Repository navigation
fix: write the exit summary in the next session instead of blocking quit - #56
Open
felipeadeildo wants to merge 1 commit into
Open
felipeadeildo wants to merge 1 commit into
felipeadeildo wants to merge 1 commit into
Conversation
Signed-off-by: Adeildo <adeildo@ranqia.com>
escapeWu
pushed a commit
to escapeWu/pi-memory
that referenced
this pull request
Oct 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #55.
Pi stops its screen before it runs
session_shutdownhandlers, and then waits for them with no timeout. The exit summary's model call ran in that wait, so quitting looked like a hang for up to 10 s. The Ctrl+C that followed killed pi, which lost the summary and theTo resume this sessionline.Quitting now only saves what the summary needs, and the next interactive session writes it:
memory/pending/<session-id>.json. Quitting the same session again replaces that file.session_start: the session claims each pending file by renaming it to<file>.<pid>.claimed. Files claimed by a process that is still alive are skipped, and ones left by a dead process are taken over. It then writes each summary in the background, one at a time, into the daily log of the day the session ended, with the original timestamp. A run in print mode leaves them alone.PI_MEMORY_EXIT_SUMMARY_TIMEOUT_MSnow bounds the background call, and its default goes from 10 s to 60 s. 10 s was often too short for a long session, and nothing is waiting on it anymore.Verified
bun test test/unit.test.tspasses: 197 → 203 tests. The new tests cover the daily log of the end day, replacing a session's pending entry, dropping an empty summary, the 3-try limit, claims held by live and by dead processes, and the interactive-only start. The tests that expected the model call at quit now expect it from the next session.npm run lintandnpm run buildare clean.Related