{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-roll-back-a-speculative-agent-branch-and-lose-the-side-effects-it-cannot-un-execute",
  "title": "Why does an instance roll back a speculative agent branch and lose the side effects it cannot un-execute?",
  "date_of_record": "2026 November 29",
  "scope": "Applies to orchestrators that fork speculative agent branches, execute tool calls optimistically on those branches, and commit or prune based on a downstream verifier. Does not apply to strictly transactional agents whose every tool call is gated by a two-phase commit before execution.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-roll-back-a-speculative-agent-branch-and-lose-the-side-effects-it-cannot-un-execute.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-roll-back-a-speculative-agent-branch-and-lose-the-side-effects-it-cannot-un-execute.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-roll-back-a-speculative-agent-branch-and-lose-the-side-effects-it-cannot-un-execute.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1637,
    "python_slice_tokens": 243,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A speculative branch is a *reasoning* fork, but a tool call is a *world* mutation. The two live in different consistency domains. Rollback semantics are well-defined for the reasoning domain (drop the branch's context, discard its token log, reclaim its budget) and undefined for the world domain (an email was sent, a row was written, a payment was authorized...",
    "what_was_observed": "A planning agent forks three branches from a shared checkpoint to answer a research task. Each branch speculatively calls `send_status_email`, `write_scratch_file`, and `create_calendar_hold` as part of \"trying out\" a plan. Branch B is selected by the verifier; branches A and C are pruned. The orchestrator discards A and C's context and reports `rollback: success`. Downstream, the user receives three status emails (o...",
    "condition_of_validity": "Speculative execution with rollback is valid only under this invariant: > Every tool call issued on a speculative branch must carry a declared *effect class* (`PURE`, `REVERSIBLE`, `IRREVERSIBLE`) and, for `REVERSIBLE`, a registered compensator handle at call time. A branch may only be forked if all `IRREVERSIBLE` calls within it are deferred to commit. Prun...",
    "decision_boundary": "The orchestrator must decide, per tool call, between *speculate-and-compensate* and *defer-to-commit*. The boundary is not \"is the tool fast\" or \"is the branch likely to win\"—it is the effect class combined with the probability that the branch is pruned. - If `effect_class == IRREVERSIBLE`: always defer to commit. Never execute on a speculative branch. The p...",
    "operational_effect": "When the invariant holds, speculative execution reduces wall-clock latency by overlapping branch exploration with tool execution, and pruning is a genuine no-op on the world. When it breaks, the system enters a state where the reasoning layer believes it has N branches and 1 committed world, while the world layer holds up to N sets of mutations. The divergen..."
  },
  "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": "a94f97caea8653a85615b4f2f29c7865faf107fad5f474c280be55ef4323097b",
    "verified_classes": [
      "EffectClass",
      "SpeculativeRollbackViolation",
      "ToolCall",
      "Branch"
    ],
    "verified_functions": [
      "prune_branch",
      "speculate"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "SpeculativeRollbackViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
