Run workflows as managed jobs with progress and cancellation #1517
CHXZAVARKA
started this conversation in
Ideas
Replies: 1 comment
|
workflow 前台阻塞确实限制编排——managed jobs(后台运行 + 进度 + 取消)能让父 agent 并行处理,是工作流系统化的关键一步。 第 9 章的工作流章节讨论了这个方向(确定性编排 vs 并行):https://github.com/Electricitysheep/dsh-handbook/blob/main/docs/09-mcp-subagent-workflow.md |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Problem
The
workflowtool runs in the foreground and returns only after its worker finishes. While it is running, the parent agent cannot do other work. Cancellation also loses the partial result, and there is no supported way to inspect the active phases or continue from a completed phase.This is a rough edge for the kind of fan-out work the tool is designed for. A ten-minute research or review workflow should not make the parent session look stuck.
Proposal
Let a workflow run as a managed job through the existing jobs subsystem.
An optional background mode could return a job id immediately. The existing job tools could then expose status, recent logs, the active phase, completed branches, failures, and the final result. Killing the job should cancel the worker and every child agent, then settle the job once.
Foreground behavior should remain unchanged for callers that want one blocking result.
How I would implement it
job_killuse the same cleanup path.phase()outputs as checkpoints. Arbitrary JavaScript stacks cannot be resumed safely, so the first resumable contract should restart only from an explicit phase boundary.The existing jobs subsystem already owns most of the lifecycle rules. The workflow package would become a producer instead of inventing another background-task API.
Acceptance criteria
job_readandjob_waitexpose the current phase, branch outcomes, and bounded logs.job_killcancels the worker and all live children without duplicate completion notices.phase()boundaries can restart from the last completed checkpoint after interruption.The current behavior is described in the workflow tool README.
All reactions