Skip to content

v0.4.1 — Replanning under parallel dispatch

Choose a tag to compare

@a-radwan-20 a-radwan-20 released this 15 Jun 13:39
· 37 commits to main since this release

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:

  1. The supervisor stops dispatching new steps and lets any in-flight peer steps drain — their results are recorded, so no completed work is lost.
  2. At that settled snapshot (no steps mid-execution), it consults the configured Replanner with the goal, completed step outputs, the failed step + error, and the remaining unstarted steps.
  3. On success it persists the replacement via Manager.Replan, rebuilds the parallel dispatch state from the refreshed plan, and continues the DAG loop.
  4. ErrReplanRejected or an exhausted MaxReplans cap 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.Replan supersede generalized — replanning now supersedes every still-created step (marking it cancelled, "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

  • runParallel now skips terminal steps by their authoritative State field rather than a separate failed map (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