Skip to content

Restore oauth-headers scrape script (fixes broken LaunchAgent / needs login)#40

Merged
BlockedPath merged 2 commits into
mainfrom
fix/restore-oauth-headers-scrape-script
May 25, 2026
Merged

Restore oauth-headers scrape script (fixes broken LaunchAgent / needs login)#40
BlockedPath merged 2 commits into
mainfrom
fix/restore-oauth-headers-scrape-script

Conversation

@BlockedPath

Copy link
Copy Markdown
Owner

What changed

Restores scripts/claude-plan-usage-oauth-headers.py to the main branch.

Why

The LaunchAgent plist (com.justin.codexmeter.claude-plan-scrape) was updated to invoke this script while feat/claude-oauth-headers-scrape was the active branch — but the script was never merged to main. After switching back to main, the LaunchAgent started failing every 15 s (exit code 2, "No such file or directory"), causing claude-plan-usage.json to go stale and the daemon to fall back to its "needs login" sentinel status.

How it was fixed

Restored the script from commit feeda27 on feat/claude-oauth-headers-scrape. Verified locally:

  • python scripts/claude-plan-usage-oauth-headers.py print returns fresh session/weekly percentages via Anthropic rate-limit headers
  • LaunchAgent restarted cleanly, claude-scrape-health.json shows ok: true
  • /health endpoint reports plan_usage.fresh: true

Reviewer notes

The script reads the Claude Code OAuth access token from the macOS Keychain (Claude Code-credentials) and POSTs a 1-token Haiku probe to api.anthropic.com/v1/messages, then parses anthropic-ratelimit-unified-* response headers. This is the same approach as feat/claude-oauth-headers-scrape; this PR just makes it available on main so the LaunchAgent doesn't break after a branch switch.

The feat/claude-oauth-headers-scrape branch can still be merged independently for any additional work it contains.

The LaunchAgent plist (com.justin.codexmeter.claude-plan-scrape) was
updated to reference claude-plan-usage-oauth-headers.py while the
feat/claude-oauth-headers-scrape branch was active, but the script was
never merged to main. After switching back to main the LaunchAgent began
failing every 15s (exit code 2) causing claude-plan-usage.json to go
stale and the daemon to fall back to "needs login".

Restored from feeda27 on feat/claude-oauth-headers-scrape. Verified
the script reads the Claude Code OAuth token from Keychain and returns
fresh session/weekly percentages via Anthropic rate-limit headers.

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

Copy link
Copy Markdown

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.

…ript

Both branches added the same file; only the mode differed (644 vs 755).
Keeping 755 to match main.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@BlockedPath
BlockedPath merged commit d1eab0b into main May 25, 2026
4 checks passed
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