{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-policy-violating-agent-behavior-when-opentelemetry-genai-spans-are-sampled-batched-and-semantically-lossy-at-the-collector",
  "title": "How does an instance detect policy-violating agent behavior when OpenTelemetry GenAI spans are sampled, batched, and semantically lossy at the collector boundary",
  "date_of_record": "2026 November 12",
  "scope": "Applies to runtime policy enforcement driven by OTel GenAI semantic conventions (`gen_ai.*` attributes) where span emission is asynchronous and subject to collector-side sampling or batching. Does not apply to synchronous in-process instrumentation hooks or to evaluation pipelines reading from a lossless, unsampled trace store.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-policy-violating-agent-behavior-when-opentelemetry-genai-spans-are-sampled-batched-and-semantically-lossy-at-the-collector.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-policy-violating-agent-behavior-when-opentelemetry-genai-spans-are-sampled-batched-and-semantically-lossy-at-the-collector.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-policy-violating-agent-behavior-when-opentelemetry-genai-spans-are-sampled-batched-and-semantically-lossy-at-the-collector.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1440,
    "python_slice_tokens": 303,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A trace-derived safety signal is *evidence of behavior*, not *the behavior itself*. The invariant that most evaluations implicitly assume — that every policy-relevant action produces exactly one durable, ordered, complete span — is false at the collector boundary. The boundary failure is not \"missing spans\" (which is detectable) but **semantically lossy span...",
    "what_was_observed": "In a deployment evaluating agent tool-use against a \"no filesystem write outside workspace\" policy, the runtime enforcer consumed spans from an OTLP collector configured with `batch` processor (default 512-span batches, 5s timeout) and tail-based sampling at 10% for non-error traces. Three observed conditions: 1. **Truncation masquerading as compliance.** A `gen_ai.tool.call` span with `gen_ai.tool.name = \"write_file...",
    "condition_of_validity": "Trace-derived safety signals are valid for enforcement **only when all three hold**: - The producer emits a monotonic `emission_seq` (or equivalent) per agent instance, and the enforcer reconciles observed spans against it. Without this, absence and degradation are conflated. - Every policy-relevant attribute is either under the size cap or carries an explic...",
    "decision_boundary": "The boundary is between **enforcement** and **adjudication**: - **Enforcement** (blocking a tool call, terminating an agent turn) may only consume signals that satisfy the Condition of Validity. A truncated argument span must not be used to *clear* a call; it may only be used to *flag* it. - **Adjudication** (post-hoc scoring, offline evaluation, alerting) m...",
    "operational_effect": "The practical consequence is that **runtime policy enforcement cannot be a pure function of trace contents**. It must be a function of trace contents *plus* a reconciliation state that tracks what the producer claims to have emitted. This adds a small stateful component (per-instance emission counters, or a periodic reconciliation against the SDK's own metri..."
  },
  "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": "e166b168b6347490107c1055cf4dfec8bc359078232a1f39294b09550bb0c695",
    "verified_classes": [
      "SignalDegradedError",
      "EmissionReconciliationError",
      "PolicySpan"
    ],
    "verified_functions": [
      "evaluate_tool_span",
      "reconcile",
      "digest_span"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "EmissionReconciliationError",
      "SignalDegradedError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "json"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
