[BUG] Claude Code: window/input interactions cancel unrelated in-flight commands

Status Open
Reported on v2.1.220
Maintainer reply None cached
Activity 0 comments · opened Jul 29, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Claude Code: window/input interactions cancel unrelated in-flight commands

  1. Switching OS window focus away from the terminal/session cancels a pending tool call (e.g., a file Edit) in the main session, instead of leaving it to complete in the background.
  2. Pressing Esc to dismiss/return from a "by-the-way" sub-query also cancels whatever command is currently running in the main session — Esc should only exit the sub-query, not reach through to cancel unrelated main-session work.

Both point to the same underlying issue: an input/focus event scoped to one UI context (a different window, a sub-query) is bleeding into and cancelling state in the main session that it shouldn't touch.

What Should Happen?

The main thread should get into scope but without cancelling a running conversation or selecting a default (e.g. yes/no questions)

Error Messages/Logs

Steps to Reproduce

1) Start a long running request
2) Set focus to another window or start a /btw request
3) wait until the main requests asks for user input
4) click on the window to set focus or 'esc' the btw request

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.220 (Claude Code)

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

_No response_

View original on GitHub ↗