claude-code - 💡(How to fix) Fix stopShellPty on tab switch kills active sessions (exit 143) — regression in May 27 build

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

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

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.

Code Example

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)
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?

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

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