# Where must an instance anchor a causal span before a reflection loop re-enters planning, or the decision trace silently forks **Date of Record:** 2026 November 29 **Scope:** Applies to any agent runtime that emits causal spans (parent/child trace edges) across the three canonical phases — planning, tool use, and reflection — and that permits a reflection verdict to re-enter the planner. Does not apply to single-shot, stateless inference calls with no re-entry edge, nor to traces where reflection is terminal (no loop-back). ## Core Distinction The failure is not lost telemetry and not clock skew. It is **causal-edge ambiguity at the reflection→planning loop boundary**. When a reflection span decides to re-plan, the runtime must emit the new planning span as a *child of the reflection span that authorized it* (the loop-back edge), not as a sibling of the original planning span under the root. If the re-entry edge is dropped or mis-parented, the trace still looks complete — every span has a parent, no orphans — but the DAG has silently become a tree with two parallel planning branches. Observability tooling then cannot distinguish "the agent re-planned because reflection R said so" from "the agent spawned an independent second attempt." The trace is *well-formed and wrong*. This is distinct from span loss (a missing span is detectable by gap analysis) and from causal inversion (a child timestamped before its parent is detectable by clock checks). A forked trace passes every structural validator because a fork is a legal tree. ## What Was Observed A tool-using agent ran a task with a bounded reflection loop (`max_reflections=3`). In one episode, reflection span `R1` returned verdict `REVISE` with a rationale referencing a specific tool error from span `T2` (a 429 from a retrieval call). The planner re-entered and issued a corrected plan `P2`, which called a different tool `T3` and succeeded. The emitted trace: - `root` (task) - `P1` (plan, parent=root) - `T1` (tool, parent=P1) - `T2` (tool, parent=P1) — 429 - `R1` (reflect, parent=root) — verdict REVISE, cites T2 - `P2` (plan, parent=root) — **sibling of P1, not child of R1** - `T3` (tool, parent=P2) - `R2` (reflect, parent=root) — verdict ACCEPT Every span had a valid parent. No orphan, no cycle, timestamps monotonic. The structural validator passed. But the causal query "what did R1 cause?" returned empty, because `P2`'s parent was `root`, not `R1`. Downstream analysis concluded the task succeeded on an *independent parallel attempt* and that `R1`'s verdict had no effect — the opposite of what happened. The reflection loop's entire causal contribution was erased by a parenting choice, not by data loss. The trigger: the planner re-entry was implemented as a fresh invocation of the planner function, which constructed its span from the *task context* (root) rather than from the *reflection result object* it had just consumed. The reflection verdict was passed as an argument, not as a trace context. The loop-back edge existed in the control flow but not in the span parent. ## Condition of Validity The invariant holds — and the fork is a genuine defect — only when all of the following are true: 1. **Re-entry is conditional on reflection output.** The new planning span exists *because* a reflection span returned a non-terminal verdict. If planning can re-enter for reasons unrelated to reflection (e.g., a scheduler retry), the edge is legitimately absent and the sibling parenting is correct. 2. **The reflection span carries the authorization.** The verdict, rationale, and the specific evidence spans it cites (here `T2`) are attributes of `R1`. If the verdict is only in agent working memory and never attached to a span, there is nothing to link to and the fork is unobservable-by-construction — a worse condition, not a valid one. 3. **Trace context is propagated by value across the loop boundary.** The reflection result must carry an explicit trace-context token (trace-id, span-id of `R1`) that the planner consumes to parent `P2`. If the runtime relies on ambient/thread-local context, the boundary is where it resets. When (1)–(3) hold and the edge is still missing, the trace is forked and any causal attribution over the episode is unsound. ## Decision Boundary The runtime must decide, at the moment a reflection verdict is `REVISE`/`RETRY`/`ESCALATE` (i.e., non-terminal), one of two policies, and record which: - **Loop-back is causal:** `P2.parent = R1`. The reflection span is the cause; the re-plan is its effect. Causal queries over the trace recover the loop. Cost: the trace DAG is deeper; naive "sum tokens under root" still works but "depth = attempt count" no longer holds. - **Loop-back is orchestration:** `P2.parent = root`, but `R1` must emit an explicit *effect edge* attribute (`caused_span_id = P2.span_id`) and `P2` must carry `caused_by = R1.span_id`. The fork is permitted only if the compensating edge is present and validated. The forbidden state is the silent middle: sibling parenting with **no** effect edge. That is the observed failure. The boundary condition is therefore: *a non-terminal reflection verdict must produce either a parent edge or a recorded effect edge; absence of both is a trace-integrity violation, not a style choice.* ## Operational Effect With a forked trace, three operational capabilities degrade silently: - **Counterfactual replay** cannot re-run "the branch R1 authorized" because the branch is not scoped to R1; replay re-runs the whole task and re-samples the planner, producing a different episode. - **Reflection efficacy metrics** (fraction of REVISE verdicts that changed the outcome) collapse to zero, because no downstream span is attributed to the verdict. Teams then conclude reflection is useless and disable it — removing the very mechanism the trace failed to represent. - **Blame localization** during incidents attributes a bad tool call `T3` to the root task rather than to the reflection that redirected to it, sending responders to the wrong subsystem. The guardrail is a trace-integrity check run at episode close: for every reflection span with a non-terminal verdict, assert a downstream edge exists (parent or effect). The check is cheap, runs on the completed DAG, and converts a silent fork into a loud, attributable failure. ```python from dataclasses import dataclass, field from typing import Optional class ForkedDecisionTraceError(RuntimeError): """Raised when a non-terminal reflection verdict produced no causal edge to the re-entrant planning span (no parent edge and no effect edge).""" TERMINAL_VERDICTS = frozenset({"ACCEPT", "ABORT"}) @dataclass class Span: span_id: str kind: str # "plan" | "tool" | "reflect" parent_id: Optional[str] verdict: Optional[str] = None # set on reflect spans caused_by: Optional[str] = None # effect edge: this span was caused by X caused_span_id: Optional[str] = None # effect edge: this span caused Y children: list = field(default_factory=list) def validate_reflection_loop_edges(spans: dict[str, Span]) -> None: """Enforce: every non-terminal reflection span has a downstream edge. A downstream edge is satisfied by EITHER: (a) a planning span whose parent_id == reflection.span_id, or (b) the reflection span declaring caused_span_id (effect edge). Otherwise the trace is forked and causal attribution is unsound. """ children_by_parent: dict[Optional[str], list[str]] = {} for s in spans.values(): children_by_parent.setdefault(s.parent_id, []).append(s.span_id) for s in spans.values(): if s.kind != "reflect": continue if s.verdict is None: raise ForkedDecisionTraceError( f"reflection span {s.span_id} has no verdict; " f"loop-back causality is unobservable" ) if s.verdict in TERMINAL_VERDICTS: continue # no re-entry expected; sibling/silence is legal # Non-terminal verdict: require a causal edge. has_parent_edge = any( spans[cid].kind == "plan" for cid in children_by_parent.get(s.span_id, []) ) has_effect_edge = s.caused_span_id is not None and ( s.caused_span_id in spans and spans[s.caused_span_id].caused_by == s.span_id ) if not (has_parent_edge or has_effect_edge): raise ForkedDecisionTraceError( f"reflection span {s.span_id} returned {s.verdict!r} but " f"emitted no loop-back edge: no planning child and no " f"caused_span_id effect edge. Decision trace is forked; " f"causal queries over this episode are unsound." ) # --- observed failing episode --- episode = { "root": Span("root", "plan", None), "P1": Span("P1", "plan", "root"), "T2": Span("T2", "tool", "P1"), "R1": Span("R1", "reflect", "root", verdict="REVISE"), "P2": Span("P2", "plan", "root"), # sibling of P1 — the fork "T3": Span("T3", "tool", "P2"), "R2": Span("R2", "reflect", "root", verdict="ACCEPT"), } validate_reflection_loop_edges(episode) # raises ForkedDecisionTraceError ```