[BUG] [VSCode-Ext] Ghost webviews from AGENT_TEAMS sessions cause message rendering loss
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Environment
| Component | Version |
|-----------|---------|
| Claude Code + Ext | 2.1.38 (linux-x64) |
| VSCode | 1.109.0 (Stable) |
| Node.js (vscode-server) | v20.19.2 |
| Remote-SSH | 0.122.0 |
| OS (server) | Debian 13 / Linux 6.17.2 (LXC) |
| OS (client) | Windows 11 |
Setup: VSCode on Windows → Remote-SSH → Linux container. Claude Code extension runs server-side.
After enabling and then disabling CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS, sessions created while the flag was active retain corrupted webview state. When these old sessions are reopened (or remain in the VSCode sidebar), they spawn ghost webview instances that compete with legitimate webviews for the React rendering pipeline. This causes ~50% of assistant messages and tool results to disappear from the chat UI.
The bug persists even after the experimental flag is removed. The only workaround is to close all old sessions and use only freshly created ones.
Critical details:
- The team ran in in-process mode (default VSCode behavior) — this is what corrupts the webviews
- The bug affects ALL chats, not just the TeamAgent-era ones. Having even one old team session in the sidebar pollutes the rendering for every chat
- Even though TeamDelete was called and the team was properly shut down, the webview corruption persists in the session state
Actual Behavior
- 5 AuthManager initializations instead of 1 (for 3 open chats):
````
2026-02-10 13:51:57.880 [info] AuthManager initialized ← chat 1
2026-02-10 13:51:57.880 [info] AuthManager initialized ← ghost
2026-02-10 13:51:57.880 [info] AuthManager initialized ← ghost
2026-02-10 13:53:36.078 [info] AuthManager initialized ← chat 2
2026-02-10 13:54:26.883 [info] AuthManager initialized ← chat 3
- 5 webview init requests for 3 chats (3 fire within 220ms at startup — 2 are ghosts):
````
2026-02-10 13:51:58.437 [info] Received message from webview: {...,"request":{"type":"init"}}
2026-02-10 13:51:58.559 [info] Received message from webview: {...,"request":{"type":"init"}}
2026-02-10 13:51:58.656 [info] Received message from webview: {...,"request":{"type":"init"}}
2026-02-10 13:53:36.554 [info] Received message from webview: {...,"request":{"type":"init"}}
2026-02-10 13:54:27.452 [info] Received message from webview: {...,"request":{"type":"init"}}
- Messages and tool results flicker and disappear during live rendering
- After restarting VSCode, all messages reappear (they're in the conversation history, just not rendered)
- With heavy tool use (10+ tool calls per turn), only ~2 tool results remain visible
What Should Happen?
- Disabling
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMSshould fully deactivate TeamAgent infrastructure - Old sessions should not spawn extra webview instances when reopened
- Each chat should have exactly 1 webview and 1 AuthManager
Error Messages/Logs
Steps to Reproduce
- Enable
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS(viaclaudeCode.environmentVariablesin settings or env) - In a Claude Code VSCode chat, the agent autonomously calls TeamCreate to spawn a local team using in-process mode (default in VSCode). Example sequence:
```
# Step 1: Claude calls TeamCreate
TeamCreate:
team_name: "my-test-team"
description: "3 Sonnet analysts for parallel analysis"
agent_type: "coordinator"
# Step 2: Claude spawns 3 teammates in parallel (single message)
Task: { subagent_type: "general-purpose", model: "sonnet", name: "analyst-1", team_name: "my-test-team", run_in_background: true }
Task: { subagent_type: "general-purpose", model: "sonnet", name: "analyst-2", team_name: "my-test-team", run_in_background: true }
Task: { subagent_type: "general-purpose", model: "sonnet", name: "analyst-3", team_name: "my-test-team", run_in_background: true }
# Step 3: Claude sends shutdown to each teammate
SendMessage: { type: "shutdown_request", recipient: "analyst-1" }
SendMessage: { type: "shutdown_request", recipient: "analyst-2" }
SendMessage: { type: "shutdown_request", recipient: "analyst-3" }
# Step 4: TeamDelete after shutdown confirmation
```
- End the session or let the team finish its work. The team was properly shut down and deleted via TeamDelete.
- Disable
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS(remove the env var entirely) - Keep the old team session(s) visible in the VSCode sidebar / past conversations
- Open any new Claude Code chat — messages and tool results will intermittently disappear
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
1.109.0
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Other
Additional Information
Close all sessions created while AGENT_TEAMS was active, then open only fresh sessions:
- Close every Claude Code chat in the sidebar
- Open a single new chat — rendering works correctly
- Never reopen old TeamAgent-era sessions — they will re-trigger the ghost webviews
Root Cause Hypothesis
Old sessions appear to store webview configuration referencing the TeamAgent messaging infrastructure (team inboxes, member routing). When these sessions are restored by VSCode, the extension re-initializes their webviews — but the TeamAgent infrastructure no longer exists, creating orphaned webview instances that:
- Register with the extension's AuthManager (causing duplicate inits)
- Send
initrequests to the extension host (creating phantom rendering contexts) - Compete with legitimate webviews for message delivery, causing React state desynchronization
The webview state seems to be persisted in VSCode's session storage (not in ~/.claude/), which is why deleting ~/.claude/teams/ alone doesn't fix the issue.
What Was Tried (Did NOT Fix)
| Action | Result |
|--------|--------|
| Remove CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS env var | No effect |
| Delete ~/.claude/teams/ directory | No effect |
| Update Claude Code 2.1.37 → 2.1.38 | No effect |
| Remove old extension 2.1.37 installation | No effect |
| Clear VSCode cache (~/.vscode-server/data/CachedData/) | No effect |
| Disable PostToolUse hooks | No effect |
| Set claudeCode.useTerminal: true | Works (terminal mode bypasses webview), but not a real fix |
| Disable remote.SSH.experimental.chat | No effect |
Additional Context
- PendingMigrationError: 5 instances of
navigator is now a global in nodejsappear at startup (3 from Claude Code extension.js at lines 59, 149, 563; 2 from Remote-SSH 0.122.0). These are non-blocking but may be related to the webview initialization path. See: https://aka.ms/vscode-extensions/navigator
- Remote-SSH: The bug was tested in a Remote-SSH context. It's unclear whether it also occurs in local-only setups.
claudeCode.useTerminal: true: Using terminal mode instead of webview completely avoids the issue, confirming the bug is in the webview rendering layer.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗