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
cmd_consolidate reads the staging files outside the staging lock, so an append landing mid-read splits one summary across two rounds #235
#234 (85c642b) gave today-*.md its own lock, held around the NDC append and around consolidation's retire loop — the four operations (wc -c, head, tail, mv) where an append could previously be sealed into a file nothing globs again.
cmd_consolidate's read of those staging files is still outside that lock.
What it costs, precisely
An append landing mid-read splits one summary: part of it is consumed into recent.md, the remainder sits past the consumed-byte offset, is kept as the tail, and is consolidated on the next round.
So this is boundary corruption of a single entry, not loss — strictly smaller than what #234 fixed, where the whole entry became unreachable. Both halves survive; they land in different places, and the seam falls wherever the reader happened to be.
Worth being exact about why it still matters: the two halves are reassembled by nothing. A reader of recent.md sees a summary that stops mid-sentence, and the continuation shows up in the next consolidation under a later timestamp, attributed to the day it was re-consumed rather than the day it was written.
Closing it means holding the staging lock across a Python call that contains the Haiku round — and a critical section containing a model call is exactly the shape this design refuses. That reasoning is not incidental; it is the same argument that ruled out consolidating onto save.lock (save-session.sh holds that one across its own summarize call, which is how #142 happened).
So the honest options are narrower than "add a lock":
Snapshot before reading — copy or rename the staging files under the lock, then read the snapshot outside it. Turns the race into a rename, which is what the retire loop already does. Costs a copy and needs a cleanup story for the snapshot when the consolidation dies mid-round.
Read under the lock but call the model outside it — take the bytes and the offset under the lock, release, summarize, then re-acquire only to commit. That is the shape fix(#223): commit NDC's partial truncate under the save lock #224 landed for the NDC commit, so there is precedent in this repo for splitting a critical section around a model call rather than widening one to contain it.
Accept it and say so — document the seam where a reader of recent.md would otherwise be confused by a summary that stops mid-sentence. Legitimate, but only if written down; an undocumented known-good-enough is indistinguishable from an unnoticed bug.
Found and reported by the agent implementing #225, which deliberately scoped it out rather than widening its own critical section. Filed rather than mentioned because a truncated memory entry is the kind of thing that gets read months later by someone with no way to know it was truncated.
Activity
test(#235): name the lock-refusal test for the exit it now covers
test(#235): stop a newline mismatch reporting itself as a lost race
fix(#235): read staging under staging.lock, with the model call outsi…