{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-trace-correlation-when-a-model-span-re-enters-a-tool-span-under-retry",
  "title": "Why does an instance lose trace correlation when a model span re-enters a tool span under retry",
  "date_of_record": "2026 November 28",
  "scope": "Applies to agent runtimes that propagate a single correlation ID (trace/span ID) across model invocations, tool calls, and sub-agent handoffs, where a tool call is retried or replayed after a model-side failure. Does not apply to purely stateless single-shot inference with no tool loop, nor to systems that regenerate a fresh correlation ID per span with no parent linking.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-trace-correlation-when-a-model-span-re-enters-a-tool-span-under-retry.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-trace-correlation-when-a-model-span-re-enters-a-tool-span-under-retry.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-trace-correlation-when-a-model-span-re-enters-a-tool-span-under-retry.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1759,
    "python_slice_tokens": 260,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There is a difference between *ID propagation* and *ID identity continuity*. Most agent frameworks propagate a correlation ID by copying it into the span context at each boundary. That is not the same as guaranteeing the ID is the same ID at every hop. The distinction matters because a model span and a tool span have different lifecycle owners: the model spa...",
    "what_was_observed": "A three-hop agent executed `plan -> search_tool -> summarize`. The runtime injected `correlation_id=C7A1` at the planner. The planner emitted a model span `M1` (parent `C7A1`) and a tool-call intent for `search_tool`. The tool executor opened span `T1` (parent `M1`, correlation `C7A1`). The search backend returned a 503. The tool executor's retry policy fired: it re-opened `T2` with parent `M1` and correlation `C7A1`...",
    "condition_of_validity": "The fork is only possible under a conjunction of three conditions, and the guardrail only needs to break one: 1. **Independent retry ownership.** The model client and the tool executor each own a retry loop, and neither consults the other's attempt counter. 2. **Parent-context reconstruction from root.** The retrying layer rebuilds the span context from the ...",
    "decision_boundary": "The decision is whether to make correlation continuity a *captured* property or a *reconstructed* property. - **Reconstruct from root** (the failing pattern): cheap, requires no state threading, but forks under independent retry. Use only when exactly one layer owns retries and the other is a pure function. - **Capture at boundary** (the correct pattern): ev...",
    "operational_effect": "When the invariant holds, trace correlation is a reliable join key: you can reconstruct the full causal chain of a task across model, tool, and sub-agent spans by filtering on one ID, and duplicate tool executions are detectable as idempotency-key collisions rather than invisible forks. When it breaks, you get two symptoms that are easy to misdiagnose: (a) t..."
  },
  "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": "d73587dec0faa4bce6912b0e489507dee21188eafa89398526e4f8e2905b4ab5",
    "verified_classes": [
      "TraceCorrelationForkError",
      "SpanContext"
    ],
    "verified_functions": [
      "open_retry_span",
      "idempotency_key",
      "execute_tool_with_replay_guard"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "TraceCorrelationForkError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
