Add periodic buffer persistence to protect against unexpected termination#19805
Add periodic buffer persistence to protect against unexpected termination#19805sgeraldes wants to merge 2 commits intomicrosoft:mainfrom
Conversation
…tion Fixes microsoft#19804 Previously, terminal buffer content was only persisted on graceful exit (normal quit or WM_ENDSESSION). This meant that unexpected terminations like BSOD, power failure, or Task Manager kills would cause complete buffer loss, even though tab layout was preserved by the 5-minute timer. This change: - Extracts buffer persistence into a new `_persistBuffers()` function - Calls `_persistBuffers()` on the existing 5-minute persistence timer - Refactors `_finalizeSessionPersistence()` to use the shared function Now buffer content is saved every 5 minutes alongside layout, protecting users running long-lived sessions (Claude Code, SSH, development environments) from losing hours of terminal history on crash. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
|
@microsoft-github-policy-service agree |
The irony of Microsoft's own spell checker not recognizing "BSOD" (Blue Screen of Death) - a term coined specifically for Windows crashes - is not lost on anyone. 😅 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Had to add a second commit to appease the spell checker gods. 📝 The irony here is chef's kiss — Microsoft's own CI spell checker flagging "BSOD" as an unknown word. You know, Blue Screen of Death... the thing Windows has been (in)famous for since Windows 3.1? I get it, we're trying to move past that reputation, but denying its existence in the dictionary feels like revisionist history. 😄 The term is now safely enshrined in |
I appreciate your contribution, but don't be weird about it. It's not in the dictionary because it is not used in this codebase. The spell checker is maintained by a non-Microsoft person, hosted in a non-Microsoft repository, as non-Microsoft property, and the dictionaries only get updated as needed when somebody wants to use an unusual term of art. |
Summary
This PR adds periodic buffer persistence to protect against unexpected termination (BSOD, power failure, Task Manager kill).
Fixes #19804
The Problem
Previously, terminal buffer content was only persisted on graceful exit:
WM_ENDSESSION(graceful OS shutdown)The 5-minute persistence timer only saved layout (tabs, panes, positions), not buffer content. This meant:
Users running long-lived sessions (Claude Code, SSH, development environments) would lose hours of terminal history on crash, even though tabs appeared to be "restored."
The Solution
_persistBuffers()function_persistBuffers()on the existing 5-minute persistence timer_finalizeSessionPersistence()to use the shared functionNow buffer content is saved every 5 minutes alongside layout.
Validation Steps Performed
_finalizeSessionPersistence()maintains cleanup behavior_persistBuffers()respectsFirstWindowPreference::PersistedLayoutAndContentsettingPR Checklist
🤖 Generated with Claude Code