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
A failed tail renders as "(no previous entry)" — save-session.sh:211 overwrites its own output on error #251
When A is true but Bfails, C runs too — and C's > overwrites whatever B already wrote.
Reproduction
With a failing tail on PATH and a now.md containing a real entry:
now.md: ## 09:00 / real previous entry
$TMP_LAST_ENTRY: (no previous entry)
rc: 0
log: (nothing)
The file had a previous entry. The summarizer is told it did not.
Why it matters
This is this repo's signature defect — an absence produced by a tool read as an absence in the world — and it is silent: rc 0, nothing logged, no marker. The summarizer loses its continuity anchor and can duplicate the previous entry back into now.md, which is the exact damage class #142/#224/#250 have been closing from the other end.
The same line also conflates three genuinely distinct states into one indistinguishable answer:
there is genuinely no ## header yet (first entry of the buffer) — a legitimate empty
now.md could not be read
tail itself failed
A reader of (no previous entry) cannot tell which of the three happened, and only the first is benign.
Suggested direction
An explicit if/else rather than &&/||, so a failed tail is a distinct branch from an empty buffer. Per docs/'s three-state contract, case (2) and (3) should be a skipped/finding that says so, not a value that reads as data. Case (1) is the only one that should render as "no previous entry".
Provenance
Found incidentally while assessing PR #173 against main; not part of that PR's scope, and reproduced rather than inferred.
Same shape as save-session.sh:211, and the same consequence: when A is true but the echo fails, C runs too. These are config readers, so the caller gets the value followed by the default — not one or the other. A partial write plus a fallback, concatenated, presented as a single answer.
That is arguably worse than the save-session.sh case. There the failure produced a wrong-but-coherent value ((no previous entry)); here it produces a value that is neither what was read nor the default, and nothing in the output says two branches ran.
Both are also silent for the same reason as the original: rc 0, nothing logged.
Raising the count to three sites and shifting my read of the fix: this is no longer "fix a line", it is worth a sweep of the shell scripts for A && B || C and a decision about whether the pattern is banned outright. shellcheck SC2015 catches exactly this — filed as claude-supertool#665, where the argument for building that validator is precisely this issue. A linter would have caught all three at edit time; three hand-found instances in two days is the case for it.
No change proposed here beyond widening the scope. Whoever takes it should decide the if/else rewrite for all three together rather than one at a time.
Activity
fdaviddpt commentedon Jul 31, 2026
Two more instances of this exact idiom, both in
scripts/log.sh, found by the agent working #252 and verified independently:Same shape as
save-session.sh:211, and the same consequence: whenAis true but theechofails,Cruns too. These are config readers, so the caller gets the value followed by the default — not one or the other. A partial write plus a fallback, concatenated, presented as a single answer.That is arguably worse than the
save-session.shcase. There the failure produced a wrong-but-coherent value ((no previous entry)); here it produces a value that is neither what was read nor the default, and nothing in the output says two branches ran.Both are also silent for the same reason as the original: rc 0, nothing logged.
Raising the count to three sites and shifting my read of the fix: this is no longer "fix a line", it is worth a sweep of the shell scripts for
A && B || Cand a decision about whether the pattern is banned outright. shellcheck SC2015 catches exactly this — filed asclaude-supertool#665, where the argument for building that validator is precisely this issue. A linter would have caught all three at edit time; three hand-found instances in two days is the case for it.No change proposed here beyond widening the scope. Whoever takes it should decide the
if/elserewrite for all three together rather than one at a time.fix(save-session): a failed last-entry read is no longer "(no previou…
release: 0.12.3 — One bad byte
release: 0.12.3 — One bad byte
release: 0.12.3 — One bad byte (#278)
fix(save-session): a failed last-entry read is no longer "(no previou…