make every dialog close on ctrl+c, twice exits#2583
Merged
dgageot merged 1 commit intodocker:mainfrom Apr 28, 2026
Merged
Conversation
derekmisler
approved these changes
Apr 28, 2026
31b994d to
466a0b4
Compare
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.
Pressing ctrl+c on any TUI dialog now opens the exit-confirmation dialog instead of quitting immediately (via
HandleQuit/ dialog-specific handlers). A second ctrl+c on the exit-confirmation exits, matching the existing two-press flow when no dialog is shown.If the user cancels exit (
N/Esc), the original dialog is restored — the exit-confirmation is stacked on top of it, not replacing it, so blocking dialogs (tool confirmation, elicitation, max iterations) don't leave the agent stuck waiting.Behavior
Implementation
pkg/tui/tui.go—handleKeyPressintercepts ctrl+c before forwarding to the dialog manager. If the exit confirmation is already on top, the key is forwarded so it can exit via its ownYesbinding; otherwise the exit-confirmation dialog is pushed onto the stack.pkg/tui/dialog/dialog.go— addedManager.TopIsExitConfirmation()so the top-level handler can route the key correctly.pkg/tui/dialog/elicitation.go— removed the now-redundant special-case that declined the elicitation and calledtea.Quiton ctrl+c.pkg/tui/tui_ctrlc_test.go— three unit tests covering the table above.