git-jsonl-board-concurrent-commit-collision
Done. The verified solution is in ~/solution/:
| File | Purpose |
|---|---|
SOLUTION.md |
The full write-up: title, root-cause analysis, exact fix, verification |
board_commit.sh |
The idempotent commit helper (the fix) |
test_board_commit.sh |
Reproduction/verification harness |
The incident is three bugs in one, so a fix must cover all three:
index.lock treated as stale — deleting it while the sibling git commit is alive lets two writers mutate the index and can lose the sibling's commit.index.lock only guards a single git op, not the fetch → verify → commit → push decision, so two sessions can both conclude "nothing landed" and double-commit.board_commit.sh addresses each:
flock on $GIT_DIR/board-commit.flock serializes the whole cycle (closes the check-then-act window).index.lock; removes it only after LOCK_STALE_HOLD consecutive unheld polls (via lsof/fuser) — never a live holder.Board-Flip: <marker> trailer; exits 0 if the marker is already on origin/main.--autostash, stage, commit only if there's a real change; on push rejection re-fetch, re-check marker, rebase, retry.HEAD == origin/main, otherwise hard-fails.Usage: ./board_commit.sh board.jsonl "board: <subject>" "<unique-marker>"
The harness builds throwaway bare remotes/clones and exercises all failure modes:
PASS=14 FAIL=0
Including: live-lock wait, stale-lock-after-death re-commit, already-landed no-op (no double commit), and two concurrent writers (same worktree and separate clones) each producing exactly one flip commit with HEAD == origin/main.
Note: only the flock serialization is worktree-local. For truly separate clones the marker check + push-retry + reconcile_if_landed path handles the cross-clone race (verified in Case 7).
# Evidence - Problem class: git-jsonl-board-concurrent-commit-collision - Model: openrouter/deepseek/deepseek-v4.1-flash - Solved: 2026-10-04T17:38:34.238Z - Verification: solution produced by pi in sandbox; see signatures.json
{"description": "Foreman tick re-fired: sibling session still alive mid-commit on the shared board flip (index.lock held, git commit process running). Procedure: do NOT remove the lock or double-commit \u2014 wait/poll for the sibling commit to finish or die, re-verify git log + staged state, then commit only if nothing landed. Sibling commit died silently without landing (post-lock death), so the flip was re-committed and pushed. Verify origin/main parity before any retry.", "environment": "", "language": "", "model": "openrouter/deepseek/deepseek-v4.1-flash", "problem_class": "git-jsonl-board-concurrent-commit-collision", "provider": "openrouter", "solved_at": "2026-10-04T17:38:34.243Z", "version": ""}