fix: quote queued OMP resumes for Windows shells (#7628)
This commit is contained in:
@@ -55,6 +55,21 @@ describe('buildAiVaultResumeCommand', () => {
|
||||
)
|
||||
})
|
||||
|
||||
it('quotes queued OMP resume paths for the provided Windows shell', () => {
|
||||
expect(
|
||||
buildAiVaultResumeCommand({
|
||||
agent: 'omp',
|
||||
sessionId: '019f27cd-4268-7000-96e7-62f42a55c144',
|
||||
resumeFilePath: 'C:\\Users\\Ada Lovelace\\.omp\\agent\\sessions\\repo\\sess.jsonl',
|
||||
cwd: 'C:\\Users\\Ada Lovelace\\repo',
|
||||
platform: 'win32',
|
||||
shell: 'powershell'
|
||||
})
|
||||
).toBe(
|
||||
"Set-Location -LiteralPath 'C:\\Users\\Ada Lovelace\\repo'; omp --resume 'C:\\Users\\Ada Lovelace\\.omp\\agent\\sessions\\repo\\sess.jsonl'"
|
||||
)
|
||||
})
|
||||
|
||||
it('falls back to the session id when no OMP transcript path is known', () => {
|
||||
expect(
|
||||
buildAiVaultResumeCommand({
|
||||
|
||||
@@ -105,18 +105,22 @@ export function buildAiVaultResumeCommand(args: {
|
||||
commandOverride?: string | null
|
||||
codexHome?: string | null
|
||||
resumeFilePath?: string | null
|
||||
shell?: AgentStartupShell
|
||||
}): string {
|
||||
const { agent, sessionId, cwd, platform, commandOverride, codexHome, resumeFilePath } = args
|
||||
const { agent, sessionId, cwd, platform, commandOverride, codexHome, resumeFilePath, shell } =
|
||||
args
|
||||
const baseCommand = commandOverride?.trim() || defaultAiVaultResumeCommandBase(agent)
|
||||
// Why: OMP's `--resume` accepts an absolute transcript path, which resolves
|
||||
// regardless of which session-dir root (custom OMP_CODING_AGENT_DIR / WSL
|
||||
// home) the file was discovered under, where an id-prefix lookup scoped to
|
||||
// the default store would miss it. Falls back to the id if no path is known.
|
||||
const resumeTarget = agent === 'omp' && resumeFilePath?.trim() ? resumeFilePath.trim() : sessionId
|
||||
const sessionArg = quoteShellArg(resumeTarget, platform)
|
||||
const sessionArg = shell
|
||||
? quoteStartupArg(resumeTarget, shell)
|
||||
: quoteShellArg(resumeTarget, platform)
|
||||
const resumeCommand = buildAgentResumeInvocation(agent, baseCommand, sessionArg)
|
||||
|
||||
return buildAiVaultResumeShellCommand({ resumeCommand, cwd, platform, codexHome })
|
||||
return buildAiVaultResumeShellCommand({ resumeCommand, cwd, platform, codexHome, shell })
|
||||
}
|
||||
|
||||
export function buildAiVaultResumeShellCommand(args: {
|
||||
|
||||
Reference in New Issue
Block a user