Skip to content

feat(ssh): forward ServerAlive values so the agent drops dead connections - #1203

Draft
EhabY wants to merge 1 commit into
fix/vsc-8-ssh-g-remote-commandfrom
feat/ssh-client-alive-env
Draft

EhabY wants to merge 1 commit into
fix/vsc-8-ssh-g-remote-commandfrom
feat/ssh-client-alive-env

Conversation

@EhabY

@EhabY EhabY commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Stacked on #1197, which forwards the session type with SendEnv.

Sends the resolved ServerAliveInterval and ServerAliveCountMax (from ssh -G, so user overrides apply) to the agent as CODER_SSH_CLIENT_ALIVE_INTERVAL and CODER_SSH_CLIENT_ALIVE_COUNT_MAX, added to SendEnv. With coder/coder#32444, the agent closes a connection whose client stopped answering on that schedule, so a window that crashed or lost power no longer shows as "Ongoing" in the connection log for days. VS Code reconnects over a fresh connection after sleep, so closing the dead one loses nothing.

The variables are set after ssh -G, separately from applySshEnvironment, which has to stay early because workspace start runs the CLI with that environment. Older agents ignore them and pass them to the session environment.

Verification
$ pnpm test:extension
 Test Files  146 passed | 1 skipped (147)
      Tests  2854 passed | 6 skipped (2860)
$ pnpm test:webview
      Tests  514 passed (514)
$ pnpm typecheck && pnpm lint && pnpm format:check
(all pass)

The new applyClientAliveEnvironment test fails when dispose stops removing its variables.

Written with Coder Agents and reviewed by @EhabY.

@EhabY
EhabY added this pull request to stack #1204 November 19, 2026 12:42
@linear-code

linear-code Bot commented Nov 20, 2026

Copy link
Copy Markdown

VSC-55

@EhabY
EhabY force-pushed the feat/ssh-client-alive-env branch from bc50e01 to 64da3e0 Compare November 20, 2026 11:26

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant