Fix rich input trapping arrow keys in Codex/OpenCode TUIs#10556
Open
SagarSDagdu wants to merge 2 commits intowarpdotdev:masterfrom
Open
Fix rich input trapping arrow keys in Codex/OpenCode TUIs#10556SagarSDagdu wants to merge 2 commits intowarpdotdev:masterfrom
SagarSDagdu wants to merge 2 commits intowarpdotdev:masterfrom
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
Contributor
|
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 |
Contributor
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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