Skip to content

fix: keep nested attachment and injected-option gateway rejections classified - #21408

Merged
Git-on-my-level merged 1 commit into
mainfrom
fix/errfix-1012-gcp-chat-file-py-150-utils-other-chat-fi
Oct 13, 2026
Merged

Git-on-my-level merged 1 commit into
mainfrom
fix/errfix-1012-gcp-chat-file-py-150-utils-other-chat-fi

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

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.

  1. Nested attachment rejections collapsed to invalid_messages (thread [PRRT_kwDOLkKqys6r4_Vf]): the gateway's _provider_rejection() roots messages[0].content[1].file.file_id to messages, so an unreadable/stale user file took the error-level branch in search_files_tool and 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.
  2. Gateway-injected option rejections downgraded (thread [PRRT_kwDOLkKqys6r4_Vs]): the gateway injects reasoning_effort: medium on the file-chat lanes (llm_gateway/config/generated_route_overrides.yaml), so invalid/unsupported_reasoning_effort is 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 ProviderRejection classifier — 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 passed
  • backend/.venv/bin/python -m pytest tests/unit/test_llm_gateway_openai_compatible.py -q — 36 passed
  • backend/.venv/bin/python -m pytest tests/unit/test_llm_gateway_metrics.py -q — 25 passed
  • backend/.venv/bin/python -m pytest tests/unit/test_file_tools_sanitization.py -q — 4 passed

Failure-Class: none

View guided diff Turn on auto-fix

…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.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T14:12:14.005285Z 2c1c5fd PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@Git-on-my-level
Git-on-my-level merged commit 383cd24 into main Oct 13, 2026
62 checks passed
@Git-on-my-level
Git-on-my-level deleted the fix/errfix-1012-gcp-chat-file-py-150-utils-other-chat-fi branch October 13, 2026 15:44
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