[FEATURE] Auto-restore editor-area Claude sessions across VS Code window reload
Summary
When a Claude Code session is opened in the editor area (Claude Code: Open in New Tab / Claude Code: Open in Primary Editor) and the VS Code window is reloaded (Developer: Reload Window), the session content disappears entirely but the editor tab remains as a locked placeholder (chat-session lock icon visible). The CLI process is killed and the webview is not deserialized back into a working state.
Bottom Terminal-panel Claude sessions persist correctly across the same reload, so the gap is specific to editor-area sessions.
The infrastructure for automatic restore already appears to exist in the extension:
registerWebviewPanelSerializer+deserializeWebviewPanelare both wiredrecentSessionsis persisted inglobalStateclaude-vscode.reopenClosedSession(Cmd/Ctrl+Shift+T) restores correctly when invoked manually
...but it is only triggered by the manual keyboard shortcut, not automatically on extension activation when surviving locked placeholder tabs are present.
Reproduction
claudeCode.useTerminal: true,claudeCode.preferredLocation: "panel",workbench.editor.autoLockGroups.workbench.editor.chatSession: truein user settings.- Command Palette →
Claude Code: Open in New Tab(or use the keyboard shortcut to open in the primary editor). - Have a brief exchange with Claude so a session is established.
Developer: Reload Window(Cmd+R).
Expected: session restored automatically, equivalent to what happens for terminal-panel Claude sessions today.
Actual: editor tab survives with a chat-session lock icon, but the CLI/webview content is gone. Cmd+Shift+T (claude-vscode.reopenClosedSession) restores the session manually — it does the right thing, it just isn't called on activation.
Related issues
- #35022 (CLOSED, March 2026) —
deserializeWebviewPanelignored saved sessionId, tabs showed wrong content. Different failure mode (wrong content, not full disappearance). - #59202 (OPEN, May 14 2026) — regression of #35022 in 2.1.141: webview stuck on "Thinking". Different failure mode (stuck rather than vanished).
- #31696 (CLOSED, March 2026) — tabs lost on transient API/network outages. Different trigger (network, not window reload).
This report is specifically about editor-area session content disappearing on window reload while the locked tab remains.
Suggested fix scope
The persistence layer (recentSessions in globalState) and the manual restore command (claude-vscode.reopenClosedSession) already work. The missing trigger is automatic re-attachment on activate() when locked chat-session placeholder tabs are detected.
Possible approaches:
- On
activate(), enumerate surviving editor tabs registered asworkbench.editor.chatSession, look them up inrecentSessions, and call the existingclaude-vscode.reopenClosedSessionflow per tab. - For
useTerminal: trueeditor-area sessions, wire VS Code's terminal-persistent-sessions handler to re-launchclaude --resume <sessionId>against the preserved sessionId and re-bind the editor-area terminal to that PTY. - Strengthen
WebviewPanelSerializer.deserializeWebviewPanelto re-launch the CLI subprocess and re-bind it to the deserialized panel.
Given the existing infrastructure, approach (1) looks like a small change at activation time.
Environment
anthropic.claude-code: 2.1.139 (darwin-arm64)- VS Code: 1.121.0 (commit f6cfa2ea2403534de03f069bdf160d06451ed282, darwin arm64)
- macOS: Darwin 25.5.0
- Hardware: Apple Silicon (M-series)
- Relevant settings:
claudeCode.useTerminal: trueclaudeCode.preferredLocation: "panel"claudeCode.enableReopenClosedSessionShortcut: trueworkbench.editor.autoLockGroups."workbench.editor.chatSession": trueterminal.integrated.enablePersistentSessions: true (VS Code default)
Current workarounds
Cmd/Ctrl+Shift+T(claude-vscode.reopenClosedSession) — manual, works reliably- Open Claude in side bar — sidebar webviews restore more reliably than editor-area panels
- Open Claude in Terminal panel — VS Code's terminal persistence handles panel terminals correctly today
claude --continue/claude --resumefrom any terminal — re-attaches to server-side session
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗