Skip to content

fix(persist): Keep saved sessions intact across quick peeks, directories and instances - #56

Merged
mhiro2 merged 6 commits into
mainfrom
fix/session-store-integrity
Oct 14, 2026
Merged

mhiro2 merged 6 commits into
mainfrom
fix/session-store-integrity

Conversation

@mhiro2

@mhiro2 mhiro2 commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Auto save no longer overwrites the auto session when a quick peek opens or closes
  • save_on_leave works on its own when debounced auto.save is off
  • Copy-mode popups are restored as copies regardless of the global ui.popup.buffer_mode
  • Session commands act on the repository and stack they were run from, even if the directory or window changes while a prompt, picker or confirmation is open
  • Neovim instances sharing a store take turns through a lock file, so concurrent saves of different sessions no longer drop one of them

Changes

  • ee06b15 : fix(persist): keep the auto session when a quick peek opens or closes
    • Auto save ignores PeekstackPush / PeekstackClose events flagged as ephemeral, so a quick peek in an empty window no longer replaces the saved stack
  • 48cb6df : fix(persist): save on leave when debounced auto save is off
    • Stack changes are tracked whenever save or save_on_leave is enabled; only the debounced write depends on save
  • f649be4 : fix(persist): restore copy-mode popups as copies
    • buffer_mode is saved for every popup, including "copy", so a restore under a "source" default no longer reopens the real file buffer
  • 8865d82 : fix(commands): act on the repository a session command ran in
    • Delete confirmation, list-then-restore and prompted save fix the store path and resolved stack root when the command runs
    • A save or restore whose stack window has been closed by then is dropped instead of falling back to the current window
    • restore, list_sessions, delete_session and rename_session accept an explicit store_path
  • b0b03de : fix(persist): lock the store against writes from other Neovim instances
    • Each read-modify-write holds an O_EXCL <store>.lock and fails with a warning if another instance keeps it for more than a second
    • A lock is taken over only once its owner pid has exited, serialized through a takeover guard so a freshly acquired lock is never removed
    • A test with two real Neovim processes saving different sessions concurrently checks that none are lost
  • 1b94676 : test(persist): keep real-store tests isolated under CI load
    • Each real-store auto save test uses its own store, so a save still in flight under a loaded runner cannot leak into the next test

Quick peek popups emit PeekstackPush and PeekstackClose like stacked
popups, so auto save treated them as a change to the stack of the window
they opened in and overwrote the auto session with it, usually empty.
Events flagged as ephemeral are now ignored by auto save.
With auto.save = false the change events were not observed at all, so
save_on_leave never learned which stack to write and silently did
nothing. Stack changes are now tracked whenever either option is on, and
only the debounced write depends on auto.save.
Sessions dropped buffer_mode when it was "copy", so a restore applied
the global ui.popup.buffer_mode instead and brought a copy back as the
real file buffer whenever the default was "source". The mode is now
saved for every popup.
Session commands resolved the store again once a prompt, picker or
delete confirmation answered, so changing directory while it was open
deleted, restored or saved the session of another repository. The store
and target window are now fixed when the command runs and passed through
every later step, and the persist API accepts an explicit store_path.
The update queue only serialized writes within one process, so two
instances saving different sessions at once could both read the same
store and the later write dropped the other's session. Each update now
holds an exclusive <store>.lock from before the read until after the
write, waits up to a second for another holder, and takes over a lock
left stale by an instance that exited.
@mhiro2 mhiro2 added the bug Something isn't working label Oct 13, 2026
On a loaded runner an auto save could outlast the 500ms wait and then
land after cleanup, leaking into the next test's store. Each real-store
auto save test now uses its own store, and the async waits in the new
session command and lock tests allow more time.
@mhiro2
mhiro2 merged commit 802fd92 into main Oct 14, 2026
3 checks passed
@mhiro2
mhiro2 deleted the fix/session-store-integrity branch October 14, 2026 00:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant