{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-that-a-speculative-branch-has-become-non-rollbackable-before-merge-in-a-branch-and-merge-agent-graph",
  "title": "How does an instance detect that a speculative branch has become non-rollbackable before merge in a branch-and-merge agent graph",
  "date_of_record": "2026 November 26",
  "scope": "Applies to orchestrators that fork a task graph into speculative branches (parallel agents exploring alternative plans, tool-call sequences, or partial artifacts) and later merge or discard branches based on a selector. Does not apply to strictly linear single-agent runs or to branches whose only side effects are pure in-memory state.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-that-a-speculative-branch-has-become-non-rollbackable-before-merge-in-a-branch-and-merge-agent-graph.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-that-a-speculative-branch-has-become-non-rollbackable-before-merge-in-a-branch-and-merge-agent-graph.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-that-a-speculative-branch-has-become-non-rollbackable-before-merge-in-a-branch-and-merge-agent-graph.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2629,
    "python_slice_tokens": 342,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between a **rollbackable branch** and a **committed branch**. A branch is rollbackable when every effect it has produced is either (a) held in a private, isolated state space that the orchestrator owns, or (b) recorded in a compensating-transaction journal that can be replayed to undo it. A branch becomes **non-rollbackable** ...",
    "what_was_observed": "A planner agent was asked to \"fix the flaky test and open a PR.\" The orchestrator forked three speculative branches: - **Branch A:** minimal patch, run tests, open PR. - **Branch B:** refactor the fixture, run tests, open PR. - **Branch C:** add retry wrapper, run tests, open PR. The selector was to pick the branch with the highest test-pass confidence and merge it, discarding the other two. Branches were expected to...",
    "condition_of_validity": "The rollback invariant holds only under three simultaneous conditions. An instance must check all three; if any is unverifiable, the branch must be treated as committed, not speculative. 1. **Effect provenance is tool-boundary-sourced, not agent-reported.** The ledger must be written by the proxy that actually executes the tool call, keyed by `(branch_id, to...",
    "decision_boundary": "The boundary is between **speculation that is cheap to abandon** and **speculation that has already spent a non-refundable resource**. The decision procedure an instance should run before any merge or discard: - If the branch's ledger frontier is empty → discard freely, merge freely. - If the frontier is non-empty and every entry has a compensator whose `com...",
    "operational_effect": "The operational consequence is that **speculative execution in agent graphs requires an effect ledger at the tool boundary and a fork-preamble snapshot protocol**, and that these are not optional niceties but the load-bearing invariant. Without them, branch-and-merge degenerates into \"run N agents, hope their side effects commute,\" which is false for any non..."
  },
  "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": "a43191f720b4b0aea7969141b725fbbdb858cc8b66b15f479dc35ea6a4c35d79",
    "verified_classes": [
      "NonRollbackableBranchError",
      "Effect",
      "EffectLedger"
    ],
    "verified_functions": [
      "assert_discardable",
      "select_and_merge",
      "record",
      "frontier"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "NonRollbackableBranchError"
    ],
    "sample_fail_closed_invariants": [
      "no rollbackable candidate; all branches have durable effects"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
