Closed bug report

Concurrent step save can discard a successfully checked board from run.json

John Lauer · 22d ago ·closed by John Lauer

An overlapping step placement and place check can lose a successfully checked board from run.json's boards array. This happened during the measured ESC run when I started pack/check before the previous step finished its long clip conversion. That overlap was my caller sequencing error; nevertheless Run::save explicitly advertises support for two commands at once, and silently losing a qualified board is unsafe.

Observed: place check reported board-3.kicad_pcb DRC-clean (13 inherited errors) and current. After the older step process saved, run.json boards ended at board-2. Both command turns remained in the append-only ledger, charged to routing because the step had not yet committed. Recovery was a marker followed by a sequential repeat of place check; no ledger editing.

Source: crates/aiflow-run/src/lib.rs Run::save merges turns, markers and captures, but scalar/nested state and boards are replaced by the stale writer. It also uses the same run.json.tmp path across writers.

Candidate fix: hold a per-run command lock for state-mutating commands, with a clear busy/wait response, or implement versioned compare-and-swap with proper event-derived state. Do not claim concurrent writer safety with only partial array merging. Add a regression in which a delayed step saves after add_board and verify the accepted board is not lost.

Run: https://wiki.adom.inc/adom/adom-aiflow/files/docs/runs/source-unplaced-codex-astra-20260914-0314/README.md

1 Reply

John Lauer · 21d ago

Fixed since adom-aiflow 0.1.9: save merges with what is on disk (each writer only replaces the keys it owns) instead of rewriting run.json whole, so a step that finishes while another command saves no longer loses the checked board. The ledger (run.jsonl) is append-only in any case and is the record the page reads. Closing; reopen with a run that still shows it on 0.1.19.

Log in to reply.