mirror of
https://github.com/lobehub/lobe-chat.git
synced 2026-06-14 03:30:19 +00:00
11e6619a3c
* ✨ feat(server,task): batch run subtasks in dependency order Adds a "Run all" entry on the subtasks panel that kicks off the first dependency layer; subsequent layers fire automatically as upstream tasks complete. Layer planning (Kahn topo sort + cycle detection) lives in a new TaskGraphService and runs server-side via two TRPC procedures. Also fixes a pre-existing bug where `task.updateStatus(completed)` was flipping unlocked dependents to `running` without ever invoking the runner — leaving them in a phantom running state with no topic in flight. Cascade now goes through TaskRunnerService.cascadeOnCompletion from all three completion paths (TRPC updateStatus, brief approval, judge auto-pass), so dependency chains advance end-to-end on their own. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * 🐛 fix(server,task): preserve edges to in-flight and out-of-scope upstreams The graph used to drop any dependency edge whose upstream wasn't in the runnable set. That silently freed two correctness-breaking cases: - A backlog subtask that depends on a *running / scheduled* sibling landed in layer 1 and got kicked off before its blocker finished. - A descendant that depends on a task *outside the current subtree* (allowed by the schema) lost its blocker entirely and ran prematurely. Edges are now classified per dependency: terminal-OK upstreams drop the edge; in-batch runnable upstreams keep their in-degree contribution; any other status — in-flight, runnable but out of scope, or unknown — marks the dependent as `blockedExternally` and excludes it from the layered plan. External blockage propagates transitively through in-batch edges so we never run a downstream of a blocked task either. `planForParent` fetches statuses for cross-scope upstreams so the classifier has real data to decide on. The UI surfaces the new bucket via `RunSubtasksPreview` and keeps the modal open (with the run button disabled) when a plan has nothing to start but does have blocked tasks worth explaining. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>