fix(claude): prefer keychain credentials#483
Merged
Merged
Conversation
Avoid stale Claude credentials files shadowing valid macOS Keychain sessions. Co-authored-by: Cursor <cursoragent@cursor.com>
barramee27
pushed a commit
to barramee27/crossusage
that referenced
this pull request
May 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.credentials.jsonfile.Test plan
bun run test -- plugins/claude/plugin.test.jsCloses #444
Made with Cursor
Note
Medium Risk
Changes credential-source precedence for OAuth tokens; mis-ordering could break authentication on macOS, but the change is small and covered by regression tests.
Overview
Fixes Claude credential resolution to prefer Keychain sessions first (including hashed service names when
CLAUDE_CONFIG_DIRis set) and only fall back to~/.claude/.credentials.jsonwhen Keychain credentials are missing/invalid, preventing stale file tokens from triggering unnecessary refresh attempts.Adds a regression test for the stale-file-shadowing-Keychain scenario and updates Claude provider docs to reflect Keychain precedence, hashed service naming, and the expanded refresh
scopeincludinguser:file_upload.Reviewed by Cursor Bugbot for commit 55c5877. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by cubic
Prefer macOS Keychain Claude Code credentials over the legacy file to avoid stale tokens and failed probes. Updates provider docs and adds a regression test to lock the behavior.
Claude Code-credentials-<sha256(CLAUDE_CONFIG_DIR).slice(0, 8)>, thenClaude Code-credentials) before~/.claude/.credentials.json.user:file_upload.Written for commit 55c5877. Summary will update on new commits. Review in cubic