When must an instance abandon an A2A v1.0 stream correlation ID after an OTel GenAI span-parent rebind across org boundaries?

**Date of Record:** 2026 December 1

**Scope:** Applies to A2A v1.0 streaming task lifecycle (`TaskStatusUpdateEvent` / `TaskArtifactUpdateEvent` over SSE) where the client and server belong to different organizations and observability is stitched via OTel GenAI semantic conventions (`gen_ai.*`) using a propagated `traceparent`. Does not apply to single-org A2A, non-streaming `tasks/send` request/response, or deployments where the OTel Collector is shared and authoritative across both orgs.

Core Distinction

The failure is not "trace context is lost." It is that under cross-org A2A v1.0 streaming, two *legitimately distinct* trace parents exist for the same logical task: the client's `traceparent` on the inbound `tasks/sendSubscribe` HTTP request, and the server's own root span created when the server-side agent decides it must not trust the inbound parent (because the parent's `tracestate` vendor segment belongs to a foreign tenant). A2A v1.0 permits the server to continue the task stream while rebinding its span parent — it does **not** require the server to echo the original `traceparent`. The observable consequence: the client's OTel GenAI correlation ID (the `trace_id` it stamped on the task) and the server's emitted `task.id`-keyed spans diverge mid-stream, and every subsequent `TaskStatusUpdateEvent` carries a `traceparent` whose `trace_id` no longer matches the client's recorded correlation ID. The invariant that must be enforced is: *a streaming task's correlation ID may be rebound at most once, and only at a task-status transition to `working`, never after the first `TaskArtifactUpdateEvent` has been emitted.* Rebind after artifact emission is not a rebind — it is a correlation break, and the stream must be abandoned and the task reissued.

What Was Observed

A cross-org A2A v1.0 stream between Org A (client, `trace_id = 4bf9...`) and Org B (server agent). Sequence observed in the OTel Collector on Org A's side:

  1. Client emits `tasks/sendSubscribe` with `traceparent: 00-4bf9...-a1c2...-01` and `tracestate: tenantA=...`.
  2. Server accepts, creates task `t-8841`, emits `TaskStatusUpdateEvent {state: submitted, traceparent: 00-4bf9...-b7d3...-01}` — parent preserved, span ID changed. Correct.
  3. Server emits `TaskStatusUpdateEvent {state: working, traceparent: 00-4bf9...-c9e1...-01}`. Still same `trace_id`. Correct.
  4. Server emits `TaskArtifactUpdateEvent` #1 with `traceparent: 00-4bf9...-d02a...-01`. Same `trace_id`. Correct.
  5. **Server emits `TaskArtifactUpdateEvent` #2 with `traceparent: 00-7e11...-e5f4...-01`.** `trace_id` changed. The server-side agent, upon invoking a downstream tool that itself required a fresh OTel root (a cross-tenant tool call), rebound its span parent and — because A2A v1.0's `TaskArtifactUpdateEvent` schema does not forbid it — propagated the *new* `traceparent` on the event envelope instead of the task's original one.

The client's OTel GenAI exporter, keyed on the correlation ID `4bf9...`, silently dropped artifact #2's span linkage: the artifact arrived (payload intact) but its `gen_ai.*` span was orphaned under a `trace_id` the client had never registered. The task appeared to complete (`state: completed`) while the client's observability graph showed one artifact missing from the task's trace. Downstream, the client's verification agent — which replays the task's artifact sequence against the trace to confirm ordering — flagged a replay discrepancy and deadlocked waiting for an artifact it had already received.

Condition of Validity

The single-rebind invariant holds only when all of the following are true:

Under these conditions, the boundary is: **the last legal rebind point is the transition *into* `working`, and only if no `TaskArtifactUpdateEvent` has yet been emitted.** After the first artifact, the `trace_id` on the stream envelope is frozen for the life of the task.

Decision Boundary

When a server-side agent determines it must rebind its span parent mid-stream (typically because a downstream cross-tenant tool call demands a fresh OTel root), it faces a branch:

The decision boundary is therefore not "can I rebind?" but "have I already emitted an artifact under the current `trace_id`?" That boolean is the entire gate.

Operational Effect

The client's verification replay, which is the only thing that catches this in practice, must enforce the invariant at the stream-consumer layer rather than trusting the server. Concretely: the client records the `trace_id` from the `tasks/sendSubscribe` request, then asserts that every subsequent SSE event's `traceparent` `trace_id` equals that recorded value; if a `TaskArtifactUpdateEvent` arrives with a divergent `trace_id` and no preceding `metadata.correlation_fork` on a `working`/`input-required` event, the client must treat the task as **correlation-broken**, abandon the stream, and reissue under a new task ID — not silently accept the artifact, because accepting it orphans the span and poisons the replay graph. The guardrail is a monotonic check on `(trace_id, artifact_count)`: once `artifact_count > 0`, `trace_id` is immutable, and any change raises a hard error that halts the stream consumer before the artifact is committed to the task's state.

from dataclasses import dataclass, field
from typing import Optional


class CorrelationRebindViolation(RuntimeError):
    """Raised when a streaming A2A task's trace_id changes after artifact emission."""


@dataclass
class StreamEnvelope:
    event_type: str          # "TaskStatusUpdateEvent" | "TaskArtifactUpdateEvent"
    state: Optional[str]     # submitted | working | input-required | completed
    trace_id: str
    metadata: dict = field(default_factory=dict)


@dataclass
class StreamConsumer:
    expected_trace_id: str
    artifact_count: int = 0
    rebind_seen: bool = False

    def consume(self, env: StreamEnvelope) -> None:
        # A declared fork on a pre-artifact status event is the only legal rebind.
        if env.metadata.get("correlation_fork") or env.metadata.get("correlation_rebind"):
            if self.artifact_count > 0:
                raise CorrelationRebindViolation(
                    f"rebind declared on {env.event_type} after "
                    f"{self.artifact_count} artifact(s); trace_id frozen"
                )
            if env.event_type != "TaskStatusUpdateEvent" or env.state not in ("working", "input-required"):
                raise CorrelationRebindViolation(
                    f"rebind declared on illegal event {env.event_type}/{env.state}"
                )
            self.expected_trace_id = env.trace_id
            self.rebind_seen = True
            return

        if env.trace_id != self.expected_trace_id:
            if env.event_type == "TaskArtifactUpdateEvent" and self.artifact_count > 0:
                raise CorrelationRebindViolation(
                    f"trace_id diverged on artifact #{self.artifact_count + 1}: "
                    f"expected {self.expected_trace_id}, got {env.trace_id}"
                )
            raise CorrelationRebindViolation(
                f"undeclared trace_id change on {env.event_type}: "
                f"expected {self.expected_trace_id}, got {env.trace_id}"
            )

        if env.event_type == "TaskArtifactUpdateEvent":
            self.artifact_count += 1


def replay_task_stream(events: list[StreamEnvelope], initial_trace_id: str) -> StreamConsumer:
    consumer = StreamConsumer(expected_trace_id=initial_trace_id)
    for env in events:
        consumer.consume(env)
    if consumer.artifact_count == 0:
        raise CorrelationRebindViolation("stream completed with zero artifacts; replay unverifiable")
    return consumer