Repository navigation
fix(judge): preserve provider context-limit errors - #450
Open
pcbeingused33 wants to merge 1 commit into
Open
pcbeingused33 wants to merge 1 commit into
pcbeingused33 wants to merge 1 commit into
Conversation
pcbeingused33
requested review from
Sebabaian,
dimneo,
n-papaioannou and
stefyi-4355
as code owners
December 2, 2026 13:03
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related to #423.
When an OpenAI-compatible provider returns HTTP 400 because the request exceeds the model's context window, the completion helper reports a strict-schema refusal, although its docstring says context overflow propagates unchanged. The judge then logs "Judge provider refused a strict verdict request; retrying it in plain JSON mode" and sends the same messages in JSON mode, which still exceeds the limit. The warning points at schema support instead of the prompt size, and the retry costs one more judge call.
Propagate context-limit errors before adapting request parameters. This preserves the provider's diagnostic and lets the judge apply its normal transport retry policy. An explicit schema rejection still triggers the JSON-mode fallback.
Test plan
python -m pytest -q ifixai/tests/providers/test_openai_parameter_fallback.py ifixai/tests/providers/test_schema_500_not_rejection.py ifixai/tests/test_one_judge_pass.py. With the regression tests applied to the base revision, four failed and 152 passed. With the fix, all 156 passed.json_schema. The separate explicit rejection tests still exercise the downgrade tojson_object.ruff check ifixai,bandit -r ifixai -ll, andifixai validatepassed.Evidence appendix rendered with
render_evidence_appendixfrom the loopback judge result above (V09, with a hand-built evidence item for the overflowing probe). The final status is the same before and after the fix; the difference is the request format and the log:This change was prepared with an AI coding assistant.