feat: swarm dispatch — autonomous decompose-and-fan-out - #6
Merged
Conversation
…in create_mission
… cap trip; collapse lane_spec
…oc_path; order swarm list
…nish P3 in reconcile; unique clone dirs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@
Summary
Adds a daemon-orchestrated swarm:
POST /swarmspoints the engine at a doc/spec path inside the target repo, a planner agent autonomously decomposes it into independent lanes, and the daemon fans out one agent unit per lane — each running the existing SP1 dispatch→oracle→build/review→PR pipeline unchanged, on its own branch/PR. Bounded by a hard lane cap and a per-swarm worst-case USD ceiling.Built as a pure, sync admission core + two seam traits with fakes, layered over the untouched per-unit driver. Spec hardened through 3 adversarial critique rounds; design + plan committed under
docs/superpowers/.What landed
next_id/next_swarmseeded from the store on startup (restart-safe id allocation);committed_spend(counts non-terminal reservations asMAX(usd_cap,cost), terminal cost, and planner cost) replaces the cap-blindspend_sinceon both admission paths — each as a single check+insert critical section; one authoritativeTERMINAL_PHASE_STRSconsumed by reconcile + rollup.swarm.rs):admit_lanesdual-guardrail (lane cap +usd_budget − planner_costenvelope) and a sanitizingslug.Planner(FakePlanner/ClaudePlanner) andDocSource(FakeDocSource/GitDocSource), selected by mode so ademoswarm never makes a paid call.swarms+swarm_lanestables,units.swarm_id, atomiccommit_lane_unit(row + back-link in one txn),swarm_rollup.run_swarm(plan→admit→fan-out, states planning→fanning_out→running / failed / empty; running→done computed at read);POST /swarms(sync-validated, returns immediately),GET /swarms,GET /swarms/:id.GitDocSourcevalidates against argv flag-smuggling and path traversal (https-only, no leading-, no../absolute doc paths, post-clone canonicalize+containment).Test Plan
cargo test— fleet-core 30 + fleetd 71 pass, 0 failed; 3 Docker/git-gated integration testsignoredby designcargo clippy -p fleet-core -p fleetd --all-targets -- -D warnings— clean@