Skip to content

refactor(aibridge): clean up keypool and provider error handling#25609

Open
ssncferreira wants to merge 1 commit into
mainfrom
ssncf/aibridge-keypool-error
Open

refactor(aibridge): clean up keypool and provider error handling#25609
ssncferreira wants to merge 1 commit into
mainfrom
ssncf/aibridge-keypool-error

Conversation

@ssncferreira
Copy link
Copy Markdown
Contributor

@ssncferreira ssncferreira commented May 22, 2026

Description

Cleans up how key pool errors are represented and how they get turned into HTTP responses. Consolidates two error types into a single type with a kind tag, and gives the response helpers in both providers consistent names.

Changes

  • Replaced the keypool sentinel and transient error struct with one error type that carries a kind and a retry-after duration.
  • Updated KeyFailoverConfig.BuildKeyPoolResponse to take the typed key pool error, so each provider can shape the exhaustion response in its own format.
  • Removed the per-provider MarkKey callback from KeyFailoverConfig since providers can rely on the shared MarkKeyOnStatus helper.
  • Renamed the response-error helpers so OpenAI and Anthropic use the same naming.

Related to: https://linear.app/codercom/issue/AIGOV-334/aibridge-follow-ups-from-key-failover-prs

Note

Initially generated by Claude Opus 4.7, modified and reviewed by @ssncferreira

Copy link
Copy Markdown
Contributor Author

ssncferreira commented May 22, 2026

@ssncferreira ssncferreira force-pushed the ssncf/aibridge-keypool-error branch 2 times, most recently from dc74869 to eb01e92 Compare May 22, 2026 11:38
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