VS Code: make session Delete recoverable (confirm + restore + reconcile from disk)

Open 💬 0 comments Opened Jul 9, 2026 by Eric-SHENNONGSHI

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet (closest are closed: #45424, #57937; related open: #71500, #29017)
  • [x] This is a single feature request

Summary

In the VS Code extension, "Delete" on a session in the Claude sessions sidebar is a permanent, unrecoverable, UI-only hide — with no confirmation, no undo, and no way to get the session back from within the product, even though the underlying transcript is never actually deleted.

Root cause (confirmed on extension 2.1.205, VS Code / Linux)

Deleting a session sends a delete_session message and appends the session id to:

Anthropic.claude-code  ->  hiddenSessionIds   (in VS Code GLOBAL state.vscdb)

The transcript at ~/.claude/projects/<encoded-dir>/<id>.jsonl is not removed — claude --resume <id> from the CLI still opens it fine. But the sidebar filters the id out via hiddenSessionIds globally and permanently. Editing the per-workspace agentSessions.model.cache does nothing, because this global list overrides it.

Net effect: a user who clicks "Delete" (reasonably expecting either a confirmation or a recycle-bin) silently loses all in-product access to a fully-intact conversation, with no discoverable way back.

This is the same mechanism previously documented in #45424 (last comment) and #57937 — both now closed (one as stale), so there is currently no open, focused request tracking the recovery story.

What should happen (proposed, in priority order)

  1. Confirmation on delete, clearly distinguishing hide from list vs. permanently delete the transcript on disk. Today the destructive-sounding action silently does the non-destructive thing, and there is no path back.
  2. A restore affordance — an Undo toast and/or a "Show hidden / Recently deleted" view that removes the id from hiddenSessionIds.
  3. Reconcile from disk: if a .jsonl exists on disk but is only hidden, surface it (e.g. in a greyed "deleted" section) rather than filtering it out forever. This would also help the externally-created-session problems in #71500 and #58002.
  4. Scope hiddenSessionIds per project (per #57937) so hiding a session in one project doesn't hide a same-id transcript in another.

Current workaround (for anyone who lands here)

The data is not lost. Fully quit VS Code (it rewrites global storage on exit), then remove the id from hiddenSessionIds in the global state DB and reopen:

  • Linux: ~/.config/Code/User/globalStorage/state.vscdb
  • macOS: ~/Library/Application Support/Code/User/globalStorage/state.vscdb
  • Windows: %APPDATA%\Code\User\globalStorage\state.vscdb
import sqlite3, json
DB = "<path to global state.vscdb>"
SID = "<your-session-id>"
con = sqlite3.connect(DB); cur = con.cursor()
row = cur.execute("SELECT value FROM ItemTable WHERE key='Anthropic.claude-code'").fetchone()
d = json.loads(row[0])
d["hiddenSessionIds"] = [x for x in d.get("hiddenSessionIds", []) if x != SID]
cur.execute("UPDATE ItemTable SET value=? WHERE key='Anthropic.claude-code'", (json.dumps(d),))
con.commit()

(Back up the DB first. The session then reappears in the sidebar and is resumable.)

Environment

  • Extension: anthropic.claude-code 2.1.205
  • VS Code on Linux (mechanism is platform-independent; same keys on macOS/Windows)

View original on GitHub ↗