VSCode extension 2.1.119: /clear routes to phantom session (webview sends session_id:"" in io_message)

Resolved 💬 2 comments Opened Apr 24, 2026 by EricDomeshek Closed Jun 1, 2026

Summary

In the Claude Code VS Code extension 2.1.119, typing /clear in the webview panel does not clear the session. Instead:

  1. A literal /clear user message is appended to the transcript.
  2. The backend runs a SessionStart:clear hook against a freshly invented session UUID (a phantom).
  3. 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_title carry the real session UUID in camelCase sessionId.
  • io_message (the user-input path, which /clear travels on) carries snake_case session_id and 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

  1. Open the Claude panel in VS Code (extension 2.1.119).
  2. Start any conversation.
  3. Type /clear.
  4. Observe: transcript not cleared; log shows io_message with session_id:"".

Reproduces 100% on two independent Macs with byte-identical bundled CLI binaries (md5 5a7d1122478a89aee9fc9cfe72d8133f).

Ruled out (not the cause)

  • iCloud-symlinked ~/.claude directory
  • Custom slash commands, plugin manifests, hooks in settings.json, ~/.claude.json overrides
  • VS Code workspace/global state.vscdb contents
  • PATH claude install (extension uses its bundled resources/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

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗