Codex CLI approval prompts can steal input while user is typing
What version of Codex are you using?
Current Codex CLI as of June 10, 2026.
What platform is your computer?
macOS, terminal-agnostic. I see this inside the VS Code integrated terminal and in iTerm.
What issue are you seeing?
Codex CLI/TUI can render an approval/question prompt while I am still typing a message in the composer. When that happens, the next keypress or click can be consumed by the prompt instead of continuing my message, so I accidentally answer the approval/question while I was still writing.
This is a bad UX trap because the prompt appears in the same terminal surface where I am actively composing. The UI changes underneath me and the input target effectively changes from "continue typing my message" to "answer this permission prompt".
Claude Code doesnt suffer from this in the same way. I can keep typing while it is working without a mid-compose permission prompt stealing my next action.
Steps to reproduce
- Start an interactive Codex CLI session in a terminal.
- Have Codex run a task that may request approval or ask a structured question.
- While Codex is still working, start typing a follow-up message in the composer.
- Before submitting that message, let Codex render an approval/question prompt.
- Continue typing or click, expecting to keep editing the message.
- The action can instead select/confirm the prompt.
Expected behavior
Codex should not let approval/question prompts steal in-progress user input.
Safer behavior would be one of:
- If the user is actively composing text, keep focus in the composer and queue the approval prompt until the user submits or cancels the draft.
- Render the approval prompt in a way that cannot be answered by ordinary typing meant for the composer.
- Require an explicit focus change before prompt options accept keyboard/click input.
- Preserve the draft exactly as typed if a prompt appears.
Actual behavior
The approval/question prompt can appear while I am composing, and my next action can answer the prompt instead of continuing the message.
Why this matters
This makes Codex feel unsafe during normal interactive use. I should be able to type instructions while the agent is working without worrying that a sudden approval UI will hijack my input and make me approve/reject something by accident.
5 Comments
I would treat this as an approval-focus safety boundary, not just terminal UI polish.
The approval prompt becoming visible should not be the same event as making its options actionable. If the user already has an in-progress composer draft, ordinary typing should continue editing that draft until the user explicitly moves focus to the approval surface.
The behavior I would test:
The key invariant is that approval requires an intentional user action targeted at the approval surface. A prompt that appears under the user's cursor or keystream should not be able to convert ordinary composing into an approve, reject, or answer decision.
The Codex TUI already has logic that prevents the approval/question prompt from appearing if the user is actively typing. The menu appearance is deferred until after 1 second after the last keystroke. This is the same approach used in other CLIs like CC.
That debounce is a useful guard. The remaining failure mode I would test is not whether the menu is delayed while keypresses arrive, but whether ownership of the next key is unambiguous once the delay expires.
A time-based delay can still fail if:
I would separate two states:
prompt_armed should require explicit focus transfer, a dedicated shortcut, or a draft submit/cancel boundary. If composer focus still owns input, printable keys and paste should continue to the draft even if the approval menu has become visible.
Tests I would add:
That keeps debounce as useful UX polish, but makes focus ownership the safety invariant.
Thanks, the debounce definitely helps when keys are arriving fast. The reason I keep hitting this is it can't actually tell whether I'm done typing. It only measures time since my last keystroke, so I only need a normal thinking pause between keystrokes, which happens constantly when I'm composing a sentence. If an approval is parked it gets promoted on the next tick after that gap; if it arrives during the gap it shows immediately. Either way the prompt lands over my draft and my next keystroke answers it. I don't even have to stop to read output.
In
bottom_pane/mod.rsthe parked approval gets promoted withpush_view(ApprovalOverlay), andhandle_key_eventchecksview_stackbefore the composer, so the instant the overlay shows it owns every key. Timing was never the right signal for "is the user still composing"; whether there's an unsent draft is.I put the change up as a PR on my fork so the diff is easy to read: https://github.com/ivnnv/codex/pull/1 (couldn't open it against this repo directly, looks like PRs here are limited to collaborators). Single invariant: don't auto-show the approval modal while there's an unsent draft. It holds the request, shows a small "approval waiting" hint, and promotes it once the draft is submitted or cleared. The no-draft path is preserved, including the existing idle delay after recent composer activity. I haven't run it in a real session, it's mostly there to make the alternative concrete.
Thanks for making this concrete. I agree the important invariant is not just the idle delay; it is that an unsent draft still owns the keyboard.
The code path you pointed to explains the failure well: once a parked approval is promoted into the overlay, key handling checks the view stack before the composer. At that point "visible" and "armed" have become the same state. The debounce lowers the odds, but it does not prove the user is done composing.
The small fix I would preserve is:
Tests I would want close to the change:
That keeps the safety rule simple: an approval can be pending while the user is composing, but it should not become keyboard-authoritative until the draft has reached an explicit boundary.