fix(delegate-task): cancel child background tasks on parent abort and timeout in unstable agent flow
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import type { ExecutorContext } from "./executor-types"
|
||||
|
||||
export async function cancelUnstableAgentTask(
|
||||
manager: ExecutorContext["manager"],
|
||||
taskID: string | undefined,
|
||||
reason: string
|
||||
): Promise<void> {
|
||||
if (!taskID || typeof manager.cancelTask !== "function") {
|
||||
return
|
||||
}
|
||||
|
||||
await Promise.allSettled([
|
||||
manager.cancelTask(taskID, {
|
||||
source: "unstable-agent-task",
|
||||
reason,
|
||||
skipNotification: true,
|
||||
}),
|
||||
])
|
||||
}
|
||||
Reference in New Issue
Block a user