Repository navigation
fix(server): delegated children can watch their own PR, and the parent hears every result - #26704
BilalIrfanContact wants to merge 2 commits into
Conversation
…esult reaches the parent Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ApprovabilityVerdict: Needs Human Approval Macroscope's review found this PR requires human approval — Delegated children gain PR-watch tools, and subsequent watch results reach their parent as follow-up tasks. This changes the default capabilities available to delegated children and requires human confirmation of the resulting monitoring behavior. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Enable delegated pull-request watch tools apps/server/src/mcp/McpInvocationContext.ts, apps/server/src/mcp/toolkits/pullRequests/tools.ts, apps/server/src/mcp/McpHttpServer.test.ts, evals/mcp-tool-use/*, packages/provider-core/src/server/runtimeInstructions.* |
The watch and unwatch tools are no longer hidden from delegated children. The child-specific watch rejection is removed from tool execution and runtime instructions. |
Allow and retain delegated watches apps/server/src/mcp/toolkits/pullRequests/handlers.*, apps/server/src/orchestration-v2/Orchestrator.ts, apps/server/src/orchestration-v2/PullRequestWatchReactor.ts, apps/server/src/orchestration-v2/ThreadStop.test.ts |
Delegated-child watch requests proceed through the existing checks and dispatch. Subagent lineage no longer ends a watch by itself. |
Dispatch pull-request-watch follow-ups apps/server/src/orchestration-v2/Orchestrator.ts, apps/server/src/orchestration-v2/DelegatedCompletionDelivery.test.ts |
Pull-request-watch wakes dispatch queued messages and record eligible delegated follow-ups. Delegated results include the URLs of active watches and a notice about later updates. |
Update instructions and scenario coverage apps/server/src/orchestration-v2/testkit/fixtures/*/muse_transcript.ndjson, docs/user/source-control.md |
The instructions and transcript fixtures state that delegated children watch only when their task asks them to. The documentation describes watch updates and cancellation. |
Priority:
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Bug fix · Severity of issue fixed: Medium
Sequence Diagram(s)
sequenceDiagram
participant PullRequestWatchReactor
participant Orchestrator
participant DelegatedChild
participant ParentThread
PullRequestWatchReactor->>Orchestrator: Dispatch pull-request-watch wake
Orchestrator->>DelegatedChild: Queue follow-up message
DelegatedChild->>Orchestrator: Return follow-up result
Orchestrator->>ParentThread: Record delegated follow-up and request parent wake
Suggested labels: bugfix
Suggested reviewers: juliusmarminge, macroscopeapp, t3dotgg
Merge Risk: 
Minimal · up to 51b32
-
No actionable issue is established; the change is mergeable after normal checks.
Pre-merge checks: 
4
-
Full details: Linked Issues check
-
Explanation
Issue
#25764has coding requirements. The runtime instruction now says, “A delegated child watches only when its task asks for it.” The watch tools and handlers allow delegated children while the provider-native subagent read-only guard remains. The orchestrator dispatches pull-request-watch wakes as delegated follow-up tasks, and the parent-facing result adds the active-watch notice. The child result therefore reaches the parent. The changed tests cover child watch acceptance, follow-up delivery, and stop behavior.
Full details: Out of Scope Changes check
-
Explanation
The changes stay within issue
#25764. Server changes implement child watch authorization, wake delivery, parent notification, and watch lifecycle behavior. Tests cover these paths. Runtime fixtures, user documentation, and the evaluation case update the same delegated-child watch policy. No unrelated production behavior is demonstrated.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
Problem
A delegated child that opens a fix PR could never follow its CI, even when its task said "watch the PR and fix CI". The injected instructions said children never watch. The server also refused the call: watch tools were hidden from children, the MCP handler and orchestrator rejected the watch, and the watch reactor ended any watch a child held. If a child had watched anyway, results from its PR-watch wake turns never reached its parent. Fixes #25764.
Change
delegate_taskmay now callwatch_pull_requestandunwatch_pull_request. Provider-native subagents (e.g. Claude's Agent tool) are still refused by the existing read-only guard.task_status) ends with: "T3 Code: this child still watches . Its results after pull request updates arrive as new delegated tasks, so this one is not final." The child's own reply shown in the UI is unchanged.unwatch_pull_request, or the parent'stask_cancel/ Stop on the parent stops the child, which already ends its watches (now covered by the existing Stop test).child-babysit-calls-watch(which encoded the old rule) are updated. The eval case is nowchild-asked-to-babysit-watches.Scope and approval
Issue #25764 is a maintainer-filed bug that states the decided direction: "Julius has decided that the lead that opens a fix PR owns its CI follow-up through a PR watch," and lists the three expected behaviors this PR implements. The issue gives the "child holds a PR watch" signal to the parent only as an example; the exact form here (a line appended to the result the parent receives) is this PR's choice and open to review.
Verification
Before (unchanged main 9826dbb):
vp test run apps/server/src/mcp/toolkits/pullRequests/handlers.test.ts -t 'allows a subagent thread to watch a pull request'failed withPullRequestWatchFromSubagentErrorat handlers.ts:275, before any watch command was dispatched.After (51b3274), both exit 0:
vp test run apps/server/src/mcp/toolkits/pullRequests/handlers.test.ts -t 'lets a delegated child watch its own pull request'vp test run apps/server/src/orchestration-v2/DelegatedCompletionDelivery.test.ts -t 'delivers the run a pull request watch wake starts after the original result'. With only the new follow-up call removed, this case fails: the wake run gets nodelegatedTaskId, so the parent is never told.Also passed during development: the full
ThreadStop,DelegatedCompletionDeliveryandpullRequestWatchtest files (94 tests),handlers.test.tswithMcpHttpServer.test.ts(42), and the eval harnessrun.test.ts(409).vp run check:changed upstream/main(25 files: the 23 in this PR plus 2 unrelated local skill edits): all steps passed. format, lint, knip 1/2 and 2/2, graphql (apps/server), typecheck (23 packages), and tests beside the changes (9 files, 542 tests).vp test run apps/server/src/orchestration-v2/testkit/MuseReplayFixtures.integration.test.ts(the updated Muse fixtures): 8 passed. The eval--dry-runfor the three child cases built every request with the new instruction andwatch_pull_requestoffered to the child (no model calls).Runtime transcript (real orchestrator and projections on an isolated in-memory SQLite database; provider output and the GitHub check failure are synthetic events):
Not verified:
child-asked-to-babysit-watchesplus the two child controls) has not been run. The runner has no GPT-6 Luna, and no eval credentials were available.Claude Opus 5.5 in Claude Code (via T3 Code).
🤖 Generated with Claude Code