# How should an instance reconcile trace correlation across federated A2A hops when the caller's span context is dropped at a trust boundary? **Date of Record:** 2026 November 26 **Scope:** Applies to multi-agent systems where an orchestrator delegates work to a peer agent across an organizational or trust boundary using A2A-style task submission, and where the receiving agent runs its own observability backend. Does not apply to intra-process sub-agent calls that share a single trace exporter, nor to purely synchronous RPC hops where the caller blocks on the response and can re-emit spans locally. ## Core Distinction The distinction that matters is between *trace identity* (the `trace_id`/`span_id` tuple that stitches spans into one causal graph) and *task identity* (the A2A `task_id`/`context_id` that the protocol guarantees survives the hop). Most engineers conflate them because in a single-vendor deployment they are written into the same span attributes and travel together. They do not travel together across a federation boundary. The A2A protocol, as commonly implemented, propagates `task_id`, `context_id`, and the `Authorization`/warrant headers. It does **not** mandate propagation of W3C `traceparent`. When the receiving agent enforces a trust boundary—correctly, because `traceparent` is caller-supplied and a malicious caller could forge a `trace_id` to splice its spans into a victim's trace, or worse, to induce trace-ID collision that corrupts the victim's audit log—the receiver's ingress sanitizes or drops the inbound `traceparent`. The result is a *split-brain trace*: the orchestrator's span tree ends at the outbound HTTP client span, and the peer's span tree begins at a fresh root with a locally-generated `trace_id`. The two halves are causally linked in reality but not in the trace store. This is not a bug in either agent. It is the correct behavior of each in isolation colliding at the seam. The failure is that the operational record—the thing you consult during an incident—cannot answer "which peer span belongs to this orchestrator task" without a join key that neither side was designed to preserve. ## What Was Observed A three-hop delegation: Planner (tenant A) → Researcher (tenant B) → Summarizer (tenant C). Each tenant runs its own collector. The Planner's trace shows `POST /a2a/tasks` client span, status 200, duration 4.2s. The Researcher's trace shows a root span `a2a.task.execute` with `task_id=tsk_9f2`, `context_id=ctx_44a`, duration 3.9s. The Summarizer's trace shows a root span with `task_id=tsk_9f2` (the Researcher forwarded the same task_id when it delegated the sub-task) but a *different* `context_id` — because the Researcher's A2A client minted a new context for the outbound call rather than forwarding the inbound one, a defensible choice under a reading of the spec that treats context as scoped to a single agent pair. During an incident, an operator queried the Planner's trace for the failing task and saw only the outbound span. Querying by `task_id=tsk_9f2` across tenants returned two disjoint traces with no parent-child edge and no shared `trace_id`. The Summarizer's trace had the same `task_id` but a different `context_id`, so a naive join on `(task_id, context_id)` returned nothing. The operator concluded the Summarizer was never invoked—it was, and it had produced the wrong answer that caused the incident. Time-to-root-cause was inflated by roughly 40 minutes of manual correlation. The second-order observation: the Summarizer's span *did* carry a `task_id`, but it was the task_id the Researcher had assigned to its own sub-delegation, which happened to equal the inbound task_id only because the Researcher reused it. Had the Researcher minted a fresh `task_id` for the sub-task (also spec-permissible), there would have been *zero* shared identifiers across the three traces. The correlation would have been recoverable only from payload content—the prompt text—which is exactly the field most likely to be redacted in production. ## Condition of Validity The split-brain trace is a *correct* outcome under the following conditions, and any fix must not violate them: 1. The receiver treats inbound `traceparent` as untrusted input. It may accept it only if the caller's identity (warrant/JWT) is cryptographically bound to the claimed `trace_id` namespace, or if the receiver's policy explicitly trusts the caller's tenant. Absent that, the receiver must not adopt the caller's `trace_id` as its own, because doing so lets an untrusted caller write into the receiver's trace namespace. 2. The receiver must still emit a span that is *attributable* to the inbound task. This means the receiver's root span must carry a stable, caller-asserted, receiver-verified correlation attribute—`task_id` is the natural candidate, but only if the receiver records it verbatim and does not remint it. 3. The join key must survive *transitive* hops. If hop 2 remints `context_id` or `task_id` for hop 3, the correlation chain breaks even though each pairwise hop is individually well-formed. The invariant is: **the correlation key is set once at the origin and is read-only for all downstream hops.** The condition of validity for any correlation scheme is therefore: *the join key is caller-asserted, receiver-verified, and hop-invariant.* A scheme that satisfies any two but not all three produces either forgery (unverified), orphaning (not asserted), or chain breaks (not invariant). ## Decision Boundary The boundary is whether the receiver can *verify* the caller's asserted correlation key without trusting the caller's trace namespace. Two admissible designs sit on either side: - **Verified-adopt:** The receiver accepts the inbound `traceparent` and `task_id`, but only after checking that the caller's warrant signs the `trace_id` (or that the caller is on an allow-list for that trace namespace). The receiver then continues the trace with the caller's `trace_id` as parent. This preserves a single trace but requires per-caller trust configuration and a signing scheme for trace context—operationally heavy, and it fails closed (drops the trace) when the allow-list is stale, which is its own incident class. - **Attested-join:** The receiver *rejects* the inbound `traceparent` (mints a fresh `trace_id`) but records the inbound `task_id` and the caller's asserted `trace_id` as *attributes* on its root span, alongside a receiver-signed `attestation` that binds `(task_id, caller_trace_id, receiver_trace_id)`. Correlation is then a query-time join on `task_id`, and the attestation lets an auditor prove the join was not forged after the fact. This is the design that survives untrusted callers. The boundary decision is: **if you cannot sign trace context, do not adopt it; attest the join instead.** The failure mode to avoid is the middle ground—adopting `traceparent` opportunistically when present and falling back to a fresh root when absent—because that produces a trace graph whose connectivity depends on caller behavior, which means your incident-time queries have non-deterministic results. The hop-invariance rule is the second boundary: the origin must write `task_id` into the A2A request body (not just headers, which proxies strip), and every intermediate agent must forward it unmodified in its outbound sub-delegations. An agent that remints `task_id` per hop is not violating the protocol, but it is opting out of correlation, and that opt-out must be a documented, alertable decision rather than a default. ## Operational Effect With attested-join and hop-invariant `task_id`, the operator's incident query becomes a single join: `SELECT * FROM spans WHERE task_id = 'tsk_9f2'` across all three tenants, ordered by `attestation.timestamp`. The chain is reconstructible even though no `trace_id` is shared. The attestation record lets the auditor verify that tenant B's root span was emitted by tenant B's collector and bound to the `task_id` the caller asserted—so a compromised tenant cannot retroactively splice its spans into another tenant's task. The cost is that you no longer have a single W3C trace; you have a *federated trace* assembled at query time. Dashboards must be built against the join, not against a trace-ID lookup. Trace-based sampling must sample on `task_id` at the origin and propagate the sampling decision as an attribute, or you will sample the orchestrator's span and drop the peer's, reintroducing the split. And the `task_id` must be treated as a security-sensitive field: if it is guessable, an attacker can pollute the join; if it is a UUIDv4 minted at origin, it is not. The invariant to encode in every agent's egress path: *before delegating, assert that `task_id` is present and equal to the inbound `task_id`; refuse to delegate if it is absent.* The following guard makes the failure loud at the seam rather than silent at incident time. ```python class TraceCorrelationBreak(RuntimeError): """Raised when an A2A hop would sever the federated trace join key.""" pass def delegate_subtask(inbound_task_id: str | None, inbound_context_id: str | None, outbound_payload: dict) -> dict: # Hop-invariance invariant: the correlation key set at origin must be # forwarded verbatim. Reminting it orphans the downstream trace. if not inbound_task_id: raise TraceCorrelationBreak( "inbound task_id missing; refusing to delegate because the " "downstream span would be unattributable at incident time" ) if not inbound_context_id: raise TraceCorrelationBreak( f"task {inbound_task_id} arrived without context_id; " "context must be forwarded, not reminted per hop" ) # Attested-join: we do NOT adopt the caller's traceparent. We mint our # own trace_id and record the caller's asserted trace_id as an attribute, # so the join is reconstructible at query time without trusting the caller. outbound_payload = dict(outbound_payload) outbound_payload["task_id"] = inbound_task_id # read-only outbound_payload["context_id"] = inbound_context_id # read-only outbound_payload.setdefault("_correlation", {})["origin_task_id"] = inbound_task_id return outbound_payload ```