[VSCode] Session Manager lists a worktree-relocated session but opens a blank tab for it (2.1.258); resume of a deleted-worktree session leaves the transcript stranded
Environment
- VS Code extension
anthropic.claude-code2.1.258 (darwin-arm64), auto-updated 2026-09-01 23:21 BRT - Claude Code CLI 2.1.258
- VS Code 1.135.0, macOS (Darwin 25.6.0)
Summary
The Session Manager sidebar lists a session whose transcript EnterWorktree relocated into a worktree project dir, but clicking it opens a blank tab under the same title, with no message. Second, related: --resume of a session whose worktree directory was deleted clears the worktree binding but leaves the transcript in the dead worktree's project dir, so it stays invisible to the extension.
What happens (read from the 2.1.258 bundle and the extension-host log)
- A session started in the workspace folder calls
EnterWorktree. Per worktrees.md the transcript follows: it moves to~/.claude/projects/<cwd-key>--claude-worktrees-<name>/<id>.jsonlwith"type":"relocated"records. - The session dies while inside the worktree (window reload, closed tab, or the extension's own auto-update restarting every session).
readSessionList()inextension.jscalls the session lister withincludeWorktrees:!1(the lister's own default istrue; no setting exposes it). The webview'sactivateSessionFromServer(id)runslistSessions("activate"), does not find the id, reportsupdate_panel_host_session {kind:"restore_declined"}, and the panel issueslaunch_claudewith noresume— a brand-new empty session in that tab.- The sidebar still shows the entry because live session state (
update_session_statetitle/state) is kept in memory; only the disk lookup behind the click misses.
Log excerpt (Claude VSCode.log):
open_in_editor sessionId=<id>
list_sessions_request entryPoint:"activate"
update_panel_host_session {"kind":"restore_declined","sessionId":"<id>"}
launch_claude ... freshStartIfUnresumable:false
Spawning Claude with SDK query function - cwd: <workspace>, ... resume: undefined
On this machine every restore_declined event in all five extension-host logs (8 of 8, 2026-08-29 → 09-02) named a worktree-relocated transcript; none named a main-dir session. The tengu_vscode_resume_precheck path (checkResumable) never ran in these windows, so it is not involved.
Repro
- In VS Code, start a session in a git workspace and have it call
EnterWorktree. - Reload the window (Developer: Reload Window) while the session is inside the worktree.
- Click that session in the Session Manager → empty tab, no notice.
~/.claude/projects/<cwd-key>--claude-worktrees-<name>/<id>.jsonlis intact.
Second defect
claude --resume <id> from the workspace folder, for a session whose worktree directory was deleted, resumes in the launch directory and clears the binding as documented, but the transcript stays in the dead worktree's project dir (new records append there). A subsequent ExitWorktree answers "No-op — no active EnterWorktree session", so the session remains invisible to the extension. Workaround that worked: resume, call EnterWorktree with a throwaway name, then ExitWorktree — the transcript comes home and the throwaway is cleaned up.
Related
- CHANGELOG 2.1.207: "Fixed background sessions that entered a git worktree resuming blank after a cold reopen from the agent list" — same class, different path.
- CHANGELOG 2.1.248: "[VSCode] Fixed a chat tab getting stuck on 'No conversation found' when its session was never saved; it now starts a new conversation instead" — this is the silent-fresh-tab behaviour seen here, applied to a session that was saved, just elsewhere.
Expected: the Session Manager's activate path resolves sessions the same way --resume does (worktree project dirs included), or the click surfaces "not found here" instead of a fresh tab.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗