Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/main/daemon/pty-subprocess.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1675,7 +1675,7 @@ describe('createPtySubprocess', () => {
expect(lastCall[2].env.ORCA_SHELL_READY_MARKER).toBe('1')
})

it('uses shell-ready wrapper for Codex native prefill flags', () => {
it('uses shell-ready wrapper for Codex positional prompts when the plan opts in', () => {
const proc = mockPtyProcess()
spawnMock.mockReturnValue(proc)
const platform = Object.getOwnPropertyDescriptor(process, 'platform')
Expand All @@ -1687,7 +1687,8 @@ describe('createPtySubprocess', () => {
cols: 80,
rows: 24,
cwd: '/repo',
command: "codex --prefill 'linked issue context'",
command: "codex 'linked issue context'",
startupCommandDelivery: 'shell-ready',
env: { SHELL: '/bin/zsh' }
})
} finally {
Expand Down
7 changes: 4 additions & 3 deletions src/main/ipc/pty.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7007,7 +7007,7 @@ describe('registerPtyHandlers', () => {
}
)

posixOnlyIt('waits for shell-ready when Codex uses the native prefill flag', async () => {
posixOnlyIt('waits for shell-ready when a Codex positional prompt opts in', async () => {
vi.useFakeTimers()
const mockProc = createMockProc()
spawnMock.mockReturnValue(mockProc.proc)
Expand All @@ -7018,7 +7018,8 @@ describe('registerPtyHandlers', () => {
cols: 80,
rows: 24,
cwd: '/tmp',
command: "codex --prefill 'linked issue context'"
command: "codex 'linked issue context'",
startupCommandDelivery: 'shell-ready'
})

const [, , options] = spawnMock.mock.calls[0]!
Expand All @@ -7029,7 +7030,7 @@ describe('registerPtyHandlers', () => {
await Promise.resolve()
vi.runAllTimers()
await Promise.resolve()
expect(mockProc.proc.write).toHaveBeenCalledWith("codex --prefill 'linked issue context'\n")
expect(mockProc.proc.write).toHaveBeenCalledWith("codex 'linked issue context'\n")
} finally {
vi.useRealTimers()
}
Expand Down
12 changes: 10 additions & 2 deletions src/main/runtime/orca-runtime.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25862,7 +25862,11 @@ describe('OrcaRuntimeService', () => {
)
expect(metaById[result.worktree.id]).toMatchObject({ createdWithAgent: 'codex' })

runtime.onPtyData('pty-startup-draft', '\x1b[?2004h›', Date.now())
runtime.onPtyData(
'pty-startup-draft',
'\x1b[?2004h\x1b[1m›\x1b[0m Ask Codex to do anything',
Date.now()
)
await vi.waitFor(() => {
expect(write).toHaveBeenCalledWith('pty-startup-draft', `\x1b[200~${draftUrl}\x1b[201~`)
})
Expand Down Expand Up @@ -26460,7 +26464,11 @@ describe('OrcaRuntimeService', () => {
)
expect(metaById[result.worktree.id]).toMatchObject({ createdWithAgent: 'codex' })

runtime.onPtyData('pty-explicit-draft', '\x1b[?2004h›', Date.now())
runtime.onPtyData(
'pty-explicit-draft',
'\x1b[?2004h\x1b[1m›\x1b[0m Ask Codex to do anything',
Date.now()
)
await vi.waitFor(() => {
expect(write).toHaveBeenCalledWith('pty-explicit-draft', `\x1b[200~${draftUrl}\x1b[201~`)
})
Expand Down
12 changes: 7 additions & 5 deletions src/relay/pty-handler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -387,18 +387,19 @@ describe('PtyHandler', () => {
)

it.skipIf(process.platform === 'win32')(
'emits shell-ready markers for renderer-delivered Codex native prefill commands',
'emits shell-ready markers for renderer-delivered Codex positional prompt commands',
async () => {
const oldShell = process.env.SHELL
const oldHome = process.env.HOME
const homeDir = mkdtempSync(join(tmpdir(), 'relay-codex-prefill-spawn-'))
const homeDir = mkdtempSync(join(tmpdir(), 'relay-codex-prompt-spawn-'))

process.env.SHELL = '/bin/bash'
process.env.HOME = homeDir
try {
await dispatcher.callRequest('pty.spawn', {
env: { HOME: homeDir },
command: "codex --prefill 'linked issue context'"
command: "codex 'linked issue context'",
startupCommandDelivery: 'shell-ready'
})
} finally {
if (oldShell === undefined) {
Expand Down Expand Up @@ -472,10 +473,11 @@ describe('PtyHandler', () => {
await dispatcher.callRequest('pty.spawn', {
env: {
HOME: homeDir,
[SETUP_AGENT_SEQUENCE_STARTUP_COMMAND_ENV]: "codex --prefill 'linked issue context'"
[SETUP_AGENT_SEQUENCE_STARTUP_COMMAND_ENV]: "codex 'linked issue context'"
},
command: 'bash -lc wait-for-setup-wrapper',
commandDelivery: 'provider'
commandDelivery: 'provider',
startupCommandDelivery: 'shell-ready'
})
} finally {
if (oldShell === undefined) {
Expand Down
Loading
Loading