Skip to content

Commit 6847120

Browse files
fix(server): a delegated child's Monitor ending reaches the parent
With per-line Monitor wakes now tagged as monitor updates, the follow-up gate dropped every wake of a Monitor-using child, including the one where the Monitor ends, so the parent never heard the child's final answer. The gate now refuses only monitor updates. A Monitor that ends starts a delegated follow-up the way a background command's ending does. Co-Authored-By: Claude Fable 5.2 <[email protected]>
1 parent ff06982 commit 6847120

2 files changed

Lines changed: 17 additions & 6 deletions

File tree

‎apps/server/src/orchestration-v2/DelegatedCompletionDelivery.test.ts‎

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2635,11 +2635,19 @@ it.layer(Layer.merge(layerTest, ProviderContinuationRequests.layer))(
26352635
threadId: child.childThreadId,
26362636
messageId: wakeMessageId,
26372637
text: "Background activity updated",
2638-
notification: {
2639-
source: { kind: "command" },
2640-
outcome: "completed",
2641-
summary: 'Command "sleep 60" finished',
2642-
},
2638+
// A monitor that ends is finished work too; only its per-line updates are progress.
2639+
notification:
2640+
delivery === "live"
2641+
? {
2642+
source: { kind: "monitor" },
2643+
outcome: "completed",
2644+
summary: 'Monitor "sleep 60" finished',
2645+
}
2646+
: {
2647+
source: { kind: "command" },
2648+
outcome: "completed",
2649+
summary: 'Command "sleep 60" finished',
2650+
},
26432651
attachments: [],
26442652
dispatchMode: { type: "queue_after_active" },
26452653
});

‎apps/server/src/orchestration-v2/Orchestrator.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,10 @@ function mayStartSubagentFollowup(
765765
): boolean {
766766
if (command.scheduledTaskId !== undefined || command.restartContinuationOfRunId !== undefined)
767767
return false;
768-
if (command.notification !== undefined) return command.notification.source.kind !== "monitor";
768+
if (command.notification !== undefined)
769+
return (
770+
command.notification.source.kind !== "monitor" || command.notification.outcome !== "updated"
771+
);
769772
return (
770773
command.createdBy === "user" ||
771774
command.creationSource === "mcp" ||

0 commit comments

Comments
 (0)