Repository navigation
fix(codex): keep streamed Gemini argument errors request scoped - #2904
Merged
jlcodes99 merged 1 commit intoOct 27, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Treat the observed streamed Gemini rejection
Request contains an invalid argument.as request-scoped when it reaches the gateway as a 5xx failure without authentication metadata.Problem
An upstream Gemini stream can return HTTP 200, then emit an error containing only:
{"type":"error","error":{"message":"Request contains an invalid argument."}}Cockpit reports this as a gateway 502. Because the envelope has no usable request-error code, the existing classifier treats it as an account failure and applies a model cooldown. Subsequent retries can exhaust the available routes and replace the original request error with
No compatible account is available for this model.Change
This change is independent of the tool-identity fix in #2901, account-model routing in #2902, and the upstream Argon continuation repair in router-for-me/CLIProxyAPI#6935.
Validation
cargo test --manifest-path src-tauri/Cargo.toml --lib upstream_errors::testscargo test --manifest-path src-tauri/Cargo.toml --lib native_connection_failures_do_not_cool_accounts_or_shorten_existing_cooldowncargo test --manifest-path src-tauri/Cargo.toml --lib native_actual_upstream_failures_keep_auth_quota_and_server_cooldownsrustfmt --check --edition 2021on the two changed Rust filesgit diff --checkRegression coverage includes streamed error observation, unchanged failure status/message, skipped account cooldowns, and preserved authentication/quota/server cooldown behavior. Tests use synthetic fixtures; no private request logs or credentials are included.