FE-745: Epic-scoped sandbox merge for verify-epic#152
Conversation
PR SummaryMedium Risk Overview A new SPEC/PLAN record invariant I124-K and mark Smaller diffs: txt fixture plan defers scaffolding epic integration until Reviewed by Cursor Bugbot for commit 1c4e36a. Bugbot is set up for automated code reviews on this repo. Configure here. |
🤖 Augment PR SummarySummary: This PR fixes multi-slice epic verification by running Changes:
Technical Notes: Merge order follows slice declaration order; later slices overwrite earlier paths and conflicts are surfaced in the event payload. Per-slice worktrees remain unmodified and the epic sandbox is rebuilt on each verification run. 🤖 Was this summary useful? React with 👍 or 👎 |
0f5cdbf to
9e6a0e8
Compare
701c569 to
257e1e0
Compare
1b11685 to
ad5652f
Compare
97540d6 to
2f0aba4
Compare
ad5652f to
fb39377
Compare
f1ff792 to
33a84c1
Compare
fb39377 to
2436dd5
Compare
33a84c1 to
71a21e2
Compare
2436dd5 to
46fe008
Compare
9ee7f6d to
7d2e69b
Compare
Parallel firing policy (petri-net.ts): - FiringPolicy = 'serial' | 'parallel' - runParallel: greedy token claiming + Promise.allSettled concurrent fire - Extracted isEnabled() private helper Shared resource pools (net-compiler.ts): - pool:test-agent / pool:code-agent replace per-slice agent places - agentPoolSize on RunPolicy bounds global concurrency - Worktree-per-slice: join(worktreeDir, sliceId) for all action contexts CLI (cook-cli.ts): - Retired dead --engine=proc|petri flag - Added --policy=serial|parallel wired to createOrchestrator Tests (engine-contract.test.ts): - Parallel added to all engines arrays (serial parity) - Concurrency proof, wall-clock benchmark, pool-bounded tests - Extracted withConcurrencyTracking() helper - Worktree isolation adapter test Decision gate passed: parallel measurably beats serial on wall clock. Co-authored-by: Amp <amp@ampcode.com>
Per-slice test-agent/code-agent places were replaced by shared pool:* places in FE-743; pool places are already excluded by the pool: prefix check.
Co-authored-by: Cursor <cursoragent@cursor.com>
verify-epic now runs against a freshly-merged <parentSandboxDir>/__epic__/<epicId>/
built from the epic's completed slice worktrees. Slices apply in plan declaration
order; later slices overwrite earlier ones on the same path and the collision is
reported via the new epic-sandbox-merged event. Per-slice worktrees are not mutated.
Unblocks multi-slice cook runs (verify-epic previously fell back to the empty
parent worktree root, halting every multi-slice plan).
- new src/orchestrator/src/epic-sandbox-merge.{ts,test.ts}
- net-compiler.ts verify-epic case wires the merger + emits epic-sandbox-merged
- engine-contract.test.ts: 'verify-epic receives parent sandboxDir' assertion
updated to pin the new __epic__/<epicId>/ invariant
- memory/SPEC.md: new I124-K invariant alongside I123-K
- memory/PLAN.md: petri-epic-verification-merge → Recently Completed; bullet
retired from petri-graph-compilation (no longer blocked on FE-700)
Validate epic/slice ids and relative paths, skip symlinks during merge walks, handle file/directory collisions safely, and only honor --version as a top-level flag. Co-authored-by: Cursor <cursoragent@cursor.com>
Slice sandboxes must not collide with the epic merge root; skip any accidental epic-root paths during merge and mirror the guard in net-compiler. Co-authored-by: Cursor <cursoragent@cursor.com>
Defer scaffolding epic verify in fixtures/txt plan and move CLI integration tests to text-ops. Merge verify-epic from worktree/<epicId>/ trees in plan order (target plus transitive deps) so slice work accumulates per epic instead of per-slice last-winner overwrites such as cli.ts. Co-authored-by: Cursor <cursoragent@cursor.com>
Restore per-slice runtime sandboxes with dependency seeding so parallel slices do not corrupt a shared epic worktree. verify-epic merges completed slice worktrees and follows slice depends_on across epics, not just epic depends_on. Co-authored-by: Cursor <cursoragent@cursor.com>
…rphans. Use preserveExisting for post-action test/assess passes; on action/rework reset, drop paths outside the dependency baseline before overlaying deps. Co-authored-by: Cursor <cursoragent@cursor.com>
The generic action transition was calling seedSliceSandboxFromDeps without preserveExisting, wiping files from prior steps in dependent slices. Co-authored-by: Cursor <cursoragent@cursor.com>
Seed dependency files in plan declaration order, always drop paths outside dep trees even when preserveExisting is set, and reuse resolveSliceWorktreeDir from net-compiler. Co-authored-by: Cursor <cursoragent@cursor.com>
Re-seeding before assess/run-tests must not delete slice-owned artifacts that are absent from dependency worktrees. Co-authored-by: Cursor <cursoragent@cursor.com>
visitSliceDeps now tracks visited slice ids so malformed plans with circular slice.depends_on cannot blow the stack. Co-authored-by: Cursor <cursoragent@cursor.com>
Mark epics before recursing into depends_on so cyclic epic graphs cannot blow the stack; add regression test. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
7d2e69b to
1c4e36a
Compare

Summary
verify-epicnow runs in a merged tree at<parentSandbox>/__epic__/<epicId>/built from completed slice sandboxes, following plan order (later slice wins on duplicate relative paths).epic-sandbox-mergehandler/transition andepic-sandbox-mergedreport event; SPEC invariant I124-K captures merge semantics for reviewers and future automation.Context
What changed
epic-sandbox-merge: assembles slice outputs into an epic-scoped directory immediately beforeverify-epicruns.__epic__slice id rejected at validation time to prevent merge namespace poisoning.Verification
npm run verifygreen.Out of scope
Traceability
petri-epic-verification-mergeinmemory/PLAN.md; umbrella H-6476.