Skip to content

fix(server): watch_pull_request says when checks already passed - #40866

Merged
juliusmarminge merged 2 commits into
mainfrom
factory/issue-40855
Nov 22, 2026
Merged

juliusmarminge merged 2 commits into
mainfrom
factory/issue-40855

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

When an agent started watching a pull request whose checks had already passed, watch_pull_request didn't say so. The watch never wakes for checks that passed before it started, and the tool tells the agent to end its turn, so the agent sat waiting on a green PR. The result now reports the check state seen when the watch started, and tells the agent to act now when checks already pass.

  • PullRequestWatchService.setWatching returns the checksState from the read it already does when a watch starts.
  • WatchPullRequestResult gains an optional checksState. When it is passing, the result adds a next note saying no wake will come for those checks.

Fixes #40855

Reproduction on main

Commit b23f1e8 (origin/main). Ran an isolated server (t3 serve --base-dir <scratch> --port 38555, fresh database) with a tiny git project whose origin is pingdotgg/t3code, and the OpenCode provider enabled. PR #40645 was open with all 35 check runs completed and none failing. At 13:31:10 UTC: t3 thread start --provider opencode --model opencode/big-pickle --wait . "Call the T3 tool watch_pull_request with url https://github.com/pingdotgg/t3code/pull/40645 ...". The tool returned {"host":"github.com","repository":"pingdotgg/t3code","number":40645,"url":"…/pull/40645","watching":true,"wasWatching":false}, with no check state. Stored events: 13:31:22 thread.pull-request-synced (watch started, awaitingBaseline 'all'); 13:31:26 thread.pull-request-link-updated with headSha e66b677, passed: true, passedChecks of all 8 checks, checksPending: false, wakes: 0, awaitingBaseline cleared. Waited through two sweeps to 13:36:57: no further pull-request events, t3 thread show still reports runCount 1, watching true and a pending 'Watching pull request #40645' monitor. So the thread was never woken. Unit repro: the new test in apps/server/src/pullRequest/PullRequestWatchService.test.ts fails on main because setWatching's result has no checksState when the start read sees 'passing'.

Evidence

Started isolated real servers on both commits with synthetic projects and OpenCode. Called watch_pull_request on #40645, whose 35 checks were completed without failures. Base omitted the already-passing state and stored it as the baseline with zero wakes. Head immediately returned checksState: "passing" and told the agent no wake would come for those checks. Real OpenCode turns reported the same respective results.

Before After
b23f1e8af9 c8c420b6da
Before: passing check state omitted After: passing state and no-wake guidance returned
Before recording After recording
Before runtime transcript After runtime transcript

Reproduction and capture drivers. Captures show real terminal output, not web UI. Both use Linux, isolated state, identical viewport and theme. The longer base observation was interrupted by a server stop and resumed after restart; it does not establish an uninterrupted six-minute wait.

Not shown:

  • An uninterrupted six-minute/two-sweep observation was not completed: the base server received an unexpected interrupt at 14:08:21 UTC and was restarted. The missing initial result, cleared passing baseline with zero wakes, and completed agent reply were directly observed.
  • Later-change wake behavior was not exercised; the verified fix is immediate disclosure of already-passing checks.

Tests

  • vp test run src/pullRequest/PullRequestWatchService.test.ts src/mcp/McpHttpServer.test.ts (apps/server): 49 passed
  • The same watch-service test file with the fix removed: the repro test fails (1 failed, 5 passed)
  • vp run typecheck (apps/server): exit 0
  • vp run check:changed: format, lint, knip, graphql, typecheck (3 packages) and tests (3 files) pass
  • PR CI on c8c420b: all 38 checks passed

Not in this change

  • A watch started with until: "checks" on a PR whose checks already pass stays registered rather than ending at once; changing that is a behaviour change beyond reporting the state.
  • The watch_pull_request tool description still says 'After this call, end your turn' without mentioning the next note; the result's next overrides it per call.
  • evals/mcp-tool-use has no case for the new next note and was not run.

Who did the work

  • Written by Claude Opus 5.5, in Claude Code
  • Reviewed by GPT-6.1 Sol, in Codex, and by Claude Opus 5.5, each on its own
  • Proof captured by GPT-6.1 Sol and checked by Claude Opus 5.5

Run by the t3code factory in T3 Code.

juliusmarminge and others added 2 commits November 22, 2026 13:28
…says so

Repro for #40855: the start read sees passing checks, the baseline read
records them silently, and the result never mentions it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A watch started on a PR whose checks already pass never wakes for them,
yet the tool told the agent to end its turn. setWatching now returns the
start read's checksState, and the MCP result adds a next note when it is
passing so the agent acts instead of waiting.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Nov 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅
Codex Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Codex Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅
Codex Live turn WebSocket decoded 21.5 KiB 21.5 KiB 0 B (0.0%) 24.4 KiB ✅
Codex Live turn messages 1 1 0 (0.0%) 8 ✅
Claude Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅
Claude Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Claude Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅
Claude Live turn WebSocket decoded 21.9 KiB 21.9 KiB 0 B (0.0%) 24.4 KiB ✅
Claude Live turn messages 1 1 0 (0.0%) 8 ✅

Other scenarios

All 64 scenario measurements match main.

All 64 scenario measurements
Provider Scenario Metric Main baseline This PR Impact PR ceiling
Codex short turn resume WebSocket decoded 10.5 KiB 10.5 KiB 0 B (0.0%) 12.7 KiB ✅
Codex short turn resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex long turn running, cold open HTTP decoded 281.7 KiB 281.7 KiB 0 B (0.0%) 302.7 KiB ✅
Codex long turn running, cold open rows 75 75 0 (0.0%) 75 ✅
Codex long turn running, history page HTTP decoded 92.4 KiB 92.4 KiB 0 B (0.0%) 107.4 KiB ✅
Codex long turn running, history page rows 75 75 0 (0.0%) 75 ✅
Codex long turn finished, cold open HTTP decoded 381.5 KiB 381.5 KiB 0 B (0.0%) 410.2 KiB ✅
Codex long turn finished, cold open rows 151 151 0 (0.0%) 151 ✅
Codex long turn finished, socket cold open WebSocket decoded 381.6 KiB 381.6 KiB 0 B (0.0%) 410.2 KiB ✅
Codex long turn finished, socket cold open WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex long turn finished, socket cold open rows 151 151 0 (0.0%) 151 ✅
Codex long turn finished, work page HTTP decoded 186.2 KiB 186.2 KiB 0 B (0.0%) 200.2 KiB ✅
Codex long turn finished, work page rows 150 150 0 (0.0%) 150 ✅
Codex idle thread resume WebSocket decoded 65 B 65 B 0 B (0.0%) 200 B ✅
Codex idle thread resume WebSocket messages 1 1 0 (0.0%) 1 ✅
Codex fleet shell snapshot HTTP decoded 42.4 KiB 42.4 KiB 0 B (0.0%) 53.7 KiB ✅
Codex fleet shell snapshot rows 27 27 0 (0.0%) 27 ✅
Codex fleet shell subscribe WebSocket decoded 65 B 65 B 0 B (0.0%) 200 B ✅
Codex fleet shell subscribe WebSocket messages 1 1 0 (0.0%) 1 ✅
Codex fleet shell resume check HTTP decoded 18 B 18 B 0 B (0.0%) 100 B ✅
Codex fleet shell resume check rows 0 0 0 0 ✅
Codex stale shell reload HTTP decoded 42.4 KiB 42.4 KiB 0 B (0.0%) 53.7 KiB ✅
Codex stale shell reload rows 27 27 0 (0.0%) 27 ✅
Codex stale shell resume WebSocket decoded 140 B 140 B 0 B (0.0%) 400 B ✅
Codex stale shell resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex stale todo list cold open HTTP decoded 72.4 KiB 72.4 KiB 0 B (0.0%) 83.0 KiB ✅
Codex stale todo list cold open rows 75 75 0 (0.0%) 75 ✅
Codex stale todo list cold open nodes 2 2 0 (0.0%) 4 ✅
Codex stale todo list cold open subagents 2 2 0 (0.0%) 4 ✅
Codex stale todo list cold open plans 1 1 0 (0.0%) 2 ✅
Codex stale todo list cold open providerTurns 1 1 0 (0.0%) 2 ✅
Codex stale todo list cold open checkpoints 1 1 0 (0.0%) 2 ✅
Claude short turn resume WebSocket decoded 10.6 KiB 10.6 KiB 0 B (0.0%) 12.7 KiB ✅
Claude short turn resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude long turn running, cold open HTTP decoded 283.3 KiB 283.3 KiB 0 B (0.0%) 302.7 KiB ✅
Claude long turn running, cold open rows 75 75 0 (0.0%) 75 ✅
Claude long turn running, history page HTTP decoded 93.4 KiB 93.4 KiB 0 B (0.0%) 107.4 KiB ✅
Claude long turn running, history page rows 75 75 0 (0.0%) 75 ✅
Claude long turn finished, cold open HTTP decoded 384.2 KiB 384.2 KiB 0 B (0.0%) 410.2 KiB ✅
Claude long turn finished, cold open rows 151 151 0 (0.0%) 151 ✅
Claude long turn finished, socket cold open WebSocket decoded 384.3 KiB 384.3 KiB 0 B (0.0%) 410.2 KiB ✅
Claude long turn finished, socket cold open WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude long turn finished, socket cold open rows 151 151 0 (0.0%) 151 ✅
Claude long turn finished, work page HTTP decoded 188.1 KiB 188.1 KiB 0 B (0.0%) 200.2 KiB ✅
Claude long turn finished, work page rows 150 150 0 (0.0%) 150 ✅
Claude idle thread resume WebSocket decoded 66 B 66 B 0 B (0.0%) 200 B ✅
Claude idle thread resume WebSocket messages 1 1 0 (0.0%) 1 ✅
Claude fleet shell snapshot HTTP decoded 43.0 KiB 43.0 KiB 0 B (0.0%) 53.7 KiB ✅
Claude fleet shell snapshot rows 27 27 0 (0.0%) 27 ✅
Claude fleet shell subscribe WebSocket decoded 66 B 66 B 0 B (0.0%) 200 B ✅
Claude fleet shell subscribe WebSocket messages 1 1 0 (0.0%) 1 ✅
Claude fleet shell resume check HTTP decoded 18 B 18 B 0 B (0.0%) 100 B ✅
Claude fleet shell resume check rows 0 0 0 0 ✅
Claude stale shell reload HTTP decoded 43.0 KiB 43.0 KiB 0 B (0.0%) 53.7 KiB ✅
Claude stale shell reload rows 27 27 0 (0.0%) 27 ✅
Claude stale shell resume WebSocket decoded 140 B 140 B 0 B (0.0%) 400 B ✅
Claude stale shell resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude stale todo list cold open HTTP decoded 73.4 KiB 73.4 KiB 0 B (0.0%) 83.0 KiB ✅
Claude stale todo list cold open rows 75 75 0 (0.0%) 75 ✅
Claude stale todo list cold open nodes 2 2 0 (0.0%) 4 ✅
Claude stale todo list cold open subagents 2 2 0 (0.0%) 4 ✅
Claude stale todo list cold open plans 1 1 0 (0.0%) 2 ✅
Claude stale todo list cold open providerTurns 1 1 0 (0.0%) 2 ✅
Claude stale todo list cold open checkpoints 1 1 0 (0.0%) 2 ✅

Baseline: 620cf47 · PR result: c8c420b · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 108.5 KiB
  • Claude decoded thread snapshot: 108.8 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The pull request watch service now returns the checks state observed at the start of a watch. When that state is passing, the MCP result includes a message that those checks will not trigger a wake.

Changes: Pull request watch result

Layer / File(s) Summary
Capture and return initial checks state
apps/server/src/pullRequest/PullRequestWatchService.ts, apps/server/src/pullRequest/PullRequestWatchService.test.ts
setWatching returns the checks state from its initial read when available. A test checks the response for an unlinked pull request with passing checks.
Report already-passing checks
apps/server/src/mcp/toolkits/pullRequests/tools.ts, apps/server/src/mcp/toolkits/pullRequests/handlers.ts
The result schema adds checksState and a message for passing checks. When no ended-watch state is present and checks are passing, the handler returns that message.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Possibly related PRs

Suggested labels: bugfix

Suggested reviewers: macroscopeapp

Merge Risk: Minimal · up to c8c42

Watches that start after checks have already passed now tell the agent so, which fixes the case in the linked issue. The change is small and backward-compatible, so I see no remaining merge risk.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(server): watch_pull_request says when checks already passed" matches the main change. The PR makes watch_pull_request report the check state seen at watch start, and adds a next note wh…
Linked Issues check Passed [#40855] The issue asks that an agent starting a watch on a PR with already-passed checks learns that in the watch_pull_request result, or through a wake on the baseline read. The PR uses the result p…
Out of Scope Changes check Passed All code changes fall within the watch-result path named by #40855: the PullRequestWatchService return value, the WatchPullRequestResult schema, the watch_pull_request handler mapping, and a unit test…
Description check Passed The description follows the repository template closely. It has a clear Problem (the agent sat waiting on an already-green PR because watch_pull_request did not report the passing check state), a Chan…
Full details: Title check

Explanation

The title "fix(server): watch_pull_request says when checks already passed" matches the main change. The PR makes watch_pull_request report the check state seen at watch start, and adds a next note when checks already pass. It is a conventional commit title in plain language, and it names the affected tool and scope.

Full details: Linked Issues check

Explanation

[#40855] The issue asks that an agent starting a watch on a PR with already-passed checks learns that in the watch_pull_request result, or through a wake on the baseline read. The PR uses the result path. PullRequestWatchService.setWatching (apps/server/src/pullRequest/PullRequestWatchService.ts) reads the checks state from the start read and returns it as checksState when a new watch starts. The handler in apps/server/src/mcp/toolkits/pullRequests/handlers.ts maps checksState === "passing" to next: CHECKS_ALREADY_PASSED_WATCH_NEXT, and the state-based merged/closed branch is kept. WatchPullRequestResult gains an optional checksState in tools.ts. The issue asks for no change to watch registration, and the PR makes none. The added unit test covers the passing case. Verified by reading the service and handler files at head. The handler diff could not be read, so the exact text of CHECKS_ALREADY_PASSED_WATCH_NEXT in tools.ts comes from the summary only.

Full details: Out of Scope Changes check

Explanation

All code changes fall within the watch-result path named by #40855: the PullRequestWatchService return value, the WatchPullRequestResult schema, the watch_pull_request handler mapping, and a unit test for the passing case. The PR description lists the unchanged tool description, the absent evals case, and the unchanged until: "checks" behavior as deferred, not as added changes. The pending real-app evidence section is documentation of validation, not a code change. No unrelated change was found in the evidence read.

Full details: Description check

Explanation

The description follows the repository template closely. It has a clear Problem (the agent sat waiting on an already-green PR because watch_pull_request did not report the passing check state), a Change section that explains the setWatching and WatchPullRequestResult updates, a Scope section that links issue #40855 as the bug, and a detailed Verification section with a before/after reproduction, specific test commands with results, typecheck and CI status, and captured evidence. It also lists what was not verified and names the model and harness. Minor gaps: the Scope section says the issue is linked but the bug link is in a single line at the end, and the evidence links are external and the uninterrupted six-minute observation was not completed. These are non-critical, so the description is mostly complete.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 620cf47 and c8c420b.

Files selected for processing: 4

  • apps/server/src/mcp/toolkits/pullRequests/handlers.ts
  • apps/server/src/mcp/toolkits/pullRequests/tools.ts
  • apps/server/src/pullRequest/PullRequestWatchService.test.ts
  • apps/server/src/pullRequest/PullRequestWatchService.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

@juliusmarminge
juliusmarminge merged commit ad2bdc7 into main Nov 22, 2026
39 checks passed
@juliusmarminge
juliusmarminge deleted the factory/issue-40855 branch November 22, 2026 14:14
github-actions Bot added a commit to omarcresp/t3code-flake that referenced this pull request Nov 22, 2026
**v0.1.12-nightly.20261122.5111** · 30 changes from 10 contributors

- **Multi-file diffs.** Open diff now shows every file in a multi-file Codex patch.
- **Mixed-content paste.** Pasting a message with text and a picture now keeps both.
- **Queued attachments.** Edit a queued message without losing its image or file attachment chips.
- **Pull request checks.** Agents watching a pull request can recognize checks that already passed instead of waiting indefinitely.
- **Notebook outputs.** Saved HTML outputs now appear when you scroll them into view.

### Plus 24 more bug fixes and performance improvements.

<details>
<summary>Full changelog</summary>

## What's Changed
* perf(mobile): keep image bytes outside draft JSON by @t3dotgg in pingdotgg/t3code#9727
* fix(server): watch_pull_request says when checks already passed by @juliusmarminge in pingdotgg/t3code#40866
* fix(codex): Open diff shows every file of a multi-file patch by @Abhiram-745 in pingdotgg/t3code#40874
* fix(server): ACP startup gives up when the agent never answers the handshake by @juliusmarminge in pingdotgg/t3code#40864
* fix(server): a branch prefixed with another remote's name publishes under its full name by @Abhiram-745 in pingdotgg/t3code#40877
* fix(server): list open delegated tasks when task_status or task_cancel finds no match by @Project516 in pingdotgg/t3code#40886
* fix(gitlab): find merge requests opened from a fork by @Abhiram-745 in pingdotgg/t3code#40894
* fix(web): pasting a chat message with text and a picture keeps both by @juliusmarminge in pingdotgg/t3code#40909
* fix(antigravity): bound silent post-settle background command holds by @Lokkuchakreshkumar in pingdotgg/t3code#40858
* fix(desktop): WSL is not offered or started when only the Windows install stub exists by @juliusmarminge in pingdotgg/t3code#40918
* fix(server): idle /ws connections behind a reverse proxy no longer drop every 60s by @juliusmarminge in pingdotgg/t3code#40932
* fix(server): thread reads no longer attribute T3 Code's compact-before-send /compact to the user by @juliusmarminge in pingdotgg/t3code#40934
* fix(web,mobile): @-file mentions show by name in message previews, not as raw links by @tiliakoos in pingdotgg/t3code#40924
* fix(web): tool calls stay grouped after a usage-limit pause again by @matthew-waters in pingdotgg/t3code#40905
* fix(server): t3 doctor no longer reports a database just under 1 GiB as "1024.0 MiB" by @tiliakoos in pingdotgg/t3code#40952
* fix(web): show clone failure after progress is dismissed by @StiensWout in pingdotgg/t3code#40951
* Invalidate pending theme imports when a replacement is too large by @StiensWout in pingdotgg/t3code#40965
* fix(mobile): show linked thread history page errors by @StiensWout in pingdotgg/t3code#40973
* fix(client-runtime): skip waiting for lower-priority linked addresses by @StiensWout in pingdotgg/t3code#40989
* fix(web): navigate Excel sheets from the focused tab by @StiensWout in pingdotgg/t3code#41008
* fix(mobile): bound app-owned composer attachment filenames by @StiensWout in pingdotgg/t3code#40991
* fix(web): prioritize visible saved notebook outputs by @StiensWout in pingdotgg/t3code#40998
* fix(web): editing a queued message keeps its attachment chips resolved by @smirea in pingdotgg/t3code#40945
* fix(server): unlinking an environment ends its session on the other machine by @juliusmarminge in pingdotgg/t3code#41005
* fix(mobile): scope Git result banners to their originating thread by @StiensWout in pingdotgg/t3code#41015
* fix(web): keep the conversation when a pairing tab closes by @StiensWout in pingdotgg/t3code#41025
* fix: restart linked thread reads when trying again by @StiensWout in pingdotgg/t3code#41020
* fix(client-runtime): count ambiguous projects in chat file links by @StiensWout in pingdotgg/t3code#40986
* fix(mobile): keep media actions on each sent image page by @StiensWout in pingdotgg/t3code#41018
* perf(server): a run's provider turn lookup is linear, not quadratic by @navidnadali in pingdotgg/t3code#38791

## New Contributors
* @Lokkuchakreshkumar made their first contribution in pingdotgg/t3code#40858
* @matthew-waters made their first contribution in pingdotgg/t3code#40905

**Full Changelog**: pingdotgg/t3code@v0.1.12-nightly.20261122.5098...v0.1.12-nightly.20261122.5111

</details>


Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.1.12-nightly.20261122.5111
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant