[BUG] Git push through the SDK's git proxy fan-outs into ~500 GitHub REST API calls, exhausting the 5,000/hour budget after a handful of pushes
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
What I observed
I noticed my GitHub API budget was being eaten unexpectedly during normal Claude Code work, and built a per-minute monitor (gh api rate_limit every 60s) to find the source. After ruling out stale subscribe_pr_activity subscriptions (which were a separate real issue — that fix worked, see below), the remaining drain lined up exactly with git push calls.
A single wave consisting of: write 2 files locally → git commit → git push origin <branch> produced this trace:
17:02:39 remaining: 2344 used: 0/min [idle] ← before wave
17:03:40 remaining: 2225 used: 119/min [HEAVY] ← turn-start
17:05:41 remaining: 2076 used: 149/min [HEAVY] ← git push begins
17:06:41 remaining: 1903 used: 173/min [HEAVY] ← fan-out
17:07:42 remaining: 1756 used: 147/min [HEAVY] ← fan-out
17:08:42 remaining: 1607 used: 149/min [HEAVY] ← fan-out
17:09:42 remaining: 1607 used: 0/min [idle] ← settled
Total cost: ~737 REST calls for one push. That's ~15% of the 5,000/hour budget per wave.
Hypothesis
The Agent SDK forwards git push through a local git proxy at http://127.0.0.1:36031/. A native git push to github.com uses the smart-HTTP git protocol — one HTTPS request, zero REST API hits. The proxy appears to additionally hit the REST/GraphQL API to fetch refs, validate state, refresh PR metadata, etc. on every push.
Why it matters
5,000/hour budget is shared across all Claude Code sessions, gh CLI invocations, and IDE extensions on the same OAuth token.
At ~737 calls/push, you can do ~6 pushes/hour before exhausting the budget — and then gh auth itself breaks with "GraphQL: API rate limit already exceeded", locking the user out of their own terminal.
For autopilot-style workflows (one wave = one push), this is a hard ceiling.
Expected behavior
A git push should cost a small bounded number of REST calls (ideally zero — git already has its own protocol), not ~500.
Reproduce
Make a trivial commit on a branch in a cloud Claude Code session
git push -u origin <branch> through the SDK's git proxy
Watch gh api rate_limit for the next 3-4 minutes — remaining drops ~500
Tangentially related (already self-fixed)
In the same investigation I also found that subscribe_pr_activity subscriptions survive /compact and keep polling at ~150 calls/min indefinitely until you explicitly unsubscribe_pr_activity or end the session. A stale subscription on a merged PR can drain the budget on its own. Not a bug per se — the tool description says to unsubscribe on merge — but it's an easy footgun. Maybe worth either (a) auto-unsubscribing when the PR closes, or (b) loudly surfacing active subscriptions in the session status.
Environment
Cloud Claude Code session (claude.ai/code)
Branch: feature branch on a small repo
Model: Claude Opus 4.7
What Should Happen?
A git push should cost a small bounded number of REST calls (ideally zero — git already has its own protocol), not ~500.
Error Messages/Logs
Here is the log for Git API requests:
16:59:38 remaining: 2694 / 5000 used: 208 in 61s → 204.6 calls/min [HEAVY]
17:00:38 remaining: 2519 / 5000 used: 175 in 60s → 175.0 calls/min [HEAVY]
17:01:39 remaining: 2344 / 5000 used: 175 in 61s → 172.1 calls/min [HEAVY]
17:02:39 remaining: 2344 / 5000 used: 0 in 60s → 0.0 calls/min [idle]
17:03:40 remaining: 2225 / 5000 used: 119 in 61s → 117.0 calls/min [HEAVY]
17:04:40 remaining: 2225 / 5000 used: 0 in 60s → 0.0 calls/min [idle]
17:05:41 remaining: 2076 / 5000 used: 149 in 61s → 146.6 calls/min [HEAVY]
17:06:41 remaining: 1903 / 5000 used: 173 in 60s → 173.0 calls/min [HEAVY]
17:07:42 remaining: 1756 / 5000 used: 147 in 61s → 144.6 calls/min [HEAVY]
17:08:42 remaining: 1607 / 5000 used: 149 in 60s → 149.0 calls/min [HEAVY]
17:09:42 remaining: 1607 / 5000 used: 0 in 60s → 0.0 calls/min [idle]
17:10:43 remaining: 1607 / 5000 used: 0 in 61s → 0.0 calls/min [idle]
17:11:44 remaining: 1485 / 5000 used: 122 in 61s → 120.0 calls/min [HEAVY]
17:12:44 remaining: 1283 / 5000 used: 202 in 60s → 202.0 calls/min [HEAVY]
17:13:45 remaining: 1165 / 5000 used: 118 in 61s → 116.1 calls/min [HEAVY]
17:14:46 remaining: 1165 / 5000 used: 0 in 61s → 0.0 calls/min [idle]
17:15:46 remaining: 1165 / 5000 used: 0 in 60s → 0.0 calls/min [idle]
17:16:47 remaining: 1165 / 5000 used: 0 in 61s → 0.0 calls/min [idle]
17:17:47 remaining: 1165 / 5000 used: 0 in 60s → 0.0 calls/min [idle]
17:18:48 remaining: 1078 / 5000 used: 87 in 61s → 85.6 calls/min [HEAVY]
17:19:48 remaining: 907 / 5000 used: 171 in 60s → 171.0 calls/min [HEAVY]
17:20:49 remaining: 737 / 5000 used: 170 in 61s → 167.2 calls/min [HEAVY]
17:21:49 remaining: 588 / 5000 used: 149 in 60s → 149.0 calls/min [HEAVY]
17:22:50 remaining: 472 / 5000 used: 116 in 61s → 114.1 calls/min [HEAVY]
17:23:50 remaining: 472 / 5000 used: 0 in 60s → 0.0 calls/min [idle]
17:24:51 remaining: 429 / 5000 used: 43 in 61s → 42.3 calls/min [HEAVY]
Steps to Reproduce
Make a trivial commit on a branch in a cloud Claude Code session
git push -u origin <branch> through the SDK's git proxy
Watch gh api rate_limit for the next 3-4 minutes — remaining drops ~500
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
Claude 1.9255.2 (1dc8f7) 2026-05-27T01:57:20.000Z
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗