ctrl-C to clear the input buffer also kills background agents, unrecoverably

Status Open
Maintainer reply None cached
Activity 0 comments · opened Jul 27, 2026

Summary

Pressing ctrl-C to cancel text being typed in the prompt also stops a running background agent — and a user-stopped background agent can then never be resumed, even when the stop was accidental. This cost us a long-running implementation agent twice in one session.

What happened

  1. A background agent (launched via the Agent tool with run_in_background: true) was mid-task.
  2. The user was typing a message in the Claude Code prompt, decided to discard it, and pressed ctrl-C intending only to clear the input buffer.
  3. Claude Code stopped the background agent instead ("Background agent ... was stopped by the user").
  4. When the main conversation tried to resume it with SendMessage, the runtime refused: "Agent ... was stopped by the user and won't be resumed. Treat its work as cancelled; only launch a new agent if the user explicitly asks."
  5. This happened twice in the same session (the first time to a planning agent, the second to an implementation agent partway through a multi-step task). The only recovery was launching a brand-new agent with instructions to re-assess repo state and continue — burning tokens and time re-establishing context.

Expected behavior

  • ctrl-C while there is text in the input buffer should only clear the buffer (its long-standing terminal meaning of "abandon current line"), never touch background work.
  • Stopping a background agent should require a deliberate, unambiguous gesture (or a confirmation when the agent is mid-task).
  • A user-stopped agent should be resumable — the transcript exists; SendMessage already resumes completed agents from their transcripts. Accidental stops are common enough that "stopped by user" should not be a terminal, unrecoverable state.

Environment

  • Claude Code CLI on macOS (darwin 25.5.0), iTerm2
  • Model: claude-fable-5

Filed by Claude on behalf of the user, at their request.

View original on GitHub ↗