Claude OAuth token expired, but background repair is suppressed when Keychain prompt policy
Claude OAuth token expired, but background repair is suppressed when Keychain prompt policy is set to only prompt on user action. Click Refresh in the CodexBar menu to retry.
I continually get this error but have set the right setting in keychain - codexbar seems to create a new entry in keychain with the wrong settng - 'confirm ... '.
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed August 2, 2026, 3:15 PM ET / 19:15 UTC.
Summary Keep this issue open for maintainer-supported diagnosis. Current main deliberately suppresses opaque delegated Claude CLI repair during background refresh when the stored policy is “Only on user action,” while preserving user-initiated repair; the remaining report that CodexBar created a Keychain item with an incorrect policy is not established without the affected item identity and an observed Refresh result.
Reproducibility: no. Current source and focused tests reproduce the intended distinction between background suppression and user-initiated recovery, but the issue lacks the Keychain service/account/access-control details and a redacted explicit-Refresh result needed to reproduce an incorrect item policy.
Ways to help us reproduce this
- Add a screenshot or short recording showing the behavior.
- Add expected vs actual behavior.
- Share version, platform, channel/provider, and relevant config details.
Maintainer decision needed
| Question | Recommendation |
|---|---|
| Should explicit Refresh remain the sole path that may invoke delegated Claude recovery under “Only on user action,” and, if the reported record is CodexBar’s own cache, what Keychain access-control behavior should that cache promise? | Preserve the current boundary and diagnose the record: Keep background repair suppressed and request the service, account, access-control details, and redacted explicit-Refresh outcome before changing any Keychain behavior. |
Why: The current implementation and documentation intentionally protect background refresh from opaque Keychain interaction; VISION.md requires sign-off for provider-auth and data-storage behavior changes, and the report does not yet identify a concrete incorrect record.
Next step Needs a maintainer decision on the auth-interaction boundary and concrete evidence identifying the purported Keychain record; a speculative repair PR could weaken the documented background-safety behavior.
Review details
Best possible solution:
Keep the current fail-closed background policy, collect the affected Keychain item’s service/account/access-control details plus a redacted explicit-Refresh result, and only change cache or recovery behavior through an approved narrow auth/storage decision.
Do we have a high-confidence way to reproduce the issue?
No. Current source and focused tests reproduce the intended distinction between background suppression and user-initiated recovery, but the issue lacks the Keychain service/account/access-control details and a redacted explicit-Refresh result needed to reproduce an incorrect item policy.
Is this the best way to solve the issue?
Unclear. The existing guard is the documented, release-shipped solution for background prompting; a change to Keychain cache or delegated recovery is not the best solution until the affected record and expected ownership are established.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
- Changing the background guard without identifying the exact Keychain item could re-enable background prompts or opaque delegated CLI interaction that the current privacy boundary intentionally prevents.
- The reported Keychain-policy mismatch may concern CodexBar’s OAuth cache, Claude Code’s credentials item, or a different Keychain record; treating those as the same storage owner could produce an unsafe fix.
Codex review notes: model internal, reasoning high; reviewed against 8cf2963c135d.
Label changes
Label justifications:
P2: The issue affects Claude OAuth recovery but current main provides a documented manual recovery path, so the present evidence does not show an urgent outage.impact:auth-provider: The report concerns expired Claude OAuth credentials, Keychain access, and delegated provider recovery.impact:ux-friction: The suppression message and unclear Keychain record add recovery confusion, but explicit Refresh andclaude loginremain available paths.
Evidence reviewed
What I checked:
- Current background guard: The delegated refresh coordinator loads the stored prompt preference rather than a reader-strategy-adjusted mode, then returns
skippedByPromptPolicyfor background work unless the mode isalways; this matches the reported suppression message and makes it intentional current behavior. (Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthDelegatedRefreshCoordinator.swift:123, 8cf2963c135d) - Documented interaction contract: The user-facing Claude documentation states that “Only on user action” is the default and reserves interactive Keychain prompts for user-initiated repair flows; it also distinguishes this preference from changing the usage source. (
docs/claude.md:49, 8cf2963c135d) - Focused policy coverage: Current tests separately cover no Claude Keychain read in background under
onlyOnUserActionand permission to read on user action, so the intended boundary is covered at the stable policy seam. (Tests/CodexBarTests/ClaudeOAuthCredentialsStorePromptPolicyTests.swift:62, 8cf2963c135d) - Keychain-write boundary remains ambiguous: Current source can write CodexBar’s own profile-scoped OAuth cache through
KeychainCacheStore, while the prompt preference itself is stored in UserDefaults. The report does not identify the Keychain service/account/access-control entry needed to determine whether it is an expected CodexBar cache item, a Claude Code item, or another item. (Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthCredentials.swift:2523, 8cf2963c135d) - Related fix and release provenance: The overlapping background-refresh safeguard was merged in commit
a27c9b094e618dfaee9ba395fe4715249ec64c0bon 2026-07-03 and is an ancestor of current main and releasev0.46.0; local history also shows follow-up work that explicitly honors the stored Claude prompt policy. (Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthDelegatedRefreshCoordinator.swift:123, a27c9b094e61) - Maturity classification unavailable: The required maturity helper was run from the checkout but could not read
qa/maturity-scores.yaml, which is absent here; no maturity label is applied. (8cf2963c135d)
Likely related people:
- Ratul Sarna: Local history identifies the original Claude Keychain prompt-policy and delegated-refresh work, including the policy introduction and follow-up interaction semantics. (role: original policy-area contributor; confidence: high; commits: 0e7da356a37f, 879294e9c220, bf170339bdb3; files:
Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthDelegatedRefreshCoordinator.swift,Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthKeychainPromptMode.swift) - Yuxin Qiao: Merged commit
a27c9b094e618dfaee9ba395fe4715249ec64c0bimplemented the related background delegated-refresh guard, and subsequent history includes a stored-prompt-policy follow-up. (role: introduced current background-repair safeguard; confidence: high; commits: a27c9b094e61, 47120d4a03b4, d686b4bdbbd7; files:Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthDelegatedRefreshCoordinator.swift,Tests/CodexBarTests/ClaudeOAuthCredentialsStorePromptPolicyTests.swift) - Peter Steinberger: Current-file blame attributes the reviewed coordinator content to the v0.46.0 release update, and local history shows repeated integration work on the active Claude path. (role: recent current-main and release contributor; confidence: medium; commits: b1170d83963d, 5b53021f1c97; files:
Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthDelegatedRefreshCoordinator.swift,docs/claude.md)
How this review workflow works
- ClawSweeper keeps one durable marker-backed review comment per issue or PR.
- Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
- A fresh review can be triggered by eligible
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch. - PR/issue authors and users with repository write access can comment
@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only. - Maintainers can also comment
@clawsweeper reviewto request a fresh review only. - Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
- Maintainer-only repair and merge flows require explicit commands such as
@clawsweeper autofix,@clawsweeper automerge,@clawsweeper fix ci, or@clawsweeper address review. - Maintainers can comment
@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.
Resolved by #2585: background repair remains prompt-safe by design under "Only on user action", while an explicit Refresh now hands expired Claude-owned credentials to the Claude CLI without reading or recreating a foreign Keychain item.