Repository navigation
fix: keep nested attachment and injected-option gateway rejections classified - #21408
Git-on-my-level merged 1 commit into
Conversation
…assified Two follow-ups from review of the gateway classifier: - Nested attachment params (messages[...]....file.file_id) were rooted to messages and collapsed into invalid_messages, taking the error-level branch for an unreadable user file. The gateway now preserves a bounded attachment-specific classification (invalid_attachment / unsupported_attachment) for allowlisted attachment param suffixes. - The gateway injects reasoning_effort on the file-chat lanes, so a provider rejecting that option is a gateway-config fault: invalid/unsupported_reasoning_effort join the request-shape set and stay error-level in search_files_tool.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2c1c5fdcc9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| 'unsupported_messages', | ||
| 'unsupported_output_limit', | ||
| 'unsupported_stream', | ||
| 'unsupported_reasoning_effort', |
There was a problem hiding this comment.
Classify unsupported-value option rejections upstream
When OpenAI rejects the injected reasoning_effort value with code: "unsupported_value", _provider_rejection() recognizes only unsupported_parameter and therefore emits invalid_request or other_4xx, so this new unsupported_reasoning_effort member never matches. The file-chat boundary consequently still reports that gateway configuration fault as a soft unreadable-file warning; handle unsupported_value in the gateway classifier and cover that response shape in the provider test.
Useful? React with 👍 / 👎.
| return ( | ||
| ProviderRejection.INVALID_ATTACHMENT | ||
| if prefix == 'invalid' | ||
| else ProviderRejection.UNSUPPORTED_ATTACHMENT |
There was a problem hiding this comment.
Keep unsupported attachment shapes as configuration faults
When the selected model does not support file or image_url content parts, the provider can return unsupported_parameter with a nested attachment path. This branch now labels that as unsupported_attachment, which is deliberately absent from _REQUEST_SHAPE_PROVIDER_REJECTIONS, so search_files_tool downgrades a broken file-chat lane affecting every request to an unreadable-user-file warning. Only invalid/stale attachment values should take the soft path; unsupported attachment syntax or capability should remain error-level.
Useful? React with 👍 / 👎.
Summary
Follow-up to #21316 (merged as 80788c0): two review findings on the gateway-normalized 400 classifier landed after the merge and are addressed here.
invalid_messages(thread [PRRT_kwDOLkKqys6r4_Vf]): the gateway's_provider_rejection()rootsmessages[0].content[1].file.file_idtomessages, so an unreadable/stale user file took the error-level branch insearch_files_tooland re-entered Cloud Error Reporting as a server fault — the exact incident fix: stop reporting rejected chat files as server errors #21316 fixed. The gateway now preserves a bounded attachment-specific classification (invalid_attachment/unsupported_attachment) for allowlisted attachment param suffixes, and the soft path honors it.reasoning_effort: mediumon the file-chat lanes (llm_gateway/config/generated_route_overrides.yaml), soinvalid/unsupported_reasoning_effortis a gateway-config fault, not a bad file. Those members join the request-shape set and stay error-level.Both changes stay inside the closed, allowlisted
ProviderRejectionclassifier — no upstream body strings cross the wire.Product invariants affected
none
Test plan
backend/.venv/bin/python -m pytest tests/unit/test_chat_file_completions.py tests/unit/test_llm_gateway_openai_provider.py -q—48 passedbackend/.venv/bin/python -m pytest tests/unit/test_llm_gateway_openai_compatible.py -q—36 passedbackend/.venv/bin/python -m pytest tests/unit/test_llm_gateway_metrics.py -q—25 passedbackend/.venv/bin/python -m pytest tests/unit/test_file_tools_sanitization.py -q—4 passedFailure-Class: none