Escape key cancels running background agents — should only clear input line

Resolved 💬 4 comments Opened Feb 27, 2026 by grigb Closed Mar 2, 2026

Bug Description

Pressing Escape while a background agent is running kills the agent. The expected behavior is that Escape should only clear the current input line, not cancel running background work.

Steps to Reproduce

  1. Launch a background agent with run_in_background: true
  2. While waiting for it to complete, start typing in the input field
  3. Press Escape to clear what you typed
  4. The background agent gets killed

Expected Behavior

Escape should clear the input line only. Background agents should continue running uninterrupted.

Actual Behavior

Escape kills the running background agent, requiring the user to re-launch it — wasting time and API credits.

Impact

  • Accidental agent kills during long-running tasks (e.g., tar compression, large codebase scans)
  • Wasted API credits from having to re-run killed agents
  • User frustration from lost work

Environment

  • Claude Code version: 2.1.44
  • OS: macOS (Darwin 23.6.0)
  • Terminal: iTerm2

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗