fix: SSH connection is terminated when agent is marked as disconnected/timed out #247
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.
For a bit of context Coder Toolbox can establish an SSH connection when the workspace
is in RUNNING state and agent is in READY state. If the connection is already established
but for some reason the agent does not respond to pings, then the connection is terminated
by signaling Toolbox that the workspace changed the overall status to a non-reachable state.
In reality the connection can still work. After some code research and testing it looks like
coder ssh waits for the agent to be connecting before establishing the ssh connection. This
allows us to mark the workspace as reachable as soon as it hits the RUNNING state regardless
of the agent status.
The PR also changes the log level from debug to info for the lines that report the workspace and agent status.
This change should help with faster debugs in the future. Logs will not be spammed every 5 seconds with
this report, instead the line will be logging only when the workspace build changes.