diff --git a/electron/mcp/agent-frame-fixtures.ts b/electron/mcp/agent-frame-fixtures.ts index ad78a1a4..70dcd1ad 100644 --- a/electron/mcp/agent-frame-fixtures.ts +++ b/electron/mcp/agent-frame-fixtures.ts @@ -51,6 +51,14 @@ export const READY_AGENT_FRAME_FIXTURES: AgentFrameFixture[] = [ '> Type your message or @path/to/file', ].join('\n'), }, + { + name: 'Codex CLI 0.154.0 "Ask Codex to do anything" prompt (custom nono agent wrapper)', + frame: [ + '› Ask Codex to do anything', + '', + 'gpt-5.6-luna high · /Users/brooksc/git/parallel-code/.worktrees/task-031-nono', + ].join('\n'), + }, ]; export const NOT_READY_AGENT_FRAME_FIXTURES: NotReadyAgentFrameFixture[] = [ diff --git a/electron/mcp/coordinator-test-harness.ts b/electron/mcp/coordinator-test-harness.ts index fccf4f24..7896700b 100644 --- a/electron/mcp/coordinator-test-harness.ts +++ b/electron/mcp/coordinator-test-harness.ts @@ -146,7 +146,7 @@ vi.mock('../shared/prompt-detect.js', () => ({ .slice(-1000) .split(/\r\n?|\n/) .some((line) => - /(?:^|\s)[❯›]\s*$|^\s*--\s*INSERT\s*--\s*$|^\s*>\s*(?:Type your message|$)/i.test( + /(?:^|\s)❯\s*$|^\s*--\s*INSERT\s*--\s*$|^\s*[›>]\s*(?:Type your message|Ask Codex to do anything|$)/i.test( line.trim(), ), ); @@ -171,7 +171,7 @@ vi.mock('../shared/prompt-detect.js', () => ({ return tail .split(/\r\n?|\n/) .some((line) => - /(?:^|\s)[❯›]\s*$|^\s*--\s*INSERT\s*--\s*$|^\s*>\s*(?:Type your message|$)/i.test( + /(?:^|\s)❯\s*$|^\s*--\s*INSERT\s*--\s*$|^\s*[›>]\s*(?:Type your message|Ask Codex to do anything|$)/i.test( line.trim(), ), ); diff --git a/electron/mcp/prompt-detect.test.ts b/electron/mcp/prompt-detect.test.ts index 159ee21d..9fd9d454 100644 --- a/electron/mcp/prompt-detect.test.ts +++ b/electron/mcp/prompt-detect.test.ts @@ -259,6 +259,21 @@ describe('chunkContainsAgentPrompt', () => { ).toBe(true); }); + it('returns true for Codex CLI 0.154.0 "Ask Codex to do anything" prompt (› prompt char)', () => { + expect(chunkContainsAgentPrompt('› Ask Codex to do anything')).toBe(true); + }); + + it('returns true for Codex CLI "Ask Codex to do anything" prompt above footer/status text', () => { + const footer = '\n\ngpt-5.6-luna high · ~/repo/worktree'; + expect(chunkContainsAgentPrompt(`› Ask Codex to do anything${footer}`)).toBe(true); + }); + + it('returns true for a plain-> variant of the "Ask Codex to do anything" prompt', () => { + // Defensive: some agent builds may render the composer with a plain `>` + // instead of Codex's usual `›` — both should be recognized as ready. + expect(chunkContainsAgentPrompt('> Ask Codex to do anything')).toBe(true); + }); + it('does not treat Codex startup screens as ready', () => { expect( chunkContainsAgentPrompt('Starting MCP servers (0/2): codex_apps, parallel-code\n›'), diff --git a/electron/shared/prompt-detect.ts b/electron/shared/prompt-detect.ts index 63f1ecd7..8c8420e4 100644 --- a/electron/shared/prompt-detect.ts +++ b/electron/shared/prompt-detect.ts @@ -29,8 +29,7 @@ export const PROMPT_PATTERNS: RegExp[] = [ export const AGENT_READY_TAIL_PATTERNS: RegExp[] = [ /^\s*❯\s*$/, /^\s*--\s*INSERT\s*--(?:$|\s|[^\w].*$)/i, - /^\s*›\s*$/, - /^\s*>\s*(?:Type your message|$)/i, + /^\s*[›>]\s*(?:Type your message|Ask Codex to do anything|$)/i, ]; export const AGENT_READY_TAIL_CHARS = 1000;