[BUG] gh pr view polling causes repeated 200-500% CPU spikes when branch has no PR

Resolved 💬 5 comments Opened Mar 22, 2026 by enoodle Closed May 27, 2026

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?

Claude Code automatically polls gh pr view --json number,url,reviewDecision,isDraft,headRefName,state approximately every 60 seconds. When the current branch has no associated PR, the command fails and appears to retry aggressively, causing CPU spikes of 200-500% per invocation as observed via ps aux --sort=-%cpu.

This was observed on a git repo where the current branch (nvim) has no open PR. Every time we sampled the process list, a new gh pr view process was at the top consuming 200-500% CPU:

USER       PID %CPU  COMMAND
efreibe+ 145196  500  gh pr view --json number,url,reviewDecision,isDraft,headRefName,state
efreibe+ 142044  250  gh pr view --json number,url,reviewDecision,isDraft,headRefName,state
efreibe+ 139902  200  gh pr view --json number,url,reviewDecision,isDraft,headRefName,state

The parent PID of these processes traces back to the claude process itself. Combined with other background processes, this contributed to sustained CPU package temperatures of 97-103°C on a Dell laptop.

This polling bypasses the permission system (it's not a Bash tool invocation), cannot be disabled via any setting or environment variable, and there is no way to opt out.

What Should Happen?

  • The polling should not retry aggressively when gh pr view fails (no PR exists for the branch)
  • There should be a way to disable PR status polling entirely (e.g., CLAUDE_CODE_DISABLE_PR_POLLING=1 or a /config toggle)
  • The polling should respect the permission system or at minimum be documented as an exception

Error Messages/Logs

$ gh pr view --json number,url,state
no pull requests found for branch "nvim"

Steps to Reproduce

  1. Open a git repository where the current branch has no associated GitHub PR
  2. Start Claude Code (claude)
  3. Run ps aux --sort=-%cpu | head -10 repeatedly (e.g., every 30-60 seconds)
  4. Observe gh pr view processes spawning repeatedly at high CPU usage

Claude Model

Opus

Is this a regression?

I don't know

Claude Code Version

2.1.81 (Claude Code)

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Other

Additional Information

This was previously reported in #23580 which was auto-closed as stale without being addressed. That issue contains a detailed analysis by @bborn who reverse-engineered the minified source and found:

  • A /config toggle (prStatusFooterEnabled) exists but is gated behind a feature flag (tengu_pr_status_cli), making it inaccessible to most users
  • Two proposed fixes were suggested: making the toggle unconditional, and adding a CLAUDE_CODE_DISABLE_PR_POLLING env var

Neither fix was implemented before the issue was closed.

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗