v0.4.1 — Replanning under parallel dispatch
Replanning under parallel dispatch
LLM-driven replanning — shipped in v0.3.0 for sequential missions — now works in parallel mode too. A failing step in a SetPlanParallel mission no longer terminates the whole mission when a Replanner is configured; the supervisor recovers, exactly as the sequential path does.
How it works
When a step fails in a parallel mission:
- The supervisor stops dispatching new steps and lets any in-flight peer steps drain — their results are recorded, so no completed work is lost.
- At that settled snapshot (no steps mid-execution), it consults the configured
Replannerwith the goal, completed step outputs, the failed step + error, and the remaining unstarted steps. - On success it persists the replacement via
Manager.Replan, rebuilds the parallel dispatch state from the refreshed plan, and continues the DAG loop. ErrReplanRejectedor an exhaustedMaxReplanscap fails the mission as before. The cap is per-mission across both dispatch modes.
What's new
- Parallel replan in
runParallel— the drain-then-replan flow above. Manager.Replansupersede generalized — replanning now supersedes every still-createdstep (marking itcancelled, "superseded by replan"), regardless of position relative to the failed step. In parallel mode this correctly catches steps that were blocked on a dependency and sit earlier in created-order than the failure — which would otherwise orphan the post-replan DAG into a false deadlock. Sequential behavior is unchanged.
Changed
runParallelnow skips terminal steps by their authoritativeStatefield rather than a separatefailedmap (removed as dead state). The DAG-completion check treats completed, cancelled, and superseded-failed steps all as "settled," so a post-replan plan with an audit-relic failed step completes cleanly instead of tripping the deadlock guard.
Compatibility
Fully backwards compatible. Missions with no Replanner configured fail on the first step failure exactly as in v0.4.0 — verified by test. No schema, plan, or wire-format change.
Tests
4 new supervisor tests (parallel replan recovers, rejection fails the mission, MaxReplans cap, no-replanner-still-fails-fast) + 1 new mission test (supersede a still-created step positioned before the failure). Full repo go test -race -count=1 ./... passes across all 128 packages, including 5× stress on the timing-sensitive parallel-replan tests. Cross-compiles clean for linux/arm64 + windows/amd64 under CGO_ENABLED=0; govulncheck clean on go1.26.4.
Full changelog: https://github.com/LumabyteCo/aibutler/blob/main/CHANGELOG.md