[BUG] Messages are swallowed/ignored after ESC interrupt - background agents continue running

Resolved 💬 2 comments Opened Mar 2, 2026 by cnwillz Closed Mar 3, 2026

Preflight Checklist

  • [x] This is a bug report (not a feature request)
  • [x] I have searched existing issues and this is not a duplicate

What's Wrong?

After pressing ESC to interrupt a complex task, the UI allows input but messages sent are silently swallowed/ignored. The AI does not receive the messages until multiple attempts (typically ~5 retries).

Steps to Reproduce

  1. Start Claude Code CLI
  2. Request a complex multi-step task (e.g., search files + read + translate + save)
  3. While task is in progress, press ESC to interrupt
  4. UI shows interrupt succeeded, input field is available
  5. Send a new message
  6. Message is not received - AI continues processing or shows no response
  7. Repeat sending the same message multiple times (typically 3-5 attempts)
  8. Eventually the AI responds

Expected Behavior

  • ESC interrupt should stop all processing
  • First message sent after interrupt should be immediately received

Actual Behavior

  • ESC appears to interrupt (UI updates, input available)
  • But background agents continue running (confirmed in CHANGELOG 2.1.52+)
  • Messages sent are queued but silently ignored until background tasks complete or multiple retries
  • No user feedback that messages are being dropped

Environment

  • Claude Code Version: 2.1.63
  • Platform: Anthropic API
  • OS: macOS
  • Terminal: claude CLI (zsh)

Related Issues

This appears to be a symptom of the same root cause as:

  • #16905 - "Esc key interrupt disabled when queued messages or background tasks exist"
  • That issue reports ESC does nothing when background tasks exist
  • This issue reports ESC works but messages are swallowed
  • #11803 - "On VSCode extension, pressing the Esc or the stop button is ignored most of the time"
  • Similar symptom: ESC pressed but model keeps processing
  • #11491 - "ESC key not working on Mac - cannot interrupt Claude"
  • ESC not working at all on macOS
  • #20086 - "Frequent 'Puzzling...' hangs requiring ESC interruption"
  • Frequent hangs requiring ESC, may be related to message queue issues

CHANGELOG Context

From v2.1.52:

"Use ctrl+f to kill all background agents instead of double-pressing ESC. Background agents now continue running when you press ESC to cancel the main thread"

From v2.1.51:

"Fixed Ctrl+C and ESC being silently ignored when background agents are running and the main thread is idle"

Analysis

The current behavior appears to be:

  1. ESC interrupts the main thread but background agents continue
  2. Input is accepted but messages are queued behind background tasks
  3. No visual feedback that messages are blocked by background processing
  4. Messages may be dropped or require multiple sends to penetrate the queue

Workaround

Press Ctrl+F after ESC to kill all background agents before sending new messages.

Suggested Fix

Either:

  1. Option A: ESC should interrupt ALL tasks (main + background) as the UI hint "(esc to interrupt)" suggests
  2. Option B: Show clear feedback when messages are queued behind background tasks (e.g., "Waiting for 3 background tasks to complete...")
  3. Option C: Change the UI hint to indicate ESC only pauses main thread, not background agents

View original on GitHub ↗

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