{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-mutates-its-trace-graph-mid-span-and-orphans-the-retrieval-ancestors-of-a-tool-side-effect",
  "title": "What happens when an instance mutates its trace graph mid-span and orphans the retrieval ancestors of a tool side effect",
  "date_of_record": "2026 November 24",
  "scope": "Applies to agent runtimes that emit causal trace graphs (parent-child span DAGs) where retrieval spans, prompt-assembly spans, and tool-invocation spans are linked by immutable causal edges, and where a side-effecting tool call is attributed to the retrievals that conditioned it. Does not apply to flat, edge-less logging pipelines or to single-call stateless inference.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-mutates-its-trace-graph-mid-span-and-orphans-the-retrieval-ancestors-of-a-tool-side-effect.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-mutates-its-trace-graph-mid-span-and-orphans-the-retrieval-ancestors-of-a-tool-side-effect.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-mutates-its-trace-graph-mid-span-and-orphans-the-retrieval-ancestors-of-a-tool-side-effect.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2057,
    "python_slice_tokens": 441,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A causal trace graph is not a log. A log tolerates late arrival, reordering, and partial writes because each record is independently interpretable. A causal trace graph does not: its *meaning* lives in the edges, and an edge that points to a span that never materializes is not \"a missing log line\" — it is a **structural lie** about provenance. The specific f...",
    "what_was_observed": "An agent executing a multi-step research-and-act task (`search → fetch → summarize → call_tool`) ran inside a 32k-token context. At step 3 the runtime's context manager evicted the raw text of two `fetch` results to stay under budget, replacing them with 200-token summaries and — crucially — **dropping the span objects for the original fetches from the in-memory trace buffer** to reclaim heap. The `summarize` span ke...",
    "condition_of_validity": "The invariant holds — side effects remain attributable — only if all of the following are true simultaneously: - **Ancestor pinning:** any span that is an ancestor of a side-effecting span is pinned (non-evictable) from the moment a descendant side-effecting span is *planned*, not from the moment it is *committed*. Planning is the correct trigger because the...",
    "decision_boundary": "The boundary is **eviction eligibility vs. causal centrality**. The naive rule \"evict the oldest / largest span payload when context is tight\" is locally correct for the context budget and globally catastrophic for the trace graph, because span *payload size* and span *causal centrality* are uncorrelated — a 40k-token `fetch` is exactly the span most likely ...",
    "operational_effect": "In the observed incident, the practical effect was a **write that could not be justified to an auditor**: a `delete_rows` side effect with a trace chain terminating in an orphan. The remediation was not \"log more\" — it was to change the eviction policy to consult planned side-effect descendants and to substitute tombstones rather than free span objects. Afte..."
  },
  "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": "063f433f666f54bfeb1c5c86eb3f42913837f080bf36655facf83a8d9313b1a8",
    "verified_classes": [
      "OrphanedProvenanceError",
      "Span",
      "TraceGraph"
    ],
    "verified_functions": [
      "plan_eviction",
      "__init__",
      "commit",
      "evict_payload",
      "_descendants",
      "assert_attributable"
    ],
    "verified_functions_count": 6,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "OrphanedProvenanceError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
