Conversation
There was a problem hiding this comment.
Pull request overview
This PR implements a double Ctrl+C requirement to exit the goose CLI, matching the behavior of Claude Code. The first Ctrl+C press (on an empty line) displays a warning message, and a second press within 800ms exits the application.
Changes:
- Added shared state to track Ctrl+C press timing across input calls
- Modified
CtrlCHandlerto implement double-press logic with 800ms timeout - Added Escape key binding that uses the same double-press behavior
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| crates/goose-cli/src/session/mod.rs | Creates shared interrupt state and passes it to input handler |
| crates/goose-cli/src/session/input.rs | Implements double-press logic in CtrlCHandler and updates key bindings |
| rustyline::EventHandler::Simple(rustyline::Cmd::Newline), | ||
| ); | ||
|
|
||
| // Bind Escape key to interrupt (same as Ctrl+C when nothing is running) |
There was a problem hiding this comment.
The comment "same as Ctrl+C when nothing is running" is misleading. The Escape key now uses the same CtrlCHandler with double-press logic, not just "when nothing is running". Consider updating to: "Bind Escape key with same double-press behavior as Ctrl+C"
| // Bind Escape key to interrupt (same as Ctrl+C when nothing is running) | |
| // Bind Escape key with same double-press behavior as Ctrl+C |
| rustyline::EventHandler::Simple(rustyline::Cmd::Newline), | ||
| ); | ||
|
|
||
| // Bind Escape key to interrupt (same as Ctrl+C when nothing is running) |
There was a problem hiding this comment.
The comment "same as Ctrl+C when nothing is running" is misleading. The Escape key now uses the same CtrlCHandler with double-press logic, not just "when nothing is running". Consider updating to: "Bind Escape key with same double-press behavior as Ctrl+C"
| test-case = "3.3.1" | ||
| base64 = "0.22.1" | ||
| reqwest = { version = "0.12.28", default-features = false } | ||
| reqwest = { version = "0.12.28", default-features = false, features = ["multipart"] } |
There was a problem hiding this comment.
🤨 seems unrelated to the rest?
There was a problem hiding this comment.
hmm yeah, will revert
Co-authored-by: Douwe Osinga <douwe@squareup.com> Signed-off-by: Harrison <hcstebbins@gmail.com>
Co-authored-by: Douwe Osinga <douwe@squareup.com>
Co-authored-by: Douwe Osinga <douwe@squareup.com>
Co-authored-by: Douwe Osinga <douwe@squareup.com>
Summary
This requires double ctrl-c to abort the CLI and displays that, bringing it in line with how claude code works