dispatch: add cascade mode for bounded recursive fan-out #29

Closed
opened 2026-05-28 04:48:25 +00:00 by coilysiren · 0 comments
Owner

Add a cascade dispatch mode: a detached worker allowed to recursively dispatch its own headless/cascade sub-workers, bounded by a hard depth budget.

Follow-on to coilysiren/coily#130 (the consult-posture work). Same axis, faster end: where consult raised the interruption budget, cascade raises the autonomy budget.

The problem

Mass migrations require branching trees of dependent work. Telling a single headless worker to "migrate repos A, B, C, D" makes it determine the scope is too large and kick back. Doing the decomposition by hand means manually coily dispatch headless-ing 12+ sub-tasks. There was no mode that could fan the work out itself.

What changed

  • New cascade subverb on the detached (headless) surface. Spawns exactly like headless (detached claude -p, log file, returns immediately), but with a prompt posture that authorizes and instructs recursive decomposition: assess scope, and if too large, file sub-issues per slice and dispatch a worker against each.
  • The leaf workers are plain coily dispatch headless (do the work, close their own issue). Slices that still need splitting get coily dispatch cascade sub-trees.
  • Hard depth budget (--depth, default 3, max 5) prevents fork bombs. dispatch stamps COILY_DISPATCH_CASCADE_DEPTH into each spawned child's environment, decrements it on every nested cascade, and refuses to spawn a cascade past the floor (budget 1 = headless leaves or direct work only). headless children inherit 0, so a leaf cannot start a cascade beneath itself. Only a top-level (non-dispatched) invocation starts a fresh budget.
  • Shared runDetached helper so headless and cascade share spawn / trust / meta / dry-run.

Design decisions (settled with Kai)

  • Name: cascade (evokes the dependent-work tree flowing down through levels).
  • Bound: hard env-enforced budget, not a soft prompt-only one - fork-bomb safety.
  • Not --dangerously-skip-permissions: the worker still runs under the lockdown and audit. The autonomy is the prompt posture plus permission to call coily dispatch (already allowlisted via Bash(coily:*)).
Add a `cascade` dispatch mode: a detached worker allowed to recursively dispatch its own headless/cascade sub-workers, bounded by a hard depth budget. Follow-on to [coilysiren/coily#130](https://forgejo.coilysiren.me/coilysiren/coily/issues/130) (the consult-posture work). Same axis, faster end: where `consult` raised the interruption budget, `cascade` raises the autonomy budget. ## The problem Mass migrations require branching trees of dependent work. Telling a single headless worker to "migrate repos A, B, C, D" makes it determine the scope is too large and kick back. Doing the decomposition by hand means manually `coily dispatch headless`-ing 12+ sub-tasks. There was no mode that could fan the work out itself. ## What changed - New `cascade` subverb on the detached (headless) surface. Spawns exactly like headless (detached `claude -p`, log file, returns immediately), but with a prompt posture that authorizes and instructs recursive decomposition: assess scope, and if too large, file sub-issues per slice and dispatch a worker against each. - The leaf workers are plain `coily dispatch headless` (do the work, close their own issue). Slices that still need splitting get `coily dispatch cascade` sub-trees. - **Hard depth budget** (`--depth`, default 3, max 5) prevents fork bombs. dispatch stamps `COILY_DISPATCH_CASCADE_DEPTH` into each spawned child's environment, decrements it on every nested cascade, and refuses to spawn a cascade past the floor (budget 1 = headless leaves or direct work only). headless children inherit `0`, so a leaf cannot start a cascade beneath itself. Only a top-level (non-dispatched) invocation starts a fresh budget. - Shared `runDetached` helper so headless and cascade share spawn / trust / meta / dry-run. ## Design decisions (settled with Kai) - Name: `cascade` (evokes the dependent-work tree flowing down through levels). - Bound: hard env-enforced budget, not a soft prompt-only one - fork-bomb safety. - Not `--dangerously-skip-permissions`: the worker still runs under the lockdown and audit. The autonomy is the prompt posture plus permission to call `coily dispatch` (already allowlisted via `Bash(coily:*)`).
Sign in to join this conversation.
No labels
P0
P1
P2
P3
P4
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
coilyco-flight-deck/cli-guard#29
No description provided.