You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: Require double Ctrl+C to exit the CLI (first press interrupts, second exits) #26371
Currently, pressing Ctrl+C immediately exits the entire OpenCode CLI. This is surprising and disruptive — it's easy to accidentally exit during a long session.
Claude Code and Codex both use a two-press pattern:
First Ctrl+C — interrupts the current agent action / cancels the in-progress operation
Second Ctrl+C — exits the CLI entirely
OpenCode should adopt the same behavior. This gives users a safe escape hatch for cancelling operations without losing their session context.
The first Ctrl+C could show a message like "Press Ctrl+C again to exit" so the user knows what's happening.
Suggested implementation path
In the TUI key handler, intercept the first Ctrl+C as a session interrupt (same as Esc or /exit light)
On a second Ctrl+C within a short window (e.g., the same keybind cycle or within a few seconds), trigger the full exit
Optionally display a brief toast/hint after the first press
You can change the default keybindings to something else. ctrl+c only exits when the prompt is empty. I have remapped mine for this reason, but changing the default binding or behaviour would just make everybody else complain.
Activity
github-actions commentedon May 8, 2026
This issue might be a duplicate of existing issues. Please check:
For keybind-related issues, please also check our pinned keybinds documentation: #4997
kommander commentedon May 11, 2026
You can change the default keybindings to something else. ctrl+c only exits when the prompt is empty. I have remapped mine for this reason, but changing the default binding or behaviour would just make everybody else complain.
verils commentedon May 21, 2026
That was not enough.
Every time I hit
Ctrl + Cwhile opencode was working with an empty prompt, the damn program quit. It's weird and dangerous.Why do you deliberately go against what most agents do?
CharlesMcquade commentedon May 24, 2026
This double-Ctrl-C request has been brought up a ridiculous amount of times. Why can it not at least be a config option?
feat(tui): require double Ctrl+C to quit
github-actions commentedon Jul 24, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.