Fix rich input trapping arrow keys in CLI Agents#10556
Conversation
Auto-toggle of the CLI agent rich input relies on plugin-emitted Blocked-state events (PermissionRequest, QuestionAsked) to close the editor when the agent needs raw keyboard input. Codex's listener only forwards opaque OSC 9 notifications as Stop and never reports Blocked, so rich input would stay open over Codex's option menus and trap the arrow keys meant for selection. OpenCode without its plugin had no listener at all and hit the same problem. Gate the three auto-toggle paths on `agent_supports_rich_status` and listener presence so we only auto-open the editor when we can also auto-close on Blocked. Codex's listener registration is preserved so OSC 9 notifications still flow; users can still open rich input manually via the chip or Ctrl-G. Fixes warpdotdev#9059
…put-traps-arrow-keys
|
I'm starting a first review of this pull request. You can view the conversation on Warp. I reviewed this pull request and requested human review from: Comment Powered by Oz |
There was a problem hiding this comment.
Overview
This PR gates rich-input auto-open and status-driven auto-toggle on sessions that both have a registered listener and report rich status, preventing Codex/OpenCode-no-plugin flows from trapping arrow keys while preserving auto-toggle for rich-status agents.
Concerns
- No blocking correctness or security concerns found in the annotated diff.
Verdict
Found: 0 critical, 0 important, 0 suggestions
Approve
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
|
@advait-m Could you take a look please? |
will do! |
|
hmm @SagarSDagdu do you have this setting turned on? Is this still an issue for you if you turn this setting off? In Agents > Third party CLI agents |
|
I'm leaning towards removing the change from i.e. if the user explicitly wants auto-open on CLI agent start (which is non-default), that should always happen. But, we should fix the default case with plugin cc @harryalbert for thoughts |
`auto_open_rich_input_on_cli_agent_start` is a default-off user preference — when the user explicitly opts in, respect it for all agents. The plugin-driven auto-toggle and auto-dismiss paths (default-on, plugin-gated) still need the rich-status check so they don't trap arrow keys for Codex.
@advait-m Kept the rich-status check on the two plugin-driven paths ( |
advait-m
left a comment
There was a problem hiding this comment.
cool, yeah I think the other 2 places make sense to update to me - will wait for CI to run and then merge
|
thanks for the contribution! |

Description
When running
codex(oropencodewithout its plugin), Warp's CLI agent rich input would auto-open and trap the arrow keys meant for navigating the agent's interactive option menus, leaving users unable to make a selection.The auto-open path assumed any detected CLI agent would later emit Blocked-state events (
PermissionRequest,QuestionAsked) that auto-close the rich input when the agent needs raw keyboard input. That assumption breaks for:CodexSessionHandler) only forwards opaque OSC 9 notifications asStopand never reportsBlocked.supports_rich_status()already returnsfalse, but the auto-open / auto-toggle paths weren't checking it.listener: None), so even though the handler supports rich status, no Blocked events ever arrive.This PR gates the three rich-input auto-toggle paths on both a registered listener AND
agent_supports_rich_status(&agent), so we only auto-open when we'll be able to auto-close onBlocked. Codex's proactive listener registration is preserved (it still drives OSC 9 notification suppression and the footer chip); only the auto-open and auto-toggle behaviors are suppressed for Codex. Users can still open rich input manually via the chip orCtrl-G.Before the fix
https://www.loom.com/share/46351245a93a4a14aa666be81d240dc8
After the fix
https://www.loom.com/share/89b33b8b6e8b4bf6a0af9ac903a21dc8
Files touched:
app/src/terminal/view.rs—maybe_auto_open_cli_agent_rich_input, status-change auto-toggle inhandle_cli_agent_sessions_eventapp/src/terminal/view/use_agent_footer/mod.rs—maybe_close_rich_input_after_submitapp/src/terminal/view_test.rs— regression testLinked Issue
Fixes #9059
ready-to-specorready-to-implement.Screenshots / Videos
Attached above
Testing
Added regression test
codex_status_change_does_not_auto_open_rich_input(app/src/terminal/view_test.rs) that asserts a Codex session withshould_auto_toggle_input: trueand a registered listener does not re-open rich input on aStopstatus event — the only status Codex's handler emits.Existing related tests still pass:
status_blocked_auto_closes_rich_inputstatus_in_progress_auto_opens_rich_input_after_blockedsubmit_with_plugin_and_auto_toggle_keeps_rich_input_opensubmit_with_plugin_but_auto_toggle_off_respects_auto_dismissAll 140 cli-agent-related unit tests pass.
cargo fmtandcargo clippy -p warp --all-targets -- -D warningsare clean.Manually verified on a local debug build:
codexno longer auto-opens rich input; arrow keys reach Codex's option menus.claudestill auto-opens rich input and auto-closes on permission prompts (regression check).Ctrl-Gstill works for Codex.Agent Mode