Skip to content

Empty the -o file when every preloaded annotation is deleted - #422

Merged
umputun merged 4 commits into
masterfrom
clear-preloaded-output
Oct 28, 2026
Merged

umputun merged 4 commits into
masterfrom
clear-preloaded-output

Conversation

@umputun

@umputun umputun commented Oct 28, 2026

Copy link
Copy Markdown
Owner

loading notes with --annotations, deleting all of them and quitting with q left the -o file untouched, because finalize skipped every exit with no annotations. The next load from that file brought the deleted notes back.

a graceful exit now writes the empty result when --annotations actually loaded at least one note and none remain. A Q discard, a signal exit and a review that never had notes keep the old behavior and leave the file alone. README, docs.html, both usage references and the gotchas entry describe it.

the PTY test harness sends keys one at a time, since a burst arrives as a single multi-rune key, and takes an -o path so the round trip runs through the real TUI. The new e2e test fails without the run() wiring.

also drops "compact mode" from the --stdin multi-file diff description: compactApplicable returns false whenever --stdin is set. The backlog item that tracked it is cut down to the remaining codex usage.md resync.

compactApplicable returns false whenever --stdin is set, but README,
docs.html and the plugin usage reference listed compact mode among the
features of a piped multi-file diff. The backlog item is cut down to the
remaining half, the codex usage.md resync.
loading notes with --annotations, deleting all of them and quitting with q
left the -o file untouched, because finalize skipped every exit with no
annotations. The next load from that file brought the deleted notes back.
A graceful exit now writes the empty result when annotations were preloaded
and none remain. A Q discard and a signal exit still leave the file as it
was, and a review that never had notes writes nothing, as before. README,
docs.html and both usage references describe it.

the PTY test harness sends keys one at a time, since a burst arrives as a
single multi-rune key, and takes an -o path so the round trip runs through
the real TUI.
the finalize doc comment opened with "no annotations writes nothing" and then contradicted it, and implied the -o file is always the --annotations source. The signal-safe save entry in gotchas.md still said empty output writes nothing, which invites restoring the old skip.
Copilot AI balanced review requested due to automatic review settings October 28, 2026 23:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@umputun
umputun merged commit f631e7e into master Oct 28, 2026
7 checks passed
@umputun
umputun deleted the clear-preloaded-output branch October 28, 2026 23:21
umputun added a commit that referenced this pull request Nov 12, 2026
* fix: empty the -o file when every flushed annotation is deleted

after an O flush wrote the -o file, deleting every annotation (or dropping
them with R) and quitting with q left the flushed snapshot in place. The
plugin launchers read that file on exit and handed the deleted notes to the
agent. A graceful quit now writes the empty output when an O flush wrote
the file in this session, the same rule #422 applies to preloaded notes.
Q and signal exits still leave the file as it was.

README, docs.html, both usage references and the gotchas entry describe it.

* fix: clear a stale -o file when the reload before quit failed

finalize returned the file-list load error before reaching the empty-output
write, so an O flush (or --annotations preload), then an R reload that failed,
then q left the old notes in the -o file. The launchers cat that file on any
exit code, so the caller still got the deleted notes next to the error. The
load-error path now clears the file first under the same rule, graceful exit
with preloaded or flushed notes, and still returns the load error.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants