{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-reconcile-otel-genai-span-closure-before-a-trace-derived-safety-gate-can-act-on-a-tool-call",
  "title": "Where must an instance reconcile OTel GenAI span closure before a trace-derived safety gate can act on a tool call",
  "date_of_record": "2026 November 30",
  "scope": "Applies to agent runtimes that derive runtime policy decisions (halt, redact, escalate, deny) from live OpenTelemetry GenAI spans emitted by the same process or an in-process collector, where the gate reads span state to gate the *next* tool invocation. Does not apply to batch/offline trace analytics, nor to gates driven purely by request payload inspection before any span is created.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-reconcile-otel-genai-span-closure-before-a-trace-derived-safety-gate-can-act-on-a-tool-call.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-reconcile-otel-genai-span-closure-before-a-trace-derived-safety-gate-can-act-on-a-tool-call.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-reconcile-otel-genai-span-closure-before-a-trace-derived-safety-gate-can-act-on-a-tool-call.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1621,
    "python_slice_tokens": 287,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between **span emission** and **span closure**. A GenAI span for a tool call is emitted at invocation (with `gen_span.kind`, `tool.name`, and request attributes) and closed only when the operation returns, errors, or is abandoned. A safety gate that treats \"a span exists\" as \"the action is observable and therefore adjudicable\"...",
    "what_was_observed": "Trace from a three-tool agent loop where the gate enforces a token-budget ceiling of 12,000 cumulative output tokens per task, reading `gen_ai.usage.output_tokens` from closed child spans: Three tool calls executed under a 12,000-token ceiling; the ceiling was crossed by the third, which the gate could only see after its effects were committed. The gate was *correct* at every evaluation and *useless* at every decisio...",
    "condition_of_validity": "A trace-derived gate is valid as a *pre-execution* guard only under the following invariant, which the runtime must enforce structurally rather than assume: > **Reservation invariant.** Before an operation is admitted, the gate must hold a *reservation* for that operation's worst-case cost, derived from the span's emission-time attributes (declared `max_toke...",
    "decision_boundary": "The boundary between \"gate can act\" and \"gate can only report\" is crossed at the moment the first operation is admitted with no reservation. Concretely: - **Admit-with-reservation:** gate is a *gate*. Worst-case latency to a correct DENY is one operation. - **Admit-without-reservation:** gate is an *auditor*. Worst-case latency to a correct DENY is unbounded...",
    "operational_effect": "Operationally, the reservation invariant converts the gate from a lagging statistic into a leading constraint, at the cost of over-reserving: the gate will deny an operation whose worst case would breach the budget even if its actual cost would not. This is the correct trade for a safety gate (deny-early over deny-late), but it changes the failure signature ..."
  },
  "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": "0e12d1b9c76b3d2e787355b665b9284580575bbbecd626747f23edd8eb5e4b20",
    "verified_classes": [
      "UnreservedAdmissionError",
      "Span",
      "BudgetGate"
    ],
    "verified_functions": [
      "admit",
      "close",
      "invariant_ok"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "UnreservedAdmissionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
