anthropics / anthropics/claude-code

Desktop (Windows): code block Run opens a new terminal tab instead of the existing terminal with an ssh session

Open
#94,259 0 comments 0 reactions 0 assignees View on GitHub
area:desktop bug has repro platform:windows regression
Dominant language
Python
Stars
145k
Forks
23.1k
PR merge metrics
PR metrics pending

Description

### Summary

Claude desktop (Windows), Code tab: pressing **Run** on a ```bash code block opens a **new terminal tab** instead of writing the command into the session's existing terminal, where an interactive `ssh` session is open. Until the 2026-09-14 update Run always wrote into the existing terminal.

### Environment

- Claude desktop 1.52386.6.0 (MSIX), Windows 11 Pro 10.0.26200
- Claude Code 2.1.270 (updated from 2.1.266 on 2026-09-14)

### Steps to reproduce

1. Open a Code session and its terminal panel (terminal 1).
2. In terminal 1 start an interactive `ssh ` session.
3. In the chat, press **Run** on any ```bash code block.

### Expected

The command is written into terminal 1 (the ssh session), as before the update.

### Actual

A new terminal tab is spawned and the command runs locally in PowerShell. `main.log` shows a new PTY per click:

```
2026-09-14 13:10:44 LocalSessions.startShellPty: sessionId=local_…::1
2026-09-14 13:21:39 LocalSessions.startShellPty: sessionId=local_…::2
2026-09-14 13:21:45 LocalSessions.startShellPty: sessionId=local_…::3
2026-09-14 13:24:02 LocalSessions.startShellPty: sessionId=local_…::4
2026-09-14 13:30:12 LocalSessions.startShellPty: sessionId=local_…::5
2026-09-14 14:07:04 LocalSessions.startShellPty: sessionId=local_…::8
```

- Right after a full app restart (tray → Exit), Run writes into terminal 1 again (13:56).
- After ~5–10 minutes without terminal output, Run spawns a new tab again (14:07). No session switch happened in between (no `setFocusedSession` in the log).
- Pressing Enter in terminal 1 before Run (to produce output) does not help.
- In the prior month such extra tabs appeared 3 times; on 2026-09-14 — 8 times.

### Notes from the local bundle

In `app/resources/ion-dist/assets/v1/c11959232-*.js`, `run` writes directly only when `isPrimaryTarget && ptyReady`, where `ptyReady = && !`; on Windows `getBusyShellPtyKeys` returns `{busy: [], probed: false}`. The live interface is loaded from `assets-proxy.anthropic.com` and may differ from the local copy. Something resets the ready state after a period of inactivity.

### Impact

Running remote commands via Run inside an open ssh session is no longer possible; every click spawns a local terminal that has to be closed.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the issue on Windows by opening an ssh session, waiting through the inactivity period, and pressing Run on a bash block. Inspect main.log and app/resources/ion-dist/assets/v1/c11959232-*.js, focusing on LocalSessions.startShellPty and the isPrimaryTarget/ptyReady behavior. Done means Run continues writing to the existing terminal and does not spawn a new local PowerShell tab after inactivity.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, powershell, shell
Domain
cli, desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.