claude-code - 💡(How to fix) Fix [BUG] Switching focus between local Code sessions kills the unfocused session's CLI process (SIGTERM, exit 143) instead of leaving it running in the background

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

Log signature (timestamps from one cycle) 13:17:11 [CCD] LocalSessions.setFocusedSession: sessionId=null 13:17:11 [CCD] LocalSessions.setFocusedSession: sessionId=local_6496a249... 13:17:11 LocalSessions.stopShellPty: sessionId=local_6c12069e... 13:17:12 [error] Session local_6c12069e... query error: Claude Code process exited with code 143

Code Example

Log signature (timestamps from one cycle)
13:17:11 [CCD] LocalSessions.setFocusedSession: sessionId=null
13:17:11 [CCD] LocalSessions.setFocusedSession: sessionId=local_6496a249...
13:17:11 LocalSessions.stopShellPty: sessionId=local_6c12069e...
13:17:12 [error] Session local_6c12069e... query error: Claude Code
        process exited with code 143
RAW_BUFFERClick to expand / collapse

Preflight Checklist

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

What's Wrong?

Environment

  • Claude Desktop: 1.8555.0 (8245b7) 2026-05-21
  • Claude Code (embedded): 2.1.149
  • macOS

What's wrong Switching focus from local session A to local session B in the desktop sidebar causes session A's CLI subprocess to be terminated with SIGTERM (exit code 143) within ~1 second. If the terminate doesn't complete promptly, the supervisor escalates to SIGKILL and LocalSessions.clearSession runs, removing the session from the in-memory map. Any in-progress turn on session A is interrupted (reason=system_error in CycleHealth). Sending a new message later causes a fresh CLI process to spawn via "Resuming session ... Mapping internal session ... to CLI session ...".

What Should Happen?

Expected: switching focus changes which session is visible, but leaves the previously-focused session's CLI running, so in-progress work continues.

Error Messages/Logs

Log signature (timestamps from one cycle)
13:17:11 [CCD] LocalSessions.setFocusedSession: sessionId=null
13:17:11 [CCD] LocalSessions.setFocusedSession: sessionId=local_6496a249...
13:17:11 LocalSessions.stopShellPty: sessionId=local_6c12069e...
13:17:12 [error] Session local_6c12069e... query error: Claude Code
        process exited with code 143

Steps to Reproduce

  1. Open two local Code sessions in different folders.
  2. Submit a prompt in session A that will run for ~30s+.
  3. Click session B in the sidebar before A finishes.
  4. Watch main.log: setFocusedSession=null → setFocusedSession=<B> → stopShellPty on A → "Claude Code process exited with code 143" on A.

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

2.1.149

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

Possibly related: #51649, #57361, #60790.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING