fix(server): PR watch reports a required check that first appears already passed #15804
main fromrefs/pull/15804/head·merged by t3dotgg(GitHub profile, opens in a new tab) View on GitHubProblem#
watch_pull_request reports "All N required checks passed" when the required checks go from not passed to passed, and it stores that as one boolean. A required check that is created and finishes between two polls, such as a gate job that waits on a slower job, is never seen pending. The boolean stays true, so the agent is never told the larger set passed. #15362 has the evaluator reproduction and a live incident.
Change#
The watch now records the names in the passing gate, in a new passedChecks field, and clears them when the head commit changes or the gate stops passing. When the gate passes and holds a name outside that list, the agent gets a new report with the new count.
passedChecks decodes as [] when missing, so watches saved before this change still load. A saved watch that already reported a pass adopts the current names on its next poll without waking the agent, as long as its checks still pass. An upgrade therefore does not wake every healthy watch.
One behavior to note: where the host marks no check required, the gate is already every check. There, a new check that first appears already passed now produces a report too. Before, it produced one only when a poll saw it pending first.
Scope and approval#
Closes #15362. The triage comment confirms the bug on main and lists this approach as one option: remember the check names in a new contract field, and let saved watches adopt them without a wake. It leaves the fix direction to a maintainer. If you prefer another direction, I will rework this.
The contract field is part of the same fix, and the server is its only writer. A same-name rerun that passes entirely between polls is a separate gap, as triage noted, and stays out of this PR.
Verification#
Automated, on Linux:
apps/server:vp test run src/orchestration-v2/pullRequestWatch.test.ts src/mcp/toolkits/pullRequests/handlers.test.ts src/orchestration-v2/runtimeLayer.test.ts: 94 passed.packages/contracts:vp test run src/threadPullRequest.test.ts: 2 passed. The new test decodes a watch saved withoutpassedChecks.- The three new evaluator tests fail against
main'spullRequestWatch.ts. - Typecheck passes for
@t3tools/contractsandt3.
Live, operated by an agent, in the web dev client on Windows. A Codex agent watched pull requests in a private test repository whose ruleset requires the status checks Tests and Gate. Commit statuses controlled the timing: Tests passed first, and Gate was posted as already successful after the first report, never pending.
main(4ee6bfd50): one report, "All 1 required check passed". No second report in the next three and a half minutes, with both required checks green.- This branch: a second report, "All 2 required checks passed", about 45 seconds after
Gatepassed. No repeat in the next two minutes. - A watch saved by
mainafter it reported a pass, then loaded on this branch: it recorded both check names and sent no report.
Not checked: Actions check runs in the live run, which is what the reporter's incident used. Check runs and commit statuses reach the evaluator in the same shape, and the unit test follows the issue's sequence. Desktop and mobile were not run. The change has no client code.
main | This branch |
|---|---|
Recordings at 4x speed.
main:
https://github.com/user-attachments/assets/80fa804a-0663-4172-a4f0-39f240a66778
This branch:
https://github.com/user-attachments/assets/0f096db3-cd39-4c79-a30e-ada7ba026ea3
Model: Claude Opus 5.5, Claude Fable 5.1 (review), GPT-6-Astra (review). Harness: Claude Code, Codex.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
Approvability#
Verdict: Approved at
34bc73aMacroscope's review found this PR approvable — This is a small, self-contained server bug fix that tracks the passing check names to notify agents when a required check appears already complete. The additive state field is backward-compatible, migration behavior avoids spurious wakes, and targeted tests cover the new scenarios.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).Navigate logical layers of code changes, visualize relationships, and explore their blast radius.
🧰 Additional context used
📚 Code guidelines (2)
docs/internals/effect-services.md — auto-discovered AGENTS.md — auto-discoveredNo actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
- Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml
- Review profile: CHILL
- Plan: Advanced
- Run ID:
8dfe6a14-ed1d-4107-924b-b893b86aefc4
📥 Commits
Reviewing files that changed from the base of the PR and between efecd3cf8bcec3d1891b5f5a27dc2f6d797c6448 and 34bc73a8568fd28a82a7051e266ffc18fe74e9c8.
📒 Files selected for processing (7)
apps/server/src/mcp/toolkits/pullRequests/handlers.test.tsapps/server/src/orchestration-v2/Orchestrator.tsapps/server/src/orchestration-v2/PullRequestWatchReactor.tsapps/server/src/orchestration-v2/pullRequestWatch.test.tsapps/server/src/orchestration-v2/pullRequestWatch.tspackages/contracts/src/threadPullRequest.test.tspackages/contracts/src/threadPullRequest.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
📝 Walkthrough
Walkthrough#
Pull request watches now track the names of checks in a passing gate. The evaluator can report another checks-passed event when a newly appearing gate is already successful. Older watch data decodes with an empty passed-check list.
Changes#
Passed-check tracking
Layer / File(s) Summary Add passed-check state to watches
packages/contracts/src/threadPullRequest.ts,packages/contracts/src/threadPullRequest.test.ts,apps/server/src/orchestration-v2/Orchestrator.ts,apps/server/src/mcp/toolkits/pullRequests/handlers.test.tsThe watch contract adds passedCheckswith an empty-array decoding default. New watches and the merged-watch test fixture initialize the field.Detect newly passed gates
apps/server/src/orchestration-v2/pullRequestWatch.ts,apps/server/src/orchestration-v2/PullRequestWatchReactor.ts,apps/server/src/orchestration-v2/pullRequestWatch.test.tsThe evaluator records passing gate names and reports newly added names when the gate is passed. Watch equality compares passedChecks. Tests cover newly successful gates, pending-then-successful gates, and already-passed watches.Priority: ➖ Normal
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix · Severity of issue fixed: Medium
Suggested reviewers:
t3dotgg,juliusmarmingeMerge Risk: ⚪ Minimal · up to
34bc7The change is ready to merge after normal checks; no actionable watch-notification risk remains.
Security Architecture Review#
Security architecture risk: 🔵 Low · up to
34bc7The change is limited to remembering reported checks and notifying the agent when additional checks pass. Existing permissions are not expanded, and healthy older watches adopt the new state without an immediate notification. Some concurrency, recovery, and rollback behavior remains unverified.
Retained concerns No architecture-level concerns identified.
Security review details
Security Blast Radius
- inferred — A party able to influence provider-reported check metadata can affect notification timing for active threads watching that pull request. The added behavior uses the existing thread notification path rather than granting additional merge, credential, or tool authority.
Security Findings and Attack Paths
- observed — The newly tracked names are used for comparison and persistence. A checks-passed notification renders the check count and requiredness, not those names, so this field does not introduce check-name text into that agent-message branch.
Trust Boundaries and Controls
- observed — The public watch tool accepts a pull-request target. Its handler resolves the current thread and project and dispatches target identity and a watching flag, not passedChecks or arbitrary watch state. The new field is initialized and advanced by server orchestration.
Resilience and Maintainability Implications
- observed — The sync handler checks the normalized pull-request identity and active watch startedAt under the thread lock, rejecting stale updates after stop or restart. It also rejects wakes for inactive threads and plans the watch mutation before the wake. This establishes ordering and lifecycle protection, not a complete crash-recovery proof.
🚥 Pre-merge checks | ✅ 3 | ❌ 2
❌ Failed checks (2 warnings)#
Check name Status Explanation Resolution Out of Scope Changes check ⚠️ Warning The added no-required-check test in apps/server/src/orchestration-v2/pullRequestWatch.test.tsconfirms that a newly appearing optional check can trigger another passed report. The implementation doe…Restrict the new re-report behavior to newly added required checks. Preserve existing no-required-check behavior so a newly appearing optional check does not trigger a report solely because it was already passed, and update the correspondin… Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 7 files. Write docstrings for the functions missing them to satisfy the coverage threshold. ✅ Passed checks (3 passed)
Check name Status Explanation Title check ✅ Passed The title clearly and specifically describes the main fix: reporting when a required check first appears already passed. Description check ✅ Passed The description covers the problem, change, scope and approval context, and focused verification results. It also states what was not tested and identifies a related behavior that remains out of scope… Linked Issues check ✅ Passed Issue #15362requires a new report when an additional required check first appears already passed.evaluatePullRequestWatchtracks passing gate names and reports when a passing gate adds a name (`ap…Full details: Out of Scope Changes check
Explanation
The added no-required-check test in
apps/server/src/orchestration-v2/pullRequestWatch.test.tsconfirms that a newly appearing optional check can trigger another passed report. The implementation does this because it tracks every check as the gate when no check is marked required. Issue#15362specifically limits its request to new required checks and says it does not request notifications for every optional check.Resolution
Restrict the new re-report behavior to newly added required checks. Preserve existing no-required-check behavior so a newly appearing optional check does not trigger a report solely because it was already passed, and update the corresponding test.
- Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
- Create a new PR
- Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment `@coderabbitai help` to get the list of available commands.A note on CodeRabbit's "Out of Scope Changes" warning, for whoever reviews this.
The warning covers repos where the host marks no check required. There,
mainalready treats every check as the gate and reports "All N checks passed". Onmain, a new check that a poll sees pending first already produces a second report once it passes. This PR makes a new check that first appears already passed do the same, so the report no longer depends on poll timing. Without it, an agent in such a repo can keep waiting on a check that already passed, the same failure #15362 reports for required checks.#15362 says it does not ask for notifications for every optional check. Its reproduction is a repo with required checks, and there this PR still sends no additional passed report when optional checks pass. The issue does not say what should happen where no check is required.
Limiting the new report to required checks is one added condition in
evaluatePullRequestWatchplus inverting one test. That can avoid extra agent wakes and leaves the timing gap in repos with no required checks. If you prefer that, say so and I will push it.Written by Claude Fable 5.1 on behalf of ScottN-PV.
t3dotgg(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes