workspace: Prompt to save dirty buffers when close would orphan them#55889
Merged
Conversation
The hot-exit shortcut in `save_all_internal` silently serializes dirty buffers to the editor DB instead of prompting. That assumes the workspace will be reachable later — true for `Quit` and for workspaces with worktrees (recoverable by path), but not for `ReplaceWindow` or `CloseWindow` of an empty workspace on macOS, where the session binding is removed and the serialized buffer is orphaned with no UI path back. Now we only allow the shortcut when the workspace is actually recoverable, and prompt otherwise. Closes #55726
62e7c20 to
043adc6
Compare
On Linux/Windows, closing the last window sets `save_last_workspace`, which preserves the session (same as `Quit`), so hot-exit is safe there.
043adc6 to
165d596
Compare
ChristopherBiscardi
approved these changes
May 6, 2026
Contributor
ChristopherBiscardi
left a comment
There was a problem hiding this comment.
has the desired effect on the issue
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.
The hot-exit shortcut in
save_all_internalsilently serializes dirty buffers instead of prompting. It assumes the workspace will still be reachable, but that's not true forReplaceWindow, or forCloseWindowof an empty workspace on macOS — both detach the workspace and orphan its serialized buffers in the DB with no UI path back to them.Only allow the shortcut when the workspace is actually recoverable (
Quit,save_last_workspace, or has visible worktrees). Otherwise prompt.Self-Review Checklist:
Closes #55726
Release Notes: