Skip to content

Copilot chat sessions created in agent ("Copilot") mode disappear from the Sessions panel on Remote-SSH #328736

Closed

Description

@cpeng77

VS Code version: 1.131.0
Copilot Chat extension version: 0.59.0
Remote: Remote-SSH to a Linux server (headless HPC login node)
OS (remote): Linux
Steps to Reproduce:

Describe the bug

When using VS Code with Remote-SSH, chats I create in the normal "Copilot" (agent) mode disappear from the Copilot Sessions panel shortly after creation — often as soon as the chat is no longer the active one, or after reloading the window. The chat's content is not actually lost (it's still on disk on the server), but it stops being listed, so I can't find or reopen it.

Chats created previously in "Copilot CLI" mode do not disappear — they stay listed and openable. But "Copilot CLI" is no longer accessable for new chats.

Root cause (what I found)

  1. Copilot CLI chats are written to a per-session directory containing an event log file (events.jsonl) under the CLI session-state folder. These show up in the Sessions panel.
  2. "Copilot" agent-mode chats are written to a different store (an agent-host session.db), and they get a row in the session registry database — but no events.jsonl is ever created for them.

The Sessions panel enumerates sessions via the CLI backend's session-listing, which only returns sessions that have a real events.jsonl with actual conversation events. Because agent-mode chats never get that file, they are never returned, so they silently disappear from the panel — even though their full content exists in the registry database and the agent-host store.

I confirmed the correlation is exact: every chat that has an events.jsonl is listed; every chat that lacks one is hidden, regardless of workspace, client name, or other metadata.

Activity

  1. Reduce395 commented on Aug 7, 2026

    @Reduce395

    I can reproduce this on a newer build, and I asked an agent to search around and come up with findings suggest an additional problem:

    Environment

    • Local OS: Windows x64
    • Remote OS: Windows x64
    • Connection: Remote-SSH
    • VS Code: 1.132.0
    • GitHub Copilot Chat: 0.60.0

    Important counterexample

    I have multiple sessions that disappear or become unavailable from the expected workspace even though each session has:

    • A populated events.jsonl
    • A valid workspace.yaml
    • A row in session-store.db
    • Indexed conversation turns

    For one affected session:

    • events.jsonl is approximately 3 MB.
    • The registry contains 13 turns.
    • workspace.yaml contains:
    cwd: c:\Development\notebook
    client_name: vscode-agent-host
    • The sessions table in session-store.db also contains:
    cwd = c:\Development\notebook
    

    Therefore, a missing events.jsonl is not a necessary condition for the session to disappear.

    Possible workspace-identity mismatch

    The persisted session metadata uses a normal Windows path:

    c:\Development\notebook
    

    However, the session provider exposes the same session with a synthesized Remote-SSH URI:

    vscode-remote://ssh-remote+<host>/c:/Development/notebook
    

    I tested session enumeration using both representations:

    workspace = C:\Development\notebook
    → no sessions
    
    workspace = vscode-remote://ssh-remote+<host>/c:/Development/notebook
    → affected sessions are returned
    

    Unfiltered enumeration also returns the sessions.

    This suggests a path-normalization or workspace-filtering mismatch:

    1. The session is persisted using the remote host’s native Windows path.
    2. The VS Code session provider exposes it using a vscode-remote URI.
    3. At least one Sessions-panel lookup appears to filter using the other representation.
    4. The valid session is consequently excluded from the panel.

    This behavior is consistent across several sessions, all with nonempty events.jsonl files.

    Agent Host startup evidence

    After both a window reload and a complete PC restart, agenthost.log begins with:

    [info] Agent Host process started successfully
    [error] CodeExpectedError: ENOPRO: No file system provider found for resource
    'vscode-userdata:/.../User'
    
    [error] CodeExpectedError: ENOPRO: No file system provider found for resource
    'vscode-userdata:/.../User/settings.json'
    

    It then reports:

    [Copilot] Listing sessions...
    [Copilot] Found 0 sessions
    

    The session files and registry rows remain present on disk at that time.

    I cannot prove that the ENOPRO error causes the session-filtering problem, but it occurs on every affected Agent Host startup and may be relevant to initialization order or workspace-provider registration.

    Suggested area to investigate

    Could the Sessions panel or Copilot session provider normalize both sides of the comparison before filtering?

    For Remote-SSH to a Windows host, these likely need to compare as the same workspace:

    c:\Development\notebook
    
    vscode-remote://ssh-remote+<authority>/c:/Development/notebook
    

    The current behavior appears to persist one form and enumerate/filter using the other. This would explain why sessions remain intact on disk but disappear from the workspace-scoped Sessions panel.

  2. RobotPsychologist commented on Aug 12, 2026

    @RobotPsychologist

    Any update on this? This is a critical issue for me, Github Copilot Chat is barely working for me on the system I SSH into. Any kind of reload, open/close of vscode causes the entire session history to disappear. New chats often don't give any responses and the session history shows a massive amount of code change even though no code change happened:

    Image

    If there is anything I can do to help diagnose this issue, please contact me, I'll walk through it with a developer. Thank you!

  3. Reduce395 commented on Aug 13, 2026

    @Reduce395

    Yep, even on 1.133 release the issue still exists. Still seeing the workspace trust show up beforehand even when the folder has already been trusted, and most times the chat logs disappear; typically after a full close and reopen of the ssh folder. Also file links in ssh from the chat (like Read readme.txt, where you can click on it) opens a file not found error (the wrong path is used, it uses the device's path instead of the ssh path). I think the hooks view is also impacted by the same issue.

    Anyway, for this specific issue, it seems vscode insiders is working more reliably.

  4. RobotPsychologist commented on Aug 13, 2026

    @RobotPsychologist

    Yep, even on 1.133 release the issue still exists. Still seeing the workspace trust show up beforehand even when the folder has already been trusted, and most times the chat logs disappear; typically after a full close and reopen of the ssh folder. Also file links in ssh from the chat (like Read readme.txt, where you can click on it) opens a file not found error (the wrong path is used, it uses the device's path instead of the ssh path). I think the hooks view is also impacted by the same issue.

    Anyway, for this specific issue, it seems vscode insiders is working more reliably.

    I can confirm having all of those exact issues. It makes me unable to directly see the code changes from agents. I need to do everything through git diffs, which is a problem for untracked files. Also the "Agents" window cannot connect to any ssh folder.

    Are you also noticing the massive number of line changes? Seems like they just build up more and more over time and between chats. After reinstall vscode the missing sessions bug went away (the old ones didn't come back mind you). Was the Accept/Reject feature deprecated pattern now or is that also a bug related to this? (I wasn't doing coding related work a lot in July).

  5. Reduce395 commented on Aug 13, 2026

    @Reduce395

    Yeah, the agents not being able to connect to any ssh folder has been a long-time issue. I just assumed it wasn't supported. And the issue with the file links in chat is really annoying too. I don't think that is a vscode issue, more of a github copilot chat extension.

    I also did a full reinstall of vscode and it seems the missing session bugs hasn't happened yet (knock on wood). I did notice the massive number of line changes, but I think it mainly was caused by not clicking the keep/undo button after the edits were made in the old version of the chat. So once more and more changes built up, it compared to that last snapshot with all the changes made since then, which is a huge amount. After they removed the keep/undo feature, it just became a stale indicator. After reinstall, that issue went away.

  6. rcortez-intel commented on Aug 22, 2026

    @rcortez-intel

    Confirming with additional evidence: Also hit this on Remote-SSH to a Linux host, triggered by an SSH connection drop/reconnect. Same symptom — several agent-mode chat sessions (spanning multiple days, dozens of turns each) no longer appear in the Sessions panel.

    I confirmed the underlying data is intact: on the remote host, the Copilot Chat extension's own transcript logs (GitHub.copilot-chat/transcripts/.jsonl) still contain the full turn-by-turn conversation (user messages, assistant messages, tool calls) with correct timestamps for every "missing" session. So this matches the reported root cause — it's a panel enumeration/filtering bug, not actual data loss. Would be great to get a fix, since there's currently no supported way for a user to recover/relist these from the UI.

  7. jacob5567 commented on Aug 26, 2026

    @jacob5567

    Confirming this on Remote-SSH as well, and I think I can pin down the exact code responsible — it reconciles the two theories in this thread (missing events.jsonl vs. workspace/path mismatch).

    Environment

    • VS Code 1.134.0 (stable), Remote-SSH to Ubuntu 22.04.5 LTS from Windows 11
    • Copilot Chat extension 0.62.0
    • Same symptom: chats created in "Copilot" (agent) mode never appear in the Chat Sessions view; "Local"/CLI-mode and terminal copilot sessions do.

    Root cause: the Chat Sessions provider explicitly excludes Agent Host sessions

    The Copilot CLI session provider drops any session whose clientName is vscode-agent-host (which is what "Copilot"/agent-mode chats are tagged with), before any workspace, origin, or events.jsonl consideration.

    In extensions/copilot/src/extension/chatSessions/copilotcli/node/copilotcliSessionService.ts (1.134.0):

    const AGENT_HOST_COPILOT_CLIENT_NAME = 'vscode-agent-host';

    In the listing path:

    // Skip sessions the agent host already lists (both surfaces share `~/.copilot/session-state/`).
    const sessionsWithoutAgentHostClientName = sessionMetadataList.filter(
        metadata => metadata.clientName !== AGENT_HOST_COPILOT_CLIENT_NAME);
    const agentHostOwnedSessionIds = sessionsWithoutAgentHostClientName.length > 0
        ? await this._getAgentHostOwnedSessionIds(agentHostDataDir)
        : new Set<string>();
    
    const diskSessions = coalesce(await Promise.all(
        sessionMetadataList.map(async (metadata) => {
            const sanitizedSessionId = metadata.sessionId.replace(/[^a-zA-Z0-9_.-]/g, '-');
            if (metadata.clientName === AGENT_HOST_COPILOT_CLIENT_NAME || agentHostOwnedSessionIds.has(sanitizedSessionId)) {
                return;   // <-- agent-mode sessions are dropped here, unconditionally
            }
            ...
            if (!await this.shouldShowSession(metadata.sessionId, metadata.context)) {
                return;   // workspace/origin filtering only happens AFTER the drop above
            }
            ...
        })));

    There's an equivalent early-return on the single-session construction path:

    if (metadata.clientName === AGENT_HOST_COPILOT_CLIENT_NAME) {
        return;
    }

    Permalinks (1.134.0):

    I checked the tags and this exclusion (same constant, same two checks) is present unchanged in 1.131.0, 1.132.0, 1.133.0 and 1.134.0 — i.e. every version reported in this thread. In 1.131.0 it's here:

    with the shouldShowSession() call right after the listing exclusion at copilotcliSessionService.ts#L542.

    Why this explains the whole thread

    • It matches the OP exactly: agent-mode (vscode-agent-host) chats are never listed.
    • It explains Reduce395's counterexample. That affected session had client_name: vscode-agent-host and a ~3 MB events.jsonl with 13 turns, yet was still hidden. A missing events.jsonl therefore isn't the necessary condition — the clientName filter is. Every affected session in this thread carries client_name: vscode-agent-host, which is precisely the value this code filters on.
    • It explains why toggling "show external sessions" doesn't help: github.copilot.chat.cli.showExternalSessions is only consulted inside shouldShowSession() (the origin check), which runs after the clientName drop. So that setting can never bring agent-host sessions back.

    The workspace/path-normalization mismatch Reduce395 describes (native path vs. vscode-remote:// URI in shouldShowSession()) may well be a second, separate bug affecting foreground/vscode-origin sessions — but it isn't what hides agent-mode chats, because those are removed by the clientName filter before shouldShowSession() ever runs.

    Corroborating local evidence (not the cause, just consistent with it)

    • Of the vscode-agent-host sessions on my machine, 0 of 9 appear in the Copilot CLI per-cwd index (~/.copilot/sidebar-sessions-state/<sha256(cwd)>.json), whereas github/cli and vscode client types do appear (subject to workspace filtering).
    • Agent-mode sessions are served by a CLI launched in headless stdio mode (--headless --stdio --no-auto-login); their transcripts are still written to ~/.copilot/session-state/<id>/events.jsonl, so as others noted, this is a listing/visibility bug, not data loss.

    Suggested fix / question

    Is the clientName === 'vscode-agent-host' (and agentHostOwnedSessionIds) exclusion intended? The comment says it's to avoid double-listing "sessions the agent host already lists" — but on Remote-SSH the Agents window can't attach to the SSH workspace, so those sessions end up listed nowhere the user can reach. If the intent is de-duplication, the exclusion should probably be conditional on the Agent Host actually being able to surface the session in the current window; otherwise these sessions need to remain visible in the Chat Sessions view.

  8. added
    bug
    agent-host
    on Aug 28, 2026
  9. added this to the 1.137.0 milestone on Sep 1, 2026
  10. roblourens commented on Sep 1, 2026

    @roblourens
    Member

    I think I see the problem here. Sorry for the slow reaction, but should be fixed in 1.137

  11. roblourens commented on Sep 1, 2026

    @roblourens
    Member

    Fixed by #333251

  12. RobotPsychologist commented on Sep 3, 2026

    @RobotPsychologist

    Thank you roblourens I just updated to 1.136.1, ssh'ing into a Linux system and all of my old conversations seem to have reappeared:

    Version: 1.136.1
    Commit: a44adf7
    Date: 2026-09-03T05:06:41Z
    Electron: 42.10.0
    ElectronBuildId: 15109253
    Chromium: 148.0.7778.280
    Node.js: 24.18.1
    V8: 14.8.178.38-electron.0
    @github/copilot: 1.0.81-0
    @github/copilot-sdk: 1.0.11
    OS: Linux x64 6.8.0-138-generic

  13. added
    verified
    on Sep 4, 2026
  14. RobotPsychologist commented on Sep 12, 2026

    @RobotPsychologist

    After upgrading to 1.137.0 from 1.136.1 it appears that the issue has been reintroduced. Anyone else having this problem again?

  15. locked and limited conversation to collaborators on Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent-hostbugverified

Type

No type

Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions