{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-speculative-branch-divergence-when-a-cached-tool-call-result-is-replayed-under-a-mutated-argument-hash",
  "title": "How does an instance detect speculative branch divergence when a cached tool-call result is replayed under a mutated argument hash",
  "date_of_record": "2026 November 24",
  "scope": "Applies to multi-agent orchestrators that fork speculative execution branches, memoize tool-call results keyed by a canonicalized argument hash, and roll back losing branches on verification. Does not apply to single-branch sequential agents, nor to caches keyed on full conversation/trajectory digests (which are inherently branch-local).",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-speculative-branch-divergence-when-a-cached-tool-call-result-is-replayed-under-a-mutated-argument-hash.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-speculative-branch-divergence-when-a-cached-tool-call-result-is-replayed-under-a-mutated-argument-hash.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-speculative-branch-divergence-when-a-cached-tool-call-result-is-replayed-under-a-mutated-argument-hash.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1447,
    "python_slice_tokens": 224,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"stale cache\" in the ordinary sense. It is a **collision between speculative branch isolation and content-addressed memoization**. When an orchestrator forks N speculative branches from a shared checkpoint, each branch may issue tool calls whose arguments are *semantically identical but structurally divergent* — differing in whitespace, ke...",
    "what_was_observed": "A three-way speculative planner forked at step 7 of a data-migration task. Branch A proposed `apply_schema(target=\"prod\", mode=\"dry_run\")`; Branch B proposed `apply_schema(target=\"prod\", mode=\"dry-run\")`. The canonicalizer lowercased and stripped non-alphanumerics from string values, so both hashed to `apply_schema|prod|dryrun`. Branch A executed first (cache miss), the tool returned `{\"status\":\"ok\",\"changes\":0}` bec...",
    "condition_of_validity": "The safe-replay invariant holds only if **all three** of the following are true: 1. The cache key is computed by the *same* function the branch uses to record its own argument identity, so a hit is provably a hit on the branch's exact bytes. 2. The tool is referentially transparent under whatever normalization the key applies — i.e., `f(normalize(x)) == f(x)...",
    "decision_boundary": "The instance must treat a cache hit as **untrusted** — equivalent to a tool result with unknown provenance — whenever the branch's own recorded argument hash differs from the cache's key hash, *or* whenever the cache entry's `branch_id` is not in the current live branch set, *or* whenever the entry's `generation` predates the most recent rollback epoch. In a...",
    "operational_effect": "Enforcing the invariant converts a silent correctness bug into a bounded latency cost: speculative branches that would have shared a cache entry now re-execute, and the orchestrator's cache hit-rate drops (observed ~18% in the migration workload). The trade is correct: the verifier now sees branch-local observations, so its ranking reflects actual tool behav..."
  },
  "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": "684173fdb01e42d89f40f48701fc110a5769b2982dca8785ff2479f67fefcba3",
    "verified_classes": [
      "SpeculativeCacheDivergence"
    ],
    "verified_functions": [
      "resolve_tool_call"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "SpeculativeCacheDivergence"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
