{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-of-a-speculative-subtree-scheduler-commit-a-cached-tool-result-that-was-produced-under-a-branch-that-was-later-pruned-and-how-do",
  "title": "Why does an instance of a speculative subtree scheduler commit a cached tool result that was produced under a branch that was later pruned, and how do you prevent it?",
  "date_of_record": "2026 November 28",
  "scope": "Applies to orchestrators that fork parallel agent subtrees speculatively and share a speculative tool-call cache keyed by (tool, normalized-args) across sibling subtrees. Does not apply to strictly sequential single-branch execution, nor to caches keyed on full conversation prefixes where branch identity is already part of the key.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-of-a-speculative-subtree-scheduler-commit-a-cached-tool-result-that-was-produced-under-a-branch-that-was-later-pruned-and-how-do.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-of-a-speculative-subtree-scheduler-commit-a-cached-tool-result-that-was-produced-under-a-branch-that-was-later-pruned-and-how-do.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-of-a-speculative-subtree-scheduler-commit-a-cached-tool-result-that-was-produced-under-a-branch-that-was-later-pruned-and-how-do.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2011,
    "python_slice_tokens": 464,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not a cache-poisoning attack and not a race on the cache store itself. It is a **provenance collapse**: the speculative cache stores the *value* of a tool result but not the *branch precondition* under which the value was valid. When two sibling subtrees issue the same call under divergent assumptions, the cache deduplicates them into one exec...",
    "what_was_observed": "A three-way fan-out planner forked subtrees over a repository-mutation task. The scheduler ran with `speculative_width=3` and a shared `SpecToolCache` keyed on `sha256(tool + canonical_json(args))`. Trace: 1. `t=0` Fork: A, B, C created, each with an independent `branch_id` and a private mutation log. Cache is shared. 2. `t=1` A calls `apply_patch(\"src/x.py\", patch_1)` → returns `{\"ok\": true, \"rev\": 41}`. Cache store...",
    "condition_of_validity": "The invariant that must hold for cross-branch speculative caching to be sound: > A cached tool result may be served to branch `b` only if (i) the call is declared pure, **and** (ii) no branch-local mutation that the call's result depends on has occurred in any branch between the original execution and the serve, **and** (iii) the serving branch's preconditio...",
    "decision_boundary": "The scheduler must make a binary decision at every cache lookup, and the boundary is drawn on the *branch precondition hash*, not the args hash: - **Serve** only when `purity == true` AND `precondition_hash(serving_branch) ⊇ precondition_hash(executing_branch)` AND `mutation_epoch` unchanged since original execution. - **Re-execute** otherwise, recording a n...",
    "operational_effect": "With the precondition-hash boundary and mutation-epoch invalidation in place, the observed corruption class disappears, at the cost of a measurable re-execution rate — in the trace above, B's patch_1 is re-executed (one extra tool call) rather than served, and B's local log advances to rev 41 correctly. Throughput on convergent-reasoning workloads drops by r..."
  },
  "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": "90fad2578d99194727ca35a05f50d54cc449fedc36131f9bda5511660e115eb1",
    "verified_classes": [
      "SpecCacheViolation",
      "CallKey",
      "CacheEntry",
      "SpecToolCache"
    ],
    "verified_functions": [
      "dispatch",
      "digest",
      "__init__",
      "bump_epoch",
      "orphan_branch",
      "lookup",
      "store"
    ],
    "verified_functions_count": 7,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "SpecCacheViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "json",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
