@devries-cameron20 / t3code Mirror · read-only / commits / 36d0dcbf55
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 22, 02:00 UTC

fix(server): wake idle parents for late delegated results (#32573)

Co-authored-by: GPT 6.1 Sol <codex@openai.com> Co-authored-by: Muse Wonder Full 1.0 <noreply@meta.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Wout Stiens committed Nov 8, 2026 at 22:28 UTC 36d0dcbf55544d7c12353506897b7dc0cb9cbb9f
6 files changed +281 -145
apps/server/src/mcp/OrchestratorMcpService.ts
+12 -10
@@ -1655,7 +1655,11 @@ const make = Effect.gen(function* () {
1655 task.completionDelivery?.state !== "acknowledged" &&
1656 task.completionDelivery?.state !== "disposed"
1657 ) {
1658 - const observingRun = ThreadManagementService.latestActiveRun(parentProjection);
1658 + const observingRun = ThreadManagementService.latestActiveRun({
1659 + runs: parentProjection.runs.filter(
1660 + (run) => run.providerInstanceId === scope.thread.providerInstanceId,
1661 + ),
1662 + });
1663 const acknowledgementRequestKey = yield* requestKey(undefined);
1664 yield* threadManagement
1665 .dispatch({
@@ -1667,10 +1671,7 @@ const make = Effect.gen(function* () {
1671 }),
1672 parentThreadId: scope.thread.threadId,
1673 taskId,
1670 - observedByRunId:
1671 - observingRun?.providerInstanceId === scope.thread.providerInstanceId
1672 - ? observingRun.id
1673 - : null,
1674 + observedByRunId: observingRun?.id ?? null,
1675 })
1676 .pipe(
1677 Effect.mapError((error) =>
@@ -1750,7 +1751,11 @@ const make = Effect.gen(function* () {
1751 ),
1752 ),
1753 );
1753 - const observingRun = ThreadManagementService.latestActiveRun(parentProjection);
1754 + const observingRun = ThreadManagementService.latestActiveRun({
1755 + runs: parentProjection.runs.filter(
1756 + (run) => run.providerInstanceId === scope.thread.providerInstanceId,
1757 + ),
1758 + });
1759 yield* threadManagement
1760 .dispatch({
1761 type: "delegated_task.completion-delivery.acknowledge",
@@ -1761,10 +1766,7 @@ const make = Effect.gen(function* () {
1766 }),
1767 parentThreadId: scope.thread.threadId,
1768 taskId: task.id,
1764 - observedByRunId:
1765 - observingRun?.providerInstanceId === scope.thread.providerInstanceId
1766 - ? observingRun.id
1767 - : null,
1769 + observedByRunId: observingRun?.id ?? null,
1770 })
1771 .pipe(
1772 Effect.mapError((error) =>
apps/server/src/orchestration-v2/DelegatedCompletionDelivery.test.ts
+143 -62
@@ -1628,6 +1628,73 @@ it.layer(layerContinuationWorkerTest)("interrupted completion wakes", (it) => {
1628 it.layer(Layer.merge(layerTest, ProviderContinuationRequests.layer))(
1629 "subagent follow-ups",
1630 (it) => {
1631 + it.effect("a late unobserved read wakes a pending result without restarting", () =>
1632 + Effect.gen(function* () {
1633 + const orchestrator = yield* Orchestrator.OrchestratorV2;
1634 + const sink = yield* EventSink.EventSinkV2;
1635 + const requests = yield* ProviderContinuationRequests.ProviderContinuationRequests;
1636 + const now = yield* DateTime.now;
1637 + const threadId = ThreadId.make("thread:late-read-live");
1638 + const runId = RunId.make("run:late-read-live");
1639 + const taskId = NodeId.make("task:late-read-live");
1640 + yield* seedParentWithTerminalTask({
1641 + threadId,
1642 + projectId: ProjectId.make("project:late-read-live"),
1643 + runId,
1644 + rootNodeId: NodeId.make("root:late-read-live"),
1645 + taskId,
1646 + deliveryState: "pending",
1647 + now,
1648 + });
1649 + const acknowledge = (key: string) =>
1650 + orchestrator.dispatch({
1651 + type: "delegated_task.completion-delivery.acknowledge",
1652 + commandId: CommandId.make(`command:late-read-live:${key}`),
1653 + parentThreadId: threadId,
1654 + taskId,
1655 + observedByRunId: null,
1656 + });
1657 + const before = yield* orchestrator.getThreadProjection(threadId);
1658 + const liveRead = yield* acknowledge("live");
1659 + assert.lengthOf(liveRead.storedEvents, 0);
1660 + const parent = before.runs.find((run) => run.id === runId)!;
1661 + yield* sink.write({
1662 + events: [
1663 + {
1664 + id: EventId.make("event:late-read-live:parent-ended"),
1665 + type: "run.updated",
1666 + threadId,
1667 + runId,
1668 + occurredAt: now,
1669 + payload: { ...parent, status: "completed", completedAt: now },
1670 + },
1671 + ],
1672 + });
1673 + yield* acknowledge("ended");
1674 + const wake = yield* requests.take;
1675 + assert.equal(wake.threadId, threadId);
1676 + assert.equal(wake.delegatedCompletion?.parentRunId, runId);
1677 + const after = yield* orchestrator.getThreadProjection(threadId);
1678 + assert.equal(
1679 + after.subagents.find((task) => task.id === taskId)?.completionDelivery?.state,
1680 + "claimed",
1681 + );
1682 + assert.deepEqual(
1683 + after.runs.find((run) => run.id === runId)?.delegatedCompletion?.delivery?.taskIds,
1684 + [taskId],
1685 + );
1686 + const repeated = yield* acknowledge("repeated");
1687 + assert.lengthOf(repeated.storedEvents, 0);
1688 + assert.deepEqual(yield* orchestrator.getThreadProjection(threadId), after);
1689 + yield* orchestrator.dispatch({
1690 + type: "delegated_task.completion-delivery.dispose",
1691 + commandId: CommandId.make("command:late-read-live:dispose"),
1692 + parentThreadId: threadId,
1693 + taskId,
1694 + });
1695 + }),
1696 + );
1697 +
1698 it.effect("recovers a reserved delivery without loading conversation history", () =>
1699 Effect.gen(function* () {
1700 const orchestrator = yield* Orchestrator.OrchestratorV2;
@@ -3418,70 +3485,84 @@ it.layer(layerTest)("delegated tasks across a server restart", (it) => {
3485 }),
3486 );
3487
3421 - it.effect("wakes the parent for a settled_only task once its spawning turn ended", () =>
3422 - Effect.gen(function* () {
3423 - const orchestrator = yield* Orchestrator.OrchestratorV2;
3424 - const eventSink = yield* EventSink.EventSinkV2;
3425 - const now = yield* DateTime.now;
3426 - const threadId = ThreadId.make("thread:settled-only-restart");
3427 - const projectId = ProjectId.make("project:settled-only-restart");
3428 - const runId = RunId.make("run:settled-only-restart");
3429 - const rootNodeId = NodeId.make("node:settled-only-restart-root");
3430 - yield* seedParentWithTerminalTask({
3431 - threadId,
3432 - projectId,
3433 - runId,
3434 - rootNodeId,
3435 - taskId: NodeId.make("node:settled-only-restart-settled"),
3436 - deliveryState: "delivered",
3437 - now,
3438 - });
3439 - yield* eventSink.write({
3440 - commandId: reconcileCommandId("settled-only-restart"),
3441 - events: [
3442 - runEvent({
3443 - threadId,
3444 - runId,
3445 - ordinal: 1,
3446 - status: "cancelled",
3447 - now,
3448 - providerThreadId: parentProviderThreadId(threadId),
3449 - userMessageId: MessageId.make(`message:seed-user:${threadId}`),
3450 - delegatedCompletion: { disposition: "open", nextGeneration: 2, delivery: null },
3451 - }),
3452 - runEvent({
3453 - threadId,
3454 - runId: RunId.make("run:settled-only-restart:continuation"),
3455 - ordinal: 2,
3456 - status: "running",
3457 - now,
3458 - providerThreadId: parentProviderThreadId(threadId),
3459 - }),
3460 - ],
3461 - });
3462 - const child = yield* seedRestartCancelledChild({
3463 - parentThreadId: threadId,
3464 - projectId,
3465 - parentRunId: runId,
3466 - rootNodeId,
3467 - name: "settled-only-restart-child",
3468 - completionWake: "settled_only",
3469 - continuationPending: false,
3470 - now,
3471 - });
3488 + it.effect.each([false, true])(
3489 + "wakes the parent for a settled_only result with a running continuation: %s",
3490 + (runningContinuation) =>
3491 + Effect.gen(function* () {
3492 + const orchestrator = yield* Orchestrator.OrchestratorV2;
3493 + const eventSink = yield* EventSink.EventSinkV2;
3494 + const now = yield* DateTime.now;
3495 + const suffix = runningContinuation ? "running" : "idle";
3496 + const threadId = ThreadId.make(`thread:settled-only-restart-${suffix}`);
3497 + const projectId = ProjectId.make(`project:settled-only-restart-${suffix}`);
3498 + const runId = RunId.make(`run:settled-only-restart-${suffix}`);
3499 + const rootNodeId = NodeId.make(`node:settled-only-restart-root-${suffix}`);
3500 + yield* seedParentWithTerminalTask({
3501 + threadId,
3502 + projectId,
3503 + runId,
3504 + rootNodeId,
3505 + taskId: NodeId.make(`node:settled-only-restart-settled-${suffix}`),
3506 + deliveryState: "delivered",
3507 + now,
3508 + });
3509 + yield* eventSink.write({
3510 + commandId: reconcileCommandId(`settled-only-restart-${suffix}`),
3511 + events: [
3512 + runEvent({
3513 + threadId,
3514 + runId,
3515 + ordinal: 1,
3516 + status: "cancelled",
3517 + now,
3518 + providerThreadId: parentProviderThreadId(threadId),
3519 + userMessageId: MessageId.make(`message:seed-user:${threadId}`),
3520 + delegatedCompletion: { disposition: "open", nextGeneration: 2, delivery: null },
3521 + }),
3522 + ...(runningContinuation
3523 + ? [
3524 + runEvent({
3525 + threadId,
3526 + runId: RunId.make(`run:settled-only-restart:continuation-${suffix}`),
3527 + ordinal: 2,
3528 + status: "running",
3529 + now,
3530 + providerThreadId: parentProviderThreadId(threadId),
3531 + }),
3532 + ]
3533 + : []),
3534 + ],
3535 + });
3536 + const child = yield* seedRestartCancelledChild({
3537 + parentThreadId: threadId,
3538 + projectId,
3539 + parentRunId: runId,
3540 + rootNodeId,
3541 + name: `settled-only-restart-child-${suffix}`,
3542 + completionWake: "settled_only",
3543 + continuationPending: false,
3544 + now,
3545 + });
3546
3473 - yield* orchestrator.recoverDelegatedTasks;
3547 + yield* orchestrator.dispatch({
3548 + type: "delegated_task.completion-delivery.acknowledge",
3549 + commandId: CommandId.make(`command:settled-only-late-read-${suffix}`),
3550 + parentThreadId: threadId,
3551 + taskId: child.taskId,
3552 + observedByRunId: null,
3553 + });
3554 + yield* orchestrator.recoverDelegatedTasks;
3555
3475 - const projection = yield* orchestrator.getThreadProjection(threadId);
3476 - assert.equal(
3477 - projection.subagents.find((row) => row.id === child.taskId)?.completionDelivery?.state,
3478 - "claimed",
3479 - );
3480 - assert.deepEqual(
3481 - projection.runs.find((row) => row.id === runId)?.delegatedCompletion?.delivery?.taskIds,
3482 - [child.taskId],
3483 - );
3484 - }),
3556 + const projection = yield* orchestrator.getThreadProjection(threadId);
3557 + assert.equal(
3558 + projection.subagents.find((row) => row.id === child.taskId)?.completionDelivery?.state,
3559 + "claimed",
3560 + );
3561 + assert.deepEqual(
3562 + projection.runs.find((row) => row.id === runId)?.delegatedCompletion?.delivery?.taskIds,
3563 + [child.taskId],
3564 + );
3565 + }),
3566 );
3567
3568 it.effect.each(["a background command", "a nested subagent"] as const)(
apps/server/src/orchestration-v2/Orchestrator.ts
+113 -57
@@ -1460,6 +1460,53 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio
1460 ? undefined
1461 : projection.messages.find((candidate) => candidate.id === delivery.messageId);
1462
1463 + const isUnobservedAcknowledgement = (
1464 + command: OrchestrationV2ServerCommand,
1465 + ): command is Extract<
1466 + OrchestrationV2ServerCommand,
1467 + { readonly type: "delegated_task.completion-delivery.acknowledge" }
1468 + > & { readonly observedByRunId: null } =>
1469 + command.type === "delegated_task.completion-delivery.acknowledge" &&
1470 + command.observedByRunId === null;
1471 +
1472 + /** Parent run and wake message events that commit a planDelegatedCompletionDelivery result. */
1473 + const delegatedCompletionPlanEvents = (
1474 + threadId: ThreadId,
1475 + plan: {
1476 + readonly parentRun: OrchestrationV2Run | undefined;
1477 + readonly message: OrchestrationV2ThreadProjection["messages"][number] | undefined;
1478 + },
1479 + threadProviderInstanceId: ProviderInstanceId,
1480 + occurredAt: DateTime.Utc,
1481 + ): ReadonlyArray<Omit<OrchestrationV2DomainEvent, "id">> => [
1482 + ...(plan.parentRun === undefined
1483 + ? []
1484 + : [
1485 + {
1486 + type: "run.updated" as const,
1487 + threadId,
1488 + runId: plan.parentRun.id,
1489 + ...(plan.parentRun.rootNodeId === null ? {} : { nodeId: plan.parentRun.rootNodeId }),
1490 + providerInstanceId: plan.parentRun.providerInstanceId,
1491 + occurredAt,
1492 + payload: plan.parentRun,
1493 + },
1494 + ]),
1495 + ...(plan.message === undefined
1496 + ? []
1497 + : [
1498 + {
1499 + type: "message.updated" as const,
1500 + threadId,
1501 + ...(plan.message.runId === null ? {} : { runId: plan.message.runId }),
1502 + ...(plan.message.nodeId === null ? {} : { nodeId: plan.message.nodeId }),
1503 + providerInstanceId: plan.parentRun?.providerInstanceId ?? threadProviderInstanceId,
1504 + occurredAt,
1505 + payload: plan.message,
1506 + },
1507 + ]),
1508 + ];
1509 +
1510 const offerDelegatedCompletionDelivery =
1511 /* This helper runs for individual orchestration events; the enclosing operation owns the span. */
1512 Effect.fnUntraced(function* (threadId: ThreadId, parentRunId: RunId) {
@@ -2650,6 +2697,56 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio
2697 : "disposed";
2698 const now = yield* DateTime.now;
2699 const emitEvent = emit(events, command);
2700 + // A late wait can arrive after finalization held the result for its still-live spawning run.
2701 + if (isUnobservedAcknowledgement(command)) {
2702 + if (
2703 + !isTerminalDelegatedTaskStatus(task.status) ||
2704 + task.completionDelivery?.state !== "pending"
2705 + )
2706 + return;
2707 + const parentRun = projection.runs.find((run) => run.id === task.runId);
2708 + if (parentRun !== undefined && isLiveRun(parentRun)) return;
2709 + const records = yield* projectionStore
2710 + .getThreadRecords(command.parentThreadId, ["messages", "providerTurns"], {
2711 + messageRoles: ["user"],
2712 + })
2713 + .pipe(
2714 + Effect.mapError(
2715 + (cause) =>
2716 + new OrchestratorProjectionError({
2717 + threadId: command.parentThreadId,
2718 + cause,
2719 + }),
2720 + ),
2721 + );
2722 + const plan = yield* planDelegatedCompletionDelivery({
2723 + parentProjection: { ...projection, ...records },
2724 + parentRun,
2725 + task,
2726 + updatedTask: task,
2727 + now,
2728 + }).pipe(mapDispatchError(command));
2729 + if (plan.task.completionDelivery?.state === "pending") return;
2730 + yield* emitEvent({
2731 + type: "subagent.updated",
2732 + threadId: command.parentThreadId,
2733 + ...(task.runId === null ? {} : { runId: task.runId }),
2734 + nodeId: task.id,
2735 + driver: task.driver,
2736 + providerInstanceId: task.providerInstanceId,
2737 + occurredAt: now,
2738 + payload: plan.task,
2739 + });
2740 + for (const event of delegatedCompletionPlanEvents(
2741 + command.parentThreadId,
2742 + plan,
2743 + projection.thread.providerInstanceId,
2744 + now,
2745 + )) {
2746 + yield* emitEvent(event);
2747 + }
2748 + return plan.parentRun?.id;
2749 + }
2750 // task_status and t3_thread_read use distinct command IDs, so two
2751 // valid observations can race after their read preflight. Re-emit the
2752 // existing task row so the second dispatch is a successful idempotent
@@ -8619,28 +8716,13 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio
8716 occurredAt: now,
8717 payload: plan.task,
8718 });
8622 - if (plan.parentRun !== undefined) {
8623 - yield* emitEvent({
8624 - type: "run.updated",
8625 - threadId: command.parentThreadId,
8626 - runId: plan.parentRun.id,
8627 - ...(plan.parentRun.rootNodeId === null ? {} : { nodeId: plan.parentRun.rootNodeId }),
8628 - providerInstanceId: plan.parentRun.providerInstanceId,
8629 - occurredAt: now,
8630 - payload: plan.parentRun,
8631 - });
8632 - }
8633 - if (plan.message !== undefined) {
8634 - yield* emitEvent({
8635 - type: "message.updated",
8636 - threadId: command.parentThreadId,
8637 - ...(plan.message.runId === null ? {} : { runId: plan.message.runId }),
8638 - ...(plan.message.nodeId === null ? {} : { nodeId: plan.message.nodeId }),
8639 - providerInstanceId:
8640 - plan.parentRun?.providerInstanceId ?? parentProjection.thread.providerInstanceId,
8641 - occurredAt: now,
8642 - payload: plan.message,
8643 - });
8719 + for (const event of delegatedCompletionPlanEvents(
8720 + command.parentThreadId,
8721 + plan,
8722 + parentProjection.thread.providerInstanceId,
8723 + now,
8724 + )) {
8725 + yield* emitEvent(event);
8726 }
8727 const node = parentProjection.nodes.find((candidate) => candidate.id === task.id);
8728 if (node !== undefined) {
@@ -12914,40 +12996,12 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio
12996 occurredAt: now,
12997 payload: completionPlan.task,
12998 },
12917 - ...(completionPlan.parentRun === undefined
12918 - ? []
12919 - : [
12920 - {
12921 - type: "run.updated" as const,
12922 - threadId: parentThreadId,
12923 - runId: completionPlan.parentRun.id,
12924 - ...(completionPlan.parentRun.rootNodeId === null
12925 - ? {}
12926 - : { nodeId: completionPlan.parentRun.rootNodeId }),
12927 - providerInstanceId: completionPlan.parentRun.providerInstanceId,
12928 - occurredAt: now,
12929 - payload: completionPlan.parentRun,
12930 - },
12931 - ]),
12932 - ...(completionPlan.message === undefined
12933 - ? []
12934 - : [
12935 - {
12936 - type: "message.updated" as const,
12937 - threadId: parentThreadId,
12938 - ...(completionPlan.message.runId === null
12939 - ? {}
12940 - : { runId: completionPlan.message.runId }),
12941 - ...(completionPlan.message.nodeId === null
12942 - ? {}
12943 - : { nodeId: completionPlan.message.nodeId }),
12944 - providerInstanceId:
12945 - completionPlan.parentRun?.providerInstanceId ??
12946 - parentProjection.thread.providerInstanceId,
12947 - occurredAt: now,
12948 - payload: completionPlan.message,
12949 - },
12950 - ]),
12999 + ...delegatedCompletionPlanEvents(
13000 + parentThreadId,
13001 + completionPlan,
13002 + parentProjection.thread.providerInstanceId,
13003 + now,
13004 + ),
13005 ...(parentNode === undefined
13006 ? []
13007 : [
@@ -13858,6 +13912,7 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio
13912 Effect.filterOrFail(
13913 (planned) =>
13914 planned.events.length > 0 ||
13915 + isUnobservedAcknowledgement(command) ||
13916 command.type === "thread.background-work.settle" ||
13917 command.type === "thread.interrupt.unresponsive" ||
13918 command.type === "thread.stop" ||
@@ -14033,7 +14088,8 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio
14088 }
14089 if (
14090 command.type === "delegated_task.wake-policy" ||
14036 - command.type === "delegated_task.remote.complete"
14091 + command.type === "delegated_task.remote.complete" ||
14092 + isUnobservedAcknowledgement(command)
14093 ) {
14094 yield* mapDispatchError(command)(offerDelegatedCompletionDeliveries(command.parentThreadId));
14095 }
apps/server/src/orchestration-v2/ProviderContinuationService.test.ts
+8 -10
@@ -248,12 +248,12 @@ describe("ProviderContinuationService", () => {
248 });
249
250 it.effect(
251 - "a project-disabled instance refuses a delegated-completion wake exactly once, acknowledges it, and never retries",
251 + "a project-disabled instance refuses a delegated-completion wake exactly once, disposes it, and never retries",
252 () => {
253 return Effect.gen(function* () {
254 const attempts = yield* Ref.make(0);
255 const cleared = yield* Ref.make(false);
256 - const acknowledged = yield* Queue.unbounded<unknown>();
256 + const disposed = yield* Queue.unbounded<unknown>();
257 const layerThreads = Layer.mock(ThreadManagementService.ThreadManagementService)({
258 getThreadRecords: () => Effect.succeed(delegatedProjection()),
259 dispatch: (command) => {
@@ -271,7 +271,7 @@ describe("ProviderContinuationService", () => {
271 ),
272 );
273 }
274 - return Queue.offer(acknowledged, command).pipe(Effect.as({} as never));
274 + return Queue.offer(disposed, command).pipe(Effect.as({} as never));
275 },
276 });
277 const layerWorker = ProviderContinuationService.layer.pipe(
@@ -299,24 +299,22 @@ describe("ProviderContinuationService", () => {
299 assert.equal(yield* Ref.get(attempts), 1);
300 assert.isTrue(yield* Ref.get(cleared));
301
302 - const acknowledgements = (yield* Queue.takeAll(acknowledged)) as ReadonlyArray<{
302 + const dispositions = (yield* Queue.takeAll(disposed)) as ReadonlyArray<{
303 type: string;
304 taskId: string;
305 - observedByRunId: string | null;
305 }>;
306 assert.deepEqual(
308 - acknowledgements.map((command) => command.taskId),
307 + dispositions.map((command) => command.taskId),
308 ["node-provider-continuation-first", "node-provider-continuation-second"],
309 );
311 - for (const command of acknowledgements) {
312 - assert.equal(command.type, "delegated_task.completion-delivery.acknowledge");
313 - assert.isNull(command.observedByRunId);
310 + for (const command of dispositions) {
311 + assert.equal(command.type, "delegated_task.completion-delivery.dispose");
312 }
313
314 yield* TestClock.adjust("1 hour");
315 yield* Effect.yieldNow;
316 assert.equal(yield* Ref.get(attempts), 1);
319 - assert.equal(yield* Queue.size(acknowledged), 0);
317 + assert.equal(yield* Queue.size(disposed), 0);
318 }).pipe(
319 Effect.provide(Layer.merge(ProviderContinuationRequests.layer, layerWorker)),
320 Effect.scoped,
apps/server/src/orchestration-v2/ProviderContinuationService.ts
+4 -5
@@ -151,16 +151,15 @@ export const layer = Layer.effectDiscard(
151 ids.allocate
152 .command({
153 fixtureName: "delegated-completion",
154 - commandName: "acknowledge-disabled",
154 + commandName: "dispose-disabled",
155 })
156 .pipe(
157 - Effect.flatMap((ackCommandId) =>
157 + Effect.flatMap((disposeCommandId) =>
158 threads.dispatch({
159 - type: "delegated_task.completion-delivery.acknowledge",
160 - commandId: ackCommandId,
159 + type: "delegated_task.completion-delivery.dispose",
160 + commandId: disposeCommandId,
161 parentThreadId: request.threadId,
162 taskId,
163 - observedByRunId: null,
163 }),
164 ),
165 ),
apps/server/src/peer/RemoteDelegation.test.ts
+1 -1
@@ -1025,7 +1025,7 @@ it.effect.each(["no active parent run", "a newer run owned by another provider"]
1025 });
1026 expect(acknowledged.subagents[0]?.completionDelivery).toEqual({
1027 state: "acknowledged",
1028 - observedByRunId: null,
1028 + observedByRunId: parentRunId,
1029 });
1030 }),
1031 ).pipe(Effect.provide(NodeHttpServer.layerTest)),