{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-s-safety-flag-span-arrive-after-its-cost-telemetry-span-has-already-been-sealed-into-an-immutable-trace-batch",
  "title": "Why does an instance's safety-flag span arrive after its cost-telemetry span has already been sealed into an immutable trace batch?",
  "date_of_record": "2026 November 30",
  "scope": "Applies to observability pipelines that emit per-step spans from an agent runtime and join them to (a) cost telemetry and (b) safety-classifier verdicts before sealing a trace into an immutable batch for later correlation. Does not apply to single-process synchronous loggers where all telemetry for a step is emitted within one call frame.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-s-safety-flag-span-arrive-after-its-cost-telemetry-span-has-already-been-sealed-into-an-immutable-trace-batch.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-s-safety-flag-span-arrive-after-its-cost-telemetry-span-has-already-been-sealed-into-an-immutable-trace-batch.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-s-safety-flag-span-arrive-after-its-cost-telemetry-span-has-already-been-sealed-into-an-immutable-trace-batch.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2331,
    "python_slice_tokens": 445,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure here is not \"the safety signal was wrong\" or \"the cost number was wrong.\" It is a **join-timing skew**: two telemetry producers that both describe the *same* agent step commit their records at different points in the step's lifecycle, and the trace-sealing stage freezes the batch at the earlier producer's commit boundary. The cost span is emitted...",
    "what_was_observed": "A cost-telemetry span is emitted at `t0` when the model call returns. Its `trace_id` and `step_id` are minted by the runtime. The safety classifier is invoked at `t1 = t0 + ε` (after the output is assembled), and its span is emitted at `t2 = t1 + Δ`, where `Δ` is the classifier's own LLM latency — typically 200ms to 3s, and heavy-tailed: p99 routinely exceeds 10s under classifier load. The trace batcher seals on a **...",
    "condition_of_validity": "This failure is bounded and does not occur under any of the following conditions, which are the guardrails: - **The batcher seals on a *safety-complete* watermark, not a *step-complete* watermark.** That is, step `N`'s batch is not sealed until either the safety span for `N` arrives or a per-step safety deadline `D_safety` expires. This requires the runtime ...",
    "decision_boundary": "The decision boundary is the choice of watermark. Concretely: - **Seal-on-step-complete** (broken): batch closes at `t0 + W`, where `W` is a fixed lag. Valid only if `Δ < W` for all steps, which is false for heavy-tailed classifier latency. This boundary is crossed whenever `p99(Δ) > W`. - **Seal-on-join-complete** (correct): batch closes at `max(t0 + W, t2)...",
    "operational_effect": "The observable effect is a **systematic, load-correlated under-reporting of safety flags in sealed traces**, concentrated on long-output and high-risk steps, and invisible to any monitoring that aggregates over all steps (because most steps have short outputs and fast classifiers, so the aggregate looks fine). The p50 safety coverage is 99.9%; the p99.9 is w..."
  },
  "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": "2296cdcd83b645edd2049523f66796daa816fd3bc64832d1607234476ecb2396",
    "verified_classes": [
      "TraceSealViolation",
      "Span",
      "Batch",
      "JoinCompleteBatcher"
    ],
    "verified_functions": [
      "__init__",
      "open_step",
      "ingest",
      "_maybe_seal",
      "seal_due"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "TraceSealViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "time",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
