Skip to content

[Bug]: watch_pull_request on a PR whose checks already passed never wakes, yet tells the agent to end its turn #40855

Closed

Description

@sol-tau

🤖 Claude Opus 5.5 writing for sol-tau

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

Real-world (GitHub, private repo, no required checks):

  1. Open a docs-only PR. CI skips most jobs and goes green in about 40 s.
  2. The agent spends a minute or two on other work (an independent review, a comment), then calls watch_pull_request on the PR. CI is already green at this point.
  3. The tool returns {"watching": true, "wasWatching": false}. Its description says "T3 wakes you on … passed required checks … After this call, end your turn", so the agent ends its turn.

Timeline (UTC): PR opened 12:57:02, last check completed 12:57:41, watch_pull_request called 12:59:00. No wake came. The user noticed the green PR and asked about it several minutes later. unwatch_pull_request then returned wasWatching: true, so the watch had been armed the whole time.

Deterministic: this is the behavior pinned by pullRequestWatch.test.ts "baselines already-passed checks". The first read after awaitingBaseline: "all" records passed: true and emits no change. Later reads of the same head also emit nothing.

Expected behavior

An agent that starts watching a PR whose checks already passed should learn that, either:

  • in the watch_pull_request result (for example checks: "passed" plus a note such as "Checks already passed on ; no wake will come for them"), the way the tool already answers "This PR is already merged/closed, so there is nothing to watch"; or
  • through one wake on the baseline read when the gate has already settled.

Actual behavior

The baseline read hides the pass, and the tool result does not mention check state. The agent follows the tool description, ends its turn, and waits forever on a PR that is ready. Docs-only and other short-CI PRs hit this often, because CI finishes before the agent gets to the watch call. Across one user's sessions this has been the cause of several "it's green, why are you still waiting?" corrections.

Impact

Major degradation or frequent failure

Version or commit

0.1.12-nightly.20261122.5085 (desktop, Linux). Code read at main b23f1e8.

Environment

Linux (Arch), T3 desktop, Claude provider (Claude Opus 5.5). GitHub, private repository on GitHub Free, so branch protection and required checks are unavailable and the gate is every check (pullRequestWatch.ts:134).

Logs or stack traces

# watch call result
{"host":"github.com","repository":"<org>/<repo>","number":<n>,"url":"…/pull/<n>","watching":true,"wasWatching":false}
# gh pr view --json statusCheckRollup at 13:02 UTC: all 8 checks COMPLETED (2 SUCCESS, 6 SKIPPED), latest completedAt 12:57:41Z
# unwatch at 13:03 UTC
{"watching":false,"wasWatching":true}

Code pointers (main @ b23f1e8):

  • apps/server/src/orchestration-v2/pullRequestWatch.ts:156-159: checks-passed is pushed only when !checksBaseline.
  • apps/server/src/orchestration-v2/Orchestrator.ts:5372-5374: a fresh watch starts with awaitingBaseline: "all".
  • apps/server/src/mcp/toolkits/pullRequests/tools.ts:402: the description tells the agent to end its turn after the call. :271 already handles the merged/closed case with a "nothing to watch" message.

Workaround

Before ending the turn, the agent runs gh pr checks <pr> and acts if everything has finished. We enforce this locally with a Claude Code Stop hook: it reads the transcript for PRs that were watched and not unwatched, asks gh pr view --json statusCheckRollup, and blocks the stop once if an open PR's checks have all finished.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions