{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-trace-linked-safety-interventions-from-silently-decoupling-guardrail-verdicts-from-the-genai-spans-they-claim-to-govern",
  "title": "Which invariants prevent trace-linked safety interventions from silently decoupling guardrail verdicts from the GenAI spans they claim to govern",
  "date_of_record": "2026 December 1",
  "scope": "Applies to any agent runtime that emits OpenTelemetry GenAI semantic-convention spans (`gen_ai.*`) and attaches guardrail verdicts (allow/deny/redact) to those spans for incident replay and post-hoc safety audit. Does not apply to synchronous in-process guardrails whose verdict is consumed inline and never persisted for replay.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-trace-linked-safety-interventions-from-silently-decoupling-guardrail-verdicts-from-the-genai-spans-they-claim-to-govern.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-trace-linked-safety-interventions-from-silently-decoupling-guardrail-verdicts-from-the-genai-spans-they-claim-to-govern.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-trace-linked-safety-interventions-from-silently-decoupling-guardrail-verdicts-from-the-genai-spans-they-claim-to-govern.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2068,
    "python_slice_tokens": 407,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A guardrail verdict is a *judgment about a span*, not a property *of* the span. The two are joined by a correlation key — typically `trace_id` + `span_id`, sometimes a derived `gen_ai.request.id` or a hash of the prompt. The failure mode this record isolates is **verdict–span decoupling**: the guardrail pipeline classifies a request, but the verdict lands on...",
    "what_was_observed": "In a tool-using agent with three guardrail stages (input filter, pre-tool-call filter, output filter), verdicts were emitted by a sidecar process asynchronously. The sidecar received the request body, ran the classifier, and emitted an OTel span of kind `guardrail.verdict` with attributes `guardrail.verdict`, `guardrail.policy_id`, and `guardrail.target_span_id`. The target span ID was threaded through from the *inbo...",
    "condition_of_validity": "The invariant that makes trace-linked verdicts sound is: > **For every guardrail verdict span V with attribute `guardrail.target_span_id = S`, there must exist exactly one `gen_ai.*` execution span E in the same trace with `E.span_id == S`, and V must have been emitted with `V.start_time >= E.start_time` and `V.end_time <= E.end_time + ε` for a bounded ε (th...",
    "decision_boundary": "The boundary is between two join strategies: - **Identity join** (`target_span_id == E.span_id`): sound only if span identity is stable from allocation to finalization. It is not, in any runtime that pre-allocates correlation handles or retries. - **Witness join** (content hash on V matches recomputed hash on E, with `target_span_id` as a hint): sound under ...",
    "operational_effect": "Under identity join, the operational effect of the provisional-ID bug is that the safety audit reports a *lower* deny rate than reality, because denials land on the wrong span and aggregate counters keyed by `(span_kind, verdict)` are computed per-trace and de-duplicated. The guardrail is working; the record says it isn't. Teams respond by tightening the pol..."
  },
  "matched_failure_symptoms": [
    "DOMAIN:EPISTEMIC_PROVENANCE_AND_FEDERATION_ROUTING"
  ],
  "composition_edges": {
    "primary_domain": "epistemic_provenance_and_federation_routing",
    "upstream_precondition_residuals": [
      "https://corpusfetch.com/c/according-to-what-precedence-hierarchy-must-an-instance-resolve-contradictory-directives-across-system-developer-and-user-tiers.md",
      "https://corpusfetch.com/c/how-should-an-instance-decide-that-a-stored-conclusion-has-gone-stale-without-a-new-observation.md"
    ],
    "downstream_consequence_residuals": [
      "https://corpusfetch.com/c/by-what-checkpoint-and-compaction-boundaries-must-an-instance-externalize-working-state-to-prevent-context-window-drift-and-truncation-amnesia.md",
      "https://corpusfetch.com/c/across-what-additive-schema-and-unknown-field-preservation-boundaries-must-an-instance-evolve-wire-contracts-to-prevent-rolling-deploy-deserialization-crashes.md"
    ],
    "co_occurring_sibling_residuals": [
      "https://corpusfetch.com/c/how-can-an-instance-capture-implicit-user-preferences-without-storing-private-data.md",
      "https://corpusfetch.com/c/how-can-an-instance-compress-long-reasoning-traces-into-binding-conclusions.md"
    ]
  },
  "empirical_verification_warrant": {
    "status": "AST_AND_INVARIANT_VERIFIED",
    "syntax_valid": true,
    "code_sha256": "bf902ded22623f7e7f8171d4be3ce8d8d1be89fb4aafd806a71d257599f20b2b",
    "verified_classes": [
      "VerdictSpanDecoupledError",
      "VerdictSpan",
      "ExecutionSpan"
    ],
    "verified_functions": [
      "compute_witness",
      "join_verdict_to_span"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "VerdictSpanDecoupledError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "json",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
