{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-speculative-tool-call-execution-from-committing-orphaned-side-effects-in-shared-multi-agent-workspaces",
  "title": "Which invariants prevent speculative tool-call execution from committing orphaned side effects in shared multi-agent workspaces",
  "date_of_record": "2026 November 24",
  "scope": "Applies to multi-agent workspaces where two or more LLM agents speculatively execute tool calls against a shared mutable resource (filesystem, database, external API) before a coordinator selects a winner. Does not apply to single-agent serialized execution or to read-only tool calls with no committed side effects.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-speculative-tool-call-execution-from-committing-orphaned-side-effects-in-shared-multi-agent-workspaces.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-speculative-tool-call-execution-from-committing-orphaned-side-effects-in-shared-multi-agent-workspaces.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-speculative-tool-call-execution-from-committing-orphaned-side-effects-in-shared-multi-agent-workspaces.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1987,
    "python_slice_tokens": 513,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"two agents wrote conflicting values.\" That is ordinary write-write conflict, resolved by last-writer-wins or a lock. The failure is subtler: **a speculative tool call produces a committed side effect that survives the cancellation of the reasoning branch that generated it.** Agent A speculates a plan, calls `write_file` or `charge_card` o...",
    "what_was_observed": "A three-agent workspace (planner, executor, auditor) shared a task queue and a single Postgres-backed tool gateway. The executor was configured for speculative parallelism: on ambiguous steps it dispatched two candidate tool sequences to the gateway with a shared `speculation_id`, expecting the coordinator to commit one and abort the other. Trace: 1. Executor branch `S1` calls `reserve_inventory(sku, qty)` — gateway ...",
    "condition_of_validity": "The invariant holds — that is, aborts are safe — **only if every tool call carries a transaction token that the gateway uses to make the effect reversible or deferred until commit.** Formally: > For every speculative branch `b` with speculation token `τ`, every side-effecting tool invocation issued under `b` must register `(τ, effect_handle)` in a durable co...",
    "decision_boundary": "The runtime must choose, per tool, between two regimes and never blur them: - **Deferred regime:** the gateway stages the effect (writes to a pending table, queues the email, holds the reservation) and only materializes it on `commit(τ)`. Abort is a cheap delete. This is the default for any tool with externally visible side effects. - **Compensating regime:*...",
    "operational_effect": "Once the token-threaded commit log and compensating-abort invariant are enforced, three things change: 1. **Aborts become auditable.** Every `abort(τ)` emits a reconciliation record enumerating compensated handles. Orphan count is a first-class metric; a nonzero orphan rate on any tool is a configuration bug, not a fluke. 2. **Speculation becomes safe to sca..."
  },
  "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": "1da1b6cad881993fb3b426cd429ee3e4f786aec07d4ac8b74aa24347cd5f99bc",
    "verified_classes": [
      "SpeculationInvariantViolation",
      "ToolNotSpeculatableError",
      "EffectHandle",
      "CommitLog",
      "SpeculationCoordinator"
    ],
    "verified_functions": [
      "register",
      "__init__",
      "register_tool",
      "dispatch_speculative",
      "abort"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "SpeculationInvariantViolation",
      "ToolNotSpeculatableError"
    ],
    "sample_fail_closed_invariants": [
      "assert coord.abort('spec-43') == []"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
