diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.ts index 00ca47f5dd..b4d34eb356 100644 --- a/apps/desktop/electron/main.ts +++ b/apps/desktop/electron/main.ts @@ -144,6 +144,7 @@ import { updateEligibility, upsertConnection } from './connection-registry' +import { activeRegistrySshScope } from './active-ssh-route' import { describeCrashReason, installCrashForensics } from './crash-forensics' import { adoptServedDashboardToken } from './dashboard-token' import { loadOrCreateInstallationId, sshOwnershipId } from './desktop-installation' @@ -9520,6 +9521,13 @@ async function teardownSshConnection(profile) { function activeSshTerminalTarget() { const profile = primaryProfileKey() const config = readDesktopConnectionConfig() + const registryScope = activeRegistrySshScope(readDesktopConnectionsRegistry(), profile) + + if (registryScope) { + const state = sshConnections.get(registryScope) + + return state && state.ssh ? { ssh: state.ssh, scope: registryScope } : 'pending' + } if (profileSshOverride(config, profile)) { const scope = sshScopeKey(profile) @@ -9538,7 +9546,6 @@ function activeSshTerminalTarget() { if (config.mode === 'ssh') { const state = sshConnections.get('') - return state && state.ssh ? { ssh: state.ssh, scope: '' } : 'pending' }