Inconsistent Hotkey for Command Approval

Open 💬 1 comment Opened Aug 17, 2026 by pklacansky

What version of Codex CLI is running?

0.147.0

What subscription do you have?

company

Which model were you using?

_No response_

What platform is your computer?

_No response_

What terminal emulator and version are you using (if applicable)?

_No response_

Codex doctor report

What issue are you seeing?

The "Yes and don't ask again command" and "No, tell differently" are both mapped to hotkey 2 if there are 3 and 2 options. When approving multiple commands, it is easy to hit 2 resulting into "No, tell differently", even if I want to say "Yes".

What steps can reproduce the bug?

Uploaded thread: 01a00158-63a7-74d3-aced-299c41ca5fe8

What is the expected behavior?

_No response_

Additional information

_No response_

View original on GitHub ↗

1 Comment

jdcodes1 · 10 days ago

Confirmed on main @ 1f41cc5d92, and the hazard is structural: digit hotkeys select by position, while the option count varies per approval.

Digits resolve through actual_idx_for_enabled_number — i.e. "2" = the second enabled row, whatever it happens to be (tui/src/bottom_pane/list_selection_view.rs#L1054-L1061). Meanwhile the option list is contextual: the "Yes, and don't ask again for commands that start with " row is only offered for single-line commands, and the session-scope row is also conditional (approval_overlay.rs#L840-L910). So across a burst of sequential approvals the popup alternates between 3-option and 2-option layouts, and "2" flips between approve-for-session and decline — exactly the muscle-memory trap you hit.

Two things worth knowing / two fix shapes:

  • Stable semantic keys already exist: y = approve, a = approve for session, p = approve for prefix, and the deny binding (keymap.rs#L1335-L1337) — these don't shift with layout. If the popup's hint line advertised them more prominently, digit-reliance would fade. (They're also remappable via [tui.keymap].)
  • Digits could be made stable too: assign fixed digits per semantic slot (e.g. 1 = plain yes, 2 = yes-with-scope, 9/0 or n = no) and simply skip unused digits when a row is absent, instead of compacting positions. Positional numbering is the only scheme in which the same key can mean "yes" and "no" on consecutive prompts — for an approval dialog specifically, that's worth ruling out by construction. A related guard: never let a digit that meant an affirmative in the previous prompt map to a destructive/negative option in the next one.

Test shape: render the approval popup with and without the prefix/session rows and assert the digit → decision mapping is identical in both layouts.