[FEATURE] Auto-restore editor-area Claude sessions across VS Code window reload

Resolved 💬 3 comments Opened May 20, 2026 by info618 Closed Jun 20, 2026

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 + deserializeWebviewPanel are both wired
  • recentSessions is persisted in globalState
  • claude-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

  1. claudeCode.useTerminal: true, claudeCode.preferredLocation: "panel", workbench.editor.autoLockGroups.workbench.editor.chatSession: true in user settings.
  2. Command Palette → Claude Code: Open in New Tab (or use the keyboard shortcut to open in the primary editor).
  3. Have a brief exchange with Claude so a session is established.
  4. 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) — deserializeWebviewPanel ignored 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:

  1. On activate(), enumerate surviving editor tabs registered as workbench.editor.chatSession, look them up in recentSessions, and call the existing claude-vscode.reopenClosedSession flow per tab.
  2. For useTerminal: true editor-area sessions, wire VS Code's terminal-persistent-sessions handler to re-launch claude --resume <sessionId> against the preserved sessionId and re-bind the editor-area terminal to that PTY.
  3. Strengthen WebviewPanelSerializer.deserializeWebviewPanel to 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: true
  • claudeCode.preferredLocation: "panel"
  • claudeCode.enableReopenClosedSessionShortcut: true
  • workbench.editor.autoLockGroups."workbench.editor.chatSession": true
  • terminal.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 --resume from any terminal — re-attaches to server-side session

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗