[BUG] After opening a PR, Claude Code autonomously polls (sleep + re-check loops) for CI / automated-review results without being asked

Open 💬 0 comments Opened Jun 23, 2026 by rayrraff

Summary

When asked only to create a pull request, Claude Code does not stop after the PR exists — it proactively "babysits" the PR, running repeated sleep commands interleaved with gh pr checks / gh pr view to wait for CI checks and an automated PR-review bot to finish and post comments. None of this monitoring was requested.

What happens

After gh pr create succeeds, the agent runs loops like:

sleep 45  && gh pr view <n> --json reviews ...
sleep 90  && gh pr checks <n> ...
sleep 120 && gh pr checks <n> ...   # waiting for the reviewer/CI to post

i.e. it idles in sleep + re-poll cycles purely to wait for asynchronous downstream results.

Why it's a problem

  • Wastes wall-clock time and tokens on idle waiting for work the user didn't ask for.
  • The long sleep can consume the entire Bash command timeout, so the command is killed mid-wait (e.g. a sleep 120 && <check> aborts at the 2-minute limit before the check runs).
  • It exceeds the requested scope ("open a PR" → done). Acting beyond the ask is surprising and erodes trust; users have to interrupt to stop it.

Expected behavior

When asked to open a PR (or any action whose results arrive asynchronously), the agent should complete that action and stop. Waiting on / monitoring CI or automated reviews should be opt-in — only when the user explicitly asks, or a config setting enables it. If review findings already exist at the moment the agent looks, addressing them is fine; spinning up a polling loop to wait for them to appear is not.

Reproduction (sketch)

  1. Ask Claude Code to "create a PR" for the current branch.
  2. Observe it create the PR, then, unprompted, run sleep N && gh pr checks/view repeatedly to wait for CI and a review bot.

Suggested fix

  • Treat "open a PR" as complete once the PR exists; do not auto-poll CI/reviews afterward.
  • Gate any post-PR monitoring behind an explicit user request or a config flag (e.g. a setting to enable waiting for checks).
  • Avoid using sleep to block on external async events as a default strategy.

Environment

  • Claude Code: 2.1.181
  • Platform: macOS 15.7.4

View original on GitHub ↗