fix(ports): say direct SSH hosts don't support port detection yet (#33055)

The host-scoped port scan reported 'Remote connection dropped' for every
direct-SSH workspace even with a healthy connection: the relay has no port
scan, so the connection was never the problem. Name the real limitation
and point at an Orca server on the host, which scans its own ports.
This commit is contained in:
Neil
2026-10-24 00:09:58 -07:00
committed by GitHub
parent d9eabac536
commit 156f3f4ef0
3 changed files with 11 additions and 8 deletions
@@ -2,6 +2,7 @@ import { afterEach, describe, expect, it, vi } from 'vitest'
import {
killWorkspacePortOnExecutionHost,
scanWorkspacePortsOnExecutionHost,
SSH_PORT_SCAN_UNSUPPORTED_REASON,
type WorkspacePortExecutionHostDeps
} from './workspace-port-execution-host'
import type { WorkspacePortScanResult } from '../../shared/workspace-ports'
@@ -69,7 +70,8 @@ describe('scanWorkspacePortsOnExecutionHost', () => {
expect(scanWorkspacePortsMock).not.toHaveBeenCalled()
expect(result).toMatchObject({ executionHostId: 'ssh:box', ports: [] })
expect(result.unavailableReason).toMatch(/Reconnect/)
expect(result.unavailableReason).toBe(SSH_PORT_SCAN_UNSUPPORTED_REASON)
expect(result.unavailableReason).not.toMatch(/dropped|Reconnect/)
})
it('refuses a workspace hosted by another server instead of scanning here', async () => {
@@ -9,7 +9,6 @@ import type {
WorkspacePortKillResult,
WorkspacePortProbe
} from '../../shared/workspace-ports'
import { SSH_HOST_NOT_SERVED_MESSAGE } from '../providers/ssh-host-not-served-error'
import { killWorkspacePort, scanWorkspacePortProbes } from './workspace-port-ownership'
export type WorkspacePortExecutionHostDeps = {
@@ -17,6 +16,9 @@ export type WorkspacePortExecutionHostDeps = {
getLocalProbes: () => Promise<WorkspacePortProbe[]>
}
export const SSH_PORT_SCAN_UNSUPPORTED_REASON =
"Port detection isn't available for direct SSH hosts yet. Move this project to an Orca server on this host to see its ports."
function unavailable(executionHostId: string, reason: string): WorkspacePortHostScanResult {
return {
executionHostId,
@@ -36,12 +38,10 @@ export async function scanWorkspacePortsOnExecutionHost(
if (host?.kind === 'local') {
return { ...(await scanWorkspacePortProbes(await deps.getLocalProbes())), executionHostId }
}
// Why: this process serves no SSH host, so its listeners are unavailable, never "none".
// Why: this process serves no SSH host, so its listeners are unavailable, never "none". Not a
// dropped connection: the relay has no port scan, but an Orca server on the host scans as local.
if (host?.kind === 'ssh') {
return unavailable(
executionHostId,
`Could not scan the SSH host: ${SSH_HOST_NOT_SERVED_MESSAGE}`
)
return unavailable(executionHostId, SSH_PORT_SCAN_UNSUPPORTED_REASON)
}
return unavailable(executionHostId, 'This workspace does not run on this server.')
}
@@ -1,6 +1,7 @@
import './rpc/unused-default-rpc-methods.test-fixture'
import { afterEach, describe, expect, it, vi } from 'vitest'
import { OrcaRuntimeWithListManagedWorktrees } from './workspaces/managed-workspace-operations'
import { SSH_PORT_SCAN_UNSUPPORTED_REASON } from '../ports/workspace-port-execution-host'
const scanWorkspacePortsMock = vi.hoisted(() => vi.fn())
@@ -38,7 +39,7 @@ describe('host-scoped workspace port scans on the server', () => {
expect(runtime.host.resolveRuntimeFileTarget).toHaveBeenCalledWith('folder:fw-1')
expect(scanWorkspacePortsMock).not.toHaveBeenCalled()
expect(result).toMatchObject({ executionHostId: 'ssh:box', ports: [] })
expect(result.unavailableReason).toMatch(/Reconnect/)
expect(result.unavailableReason).toBe(SSH_PORT_SCAN_UNSUPPORTED_REASON)
})
it('refuses Stop when the workspace now resolves to a different host than the row', async () => {