-
Notifications
You must be signed in to change notification settings - Fork 1
impl: enhanced workflow for network disruptions #162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Currently, when the network connection drops, the Coder TBX plugin resets itself, redirects users to the authentication page, and terminates active SSH sessions to remote IDEs. This disrupts the user experience, forcing users to manually reconnect once the network is restored. Additionally, since the SSH session to the remote IDE is lost, the JBClient is unable to re-establish a connection with the remote backend. This PR aims to improve that experience by adopting a behavior similar to the SSH plugin. Instead of clearing the list of workspaces or dropping existing SSH sessions during a network outage, we retain them. Once the network is restored, the plugin will automatically reinitialize the HTTP client and regenerate the SSH configuration—only if the number of workspaces has changed during the disconnection—without requiring user intervention.
Adds support for remembering SSH connections that were not manually disconnected by the user. This allows the plugin to automatically restore those connections on the next startup enabling remote IDEs that remained open to reconnect once the SSH link is re-established.
if (isManual) { | ||
// if the user manually disconnects the ssh connection we should not connect automatically | ||
context.settingsStore.updateAutoConnect(this.id, false) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this choice? If the user manually disconnects and then connects again, we should still try to resume the last active connection if possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you take a look at beforeConnection
we set auto-connect to true. In other words:
- user connects the ssh, and then TBX is closed -> at the next restart we automatically reconnect.
- user connects to the ssh, manually disconnects and then TBX is closed -> at the next restart we no longer reconnect automatically because the user made a conscious choice to disconnect.
- user connects to the ssh, manually disconnects, then reconnects again the ssh session, and then TBX is closed -> at the next restart we automatically reconnect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a few questions and suggestions.
Tested on macOS with both Coder Desktop and without, and the connection seems to recover gracefully. I noticed some delay (5-10s) in showing |
This looks like it is under JetBrains control. I can reproduce the same thing with the SSH plugin. The "Connecting" is a state from from JetBrains. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I tested and it works as expected.
Auto connect will now happen everytime at start up if there is a url and token available.
Reason for the major change: major changes in how we handle network disruptions
Currently, when the network connection drops, the Coder TBX plugin resets itself, redirects users to the authentication page, and terminates active SSH sessions to remote IDEs. This disrupts the user experience, forcing users to manually reconnect once the network is restored. Additionally, since the SSH session to the remote IDE is lost, the JBClient is unable to re-establish a connection with the remote backend.
This PR aims to improve that experience by adopting a behavior similar to the SSH plugin. Instead of clearing the list of workspaces or dropping existing SSH sessions during a network outage, we retain them. Once the network is restored, the plugin will automatically reinitialize the HTTP client and regenerate the SSH configuration—only if the number of workspaces has changed during the disconnection—without requiring user intervention.
Additionally we also add support for remembering SSH connections that were not manually disconnected by the user. This allows the plugin to automatically restore those connections on the next startup enabling remote IDEs that remained open to reconnect once the SSH link is re-established.