ソースを参照

Merge codex/commands into codex/goal-commands

Tianyi Cui 2 ヶ月 前
親
コミット
64b84c9ef0

+ 1 - 1
examples/echo-agent/tests/fixtures/goal/tool-goal/scripted-llm.ts

@@ -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')
   }
 }

+ 5 - 2
packages/goal/tool-goal/tests/tool-goal.e2e.ts

@@ -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)