Skip to content

Make ctrl-c work like in claude code#6900

Merged
DOsinga merged 4 commits intomainfrom
double-ctrl-c
Feb 3, 2026
Merged

Make ctrl-c work like in claude code#6900
DOsinga merged 4 commits intomainfrom
double-ctrl-c

Conversation

@DOsinga
Copy link
Collaborator

@DOsinga DOsinga commented Feb 2, 2026

Summary

This requires double ctrl-c to abort the CLI and displays that, bringing it in line with how claude code works

Copilot AI review requested due to automatic review settings February 2, 2026 17:07
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 CtrlCHandler to 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)
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

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

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"

Suggested change
// Bind Escape key to interrupt (same as Ctrl+C when nothing is running)
// Bind Escape key with same double-press behavior as Ctrl+C

Copilot uses AI. Check for mistakes.
rustyline::EventHandler::Simple(rustyline::Cmd::Newline),
);

// Bind Escape key to interrupt (same as Ctrl+C when nothing is running)
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

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

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"

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings February 2, 2026 19:23
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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"] }
Copy link
Collaborator

Choose a reason for hiding this comment

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

🤨 seems unrelated to the rest?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

hmm yeah, will revert

@DOsinga DOsinga added this pull request to the merge queue Feb 3, 2026
Merged via the queue into main with commit 0f334db Feb 3, 2026
18 checks passed
@DOsinga DOsinga deleted the double-ctrl-c branch February 3, 2026 12:13
stebbins pushed a commit to stebbins/goose that referenced this pull request Feb 4, 2026
Co-authored-by: Douwe Osinga <douwe@squareup.com>
Signed-off-by: Harrison <hcstebbins@gmail.com>
kuccello pushed a commit to kuccello/goose that referenced this pull request Feb 7, 2026
Co-authored-by: Douwe Osinga <douwe@squareup.com>
Tyler-Hardin pushed a commit to Tyler-Hardin/goose that referenced this pull request Feb 11, 2026
Co-authored-by: Douwe Osinga <douwe@squareup.com>
Tyler-Hardin pushed a commit to Tyler-Hardin/goose that referenced this pull request Feb 11, 2026
Co-authored-by: Douwe Osinga <douwe@squareup.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants