fix(auth): ignore stale unauthorized results after credential replacement#4565
fix(auth): ignore stale unauthorized results after credential replacement#4565yinkev wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 151d457dba
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
151d457 to
3eb4995
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3eb499525e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
3eb4995 to
7aa4541
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7aa454122b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
7aa4541 to
e0783de
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e0783de18e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
e0783de to
959ab94
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
Root cause
A same-filename re-login preserves the auth ID. An older request or refresh can finish after the replacement and previously mutate whichever credential currently occupied that ID.
Execution results now carry a one-way credential revision fingerprint. Refresh application uses credential-aware, generation-checked three-way merging:
Only stale unauthorized failures are credential-specific. Success, quota, and transient results from ordinary token rotation still apply to shared account/model state.
Credential coverage
Storage and metadata representations produce the same fingerprint material without logging or exposing tokens.
Validation
go test ./sdk/cliproxy/auth ./internal/api/handlers/management ./internal/auth/claude ./internal/auth/codex -count=1go vet ./sdk/cliproxy/auth ./internal/api/handlers/management ./internal/auth/claude ./internal/auth/codexgo build -o /tmp/pr4565-server ./cmd/servergit diff --check upstream/dev...HEADFixes #4123