fabro/lib/components
Bryan Helmkamp dc46d183b0
fix(llm): classify provider error codes through one shared table
Three places translated a provider error code into a ProviderErrorKind:
error_from_status_code for HTTP error bodies, and a private table in each
of the openai_responses and anthropic_messages stream decoders. The tables
disagreed, so the same failure classified differently depending on which
path saw it.

Most visibly, OpenAI returns HTTP 429 with error.type "insufficient_quota"
when an account is out of credit. The streaming decoder mapped that to
QuotaExceeded, but the non-streaming path fell through to the plain
429 => RateLimit arm, so a spent quota was retried with backoff and never
triggered failover.

Move the code table into error.rs as kind_from_error_code, returning None
when the code says nothing so each caller keeps its own default. All three
call sites now share it.

In error_from_status_code, unambiguous statuses (401, 403, 404, 408, 413,
5xx) still win outright. A 429 defers to the code only when it reports a
spent quota. Ambiguous statuses (400, 422, ...) prefer the structured code
over the existing message-substring guessing, which now runs only when
there is no code.

Two classifications improve as a side effect of merging the tables:
not_found_error now maps to NotFound rather than Server for openai, and
request_too_large maps to ContextLength rather than InvalidRequest.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-01 09:04:36 -04:00
..
fabro-acp refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
fabro-agent Simplify stdin_source plumbing after review 2026-07-29 11:14:48 -04:00
fabro-automation refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
fabro-checkpoint refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
fabro-dump Add runtime for_each item injection 2026-07-27 11:55:55 -04:00
fabro-environment refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
fabro-github Stop requesting workflow write permission 2026-07-29 13:19:55 -04:00
fabro-graphviz Merge pull request #686 from fabro-sh/fix/space-separated-node-classes 2026-07-29 22:31:48 -04:00
fabro-hooks fix: address env interpolation review findings 2026-07-28 17:30:50 -04:00
fabro-install refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
fabro-interview refactor: remove duplicated review target rendering and validation 2026-07-28 15:14:23 -04:00
fabro-llm fix(llm): classify provider error codes through one shared table 2026-08-01 09:04:36 -04:00
fabro-manifest feat: add model-keyed fallback policies 2026-07-30 12:02:41 -04:00
fabro-mcp refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
fabro-mcp-store refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
fabro-sandbox Simplify stdin_source plumbing after review 2026-07-29 11:14:48 -04:00
fabro-slack fix: stop a pipe in a link label from splitting Slack link markup 2026-07-28 15:31:20 -04:00
fabro-store fabro(01KYQMV1VW6139EGNHEM1RGF2G): simplify_sol (succeeded) 2026-07-30 00:22:06 +00:00
fabro-tool refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
fabro-tracker refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
fabro-validate Merge remote-tracking branch 'origin/main' into feat/command-stdin-source 2026-07-29 11:37:27 -04:00
fabro-variable refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
fabro-workflow fabro(01KYQN78K19NY7PNSCDYP6CG9G): simplify_fable (succeeded) 2026-07-31 14:09:32 -04:00