Files
vscode/cli
Connor Peet 56fe549585 agent host: lenient protocol negotiation + CLI-driven server upgrades
Replaces the exact-match version check in `ProtocolServerHandler._handleInitialize`
with a semver-caret negotiator (`negotiateProtocolVersion`) that picks the
highest offered version compatible with the server.

When negotiation still fails and the agent host was spawned by a managing
VS Code CLI (signalled by the new `VSCODE_AGENT_HOST_MANAGEMENT_SOCKET`
env var), the `UnsupportedProtocolVersion` error advertises a
`_meta.vscodeUpgradeMethod = "_vscodeUpgrade"` hint. The client can then
invoke that method on the same transport (callable pre-`initialize`) to
request a server upgrade.

The CLI runs a hyper-based HTTP control server on a unix socket / named
pipe. `POST /upgrade` synchronously downloads the latest release, returns
a serde-derived response (`{ok, upgradeNeeded, upgradeStarted,
runningCommit, latestCommit, restartDelayMs, error}`), and then schedules
a kill+respawn after a 3 s drain delay so the response can hop back
through the proxy before the transport drops. Single-flight via
`upgrade_in_progress: AtomicBool`; the listener is started lazily from
`AgentHostManager::start_server`.

UI:
- `RemoteAgentHostConnectionStatus.incompatible` carries `vscodeUpgradeMethod`
  (read from `_meta`).
- A `watchForIncompatibleNotifications` autorun on each provider raises a
  one-shot warning notification on transition into `incompatible`, with
  "Update Server" (when the host advertised it) and "Show Options"
  primary actions.
- `runServerUpgrade` is shared between the notification action and the
  per-host quickpick. It drives a progress notification with a per-second
  "Restarting in Ns..." countdown and observes `connectionStatus` so it
  bails out if some other code path is already reconnecting.
2026-05-15 21:34:22 -07:00
..