Skip to content

Commit d91915d

Browse files
fix(server): a t3 thread send to a finished delegated child notifies its parent (pingdotgg#33446)
1 parent 17a6a01 commit d91915d

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2575,7 +2575,8 @@ it.layer(Layer.merge(layerTest, ProviderContinuationRequests.layer))(
25752575
creationSource: outcome === "failed" ? "web" : "mcp",
25762576
commandId: CommandId.make(`command:followup-send-${outcome}`),
25772577
threadId: child.childThreadId,
2578-
senderThreadId: parentThreadId,
2578+
// `t3 thread send` and unscoped MCP sessions carry no sender thread.
2579+
...(outcome === "completed" ? {} : { senderThreadId: parentThreadId }),
25792580
messageId,
25802581
text: "Check the same work again.",
25812582
attachments: [],

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8486,12 +8486,14 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio
84868486
if (!startsAttempt) return;
84878487
const child = yield* projectionStore.getThread(command.threadId);
84888488
const parentThreadId = child.lineage.parentThreadId;
8489+
// A send with no sender thread comes from a client acting for the owner, like a user send.
84898490
if (
84908491
child.lineage.relationshipToParent !== "subagent" ||
84918492
parentThreadId === null ||
84928493
(command.notification === undefined &&
84938494
command.createdBy !== "user" &&
84948495
command.usageLimitContinuationOfRunId === undefined &&
8496+
command.senderThreadId !== undefined &&
84958497
command.senderThreadId !== parentThreadId)
84968498
)
84978499
return;

0 commit comments

Comments
 (0)