VSCode extension 2.1.119: /clear routes to phantom session (webview sends session_id:"" in io_message)
Summary
In the Claude Code VS Code extension 2.1.119, typing /clear in the webview panel does not clear the session. Instead:
- A literal
/clearuser message is appended to the transcript. - The backend runs a
SessionStart:clearhook against a freshly invented session UUID (a phantom). - The real session — UI, transcript, backend conversation state — is untouched.
Each failed /clear also leaves a ~15,719-byte orphan .jsonl in ~/.claude/projects/<workspace-slug>/.
Root cause (from extension log)
Inside a single panel session, the webview sends two kinds of messages with inconsistent session-id fields:
update_session_state,get_session_request,generate_session_titlecarry the real session UUID in camelCasesessionId.io_message(the user-input path, which/cleartravels on) carries snake_casesession_idand it is always"".
Example from my log (~/Library/Application Support/Code/logs/<ts>/window<n>/exthost/Anthropic.claude-code/Claude VSCode.log):
Received message from webview: {"type":"io_message","channelId":"ltkpcwbdkbg","message":{"type":"user","uuid":"3180fabe-...","session_id":"","parent_tool_use_id":null,"message":{"role":"user","content":[{"type":"text","text":"/clear"}]}},"done":false}
The same panel simultaneously sends update_session_state messages with a real sessionId like 138e792d-c46d-4a5b-8aa2-e340780da07d — so the webview knows the session UUID, it just fails to include it in the io_message payload.
Reproduction
- Open the Claude panel in VS Code (extension 2.1.119).
- Start any conversation.
- Type
/clear. - Observe: transcript not cleared; log shows
io_messagewithsession_id:"".
Reproduces 100% on two independent Macs with byte-identical bundled CLI binaries (md5 5a7d1122478a89aee9fc9cfe72d8133f).
Ruled out (not the cause)
- iCloud-symlinked
~/.claudedirectory - Custom slash commands, plugin manifests, hooks in
settings.json,~/.claude.jsonoverrides - VS Code workspace/global
state.vscdbcontents - PATH
claudeinstall (extension uses its bundledresources/native-binary/claude)
The plain-terminal claude CLI's /clear works normally with the same ~/.claude config, which points to a webview-side defect rather than a backend or config issue.
Workaround
The "+" new-conversation button in the Claude panel tears down and replaces the current session (new channelId), producing a usable fresh session. However, the new session's io_message still sends session_id:"" — the underlying bug is unfixed, /clear remains broken inside the new session too. "+" is a substitute for /clear, not a fix.
The Command Palette's "Chat: New Claude Session" opens a pane but returns "Language model unavailable" when typed into (separate issue — extension is registered as a chat participant but no vscode.lm.* language-model provider is available).
Related
Possibly adjacent: #26794 (/clear sets SessionStart hook source to startup instead of clear) — that's a hook-parameter bug; this is a routing bug where /clear never reaches the real session at all.
Environment
- Claude Code VS Code extension: 2.1.119 (
anthropic.claude-code-2.1.119-darwin-arm64) - VS Code: 1.117.0, commit
10c8e557c8b9f9ed0a87f61f1c9a44bde731c409, arm64 - macOS: 26.3.1 (build 25D2128)
- Reproduces on two Macs independently
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗