Skip to content

fix(backend): degrade file chat on missing gateway lane - #12449

Merged
Git-on-my-level merged 1 commit into
mainfrom
codex/fix-file-chat-gateway-skew
Aug 31, 2026
Merged

Git-on-my-level merged 1 commit into
mainfrom
codex/fix-file-chat-gateway-skew

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Aug 31, 2026 •

Copy link
Copy Markdown
Member

What changed and why

File chat now treats an OpenAI-compatible 404 with the typed model_not_found code as a gateway capability-skew signal and retries the completion through the existing direct-provider kill-switch path. It records the recovery through shared fallback telemetry, while genuine provider file 404s remain typed stale-attachment failures.

Production evidence on 2026-08-30 showed the backend calling the new omi:auto:file-chat-* lanes added by #12337 while the serving gateway image still predated those lanes. Every observable llm_gateway_request_rejected ... error_class=model_not_found event matched a backend StaleChatFileError chat failure; the status-only attachment classifier had hidden the actual gateway rejection.

Product invariants affected

none

How it was verified

  • Live production logs: 21 gateway model_not_found rejections on the current backend revision matched 21 file-chat StaleChatFileError failures one-for-one by timestamp. The earlier backend revision contributed four more file-chat failures; its gateway pod logs had already rolled over.
  • cd backend && PYTHONPATH=. .venv/bin/python -m pytest -q tests/unit/test_chat_file_gateway_surface.py tests/unit/test_chat_file_completions.py — 16 passed.
  • cd backend && ./scripts/typecheck.sh — 0 errors.
  • git diff --check — passed.
  • make preflight — passed after commit against origin/main.

The fix was not deployed from this branch. Live log correlation proves the incident path; the regression suite exercises the recovery seam without sending user data or provider traffic.

Tests

backend/tests/unit/test_chat_file_gateway_surface.py now proves:

  • async streaming falls back only for a typed gateway model_not_found rejection;
  • a genuine file 404 does not fall back and remains StaleChatFileError;
  • a direct fallback that fails mid-stream records exhausted, never recovered;
  • the synchronous file-search completion path has the same compatibility behavior;
  • successful gateway routing remains gateway-only.

Failure class (fixes)

Failure-Class: FC-ship-before-required-route

Review in cubic

Failure-Class: FC-ship-before-required-route
@Git-on-my-level
Git-on-my-level merged commit 030aec9 into main Aug 31, 2026
42 of 43 checks passed
@Git-on-my-level
Git-on-my-level deleted the codex/fix-file-chat-gateway-skew branch August 31, 2026 01:18
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