Skip to content

Agents window: external agent sessions are only discovered at startup; add refresh/rediscovery #335215

Open

Description

Type: Bug (with a feature ask at the end)

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

  1. Open the Agents window. Set the External filter to "All" (or "Last 7 Days").
  2. In a terminal, run claude in any directory, have a short conversation, exit.
  3. 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

  1. interconnectedMe commented on Oct 15, 2026

    @interconnectedMe

    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:

    • At startup, agenthost.log reports discovery 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.
    • The agent-host SQLite catalog contains 172 Claude sessions, all classified as external.
    • Three top-level Claude transcript files for this workspace, updated after agent-host startup this morning, have session IDs absent from that catalog.
    • The current Planning workspace's native session cache contains 144 agent-host-claude entries, all unarchived. Older sessions have therefore reached the native data model; this is not evidence of complete discovery failure.
    • The active profile explicitly sets chat.agentSessions.showExternal to last30Days, and the host configuration agrees. No saved provider-exclusion filter was found in the inspected state stores.

    Inspection of the shipped agentHostMain.js shows _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.

  2. added
    agent-host
    feature-request
    sessions-list
    on Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

agent-hostagents-windowfeature-requestsessions-list

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions