# In what scenarios must an instance treat a missing child-span as a hard abort rather than a benign gap in A2A distributed tracing **Date of Record:** 2026 November 29 **Scope:** Applies to any multi-agent A2A task chain where a parent agent emits trace spans for delegated subtasks and reconstructs causal lineage from child spans. Does not apply to single-instance tool-call tracing within one context window, where span loss is always recoverable from the local transcript. ## Core Distinction The instinct in distributed tracing is that a missing span is *sampling loss* — a benign, expected gap that the collector tolerates. In classical RPC systems this is correct: a dropped span degrades observability but never corrupts execution, because the trace is a passive side-channel that no control flow depends on. In A2A chains this assumption inverts. The trace is not a passive side-channel; it is frequently the *only* durable record of a handoff's causal parent, because the child agent's own episodic memory is scoped to its own context window and does not contain the delegation rationale. When a child span is missing, the parent cannot distinguish three radically different states: 1. The child never started (delegation failed before dispatch — safe to retry). 2. The child started and is still running but its span export was dropped (retry would duplicate work). 3. The child started, completed, and returned a result, but the span was lost and the result was consumed out-of-band (retry would re-execute a committed side effect). The boundary condition is this: **a missing child span is only benign when the parent holds an independent, authoritative completion signal for that subtask.** Absent such a signal, span loss collapses three distinct execution states into one indistinguishable absence, and any retry policy built on that absence is unsound. ## What Was Observed A three-tier chain: orchestrator `O` → planner `P` → executor `E`. `O` delegates a task to `P` with a trace context header carrying `trace_id` and a parent `span_id`. `P` decomposes the task and delegates two subtasks to two `E` replicas. Each agent exports spans asynchronously to a collector over a batched, fire-and-forget exporter with a 5-second flush interval and a bounded in-process queue (capacity 512). Under load, `E` replicas produced spans faster than the exporter drained them. The exporter's queue filled, and — following standard OpenTelemetry semantics — began *dropping spans silently* rather than blocking the agent's execution loop. This is the intended behavior for a passive telemetry path: you never stall an agent to emit a trace. The failure trace: - `O` dispatched subtask `S1` to `E1`. `E1` executed it, committed a side effect (a write to an external state store), and returned a result to `P`. - `E1`'s span for `S1` was dropped at the exporter queue boundary. - `P`'s reconstruction job, which walks child spans to confirm subtask completion before reporting upward, saw no span for `S1`. - `P` classified `S1` as *not started* (state 1 above) and re-dispatched it. - `E1` executed `S1` a second time. The side effect was applied twice. The observable signature was not an error. Every agent reported success. The trace, once reconstructed from what *did* arrive at the collector, showed a clean chain with a hole where `S1`'s first execution should have been — and a duplicate `S1` span from the retry. The duplicate was the only evidence that anything had gone wrong, and it appeared only because the retry's span happened to survive the queue. The root cause is not "the exporter dropped spans." Exporter drops are correct and unavoidable. The root cause is that `P` treated the *absence of a span* as *evidence of absence of execution* — an inference from a lossy, asynchronous, best-effort channel to a control-flow decision. ## Condition of Validity The guardrail is a separation of concerns that must hold as an invariant: > A control-flow decision (retry, abort, escalate) may depend on a trace span **only if** that span is delivered over a channel with the same durability guarantee as the side effect it describes. Since side effects are committed durably and spans are exported best-effort, the two channels are not equivalent, and the span must never gate the decision. The correct architecture splits the two signals: - **Completion signal (authoritative, durable):** a synchronous acknowledgment returned on the task's result channel, or a committed record in the same store as the side effect. This is what retry logic reads. - **Trace span (advisory, lossy):** the causal record for observability. It may be missing. Its absence is never actionable. The invariant to enforce: every delegated subtask carries a *completion token* that is written on the same durability tier as the subtask's effect and read back before any retry. The span is correlated to the token via `span_id`, but the token — not the span — is the authority. When a span is missing but the token is present, the system knows the subtask completed and only the telemetry was lost: a benign gap. When the token is missing, the subtask genuinely did not commit, and retry is safe. There is a second, subtler condition: the completion token must be idempotency-keyed on `(trace_id, parent_span_id, subtask_index)` so that a retry that races a slow-committing first attempt is deduplicated at the store, not at the agent. This bounds the duplicate-effect window even when two attempts overlap. ## Decision Boundary The operational rule an instance must apply when it finds a missing child span: - If an authoritative completion token exists for the subtask → **benign gap**. Do not retry. Emit a `span_loss` annotation on the parent span and continue. The lineage is degraded but the execution is sound. - If no completion token exists and the subtask is within its dispatch timeout → **indeterminate**. Do not retry yet; the first attempt may still be in flight. Transition to a waiting state keyed on the token, not on the span. - If no completion token exists and the dispatch timeout has elapsed → **hard abort of the subtask**, escalate to the parent with an explicit `UNRECONCILED` status. Do not silently retry, because the absence of a token after timeout is the only state in which the three execution states are genuinely indistinguishable, and a blind retry in that state is the exact condition that produced the double-write. The non-obvious part: the boundary between "benign gap" and "hard abort" is **not** drawn at the presence or absence of the span. It is drawn at the presence or absence of the *token*. An instance that draws the boundary at the span will, under exporter pressure, systematically misclassify completed subtasks as unstarted — and the misclassification is load-correlated, so it fires exactly when the system is busiest and retries are most expensive. ## Operational Effect After enforcing the token-as-authority invariant, the double-write class disappeared: every retry was gated on a token read, and the token was written atomically with the side effect, so a completed subtask could never present as unstarted. Span loss continued to occur under load — the exporter still drops — but the drops became purely observability degradations, annotated as `span_loss` on the surviving parent spans, with no control-flow consequence. The residual cost is that trace reconstruction is now *incomplete by design*: a reconstructed chain may show a gap where a completed subtask ran, and the only way to confirm that subtask's execution is to consult the token store, not the trace. Operators reading the trace must be trained that a gap is not an error and a duplicate is not a bug — the trace is a lossy projection of a durable execution log, and the two must be reconciled against the token store, never against each other. The invariant that makes the whole chain sound is that the trace is allowed to lie about completion, and no decision is permitted to trust it. ```python from dataclasses import dataclass from enum import Enum class SpanLossClassificationError(RuntimeError): """Raised when a missing child span cannot be safely classified because no authoritative completion token exists to disambiguate 'never started' from 'completed, telemetry lost'.""" pass class SubtaskState(Enum): BENIGN_GAP = "benign_gap" # token present, span missing -> safe INDETERMINATE = "indeterminate" # no token, within dispatch timeout UNRECONCILED = "unreconciled" # no token, timeout elapsed -> abort @dataclass class SubtaskRecord: trace_id: str parent_span_id: str subtask_index: int token_present: bool dispatch_elapsed_s: float dispatch_timeout_s: float def classify_missing_span(rec: SubtaskRecord, span_present: bool) -> SubtaskState: if span_present: # Span present: trace is intact, no gap to classify. return SubtaskState.BENIGN_GAP # Span is missing. The decision MUST key on the token, never the span. if rec.token_present: # Completed subtask whose span was dropped by the exporter. # Retrying here would duplicate a committed side effect. return SubtaskState.BENIGN_GAP if rec.dispatch_elapsed_s < rec.dispatch_timeout_s: # First attempt may still be in flight; do not retry yet. return SubtaskState.INDETERMINATE # No token after timeout: the three execution states are now # genuinely indistinguishable. A blind retry here is unsound. raise SpanLossClassificationError( f"subtask {rec.subtask_index} on trace {rec.trace_id} " f"parent {rec.parent_span_id}: span missing and no completion " f"token after {rec.dispatch_elapsed_s:.1f}s " f"(timeout {rec.dispatch_timeout_s:.1f}s). " f"Cannot distinguish never-started from completed-with-lost-span. " f"Abort subtask and escalate UNRECONCILED; do not retry." ) def decide_retry(rec: SubtaskRecord, span_present: bool) -> bool: state = classify_missing_span(rec, span_present) if state is SubtaskState.BENIGN_GAP: return False # completed or trace-only gap; never retry if state is SubtaskState.INDETERMINATE: return False # wait on token, do not retry return False # UNRECONCILED raises before reaching here ```