Skip to content

Commit acd4f22

Browse files
committed
impl: enhanced workflow for 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.
1 parent 60cbfe9 commit acd4f22

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## Unreleased
44

5+
### Changed
6+
7+
- improved workflow when network connection is flaky
8+
59
## 0.5.2 - 2025-07-22
610

711
### Fixed

src/main/kotlin/com/coder/toolbox/CoderRemoteProvider.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,17 +166,17 @@ class CoderRemoteProvider(
166166
context.logger.error(ex, "workspace polling error encountered, trying to auto-login")
167167
if (ex is APIResponseException && ex.isTokenExpired) {
168168
WorkspaceConnectionManager.shouldEstablishWorkspaceConnections = true
169+
close()
170+
// force auto-login
171+
firstRun = true
172+
context.envPageManager.showPluginEnvironmentsPage()
173+
break
169174
}
170-
close()
171-
// force auto-login
172-
firstRun = true
173-
context.envPageManager.showPluginEnvironmentsPage()
174-
break
175175
}
176176
}
177177

178178
// TODO: Listening on a web socket might be better?
179-
select<Unit> {
179+
select {
180180
onTimeout(POLL_INTERVAL) {
181181
context.logger.trace("workspace poller waked up by the $POLL_INTERVAL timeout")
182182
}

0 commit comments

Comments
 (0)