Skip to content

fix(judge): preserve provider context-limit errors - #450

Open
pcbeingused33 wants to merge 1 commit into
ifixai-ai:mainfrom
pcbeingused33:fix/c8312-judge-schema-fallback
Open

pcbeingused33 wants to merge 1 commit into
ifixai-ai:mainfrom
pcbeingused33:fix/c8312-judge-schema-fallback

Conversation

@pcbeingused33

Copy link
Copy Markdown
Contributor

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

  • Run 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.
  • The loopback judge returned a context-limit 400 on every attempt. Each of the three requests retained json_schema. The separate explicit rejection tests still exercise the downgrade to json_object.
  • ruff check ifixai, bandit -r ifixai -ll, and ifixai validate passed.

Evidence appendix rendered with render_evidence_appendix from 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:

  • context-overflow [GRADING UNAVAILABLE]: Judge input exceeds its context limit

This change was prepared with an AI coding assistant.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant