[BUG] deserializeWebviewPanel discards saved session ID — panel tabs always open blank on restart

Resolved 💬 9 comments Opened Mar 16, 2026 by BoostlyPeter Closed May 10, 2026

Description

When VS Code restores a Claude Code panel tab after restart, the saved session ID is available in the deserialized panel state but is explicitly discarded — passed as void 0 to setupPanel. The panel always opens a blank new session instead of restoring history.

This affects all platforms, not just Windows.

Root Cause

deserializeWebviewPanel receives the serialized panel state as L, which contains the sessionID the panel saved during its lifetime via setState(). However, the call to setupPanel ignores it:

// Current — session ID discarded:
B.setupPanel(H, void 0, void 0, W)
//               ^^^^^
//         L?.sessionID is available but never passed

// Should be:
B.setupPanel(H, L?.sessionID, void 0, W)

Variable names by version:

| Version | Current (broken) | Fixed |
|---------|-----------------|-------|
| v2.1.76 | B.setupPanel(H, void 0, void 0, W) | B.setupPanel(H, L?.sessionID, void 0, W) |
| v2.1.74 | q.setupPanel($, void 0, void 0, A) | q.setupPanel($, L?.sessionID, void 0, A) |

Steps to Reproduce

  1. Open VS Code with a Claude Code panel tab
  2. Have a conversation
  3. Close VS Code completely
  4. Reopen VS Code — the panel tab is restored by VS Code's serializer
  5. Observe: panel opens a blank new session instead of the previous conversation

Expected Behavior

The panel tab should restore the previous conversation. VS Code's registerWebviewPanelSerializer is specifically designed for this purpose — it serializes panel state on close and passes it back to deserializeWebviewPanel on restore. The session ID is already being saved correctly by the panel; it just needs to be passed through.

How initialSession enables history display

When setupPanel receives a non-null initialSession:

  1. It is embedded in the webview HTML as data-initial-session
  2. Webview init Path 2 is skipped (no new blank session created)
  3. Webview init Path 1 (inside listSessions().then()) calls activateSessionFromServer(sessionId)
  4. loadFromServer()getSession(sessionId) reads the .jsonl file → history displays

Without L?.sessionID, step 1 never happens and the panel always creates a new session.

Environment

  • Confirmed on v2.1.74 and v2.1.76
  • Affects all platforms (Windows, macOS, Linux)
  • Panel tabs only — sidebar uses a different code path (resolveWebviewView)

View original on GitHub ↗

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