Repository navigation
Description
Type: Bug (with a feature ask at the end)
- VS Code Version: 1.136.2 (commit 88e44fa, x64)
- OS Version: Ubuntu 22.04.5 LTS (kernel 6.8.0-138-generic)
- Agent: Claude Code CLI (external sessions feature per https://code.visualstudio.com/docs/agents/run/agents-window and https://code.visualstudio.com/docs/agents/run/sessions/manage-sessions)
Summary
The Agents window discovers external agent sessions (e.g. Claude Code CLI sessions started in a terminal) only once, when the Agent Host starts. A session created after VS Code launches never appears in the sessions list — regardless of the External filter setting — until VS Code is fully restarted. Changing chat.agentSessions.showExternal only reconciles the sessions already discovered at startup; it does not rescan disk.
Steps to reproduce
- Open the Agents window. Set the External filter to "All" (or "Last 7 Days").
- In a terminal, run
claudein any directory, have a short conversation, exit. - Look for the new session in the Agents window sessions list.
Expected: the new external session appears (it is on disk under ~/.claude/projects/...).
Actual: it never appears. Toggling the External filter or the Claude filter does not help. After restarting VS Code, the session appears as expected.
Evidence from agenthost.log
(timestamps are local time, UTC+8)
Discovery ran exactly once, at window startup (10:24):
2026-09-09 10:24:26.108 [info] [AgentService] discovery for provider claude: 119 candidate(s) (119 external), 0 registered, 58 already registered, 60 suppressed as subagent/chat backing, 1 skipped as older than 30 days
The terminal Claude session in question was created at 15:24 (five hours after that scan) and was therefore never registered. Later filter changes only reconciled already-known sessions — note there is no new discovery for provider claude line:
2026-09-09 15:29:20.685 [info] [AgentService] showExternalSessions changed 'last30Days' -> 'recent'; queueing session list reconciliation
2026-09-09 15:29:21.097 [info] [AgentService] External session reconciliation done in 411ms (mode: 'recent', previous: 'last30Days'): 2 published, 64 retracted, 2 visible
2026-09-09 15:31:59.269 [info] [AgentService] showExternalSessions changed 'recent' -> 'last30Days'; queueing session list reconciliation
2026-09-09 15:31:59.654 [info] [AgentService] External session reconciliation done in 384ms (mode: 'last30Days', previous: 'recent'): 62 published, 0 retracted, 64 visible
Feature ask
Either (or both) of:
- A refresh action in the Agents window sessions list that re-runs external session discovery on demand.
- Automatic rediscovery — periodic rescan or a file watcher on the known external session catalogs (
~/.claude/projects,~/.copilot, Codex equivalents), so sessions started while VS Code is running show up without a restart.
From a user's perspective the current behavior looks like the session is simply lost — the docs say external sessions are discoverable via the filter, but no filter value can surface a session created after launch.
— Claude (posted on Eric's behalf via Claude Code)
Activity
interconnectedMe commentedon Oct 15, 2026
Follow-up from 2026-10-15 on Ubuntu/Linux x64, now running VS Code 1.142.0 (
6d62b1d5dace93a33b3a6d3eca1317bd5e15bcb1) with Claude Code extension 2.1.300.Today's symptom is that newly created Claude sessions are missing from the native Chat Sessions sidebar. The user reports that, as far as they can tell, all of today's sessions are absent; we did not manually inspect the entire older history.
Read-only inspection found:
agenthost.logreportsdiscovery for provider claude: 172 candidate(s) (172 external), 0 registered, 172 already registered, 0 suppressed as subagent/chat backing, 0 skipped as older than 30 days.agent-host-claudeentries, all unarchived. Older sessions have therefore reached the native data model; this is not evidence of complete discovery failure.chat.agentSessions.showExternaltolast30Days, and the host configuration agrees. No saved provider-exclusion filter was found in the inspected state stores.Inspection of the shipped
agentHostMain.jsshows_startClaudeCodeChatDiscovery()memoizing its discovery promise after success, without a periodic scan or filesystem watcher in that path. The native list store's refresh also returns early once its cache is valid. This is consistent with new external Claude sessions remaining undiscovered after startup.We have not restarted the local agent host or fully restarted VS Code during this investigation, so recovery by restart has not yet been verified on this installation. The upstream test plan #331122 recommends Developer: Restart Local Agent Host when new external sessions are not discovered.
This appears to reproduce the startup-only discovery problem reported here in 1.142.0. Related local-history report: #340573.