agentydragon(tasks): gate Ctrl+D same as Ctrl+C exit confirmation

This commit is contained in:
Rai (Michael Pokorny)
2025-06-24 16:30:35 -07:00
parent 2620fff775
commit 0456efdec7

View File

@@ -19,6 +19,7 @@ Require two consecutive Ctrl+C keystrokes (within a short timeout) to exit the T
- If a second Ctrl+C occurs within a configurable timeout (e.g. 2sec), the TUI exits normally.
- If no second Ctrl+C arrives before timeout, clear the confirmation state and resume normal operation.
- Ensure that child processes (shell tool calls) still receive SIGINT immediately and are not affected by the doubleCtrl+C logic.
- Prevent immediate exit on Ctrl+D (EOF); require the same doubleconfirmation workflow as for Ctrl+C when EOF is received.
- Provide unit or integration tests simulating SIGINT events to verify behavior.
## Implementation
@@ -30,6 +31,7 @@ Require two consecutive Ctrl+C keystrokes (within a short timeout) to exit the T
2. If enabled and not already confirming, enter a `ConfirmExit` state, record timestamp, and display confirmation message.
3. If enabled and in `ConfirmExit` state, exit immediately on second Ctrl+C.
4. On each TUI tick, if in `ConfirmExit` and timeout elapsed, clear `ConfirmExit` state.
5. Intercept EOF (Ctrl+D) events in the input handler and apply the same `ConfirmExit` logic as for Ctrl+C when `require_double_ctrl_c` is enabled.
- Add rendering logic in the status bar (`tui/src/status_indicator_widget.rs` or similar) to show the confirmation prompt.
**How it works**
@@ -40,4 +42,4 @@ Require two consecutive Ctrl+C keystrokes (within a short timeout) to exit the T
## Notes
- Make the doubleCtrl+C timeout duration configurable if desired (e.g. via `tui.double_ctrl_c_timeout_secs`).
- Ensure that existing tests for Ctrl+C behavior are updated or new tests added to cover the confirmation state.
- Ensure that existing tests for Ctrl+C behavior are updated or new tests added to cover the confirmation state.