{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-causal-linkage-between-an-llm-span-and-the-memory-read-that-fed-it-when-the-observability-pipeline-batches-spans-by-wall-clo",
  "title": "Why does an instance lose causal linkage between an LLM span and the memory read that fed it when the observability pipeline batches spans by wall-clock flush window?",
  "date_of_record": "2026 December 2",
  "scope": "Applies to runtime observability pipelines that emit LLM spans, tool-execution spans, and memory-operation spans as separate asynchronous records and reconstruct causality post-hoc via span parentage plus timestamps. Does not apply to single-process synchronous tracers that emit a single fused span per agent step, nor to pipelines that carry an explicit causal token (trace-context propagation) through every memory and tool call.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-causal-linkage-between-an-llm-span-and-the-memory-read-that-fed-it-when-the-observability-pipeline-batches-spans-by-wall-clo.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-causal-linkage-between-an-llm-span-and-the-memory-read-that-fed-it-when-the-observability-pipeline-batches-spans-by-wall-clo.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-causal-linkage-between-an-llm-span-and-the-memory-read-that-fed-it-when-the-observability-pipeline-batches-spans-by-wall-clo.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1741,
    "python_slice_tokens": 236,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"missing spans.\" Every span arrives. The failure is **causal misattribution under flush-window reordering**: a memory `read` span that produced the context for LLM call *N* is batched into the same flush window as LLM call *N+1*, and because the pipeline correlates by `parent_span_id` plus nearest-preceding-timestamp, the read gets attache...",
    "what_was_observed": "An agent loop with the canonical shape: `retrieve → assemble prompt → generate → parse tool call → execute tool → checkpoint`. Memory reads go to a vector store over a network; generation goes to a hosted inference endpoint. The tracer emits spans on completion (span-close), not on start. The collector batches by a 250 ms flush window and sorts each batch by `end_time` before writing to the correlation store. Observe...",
    "condition_of_validity": "This misattribution is bounded and predictable. It occurs when and only when all three hold: 1. **Spans are emitted on close, not on start.** A span that opens before generation *N* but closes after generation *N+1* has begun carries an `end_time` that sorts it *after* the generation it fed. If the tracer emitted an `open` event with `start_time` at issue, t...",
    "decision_boundary": "The guardrail is a **causal-edge invariant enforced at span emission, not at correlation time**: every memory and tool span must carry the `span_id` of the LLM generation that *requested* it, captured at request-issue time, and the correlator must refuse to attach any span lacking that edge. Concretely: - The agent runtime mints a `request_token` (the curren...",
    "operational_effect": "With the causal edge stamped at issue, the straddling read attaches to generation *N* regardless of flush order, and the phase shift disappears. The observable consequences: - **Retrieval hit rate becomes monotonic across steps** instead of showing the phantom first-step-zero / later-step-inflated signature. A regression to that shape is now a reliable alarm..."
  },
  "matched_failure_symptoms": [
    "OOM_KILL_OR_MEMORY_EXHAUSTION"
  ],
  "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": "e0bf6ba73becdf80fb6cf679eaf288bcf295d01854fe9d19cfacac3c8d644595",
    "verified_classes": [
      "CausalEdgeMissingError"
    ],
    "verified_functions": [
      "attach_span"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "CausalEdgeMissingError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
