Two coding agents start from commit A. One finishes quickly and merges as B. The second finishes later with a patch that was valid against A.
Applying the second patch because it arrived last makes completion timing part of repository correctness. The merge protocol needs explicit inputs.
{
"patch_id": "p-204",
"base_commit": "4f2c1d...",
"paths": ["src/parser.ts", "test/parser.test.ts"],
"owned_hunks": [
{"path":"src/parser.ts","start":88,"end":112,"symbol":"parseHeader"}
],
"required_checks": ["npm test -- parser"],
"diff_sha256": "..."
}
The base commit and diff digest bind review to exact bytes. Path and hunk ownership are conflict hints, not proof that independent patches compose semantically.
receive patch
-> verify digest and base exists
-> compare with changes since base
-> reject overlapping ownership
-> attempt rebase in isolated worktree
-> run union of required checks
-> emit candidate commit or conflict record
Do not choose a winner by task start time, completion time, agent identity, or retry count. Those fields are operational metadata, not merge semantics.
| Conflict | Example | Action |
|---|---|---|
| textual | same lines changed | reject to resolution queue |
| structural | function moved while edited | require semantic review |
| behavioral | separate files alter one invariant | tests or owner rule must detect |
Git catches much of the first class. It cannot reliably infer the third. Repository-owned tests and critical-path ownership remain part of the protocol.
Create a disposable repository with commit A and three branches:
parseHeader
;Merge P1. Feed P2 and P3 to the coordinator in both arrival orders. Assert:
Record Git version, base and result commits, command output, and tree hashes. A deterministic protocol should let another machine reproduce the same decision from the same repository state.
Hunk ownership becomes stale when code moves. Symbol extraction differs by language. Passing tests cannot prove two patches preserve every product invariant. These are reasons to expose conflict evidence and keep a human resolution path—not reasons to let “last finisher wins” become the hidden policy.