diff --git a/src/main/ports/workspace-port-execution-host.test.ts b/src/main/ports/workspace-port-execution-host.test.ts index 7d1cefd9088..1ccd842b35b 100644 --- a/src/main/ports/workspace-port-execution-host.test.ts +++ b/src/main/ports/workspace-port-execution-host.test.ts @@ -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 () => { diff --git a/src/main/ports/workspace-port-execution-host.ts b/src/main/ports/workspace-port-execution-host.ts index df1a477857c..759eecb8839 100644 --- a/src/main/ports/workspace-port-execution-host.ts +++ b/src/main/ports/workspace-port-execution-host.ts @@ -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 } +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.') } diff --git a/src/main/runtime/orca-runtime-workspace-ports-host.test.ts b/src/main/runtime/orca-runtime-workspace-ports-host.test.ts index 46378708d0e..9837a0c99a7 100644 --- a/src/main/runtime/orca-runtime-workspace-ports-host.test.ts +++ b/src/main/runtime/orca-runtime-workspace-ports-host.test.ts @@ -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 () => {