[BUG] VS Code/Cursor: Claude editor tabs vanish after a reload while the (remote) extension host is down, and panelTabSessions prunes them instead of restoring them
Summary
In the VS Code extension, Claude chats open as editor tabs can disappear for good if the window reloads while the extension host is down. This happens, for example, after a Remote-WSL or Remote-SSH extension host dies. The transcripts stay intact on disk; only the tabs are lost.
The extension already keeps the list it would need to recover them (panelTabSessions in workspace state). On activation it prunes every remembered session that has no matching tab and writes the pruned list back, so the fallback is erased at exactly the moment it is needed.
On my machine this cost 33 of 65 open chat tabs in one reload. I recovered them by hand (workaround below).
Environment
- Extension:
anthropic.claude-code2.1.292 (linux-x64), running in the remote extension host - Editor: Cursor 3.17.8 (VS Code 1.128 base) on Windows, Remote-WSL (Ubuntu)
- Setup: about 65 Claude chats open as editor tabs (
claudeCode.preferredLocation: "panel", viewTypeclaudeVSCodePanel)
What happened
- The WSL service failed. The window's
renderer.logshowsWsl/ERROR_SERVICE_DISABLED, then "Remote extension host exited … permanent disconnection". No extension host ran for about 5 minutes. - The window was reloaded during that gap.
- After the reload, 32 Claude tabs came back and 33 were gone. Every missing session's
.jsonltranscript was intact.
Root cause
There are two parts. The first is in the editor and the second is in the extension.
1. The editor drops webview tabs that have no live reviver when it saves the layout.
- The webview serializer's
shouldPersistkeeps a tab when it is a revived webview input (openRevivedWebview, i.e. restored at the last window load) or when a reviver for its viewType is currently registered. - Revivers are registered by the extension host. While it is down,
EditorGroupModel.serialize()silently skips every Claude tab created withcreateWebviewPanelsince the last window load. Upstream VS Code has the same logic (webviewWorkbenchService.shouldPersist). - Tabs that were restored at the previous window load survive.
2. The extension prunes its own manifest instead of using it.
- On activation,
this.rememberedTabSessions = getPanelTabSessions(), thenreconcileRememberedTabSessionsruns. - A helper (minified
mM1in 2.1.292) drops every remembered session whose title matches no open Claude tab:if(!X.has(z.title))continue. persistPanelSessions()then writes the bound panels plus the pruned list back topanelTabSessions.- So the sessions the editor failed to save are forgotten permanently.
Evidence
All from the workspace state.vscdb and its WAL. I rebuilt the 44 committed versions after the reload.
- The two lists agree exactly. At the first post-reload checkpoint, the saved editor layout and
panelTabSessionshold the same 32 session ids. The editor dropped the tabs; the extension only mirrored that. - The split matches the
shouldPersistrule. All 32 survivors had transcripts that started before the last full window load, so they were restored (revived) tabs. 25 of the 33 lost sessions started after it, so they were plaincreateWebviewPaneltabs. - It is not the 10-minute rule from #90095. Every saved Claude editor-tab state contains only
{isFullEditor, sessionID}, with nosessionUpdatedAt.
Expected repro (not yet run as a clean test)
- In a Remote-WSL or Remote-SSH window, open a Claude chat in a new editor tab.
- Take the remote extension host down, e.g.
wsl --shutdown. - Reload the window.
Tabs opened since the last window load vanish, and the sessions also disappear from panelTabSessions. Tabs that were restored at the previous window load survive.
Suggested fix
- In the extension: do not drop remembered sessions that have no tab at activation (the editor may have dropped them). Remove an entry only when the user closes its tab or its transcript is gone. Then reopen those sessions, e.g. in their recorded group with
preserveFocus, or offer "Reopen N Claude tabs that were not restored".panelTabSessionsalready is the manifest #100708 asks for. - Upstream (separate report for microsoft/vscode / Cursor):
shouldPersistcould keep webview tabs whose viewType has anonWebviewPanel:activation event, even when no reviver is live yet.
Workaround (works today, no reload needed)
claude-vscode.primaryEditor.open accepts a session id and opens it in a new tab (it reveals an existing tab instead of duplicating it). A keybinding can open many at once:
{ "key": "ctrl+alt+shift+1", "command": "runCommands",
"args": { "commands": [
{ "command": "claude-vscode.primaryEditor.open", "args": "<session-id>" },
{ "command": "claude-vscode.primaryEditor.open", "args": "<session-id>" } ] } }
To find the session ids, use recent .jsonl transcripts that have no open tab, or older panelTabSessions values still present in the workspace database's free pages.
Related
- #100708: feature request; same symptom over Remote-SSH
- #90095: 10-minute
restore_declinedrule; panel-hosted chats only, a different cause - #79760, #82878, #64756: other restore problems after a host restart or reconnect, all closed
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗