FE-743: Petri parallel execution with resource pools and per-slice sandboxes#149
FE-743: Petri parallel execution with resource pools and per-slice sandboxes#149kostandinang wants to merge 3 commits into
Conversation
PR SummaryMedium Risk Overview The interpreter gains a CLI exposes Reviewed by Cursor Bugbot for commit 421f18b. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
🤖 Augment PR SummarySummary: This PR completes FE-743 by adding true parallel Petri-net execution, shared agent resource pools, and per-slice worktree isolation to reduce wall-clock time on multi-slice plans. Changes:
Technical Notes: Parallel execution aims for serial parity while allowing bounded concurrency via shared pool tokens. 🤖 Was this summary useful? React with 👍 or 👎 |
6ff7563 to
d4e9d95
Compare
d4e9d95 to
d43222e
Compare
8e56a7c to
f959557
Compare
d43222e to
55945f9
Compare
13953ca to
386c3cf
Compare
386c3cf to
0f5cdbf
Compare
f959557 to
1747538
Compare
0f5cdbf to
9e6a0e8
Compare
da2bb0d to
6c4fd65
Compare
2f0aba4 to
f1ff792
Compare
6c4fd65 to
c51fdb7
Compare
f1ff792 to
33a84c1
Compare
c51fdb7 to
e76b68a
Compare
e76b68a to
745c45a
Compare
33a84c1 to
71a21e2
Compare
745c45a to
78b15a6
Compare
71a21e2 to
6f78604
Compare
Co-authored-by: Amp <amp@ampcode.com>
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>
Deposit fulfilled transition outputs even when a sibling sets ctx.halted in the same batch, matching serial commit semantics while still rolling back on handler rejection. Co-authored-by: Cursor <cursoragent@cursor.com>
78b15a6 to
78706a2
Compare
6f78604 to
421f18b
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 421f18b. Configure here.
| return placeId; | ||
| } | ||
|
|
||
| type TransitionClaim = { transition: TransitionDef; consumed: Token[] }; |
There was a problem hiding this comment.
Stale benign-residual entries mask removed per-slice places
Low Severity
BENIGN_RESIDUAL_PLACES still contains 'test-agent' and 'code-agent', but this PR removed per-slice agent places (e.g. slice:X:test-agent) and replaced them with shared pool:test-agent / pool:code-agent places. Pool places are already excluded by the startsWith('pool:') check in hasWorkBearingTokens, so the set entries are now dead code that can never match any place in the compiled net. Keeping them is confusing for anyone reading the deadlock-detection logic, as it implies per-slice agent places still exist.
Reviewed by Cursor Bugbot for commit 421f18b. Configure here.



Summary
FiringPolicy(serial|parallel) to the Petri interpreter: parallel mode claims all ready transitions and fires them concurrently withPromise.allSettled, subject to pool limits.Context
worktreeDirtosandboxDirclarifies that the path is a per-run filesystem root, not necessarily a git worktree (brownfield worktrees land in FE-755).What changed
FiringPolicy:serialpreserves prior single-fire behavior;parallelbatches independent ready transitions.RunPolicy.agentPoolSize: caps simultaneous agent-backed transitions viapool:test-agentandpool:code-agentplaces.join(sandboxDir, sliceId)so concurrent slices do not stomp the same tree.--engineflag; adds--policy=serial|parallelfor explicit policy selection at cook time.Verification
npm run verifygreen.Out of scope
verify-epic(FE-745).Traceability
petri-parallel-executioninmemory/PLAN.md; umbrella H-6476.