cli-git concurrent commits handover #
Updated 2026-09-26.
Landed #
The feature branch feat/cli-git-concurrent-commits fast-forwarded main to cf2bf70d2 on 2026-09-26
and was pushed;
main's wrapper was rebuilt from it.
Final verification on that head:
build,
types,
oxlint,
test:unit (3 consecutive green runs before the last merge,
145 passing suites after it),
test:built:trust,
container end-to-end seeds 1 to 3
(114 runs each,
0 failures,
documented skips only,
Git 2.55.0,
2.40.0,
and 2.39.5),
lifecycle latency budgets,
and the concurrent-commit benchmark.
landing.reserveAfterLostRaces defaults to 1 after repeated sweeps (veto open).
GitHub's ruleset reported one bypassed violation on the push:
commit 8ed5daa61 is unsigned and authored by the test fixture identity T <t@example.invalid>;
all 465 other commits in the range are signed by the owner.
Cause:
the slice 2 subagent exported a smoke-test HOME and GIT_CONFIG_GLOBAL (identity T,
no signing) in one shell
and then committed in the real worktree from that shell;
no test or fixture wrote to a real worktree.
A correction comment is on the commit,
and issue #575 now covers this environment-override case.
Owner decision 2026-09-26:
leave the commit in main's history with its correction comment;
do not rewrite or force-push main.
Cleanup done:
issue #571 closed;
the merged worktrees and the local and remote branches
feat/cli-git-concurrent-commits*,
fix/cli-git-concurrent-commits-per-commit-cost-grows-with-history,
fix/cli-git-manual-push-scans-already-published-history,
and fix/cli-git-worktree-copy-stalls-and-blocks-linked-worktrees are removed.
The first commit through main's rebuilt wrapper (e06d3d98c) was signed,
auto-pushed,
and left no transaction state.
Goal #
cli-git lets several git commit invocations against the same worktree and branch run at the same time,
and every one lands as its own sequential commit,
instead of all but the first failing on index.lock EEXIST (issue #560 was a real collision).
Status #
- Design grilling finished; the owner confirmed shared understanding on 2026-09-25.
- Canonical design record:
doc/planning/cli-git-concurrent-commits.md. Every decision, the evidence behind it, rejected options, and the owner's recommendation calibration live there. - Owner instruction after confirmation:
do the changes in a new worktree,
then merge to
mainafter verification. - Worktree:
/var/home/user/worktrees/cli-git-concurrent-commits, branchfeat/cli-git-concurrent-commits, created from4044f7d40.mise run prepare:pnpm:installcompleted there. cli-git skips ignored-state copying for worktrees created from the main worktree, so dependencies had to be installed separately. The worktree'scli-git.config.tswas byte-identical to the trusted main copy and was enrolled withgit cli-git trust --yes. Theforbidden-stringsscanner binary had to be built there (mise run //package/cli/forbidden-strings:build) before commits passed thesecurity/forbidden-stringspolicy. - Decision record committed on the branch as
d322d083e(doc/decision/cli-git-concurrent-commits.md). - Implementation issue: #571.
- Implementation plan committed on the branch:
package/git-policy/cli/doc/concurrent-commits-implementation-plan.md. - The owner went to sleep on 2026-09-25 and asked for autonomous work, building both options when two look equally good. Agent-made decisions are recorded, veto open, in the decision record section "Implementation-time decisions".
- Running in parallel on the branch
(each commits with explicit pathspecs and retries on
index.lock): theSPEC.mdandREADME.mdrewrite, slice 1 (per-transaction journals and live-owner-skipping recovery), and the container end-to-end suite (expected to fail its concurrency scenarios until later slices land, which is its positive control). - Slice 1 landed on the branch
(
9f53f7857throughce4de39e8): per-transaction directories under<git-dir>/cli-git-transactions/<uuid>,owner.json, live-owner-skipping recovery, and reflog nonce search. Unit tests andtest:built:trustwere green at its last commit. Known limit until slice 3: a dead unlanded transaction fails closed if another transaction later movedHEAD. - Container end-to-end suite committed on the branch
(
2be50139ethroughd2e6b0512; results inpackage/git-policy/cli/e2e/README.md):mise run //package/git-policy/cli:test:e2e:concurrent [--seed N] [--scenario a,b] [--git 2.40.0,2.55.0]. Git 2.40.0 is the declared minimum (merge-tree --merge-base). On the slice 1 build all 19 baselines and the checker positive control pass, and every concurrency scenario fails as expected (index.lockEEXIST,git addexit 128,gc --prune=nowdeleting a held blob, hook-phaseSIGKILLleaving locks). Follow-ups for the suite: kill markers for landing, ref-update, and index-install phases once implemented; binary and rename scenarios; a less timing-dependent shared-file start window; per-exit remote checks. Observed separately: thelinked-worktree-onlypolicy rejects lint-staged'sgit stashin a main worktree. - Slice 2 landed on the branch
(through
ab62a2cd2): shadow preparation for every commit, the hook dispatcher shim, serial landing that reportsconcurrent-commit/head-movedinstead of replaying, and recovery afterSIGKILLat 11 phases. Build, types, oxlint, unit, andtest:built:trustwere green. - Running in parallel,
each in its own worktree:
- slice 3 in the feature worktree:
replay,
revalidation,
moving private-index objects into the shadow store,
native semantics for hooks that restage files,
e2e kill-phase markers,
and syncing
SPEC.mdwith slices 2 and 3; - slice 6 in
/var/home/user/worktrees/cli-git-concurrent-commits-index-lock-classification(branchfeat/cli-git-concurrent-commits-index-lock-classification):core.lockfilePidinjection, foreignindex.lockclassification and waits, index-writer coordination, and the narrowed worktree-copy settlement lock; - slice 8 finished in
/var/home/user/worktrees/cli-git-concurrent-commits-single-flight-auto-push(branchfeat/cli-git-concurrent-commits-single-flight-auto-push, throughb6860a9e8): single-flight auto-push, green on build, types, oxlint, unit, andtest:built:trust. Both merge intofeat/cli-git-concurrent-commitsafter they are green. Slices 4 (read sets andinputs) and 5 (reservation) follow slice 3.
- slice 3 in the feature worktree:
replay,
revalidation,
moving private-index objects into the shadow store,
native semantics for hooks that restage files,
e2e kill-phase markers,
and syncing
- The slice worktrees and branches were first created as
ccc-locks/ccc-push; the owner called the names non-descriptive, and they were renamed on 2026-09-26. The lock branch is published under its new name (slice 6 finished at6143d837d) and the old remotefeat/ccc-locksis deleted. The auto-push branch is published under its new name and the old remotefeat/ccc-pushis deleted. - Claude Code crashed twice on 2026-09-26 while running a wrapped manual
git pushof the renamed branch. An isolated rerun as a systemd user service showed the cause: the wrapper'smanual-pushscan listed the whole history for a ref the remote lacks and spawned onegit diff-treeper commit concurrently (3256 tasks, 1.3 GB peak, thenspawn /usr/bin/git EAGAINfromfinal-newline). Code:pushedCommitsandcreateManualPushCandidatesinpackage/git-policy/cli/src/policy-engine/manual-push-candidates.ts. The owner ruled it wrong by design: the scan must never walk every commit. Fixed on branchfix/cli-git-manual-push-scans-already-published-historyand merged intomain(pushed asf1f8d6640; main's wrapper rebuilt): the scan excludes everything reachable from the destination remote's tracking refs, scans only the tip tree when nothing on the remote is known, and uses a fixed number of processes. Measured on the real repository: the new-branch push that failed at 3256 tasks and 1.3 GB now takes 5.7 s and 73 MB.doc/troubleshooting/cli-git-tag-push-eagain.mdnow records the root cause. - While pushing,
the released cli-git on
mainfailed closed withcontent-unavailablebecause another session's commit transaction was live in the main worktree; slice 1's live-owner skip resolves that once the feature branch merges. - Slices 3 and 6 were interrupted by the crashes and resumed from their transcripts.
- Slice 3 finished on the feature branch
(through
0dbebe896): replay, revalidation, shadow-store objects, hook-staged trees kept, phase markers, and theSIGKILLhang fix (the container's PID 1 never reaps orphans, so zombie lock owners looked alive; Linux statesZandXnow count as exited). Container seed 1: 4 of 66 runs failed. - Owner decisions 2026-09-26,
not yet in the decision record because a merge is in progress in the feature worktree:
- Replay per overlapping path: if the captured bytes already contain the landed change (its diff applies in reverse to the captured version), land the captured bytes; otherwise three-way merge, and a conflict fails. This amends the Q4 answer after the trace scenario showed pure three-way merging conflicting on adjacent edits in a shared worktree.
- Amending a published commit while others are in flight:
the e2e checker exempts commits landed on the amended history from
remote-containsand requires the non-fast-forward push failure to be surfaced with exit0.
- Slices 6 and 8 merged into the feature branch
(
61d5622c8,d52991dc0; integration fixes throughcb2ef918b, including process-group teardown for fixtures). All checks green; container seeds 1 and 2 failed only the two scenarios the owner decisions address. Both decisions are now in the decision record (ef003b7cf). - In progress:
- feature worktree: subsumption replay, slice 5 reservation, and the amended-history checker expectation;
/var/home/user/worktrees/cli-git-concurrent-commits-policy-read-sets(branchfeat/cli-git-concurrent-commits-policy-read-sets): slice 4 read sets andinputs. Slice 4 finished at96d96533d, all checks green. Its agent made 9 commits with/usr/bin/gitafter arequire-rootfinding, skipping commit-time policies and auto-push; they were pushed through the wrapper afterwards and its manual-push policies passed. The owner chose a deterministic hook over more rule wording: issue #575. Subsumption replay, slice 5 reservation, and the amended-history checker finished through5a863e43b: container seed 1 passed 71 of 72 runs, seed 2 passed 70 of 72; onlyconcurrent-trace-replaystill conflicted, where a later capture rewrote lines an earlier in-flight commit had just added. Owner decision 2026-09-26: for a path both commits captured from the same worktree, the later capture wins (decision record, "Capture order"). Capture order landed with the slice 4 merge (f44b7e8d4through255de52b4): container seeds 1 to 3 pass every scenario on both Git versions except documented skips. Open before merging tomain:test:unitflakes on the trust registry's recursive lock, which gives up after about 1 s even while its owner is alive; an agent in the feature worktree is applying the owner-liveness wait, recording the index-commit capture and checker decisions, and re-measuring the latency baseline.- A
git worktree addfrom a linked worktree stalled after copying about 2 GB of ignored files, blocking every wrapped command in linked worktrees until an agent deleted the copy journal by hand. Investigation and fix in/var/home/user/worktrees/cli-git-worktree-copy-stalls-and-blocks-linked-worktrees(branchfix/cli-git-worktree-copy-stalls-and-blocks-linked-worktrees). Update 2026-09-26 evening: - Trust registry lock,
test home isolation,
and the untrust-overlap reader fix landed;
worktree-copy fix merged (
6f613c26e); Git 2.39.5 degrades by capability probe; feature headda8ba33cfpassed unit (3 runs),test:built:trust, container seeds 1 to 3 (90 pass, 24 documented skips, 0 fail per seed), and latency budgets. - Per-commit cost growth was unconsolidated packs from
index-pack --keeplandings, because plumbing skips nativegit commit's auto-maintenance; fixed onfix/cli-git-concurrent-commits-per-commit-cost-grows-with-history(344 ms per commit at 2000 packs, from 1062 ms). - Running:
final integration
(merge the maintenance fix,
re-run the reservation sweep with the rule "tails within the band:
lower median wins",
benchmarks,
full verification,
documentation consistency),
and removal of about 1351 stale trust records of deleted
/tmprepositories from the owner's real registry after a backup (owner approved). - Issues opened this session:
#572 (under-scoped verification),
#573 (logger sink timeout noise),
#574 (short-form names),
#575 (absolute-path git bypass hook),
#576 (logger logs under
node_modules). After final integration: merge the feature branch intomain, rebuild main's wrapper, and close #571.
SPEC.mdhas no placeholders left; the shadow snapshots every real ref at invocation so hooks resolve tags and other branches.- Private
HEADshape chosen from a disposable-repository prototype: a shadow repository with alternates to the real object store (decision record commit0d19ff973on the branch). Culled shapes and their evidence are in the decision record. A docs agent is replacing theSPEC.mdplaceholders to match. Slice 2 starts after slice 1 lands, because both change the transaction workspace files.
Evidence produced this session #
- Private
HEADprototype, hook environment probe, andindex.lockholder research: summarized in the planning doc sections of the same names. - Git hook quirks,
with source traces,
upstream filing decisions,
and a prototype Git patch:
doc/troubleshooting/git-hook-disable-switches.mdanddoc/troubleshooting/git-private-admin-dir-hook-environment.md. - Planning doc commits:
4b0335b1bthroughc56b7e6c5onmain; troubleshooting docs4044f7d40.
Next actions #
- Review the
SPEC.md, slice 1, and end-to-end suite results as they arrive. - Choose the private
HEADshape from the prototype, then implement slice 2. - Implement the remaining slices in the plan's order:
per-transaction journals and recovery,
private
HEADpreparation with the hook dispatcher shim, landing critical section with replay, policy read-set tracking andinputs, starvation reservation, foreignindex.lockclassification and index-writer waits, single-flight auto-push, concurrent fixtures and benchmarks, and the container end-to-end suite replaying realistic workloads against fresh dummy repositories (see the decision record section "Container end-to-end verification"; inherent to this design, omitted until the owner pointed it out, agent-behavior gap tracked in #572). - Verify at the user boundary with the packed shadow-bin fixtures,
then merge
feat/cli-git-concurrent-commitsintomain.
Open items for the owner #
- Upstream Git report for the hook disable switches: all six filing constraints hold, but Git rejects mail that looks AI generated, so the owner must rewrite it, rerun the reproduction, and sign off before sending. Nothing was filed.
Owner working instructions #
- Work autonomously; when two choices look equally good and promising, build both and let the build show which is better.
- Use as many worktrees as useful:
one per competing prototype,
branched from
feat/cli-git-concurrent-commits. - Cull competing prototypes early once one clearly crowds out the others; record the culled option and the evidence in the decision record.
Cautions #
- Other sessions commit to
mainconcurrently (AGENTS.md batches, issue 570); touch only this task's files. - The shim executables must follow SCR: no shell scripts.