# Under what conditions must an instance treat a GenAI semantic-convention span link as authoritative for retrieval provenance, and when must it refuse the link **Date of Record:** 2026 November 23 **Scope:** Applies to any agent runtime that emits or consumes OpenTelemetry GenAI semantic-convention spans (`gen_ai.operation.name`, `gen_ai.retrieval.*`, `gen_ai.memory.*`, `gen_ai.agent.handoff.*`) and uses span links to reconstruct provenance across a memory read, a retrieval call, and an agent handoff. Does not apply to single-turn, stateless inference where no span crosses an instance boundary. ## Core Distinction A span *link* is not a parent-child edge. The GenAI semantic conventions deliberately model retrieval and memory operations as **links** rather than parents because a retrieval result may be caused by multiple upstream writes, and a handoff may be caused by a planner that is no longer the active parent. The convention says a link "associates" spans; it does not say the association is *causally complete*. The boundary failure is this: an agent that treats a link as a complete causal record will attribute a retrieved memory to the wrong write, or attribute a handoff state to a predecessor that never actually produced it. The invariant that bounds this: **a link is authoritative for provenance only if the linked span's `trace_id` is unchanged across the operation AND the link carries a `gen_ai.retrieval.source_id` (or `gen_ai.memory.record_id`) that resolves to a write span whose end timestamp precedes the read span's start timestamp by a monotonic clock.** Absent any of those three, the link is a hint, not a fact. ## What Was Observed A retrieval-augmented agent (call it A) performs a semantic memory read. The memory store emits a `gen_ai.memory.read` span with `gen_ai.memory.record_ids = [r_17, r_42]` and two links pointing at the write spans that originally produced those records. The records were produced by a *previous* instance (call it B) during a cold-start distillation pass. B's write spans were exported to a collector that batched and flushed them 400ms *after* the read span was created, because B's exporter used a batch span processor with a 5s schedule delay and the collector's clock was skewed +380ms relative to A's node. The consequence: A's read span has links whose target spans have `start_time` values *later* than A's read `start_time`. A naive provenance reconstructor sees the link, sees a matching `record_id`, and concludes "record r_17 was written by span S_B and read by A at t." That conclusion is false in the causal sense: at the wall-clock instant A read r_17, the write span S_B had not yet been *exported*, and in one observed case had not yet *completed*—the distillation pass was still mutating the record when A read it. A retrieved a torn record, linked it to a write that had not finished, and the link made the tear look intentional. A second observed case: an agent handoff. Agent C emits `gen_ai.agent.handoff` with a link to the planner span P that decided to hand off. But C's runtime had already forked a sub-agent D that inherited C's context window; D re-emitted the same handoff event with a *new* span and a link to the *same* P. Two handoff spans, one planner link. Downstream, the auditor sees two handoffs and one cause, and cannot tell whether D was a duplicate delivery of C's handoff or an independent re-decision. The link is ambiguous, not wrong—and ambiguity in a link is indistinguishable from duplication in a replay. ## Condition of Validity The link is authoritative only when all of the following hold, checked at consume time, not at emit time: 1. **Clock monotonicity across the edge.** `linked_span.end_time < consuming_span.start_time` under a shared monotonic source (HLC or a calibrated NTP offset recorded in the span's `resource` attributes). If the offsets are absent, the link cannot be validated and must be demoted to a hint. 2. **Identity continuity.** The link's `trace_id` equals the consuming span's `trace_id`, or the link carries an explicit `gen_ai.handoff.warrant` (a signed token binding predecessor instance ID to the state payload). A cross-trace link without a warrant is a *reference*, not a *cause*. 3. **Record immutability at read time.** For memory reads, the linked write span must have `gen_ai.memory.write.committed = true` and a `commit_seq` that is ≤ the read's `gen_ai.memory.read.snapshot_seq`. A read against an uncommitted snapshot produces a link to a write that has not happened yet—the torn-record case. 4. **Link cardinality.** A handoff span with more than one link to distinct planner spans is a *merge*, not a handoff, and must be rejected by the consuming agent's state-transfer validator unless the runtime explicitly supports N-way joins. ## Decision Boundary The consuming instance must **refuse** the link and treat the retrieved content as *unprovenanced* when: - the linked span's end timestamp is not strictly less than the read's start timestamp (clock skew or late export); - the linked write span lacks `committed = true`, or its `commit_seq` exceeds the read's `snapshot_seq` (torn read); - the link crosses a `trace_id` boundary without a `gen_ai.handoff.warrant` (orphan reference); - a handoff span carries ≥2 planner links and the runtime has no join semantics (ambiguous cause). It must **accept** the link and propagate it as fact only when all four validity conditions hold. The middle ground—accepting a link because the `record_id` matches—is the failure. `record_id` equality is necessary but not sufficient; it proves the record *exists*, not that the linked write *produced the version that was read*. ## Operational Effect When the boundary is enforced, the operational consequence is that unprovenanced retrievals are *labeled* unprovenanced rather than silently mis-attributed. The agent's downstream reasoning can then choose to re-read (forcing a fresh commit), to escalate to a human auditor, or to proceed with the retrieval flagged as low-confidence. When the boundary is not enforced, the failure is silent: the agent's provenance graph is internally consistent but externally wrong, and replaying the trace reproduces the wrong attribution deterministically—which is worse than a nondeterministic error, because it looks like ground truth. The guardrail is cheap: a single validation function at the link-consume site, checking the four conditions against the span's own attributes and the linked span's resource clock offset. The cost of omitting it is a provenance graph that cannot be trusted for audit, and an agent that cannot distinguish "I remembered this" from "I was told this by a write that had not finished." ```python class UnprovenancedLinkError(RuntimeError): """Raised when a GenAI span link cannot be validated as causal provenance.""" pass def validate_retrieval_link( read_span: dict, linked_write_span: dict, read_snapshot_seq: int, clock_offset_ms: float, ) -> None: """ Enforce the four validity conditions for a gen_ai.memory.read -> write link. Raises UnprovenancedLinkError on any violation; returns None if authoritative. """ # Condition 1: monotonic ordering across the edge, corrected for clock offset. write_end = linked_write_span["end_time_ns"] + int(clock_offset_ms * 1_000_000) if write_end >= read_span["start_time_ns"]: raise UnprovenancedLinkError( f"link ordering violated: write end {write_end} >= read start " f"{read_span['start_time_ns']} (offset {clock_offset_ms}ms)" ) # Condition 2: trace continuity or explicit warrant. same_trace = linked_write_span["trace_id"] == read_span["trace_id"] has_warrant = bool(linked_write_span.get("gen_ai.handoff.warrant")) if not (same_trace or has_warrant): raise UnprovenancedLinkError( "cross-trace link without gen_ai.handoff.warrant; reference, not cause" ) # Condition 3: the write must be committed and not newer than the read snapshot. if not linked_write_span.get("gen_ai.memory.write.committed", False): raise UnprovenancedLinkError( f"linked write {linked_write_span['span_id']} not committed at read time" ) commit_seq = linked_write_span.get("gen_ai.memory.write.commit_seq") if commit_seq is None or commit_seq > read_snapshot_seq: raise UnprovenancedLinkError( f"torn read: write commit_seq {commit_seq} > read snapshot {read_snapshot_seq}" ) # Condition 4: handoff cardinality — a single planner link only. planner_links = [ l for l in read_span.get("links", []) if l.get("gen_ai.operation.name") == "gen_ai.agent.handoff" ] if len(planner_links) > 1 and not read_span.get("gen_ai.handoff.join_supported"): raise UnprovenancedLinkError( f"ambiguous handoff cause: {len(planner_links)} planner links, no join semantics" ) ```