Merge codex/commands into codex/goal-commands

This commit is contained in:
Tianyi Cui
2026-07-20 02:41:39 +08:00
2 changed files with 6 additions and 3 deletions

View File

@@ -75,7 +75,7 @@ class GoalScriptAdapter extends LlmAdapter {
if (goal === undefined) throw new Error('scripted goal state missing')
return toolCall('update_goal', { goal_id: goal.id, revision: goal.revision, action: 'pause' })
}
if (prompt.text === 'pause') return textReply('GOAL PAUSED')
if (prompt.text === 'pause') return textReply('UNEXPECTED CONTINUATION AFTER PAUSE')
return textReply('UNEXPECTED PROMPT')
}
}

View File

@@ -16,6 +16,7 @@ const configPath = fileURLToPath(new URL(
const repoTsconfig = fileURLToPath(new URL('../../../../tsconfig.json', import.meta.url))
const PROCESS_TIMEOUT_MS = 30_000
const TEST_TIMEOUT_MS = PROCESS_TIMEOUT_MS + 15_000
const PAUSED_RESULT = '"phase":"paused"'
let child: ChildProcessWithoutNullStreams | undefined
let workdir: string | undefined
@@ -68,7 +69,8 @@ async function runComposition(): Promise<{ stdout: string; stderr: string }> {
pauseSent = true
proc.stdin.write('pause\n')
}
if (!inputClosed && stdout.includes('GOAL PAUSED')) {
const pausedAt = stdout.indexOf(PAUSED_RESULT)
if (!inputClosed && pausedAt >= 0 && stdout.indexOf('\n> ', pausedAt) >= 0) {
inputClosed = true
proc.stdin.end()
}
@@ -98,7 +100,8 @@ describe('goal tools through a real Loader, app, and stdio process', () => {
expect(stderr).not.toContain('UNHANDLED')
expect(stdout).toContain('goal-tools e2e ready.')
expect(stdout).toContain('GOAL CREATED')
expect(stdout).toContain('GOAL PAUSED')
expect(stdout).toContain(PAUSED_RESULT)
expect(stdout).not.toContain('UNEXPECTED CONTINUATION AFTER PAUSE')
const logs = await jsonlFiles(join(workdir as string, '.sessions'))
expect(logs).toHaveLength(1)