mirror of
https://github.com/stablyai/orca.git
synced 2026-10-23 00:03:52 +00:00
fix(terminal): preserve paired folder host scope
This commit is contained in:
@@ -16716,9 +16716,13 @@ export class OrcaRuntimeService {
|
||||
queriedHostIds,
|
||||
targetWorktreeId !== FLOATING_TERMINAL_WORKTREE_ID
|
||||
)
|
||||
let resolvedTargetHostId: ExecutionHostId | null = null
|
||||
for (const worktree of worktrees) {
|
||||
if (worktree.hostId) {
|
||||
knownHostIds.add(worktree.hostId)
|
||||
if (worktree.id === targetWorktreeId) {
|
||||
resolvedTargetHostId = worktree.hostId
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const terminal of terminals) {
|
||||
@@ -16727,7 +16731,7 @@ export class OrcaRuntimeService {
|
||||
}
|
||||
}
|
||||
const scopedHostId = targetWorktreeId
|
||||
? this.tryGetWorkspaceSessionHostIdForWorktree(targetWorktreeId)
|
||||
? (resolvedTargetHostId ?? this.tryGetWorkspaceSessionHostIdForWorktree(targetWorktreeId))
|
||||
: null
|
||||
const candidates = targetWorktreeId ? (scopedHostId ? [scopedHostId] : []) : knownHostIds
|
||||
// Paired runtimes own a separate control plane. Mirrored rows are evidence
|
||||
|
||||
@@ -70,6 +70,16 @@ function makeSshFolderWorkspace() {
|
||||
}
|
||||
}
|
||||
|
||||
function makeRuntimeFolderWorkspace() {
|
||||
return {
|
||||
...makeSshFolderWorkspace(),
|
||||
id: 'folder-runtime',
|
||||
name: 'Runtime folder',
|
||||
connectionId: null,
|
||||
executionHostId: 'runtime:env-9' as const
|
||||
}
|
||||
}
|
||||
|
||||
type GraphLeaf = { worktreeId: string; leafId: string; ptyId: string }
|
||||
|
||||
function makeRuntime(leaves: GraphLeaf[], store = makeStore()): OrcaRuntimeService {
|
||||
@@ -289,6 +299,23 @@ describe('listTerminals scope declaration', () => {
|
||||
expect(result.hostScope?.omittedHostIds).toEqual(['local', 'ssh:box-2'])
|
||||
})
|
||||
|
||||
it('does not claim local coverage for a paired-runtime folder workspace', 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(`id:${folderWorkspaceKey(folderWorkspace.id)}`)
|
||||
|
||||
expect(result.hostScope?.hostIds).toEqual([])
|
||||
expect(result.hostScope?.omittedHostIds).toEqual(['local', '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