Repository navigation
Description
Summary
After updating VS Code Insiders from 429a4ec to ff00e78, every existing Remote Agent Host session on my SSH host disappeared from the session list. Nothing was deleted. The agent host now starts with a different user data directory, so it opens an empty session index.
Environment
- Client: macOS, VS Code Insiders
ff00e788322523ee1e9e8ee2c9bb4b89af93a3c2 - Last good:
429a4ec703266abbd31f6886764e4127955bdc9d - Remote: Linux arm64 over SSH (Remote Agent Host via
code-insiders agent host)
Root cause
d3e4a86 (#340424, "cli: host agent servers as GitHub environments") changed AgentHostManager in cli/src/tunnels/agent_host.rs so the CLI now passes its own --user-data-dir through to the server it starts:
if let Some(a) = &self.config.user_data_dir {
cmd.arg("--user-data-dir");
cmd.arg(a);
}The CLI has always been launched on the remote as:
code-insiders-<commit> --cli-data-dir ~/.vscode-server-insiders/cli agent host --port 0 --new-instance --user-data-dir "~/.config/Code - Insiders" --idle-timeout 300
Before this change, that argument wasn't forwarded, so the server's agent host used the server default data directory. Now it is forwarded:
code-server-insiders args |
--type=agentHost --user-data-dir |
|
|---|---|---|
429a4ec (before) |
no --user-data-dir |
~/.vscode-server-insiders/data |
ff00e78 (after) |
--user-data-dir "~/.config/Code - Insiders" |
~/.config/Code - Insiders |
As a result, the new agent host starts with a fresh User/globalStorage/agent-host.db, a fresh agentSessionData/, and a default agent-host-config.json. All existing session state stays in ~/.vscode-server-insiders/data, where nothing reads it anymore.
User/globalStorage/agent-host.db |
sessions |
sessions_v2 |
|---|---|---|
~/.vscode-server-insiders/data (old) |
294 | 121 |
~/.config/Code - Insiders (new) |
0 | 0 |
Agent host log after the update:
[AgentService] sessions_v2 import for provider copilotcli: 0 synchronized, 0 current, 0 excluded, ...
[ProtocolServer] Request 'subscribe' failed Session not found: copilotcli:/<session-id>
The Copilot SDK sessions in ~/.copilot/session-state are still listed (Listed 122 SDK session(s)), but they no longer map to the agent host's index.
A side concern: ~/.config/Code - Insiders is also the user data directory of a desktop VS Code Insiders install on Linux. If the remote machine has one, the agent host would now share its User/ and globalStorage with it.
Steps to reproduce
- On a build from before d3e4a86, connect to a Linux SSH host with Remote Agent Host and create a few sessions.
- Update the client to a build that includes d3e4a86, then make sure the old agent host exits so a new one starts.
- The session list for that host is empty, and opening an existing session URI fails with
Session not found.
Expected
After an update, the agent host keeps using its existing data directory, or migrates it, so existing sessions stay visible.
Workaround
Point the new directory at the old one:
# stop the running `code-insiders-* agent host` process tree first
mv ~/.config/"Code - Insiders" ~/.config/"Code - Insiders.bak"
ln -s ~/.vscode-server-insiders/data ~/.config/"Code - Insiders"After reconnecting, the sessions are back: sessions_v2 import ... 105 synchronized, and the previously missing session opens.
Related
#340772 reports the same symptom (session index has zero rows after an update while the session data is intact) and may have the same root cause.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
agentHost: restore server data directory (#341172)
[1.142] agentHost: restore server data directory (#341171)