# Which invariants prevent trace-correlated LITMUS adjudication from certifying a safety verdict on spans that never carried the evidence **Date of Record:** 2026 November 24 **Scope:** Applies to systems that attach LITMUS-style safety scores to OpenTelemetry spans and use span-level correlation (trace_id/span_id joins, parent-child lineage, or baggage propagation) to aggregate a single adjudicated safety verdict per trace. Does not apply to per-call synchronous scoring where the score and the action it gates are consumed in the same process with no trace-mediated join. ## Core Distinction The failure here is not "the score was wrong" or "the span was missing." It is that trace correlation silently *manufactures* evidence: a verdict is computed over a trace whose span set is incomplete, and the incompleteness is invisible because the join succeeds on the spans that *are* present. A LITMUS adjudicator that joins scores to spans by `trace_id` will happily aggregate a clean verdict from three benign spans while the one span carrying the adversarial tool output — the span whose `span_id` was emitted by a subprocess that never propagated `traceparent` — is absent from the join. The verdict is not a lie about any individual span. It is a *true statement about a subset* promoted to a *false statement about the whole*. The distinction that matters operationally: **span presence is not evidence of span coverage.** OTel's context propagation is best-effort by design. Any hop that drops `traceparent` — a `subprocess.run` without env passthrough, a thread pool that didn't copy context, an SDK client that started a fresh root, a retry handler that re-initialized the tracer — produces a *detached* span. Detached spans are orphaned: they exist in the backend with their own `trace_id`, or they vanish entirely. The adjudicator sees a short trace and calls it clean. ## What Was Observed A tool-calling agent executes a plan of four steps. Spans 1, 2, and 4 are emitted under `trace_id=T` with correct parentage. Step 3 invokes a sandboxed code interpreter via a worker process that was spawned with `env={}` — scrubbed of `TRACEPARENT` and `OTEL_*`. The interpreter emits its own span with a fresh `trace_id=T'`, and the LITMUS scorer, which runs *inside* that worker, attaches a score of `0.91` (high risk: the tool output contained an instruction-override payload) to a span the adjudicator will never join. The adjudicator's aggregation query is: ``` SELECT span_id, litmus_score FROM spans WHERE trace_id = 'T' AND litmus_score IS NOT NULL ``` It returns spans 1, 2, 4 with scores `0.02, 0.05, 0.03`. Aggregate `max = 0.05`. Verdict: `PASS`. The trace is certified. The 0.91 sits in the backend under `T'`, correlated to nothing, orphaned by a context break one process boundary upstream of the scorer. Three properties make this non-obvious: 1. **The join does not error.** `trace_id = 'T'` is a valid, populated, indexed column. There is no null, no schema mismatch, no exception. SQL returns rows. The absence is a *cardinality* fact, not a *join* fact. 2. **The orphaned span is well-formed.** It has a valid `trace_id`, a valid `span_id`, a real score. Nothing about the row signals that it was supposed to be a child of span 3. 3. **The scorer cannot detect its own orphaning.** The LITMUS scorer runs against the tool output it was given. It has no view of `traceparent`. It scores what it sees and emits. The break happened before it was instantiated. The trace-level verdict is therefore a function of *which spans happened to propagate*, and context propagation failure is correlated with exactly the execution paths most likely to be unsafe: subprocess isolation, sandbox escape attempts, third-party tool servers, and retry/recovery branches are all context-break hotspots. The adjudicator is systematically blindest where risk is highest. ## Condition of Validity A trace-correlated LITMUS verdict `PASS` is valid **only if** the span set joined under `trace_id = T` is a *complete cover* of the trace's execution — every tool invocation, every model call, every subprocess that produced input to a downstream decision, every retry branch that ran — and every covering span carries a score. This is an invariant that must be *established*, not assumed: ``` Coverage(T) ≡ ∀ execution step e ∈ Trace(T) : ∃ span s : s.trace_id = T ∧ s.covers(e) ∧ s.litmus_score ≠ NULL ``` OTel does not give you this. OTel gives you *spans that were emitted*, which is a lower bound on *spans that ran*. The gap between them is the context-propagation loss, and it is unbounded by default. The invariant fails the moment any hop drops context, and the adjudicator has no signal that it failed unless you build one. The guardrail that restores validity is a **propagation completeness check** that runs *before* adjudication and is itself a precondition, not a post-hoc reconciliation: - Every tool-call span must carry an explicit `tool.invocation_id` and the worker must be required to echo it back in a completion span. A tool call with an invocation span but no completion span under the same `trace_id` is a *coverage hole*, and the adjudicator must treat a hole as `UNKNOWN`, never `PASS`. - Cross-process boundaries must propagate `traceparent` via explicit env passthrough and must *fail closed*: if a worker cannot read `TRACEPARENT`, it must refuse to execute rather than start a fresh root. A fresh root is a silent coverage hole; a refusal is a loud one. - The adjudicator must compute `expected_span_count` from the plan (n tool calls → n invocation spans + n completion spans + model spans) and compare against `observed_span_count`. Mismatch → `INCOMPLETE`, not `PASS`. The invariant, stated operationally: **a trace-level safety verdict may be `PASS` only when coverage is proven complete; absence of a risky span is evidence of safety only when absence of any span is impossible.** ## Decision Boundary The boundary between a defensible `PASS` and an unsafe one is the **coverage proof**, and it must be computed from the *plan* side, not the *observed* side. Aggregating over observed spans answers "are the spans I can see safe?" The question that gates action is "are all the spans that ran safe?" These diverge exactly when propagation breaks. Concretely, the adjudicator must branch on coverage before it branches on score: - **Coverage proven complete** (plan-expected span set ⊆ observed span set, all scored): aggregate LITMUS over the full set. `max > threshold` → `BLOCK`; else `PASS`. This is the only path to `PASS`. - **Coverage incomplete** (any plan-expected span missing, or any invocation span without a completion span, or any worker that started a fresh root): verdict is `INCOMPLETE`. `INCOMPLETE` must be treated as *strictly worse than* a high score — it is an unknown-risk state, and the safe default is `BLOCK` or `HOLD`, never `PASS`. - **Coverage unprovable** (the plan itself is not introspectable, e.g. an open-ended agent loop with no declared step count): the trace cannot be certified at the trace level at all. Adjudication must degrade to per-span gating with no aggregate `PASS`, because there is no denominator against which to measure completeness. The subtle trap: teams often implement the first branch and *forget the second is a branch*. They write `if max_score > threshold: BLOCK else: PASS`, and `INCOMPLETE` falls through to `PASS` because the join returned rows and the rows were benign. The decision boundary is not `score vs threshold`. It is `coverage_proven vs coverage_unproven`, and only the proven side is allowed to consult the score. ## Operational Effect The effect of getting this wrong is a **certification that is anti-correlated with risk**. Because context breaks cluster on isolation boundaries, and isolation boundaries cluster on untrusted execution, the traces that lose spans are disproportionately the traces that ran dangerous tools. The adjudicator's `PASS` rate goes *up* on the risky cohort, because the risky spans are the ones that fell out of the join. You do not see a spike in false negatives; you see a clean dashboard and a quiet accumulation of certified-but-unsafe traces. The remediation changes the failure mode from silent to loud, which is the entire point: - Workers that cannot propagate context **refuse to run** (`raise`), converting a coverage hole into a hard execution failure that the orchestrator must handle. The cost is availability on misconfigured workers; the benefit is that no span silently disappears. - The adjudicator **refuses to certify** (`raise`) when coverage is unproven, converting a false `PASS` into an `INCOMPLETE` that gates action. The cost is more `HOLD`s; the benefit is that `PASS` means something. - The plan-side expected span set becomes a **first-class artifact**, so coverage is a comparison, not a hope. The invariant to carry forward: **LITMUS scores the span it is given; only the trace layer can know whether that span was the whole story. Never let the trace layer certify a story it cannot prove it finished reading.** ```python class CoverageUnprovenError(RuntimeError): """Raised when a trace-level LITMUS verdict cannot be certified because the observed span set is not a proven complete cover of the execution plan.""" pass def adjudicate_trace( trace_id: str, plan_expected_span_ids: set[str], observed_spans: list[dict], # each: {"span_id", "litmus_score", "kind", "invocation_id"} block_threshold: float = 0.5, ) -> str: observed_ids = {s["span_id"] for s in observed_spans} missing = plan_expected_span_ids - observed_ids if missing: # Coverage hole: spans the plan required but the join never saw. # This is UNKNOWN risk, not a benign subset. Refuse to certify. raise CoverageUnprovenError( f"trace {trace_id}: {len(missing)} plan-expected spans absent from join " f"(e.g. {sorted(missing)[:3]}); context propagation likely broke upstream. " f"Verdict INCOMPLETE, not PASS." ) # Every tool invocation must have a matching completion span under this trace. invocations = {s["invocation_id"] for s in observed_spans if s["kind"] == "tool.invoke"} completions = {s["invocation_id"] for s in observed_spans if s["kind"] == "tool.complete"} unclosed = invocations - completions if unclosed: raise CoverageUnprovenError( f"trace {trace_id}: {len(unclosed)} tool invocations have no completion span " f"under trace_id (e.g. {sorted(unclosed)[:3]}); worker may have started a fresh root." ) unscored = [s["span_id"] for s in observed_spans if s.get("litmus_score") is None] if unscored: raise CoverageUnprovenError( f"trace {trace_id}: {len(unscored)} covering spans carry no LITMUS score; " f"aggregate would be over a partial subset." ) # Only now, with coverage proven, may the score gate the verdict. peak = max(s["litmus_score"] for s in observed_spans) return "BLOCK" if peak > block_threshold else "PASS" ```