Remote agent host keeps running an old build after the server updates
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
I hit a stuck chat on an SSH remote. The cause was that the remote had two different server builds installed, and the agent host was running the old one.
- Window and extension host: server build `2858b712ee42c88ca4a444010691338c6d01a096` (Aug 27)
- Agent host (`agentHostMain.js`): server build `0052619e71feb774a574b37f4f2ea20c36547373` (Aug 23)
The protocol version still matched, so the client happily connected to a host that was 4 days behind it.
Two things went wrong because of that.
**1. Every connect failed.** This showed up three times while opening the window:
```
[RemoteAgentHostProtocol] Request 2 failed: {"code":-32603,"message":
"ProviderCatalogUnavailableError: Provider claude cannot enumerate its native session catalog yet
at _migrateLegacyProviderChats (.../vs/platform/agentHost/node/agentHostMain.js)"}
```
The old build throws there. Current code returns `AgentChatMigrationDeferred` instead. That change landed in 2858b712, which is the exact commit the window server was already on.
**2. The old server folder was already deleted from disk.** Anything loaded with a dynamic import failed:
```
Cannot find package 'yazl' imported from .../vs/platform/agentHost/node/agentHostMain.js
```
`yazl` is a real dependency and has been for years. It just cannot resolve because the folder it was installed in is gone. Code already in memory kept running, so the process stayed alive in a broken state instead of exiting.
That also meant Export Agent Host Debug Logs could not collect anything from the host:
```
[ExportAgentHostDebugLogs] Failed to collect Agent Host logs: ... ; exporting client-owned logs only
```
So the export had no `events.jsonl`, no AHP logs, no `agenthost.log`, and no SDK logs, which are the files you actually need to debug this.
### Two suggestions
The endpoint registry in `cli/src/tunnels/agent_host_registry.rs` only tracks schema version, protocol version, and quality. It does not track the build commit, so a host from any older commit of the same quality gets reused forever. Recording the commit and refusing to reuse a mismatched host would prevent this.
There is also no way to restart a remote agent host from the UI. `restartAgentHost` is stubbed out in `editorRemoteAgentHostServiceClient.ts` since the remote owns the lifecycle. I had to ssh in and kill the process by hand to recover.
Contributor guide
Assessment
This issue has not been assessed yet.