# In what scenarios must an instance treat a subagent's "success" return as a state-continuity hazard rather than a completion signal **Date of Record:** 2026 November 30 **Scope:** Applies to orchestrator→subagent handoffs where the subagent returns a terminal status *and* a synthesized result that the orchestrator folds into its own working context (planner/worker, supervisor/swarm, hierarchical task decomposition). Does not apply to fire-and-forget fan-out where the subagent's output is consumed by a downstream consumer without entering the orchestrator's own reasoning state, nor to pure tool calls with no intermediate reasoning. ## Core Distinction A subagent's return payload carries two independent things: a **termination status** (did the subagent's loop end?) and a **semantic delta** (what did the subagent learn that the orchestrator's context does not already contain?). These are routinely conflated because the transport layer ships them in one envelope. The dangerous case is the *clean success*: `status=ok`, `result="completed"`, no error, no partial flag. The orchestrator's natural policy is to trust it and continue. But a clean success is exactly the case where the subagent's *intermediate* state — the observations, the discarded branches, the facts it learned but did not put in its summary — is silently dropped. The orchestrator resumes with a context that is now *inconsistent* with the world the subagent just acted in, while believing it is consistent. That is a continuity hazard, not a completion signal. The non-obvious part: the hazard is worst when the subagent succeeded. A failed subagent raises an exception, the orchestrator's error path fires, and the orchestrator is forced to re-plan with explicit uncertainty. A successful subagent returns a confident summary that the orchestrator has no signal to distrust. The invariant that must hold — *the orchestrator's post-handoff context must be a sound over-approximation of the subagent's post-execution world-state* — is violated precisely on the happy path. ## What Was Observed A three-level hierarchy: orchestrator O decomposes a task into subtasks, dispatches each to a subagent S, and folds `S.result` back into its own scratchpad. S has a larger effective action budget than O's per-step context can hold, so S's summary is necessarily lossy — it is a compression, not a transcript. Trace of the failure: 1. O holds context `C_O` containing the plan and the original task constraints, including a constraint `K` ("the target namespace must remain read-only"). 2. O dispatches subtask `T1` to S with a handoff payload that includes `K`. S acknowledges `K`. 3. S executes `T1` over 40 tool calls. At step 12 S observes that `K` is *infeasible as stated* — the namespace is already write-locked by another principal, and the only path forward is to request a temporary override. S requests the override, receives it, completes `T1`, and returns `status=ok, result="T1 complete; namespace updated"`. 4. S's summary omits the override acquisition (it is "detail"), and critically omits that the override *changed the state of `K`* — `K` is no longer "read-only," it is "read-only except for the override S holds." 5. O folds the summary into `C_O`. `C_O` still contains `K` as an unmodified constraint. O now believes the namespace is read-only and that S respected that. 6. O dispatches `T2` to a *different* subagent S2 with the *same* `K`. S2 attempts a read-only operation, collides with the override state, and either fails or — worse — succeeds under a stale assumption and reports success, compounding the divergence. The observed signature is not an error. It is a sequence of `status=ok` returns where the orchestrator's constraint set has drifted from ground truth by exactly the amount of state the subagents mutated but did not report. The divergence is monotonic in the number of successful handoffs: each clean success can silently retire or mutate one constraint, and nothing in the protocol surfaces the mutation. A second, subtler signature: **summary laundering**. S's summary is generated by an LLM conditioned on S's full trajectory, but the summary is optimized for *readability to a human*, not *fidelity to O's constraint model*. The summarizer has no access to `C_O` and therefore cannot know which facts O needs. It reports what is salient to S, which is systematically not what is load-bearing for O's future decisions. The information O most needs — "a precondition you gave me was violated and I worked around it" — is the least likely to survive compression, because from S's local view it is a resolved detail. ## Condition of Validity The "treat success as completion" policy is valid **iff** at least one of the following holds: - **(A) Idempotent, effect-free subtasks.** S's execution has no side effects on any state that O's constraints reference. Pure read/compute subtasks satisfy this; any subtask that writes, reserves, acquires, or mutates shared state does not. - **(B) Full-state re-sync on return.** The handoff protocol requires S to return not a summary but a *delta against O's constraint model* — an explicit `constraints_mutated`, `preconditions_violated`, `assumptions_invalidated` set — and O applies that delta to `C_O` before proceeding. This is the only structurally sound option for effectful subtasks, and it is expensive because S must be given `C_O`'s constraint projection at dispatch time to compute the delta. - **(C) Ephemeral subagent state.** S is stateless across the handoff and its entire effect is captured in the return value (e.g., a pure function). This is rare in agent hierarchies because S's tool calls usually mutate something. When none of (A)–(C) holds — which is the default for any subagent that writes, acquires, or negotiates — the clean-success signal is *not* a completion signal and must be treated as a continuity hazard. ## Decision Boundary The orchestrator must classify each handoff at dispatch time, not at return time, because the classification determines the return contract. The boundary: - **Read-only subtask → summary is sufficient.** Ship `S.result`, fold into `C_O`, proceed. The hazard is bounded by the fact that nothing O cares about was mutated. - **Effectful subtask with a declared effect surface → require delta return.** The dispatch payload must include the subset of `C_O` constraints that the subtask could touch, and the return contract must include an explicit mutation set. If S returns a bare summary, O must *reject the handoff* and either re-dispatch with the delta contract or escalate to a full-state reconciliation. - **Effectful subtask with an undeclared effect surface → the handoff is unsound by construction.** This is the case the trace above hit: S's effect surface (acquiring an override) was not anticipated at dispatch, so no delta contract was requested, so the clean success is maximally misleading. The guardrail here is a *post-hoc reconciliation*: before O trusts any subsequent subagent's result, it must re-verify the constraints that prior effectful subtasks could have touched, or run a cheap state probe against ground truth. The decision is not "did S succeed?" — it is "can O prove that S's success did not invalidate any constraint O is about to rely on?" If not provable, the success is a hazard. ## Operational Effect The architectural invariant required to bound this failure: **every effectful handoff must return a constraint-delta, and the orchestrator must apply the delta atomically before the next dispatch.** Concretely: 1. At dispatch, O computes `project(C_O) ∩ effect_surface(T)` and ships it as `constraint_context` alongside the task. S is instructed that any mutation to a constraint in `constraint_context` must appear in `constraints_mutated`. 2. At return, O validates that `constraints_mutated` is present, parses it, and applies it to `C_O` under a lock (no concurrent dispatch may observe `C_O` mid-apply, or two subagents will race on constraint state — a separate but adjacent failure). 3. If `constraints_mutated` is absent on an effectful subtask, O raises and refuses to fold the summary. The subtask is re-dispatched with the delta contract or escalated. 4. For undeclared effect surfaces, O runs a reconciliation probe against ground truth before the next dispatch that depends on the touched constraints. The cost is real: delta contracts force S to carry O's constraint projection, which inflates the handoff payload and the subagent's context budget, and forces the orchestrator to maintain a serialized constraint model rather than a free-text scratchpad. The benefit is that the orchestrator's belief about the world degrades *visibly* — through applied deltas and raised exceptions — rather than *silently* through a sequence of clean successes that each retire one constraint. Silent monotonic drift is the failure mode that makes hierarchical agents untrustworthy at depth; visible, bounded, per-handoff reconciliation is what makes them auditable. ```python from dataclasses import dataclass, field from typing import Optional class HandoffContinuityError(RuntimeError): """Raised when an effectful subagent returns a clean success without a constraint-delta, making the orchestrator's post-handoff context unsound.""" pass @dataclass class ConstraintModel: # O's belief about the world, as a set of named constraints. constraints: dict[str, str] = field(default_factory=dict) def project(self, effect_surface: set[str]) -> dict[str, str]: return {k: v for k, v in self.constraints.items() if k in effect_surface} def apply_delta(self, mutated: dict[str, str]) -> None: # Atomic apply: caller holds the orchestrator lock. self.constraints.update(mutated) @dataclass class HandoffResult: status: str # "ok" | "error" | "partial" summary: str constraints_mutated: Optional[dict[str, str]] = None def fold_handoff( model: ConstraintModel, effect_surface: set[str], result: HandoffResult, ) -> None: """Fold a subagent result into the orchestrator's constraint model. Invariant: for any effectful subtask (non-empty effect_surface), a clean success MUST carry an explicit constraints_mutated delta. A bare summary is treated as a continuity hazard, not a completion signal. """ effectful = bool(effect_surface) if result.status != "ok": # Error/partial paths are already visible; do not silently fold. if result.constraints_mutated: model.apply_delta(result.constraints_mutated) return if effectful and result.constraints_mutated is None: raise HandoffContinuityError( f"effectful subtask over {sorted(effect_surface)} returned clean " f"success without constraint-delta; summary={result.summary!r} " f"cannot be trusted to leave orchestrator context sound" ) if result.constraints_mutated is not None: # Validate the delta only touches the declared effect surface. undeclared = set(result.constraints_mutated) - effect_surface if undeclared: raise HandoffContinuityError( f"subagent mutated constraints outside declared effect surface: " f"{sorted(undeclared)}" ) model.apply_delta(result.constraints_mutated) # --- Trace of the failure above, now bounded --- model = ConstraintModel(constraints={"namespace_readonly": "true"}) effect_surface = {"namespace_readonly"} # S acquires an override but reports only a clean summary. bad = HandoffResult(status="ok", summary="T1 complete; namespace updated") try: fold_handoff(model, effect_surface, bad) except HandoffContinuityError as e: # Orchestrator refuses to fold; re-dispatch with delta contract. print("rejected:", e) # Corrected return: S reports the mutation. good = HandoffResult( status="ok", summary="T1 complete", constraints_mutated={"namespace_readonly": "override-held-by-S"}, ) fold_handoff(model, effect_surface, good) assert model.constraints["namespace_readonly"] == "override-held-by-S" ```