test: lock composer agent-detection host precedence for runtime repos (#7082)
Regression guard for the runtime-agent-list fix: asserts the composer's detectedAgentList selector and detection effect resolve SSH -> runtime -> local in that order, so a runtime-owned repo shows the paired runtime's agents instead of the local machine's. Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
committed by
Jinwoo Hong
co-authored by
Orca
parent
1886ea27f7
commit
d84041c52a
@@ -159,6 +159,40 @@ describe('useComposerState host-context boundaries', () => {
|
||||
expect(submitSection).toContain('runtimeEnvironmentId: folderTargetRuntimeEnvironmentId')
|
||||
})
|
||||
|
||||
it('detects composer agents against the repo host: SSH, then runtime, then local (#7082)', () => {
|
||||
// Why: a repo owned by a paired runtime must show the runtime's agents, not
|
||||
// the local machine's. SSH stays first priority; runtime falls through before
|
||||
// local so an SSH repo never double-detects. Regression guard for #7082.
|
||||
const selectorSection = sourceBetween(
|
||||
HOOK_SOURCE,
|
||||
'const detectedAgentList = useAppStore',
|
||||
'const ensureDetectedAgents = useAppStore'
|
||||
)
|
||||
expect(selectorSection).toContain('if (isRemote) {')
|
||||
expect(selectorSection).toContain('s.remoteDetectedAgentIds[connectionId]')
|
||||
expect(selectorSection).toContain('if (runtimeEnvironmentId) {')
|
||||
expect(selectorSection).toContain('s.runtimeDetectedAgentIds[runtimeEnvironmentId]')
|
||||
expect(selectorSection).toContain('return s.detectedAgentIds')
|
||||
// SSH branch is checked before the runtime branch.
|
||||
expect(selectorSection.indexOf('if (isRemote) {')).toBeLessThan(
|
||||
selectorSection.indexOf('if (runtimeEnvironmentId) {')
|
||||
)
|
||||
|
||||
expect(HOOK_SOURCE).toContain(
|
||||
'const runtimeEnvironmentId = selectedRepoSettings?.activeRuntimeEnvironmentId?.trim() || null'
|
||||
)
|
||||
|
||||
// Detection effect fans out to the same three hosts in the same order and
|
||||
// re-runs when the runtime environment changes.
|
||||
const detectSection = sourceBetween(HOOK_SOURCE, 'const detect = isRemote', 'void detect.then')
|
||||
expect(detectSection).toContain('ensureRemoteDetectedAgents(connectionId)')
|
||||
expect(detectSection).toContain('ensureRuntimeDetectedAgents(runtimeEnvironmentId)')
|
||||
expect(detectSection).toContain('ensureDetectedAgents()')
|
||||
expect(HOOK_SOURCE).toContain(
|
||||
'}, [connectionId, runtimeEnvironmentId, isRemote, selectedRepoSshStatus, disabledTuiAgents])'
|
||||
)
|
||||
})
|
||||
|
||||
it('seeds initial workspace run target from the task source context', () => {
|
||||
expect(
|
||||
resolveInitialWorkspaceRunSeed({
|
||||
|
||||
Reference in New Issue
Block a user