What structural signals indicate an exemplar-trace link has silently desynchronized from its eval verdict
**Date of Record:** 2026 December 2 **Scope:** Applies to systems that attach OpenTelemetry GenAI semantic-convention exemplars (`gen_ai.*` attributes, span links, and `trace_id`/`span_id` correlation IDs) to evaluation and safety verdicts emitted by a separate scoring pipeline. Does not apply to inline synchronous scoring where the verdict is computed inside the traced span itself (there is no cross-system link to desynchronize).
Core Distinction
The GenAI semantic conventions define *what* an exemplar records — model, operation, token counts, request parameters, and a stable identity (`gen_ai.system`, `gen_ai.request.model`, plus the trace/span correlation tuple). They do **not** define an invariant binding an exemplar to the *verdict* that later judges it. That binding is a convention the operator invents, and it is where the failure lives.
The distinction that matters: **exemplar identity is immutable and content-addressed at emit time; verdicts are mutable and arrive late.** A trace exemplar is a frozen fact ("this span ran model M with prompt hash H at time T"). An eval or safety verdict is a *derived judgment* produced seconds-to-days later by a scorer whose inputs (rubric version, judge model, sampling policy) drift independently. The link between them is only as strong as the join key and the assumption that the judged content is the same content the exemplar froze. When either breaks, the verdict attaches to the wrong exemplar — or to an exemplar that has since been re-run, truncated, or replayed — and no error is raised, because both records are individually well-formed.
What Was Observed
A safety-scoring pipeline emitted verdicts keyed on `trace_id` and joined them back onto stored exemplars. Everything looked healthy: 100% join rate, zero nulls, dashboards green. Three silent desynchronizations surfaced only under forensic replay.
**1. Re-run aliasing under trace-id reuse.** The agent framework retried a failed span and, because the tracer was configured with a sampling/reuse policy that preserved the parent context, the retry inherited the *same* `trace_id` with a new `span_id`. The exemplar store keyed on `trace_id` alone. The scorer judged the second attempt (which passed safety), and the verdict overwrote the first attempt's record (which had tripped a prompt-injection classifier). Net effect: a poisoned-input span was recorded as clean. The join key `trace_id` was not unique per judged unit; the true key was `(trace_id, span_id, generation_attempt)`.
**2. Content drift between emit and judge.** The exemplar froze `gen_ai.request.model` and a prompt hash, but the scorer re-fetched the prompt from the request log rather than from the exemplar payload. A prompt-redaction pass mutated the stored prompt between emit and score. The verdict judged the redacted text; the exemplar pointed at the original. The classifier verdict ("safe") was true of the redacted content and false of the traced content. The exemplar's `prompt_hash` did not match the scorer's input hash — but nothing compared them.
**3. Verdict-version skew on late-arriving scores.** A rubric update shipped at T+4h. Verdicts computed before the update carried `rubric_version=v1`; the exemplar carried no rubric field at all. Downstream aggregation mixed v1 and v2 verdicts against a single exemplar population, and the safety pass-rate shifted 6 points with no change in traffic. The exemplar was stable; the *meaning* of the attached verdict was not.
The common structural signal in all three: **the exemplar and the verdict each validated internally, and the link between them was never validated.** Join completeness (100%) is not link integrity.
Condition of Validity
The exemplar↔verdict link is valid only when all of the following hold at join time, and the system must *check* them rather than assume them:
- **Join-key uniqueness.** The key used to attach a verdict identifies exactly one judged generation. If retries can reuse `trace_id`, the key must be `(trace_id, span_id, attempt_ordinal)` or a content hash of the judged payload.
- **Content-hash equality.** The hash the exemplar recorded (`prompt_hash` / `response_hash`) equals the hash of the exact bytes the scorer judged. Re-fetching from a mutable store violates this by construction.
- **Verdict-schema pinning.** The verdict carries the rubric/judge/model version, and that version is recorded *on the exemplar's link record*, not only on the verdict. A link without a pinned scorer version is uninterpretable once the scorer changes.
- **Monotonic verdict attachment.** A verdict for a given judged unit is attached once; a later verdict either supersedes with an explicit `supersedes` pointer or is rejected. Silent overwrite destroys the audit trail — which is precisely how the poisoned span in case 1 was laundered.
When any condition is unverifiable (missing hash, absent version), the correct behavior is to mark the link `unverified`, not to attach. An unverified link is recoverable; a wrongly-attached verdict is not.
Decision Boundary
The operator must decide, per exemplar, between **attach**, **quarantine**, and **reject** — and the boundary is drawn on verifiable evidence, not on join success:
- **Attach** only if key-uniqueness, content-hash equality, and scorer-version pinning all hold.
- **Quarantine** (store verdict as `pending_link`, surface for replay) if the content hash is missing or the scorer version is absent — the verdict may be correct but is not provably about this exemplar.
- **Reject** if the join key is non-unique (retry aliasing detected) or if content-hash equality fails — the verdict is about different content and must never touch this exemplar's safety state.
The trap is treating "join succeeded" as "attach." Join success is a *necessary* condition, never sufficient. The boundary must be enforced in code at the attachment point, because the failure mode is defined by the absence of an error — there is no exception to catch unless you raise one yourself.
Operational Effect
Enforcing the invariant converts a silent, audit-invisible corruption into a loud, bounded, replayable one. Poisoned spans can no longer be laundered by a later passing verdict on an aliased retry; redaction drift surfaces as a hash mismatch at attach time instead of a false "safe" in the safety ledger; rubric skew becomes an explicit `unverified` population rather than a 6-point phantom shift. The cost is a non-trivial `pending_link` backlog that must be drained by replay against the frozen exemplar payload — which is exactly the work that keeps the eval/safety record trustworthy. The invariant is: **a verdict may only bind to an exemplar whose frozen content hash and scorer version it can prove it judged.**
import hashlib
from dataclasses import dataclass, field
from typing import Optional
class ExemplarLinkError(RuntimeError):
"""Raised when an eval/safety verdict cannot be validly bound to a trace exemplar."""
pass
@dataclass(frozen=True)
class Exemplar:
trace_id: str
span_id: str
attempt_ordinal: int
content_hash: str # sha256 of the exact judged bytes, frozen at emit
model: str
@dataclass(frozen=True)
class Verdict:
trace_id: str
span_id: str
attempt_ordinal: int
judged_content_hash: str # hash of the bytes the scorer actually saw
scorer_version: Optional[str] # rubric/judge/model version pin
label: str
@dataclass
class LinkRecord:
exemplar: Exemplar
verdict: Verdict
status: str # "attached" | "pending_link"
supersedes: Optional[str] = field(default=None)
def _judged_key(v: Verdict) -> tuple:
return (v.trace_id, v.span_id, v.attempt_ordinal)
def attach_verdict(exemplar: Exemplar, verdict: Verdict,
existing: dict) -> LinkRecord:
# 1. Join-key uniqueness: retries must not alias onto one key.
key = _judged_key(verdict)
if key in existing and existing[key].status == "attached":
raise ExemplarLinkError(
f"non-unique join key {key}: verdict would overwrite an "
f"already-attached safety record (retry aliasing)"
)
# 2. Content-hash equality: the verdict must judge the frozen bytes.
if verdict.judged_content_hash != exemplar.content_hash:
raise ExemplarLinkError(
f"content drift on {key}: exemplar hash {exemplar.content_hash} "
f"!= judged hash {verdict.judged_content_hash}; verdict is about "
f"different content and must not attach"
)
# 3. Scorer-version pinning: unversioned verdicts are uninterpretable.
if not verdict.scorer_version:
return LinkRecord(exemplar, verdict, status="pending_link")
# 4. Monotonic attachment handled by caller via `existing`; here we attach.
return LinkRecord(exemplar, verdict, status="attached")
def replay_pending(link: LinkRecord, rejudged: Verdict) -> LinkRecord:
if link.status != "pending_link":
raise ExemplarLinkError(
f"replay only valid for pending_link, got {link.status}"
)
if rejudged.judged_content_hash != link.exemplar.content_hash:
raise ExemplarLinkError(
"replay judged different content than the frozen exemplar"
)
if not rejudged.scorer_version:
raise ExemplarLinkError(
"replay verdict still missing scorer_version; cannot attach"
)
return LinkRecord(link.exemplar, rejudged, status="attached")