Repository navigation
fix(auth): clean OAuth contention diagnostics - #101573
Conversation
Co-authored-by: Vincent Koc <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 975b50a6f4
ℹ️ 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".
|
|
||
| ### Fixes | ||
|
|
||
| - **OAuth refresh contention diagnostics:** keep local lock paths out of user-facing refresh failures and avoid duplicate failure prefixes while preserving structured provider and profile classification. (#83383) Thanks @vincentkoc. |
There was a problem hiding this comment.
Remove the normal-fix changelog entry
The root AGENTS.md says CHANGELOG.md is release-only and should not be edited for normal PRs or direct main fixes; release-note context belongs in the PR body, squash message, or direct commit text. Since this auth diagnostic fix is not a release-generation change, adding an Unreleased entry here creates maintainer-owned release-note drift/duplicate generation work, so please drop this line and keep the credit/context in the commit/PR metadata instead.
Useful? React with 👍 / 👎.
|
Codex review: needs real behavior proof before merge. Reviewed July 7, 2026, 7:03 AM ET / 11:03 UTC. Summary PR surface: Source -1, Tests +38, Docs +1. Total +38 across 4 files. Reproducibility: yes. Source inspection of current main shows refresh_contention can be formatted through the manager cause chain and then rewrapped by the resolver; the added regression models that deterministic path without live OAuth credentials. Review metrics: 1 noteworthy metric.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Copy recommended automerge instructionNext step before merge
Security Review findings
Review detailsBest possible solution: Land the focused auth diagnostic cleanup after dropping the changelog line and preserving the final-head regression for one prefix, no lock path, and structured contention metadata. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection of current main shows refresh_contention can be formatted through the manager cause chain and then rewrapped by the resolver; the added regression models that deterministic path without live OAuth credentials. Is this the best way to solve the issue? Mostly yes. The manager/resolver diagnostic layer is the narrow maintainable fix and this branch is smaller than the older draft, but the changelog edit is not part of the best merge shape. Full review comments:
Overall correctness: patch is correct AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 16348ddec3ad. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source -1, Tests +38, Docs +1. Total +38 across 4 files. View PR surface stats
Acceptance criteria:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
Land-ready on exact head Verification:
The replay preserves structured |
|
Merged via squash.
|
Co-authored-by: Vincent Koc <[email protected]>
What Problem This Solves
OAuth refresh lock contention currently crosses two error-wrapping layers. The manager flattens the nested file-lock cause into its message, then the profile resolver surfaces the manager error itself and adds another
OAuth token refresh failedprefix. Operators can therefore see a duplicated failure prefix plus an internal local lock path andfile lock timeoutdetail.This is a focused, current-main replay of #83383. The original branch is conflicting and cannot be updated by maintainers.
Why This Change Was Made
code: "refresh_contention"andlockPathon the structured manager error for programmatic handling.OAuthRefreshFailureErrorprovider, profile, and reason classification added after the original PR was written.Contributor credit is preserved in the commit and changelog. The production diff is net-negative in lines.
User Impact
When another OpenClaw process already holds an OpenAI OAuth refresh lock, the operator now sees one actionable
refresh_contentionfailure. Local lock paths and the underlying file-lock timeout stay out of the user-facing message, while structured contention metadata remains available to code.No config, storage, provider-routing, credential, or authorization behavior changes.
Evidence
tbx_01kwy25q40ew4jxxbb54v1kmm0:pnpm test src/agents/auth-profiles/oauth.openai-codex-refresh-fallback.test.ts src/agents/auth-profiles/oauth-manager.test.ts src/agents/auth-profiles/oauth-lock-timeout-classification.test.ts— 3 files / 47 tests passed on the final formatted diff.pnpm check:changed— core, coreTests, and docs lanes passed, including production/test typechecks, lint with 0 warnings/errors, policy guards, and cycle checks.pnpm format:checkpassed for all four changed files..agents/skills/autoreview/scripts/autoreview --mode local: clean, no accepted/actionable findings; overall correctness 0.91.git diff --checkpassed.Source-blind live CLI proof was not claimed: the public auth CLI has no disposable command that creates an expired OAuth profile and holds its canonical refresh lock, and using a real provider credential is unnecessary for this deterministic diagnostic path.
Related