mirror of
https://github.com/stablyai/orca.git
synced 2026-10-22 16:03:47 +00:00
fix(terminal): disclose paired folder hosts
This commit is contained in:
@@ -5776,6 +5776,9 @@ export class OrcaRuntimeService {
|
||||
if (!workspace) {
|
||||
return null
|
||||
}
|
||||
if (workspace.executionHostId != null) {
|
||||
return parseExecutionHostId(workspace.executionHostId)?.id ?? null
|
||||
}
|
||||
const connectionId = this.resolveFolderWorkspaceConnectionId(workspace)
|
||||
return connectionId ? toSshExecutionHostId(connectionId) : LOCAL_EXECUTION_HOST_ID
|
||||
}
|
||||
@@ -5844,6 +5847,13 @@ export class OrcaRuntimeService {
|
||||
}
|
||||
const projectGroups = this.store?.getProjectGroups?.() ?? []
|
||||
for (const workspace of this.store?.getFolderWorkspaces?.() ?? []) {
|
||||
if (workspace.executionHostId != null) {
|
||||
const explicitHostId = parseExecutionHostId(workspace.executionHostId)?.id
|
||||
if (explicitHostId) {
|
||||
hostIds.add(explicitHostId)
|
||||
}
|
||||
continue
|
||||
}
|
||||
const connection = inferFolderWorkspacePathConnection({
|
||||
folderPath: workspace.folderPath,
|
||||
projectGroupId: workspace.projectGroupId,
|
||||
@@ -16733,6 +16743,9 @@ export class OrcaRuntimeService {
|
||||
const scopedHostId = targetWorktreeId
|
||||
? (resolvedTargetHostId ?? this.tryGetWorkspaceSessionHostIdForWorktree(targetWorktreeId))
|
||||
: null
|
||||
if (scopedHostId) {
|
||||
knownHostIds.add(scopedHostId)
|
||||
}
|
||||
const candidates = targetWorktreeId ? (scopedHostId ? [scopedHostId] : []) : knownHostIds
|
||||
// Paired runtimes own a separate control plane. Mirrored rows are evidence
|
||||
// for those rows only; this runtime cannot claim their complete inventory.
|
||||
|
||||
@@ -76,7 +76,7 @@ function makeRuntimeFolderWorkspace() {
|
||||
...makeSshFolderWorkspace(),
|
||||
id: 'folder-runtime',
|
||||
name: 'Runtime folder',
|
||||
connectionId: null,
|
||||
connectionId: 'stale-box',
|
||||
executionHostId: 'runtime:env-9' as const
|
||||
}
|
||||
}
|
||||
@@ -317,6 +317,23 @@ describe('listTerminals scope declaration', () => {
|
||||
expect(result.hostScope?.omittedHostIds).toEqual(['local', 'runtime:env-9'])
|
||||
})
|
||||
|
||||
it('keeps a paired-runtime folder owner omitted in an unscoped listing', async () => {
|
||||
const baseStore = makeStore()
|
||||
const folderWorkspace = makeRuntimeFolderWorkspace()
|
||||
const runtime = makeRuntime([], {
|
||||
...baseStore,
|
||||
getRepos: vi.fn(() => [REPOS[0]!]),
|
||||
getRepo: vi.fn((id: string) => (id === REPOS[0]!.id ? REPOS[0] : undefined)),
|
||||
getWorkspaceSessionHostIds: vi.fn(() => ['local']),
|
||||
getFolderWorkspaces: vi.fn(() => [folderWorkspace])
|
||||
})
|
||||
|
||||
const result = await runtime.listTerminals()
|
||||
|
||||
expect(result.hostScope?.hostIds).toEqual(['local'])
|
||||
expect(result.hostScope?.omittedHostIds).toEqual(['runtime:env-9'])
|
||||
})
|
||||
|
||||
it('keeps a disconnected SSH host omitted when only local inventory answered', async () => {
|
||||
const runtime = makeRuntime([])
|
||||
runtime.setPtyController({
|
||||
|
||||
Reference in New Issue
Block a user