VS Code: panel-hosted chat not restored after reload when idle >10 min (restore_declined)

Status Open
Reported on v2.1.246
Maintainer reply None cached
Activity 0 comments · opened Aug 27, 2026

Summary

In the VS Code extension, a chat hosted in the Claude panel/sidebar is not restored after a window reload (VS Code update restart, Developer: Reload Window, crash) if the session was last switched to more than 10 minutes earlier. The webview emits update_panel_host_session {kind:"restore_declined"} and opens an empty new chat. Chats opened as editor tabs are unaffected (VS Code serializes them and passes initialSession).

Lost the panel chat this way 4 times in 6 days (logs: restore_declined on 08-22, 08-23, 08-25, 08-27). The transcript is intact on disk; only the panel forgets it.

Root cause (webview/index.js, identical in 2.1.246 and 2.1.247)

function LF1($,J){if(!$)return!1;return J===void 0||Date.now()-J<zX0}   // zX0=600000
...
A=LF1(J.value.sessionID,J.value.sessionUpdatedAt)?J.value.sessionID:void 0
...
else if(A){ ...find session... } else M(),D(P)   // D => restore_declined

sessionUpdatedAt is written only by the effect on z.activeSession.value (i.e. when the active session changes), not on message activity. A chat you have been working in continuously for hours is therefore "stale" the moment the window reloads. The 10-minute window looks intended to avoid resurrecting an abandoned chat, but it fires on the most active chat as well.

Expected

Panel-hosted session restored on reload the same way editor-tab sessions are (or at least: staleness measured from the session's last message / transcript mtime, not from the last tab switch).

Repro

  1. Open Claude in the panel (claudeCode.preferredLocation: panel), chat for >10 min without switching sessions.
  2. Developer: Reload Window.
  3. Panel shows a fresh empty chat; extension log shows restore_declined for the previous sessionId.

Env

VS Code 1.135.0 (08d4889f), macOS 25.5 arm64, anthropic.claude-code 2.1.246 → 2.1.247 (both reproduce).

Local workaround: patching the constant to a large value restores correctly.

View original on GitHub ↗