Repository navigation
Conversation
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Non-PTY SSH sessions (
ssh -T, used by VS Code Remote-SSH and other editors) keep their process running after the client leaves, matching OpenSSH (#18519). The disconnect was only reported when that process exited, so connection log rows stayed "Ongoing" while the editor's server or a foreground loop kept running.The session handler now also reports the disconnect (reason
client_closed) when the SSH connection closes, whichever comes first. The report still happens at most once and before the handler returns. Process lifetime is unchanged.Not covered here: a client that disappears without closing TCP (sleep,
kill -9) is only detected by the server keep-alive, which currently closes the session but not the connection. That fix is incoder/sshand will follow with a fork bump.Verification
TestSSHShutdownReason/ClientDisconnectWhileProcessRuns(exec sleep 120, client closes) fails onmainand passes with this change.A throwaway repro (non-PTY
bashsession, client closes, disconnect reported within 3s):while true; do sleep 1; donesleep 1000 &(holds stdout)sleep 1000 </dev/null &>/dev/null &Decision log
session.Context()is per connection, so a session closed on a still-open multiplexed connection still reports on process exit, as before.CODER_AGENT_SSH_MAX_TIMEOUT(default 72h, so one probe per 24h). Shortening it is a separate change.Written with Coder Agents and reviewed by @EhabY.