Skip to content

fix(server): a delegated task reports the answer its child gives after an awaited Monitor ends - #37901

Merged
juliusmarminge merged 2 commits into
mainfrom
factory/issue-28448-a28462
Nov 17, 2026
Merged

juliusmarminge merged 2 commits into
mainfrom
factory/issue-28448-a28462

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Nothing had to change in this round. PR #37901 is at f2da072: all 7 required checks passed, every other check finished as success, skipped or neutral, and Macroscope approved it (Approvability: approved). There are no line comments, no CodeRabbit review, and no open finding rated high or above. The fix is unchanged: delegatedTaskProgress now leaves only Monitor update wakes (outcome 'updated') out of the result run, the same check as Orchestrator.mayStartSubagentFollowup. So the run a finished Monitor starts can become the task's result and reach the parent.

Fixes #28448

Reproduction on main

Commit f390ae7 (origin/main). Ran T3CODE_DEV_SEED=0 vp run dev in a fresh worktree, added a scratch git repo with t3 project add, then t3 thread start --provider claudeAgent --model claude-haiku-5-5 with a parent prompt that calls delegate_task (mode async, isolation shared, Claude Haiku 5.5 child). The child's brief: start a Monitor (persistent false, for i in 1 2; do sleep 25; echo tick $i; done), call t3_background_wait with its task ID, reply INTERIM A; on tick 1 call t3_background_wait again and reply INTERIM B; when the Monitor finishes reply FINAL. Observed in the dev DB: child run 1 ended with INTERIM A (03:50:15). Run 2 started on a notification {monitor, updated} and ended with INTERIM B (03:50:40). Run 3 started on {monitor, completed, 'Monitor "probe ticks" finished'} and ended with FINAL (03:51:02.257). The parent's only notice arrived at 03:51:02.406: 'Delegated task … (Repro marked monitor) [completed]: INTERIM A'. The parent replied 'GOT: INTERIM A'. The subagent row ended with status completed, result 'INTERIM A'. FINAL never reached the parent. Failing test pushed: an extra assertion in SubagentProjection.test.ts ('waits for nested work and retains the report across monitor acknowledgements') fails on main with expected 'followup' to equal 'monitor-ended'. Locally, changing the monitorRuns filter to drop only outcome 'updated' makes all 11 tests in that file pass (not committed).

Evidence

Run the identical async/shared Claude Haiku 5.5 delegation on both commits. Child marks a two-tick Monitor with t3_background_wait, replies INTERIM A, acknowledges the update with INTERIM B, then replies FINAL when the Monitor finishes. Open the child to observe all three turns, then return to the parent.

Environment: real dev servers, separate fresh isolated databases, synthetic project, Chromium 1280×800, light theme. Captures crop the same chat region for privacy.

Before After
f390ae7f15 f2da0723a8
Before: parent receives INTERIM A After: parent receives FINAL
Before: child reached FINAL After: child reached FINAL
Before recording After recording
Before runtime transcript After runtime transcript

Driver, identical prompt, read-only transcript exporter, reproduction instructions.

The base child reached FINAL in run 3, but its task stored INTERIM A and woke the parent with that stale result. The fix stored FINAL and the parent replied GOT: FINAL.

Tests

No new commands this round; nothing changed. CI on f2da072: all 7 required checks passed and every other check finished as success, skipped or neutral. From the previous round: SubagentProjection.test.ts 11/11, three neighbouring test files 121/121, and vp run check:changed passed.

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 17, 2026 03:53
…nitor started

Reproduces #28448: delegatedTaskProgress drops every Monitor-started run,
so the answer a child gives after its awaited Monitor ends never becomes
the task's result.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r an awaited Monitor ends

delegatedTaskProgress skipped every Monitor-started run when picking the
task's result, so a run started by a finished Monitor never became the
result and the task settled on the child's first-turn interim reply. Skip
only Monitor update wakes, matching mayStartSubagentFollowup.

Fixes #28448

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:XS 0-9 changed lines (additions + deletions). labels Nov 17, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at f2da072

Macroscope's review found this PR approvable — Delegated tasks can now report the child's answer after an awaited monitor ends, while interim monitor updates remain excluded. Existing active-work and child-completion safeguards are unchanged.

You can add or adjust custom eligibility rules. Learn more.

@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: d7373c4 · PR result: f2da072 · 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 17, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change updates delegated task result selection so that only monitor runs with an "updated" notification are excluded. A test verifies that a completed monitor run can be selected as the result.

Changes: Monitor result selection

Layer / File(s) Summary
Filter monitor updates and verify completion selection
packages/provider-core/src/server/subagentProjection.ts, apps/server/src/orchestration-v2/SubagentProjection.test.ts
delegatedTaskProgress excludes runs only when their monitor notification has outcome "updated". The test verifies that a completed monitor run is selected as the result.

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

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: macroscopeapp, maria-rcks, t3dotgg

Merge Risk: Minimal · up to f2da0

This change lets a completed Monitor run supply a delegated task's result instead of the child's interim reply, while Monitor update wakes stay excluded. A regression test covers it. No concrete merge-blocking risk was found.

Pre-merge checks: Passed 3 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Linked Issues check Inconclusive Issue #28448 is the only active direct target. Its expected behavior is that every wake-turn completion reaches the parent, and that summary and resultContextTransferId reflect the latest terminal run… Provide evidence for the issue's broader expectations. Either show that completion delivery for wake turns (including background-command wakes and grandchild completions) is covered at the reviewed head, or state which of those cases this P…
Passed Passed checks: 3 passed

Check name Status Explanation
Title check Passed The title names the fix precisely: a delegated task now reports the answer its child gives after an awaited Monitor ends. The raw summary and objectives confirm the change: delegatedTaskProgress now s…
Out of Scope Changes check Passed The reviewed head changes only the Monitor filter in delegatedTaskProgress and adds one assertion case to SubagentProjection.test.ts. The filter change directly implements the Monitor result-selection…
Description check Passed The description is a detailed, well-evidenced account of a narrow Monitor-specific fix to delegatedTaskProgress, covering the problem (interim reply stored as the task result), the change (exclude onl…
Full details: Title check

Explanation

The title names the fix precisely: a delegated task now reports the answer its child gives after an awaited Monitor ends. The raw summary and objectives confirm the change: delegatedTaskProgress now skips only Monitor notifications with outcome 'updated', so a run started by a finished Monitor can supply the result. The title is specific, follows conventional commit form, and matches the main change.

Full details: Out of Scope Changes check

Explanation

The reviewed head changes only the Monitor filter in delegatedTaskProgress and adds one assertion case to SubagentProjection.test.ts. The filter change directly implements the Monitor result-selection defect cited in #28448. The test covers the same path. The PR description states that the change adds no new regex or parser and reuses the outcome check described for Orchestrator.mayStartSubagentFollowup. No unrelated files or behavior changes are indicated in the supplied summary.

Full details: Description check

Explanation

The description is a detailed, well-evidenced account of a narrow Monitor-specific fix to delegatedTaskProgress, covering the problem (interim reply stored as the task result), the change (exclude only Monitor 'updated' wakes), reproduction on main with observed run-by-run results, a failing-then-passing unit test, before/after evidence, and test results. It does not follow the template headings (Problem, Change, Scope, Verification), and the Scope section does not state clearly why no issue is linked beyond citing #28448 in the objectives. The Problem section is implicit rather than under its own heading, and the description is long and includes CI and process detail that the template does not request. The required information is present, so the check passes.

Full details: Linked Issues check

Explanation

Issue #28448 is the only active direct target. Its expected behavior is that every wake-turn completion reaches the parent, and that summary and resultContextTransferId reflect the latest terminal run. The reviewed head shows the Monitor-specific part is addressed. In delegatedTaskProgress (packages/provider-core/src/server/subagentProjection.ts), monitorRuns now collects only messages with notification.source.kind === 'monitor' and outcome === 'updated'. Runs started by a finished Monitor therefore remain eligible for resultRun selection, which the reported repro needed. The PR does not cover the issue's broader cases. Those include background-command wake turns, reviewer grandchildren, and the delivery of wake-turn completions to the parent. The inspected diff and file read do not show the delivery path, and the PR description does not claim those cases. The base revision could not be read, so the before-state is taken from the PR description and the raw summary. The live repro was not rerun. The unit test is the only evidence for the fix.

Resolution

Provide evidence for the issue's broader expectations. Either show that completion delivery for wake turns (including background-command wakes and grandchild completions) is covered at the reviewed head, or state which of those cases this PR intentionally leaves open. Also provide a base-revision read or diff of subagentProjection.ts so the before and after behavior can be compared directly.

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 d7373c4 and f2da072.

Files selected for processing: 2

  • apps/server/src/orchestration-v2/SubagentProjection.test.ts
  • packages/provider-core/src/server/subagentProjection.ts

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

@juliusmarminge
juliusmarminge merged commit a5c28da into main Nov 17, 2026
40 checks passed
@juliusmarminge
juliusmarminge deleted the factory/issue-28448-a28462 branch November 17, 2026 04:22
cursor Bot pushed a commit to mattiaz9/t3code that referenced this pull request Nov 17, 2026
AIdoesmyjob pushed a commit to AIdoesmyjob/t3code that referenced this pull request Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 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.

Delegated task: final wake-turn completion never delivered to the parent; task result stays on run 1

1 participant