# In what scenarios must an instance reject a parent span whose GenAI conversation ID was minted under a different agent identity **Date of Record:** 2026 November 22 **Scope:** Applies to multi-agent systems that propagate OpenTelemetry GenAI semantic conventions (`gen_ai.conversation.id`, `gen_ai.agent.id`, `gen_ai.operation.name`) across span contexts during agent-to-agent handoffs. Does not apply to single-agent tracing where one process owns the entire span tree, nor to pure metrics/logs pipelines that do not carry span context. ## Core Distinction The GenAI semantic conventions were designed to describe a *conversation* — a logical, user-facing interaction thread — and separately to describe an *agent* — the executing identity. These two identifiers travel together in a span context, but they answer different questions. `gen_ai.conversation.id` says "this work belongs to thread X." `gen_ai.agent.id` says "this span was emitted by actor Y." The conventions do **not** mandate that a conversation ID be bound to a single agent identity. That omission is the boundary. The failure mode is not "the span is malformed." It is subtler: when agent B receives a span context from agent A that carries A's `gen_ai.conversation.id` but where B is about to emit child spans under its *own* `gen_ai.agent.id`, the resulting trace is internally consistent at the span level and *semantically corrupt* at the conversation level. Downstream consumers that group by `conversation.id` will silently merge two distinct agent identities into one conversation, and any auditor reconstructing "who said what to whom" from the trace will attribute B's operations to A's turn. The distinction that matters: **trace-parentage validity is not the same as conversation-identity validity.** A span can have a perfectly valid `parent_span_id` and still be a conversation-identity violation. ## What Was Observed A three-agent pipeline (planner → retriever → synthesizer) using W3C trace context plus GenAI attributes. The planner mints `gen_ai.conversation.id = conv-7f3a` and `gen_ai.agent.id = planner-v2`. It calls the retriever over an A2A transport, injecting the full `traceparent` and the GenAI attributes as baggage. The retriever, correctly, creates child spans with `parent_span_id` = planner's span and copies the conversation ID from baggage — but stamps `gen_ai.agent.id = retriever-v1` on its own spans, because that is what the conventions say an agent span should carry. The trace rendered fine in Jaeger. The problem surfaced in a replay auditor that grouped spans by `conversation.id` and asserted that all spans in a conversation share a single `gen_ai.agent.id` lineage root. The assertion failed on every conversation that crossed an agent boundary — which was all of them. Worse, a second incident: the retriever retried a failed sub-call and re-emitted spans with a *fresh* `gen_ai.conversation.id` (because its retry wrapper regenerated context from scratch), orphaning the retry subtree from the original conversation. The auditor saw two conversations where there was one, and the synthesizer's cost attribution split 60/40 across them. The non-obvious part: neither the retriever nor the synthesizer did anything the spec forbids. The corruption emerged from the *interaction* of (a) conversation ID propagation via baggage, (b) agent ID re-stamping per hop, and (c) retry logic that treats context as regenerable. ## Condition of Validity A receiving agent B may accept a parent span context from agent A and continue the conversation only if all of the following hold: 1. The incoming `gen_ai.conversation.id` is treated as **immutable baggage** — B must never regenerate it, and retry wrappers must preserve it byte-for-byte across attempts. 2. B records the *provenance* of the conversation ID: which `gen_ai.agent.id` minted it. This is not a standard attribute; it must be carried as a custom attribute (e.g., `gen_ai.conversation.origin_agent`) or the auditor has no way to distinguish a legitimate multi-agent conversation from a hijacked one. 3. B's own spans carry B's `gen_ai.agent.id`, but they are explicitly marked as *continuations* (`gen_ai.conversation.role = continuation` or equivalent), not as conversation roots. 4. The `traceparent` trace-id and the conversation ID are checked for consistency: if the incoming context claims conversation `conv-7f3a` but the trace-id belongs to a different trace root than the one previously associated with `conv-7f3a` in this agent's local state, that is a **conversation-identity collision** and must be rejected, not merged. Condition 4 is the sharp one. It is the only condition that cannot be satisfied by well-behaved propagation alone — it requires the receiving agent to maintain a small local map from `conversation.id → trace.id` and to treat a mismatch as a boundary violation. Without it, a prompt-injected or buggy upstream can splice a foreign trace into an existing conversation and the auditor will never see the seam. ## Decision Boundary The boundary is between **propagation** and **adoption**. Propagation says: forward the context. Adoption says: bind your own execution to that context as if you minted it. The conventions cover propagation; they are silent on adoption. The invariant a receiving agent must enforce is: > An agent may propagate a conversation ID it did not mint, but it may only *adopt* (i.e., emit root-level or conversation-defining spans under) a conversation ID whose origin agent it can verify and whose trace-id binding is consistent with its local record. Concretely, the decision procedure on span-context receipt is: - If `gen_ai.conversation.id` is absent → mint a new one, record self as origin, proceed as root. - If present and `gen_ai.conversation.origin_agent` is absent → treat as unverifiable; emit a *continuation* span carrying the ID but do **not** emit any span that a consumer could interpret as conversation-defining. Flag for auditor. - If present, origin recorded, and local `conversation.id → trace.id` map agrees → adopt normally. - If present, origin recorded, but trace-id disagrees with local map → **reject the parent context**, emit an orphan span with a fresh trace-id, and raise a boundary violation. Do not silently re-parent. The last case is the one that gets skipped in practice because "the trace still renders." It should not be. ## Operational Effect Enforcing this boundary changes three things. First, retry wrappers must be rewritten to carry conversation context through retries rather than regenerating it — this is the single highest-yield fix and eliminates the majority of orphaned subtrees. Second, every agent gains a tiny piece of state (the conversation→trace map), which must be scoped to the agent's lifetime and persisted across cold starts if the agent can resume mid-conversation; without persistence, a restarted agent will reject legitimate continuations as collisions. Third, the auditor's grouping logic must switch from "group by conversation.id" to "group by conversation.id, then verify single origin_agent and single trace.id per group" — otherwise the auditor itself becomes the thing that hides the corruption. The cost is a small amount of per-agent state and a stricter handoff contract. The benefit is that a trace can be trusted as a record of *who* did *what* within *which* conversation, which is the entire point of the GenAI conventions in a multi-agent setting. An instance that skips this boundary is not tracing a multi-agent system; it is tracing a set of agents that happen to share a string. ```python from __future__ import annotations from dataclasses import dataclass, field from typing import Optional class ConversationIdentityViolation(RuntimeError): """Raised when an agent is asked to adopt a parent span context whose conversation identity cannot be reconciled with its local binding record.""" @dataclass class SpanContext: trace_id: str span_id: str conversation_id: Optional[str] origin_agent: Optional[str] agent_id: str @dataclass class AgentTracer: agent_id: str # conversation.id -> trace.id binding established when this agent first saw it _bindings: dict[str, str] = field(default_factory=dict) def receive_parent(self, ctx: SpanContext) -> SpanContext: if ctx.conversation_id is None: # We mint the conversation; we are the origin. self._bindings[ctx.conversation_id] = ctx.trace_id return ctx if ctx.origin_agent is None: # Unverifiable origin: emit continuation only, never conversation-defining. return SpanContext( trace_id=ctx.trace_id, span_id=ctx.span_id, conversation_id=ctx.conversation_id, origin_agent=None, agent_id=self.agent_id, ) prior_trace = self._bindings.get(ctx.conversation_id) if prior_trace is None: # First time we see this conversation; record the binding. self._bindings[ctx.conversation_id] = ctx.trace_id return ctx if prior_trace != ctx.trace_id: raise ConversationIdentityViolation( f"agent {self.agent_id!r} received conversation " f"{ctx.conversation_id!r} bound to trace {ctx.trace_id!r}, " f"but locally bound to {prior_trace!r}; refusing to adopt " f"parent span {ctx.span_id!r} from origin {ctx.origin_agent!r}" ) return ctx def handoff(tracer: AgentTracer, parent: SpanContext) -> SpanContext: try: return tracer.receive_parent(parent) except ConversationIdentityViolation: # Reject the parent context; emit an orphan span under a fresh trace. raise ```