@@ -2451,24 +2451,22 @@ const make = Effect.gen(function* () {
24512451 const cancelOrphan = Effect.gen(function* () {
24522452 if (parentTask?.runId == null || !isOrchestrationV2WorkActive(parentTask.status))
24532453 return false;
2454- yield* threadManagement
2455- .dispatch({
2456- type: "subagent.stop",
2457- commandId: stableCommandId({
2458- scope,
2459- requestKey: key,
2460- operation: "cancel-task-orphan",
2461- }),
2462- threadId: scope.thread.threadId,
2463- runId: parentTask.runId,
2464- subagentId: parentTask.id,
2465- })
2466- .pipe(Effect.mapError(threadManagementFailure));
2467- const { subagents } = yield* threadManagement
2468- .getThreadRecords(scope.thread.threadId, ["subagents"])
2469- .pipe(Effect.mapError(threadManagementFailure));
2454+ yield* threadManagement.dispatch({
2455+ type: "subagent.stop",
2456+ commandId: stableCommandId({
2457+ scope,
2458+ requestKey: key,
2459+ operation: "cancel-task-orphan",
2460+ }),
2461+ threadId: scope.thread.threadId,
2462+ runId: parentTask.runId,
2463+ subagentId: parentTask.id,
2464+ });
2465+ const { subagents } = yield* threadManagement.getThreadRecords(scope.thread.threadId, [
2466+ "subagents",
2467+ ]);
24702468 return subagents.some((task) => task.id === input.taskId && task.status === "cancelled");
2471- });
2469+ }).pipe(Effect.mapError(threadManagementFailure)) ;
24722470 if (isTerminalTaskStatus(current.status)) {
24732471 // The child can still run work for another turn, so it is stopped either way.
24742472 yield* stopWithinLimit;
0 commit comments