fix(subagent): close stacked catalog integration gaps
This commit is contained in:
@@ -66,6 +66,7 @@ export type InputStep =
|
||||
text: string
|
||||
waitForFile?: { path: string; timeoutMs?: number }
|
||||
}
|
||||
| { op: 'waitForFile'; path: string; timeoutMs?: number }
|
||||
| { op: 'waitForTurnStart'; minimumTurn?: number; timeoutMs?: number }
|
||||
| { op: 'waitForTurnEnd'; timeoutMs?: number }
|
||||
| { op: 'waitForTitleAfterTurnEnd'; timeoutMs?: number }
|
||||
@@ -436,6 +437,9 @@ async function runStep(
|
||||
await promptDone
|
||||
return
|
||||
}
|
||||
case 'waitForFile':
|
||||
await waitForWorkspaceFile(cwd, step.path, step.timeoutMs)
|
||||
return
|
||||
case 'waitForTurnEnd': {
|
||||
const sessionId = getSessionId()
|
||||
if (sessionId === undefined) throw new Error('snapshot-harness: waitForTurnEnd before newSession')
|
||||
|
||||
@@ -865,6 +865,19 @@ describe('runScenario', () => {
|
||||
expect(result.sessionId).toBeDefined()
|
||||
})
|
||||
|
||||
it('waitForFile holds the next input step behind cwd-relative readiness', { timeout: 20_000 }, async () => {
|
||||
const { dir, fixtureFile } = await scenario({})
|
||||
const workspaceDir = join(dir, 'workspace')
|
||||
const { mkdir } = await import('node:fs/promises')
|
||||
await mkdir(workspaceDir, { recursive: true })
|
||||
await writeFile(join(workspaceDir, 'ready'), '')
|
||||
const result = await runScenario(
|
||||
{ steps: [...boot, { op: 'waitForFile', path: 'ready' }, { op: 'cancel' }] },
|
||||
{ agent: AGENT, mode: 'replay', fixtureFile, workspaceDir },
|
||||
)
|
||||
expect(result.sessionId).toBeDefined()
|
||||
})
|
||||
|
||||
it.each([
|
||||
[{ op: 'prompt', text: 'x' }, /prompt before newSession/],
|
||||
[{ op: 'promptAndWaitForAgentMessage', text: 'x', waitForText: 'later' }, /promptAndWaitForAgentMessage before newSession/],
|
||||
|
||||
Reference in New Issue
Block a user