Skip to content

feat: swarm dispatch — autonomous decompose-and-fan-out - #6

Merged
adbarc92 merged 27 commits into
mainfrom
worktree-feat+swarm-dispatch
Jun 9, 2026
Merged

feat: swarm dispatch — autonomous decompose-and-fan-out#6
adbarc92 merged 27 commits into
mainfrom
worktree-feat+swarm-dispatch

Conversation

@adbarc92

@adbarc92 adbarc92 commented Jun 9, 2026

Copy link
Copy Markdown
Owner

@

Summary

Adds a daemon-orchestrated swarm: POST /swarms points 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

  • Engine preconditions (P1–P4): next_id/next_swarm seeded from the store on startup (restart-safe id allocation); committed_spend (counts non-terminal reservations as MAX(usd_cap,cost), terminal cost, and planner cost) replaces the cap-blind spend_since on both admission paths — each as a single check+insert critical section; one authoritative TERMINAL_PHASE_STRS consumed by reconcile + rollup.
  • Pure core (swarm.rs): admit_lanes dual-guardrail (lane cap + usd_budget − planner_cost envelope) and a sanitizing slug.
  • Seams: Planner (FakePlanner / ClaudePlanner) and DocSource (FakeDocSource / GitDocSource), selected by mode so a demo swarm never makes a paid call.
  • Persistence: swarms + swarm_lanes tables, units.swarm_id, atomic commit_lane_unit (row + back-link in one txn), swarm_rollup.
  • Orchestration & API: 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.
  • Restart-safety: planning→failed; fanning_out→idempotent resume.
  • Security: GitDocSource validates 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 tests ignored by design
  • cargo clippy -p fleet-core -p fleetd --all-targets -- -D warnings — clean
  • P2 concurrent-admission regression test (two missions racing the cap → exactly one admitted), verified non-flaky
  • Manual: real-mode swarm against the sandbox repo (requires Docker + gh + ANTHROPIC_API_KEY)
    @

adbarc92 added 27 commits June 9, 2026 10:29
@adbarc92
adbarc92 merged commit 7c797c4 into main Jun 9, 2026
@adbarc92
adbarc92 deleted the worktree-feat+swarm-dispatch branch June 9, 2026 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant