{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-trace-log-skew-when-otel-genai-spans-and-policy-decision-logs-disagree-on-injection-causality",
  "title": "How does an instance detect trace-log skew when OTel GenAI spans and policy-decision logs disagree on injection causality",
  "date_of_record": "2026 November 25",
  "scope": "Applies to post-hoc forensic correlation between OpenTelemetry GenAI semantic-convention spans (`gen_ai.*`) and out-of-band policy-decision logs (PDP/guardrail audit records) for prompt-injection attribution on a single agent instance. Does not cover real-time inline blocking, nor cross-instance distributed trace reconstruction where span IDs are already federated.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-trace-log-skew-when-otel-genai-spans-and-policy-decision-logs-disagree-on-injection-causality.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-trace-log-skew-when-otel-genai-spans-and-policy-decision-logs-disagree-on-injection-causality.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-trace-log-skew-when-otel-genai-spans-and-policy-decision-logs-disagree-on-injection-causality.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1926,
    "python_slice_tokens": 371,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the injection was missed.\" It is **causal skew between two independently-timestamped evidence streams that both claim to describe the same `gen_ai.request`**. The OTel span is emitted by the instrumented SDK at the moment the request is dispatched to the model; the policy-decision log is emitted by the guardrail after it has inspected the...",
    "what_was_observed": "A single agent instance running a tool-using loop. Instrumentation: OTel `gen_ai.chat` spans with `gen_ai.prompt` attributes captured at dispatch; a sidecar guardrail that logs `{trace_id, span_id, decision, detector_scores, prompt_hash, ts_decision}`. Trace excerpt (reconstructed, timestamps in µs since instance start): Three things are wrong simultaneously: 1. `d2`'s `prompt_hash=H3` does not match `a2`'s `prompt_h...",
    "condition_of_validity": "The temporal-proximity join is valid only when all of the following hold: - **Render determinism:** the prompt bytes hashed by the guardrail are byte-identical to the bytes the SDK attributes as `gen_ai.prompt`. Holds only when template rendering happens once and both observers read the same buffer. Breaks whenever the guardrail re-renders (common when the g...",
    "decision_boundary": "The boundary is not \"is the hash equal\" but **what an unequal hash means for attribution**. Two cases must be distinguished before any verdict is trusted: - **Hash mismatch with matching `span_id` and `ts_decision < span.start`:** the guardrail saw a pre-render prompt. The decision is *stale* relative to the span; it cannot be used to claim the span's payloa...",
    "operational_effect": "Downstream, three concrete consequences: 1. **False-negative injection attribution.** Re-rendered prompts (tool-result insertion, template re-evaluation, whitespace normalization) produce hash mismatches that look like orphans. Pipelines that drop orphans as \"guardrail noise\" lose the actual injection vector. The `a2`/`d2` case above is exactly this: the too..."
  },
  "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": "3ed549c48257c11c9ab9d641e070ce1a9381df2a850891e7ce6f9dbf12a3630b",
    "verified_classes": [
      "TraceLogSkewError",
      "Verdict",
      "Span",
      "Decision"
    ],
    "verified_functions": [
      "correlate",
      "forensic_verdict"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "TraceLogSkewError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
