stopShellPty on tab switch kills active sessions (exit 143) — regression in May 27 build

Resolved 💬 1 comment Opened May 28, 2026 by renatomoscati-creator Closed Jun 28, 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?

What happens:
Switching between sessions in the sidebar sends SIGTERM (exit code 143) to the active claude process mid-run. Any running agents, tool calls, or in-progress responses are killed. Clicking away and back is enough to trigger it.

Steps to reproduce:

Open two or more sessions in the desktop app
Start any operation in session A (or just have it idle mid-response)
Click session B in the sidebar
Click back to session A
Session A shows "Session was interrupted" — exit code 143
From ~/Library/Logs/Claude/main.log:

LocalSessions.startShellPty: sessionId=<new-session>
LocalSessions.stopShellPty: sessionId=<active-session> ← SIGTERM sent here
Shell PTY for <active-session> exited (stale — already replaced)
[error] Session <active-session> query error: Claude Code process exited with code 143
[CCD CycleHealth] unhealthy cycle (137s, hadFirstResponse=true, reason=system_error)
Root cause (from logs): stopShellPty is called on the previously focused session every time focus changes. This sends SIGTERM to the running claude process. Before this build, backgrounded sessions stayed alive.

What Should Happen?

Expected: switching tabs should not kill running sessions — they should stay alive in the background (as they did before May 27).

Error Messages/Logs

LocalSessions.startShellPty: sessionId=<new-session>
LocalSessions.stopShellPty: sessionId=<active-session>   ← SIGTERM sent here
Shell PTY for <active-session> exited (stale — already replaced)
[error] Session <active-session> query error: Claude Code process exited with code 143
[CCD CycleHealth] unhealthy cycle (137s, hadFirstResponse=true, reason=system_error)

Steps to Reproduce

Steps to reproduce:

Open two or more sessions in the desktop app
Start any operation in session A (or just have it idle mid-response)
Click session B in the sidebar
Click back to session A
Session A shows "Session was interrupted" — exit code 143

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

Claude Code desktop app v2.1.149

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗