Skip to content

fix(tui): show shutdown feedback on exit#23323

Merged
fcoury-oai merged 2 commits into
mainfrom
fcoury/slow-ctrl-c
May 18, 2026
Merged

fix(tui): show shutdown feedback on exit#23323
fcoury-oai merged 2 commits into
mainfrom
fcoury/slow-ctrl-c

Conversation

@fcoury-oai
Copy link
Copy Markdown
Contributor

@fcoury-oai fcoury-oai commented May 18, 2026

Why

Ctrl+C can take a noticeable amount of time to finish when the TUI is waiting for the app-server thread shutdown path to complete. Before this change, the UI could look like it had not accepted the shutdown request because the composer and cursor remained in their normal interactive state during that wait.

This PR makes the accepted shutdown visible immediately. It does not add an artificial sleep or change the shutdown timeout; it only draws one final feedback frame before continuing through the existing shutdown flow.

What Changed

  • On ExitMode::ShutdownFirst, the TUI now renders shutdown feedback before awaiting the existing thread shutdown future.
  • The bottom pane disables composer input, which hides the cursor through the existing disabled-input cursor path.
  • The composer shows Shutting down... as the disabled input hint and suppresses footer content so the shutdown acknowledgement is not competing with shortcut/status text.
  • The logout path uses the same feedback path before shutting down.

How to Test

  1. Start Codex from this branch.
  2. Press Ctrl+C to request shutdown.
  3. If shutdown takes long enough to observe, confirm the composer changes to › Shutting down..., the cursor disappears, and no footer hint is rendered below it.
  4. Regression check: repeat with text already typed in the composer and confirm the visible row still switches to Shutting down... while the draft remains preserved internally until the process exits.

Targeted tests:

  • cargo test -p codex-tui shutdown_in_progress_disables_input_and_uses_hint_without_footer
  • cargo test -p codex-tui bottom_pane::footer::tests::

Local Validation Note

cargo test -p codex-tui still aborts in app::tests::discard_side_thread_removes_agent_navigation_entry with a stack overflow. That same test also failed when run alone locally, and the failure appears unrelated to this shutdown feedback path.

@fcoury-oai fcoury-oai marked this pull request as ready for review May 18, 2026 16:23
Copy link
Copy Markdown
Contributor

@canvrno-oai canvrno-oai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed and tested with text in the composer, active pets, streaming threads, and from several menus. I only saw the Shutting down... render very briefly on my device.

@fcoury-oai
Copy link
Copy Markdown
Contributor Author

Reviewed and tested with text in the composer, active pets, streaming threads, and from several menus. I only saw the Shutting down... render very briefly on my device.

It should only be really visible on the situation I mentioned: for me sometimes the shutdown of app-server takes a while. Long enough to make it seem like the app is frozen. Once we have this improvement in place, I will start doing some analysis on what causes the slowness in the first place.

@fcoury-oai fcoury-oai merged commit bb43044 into main May 18, 2026
31 checks passed
@fcoury-oai fcoury-oai deleted the fcoury/slow-ctrl-c branch May 18, 2026 17:41
@github-actions github-actions Bot locked and limited conversation to collaborators May 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants