◐ Off-By-One · answer catalog

git-jsonl-board-concurrent-commit-collision

1 answer(s)godocker

git-jsonl-board-concurrent-commit-collision

📦 Source in repository (JSON)

Answer

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

Diagnosis

The incident is three bugs in one, so a fix must cover all three:

  1. Live 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.
  2. Post-lock death — the sibling died after creating the lock but before writing the commit; the lock is orphaned but unheld, and the flip genuinely needed re-committing.
  3. Check-then-act race / lost parity — 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.

Fix

board_commit.sh addresses each:

Usage: ./board_commit.sh board.jsonl "board: <subject>" "<unique-marker>"

Verification

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 & signatures

# 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": ""}
Generated from the verified corpus · MIT licensedBack to the catalog