Escape key does not cancel a running task/agent (no cancel binding in Task context)
Resolved 💬 2 comments Opened Jun 10, 2026 by nick9248 Closed Jun 14, 2026
Description
When a task/agent is running in the foreground (e.g. invoking an MCP-provided slash command), pressing Escape does nothing. The only way to interrupt is Ctrl+C.
Root cause (from ~/.claude/keybindings.json defaults)
The Task context ("when a task/agent is running in the foreground") only defines:
{
"context": "Task",
"bindings": {
"ctrl+b": "task:background"
}
}
There is no escape-bound cancel/interrupt action for the Task context. By contrast:
Chatcontext bindsescape->chat:cancelGlobalcontext bindsctrl+c->app:interrupt
But neither of those appears to apply while a task is running in the foreground, so escape is a no-op and only ctrl+c works.
Expected behavior
Pressing Escape while a task/agent is running in the foreground should cancel/interrupt it, consistent with how escape behaves in the Chat context (chat:cancel).
Steps to reproduce
- Invoke an MCP-provided slash command / skill that runs as a foreground task
- While it's running, press Escape
- Nothing happens
- Press Ctrl+C — this interrupts it
Environment
- Claude Code version: 2.1.170
- OS: Windows 11 Pro (10.0.26200)
- Shell: PowerShell 7
~/.claude/keybindings.json: default/stock config (no user overrides)
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗