Files
orca/tests/e2e/cross-version-wire/cross-version-agent-session-model-options.unit.test.ts
OrcaWin 6c1a82bbd8 test: remove 30 low-value web and compatibility tests (#37814)
* test: remove 30 low-value web and compatibility tests

* test: retire obsolete browser schema evidence from active gate
2026-11-03 04:47:31 -08:00

89 lines
3.2 KiB
TypeScript

import { afterEach, beforeAll, describe, expect, it } from 'vitest'
import { AGENT_SESSION_OPTIONAL_MODEL_CLIENT_CAPABILITY } from '../../../src/shared/agent-session/options/agent-session-optional-model-capability'
import { STRUCTURED_AGENT_SESSION_RUNTIME_CAPABILITY } from '../../../src/shared/agent-session/agent-session-runtime-capabilities'
import { ELECTRON_REMOTE_RUNTIME_CLIENT_CAPABILITIES } from '../../../src/shared/electron-remote-runtime-client-capabilities'
import { remoteRuntimeClientCapabilities } from '../../../src/shared/remote-runtime/remote-runtime-client-capabilities'
import { resolveBaselineReleaseRef } from './release-checkout'
import { callBuild } from './structured-agent-session-surface-execution'
import { installableHost, structuredHostStub } from './structured-agent-session-host-fixture'
import {
loadAgentSessionWireBuild,
WORKING_TREE,
type AgentSessionWireBuild
} from './versioned-agent-session-wire'
let current: AgentSessionWireBuild
let baseline: AgentSessionWireBuild
const SESSION = 'model-options-session'
beforeAll(async () => {
current = await loadAgentSessionWireBuild(WORKING_TREE)
baseline = await loadAgentSessionWireBuild(resolveBaselineReleaseRef())
}, 180_000)
afterEach(async () => {
await current.installStructuredHost(null)
if (baseline.methodNames.includes('agentSession.options')) {
await baseline.installStructuredHost(null)
}
})
describe('selected model reports across released client and host versions', () => {
it('projects a labelled empty observation for an older client against the new host', async () => {
const host = structuredHostStub(SESSION, 'folder-options')
const report = { models: [], current: { effort: 'off' } }
host.readOptions.mockResolvedValue(report)
await current.installStructuredHost(installableHost(host))
const legacy = [
...baseline.capabilities.filter(
(value) => value !== AGENT_SESSION_OPTIONAL_MODEL_CLIENT_CAPABILITY
),
STRUCTURED_AGENT_SESSION_RUNTIME_CAPABILITY
]
expect(
await callBuild(
current,
'agentSession.options',
{ sessionId: SESSION },
{
clientKind: 'runtime',
clientCapabilities: legacy
}
)
).toMatchObject([
{
ok: true,
result: {
current: { model: '', effort: 'off' },
models: [{ id: '', label: 'Model not reported', isDefault: false, efforts: [] }]
}
}
])
expect(
await callBuild(
current,
'agentSession.options',
{ sessionId: SESSION },
{
clientKind: 'runtime',
clientCapabilities: remoteRuntimeClientCapabilities(
ELECTRON_REMOTE_RUNTIME_CLIENT_CAPABILITIES
)
}
)
).toMatchObject([{ ok: true, result: report }])
host.readOptions.mockResolvedValue({ models: [], current: { model: 'reported-model' } })
expect(
await callBuild(
current,
'agentSession.options',
{ sessionId: SESSION },
{
clientKind: 'runtime',
clientCapabilities: legacy
}
)
).toMatchObject([{ ok: true, result: { current: { model: 'reported-model' } } }])
})
})