Skip to content

fix: expose typed provider failure details in errors - #246

Merged
danielkov merged 1 commit into
mainfrom
fix/expose-provider-errors
Oct 13, 2026
Merged

danielkov merged 1 commit into
mainfrom
fix/expose-provider-errors

Conversation

@danielkov

Copy link
Copy Markdown
Contributor

Typed provider failures (LoopError::ProviderFailure) already carry sanitized, payload-free data: failure reason, last attempt reason, HTTP status, allowlisted upstream type/code, and attempt count. Kit threw all of it away. The fatal record and the error surfaced to ACP/prompt clients both collapsed it to provider request failed.

That hid the ChatGPT backend's 401s during today's outage, where every Codex request failed with invalid_api_key. The error log recorded only provider_error, so diagnosing it took a live reproduction.

Changes in src/fatal.rs:

  • The fatal record code is now the failure reason (http_status, authentication, retry_exhausted, …) instead of the generic provider_error.
  • The message and the rendered client error include the status, the upstream classification when it's known, and the attempt count, for example:
    • provider request failed: http_status (HTTP 401, invalid_request_error/invalid_api_key, attempts: 2)
    • provider request failed: retry_exhausted after http_status (HTTP 503, attempts: 12)

Every field comes from agentkit's allowlisted enums, so no response bodies, URLs, or credentials reach the log. Legacy string errors and cancellation behave as before.

Follow-up in agentkit: the HTTP non-2xx path sets only http_status and doesn't parse the body's error.type/error.code into the allowlisted kinds, so HTTP 401s still show only the status. The WebSocket and SSE response.failed paths already classify them.

@danielkov
danielkov enabled auto-merge (squash) October 13, 2026 10:59
Typed agentkit provider failures already carry a sanitized reason, HTTP
status, allowlisted upstream error type/code and attempt count, but the
fatal log and the ACP/prompt error text collapsed them into a bare
"provider request failed". Render those fields and use the failure
reason as the fatal record code.
@danielkov
danielkov force-pushed the fix/expose-provider-errors branch from 2da87b4 to de2006b Compare October 13, 2026 11:03

@kit-code-agent kit-code-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found. The changes look good to merge.

@danielkov
danielkov merged commit a58564e into main Oct 13, 2026
5 checks passed
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