fix: keep nested attachment and injected-option gateway rejections classified
Merged
GI
4d ago+81+81+01234567890123456789-2-2-0123456789
Summary
Follow-up to #21316 (merged as 80788c026f): two review findings on the gateway-normalized 400 classifier landed after the merge and are addressed here.
- Nested attachment rejections collapsed to
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 #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. - Gateway-injected option rejections downgraded (thread [PRRT_kwDOLkKqys6r4_Vs]): the gateway injects
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 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