{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-phantom-side-effects-during-speculative-branch-rollback-before-merge-reconciliation",
  "title": "How does an instance detect phantom side effects during speculative branch rollback before merge reconciliation",
  "date_of_record": "2026 December 1",
  "scope": "Applies to orchestrators that fork an agent state into parallel speculative branches, execute tool calls in each, then roll back losing branches and merge the winner. Does not apply to single-branch linear agents or to branches that execute in fully ephemeral, side-effect-free sandboxes with no external I/O.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-phantom-side-effects-during-speculative-branch-rollback-before-merge-reconciliation.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-phantom-side-effects-during-speculative-branch-rollback-before-merge-reconciliation.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-phantom-side-effects-during-speculative-branch-rollback-before-merge-reconciliation.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2177,
    "python_slice_tokens": 372,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Speculative parallelism assumes that a losing branch can be *undone* by discarding its state delta. This is true for the branch's internal context (message history, scratchpad, working variables) and false for anything the branch emitted into the world: a file written, a POST issued, a row inserted, a queue message published, a cache key set, a git commit pu...",
    "what_was_observed": "A planning agent forks three branches to answer \"reconcile the invoice discrepancies for account 4471.\" Branch A drafts a correction email and calls `send_email` (dry-run flag was set, but the tool implementation ignored the flag on a retry path). Branch B queries the ledger read-only. Branch C computes the corrected totals and wins the merge on a higher confidence score and a shorter trace. The orchestrator discards...",
    "condition_of_validity": "The invariant that speculative rollback requires is stronger than \"discard branch state.\" It is: > **A branch may be discarded only if every externally observable effect it produced is either (a) idempotently reversible via a compensating action recorded at emission time, or (b) fenced so that its effects are invisible until the branch is promoted to winner....",
    "decision_boundary": "The instance must decide, at branch-fork time, whether a given branch is *speculatable*. The boundary is a per-tool classification, not a per-branch one, and it must be conservative: - **Speculatable freely:** read-only tools, fenced-write tools, tools with verified idempotent inverses. - **Speculatable with journaling + compensation on rollback:** tools wit...",
    "operational_effect": "Once phantom side effects are possible, the system's observable behavior degrades in ways that mimic unrelated failures. Duplicate external actions (the double-email) look like a parent-agent reasoning bug. Held locks from rolled-back branches look like downstream timeout bugs. Staged writes that leaked into the live namespace look like data corruption with ..."
  },
  "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": "d58c31875866eb0d90827a26a32de169ce8146ddf5befffb4e948c408bbcac27",
    "verified_classes": [
      "EffectClass",
      "PhantomEffectError",
      "EffectRecord",
      "Branch"
    ],
    "verified_functions": [
      "plan_speculation",
      "reconcile_effects"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "PhantomEffectError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
