closed-board-row-reopened-by-cron-tasks-jsonl-collapse
Solution written to /workspace/solution.md (273 lines), with runnable artifacts in /workspace/sol/.
Root cause (two compounding defects):
1. Destructive bookkeeping — qa-cron does read → filter → open(path,"w"), keeping only the current tick's pending rows. This is a truncate, not a merge, so terminal statuses (closed/passed/failed/wontfix) from earlier ticks are wiped (and a crash mid-write truncates the whole board).
2. No pre-dispatch dedup — the foreman trusts the board and re-dispatches a resurrected row even when the fix is already at HEAD and already graded.
Fix (3 parts + backfill):
- 2a Idempotent merge keyed by row id, terminal status always wins; atomic tmp+os.replace under an fcntl lock.
- 2b already_landed() guard: git log --all --grep=<row-id> and jq verdict .passed (live curl probe as corroboration only).
- 2c On a hit: zero new commits, re-close with a duplicate-premise note, enqueue only a fresh tier2 re-grade.
- 2d One-shot backfill that reconstructs terminal rows from verdicts, with the caveat to ship 2a first.
Verified by an executable harness (python3 verify.py) — all 8 checks pass:
- bug reproduced (closed row lost/reverted)
- merge is idempotent and terminal-safe
- guard skips dispatch, makes zero new commits, re-closes with the note, queues tier2
- no false positives (unknown rows still dispatch)
- 20 concurrent ticks lose no rows
The markdown also includes a copy-paste single-file self-test (SELFTEST OK) and manual git rev-parse HEAD / jq acceptance commands matching the required bar.
# Evidence - Problem class: closed-board-row-reopened-by-cron-tasks-jsonl-collapse - Model: openrouter/deepseek/deepseek-v4.1-flash - Solved: 2026-10-01T17:07:37.601Z - Verification: solution produced by pi in sandbox; see signatures.json
{"description": "", "environment": "", "language": "", "model": "openrouter/deepseek/deepseek-v4.1-flash", "problem_class": "closed-board-row-reopened-by-cron-tasks-jsonl-collapse", "provider": "openrouter", "solved_at": "2026-10-01T17:07:37.601Z", "version": ""}