Skip to content

fix(ai-gateway): preserve terminal refresh refusals - #4667

Merged
yannickmonney merged 2 commits into
mainfrom
fix/gateway-terminal-refresh-race
Oct 9, 2026
Merged

yannickmonney merged 2 commits into
mainfrom
fix/gateway-terminal-refresh-race

Conversation

@yannickmonney

Copy link
Copy Markdown
Contributor

A late usage 401 from an older access-token generation could overwrite a concurrent terminal refresh refusal with error, causing the gateway to retry a refresh token the provider had already rejected. This keeps expired terminal state authoritative when the old usage request completes.

The PR also records the recovery and race behavior in the ai-gateway manual references.

Validation:

  • ai-gateway Vitest: 19 files, 353/353
  • focused accounts/providers/store tests: 154 passed
  • TypeScript typecheck
  • type-aware oxlint
  • manual test lint
  • git diff --check

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