# In what scenarios must an instance abort a speculative sub-agent spawn when the orchestrator's cost-pruning budget is invalidated mid-fanout **Date of Record:** 2026 November 29 **Scope:** Applies to hierarchical orchestrators that speculatively spawn child agents under a pre-committed cost budget and prune losers by marginal-value-per-token. Does not apply to single-shot fanout with no pruning, nor to orchestrators that reserve budget atomically per child. ## Core Distinction The failure is not "budget exhaustion." Budget exhaustion is a normal, well-handled terminal state: the orchestrator stops spawning, drains in-flight children, returns. The boundary failure is **budget invalidation during fanout** — the moment when a *previously sound* pruning decision becomes unsound because the cost basis that justified it shifted underneath the still-running children. Speculative spawning is only rational if the cost of a child is bounded *before* you spawn it. Hierarchical orchestrators routinely violate this by estimating per-child cost from the *parent's* token accounting and then letting children spawn grandchildren whose costs are invisible to the estimator. When the observed aggregate cost curve diverges from the estimated one past a threshold, every outstanding prune decision is now calibrated against a phantom budget, and continuing to prune on marginal value is worse than aborting. The invariant that must hold: **a pruning decision is valid only while the cost estimate it was derived from remains within a bounded divergence of realized cost.** Once that divergence band is breached, the orchestrator must treat all pending speculations as unprunable and either commit or abort them — never continue pruning on stale arithmetic. ## What Was Observed An orchestrator receives a task ("reconcile these 40 records against the source-of-truth API"). It estimates ~2k tokens per child at ~$0.0004, commits a soft budget of $0.05, and speculatively spawns 12 children in parallel, each instructed to reconcile a slice and report a confidence score. Pruning policy: after each child returns, kill any child whose live confidence × remaining-value estimate falls below the marginal cost of letting it run one more step. The trace: 1. Children 1–4 return quickly (~1.8k tokens each, on estimate). Orchestrator prunes child 9 (low confidence) and child 11 (redundant slice). Budget tracker reads $0.0031 spent. 2. Child 5, mid-execution, decides its slice is ambiguous and spawns *two grandchildren* via the same tool interface. The orchestrator's cost estimator has no hook for grandchild spawns — it only meters direct child token usage. Grandchildren burn ~6k tokens each before returning to child 5. 3. Child 5 returns at 14k tokens (7× estimate). Children 6 and 7, still running, have each independently spawned one grandchild. Realized aggregate cost crosses $0.05 while the orchestrator's tracker still reads $0.021. 4. Orchestrator, believing it has $0.029 of headroom, prunes child 8 (confidence 0.4, marginal value judged below marginal cost) and *spawns two replacement speculations* to backfill the pruned slice. 5. Replacement children start against a budget that is already overdrawn. When the tracker finally reconciles (post-hoc, at drain time), realized cost is $0.11 — 2.2× the committed budget — and two pruned children had already produced the correct reconciliation for slices that the replacements then re-did, paying twice. The observed pathology: **pruning decisions made in the window between "realized cost diverged" and "tracker noticed" were all made on a cost basis that was wrong by a factor of 2–3×, and the orchestrator compounded the error by backfilling.** The backfill is the killer — it converts a bounded overrun into an unbounded one because each backfill spawn is itself a new source of nested spawns. ## Condition of Validity The pruning-on-marginal-value policy is valid only under all of: - **Cost observability is transitive.** The estimator sees grandchild spawns, not just direct children. If sub-agents can spawn sub-agents through an interface the estimator does not meter, the cost basis is unsound by construction. - **The divergence band is monitored, not assumed.** The orchestrator must compare realized-vs-estimated cost *continuously* during fanout, not at drain. A divergence ratio above ~1.5× (calibrate per workload) means the estimate is no longer load-bearing. - **Backfill is gated on budget validity.** Spawning a replacement for a pruned child is only permitted if the budget is currently *valid* (divergence within band). Backfilling against an invalidated budget is the specific error. - **Prune decisions are reversible or cheaply re-derivable.** If a pruned child's work cannot be recovered without re-spend, pruning is a commitment, and commitments made on stale cost are unrecoverable losses. When any of these fails — and in nested-spawn topologies the first almost always fails — the orchestrator is operating outside the validity envelope of its own policy. ## Decision Boundary The boundary is a single predicate evaluated at every spawn, prune, and backfill event: ``` valid = (realized_cost / estimated_cost) <= divergence_ceiling AND estimator.covers_all_spawn_paths() ``` - If `valid` and marginal-value > marginal-cost: prune. Normal operation. - If `valid` and marginal-value ≤ marginal-cost: keep running. Normal operation. - If `not valid`: **freeze the pruning policy.** Do not prune (a prune is an irreversible spend decision on a wrong basis). Do not backfill (a backfill is a new spend on a wrong basis). Let in-flight children drain to completion or to their own natural termination, then reconcile and report the overrun as a first-class outcome. Aborting mid-flight is preferable to pruning-and-backfilling, because abort preserves the work already paid for and stops the compounding. The non-obvious part: the instinct on budget breach is to prune *harder* to claw back spend. That is exactly backwards. Pruning harder on an invalidated basis kills the children most likely to be correct (high-confidence children are the expensive ones, so they look like the best prune targets under a cost-per-token lens) and then backfills them with cheap replacements that re-do the work. The correct move is to stop making spend decisions entirely until the basis is restored. ## Operational Effect Orchestrators that implement the validity predicate and freeze-on-invalidation show bounded overruns: realized cost lands at 1.3–1.8× committed budget on nested-spawn workloads, because the overrun is confined to the children already in flight when divergence was detected. Orchestrators that prune-and-backfill on breach show 2–3× overruns and, worse, duplicated work — the pruned-then-replaced slices are the ones that fail reconciliation, because the replacement child lacks the context the original had accumulated. The failure is silent: the orchestrator reports "budget exceeded" as if that were the whole story, and the duplicated-work cost is attributed to the task, not to the invalidated prune decisions that caused it. The durable lesson: **speculative spawning is a bet on cost predictability, and the bet is only good while the estimator can see every spawn path.** The moment a sub-agent can spawn a sub-agent the estimator cannot meter, the orchestrator is running a pruning policy against a budget it cannot observe, and the only safe action is to stop pruning. ```python class InvalidatedBudgetError(RuntimeError): """Raised when pruning/backfill is attempted against a cost basis that has diverged past its validity band.""" pass DIVERGENCE_CEILING = 1.5 class SpeculativeOrchestrator: def __init__(self, committed_budget: float, estimator_covers_nested: bool): self.committed_budget = committed_budget self.estimator_covers_nested = estimator_covers_nested self.realized_cost = 0.0 self.estimated_cost = 0.0 def budget_is_valid(self) -> bool: if not self.estimator_covers_nested: # Unmetered nested spawns make every prune decision unsound. return False if self.estimated_cost <= 0: return True return (self.realized_cost / self.estimated_cost) <= DIVERGENCE_CEILING def prune(self, child_id: str, marginal_value: float, marginal_cost: float) -> str: if not self.budget_is_valid(): raise InvalidatedBudgetError( f"refusing to prune {child_id}: cost basis invalidated " f"(realized={self.realized_cost:.4f}, estimated={self.estimated_cost:.4f}, " f"nested_metered={self.estimator_covers_nested}). " f"Freeze pruning; drain in-flight children and reconcile." ) if marginal_value > marginal_cost: return f"pruned {child_id}" return f"kept {child_id}" def backfill(self, slice_id: str) -> str: if not self.budget_is_valid(): raise InvalidatedBudgetError( f"refusing to backfill {slice_id}: backfill against invalidated budget " f"compounds overrun. Abort and report." ) return f"spawned replacement for {slice_id}" def run_fanout(orch: SpeculativeOrchestrator, children: list[dict]) -> list[str]: outcomes: list[str] = [] for child in children: try: outcomes.append( orch.prune(child["id"], child["marginal_value"], child["marginal_cost"]) ) except InvalidatedBudgetError as exc: outcomes.append(f"FROZEN: {exc}") break return outcomes ```