fix(ai-vault): keep SSH title ownership local

This commit is contained in:
Brennan Benson
2026-08-14 15:40:27 -07:00
parent 85a942b20f
commit 4fd1c8d81b
2 changed files with 23 additions and 1 deletions
@@ -290,6 +290,27 @@ describe('runtime-owned SSH AI Vault routing', () => {
}
)
})
it('does not resolve titles through another runtime for a locally owned SSH target', async () => {
mocks.requestActiveSshAiVaultSessionTitles.mockResolvedValue(null)
mocks.getActiveSshAiVaultHostInfo.mockReturnValue({})
const findRuntimeOwningSshAiVaultHost = vi.fn()
const resolveRuntimeOwnedSshAiVaultSessionTitles = vi.fn()
registerAiVaultHandlers({
findRuntimeOwningSshAiVaultHost,
resolveRuntimeOwnedSshAiVaultSessionTitles
})
await expect(
_internals.resolveAiVaultSessionTitles({
executionHostScope: 'ssh:dev-box',
requests: [{ agent: 'codex', sessionId: 'session-1' }]
})
).resolves.toEqual({ titles: [] })
expect(findRuntimeOwningSshAiVaultHost).not.toHaveBeenCalled()
expect(resolveRuntimeOwnedSshAiVaultSessionTitles).not.toHaveBeenCalled()
})
})
function result(sessions: AiVaultSession[]): AiVaultListResult {
@@ -11,7 +11,7 @@ import {
import type { RuntimeOwnedSshAiVaultHost } from '../ai-vault/runtime-owned-ssh-session-list'
import { resolveLocalAiVaultSessionTitles } from '../ai-vault/session-title-resolver'
import { parseAiVaultSessionTitlesResult } from '../ai-vault/session-title-result-validation'
import { requestActiveSshAiVaultSessionTitles } from './ssh'
import { getActiveSshAiVaultHostInfo, requestActiveSshAiVaultSessionTitles } from './ssh'
export type RuntimeAiVaultSessionTitleResolver = (
environmentId: string,
@@ -70,6 +70,7 @@ async function resolveSshAiVaultSessionTitles(
}
if (
isRuntimeOwnedSshTargetId(targetId) ||
getActiveSshAiVaultHostInfo(targetId) ||
!options.findRuntimeOwningSshAiVaultHost ||
!options.resolveRuntimeOwnedSsh
) {