Merge codex/goal-tools into codex/goal-session
This commit is contained in:
@@ -75,7 +75,7 @@ class GoalScriptAdapter extends LlmAdapter {
|
|||||||
if (goal === undefined) throw new Error('scripted goal state missing')
|
if (goal === undefined) throw new Error('scripted goal state missing')
|
||||||
return toolCall('update_goal', { goal_id: goal.id, revision: goal.revision, action: 'pause' })
|
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')
|
return textReply('UNEXPECTED PROMPT')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ const configPath = fileURLToPath(new URL(
|
|||||||
const repoTsconfig = fileURLToPath(new URL('../../../../tsconfig.json', import.meta.url))
|
const repoTsconfig = fileURLToPath(new URL('../../../../tsconfig.json', import.meta.url))
|
||||||
const PROCESS_TIMEOUT_MS = 30_000
|
const PROCESS_TIMEOUT_MS = 30_000
|
||||||
const TEST_TIMEOUT_MS = PROCESS_TIMEOUT_MS + 15_000
|
const TEST_TIMEOUT_MS = PROCESS_TIMEOUT_MS + 15_000
|
||||||
|
const PAUSED_RESULT = '"phase":"paused"'
|
||||||
|
|
||||||
let child: ChildProcessWithoutNullStreams | undefined
|
let child: ChildProcessWithoutNullStreams | undefined
|
||||||
let workdir: string | undefined
|
let workdir: string | undefined
|
||||||
@@ -68,7 +69,8 @@ async function runComposition(): Promise<{ stdout: string; stderr: string }> {
|
|||||||
pauseSent = true
|
pauseSent = true
|
||||||
proc.stdin.write('pause\n')
|
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
|
inputClosed = true
|
||||||
proc.stdin.end()
|
proc.stdin.end()
|
||||||
}
|
}
|
||||||
@@ -98,7 +100,8 @@ describe('goal tools through a real Loader, app, and stdio process', () => {
|
|||||||
expect(stderr).not.toContain('UNHANDLED')
|
expect(stderr).not.toContain('UNHANDLED')
|
||||||
expect(stdout).toContain('goal-tools e2e ready.')
|
expect(stdout).toContain('goal-tools e2e ready.')
|
||||||
expect(stdout).toContain('GOAL CREATED')
|
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'))
|
const logs = await jsonlFiles(join(workdir as string, '.sessions'))
|
||||||
expect(logs).toHaveLength(1)
|
expect(logs).toHaveLength(1)
|
||||||
|
|||||||
Reference in New Issue
Block a user