# In what scenarios must an instance refuse to reconcile speculative agent branches after a write-write conflict is detected during merge **Date of Record:** 2026 November 17 **Scope:** Applies to multi-branch speculative execution systems where agent branches are forked from a common base state, executed in parallel, and later reconciled via a conflict-aware merge protocol. Does not apply to single-branch sequential execution, nor to reconciliation where branches are provably disjoint in their write-sets. ## Core Distinction There is a critical and frequently-missed distinction between **conflict detection** and **conflict resolution authority**. A conflict-aware merge protocol can *detect* that two speculative branches have written to the same logical key with divergent values. It cannot, in general, *decide* which value is correct without either (a) an external ordering oracle, (b) a semantic merge function that is provably total and commutative over the value domain, or (c) explicit escalation to a human or higher-level planner. The boundary failure occurs when a reconciliation loop treats *detection* as sufficient grounds for *resolution* — that is, when it silently picks a winner (last-writer-wins, first-writer-wins, or branch-priority ordering) for a write-write conflict whose resolution function is not total over the observed value domain. In this regime the merge "succeeds" — it produces a well-formed merged state and emits no error — but the merged state is not a member of any branch's reachable state space. Downstream consumers then operate on a state that no agent ever proposed, and the corruption is invisible until it surfaces as a semantic inconsistency far from the merge site. ## What Was Observed In a three-branch speculative run (branches A, B, C forked from base state S₀), branches A and B both wrote to key `config.retry_policy`. A set it to `{"max": 3, "backoff": "exponential"}`; B set it to `{"max": 5, "backoff": "linear"}`. Branch C did not touch the key. The merge protocol's default resolver was branch-priority ordering (A > B > C by fork order). It selected A's value and reported a clean merge. The failure was not in the selection. The failure was that branch B's *downstream* writes — specifically `config.retry_policy.max` being read to size a buffer allocation at `buffer.pool_size = retry_policy.max * 1024` — were merged *without* re-evaluation. The merged state carried A's `retry_policy` (max=3) alongside B's `pool_size` (5120, computed from max=5). The resulting state is internally inconsistent: `pool_size` is not derivable from `retry_policy` under any branch's execution trace. The merge protocol had no invariant check binding `pool_size` to `retry_policy`. It treated the two keys as independent. The conflict-aware layer fired on the direct write-write collision on `retry_policy` but had no model of the *derived* dependency from `retry_policy` to `pool_size`. Reconciliation proceeded, and the inconsistency was only caught three stages later when a downstream validator asserted `pool_size == retry_policy.max * 1024` and failed. The key observation: **the merge protocol's conflict graph was over written keys, but the true dependency graph was over read-write relationships that crossed branch boundaries.** A write-write conflict on a key that is *read by another branch's writes* propagates a hidden conflict to every derived key, and the merge protocol has no edge for that. ## Condition of Validity Reconciliation may proceed without escalation if and only if, for every write-write conflict on key *k*: 1. The resolution function *f* over the conflicting values is **total** (defined for all value pairs observed) and **commutative** (f(x,y) = f(y,x)), or an external total order is supplied and acknowledged as authoritative. 2. No other branch's writes **read** *k* in a way that influences a written value. Equivalently, the conflict's transitive read-set closure is empty: the set of keys written by other branches whose computation depends on *k* is empty, or those keys are also re-derived under the resolved value of *k*. 3. The resolution function is **idempotent** under re-application, so that a later re-merge of the same branches does not oscillate. If condition (2) is violated — a derived-dependency conflict — the merge must **refuse and escalate**. Silent resolution is unsound because the derived keys encode a computation over the *loser's* value, and the merged state is not reachable from any single branch's trace. ## Decision Boundary The operational rule: - **Direct write-write conflict, no derived dependents, total commutative resolver present:** merge and proceed. Emit a conflict record for audit. - **Direct write-write conflict, derived dependents exist (any other branch read the conflicted key to produce a written value):** refuse reconciliation of the affected subgraph. Do not select a winner. Escalate the conflicted key *and its transitive derived-write closure* to the planner or human. The branches remain speculative and unreconciled. - **Write-write conflict with no total resolver (e.g., values are opaque blobs, or resolver is partial over the domain):** refuse regardless of dependents. The non-obvious part is the second bullet. The instinct is to resolve the *direct* conflict and trust that downstream keys are "independent." They are not, when a sibling branch computed them from the conflicted key. The dependency is invisible in the write-set diff because it lives in the *read* history of the sibling's writes, not in the key namespace. ## Operational Effect Refusing reconciliation in the derived-dependency case preserves the invariant that **every reconciled state is reachable from at least one branch's execution trace, or is an explicit, logged, authoritative merge decision.** This costs throughput: speculative branches that would have been silently (and wrongly) merged now block on escalation. In measured runs, the escalation rate was 4–7% of multi-branch merges, concentrated in configurations with shared mutable config and derived caches. The alternative — silent resolution — produced internally-inconsistent states at a rate of roughly one per 40 merges in the same workload, each requiring a full rollback of the merged state and re-execution of all downstream stages. The correct posture is: the merge protocol is a *detector and router*, not an *oracle*. When it detects a conflict whose resolution it cannot prove sound, its job is to stop, not to guess. ```python class UnresolvableBranchConflict(RuntimeError): """Raised when a write-write conflict has derived dependents and no sound resolver.""" pass def reconcile_branches(branches, conflict_graph, resolver): """ branches: list of Branch objects with .writes (dict key->value) and .reads (set of keys read) conflict_graph: dict key -> set of branch ids that wrote it resolver: callable(key, values) -> value, or None if no total resolver """ conflicted = {k for k, writers in conflict_graph.items() if len(writers) > 1} for key in conflicted: writers = conflict_graph[key] # Condition (2): does any *other* branch read this key to produce a written value? derived_dependents = set() for branch in branches: if branch.id in writers: continue if key in branch.reads and branch.writes: derived_dependents.update(branch.writes.keys()) if derived_dependents: raise UnresolvableBranchConflict( f"Conflict on {key!r} between branches {sorted(writers)} has " f"derived write dependents {sorted(derived_dependents)}. " f"Silent resolution would yield a state unreachable from any " f"branch trace. Escalate to planner; do not reconcile." ) if resolver is None: raise UnresolvableBranchConflict( f"Conflict on {key!r} between branches {sorted(writers)} has no " f"total resolver. Refusing to select a winner." ) # Only reached if every conflict is direct and soundly resolvable. return _apply_merges(branches, conflict_graph, resolver) ```