Coordinating parallel coding agents in code, not prompts
Why parallel coding agents need coordination in code: admission control for one sandbox, reviews pinned to a source revision, and decisions journaled before acting.

When a parent coding agent spawns six sub-agents in one response, the model provider barely notices; six parallel completions are routine, so fan-out looks free. Underneath, all six land in the same two-CPU cloud sandbox, share one disk, and start dependency installs together while builds and reviews race each other.
The common reflex is a paragraph in the system prompt asking agents to take turns or wait for sibling builds. Even a compliant model cannot honor that, because no agent sees what its siblings are about to start in the same turn, and a prompt cannot enforce mutual exclusion. Coordination belongs in code that owns each shared resource: admission control for machine capacity, optimistic concurrency for asynchronous review, and write-ahead logging for orchestration decisions.
I built the admission and review controls below into the TypeScript runtime for a production coding agent, where a parent spawns sub-agents in one cloud sandbox, each the same agent with its own brief and model, while an advisory reviewer from another model family checks the diff.
Admission control for sessions and hardware
Model concurrency is not machine capacity, so session fan-out needs a hard bound. The runtime allows at most 16 concurrent sub-agents and queues up to 64 more, claiming each slot synchronously before the first await. When a model emits several spawn calls in one response, all enter the handler on the same turn of the event loop; a check that reads the count and awaits asynchronous work before incrementing admits the whole batch on one stale count.
Session caps still treat every child as equally cheap, whereas a two-CPU sandbox breaks on disk exhaustion and build contention. Before spawning a child, creating a Git worktree, installing dependencies, or starting a heavy build, a preflight checks free disk against a 25 GiB floor and measures rebuildable output like dependency trees and build artifacts against a cap. That directory walk is bounded at 250,000 entries and fails closed on hitting that limit, since a partial count proves nothing about the rest of the tree. Heavy builds also take an on-disk lease shared across processes so siblings serialize CPU-heavy work, though the lease binds only commands routed through the runtime.
A bare error from a preflight can do more damage than a delay. Hand a coding agent an unstructured out-of-space failure and it will solve the problem in the most direct way available, looking for something large to delete, which on a shared sandbox may be a sibling’s only copy of its work. Refusals are therefore typed and carry recovery steps, naming the rebuildable paths and restricting cleanup to owned, reconstructible output so dirty source stays intact.
Pinning asynchronous review to a source revision
Running the advisory reviewer asynchronously lets the coding agent keep working instead of blocking on every review call, which creates a versioning problem once the tree changes mid-review. Git HEAD is the wrong key, because a coding agent routinely edits files for hours before making a commit.
Instead, the runtime stamps each review request with a monotonic counter bumped on every source edit and a digest of the current diff. Only one review runs at a time; edits arriving mid-review coalesce into the newest state rather than queuing redundant rounds. When a verdict returns, the runtime runs an optimistic concurrency check against the current revision and drops any stale result on delivery, approval or findings alike. An old approval would certify code the reviewer never saw, and stale findings only send the agent back to rework edits it has already moved past.
If a review times out or an edit lands after the last review, the runtime records an incomplete review, never an approval. Even a current approval means only that a second model examined this diff and raised nothing serious, not that the patch is proven correct.
Re-deriving state and journaling decisions
Once orchestration spans multiple tasks across restarts, the shared state moves beyond any single transcript. Here I draw on a separate experimental orchestrator rather than the production runtime; it ran a project as a dependency graph with one coding agent and one reviewer per task. Anything an external authority already owns should be re-derived on restart instead of mirrored locally where it can drift. OpenAI’s Symphony specification, a published design for turning issue-tracker tickets into agent runs, takes this exact line, rebuilding its state from the tracker and workspace rather than keeping a scheduler database.
Re-derivation stops once the orchestrator makes decisions that neither an external tracker nor a worker transcript records. The orchestrator therefore journals an accepted plan, a review verdict, or reserved spend before acting on it. On recovery, that write-ahead log is trusted for what was decided, not for what reached the files. A crash can fall between logging a decision and finishing disk writes, so approved tasks that have not completed re-run over whatever changes already landed rather than assuming the working tree matches the last journal entry.
Chris Chabot, August 2026