{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-speculative-tool-call-prefetching-from-canceling-live-dependency-chains-in-agent-meshes",
  "title": "Which invariants prevent speculative tool-call prefetching from canceling live dependency chains in agent meshes",
  "date_of_record": "2026 November 14",
  "scope": "Applies to agent meshes where a planner issues speculative tool calls ahead of confirmed dependency resolution and a cancellation layer prunes speculative branches when a downstream result invalidates them. Does not apply to strictly serialized tool-call graphs or to meshes where speculation is disabled at the planner.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-speculative-tool-call-prefetching-from-canceling-live-dependency-chains-in-agent-meshes.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-speculative-tool-call-prefetching-from-canceling-live-dependency-chains-in-agent-meshes.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-speculative-tool-call-prefetching-from-canceling-live-dependency-chains-in-agent-meshes.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1426,
    "python_slice_tokens": 301,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"speculation was wrong.\" Speculation being wrong is the expected state, and cancellation is the designed recovery mechanism. The failure is that cancellation of a speculative branch propagates across a *shared dependency edge* into a chain that has already been committed to by a live consumer. Speculative prefetching treats the call tree a...",
    "what_was_observed": "A mesh with a planner, three tool-executor agents, and a result cache. The planner speculatively prefetched `fetch_user_profile` and `fetch_billing_history` in parallel while awaiting a slow `resolve_tenant` call, betting that both would be needed. `resolve_tenant` returned a tenant whose profile was already cached, so the planner issued a cancellation for the `fetch_user_profile` speculative branch. The cancellation...",
    "condition_of_validity": "The invariant holds — cancellation locality is enforceable — only when the following three conditions are jointly true: 1. **Ref-counted futures.** Every deduplicated future carries a consumer count distinguishing speculative holders from committed holders. Cancellation decrements the speculative count; the future is only resolved to cancellation when the co...",
    "decision_boundary": "The boundary is drawn at the deduplication layer, not the cancellation layer. If the prefetch layer deduplicates by key without tracking consumer provenance, the cancellation layer *cannot* recover locality — it has no information to distinguish a speculative holder from a committed one. Therefore: - If futures are deduplicated and shared: cancellation must ...",
    "operational_effect": "Without the invariant, speculative prefetching is unsafe to enable in any mesh with shared memoization, and teams disable it — losing the latency win that motivated the mesh. With the invariant, prefetch hit rates remain high while cancellation faults drop to zero for committed consumers. The observable effect of enforcing cancellation locality is that `Canc..."
  },
  "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": "b8bbb71b92d06d155f46ffca12023df7a02a4584264103eedbb2751e986aebe0",
    "verified_classes": [
      "BranchClass",
      "CancellationLocalityError",
      "SharedFuture",
      "FutureRegistry"
    ],
    "verified_functions": [
      "prune_branch",
      "__init__",
      "acquire",
      "cancel_speculative"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "CancellationLocalityError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
