Skip to content

fix: handle missing OAuth credentials on macOS (Keychain support)#5

Merged
nathanschram merged 2 commits intomasterfrom
fix/v0.23.2-macos-credentials
Feb 26, 2026
Merged

fix: handle missing OAuth credentials on macOS (Keychain support)#5
nathanschram merged 2 commits intomasterfrom
fix/v0.23.2-macos-credentials

Conversation

@nathanschram
Copy link
Contributor

Summary

  • Fix FileNotFoundError crash when ~/.claude/.credentials.json doesn't exist (macOS stores credentials in Keychain, not on disk)
  • Add macOS Keychain fallback to _read_access_token() — tries plain-text file first, then security find-generic-password -s "Claude Code-credentials" -w on darwin
  • Broaden _maybe_append_usage_footer() except clause to catch FileNotFoundError and httpx.HTTPStatusError — messages always delivered to Telegram even when usage data unavailable
  • 6 new tests covering all credential source paths
  • Bump to v0.23.2

Context

On macOS, Claude Code stores OAuth credentials in the macOS Keychain and actively deletes the plain-text .credentials.json file (anthropics/claude-code#1414). Untether's usage footer was reading only the file, crashing the post-run handler before message delivery.

Test plan

  • All 6 new tests pass (FileNotFoundError, HTTPStatusError, Keychain fallback, file-preferred, file-read, file-missing)
  • Full suite: 867 passed, 1 pre-existing failure (unrelated), 80.83% coverage
  • Ruff clean
  • Test on macOS with OAuth credentials in Keychain

🤖 Generated with Claude Code

On macOS, Claude Code stores OAuth credentials in the macOS Keychain,
not in ~/.claude/.credentials.json. The plain-text file only exists on
Linux. This caused FileNotFoundError crashes in the post-run usage
footer, preventing message delivery to Telegram.

- Add macOS Keychain fallback to _read_access_token() (tries file
  first, then `security find-generic-password` on darwin)
- Catch FileNotFoundError and httpx.HTTPStatusError in
  _maybe_append_usage_footer() so messages are always delivered
- Add 6 tests covering missing credentials, HTTP errors, Keychain
  fallback, and file-preferred-over-Keychain behaviour
- Bump version to 0.23.2

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@nathanschram nathanschram merged commit 5dc873e into master Feb 26, 2026
16 checks passed
@nathanschram nathanschram deleted the fix/v0.23.2-macos-credentials branch February 26, 2026 08:05
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