warp icon indicating copy to clipboard operation
warp copied to clipboard

Windows: tabs are individually closed and discarded when the OS restarts with Warp open

Open CtrlJason opened this issue 3 months ago • 6 comments

Describe the bug

On Windows, when the machine is restarted (or shut down) while Warp is open, Warp's shutdown path closes each tab individually instead of closing the window with its tabs intact. Because each close is recorded as a user-initiated tab close (storing data for closed tab), the tabs are removed from the restorable session, and the next launch restores almost nothing.

Closing Warp manually before restarting preserves everything. Being hard-killed also preserves everything. Only the graceful OS-shutdown path loses the session — the opposite of what you would expect.

Evidence

Warp log (%LOCALAPPDATA%\warp\Warp\data\logs\warp.log.old.0), end of session:

2026-08-18T13:33:28Z [INFO] storing data for closed tab      (x5, all in the same second)
2026-08-18T13:33:28Z [INFO] No windows left, terminating app
2026-08-18T13:33:28Z [INFO] Deferred autoupdate applied, terminating app

Windows Event Log, System, event ID 1074 (local time is UTC-5):

18/08/2026 8:33:27 a. m.  1074  process StartMenuExperienceHost initiated the restart of the computer

Warp closed all 5 tabs one second after the user clicked Restart in the Start menu. The app then terminated because it had no windows left. Next launch restored 1 terminal instead of 9.

Comparison across the 6 sessions present in the logs — the correlation is exact. Tabs survive unless they are closed, and the only session that lost them is the one where they were closed at the moment of shutdown:

session start terminals restored storing data for closed tab at shutdown next launch
2026-08-12 11:34Z 14 0 (its 6 were mid-session) restored 8
2026-08-12 19:00Z 8 0 restored 8
2026-08-13 11:35Z 8 0 restored 9
2026-08-17 11:41Z 9 0 restored 9
2026-08-18 11:29Z 9 5, same second as termination restored 1

Two of those sessions (13→15 Aug, 17→18 Aug) ended in an unclean kill — Windows events 6008/41, no application will terminate in the log — and still restored 8 and 9 terminals. So an abrupt kill preserves the session while the OS-shutdown path destroys it.

The two restarts on 12 Aug did not lose anything because Warp had already been closed by the user 93 s and 18 s before the 1074 event.

Pinning does not protect anything: the pinned tab_group ("Personal", pinned = 1) survived in warp.sqlite, but the tabs inside it were closed and dropped.

Not the autoupdate

The log line Deferred autoupdate applied, terminating app appears in that shutdown, but no update actually happened: the version string is identical before and after (v0.2026.08.05.09.03.stable_01), warp.exe still has its 7 Aug timestamp, and all 139 rows of __diesel_schema_migrations ran on install day (11 Aug). Mentioning it in case the deferred-update path is what selects the tab-by-tab close branch.

To reproduce

  1. Open Warp with several tabs.
  2. Restart Windows from the Start menu without closing Warp first.
  3. Let Warp launch again.
  4. The tabs are gone; the log shows one storing data for closed tab per tab, immediately before No windows left, terminating app.

Expected behavior

An OS-initiated shutdown should close the window with its tabs intact, the same way a manual window close does, so the session is restorable. A shutdown the user did not perform through Warp's own tab-closing UI should never be recorded as the user closing tabs.

Operating system

Windows 11 Pro 10.0.26200

Shell

pwsh (PowerShell 7)

Current Warp version

v0.2026.08.05.09.03.stable_01

Related issues

Not a duplicate of the ones I found: #3910 is macOS/2023 and the tabs survived there (only the working path was lost); #3394 is about window close on macOS; #9109 is about restoring tabs after closing them deliberately. None identifies the OS-shutdown path closing tabs one by one on Windows.

CtrlJason avatar Aug 18 '26 14:08 CtrlJason

@CtrlJason

Here's what I found while triaging this issue:

Thanks for the detailed logs. This looks like an actionable Windows-specific shutdown/session-restore bug: during graceful OS restart, tabs appear to be treated as closed rather than preserved for the next launch. I did not find enough matching existing issues to mark this as a duplicate.

Maintainer details

I concluded that windows OS restart while Warp is open can cause terminal tabs to be recorded as closed, leaving the next launch with an incomplete restored session..

Triage summary

This looks like an actionable Windows-specific bug in session/tab preservation during OS-initiated shutdown or restart. The report provides enough evidence to route without more reporter input: Warp v0.2026.08.05.09.03 on Windows 11 Pro 10.0.26200, a clear Start menu restart repro, and log correlation showing several storing data for closed tab entries immediately before No windows left, terminating app.

The likely implementation area is window/tab/session lifecycle handling rather than a shell-specific PowerShell issue. In the current code, terminal model exits can emit pane-group Exited, which Workspace::handle_file_tree_event turns into close_tab; Workspace::remove_tab records storing data for closed tab and dispatches workspace:save_app. Separately, the winit event loop's termination path currently documents that it cannot distinguish system-initiated termination and assumes TerminationRequestSource::User, while the macOS backend has explicit system-initiated termination handling. That makes Windows OS shutdown susceptible to flowing through ordinary tab/window close behavior before the app reaches ApplicationStage::Terminating.

Relevant areas to inspect:

  • crates/warpui/src/windowing/winit/event_loop/mod.rs: winit close and terminate request handling, including the user-vs-system termination assumption.
  • app/src/terminal/view.rs and app/src/pane_group/mod.rs: terminal exit to pane-group/tab exit propagation.
  • app/src/workspace/view.rs: tab removal, undo-close recording, and session-save dispatch.
  • app/src/lib.rs: app/window close callbacks, ApplicationStage::Terminating, and shutdown/autoupdate interaction.
  • app/src/workspace/global_actions.rs: persisted app-state snapshot saving.

I checked open issue candidates across the repository and recent closed candidates. #14328 and #13358 share Windows tab/session closure symptoms and the storing data for closed tab log line, but their triggers differ (resize/minimize-to-height-0 and WSL/Git/typing), and I did not find two sufficiently similar existing issues for duplicate classification.

This is my automated analysis and may be incorrect. A maintainer will verify the details.

Powered by Oz

warp-for-oss[bot] avatar Aug 18 '26 14:08 warp-for-oss[bot]

Note on provenance: this comment was produced by an AI agent analyzing the logs and database on my machine, cross-referenced against this repository's source. I am posting it as-is. The timeline, log lines and version numbers are taken verbatim from my own files, but please treat the interpretation as a hypothesis to verify rather than a confirmed diagnosis.

Another Windows repro, on v0.2026.08.19.08.15.stable_01 / Windows 11.

Timeline

Local time; log timestamps are UTC+0 (machine is UTC+8).

10:53:57  Event 1074 - StartMenuExperienceHost initiated the restart
10:54:16  Event 6006 - event log service stopped
10:54:47  Event 6005 - boot
10:55:23  warp.exe launched automatically (login_item)
10:55:25  SQLite error 283 (A WAL mode database file was recovered):
          recovered 183 frames from warp.sqlite-wal
10:55:25  dispatching global action for root_view:open_from_restored
10:55:26  window resized x3 + active window changed  -> 4x workspace:save_app
10:55:30  16x workspace:save_app
10:55:31  25x workspace:save_app
10:55:38  Creating terminal model with 0 restored blocks   <- the only one

Before the restart the workspace had 3 tab groups and 10 tabs. This is not from memory: an independent copy of warp.sqlite was taken at 10:51:39, three minutes before the restart, and it still contains them.

After the restart: 0 tab groups, 2 tabs, and the only surviving tab was Settings.

Creating terminal model and Shell is bootstrapped each appear exactly twice in the whole session, and the second occurrence is 69 seconds later (that one was me opening a tab by hand). So the restore produced a single terminal.

Two observations that may help narrow it down

The WAL recovery line. The 183 frames were committed by the pre-shutdown session and were recovered intact, so whatever the shutdown path wrote did reach disk. Combined with only one terminal being recreated, the snapshot that open_from_restored read appears to have been almost empty already at boot — which points at the tabs being discarded during the shutdown sequence rather than at startup.

45 saves land before the workspace exists. workspace:save_app is dispatched 45 times between 10:55:26 and 10:55:31, all of them before the first terminal model is created at 10:55:38. Since save_app_state unconditionally deletes 21 tables and re-inserts within one transaction (app/src/persistence/sqlite.rs:918-940), any save landing on a not-yet-populated workspace overwrites the single stored snapshot. There is no history table, no versioning and no backup, so one bad save is unrecoverable. The window events that trigger it (on_active_window_changed, on_window_moved, on_window_resized, on_window_will_close in app/src/lib.rs) all fire during startup.

In this incident the 13-second gap between open_from_restored and the first terminal was spent on cloud settings sync while the network was not up yet — the log shows settings_view::features_page::FeaturesPageAction::* being dispatched, plus repeated Failed to make response to firebase to fetch access token and Remote server rotate_auth_token: no auth_context available, skipping. That may explain why this reproduces on a laptop on Wi-Fi but not on a wired desktop, and possibly also why the one surviving tab was Settings.

Two things that look like red herrings

Both from reading the source, not from testing:

  • The Deferred autoupdate applied, terminating app line quoted in the original report is probably unrelated to the shutdown path. on_should_terminate_app returns early for TerminationRequestSource::System (app/src/lib.rs:2785), so a system-initiated restart never reaches apply_pending_update. In my logs that line only ever appears on a user-initiated quit.
  • quit_on_last_window_closed cannot be used as a workaround on Windows. It is hardcoded true via cfg!(any(target_os = "linux", target_os = "freebsd", windows)) in on_should_close_window (app/src/lib.rs:2739).

Workaround that does hold up

Force-killing warp.exe before restarting preserves the session, matching the original reporter's observation that unclean kills are harmless. A graceful OS shutdown is the only path that loses it. on_window_will_close returns early when stage() == ApplicationStage::Terminating (app/src/lib.rs:2916), which is presumably why a proper app-level quit is also safe, while the per-window close path is not.

Impact

This is painful in daily use. Tab groups are the main way I organise work across several repositories, and they cannot be expressed in a Launch Configuration or a Tab Config today (#13898, #15252), so there is no config file to fall back on — the only copy lives in warp.sqlite, which is single-slot and destructively overwritten. Every OS restart is a coin flip, and recovering means hand-rebuilding the groups.

Really looking forward to a fix. Happy to attach the full warp.log, the pre-restart copy of warp.sqlite and the post-restart one if that would help.

yie1d avatar Aug 28 '26 03:08 yie1d

I frequently get my system rebooting overnight due to system updates, and this has to be the most annoying issue with Warp. My main use case of Warp is to have a visual hint of what I was doing across my various agent lead projects, so when it boots up blank or in a state from a week ago I lose that context.

adamhardy-recordpoint avatar Sep 10 '26 22:09 adamhardy-recordpoint

This is also an issue on Mac Tahoe and Golden Gate.

allenrchan avatar Sep 24 '26 10:09 allenrchan

This issue is killing me. Can you please set a higher priority on it. I like Warp, but I constantly looking for alternatives, because this one make it almost unusable for me. I am on v0.2026.11.18.08.17.stable_04 right now

andykirik avatar Nov 22 '26 01:11 andykirik

This issue is killing me. Can you please set a higher priority on it. I like Warp, but I constantly looking for alternatives, because this one make it almost unusable for me. I am on v0.2026.11.18.08.17.stable_04 right now

Yeah, I ended up forking it Andy and fixing it myself. I pushed a PR, but don't have time to jump through the hoops necessary to become a contributor.

adamhardy-recordpoint avatar Nov 22 '26 21:11 adamhardy-recordpoint