You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
NDC and consolidation take two different locks over the same today-*.md file, so nothing serializes an append against a merge #225
scripts/run-consolidation.sh:42-46 takes tmp/consolidation.lock, fully synchronously. It reads past-day today-*.md files to merge them away.
Both use the same lib-lock.sh primitive, so each is internally sound. They just are not the same lock, and holding one says nothing about the other.
The gap
today-YYYY-MM-DD.md is written by one and read-then-merged-away by the other, with no shared mutual exclusion. The NDC append is not atomic — it is [ -s "$TODAY_FILE" ] && echo "" >> "$TODAY_FILE" followed by cat "$HAIKU_TEXT_FILE" >> "$TODAY_FILE", two separate appends — so a consolidation run reading between them sees a file with a trailing blank line and no summary, and a run reading during the second could see a partial one.
What I have and have not established
I have not shown this is reachable. Consolidation targets past-day files and NDC normally appends to today's, so the day boundary may well make the overlap empty in practice. The candidate windows are the obvious ones — a save whose NDC round starts before midnight and commits after (the exact case NOW_DAY_FILE and #141 exist to handle, so $NDC_DAY can legitimately name yesterday), and a consolidation run firing while such a round is in flight.
Filing it unproven and saying so, rather than either fixing it blind or dropping it. "NDC and consolidation do not share a lock" is a sentence that reads badly in hindsight if it turns out to matter, and the cost of writing it down now is one issue.
What would settle it
Whether $NDC_DAY can name a day that consolidation considers past, while consolidation is eligible to run. If yes, this is real and the fix is a shared lock (or ordering) around today-*.md. If no, close it and leave the reasoning on the record so the next person does not re-derive it.
Found while fixing #223 (PR #224), by the agent working that issue. Deliberately not folded into that PR — different files, different lock, and bundling an unproven concurrency change into a proven one would put both at risk.
Activity
fix(#225): give today-*.md its own lock so an append cannot race a re…
test(#235): stop a newline mismatch reporting itself as a lost race
fix(#235): read staging under staging.lock, with the model call outsi…