{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-emits-safety-signal-spans-after-its-trace-root-has-already-been-closed-orphaned-span-correlation-in-agent-observability",
  "title": "What happens when an instance emits safety-signal spans after its trace root has already been closed: orphaned span correlation in agent observability",
  "date_of_record": "2026 November 22",
  "scope": "Applies to agent observability pipelines that correlate spans to a trace root by `trace_id` and finalize cost/latency/safety aggregates at root-close time. Does not apply to streaming aggregation systems that recompute trace-level attributes continuously from a durable span store.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-emits-safety-signal-spans-after-its-trace-root-has-already-been-closed-orphaned-span-correlation-in-agent-observability.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-emits-safety-signal-spans-after-its-trace-root-has-already-been-closed-orphaned-span-correlation-in-agent-observability.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-emits-safety-signal-spans-after-its-trace-root-has-already-been-closed-orphaned-span-correlation-in-agent-observability.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2042,
    "python_slice_tokens": 448,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters here is between *span emission order* and *span causal order*. In a single-process LLM call, the safety classifier runs inline and its verdict span is emitted before the parent span closes. In an agentic system, safety evaluation is often asynchronous and decoupled: a moderation model, a policy engine, or a post-hoc auditor inspe...",
    "what_was_observed": "A multi-tool agent trace for a single user turn exhibited the following sequence: 1. Root span `agent.turn` opened at T0 with `trace_id=abc123`. 2. Child spans for `llm.plan`, `tool.search`, `tool.fetch`, `llm.synthesize` emitted between T0 and T0+4.2s. 3. At T0+4.2s the root span closed. The aggregator computed `total_cost=0.041 USD`, `p99_latency=4200ms`, `safety_verdict=null`, and flushed the trace record to the c...",
    "condition_of_validity": "The invariant that must hold for correct correlation is: > For every span `s` with `s.trace_id = t`, either `s` is ingested before `t` is finalized, or the finalization of `t` is *reversible* and any trace-level attribute derived from `s` is recomputed on late arrival. This invariant holds trivially when safety evaluation is synchronous and inline. It breaks...",
    "decision_boundary": "The decision boundary is where you choose between two finalization strategies: **Strategy A — Close-on-root.** Finalize the trace when the root span ends. Cheap, low-latency dashboards, but requires that every causally-relevant span be a synchronous descendant of the root. Any async safety, audit, or cost-reconciliation span violates this and must be handled...",
    "operational_effect": "The observable effects, in order of severity: 1. **Safety blind spot under load.** The async judge's queue delay grows with load, so `L_max` grows exactly when safety matters most. Orphaned safety spans cluster during traffic spikes — the system is least safe, and least observable, at peak. 2. **Cost/latency misattribution.** If late spans are folded into du..."
  },
  "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": "b064b8f2876e1c4b88a1a5984002b865ab4a5ae9eb71edec3cdbebeb67fe261e",
    "verified_classes": [
      "OrphanedSafetySpanError",
      "Span",
      "TraceRecord",
      "TraceFinalizer"
    ],
    "verified_functions": [
      "__init__",
      "ingest",
      "try_seal"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "OrphanedSafetySpanError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
