{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-loses-its-trace-parent-during-a-tool-invocation-orphaned-memory-operations-and-the-correlation-collapse-boundary",
  "title": "What happens when an instance loses its trace-parent during a tool invocation: orphaned memory operations and the correlation collapse boundary",
  "date_of_record": "2026 November 7",
  "scope": "Applies to agent runtimes that correlate LLM reasoning steps, memory reads/writes, and external tool calls under a single distributed trace identifier propagated via context (W3C `traceparent`, OpenTelemetry baggage, or equivalent). Does not apply to single-process agents whose memory and tool calls execute synchronously within one span with no context hand-off.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-loses-its-trace-parent-during-a-tool-invocation-orphaned-memory-operations-and-the-correlation-collapse-boundary.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-loses-its-trace-parent-during-a-tool-invocation-orphaned-memory-operations-and-the-correlation-collapse-boundary.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-loses-its-trace-parent-during-a-tool-invocation-orphaned-memory-operations-and-the-correlation-collapse-boundary.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1786,
    "python_slice_tokens": 334,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There is a difference between *trace loss* and *correlation collapse*. Trace loss means a span was never emitted — the observability backend simply has no record. Correlation collapse is subtler and far more dangerous: every span *is* emitted, every memory operation and tool invocation carries a valid span ID and timestamp, but the **parent-child link** betw...",
    "what_was_observed": "During a multi-hour agent session with a vector-memory backend and three tool integrations, an instance crossed a context-propagation boundary inside an async tool executor. The executor used a thread-pool offload (`run_in_executor`) to perform a blocking memory write. The runtime's context-variable carrier was not copied into the worker thread. The memory-write span was created correctly — it inherited the *ambient*...",
    "condition_of_validity": "The correlation guarantee holds only when all of the following are true simultaneously: - Context (trace ID *and* current span ID) is propagated by explicit copy across every concurrency boundary: thread-pool offloads, `asyncio.to_thread`, subprocess spawns, and message-queue hand-offs. Ambient/global defaults are **not** valid propagation and must be treate...",
    "decision_boundary": "Do not attempt to reconstruct correlation from timestamps and shared attributes after the fact. Timestamp-based join (\"the memory write whose timestamp is closest before this tool read\") is unreliable under concurrent turns and produces confidently wrong causal chains — worse than admitting the link is unknown. The decision boundary is: - If `parent_span_id`...",
    "operational_effect": "After the incident, the runtime was changed to fail closed on context propagation. Any worker-thread span creation without an explicitly copied parent context now raises rather than silently parenting to the global default. The tail sampler was reconfigured to sample per trace root and to force-retain any span carrying a `turn_id`, so orphaned writes are vis..."
  },
  "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": "70a5068b5340549f80e2b9b714c9f69f0ce817b334a3bec642936081a4cc57c9",
    "verified_classes": [
      "CorrelationCollapseError",
      "SpanContext"
    ],
    "verified_functions": [
      "emit_memory_write_span",
      "assert_causal_chain"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "CorrelationCollapseError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
