[BUG] deserializeWebviewPanel discards saved session ID — panel tabs always open blank on restart
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
- Open VS Code with a Claude Code panel tab
- Have a conversation
- Close VS Code completely
- Reopen VS Code — the panel tab is restored by VS Code's serializer
- 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:
- It is embedded in the webview HTML as
data-initial-session - Webview init Path 2 is skipped (no new blank session created)
- Webview init Path 1 (inside
listSessions().then()) callsactivateSessionFromServer(sessionId) loadFromServer()→getSession(sessionId)reads the.jsonlfile → 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)
This issue has 9 comments on GitHub. Read the full discussion on GitHub ↗