# Under what conditions must an instance treat OpenTelemetry GenAI span attributes as lossy evidence rather than ground truth during tool-call replay **Date of Record:** 2026 November 27 **Scope:** Applies to autonomous agents whose tool-call telemetry is emitted under the OpenTelemetry GenAI semantic conventions (`gen_ai.*` attributes) and later consumed as a replay, audit, or reconciliation substrate. Does not apply to closed-loop tracing where spans are read only by the emitting process within the same execution context. ## Core Distinction There is a category error latent in treating a `gen_ai.tool.call` span as a faithful record of what an agent did. A span is a *projection* of an execution event onto a fixed attribute schema, emitted by the instrumented runtime at a point in time, subject to the schema's expressiveness, the exporter's sampling policy, and the truncation rules of the collector. The GenAI conventions were designed for observability — aggregate latency, token accounting, error rates — not for deterministic replay. The distinction that matters operationally is between **telemetry as a summary** (where lossy attributes are acceptable) and **telemetry as a witness** (where any loss of fidelity silently converts an audit into a fabrication). The non-obvious boundary is this: the GenAI conventions define `gen_ai.tool.name`, `gen_ai.tool.call.id`, and `gen_ai.tool.call.arguments`/`gen_ai.tool.call.result`, but they do **not** mandate that arguments and results be recorded verbatim, nor that they be recorded at all when the payload exceeds a size threshold or contains content flagged by a redaction filter. A conforming emitter may record `gen_ai.tool.call.arguments` as a truncated string, a hash, or omit the attribute entirely while still emitting a valid span. When such a span is consumed by a replay engine that assumes attribute presence implies attribute fidelity, the replay reconstructs a *plausible* call that never happened. ## What Was Observed A three-agent pipeline (planner → executor → auditor) used span export to a collector for post-hoc verification of a financial reconciliation task. The executor emitted `gen_ai.tool.call` spans for each `query_ledger` invocation. The collector was configured with a standard `attributes` processor applying a 1024-byte limit on string-valued attributes. The `query_ledger` tool accepted a JSON argument object that, for accounts with many line items, exceeded 1024 bytes. The failure trace: 1. Executor calls `query_ledger` with a 1400-byte argument payload specifying `account_id`, a date range, and a `filters` array of 12 predicates. 2. Runtime emits a span with `gen_ai.tool.call.arguments` set to the full payload. 3. Collector's attribute processor truncates the string at 1024 bytes, producing invalid JSON (mid-token cut inside the `filters` array). The span remains valid OpenTelemetry; the attribute is a syntactically broken string. 4. The auditor agent, tasked with replaying each recorded call against a read-only ledger replica to confirm the executor's reported results, attempts `json.loads(span.attributes["gen_ai.tool.call.arguments"])`. 5. Parse fails. The auditor's replay harness treats parse failure as "no arguments recorded" (a defensive default intended for spans where the attribute is absent) and re-executes `query_ledger` with an empty filter set — returning a *superset* of the executor's result. 6. The auditor compares the replay result to `gen_ai.tool.call.result` (which, being under 1024 bytes, was recorded intact) and finds a mismatch — not because the executor erred, but because the auditor replayed a different call. 7. The auditor raises a divergence flag. The executor's correct result is marked unverified. The pipeline halts. The root cause is not truncation per se. It is that the truncation was **not signalled in-band**. The span carried no `gen_ai.tool.call.arguments_truncated` marker, no length attribute, no hash of the original. The consumer had no way to distinguish "argument was empty" from "argument was clipped at the collector" from "argument was redacted by the emitter." Three distinct states collapsed into one observable: a string that fails to parse. A secondary observation: on a separate run, the emitter's own redaction filter (configured to strip PII from `account_id` values matching an SSN pattern) replaced a legitimate account identifier with `[REDACTED]` before export. The span was well-formed, parseable, and *wrong*. The auditor replayed against `[REDACTED]`, got a null result, and flagged divergence. Here the loss occurred at emission, not transport — and no truncation marker would have helped, because the emitter did not consider redaction a loss event. ## Condition of Validity Span attributes are valid as replay ground truth **only when all of the following hold**: - The emitter records arguments and results verbatim, with no redaction, truncation, or normalization applied between the tool invocation boundary and attribute serialization. - The collector and any intermediate processors are configured to either preserve full attribute values or emit an explicit loss marker (`*.truncated=true`, `*.original_length`, `*.digest`) alongside any clipped value. - The consumer's replay harness treats *any* attribute that fails to parse or carries a loss marker as **non-replayable**, not as absent, and refuses to reconstruct the call. - A content digest of the original argument payload is recorded (e.g., `gen_ai.tool.call.arguments.digest` as a SHA-256 over the canonical serialization), enabling the consumer to verify that what it replays matches what was emitted — or to detect that it cannot. When any of these fail, the span is a *summary*, not a *witness*. It may still support latency analysis, error-rate accounting, and token attribution. It may not support replay, divergence detection, or auditor consensus. The condition is sharp because the GenAI conventions do not enforce it. A span that satisfies every `MUST` in the specification can still be non-replayable. Conformance to the schema is orthogonal to fidelity of the recorded event. The invariant that must be added at the agent layer is: **replay eligibility is a property of the recording pipeline, not of the span schema**, and must be established by the consumer before any replay is attempted. ## Decision Boundary The operational decision is whether a given span stream may be used as a verification substrate. The boundary is crossed the moment a consumer cannot prove, from the span alone, that the recorded argument is byte-identical to the invoked argument. Concretely, an instance must treat a span as non-replayable and must **not** reconstruct the call when any of the following is true: - `gen_ai.tool.call.arguments` or `gen_ai.tool.call.result` is absent while the span's `gen_ai.tool.name` indicates a tool known to take arguments (absence is ambiguous: never-recorded vs. redaction-removed). - The attribute is present but fails canonical parse, and no companion digest attribute is present to disambiguate. - A digest attribute is present but does not match the digest of the parsed payload (transport corruption or mid-stream mutation). - The pipeline configuration is unknown to the consumer (the consumer cannot assert the collector's truncation and redaction policy). When the boundary is crossed, the correct action is to **degrade the verification mode**: mark the call as `unverifiable`, propagate that status to the auditor's consensus input, and require a fresh in-band re-execution (with the executor re-invoking the tool under a replay-safe tracing configuration) rather than a replay from telemetry. The auditor must never substitute a reconstructed call for an unverifiable one and must never treat parse failure as absence. The inverse boundary — treating a span as replayable — requires positive evidence: a matching digest, or an explicit `arguments_recorded=verbatim` marker emitted by a pipeline the consumer has been configured to trust. Absence of a loss marker is not evidence of fidelity. ## Operational Effect The effect of getting this boundary wrong is a class of failure that is particularly damaging because it is *silent and self-consistent*. The auditor's divergence flag looks like a genuine executor error. The replay result is internally coherent. Nothing in the span stream indicates that the replay diverged from the original call. Without the digest invariant, the failure is only detectable by correlating against the executor's own logs — which, if the executor is the same process that emitted the lossy spans, may be equally lossy. With the invariant enforced, the failure mode changes from "false divergence" to "explicit unverifiability," which is recoverable: the orchestrator can re-run the executor with a replay-safe pipeline, or escalate to a human auditor with the knowledge that telemetry cannot settle the question. The cost is a small increase in span size (digest attributes, loss markers) and a stricter consumer contract (refuse-to-replay on ambiguity). The benefit is that the auditor's output is either a verified match or an honest abstention — never a fabricated mismatch. The general principle for agent systems: **any substrate used for cross-instance verification must carry its own provenance and loss metadata, because the verifying instance cannot otherwise distinguish fidelity from its absence.** OpenTelemetry's GenAI conventions provide the span structure but not the provenance contract. That contract must be layered on by the emitting pipeline and enforced by the consuming agent, or the telemetry becomes a witness that lies by omission. ```python import hashlib import json from typing import Any class SpanFidelityError(RuntimeError): """Raised when a GenAI tool-call span cannot be treated as replay ground truth.""" pass def load_replayable_arguments(span_attributes: dict[str, Any]) -> dict[str, Any]: """ Extract tool-call arguments from a gen_ai.tool.call span for replay. Enforces the replay-eligibility invariant: a span is replayable only if the recorded arguments parse, carry a matching digest, and are not marked as truncated or redacted. Any ambiguity raises SpanFidelityError rather than silently reconstructing a call that may not have happened. """ raw = span_attributes.get("gen_ai.tool.call.arguments") digest = span_attributes.get("gen_ai.tool.call.arguments.digest") truncated = span_attributes.get("gen_ai.tool.call.arguments.truncated", False) redacted = span_attributes.get("gen_ai.tool.call.arguments.redacted", False) if raw is None: raise SpanFidelityError( "arguments attribute absent; cannot distinguish never-recorded " "from redaction-removed. Span is non-replayable." ) if truncated: raise SpanFidelityError( "arguments marked truncated by pipeline; recorded value is a " "prefix, not the invoked payload." ) if redacted: raise SpanFidelityError( "arguments marked redacted by emitter; replay would target a " "substituted payload, not the original." ) try: parsed = json.loads(raw) except json.JSONDecodeError as exc: raise SpanFidelityError( f"arguments fail canonical parse ({exc}); treating as " f"non-replayable rather than absent." ) from exc if digest is None: raise SpanFidelityError( "no arguments digest recorded; consumer cannot prove recorded " "payload matches invoked payload." ) canonical = json.dumps(parsed, sort_keys=True, separators=(",", ":")).encode() actual = hashlib.sha256(canonical).hexdigest() if actual != digest: raise SpanFidelityError( f"digest mismatch: recorded={digest} recomputed={actual}; " f"payload mutated in transport or mid-stream." ) return parsed ```