pub struct MergeTxn {
pub op_id: String,
pub source_branch: String,
pub worker_branch: String,
pub expected_source_oid: String,
pub worker_oid: String,
pub base_sha: Option<String>,
pub driver_pid: Option<i32>,
pub driver_pid_start_secs: Option<u64>,
pub driver_pid_start_identity: Option<String>,
pub caller_authority: Option<CallerMergeLink>,
pub landing: bool,
pub started_at: DateTime<Utc>,
}Expand description
A durable, in-flight run merge transaction recorded by merge.started
BEFORE the git mutation, and the sole input to deterministic merge-crash
recovery (design.md §2.1b / A2, issue merge-transaction-recovery).
run merge spans git refs and the event log and is not atomic across them.
Recording the transaction — the exact source ref it will move, the OID it
expects that ref to be at (expected_source_oid, the compare half of the
compare-and-swap), and the worker’s tip — lets the supervisor (or a retried
run merge) resolve the ONE recorded transaction by OID after a crash:
- source ref still at
expected_source_oid→ the mutation never landed → REJECT (merge.aborted), preserving the worker’s branch + work. - source ref moved off
expected_source_oidAND the worker’s content is integrated (rebase-robust content verification) → COMPLETE (append theexplicit-mergenode.reportthe crash prevented). - source ref moved unexpectedly but the worker’s content is not integrated → fail closed (REJECT), preserving the work.
Fields§
§op_id: StringOpaque unique id for this merge attempt. A fresh id per run merge
invocation (each attempt re-reads expected_source_oid), so recovery can
name exactly which transaction it resolved in the merge.aborted audit.
source_branch: StringThe source/target ref this merge moves — manifest.source_branch
(main, or an integration branch). Recovery reads this ref’s current OID
to decide the transaction’s fate.
worker_branch: StringThe worker branch whose commits are being merged (node.branch). Its
content is what recovery verifies is integrated into source_branch.
expected_source_oid: StringThe OID source_branch was at when the transaction was recorded — the
compare half of the compare-and-swap. If the ref is still here at recovery
time, the git mutation never landed.
worker_oid: StringThe worker branch tip at record time. Retained for the audit trail and as
a secondary landing signal; the authoritative completion check is
content-based (rebase-robust) against source_branch.
base_sha: Option<String>The worker branch’s fork point (node.base_sha), used to bound the
content check to the worker’s own commits. None when unrecorded.
driver_pid: Option<i32>PID of the run merge process driving the transaction, so recovery can
tell a still-in-progress merge (driver alive — leave it) from a crashed
one (driver gone — resolve it), never racing a live merge. None when
unrecorded.
driver_pid_start_secs: Option<u64>Start time of driver_pid in Unix seconds (the same representation the
pid-file liveness check records), guarding against PID reuse the way the
agent/supervisor liveness checks do — a recycled PID must not look alive.
None when the platform could not read it. Decides PID reuse only when
driver_pid_start_identity is absent.
driver_pid_start_identity: Option<String>Kernel start identity of driver_pid (the same token the agent and
supervisor identity checks compare exactly). Unlike the seconds value it
does not move when the wall clock is stepped. Absent on transactions
recorded before the field existed.
Caller-only provenance tying the transaction to the sticky intent and the exact writer inode held by the merge driver. Absent on normal merges.
landing: boolA resident run land transaction (ADR 0003): its completion is a
non-terminal node.round_landed, never an explicit-merge report.
started_at: DateTime<Utc>When the transaction was recorded.