Files
orca/src/shared/native-chat-agent-support.test.ts
T
Brennan Benson 0121f571e4 fix(agent-status): map codex request_user_input questions to Needs You (#9861)
* fix(agent-status): map codex request_user_input questions to waiting

Codex 0.145 asks user questions via the auto-allowed request_user_input
tool (experimental default_mode_request_user_input): PreToolUse fires
while blocked on the answer with no Stop, so Orca showed the pane as
working/idle instead of Needs You. Map that PreToolUse to waiting
(mirrors grok's ask_user_question), exempt question waits from the codex
yolo auto-approval suppressor, and deliver native-chat answers to the
digit-commit selector by option number (typed labels are ignored and
Enter commits the highlighted first option). Older codex versions emit
no such event and are unchanged.

* fix(native-chat): preserve codex question answer semantics
2026-07-22 12:00:14 -07:00

49 lines
2.1 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import {
isNativeChatSupportedAgent,
resolveNativeChatTranscriptAgent,
shouldStepNativeChatAskAnswer
} from './native-chat-agent-support'
describe('resolveNativeChatTranscriptAgent', () => {
it('maps OpenClaude onto the Claude transcript format', () => {
expect(resolveNativeChatTranscriptAgent('openclaude')).toBe('claude')
expect(resolveNativeChatTranscriptAgent('claude')).toBe('claude')
})
it('passes codex and grok through and rejects everything else', () => {
expect(resolveNativeChatTranscriptAgent('codex')).toBe('codex')
expect(resolveNativeChatTranscriptAgent('grok')).toBe('grok')
expect(resolveNativeChatTranscriptAgent('cursor')).toBeNull()
expect(resolveNativeChatTranscriptAgent(null)).toBeNull()
expect(resolveNativeChatTranscriptAgent(undefined)).toBeNull()
})
})
describe('isNativeChatSupportedAgent', () => {
it('recognizes the parseable agents and rejects unknown / nullish input', () => {
expect(isNativeChatSupportedAgent('claude')).toBe(true)
expect(isNativeChatSupportedAgent('openclaude')).toBe(true)
expect(isNativeChatSupportedAgent('cursor')).toBe(false)
expect(isNativeChatSupportedAgent(null)).toBe(false)
expect(isNativeChatSupportedAgent(undefined)).toBe(false)
})
})
describe('shouldStepNativeChatAskAnswer', () => {
it('steps the digit-commit selector agents (Claude, OpenClaude, Codex)', () => {
expect(shouldStepNativeChatAskAnswer('claude')).toBe(true)
expect(shouldStepNativeChatAskAnswer('openclaude')).toBe(true)
// Codex 0.145's request_user_input card ignores typed labels and commits on
// the highlighted row, so pasted answers misdeliver like STA-1860.
expect(shouldStepNativeChatAskAnswer('codex')).toBe(true)
})
it('does not step other or unknown agents', () => {
expect(shouldStepNativeChatAskAnswer('grok')).toBe(false)
expect(shouldStepNativeChatAskAnswer('cursor')).toBe(false)
expect(shouldStepNativeChatAskAnswer(null)).toBe(false)
expect(shouldStepNativeChatAskAnswer(undefined)).toBe(false)
})
})