mirror of
https://github.com/stablyai/orca.git
synced 2026-10-31 00:57:45 +00:00
* fix(omp): read the cmd fresh-config path by name so the guard survives a variable hand-over On cmd.exe, OMP's fresh-session guard referenced %ORCA_OMP_FRESH_CONFIG%, which cmd only expands while reading the typed line. When the line reaches cmd inside another variable (the setup gate's `<wait> && %ORCA_SEQUENCED_STARTUP_COMMAND%`), cmd expands once, the reference stays literal, and OMP refuses to start with "fresh OMP settings are unavailable". The guard now reads the variable by name with a one-pass for-variable, `for %! in (.) do @if exist "%~$ORCA_OMP_FRESH_CONFIG:!" ...`, so typed and handed-over lines behave the same. The older cmd prefix stays recognized for persisted lines and older hosts. A real-cmd test runs both deliveries in the Windows CI lane. * test(omp): pin the cmd guard's echo suppression and type the smoke's cmd line on stdin The real-cmd test now runs echo on, like a pane, and asserts the config path never reaches stdout, so dropping the guard's @ fails it. The manual Windows smoke typed the line into a batch file, where the guard's %! would need %%!; it now feeds cmd.exe on stdin like a pane does. The guard comment now states the real rule: only %! or %~...! text in the for body changes, and the quoter keeps prompts from forming it.
69 lines
2.2 KiB
TypeScript
69 lines
2.2 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { withFreshOmpLaunch } from './omp-fresh-launch'
|
|
import { buildAgentStartupPlan } from './tui-agent-startup'
|
|
|
|
describe('OMP fresh launch intent', () => {
|
|
it.each(['omp', 'omp launch', 'omp --model provider/model', 'omp --config user.yml'])(
|
|
'%s adds the final overlay',
|
|
(command) => {
|
|
expect(withFreshOmpLaunch(command, 'posix')).toContain(
|
|
`${command} --config "$ORCA_OMP_FRESH_CONFIG"`
|
|
)
|
|
}
|
|
)
|
|
it.each([
|
|
'omp --resume id',
|
|
'omp -r id',
|
|
'omp --continue',
|
|
'omp -c',
|
|
'omp --session-dir /custom',
|
|
'omp --no-session',
|
|
'omp --fork id',
|
|
'omp models',
|
|
'omp config',
|
|
'omp wt',
|
|
'omp --help',
|
|
'omp --unknown foo',
|
|
'omp --model',
|
|
'omp -- hello',
|
|
'echo omp',
|
|
'omp && echo hi',
|
|
'omp --model foo;',
|
|
'omp --model $(preferred-model)',
|
|
'omp --model `preferred-model`'
|
|
])('preserves %s', (command) => {
|
|
expect(withFreshOmpLaunch(command, 'posix')).toBe(command)
|
|
})
|
|
it.each(['cmd', 'powershell'] as const)('preserves compound values in %s', (shell) => {
|
|
const command = 'omp --model foo&'
|
|
expect(withFreshOmpLaunch(command, shell)).toBe(command)
|
|
})
|
|
it('quotes the host config path for each Windows shell', () => {
|
|
expect(withFreshOmpLaunch('omp', 'powershell')).toContain(
|
|
'omp --config "$env:ORCA_OMP_FRESH_CONFIG"'
|
|
)
|
|
expect(withFreshOmpLaunch('omp', 'cmd')).toContain('omp --config "%~$ORCA_OMP_FRESH_CONFIG:!"')
|
|
})
|
|
it('keeps fresh intent out of saved resume command and environment', () => {
|
|
const plan = buildAgentStartupPlan({
|
|
agent: 'omp',
|
|
prompt: 'new task',
|
|
cmdOverrides: {},
|
|
platform: 'linux'
|
|
})
|
|
expect(plan?.launchCommand).toContain('--config "$ORCA_OMP_FRESH_CONFIG"')
|
|
expect(JSON.stringify(plan?.launchConfig)).not.toContain('ORCA_OMP_FRESH_CONFIG')
|
|
expect(plan?.env).toBeUndefined()
|
|
})
|
|
it('requires host-owned configuration for fresh SSH launches', () => {
|
|
const plan = buildAgentStartupPlan({
|
|
agent: 'omp',
|
|
prompt: 'new task',
|
|
cmdOverrides: {},
|
|
platform: 'linux',
|
|
isRemote: true
|
|
})
|
|
expect(plan?.launchCommand).toContain('test -f "$ORCA_OMP_FRESH_CONFIG"')
|
|
})
|
|
})
|