返回 CodeWhale
wf_a4_cancel_mid_run.workflow.js
根目录 / docs / examples / dogfood-automatic / wf_a4_cancel_mid_run.workflow.js
1 /**
2 * #4131 WF-A4 — cancellation mid-run dogfood fixture.
3 *
4 * Starts multiple long-lived explore tasks so the operator has time to press
5 * panel [c] / X or run `/workflow cancel <run_id>`.
6 *
7 * Run: /workflow run docs/examples/dogfood-automatic/wf_a4_cancel_mid_run.workflow.js
8 * Then cancel while lifecycle is running.
9 */
10 export default async function () {
11 phase("Long work");
12 // Fan-out several slow scouts; cancel should finalize outstanding children.
13 const results = await parallel([
14 () =>
15 task({
16 description: "Slow scout 1 — cancel target",
17 label: "slow-1",
18 type: "explore",
19 prompt:
20 "If a foreground shell tool is available, first run `sleep 60`; otherwise state that limitation. Then thoroughly inventory crates/tui/src file names (read-only) and return a count. This creates a practical cancellation window.",
21 }),
22 () =>
23 task({
24 description: "Slow scout 2 — cancel target",
25 label: "slow-2",
26 type: "explore",
27 prompt:
28 "If a foreground shell tool is available, first run `sleep 60`; otherwise state that limitation. Then thoroughly inventory crates/config/src file names (read-only) and return a count. This creates a practical cancellation window.",
29 }),
30 () =>
31 task({
32 description: "Slow scout 3 — cancel target",
33 label: "slow-3",
34 type: "explore",
35 prompt:
36 "If a foreground shell tool is available, first run `sleep 60`; otherwise state that limitation. Then thoroughly inventory docs/ markdown titles (read-only) and return a count. This creates a practical cancellation window.",
37 }),
38 ]);
39
40 phase("Unreachable if cancelled");
41 return { scenario: "WF-A4", results };
42 }
43
43 lines JAVASCRIPT