From 5da4aa9aba17a6defba8fc750e1b844a56168911 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Tue, 17 Nov 2026 03:53:13 +0000 Subject: [PATCH 1/2] test(server): a delegated task's result follows the run a finished Monitor 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 --- .../SubagentProjection.test.ts | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/apps/server/src/orchestration-v2/SubagentProjection.test.ts b/apps/server/src/orchestration-v2/SubagentProjection.test.ts index 2f764233ba97b..476477070b9ad 100644 --- a/apps/server/src/orchestration-v2/SubagentProjection.test.ts +++ b/apps/server/src/orchestration-v2/SubagentProjection.test.ts @@ -365,6 +365,32 @@ it("waits for nested work and retains the report across monitor acknowledgements }); assert.equal(progress.state, "result_available"); assert.equal(progress.resultRun?.id, report.id); + const ended = { ...report, id: RunId.make("monitor-ended"), ordinal: 4 }; + const afterMonitorEnded = delegatedTaskProgress({ + ...projection, + runs: [run, report, monitor, ended], + messages: [ + { + ...artifacts.message, + runId: monitor.id, + notification: { + source: { kind: "monitor" }, + outcome: "updated", + summary: "Monitor update", + }, + }, + { + ...artifacts.message, + runId: ended.id, + notification: { + source: { kind: "monitor" }, + outcome: "completed", + summary: 'Monitor "ticks" finished', + }, + }, + ], + }); + assert.equal(afterMonitorEnded.resultRun?.id, ended.id); }); it("exposes the provider failure rather than a progress message from the failed run", () => { From f2da0723a8eb56cfb30bb5067589094dc3e0dd2a Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Tue, 17 Nov 2026 03:57:52 +0000 Subject: [PATCH 2/2] fix(server): a delegated task reports the answer its child gives after 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 pingdotgg/t3code#28448 Co-Authored-By: Claude Opus 5.5 --- packages/provider-core/src/server/subagentProjection.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/provider-core/src/server/subagentProjection.ts b/packages/provider-core/src/server/subagentProjection.ts index f1b0a41905fb3..54ff6e0084e1a 100644 --- a/packages/provider-core/src/server/subagentProjection.ts +++ b/packages/provider-core/src/server/subagentProjection.ts @@ -301,7 +301,11 @@ export function delegatedTaskProgress(projection: { ["completed", "failed", "cancelled", "interrupted", "rolled_back"].includes(status); const monitorRuns = new Set( projection.messages - .filter((message) => message.notification?.source.kind === "monitor") + .filter( + (message) => + message.notification?.source.kind === "monitor" && + message.notification.outcome === "updated", + ) .map((message) => message.runId), ); const workRuns = projection.runs.filter(