From docs/AUDIT-v0.4.0.md (P1, item 6).
session-flush.sh guards its end-stamp with an anchored grep so a double SessionEnd writes one stamp. session-precompact.sh has no such guard: a double PreCompact fire for one seam writes two boundary markers. Low impact (informational marker), but asymmetric with flush for no documented reason.
Fix: mirror flush's grep guard, but keyed to "a boundary already exists as the LAST marker" rather than "any boundary exists in the file" - multiple genuine compactions in one long session must still each get their own stamp. Simplest correct form: skip the write only if the file already ends with a compaction-boundary marker (tail -n2 check), since two stamps with no captured actions between them mark the same seam.
From docs/AUDIT-v0.4.0.md (P1, item 6).
session-flush.sh guards its end-stamp with an anchored grep so a double SessionEnd writes one stamp. session-precompact.sh has no such guard: a double PreCompact fire for one seam writes two boundary markers. Low impact (informational marker), but asymmetric with flush for no documented reason.
Fix: mirror flush's grep guard, but keyed to "a boundary already exists as the LAST marker" rather than "any boundary exists in the file" - multiple genuine compactions in one long session must still each get their own stamp. Simplest correct form: skip the write only if the file already ends with a compaction-boundary marker (tail -n2 check), since two stamps with no captured actions between them mark the same seam.