Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): a cancelled delegated task no longer shows its child's question #18459

Mergedflamboh(GitHub profile, opens in a new tab)merged 8 commits intomain fromrefs/pull/18459/headmerged by maria-rcks View on GitHub

Showing 2 changed files with 131 additions and 0 deletions.

x
0 of 2 viewed, 2 left
58 additions and 0 deletionsapps/server/src/orchestration-v2/Orchestrator.tsModified
View file
@@ -10470,6 +10470,64 @@
...(progress.resultRun === undefined ? {} : { resultRun: progress.resultRun }),
+​
+ const { resultRun } = progress;
+ if (progress.state !== "result_available" || resultRun === undefined) return;
+ const status = delegatedTaskTerminalStatus(runOutcome(resultRun));
+ if (status !== "cancelled" && status !== "interrupted") return;
+ if (
+ yield* childAwaitsRestartContinuation(
+ childControls.runs,
+ resultRun,
+ options?.settledContinuationOf,
+ return;
+ // Cancelled or interrupted tasks must not leave async questions that resume the child.
+ // Callers hold the parent lock; dismiss takes the child lock, as follow-up intake does.
+ const { runtimeRequests } = yield* projectionStore.getThreadRecords(childThreadId, [
+ "runtimeRequests",
+ ]);
+ const pendingQuestions = runtimeRequests.filter(
+ (request) =>
+ request.status === "pending" &&
+ request.kind === "user_input" &&
+ request.responseCapability.type === "message",
+ );
+ if (pendingQuestions.length === 0) return;
+ const { nodes } = yield* projectionStore.getThreadRecords(childThreadId, ["nodes"]);