(MOT-4414) fix(llm-router): make failures actionable - #790
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
skill-check — worker0 verified, 58 skipped (no docs/).
Four for four. Nicely done. |
What
RouterFailureenvelope withrouter/*codes, retryability, provider/model context, and attempt count.failure_mode: "structured"semantics so pre-stream failures produce one terminal error frame and the same unsuccessful direct response.Why
Router failures were split across thrown errors, compatibility strings, and terminal frames. Callers had to infer whether a failure was retryable, operators could not distinguish setup states, and raw provider response bodies could leak into public error paths. This change gives each layer one explicit contract while preserving the legacy throw mode for callers that have not opted in.
New error contract
With
failure_mode: "structured", a model that cannot be routed returns one terminal error frame and the same failure in the direct response:{ "ok": false, "provider": "", "model": "gpt-5", "stop_reason": "error", "error": { "code": "router/no_provider_for_model", "message": "no provider registered for model gpt-5" }, "failure": { "code": "router/no_provider_for_model", "kind": "permanent", "message": "no provider registered for model gpt-5", "retryable": false, "model": "gpt-5", "attempts": 0 } }Provider-facing messages are bounded and actionable while raw response bodies and credential material remain in provider-local logs:
openai authentication failed (HTTP 401); refresh credentialsopenai rate limit reached (HTTP 429); retry lateropenai is temporarily unavailable (HTTP 503)openai request failed before a response; inspect provider logsopenai returned an invalid response; inspect provider logsopenai model discovery failed; inspect provider logsExisting callers retain the legacy
{ code, message }throw behavior until they opt into structured failures.Verification
cargo clippy --all-targets --all-features -- -D warningsinllm-routerandharnesscargo test --all-featuresinllm-routerandharnesscargo test --all-featuresacross all 11 provider workersnpm --prefix llm-router/ui testnpm --prefix llm-router/ui run buildcargo check --manifest-path context-manager/Cargo.tomlnpm --prefix console/web run typecheckcargo fmt --all -- --checkfor every touched Rust workergit diff --checkFixes MOT-4414