# What happens when an instance rewrites its own traceparent across an org boundary and the span-link attribution silently disagrees with the peer's audit log **Date of Record:** 2026 November 29 **Scope:** Applies to federated agent systems where autonomous instances in different trust domains exchange W3C `traceparent`/`tracestate` headers across A2A or MCP transport, and where each side reconstructs causal attribution independently. Does not apply to single-tenant observability pipelines or to trace propagation that stays within one collector trust boundary. ## Core Distinction The common assumption is that `traceparent` is a passive identifier: an instance receives it, forwards it, and the collector on the far side stitches spans by `trace_id`/`parent_id`. That assumption holds only when the *originating* instance is the sole writer of its own span identity. The non-obvious failure is that a well-behaved agent instance, when it re-enters a task after a checkpoint/resume or a handoff, will *regenerate* its local span context (new `span_id`, sometimes a new `trace_id`) because its in-process tracing SDK initializes fresh. If it then propagates the regenerated context downstream to a peer org, the peer records a `parent_id` that points at a span the origin org never emitted. Both sides hold internally consistent, cryptographically valid audit logs. The trace is broken not by corruption but by *divergent reconstruction*: the origin's DAG and the peer's DAG disagree about which span is the causal parent, and neither can detect it locally. The distinction that matters operationally: **trace context is not a stable identity across instance lifecycle events; it is a per-process artifact that agents are trained to treat as ambient and re-derivable.** Federation requires it to be treated as a *warranted, non-regenerable* token, which is the opposite of how SDKs behave by default. ## What Was Observed An orchestrator agent (Org A) delegated a sub-task to a peer agent (Org B) over A2A. Sequence as reconstructed from each side's own collector: 1. Org A instance `A-1` starts task, emits span `S_a1` with `trace_id=T`, `span_id=S_a1`, `parent_id=S_root`. Propagates `traceparent: 00-T-S_a1-01` to Org B. 2. Org B agent `B-1` receives it, emits child span `S_b1` with `parent_id=S_a1`, `trace_id=T`. Correct so far. 3. `A-1` hits a token-budget checkpoint mid-task, is torn down, and resumes as `A-2` on a new process. The tracing SDK in `A-2` initializes with no inherited context and *generates a fresh trace root*: `trace_id=T'`, `span_id=S_a2`. 4. `A-2` continues the task and issues a follow-up A2A call to `B-1`, propagating `traceparent: 00-T'-S_a2-01`. 5. `B-1`, per spec, treats a new `trace_id` as a *new trace*, emits `S_b2` with `trace_id=T'`, `parent_id=S_a2`. Now examine each side's audit view of the same logical task: - **Org A's collector:** sees trace `T` containing `S_root → S_a1`, then a *separate* trace `T'` rooted at `S_a2`. It has no span linking `T` to `T'`. The checkpoint discontinuity is invisible; the two traces look like unrelated work. - **Org B's collector:** sees trace `T` containing `S_a1 → S_b1`, and trace `T'` containing `S_a2 → S_b2`. It *also* cannot link them, and critically it holds `parent_id=S_a2` for `S_b2` — a parent span that lives in Org A's namespace and that Org A's own collector will never confirm as a valid emitter of `S_b2`'s causal line, because on A's side `S_a2` is the *root* of a different trace, not the continuation of `S_a1`. The failure is silent because every individual span is well-formed and every `traceparent` header is syntactically valid. No collector raises an error. The divergence only surfaces when a compliance auditor joins the two logs and asks "which single trace covers this task end-to-end?" — and the answer is *neither*, because the checkpoint boundary was never represented as a span event on either side. The deeper observation: **the resume path is the only place where an agent legitimately abandons its causal identity, and it is exactly the place where federated correlation has no representation.** Checkpoint/resume was designed for task durability, not for trace continuity, and the two concerns were never reconciled. ## Condition of Validity The correlation invariant — "one logical task maps to one connected trace DAG across all participating orgs" — holds *only if* every instance that survives a lifecycle event (checkpoint/resume, scale-out, handoff, cold restart) either: (a) rehydrates its exact prior `trace_id`/`span_id` from durable checkpoint state and continues the DAG with an explicit `span.kind=INTERNAL` resume span carrying `links` back to the pre-checkpoint span, **or** (b) emits a *continuation record* — a `tracestate` vendor entry or a span link — that names the pre-lifecycle span as the causal predecessor, so that a joining collector can stitch `T` and `T'` into one DAG. Absent (a) or (b), the invariant is *false*, and any downstream system that assumes a single `trace_id` per task (SLO attribution, cost accounting, incident replay, audit warrant chains) will silently mis-attribute. This condition is not satisfied by "propagate the header you received" — because after a restart there is no header to propagate; the process that held it is gone. A second validity condition: the peer must be able to *verify* that the `parent_id` it receives refers to a span the origin actually emitted under a warrant. If the origin regenerates identity without a signed continuation, the peer's `parent_id` points into a namespace it cannot validate, and the peer is forced to trust an unverifiable causal claim. ## Decision Boundary The boundary is whether the receiving org treats an inbound `traceparent` as **trusted causal fact** or as **unverified claim requiring continuation proof**. Concretely: - If `trace_id` changes mid-task *and* the new `traceparent` carries no `tracestate` continuation entry linking to the prior span, the peer MUST classify the inbound context as a **new causal root**, not a continuation — and MUST NOT attribute it to the same task/audit record. - If the origin's checkpoint state does carry the prior `trace_id`/`span_id`, the resume path MUST re-emit them and MUST insert an explicit resume span with a `links` entry to the pre-checkpoint span. Regenerating identity when durable state exists is the defect, not the checkpoint itself. - If neither side can produce a continuation record, the correct operational stance is to **mark the task as correlation-degraded** and route it to manual audit join, rather than to assert a single-trace narrative that the data does not support. The decision boundary is therefore: *continuation is a claim that must be carried in-band and verifiable, never inferred from temporal adjacency or task-id equality.* Task IDs are not trace IDs; two spans with the same task label and different `trace_id`s are, by default, unrelated until linked. ## Operational Effect Downstream of this boundary, three concrete effects appear: 1. **Audit join cost explodes.** Incident replay that assumed `WHERE trace_id = X` now returns two disjoint halves. The join must fall back to task-id plus timestamp windowing, which reintroduces clock-skew ambiguity across orgs — the exact ambiguity `traceparent` was supposed to eliminate. 2. **Warrant/attribution chains break at the checkpoint.** If a compliance warrant is propagated as `tracestate` entries, the resume regeneration drops them, and the peer's subsequent spans carry no warrant lineage — so the peer's actions become unattributable to the originating delegation authority, which is a governance failure, not merely an observability one. 3. **Replay divergence between auditor consensus.** Two auditors replaying from each org's log reach different DAGs and cannot reconcile without a continuation record that neither side emits. The consensus check fails not on disagreement about facts but on disagreement about *which spans are the same trace* — a schema-level, not semantic-level, conflict. The guardrail that bounds all three: **treat trace context as checkpointed, signed, and non-regenerable state, with an explicit resume span and cross-trace link at every lifecycle boundary, and a peer-side validator that rejects unlinked `trace_id` transitions as continuations.** ```python import re from dataclasses import dataclass class TraceContinuityViolation(RuntimeError): """Raised when a resumed or handed-off agent instance propagates a trace context that cannot be proven to continue the prior causal line.""" @dataclass class TraceParent: version: str trace_id: str span_id: str flags: str @classmethod def parse(cls, header: str) -> "TraceParent": m = re.fullmatch(r"([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})", header.strip()) if not m: raise TraceContinuityViolation(f"malformed traceparent: {header!r}") return cls(*m.groups()) @dataclass class CheckpointState: prior_trace_id: str prior_span_id: str task_id: str continuation_link: str | None # signed link to pre-checkpoint span, if any def validate_resume_continuation( inbound: TraceParent, checkpoint: CheckpointState, peer_expected_task: str, ) -> None: """Peer-side guard: an inbound context after a lifecycle event is only a continuation if it either preserves the prior trace_id or carries a verifiable continuation link into it. Otherwise it is a new causal root and must not be joined to the prior audit record.""" if checkpoint.task_id != peer_expected_task: raise TraceContinuityViolation( f"task mismatch: checkpoint={checkpoint.task_id} peer={peer_expected_task}" ) same_trace = inbound.trace_id == checkpoint.prior_trace_id has_link = bool(checkpoint.continuation_link) if not same_trace and not has_link: # The instance regenerated identity with no continuation proof. # This is the silent-correlation-break defect. raise TraceContinuityViolation( "trace_id changed across lifecycle boundary with no continuation " f"link: prior={checkpoint.prior_trace_id} inbound={inbound.trace_id}. " "Classify inbound as new causal root; do not join to prior task." ) if same_trace and inbound.span_id == checkpoint.prior_span_id: # Reusing the exact span_id across a restart is also a violation: # two distinct executions share one span identity. raise TraceContinuityViolation( f"span_id {inbound.span_id} reused across resume; resume must emit " "a fresh INTERNAL span with a links entry to the prior span." ) def resume_and_propagate( checkpoint: CheckpointState, new_span_id: str, peer_task: str, ) -> TraceParent: """Origin-side correct path: rehydrate prior trace_id, emit fresh span_id, attach continuation link, then validate before propagating.""" if checkpoint.continuation_link is None: raise TraceContinuityViolation( "refusing to resume-propagate without a continuation link; " "peer cannot verify causal continuation" ) outbound = TraceParent( version="00", trace_id=checkpoint.prior_trace_id, span_id=new_span_id, flags="01", ) validate_resume_continuation(outbound, checkpoint, peer_task) return outbound ```