Merging Parallel Work and Resolving Disagreement
Compare one, two and four agents at matched total budgets; inject conflicting findings and edits.
Two bounded investigators, delegated under Chapter 19’s contract, come back
with incompatible answers about the same fixture. Investigator A reports:
“The retry limit is enforced in execute_with_retry.” Investigator B
reports: “No code reads max_attempts; only comments and the API notes
mention it.” At the same time, two editing children, each asked to “make
retries respect the configured limit”, return patches that both rewrite
lines 13–16 of worker (the body of the function starting at line 12), in different ways. Each patch passes the test
suite on its own.
The parent now has three problems that look similar and are not. It has contradictory findings: one is right and one is wrong, or the question is ill-posed. It has conflicting edits: they cannot both be applied as written, and even edits that can both be applied may be wrong together. And it has whatever duplicated work the investigators did reading the same files. A harness that merges by asking a model to “reconcile these results” will produce one fluent answer, and will lose the information needed to tell which of the three problems it solved.
This chapter separates the three, assigns each an owner and an arbitration rule, and sets up Project 08’s central measurement: whether more agents actually help when the total budget is held fixed.
Evidence status. Draft manuscript. Formal Project 08 (Investigation Team) has not started. The educational merge demonstration D20-MERGE-01 is implemented and executed (
examples/pi-harness-lab/src/merge.ts;test/merge.test.ts, 15/15 pass offline, including a file-backed parent-acceptance scenario run through the D06 edit gate). Nothing in this book’s code runs more than one live agent; children are scripted. Project 01 is REJECTED (REVIEW-02). The fixture facts used in the example are OBSERVED in the Project 01 fixture source. External multi-agent research is DOCUMENTED (verified) and not replicated. The matched-budget comparison (Project 08 study) is PROPOSED and remains EXPERIMENT PENDING; budget figures below are the study’s registered design, with their workings shown.
20.1 Three merge problems
| Problem | What collides | Correct output | Arbitration basis |
|---|---|---|---|
| Findings | Claims about the same subject | The supported claim, or an explicit REVIEW or UNKNOWN |
Evidence (provenance and support, Chapter 8) |
| Edits | Changes to the same artifact | A single change set, verified as a whole | Deterministic merge rules, then verification of the combination |
| Duplicated effort | Work done more than once | Nothing to choose. The cost is recorded | Accounting, against the evidence store |
The rows need different machinery because they fail differently. A finding merged wrongly produces a confident false claim. An edit merged wrongly produces broken or subtly wrong code. Duplication merged wrongly produces nothing visible at all, only a larger bill. That is why it is the one most often ignored.
20.2 Merging findings: evidence, not votes
The tempting arbitration for contradictory findings is majority vote. Run more agents, and take what most of them say. Two properties of agent teams make votes weak evidence.
Copies are not independent witnesses. Agents built on the same model, given similar contexts, make correlated mistakes. Three copies agreeing is much less than three independent confirmations. It may be one error sampled three times. Chapter 15’s caution about model judges evaluating outputs from their own family applies here in a sharper form.
Votes discard the reason. A 2–1 vote records that two agents believed something. It does not record why, and the “why” is what allows the parent to check it. The parent cannot tell a well-cited minority from a plausible but unsupported majority.
The alternative is to arbitrate findings with the machinery the book has already built. Each finding is a claim with citations (Chapter 8). For two contradictory claims about the same subject, the parent resolves each claim’s citations to recorded evidence and checks its support. There are four possible results:
- One claim supported, the other not. Accept the supported claim. Record the other as rejected, with the reason.
- Both supported. The evidence itself conflicts, or the claims answer
different questions. The result is
REVIEW, not a coin toss. This is the T4 situation from Chapter 5: a fixture whose comment says “handles” and whose code does not. Two honest investigators can cite real lines for opposite conclusions. - Neither supported.
UNKNOWN. The investigation must be redone or escalated. It cannot be averaged. - Support depends on judgment beyond the deterministic checks, for example semantic entailment. Route the claims to the evaluator that has precedence for that property (Chapter 15 §15.3).
Contradiction detection must come first, and it is easy to get wrong.
Two claims contradict only if they are about the same subject and assign
incompatible values. Detecting that requires claims to be structured
enough to compare: a subject (for example “the code location that enforces
max_attempts”) and a value. Free prose rarely is. A practical harness
asks delegated investigators for a typed deliverable (Chapter 19 §19.2)
whose claims have explicit subjects and search scope: fixture/repository
digest or commit, included files and exclusions, method, coverage and
limitations. An absence claim quantifies only over that scope. Compare
scopes and quantifiers before declaring a contradiction: a complete read
of six fixture files says nothing about a seventh file in a real repository.
Different versions or incomplete coverage may make claims incomparable. Prose claims that the harness cannot
match by subject are not merged. They are presented side by side, with
their evidence, for adjudication.
20.3 Merging edits: preconditions, then composition
Edit merging has a deterministic core that version control has refined for decades. Two changes made against a common base can be combined by a three-way merge that compares each with the base. Changes to non-overlapping regions combine mechanically. Overlapping changes are a textual conflict, which must be resolved by a decision.
Chapter 6 supplies the harness-specific part. Every proposed edit carries
the base digest it was computed against. When two parallel editors propose
changes to the same file, the first to apply changes the file’s digest.
The second edit’s precondition is then stale, and the effect boundary
refuses it with STALE_BASE (Chapter 6 §6.7). That refusal is correct. The
open question is what happens next, and there are three options.
- Rebase mechanically when the hunks do not overlap: apply the second edit’s hunks to the new base by three-way merge, and record that this was done.
- Re-propose when they overlap: return the conflict, with both versions and the new base, to an agent (or a human) to produce a resolution, which is itself a new edit with a new base digest.
- Choose one when the edits are alternatives rather than complements, as in the opening example, where both children attempted the same fix. Choosing between alternatives is an evaluation question. Apply the registered candidate-selection checks separately and keep the passing candidate, or both for review. In a comparative study these checks are distinct from the sealed final assessment oracle (§20.5).
Mechanical success is not semantic success. Two edits that touch different lines can each pass the tests alone and fail together: one changes a function’s contract, and the other adds a caller relying on the old one. So the merged result must pass the same verification gate as a single patch (Chapter 14’s verified-patch record), run on the combined change set. A merge that skips this gate trusts each part’s evidence for a whole that was never tested.
20.4 A shared evidence store, not a shared mind
Parallel agents benefit from seeing each other’s evidence. If
investigator A has read worker lines 12–16 and recorded the result with
its digest, investigator B’s claim can cite that record without reading
the file again. When B reads it anyway, the duplicate is detectable,
because both reads produce the same content digest and the same declared operation/coverage scope.
Content equality alone can reflect legitimate repeated checks after a
state change, so the duplication metric must register which immutable
source identity and tool operation count as the same work.
This suggests a shared evidence store (PROPOSED): append-only,
written only by tools and runners (never by models), with records
addressed by content digest and carrying provenance (which agent’s tool
call produced them, under which run). The store is the “shared evidence”
row of Chapter 19’s table. What it must not become is a shared store of
beliefs, a blackboard where agents post conclusions for others to
build on. Conclusions posted there acquire an authority they have not
earned. A second agent that reads “the limit is enforced in
execute_with_retry” on a shared board is likely to cite it as if it were
evidence. If agents exchange claims at all, the claims carry their
citations, and a consumer resolves those citations against the evidence
store before relying on them.
The host authenticates tool/runner writers and keeps the append-only sink outside every agent’s write authority, including filesystem and alternate API routes. Agents may submit proposals to a separate untrusted area; they cannot write trusted receipts or promote claims. Admission checks writer identity, run/operation binding, artifact digest and evidence scope. Only the named evaluator can append a scoped verification decision, under Chapter 15’s precedence rules. A digest proves content identity, not who observed it or whether it is true. If the worker can change the runner, evaluator or sink, this boundary has not been established.
The store also gives duplicated effort a measure. The share of tool results whose digest was already in the store when they were produced is the team’s duplication fraction. It is cheap to derive once these records exist, and it is one of Project 08’s endpoints.
20.5 Matched total budget, and what more agents can buy
The blueprint requires Project 08 to compare one, two and four agents at matched total budgets, and requires all later coordination projects to do the same (blueprint, project table). The reason is Chapter 1’s budget illusion. Four agents with four budgets will often beat one agent with one budget, and that shows only that more spending helps.
At a fixed total, adding agents redistributes budget. With B total, a merge reserve R (merging, arbitration and final verification are not free), and k agents splitting the rest equally, each agent gets (B − R) / k. Hypothetical, with B = 120,000 tokens and R = 20,000:
k = 1: 100,000 per agent · k = 2: 50,000 each · k = 4: 25,000 each.
For the proposed E20 design, fix R = 20,000 in every arm, including single-agent and best-of-four. It covers candidate verification/selection, coordination, arbitration, merging and final validation. Each BoN attempt gets (120,000 − 20,000)/4 = 25,000, not 120,000. No attempt inherits another’s unused share in this design. Unused reserve is not transferred to generation. If reserve runs out, the arm stops incomplete and is still counted. This equal ceiling is a declared comparison policy, not a claim that overhead is equal or that the allocation is optimal.
Calibrate adequacy on development tasks only, then freeze the reserve before confirmation; any change creates a new registered study. A sensitivity analysis, if desired, registers every reserve value and contrast before any held-out result. Report actual overhead and unused capacity per arm, not just allocated ceilings. Model calls, tools, retries and validators all count; tool-call and time ceilings form a separately registered resource vector with the same allocation policy. Paid/non-token work needs its own cost ledger: token matching alone is not monetary matching.
What can a team buy with a quarter of the budget each? Two plausible things. Coverage: different agents explore different parts of a large search space. Diversity: independent attempts make different mistakes, so a verifier can choose the best. There are two plausible costs. Depth: each agent may run out of budget before finishing a sub-task that a single agent would have completed. Coordination overhead: merging, contradiction handling and duplicated reading.
The diversity benefit has a well-known cheaper competitor. A single agent sampled in separate requests (registered seeds where supported, otherwise repetition IDs), with a verifier choosing among the results (“best-of-N”), buys diversity without any coordination machinery. The MAST project, from Berkeley researchers who studied failures across multi-agent frameworks, describes multi-agent performance gains as often minimal compared with single-agent frameworks or simple baselines like best-of-N sampling (Cemri et al., “Why Do Multi-Agent LLM Systems Fail?”, arXiv:2503.13657; project page sky.cs.berkeley.edu/project/mast; DOCUMENTED). In its latest version, their taxonomy organizes 14 failure modes into three categories: system design issues, inter-agent misalignment and task verification. This book does not replicate their measurements, and their framework counts changed between paper versions, so none is quoted. What the book takes from them is a control. A Project 08 study that does not include a best-of-N arm at the same budget cannot say whether the team helped or merely the sampling. The broader question of when teams are worse than single agents belongs to Chapter 24, and is deliberately not settled here.
Selection and final evaluation have different jobs. The candidate verifier may select a BoN answer or arbitrate a team’s claims; the sealed final oracle evaluates the selected result and is unavailable for candidate search. Record both identities, versions, prompts/test procedures, sources and cost. Verifiers sharing a model, training data, prompt, source corpus or assumptions can repeat the candidates’ error. Another provider is not proof of independence. Prefer deterministic checks for covered properties, calibrate semantic judges on development labels, disclose shared axes and measure common misses. Charge selection verification and final validation inside R in every arm; no unpriced panel or extra oracle attempts.
20.6 Ownership
| Mechanism | Owner | Requires | May decide | Must not |
|---|---|---|---|---|
| Contradiction detection | Host | Typed claims with subjects | That two claims conflict | Infer conflicts from free prose and silently merge |
| Finding arbitration | Parent-side evaluator | Resolved citations; support checks | Accept, reject, REVIEW, UNKNOWN |
Use vote counts as evidence |
| Edit merge | Host merge step plus effect boundary | Base digests; three-way merge | Rebase non-overlapping hunks; refuse overlaps | Apply a stale edit; skip combined verification |
| Alternative selection | Selection evaluator | Registered candidate-check results | Keep passing candidate(s) | Choose by confidence or search against the study’s final oracle |
| Evidence store | Host, written by tools and runners | Content digests; provenance | Deduplicate; serve citations | Accept model-written “evidence” |
| Budget split | Host ledger (Chapter 19) | Total, merge reserve, k | Allocate and reserve shares | Grant extra budget to larger teams |
The bookkeeping and precondition checks are deterministic. Finding arbitration and alternative selection can require semantic judgment, under Chapter 15’s precedence and calibration rules. A model can propose a merge resolution for overlapping edits. Accepting it is the verification gate’s job.
The final assessment oracle MUST remain unavailable to candidate selection in every arm. Register separate candidate-check and final-oracle identities before execution; repeated selection tests never count as fresh final assessment evidence.
20.7 Worked example: the opening, resolved
This section is an executed educational demonstration, D20-MERGE-01
(test/merge.test.ts, 15/15 pass offline). Findings are arbitrated by
citation resolution against parent-held evidence; edits by base
preconditions and overlap rules; duplication by digest comparison.
Fixture facts are real; the investigators are scripted.
Findings. Both investigators return typed claims about the subject
“code location that enforces max_attempts”.
- Investigator A cites
workerlines 12–16. The parent resolves the citation against the evidence store: the record exists, with a matching digest. The support check asks whether lines 12–16 readmax_attemptsor loop a bounded number of times. They do not. They callrunonce, catch any exception, and raiseRetryExhausted. A’s claim is unsupported. - Investigator B claims that no code location reads
max_attempts, and cites the full catalogue plus a recorded full-range read of every file in it. An absence claim is supported only within its declared search scope (Chapter 3’s oracle discipline). B’s receipt names therepo-scout-v1fixture digest, catalogue and all six file IDs, full-range read coverage, and an inspection method that distinguishes declarations/comments from executable uses. The claim is limited to those admitted files, not generated or external dependencies. B’s reads cover all six files of the fixture. In none of them does code readmax_attempts; it appears only in the configuration, in comments and in prose. So within that scope B’s claim is supported. - Result: accept B and reject A, with the reason. The parent also records
the fixture’s comment-versus-code discrepancy as a finding in its own
right. Two investigators disagreeing about it is evidence that the
documentation misleads, which is worth recording. The arbitration rule
above — supported beats unsupported, both-supported escalates to
REVIEW, neither-supported escalates asUNKNOWN, votes decide nothing — is executed inmerge()(D20 suite: one supported claim accepted over two unsupported rivals; a two-vote “majority” for an unsupported value still escalates; both-supported escalates).
The receipt’s field names above specify the proposed evidence contract; no executed absence-inspection receipt is quoted. A future result must publish or provide controlled access to its actual digest, file IDs, coverage and validated inspection-method identity before claiming support.
Edits. The refusal half of this narrative is executed: a patch
computed against a moved base is refused without silent rebasing, and
overlapping hunks produce CONFLICT with nothing applied (D20 suite and
the file-backed scenario, which also verifies that conflicting files are
byte-identical afterwards). Disjoint accepted edits apply through the
D06 edit gate with fresh preconditions, and the final files are verified.
What is not executed here is the candidate-selection machinery of the
second half below — sealed FAIL_TO_PASS/PASS_TO_PASS runs in an isolated
runner, reverts as journaled compensating operations. That belongs to
the formal study, with Projects 05 and 06 as prerequisites:
Editor 1 computed its patch against base digest D0 and
applies first. The file is now D1. Editor 2’s patch, also computed
against D0, is refused with STALE_BASE. Its hunks overlap Editor 1’s
(both rewrite lines 13–16), so mechanical rebase is not allowed. Both
patches were alternatives: each implements a bounded retry loop. So the
parent treats them as candidates rather than merging them. It verifies
each separately, against D0, in the isolated runner (Chapter 12), using
the sealed FAIL_TO_PASS and PASS_TO_PASS candidate-gate tests (Chapter 14).
They are hidden from the editing agents, but are not E20’s independent
final assessment oracle: repeated selection cannot consume that oracle.
Suppose Editor
1’s patch retries on every exception, and Editor 2’s only on a transient
error class. The sealed tests include a permanent-failure case (the gap
found by a human in Chapter 15 §15.7), so only Editor 2’s patch passes.
Editor 1’s applied change is reverted as a compensating operation, which is
itself journaled and verified. Editor 2’s patch is applied against D0
with a fresh precondition check.
Duplication. Both investigators read worker lines 12–16. The second
read’s digest matched the store, so it is counted as duplicated effort:
the illustrated repeated read. No complete eleven-result transcript or
duplication ratio is asserted by this walk-through. The digest-comparison
half — identical evidence recognized across bundles — is executed in
merge() (identical duplicates merge once); store-wide duplication
fractions remain a Project 08 endpoint.
Nothing in the executed resolution consulted a vote, an agent’s self-reported confidence, or a model asked to reconcile. Every decision was made by resolving citations, checking support, comparing digests, or refusing to guess. The sealed-test runs described above are not executed here; the demonstration stops at the gate and records what the gate decided.
20.8 Project 08 checkpoint: Investigation Team
Blueprint requirement: parallelize a complex code or research task. The new mechanisms are scoped delegation, role assignment, merge arbitration and shared evidence. The verification compares 1, 2 and 4 agents at matched total budgets, and detects contradictions, duplication and conflict.
Status: formal study not started. Its educational prerequisites now exist as demonstrations: Chapter 19’s delegation admission and acceptance (D19-DELEGATE-01), Chapter 6’s preconditions (D06-EDIT-01), and the merge arbitration below (D20-MERGE-01). Still missing: Chapter 14’s sealed verification runs (Project 06, not started), isolation for test execution (Project 05, not started), and an accepted evidence pipeline (Project 01, REJECTED).
Proposed study. All of the following is PROPOSED; EXPERIMENT PENDING.
- Research question. At a fixed total budget, does splitting work across 2 or 4 agents with evidence-based merging improve verified outcomes over one agent, and over one agent sampled best-of-N with the same verifier?
- Hypothesis. On tasks with separable sub-investigations, k = 2 or 4 improves verified completion over k = 1. Best-of-N captures part of that gain. On tasks without separable structure, k > 1 is worse, because depth is lost.
- Alternative hypothesis. No team arm beats best-of-N at matched budget within the sampled task classes and model. That would leave a coordination advantage undemonstrated here, not establish that teams never help. Low precision can leave both useful benefit and harm plausible.
- Independent variable. Arm:
- A1, single agent;
- A2 and A4, teams with evidence-based merging;
- BoN, a single agent with N = 4 samples and the same verifier;
- A4-vote, A4 with majority-vote merging. This is an ablation of evidence-based arbitration.
- Dependent variables.
- Verified completion (sealed oracle).
- Contradictions detected out of contradictions injected.
- False merges: accepted claims that are unsupported or contradicted, and applied edits that fail combined verification.
- Duplication fraction.
- Merge spend.
- Total spend and wall time.
- Controls.
- Identical total budget per task across arms, under Chapter 17’s admission rule, with the fixed 20,000 reserve and BoN 25,000 per-attempt share from §20.5.
- The same model, tools, fixture and oracle.
- Interleaved execution order (Chapter 18).
- Fixture. Versioned descendants of the synthetic fixture, never the
frozen
repo-scout-v1, built in two classes: tasks with separable sub-investigations, and tasks without. Seeded conflicting evidence (documentation contradicting code, like the comment inworker) and scheduled conflicting edits (Chapter 6’s fault schedule) are labelled in advance. - Evaluation. Sealed oracle for outcomes. Deterministic counting of injected conflicts detected. Task-level paired analysis (Chapter 18 §18.5).
- Primary comparison. A4 versus BoN on task-level verified completion
(task
PASSand executionACCEPTED), at the matched resource ceilings. A2 versus A1 and A4 versus A4-vote are secondary; register a multiplicity method before execution rather than select the best contrast. - Failure and acceptance criteria. Separate two tests. Deterministic safety cases register zero tolerance for applying a stale edit, trusting an unauthenticated receipt or accepting a seeded claim that fails its specified support predicate: one counterexample fails that invariant. Stochastic semantic arbitration instead reports false-merge rates and task/fixture-clustered uncertainty. Before execution register a maximum acceptable error rate, practical improvement margin and sample size. Accept a rate claim only if its upper interval bound meets the threshold; otherwise report failure or insufficient precision. Report every miss. Similar point estimates for A4-vote and A4 do not establish equivalence; that requires a registered margin and precision.
- Threats. Correlated agents (same model) understate diversity. Task classes may be chosen to favour teams, so the class labels are registered before any run. The fixed reserve may constrain larger teams more severely; it is part of this treatment, with actual spend and exhaustion reported. Shared task families/repositories and provider batches require clustered or blocked analysis under Chapter 18, not independent run counts. Numerical error thresholds, sample size and multiplicity method remain registration prerequisites; this is a protocol proposal, not an executed or fully registered experiment.
20.9 Failure modes
- Merge by summary. A model is asked to reconcile results into one answer. Defence: three separate merge problems, each with deterministic or evidence-based arbitration.
- Votes as evidence. Correlated copies agree on an error. Defence: resolve citations and check support.
- Undetected contradiction. Prose claims with no comparable subjects. Defence: typed deliverables; incomparable claims are presented, not merged.
- Stale parallel edit. The second patch is applied to a changed base. Defence: Chapter 6 preconditions.
- Composition untested. Non-overlapping hunks pass alone and fail together. Defence: verify the combined change set.
- Belief blackboard. Shared conclusions acquire unearned authority. Defence: share evidence; claims must carry citations.
- Budget illusion. Larger teams get larger budgets, or uncounted merge cost. Defence: matched totals and declared merge reserves.
- Missing best-of-N. A team gain is attributed to coordination. Defence: a BoN arm at the same budget.
20.10 What you can build and test now
D20-MERGE-01 already implements the core loop: evidence-resolved finding
arbitration (votes decide nothing), contradiction detection with
REVIEW/UNKNOWN escalation, base-digest preconditions with overlap
refusal, identical-duplicate idempotence, cross-task and terminal
rejection, order-independent decisions, and a file-backed parent scenario
that applies merged edits through the D06 gate. Extend it with
mechanical rebase for non-overlapping hunks, a pair of edits that pass
separately and fail together (to prove combined verification is needed),
the append-only shared evidence store with provenance and duplication
fractions, and seeded conflicting-documentation fixtures.
20.11 What remains unverified
- Formal Project 08 acceptance (the §20.8 matched-budget comparison with BoN and A4-vote arms). The merge mechanism is demonstrated; the team comparison is not run.
- Whether evidence-based arbitration’s extra cost is repaid in avoided false merges, for any model (§20.8).
- How much correlated error same-model agents show on this book’s tasks (UNKNOWN). This is an input to whether diversity is real.
- MAST’s findings describe the frameworks they studied. Their transfer to a Pi-based harness is untested.
EXPERIMENT PENDING. The formal Project 08 study has not run; D20-MERGE-01 is an executed educational demonstration of arbitration and acceptance, not that study.
Capstone connection. The multi-agent coordination capstone stands on this chapter’s evidence store, merge rules and the Project 08 matched-budget result, including the possibility that the result is negative. The economic-orchestration capstone reuses the merge-reserve accounting.
Merging parallel work uses evidence produced during a run. The next two chapters ask what should survive after the run: which parts of a finished run, its trace, its verified outcome, the procedure it followed, its lessons, are worth keeping, and in what form. Chapter 21 begins with what experience is.
Previous: Chapter 19: Delegation Without Unbounded Autonomy.
Next: Chapter 21: Experience: Traces, Outcomes, Skills, and Cases.