anthropics / anthropics/claude-code

[BUG] Desktop (Code tab): Enter in new-session composer navigates to an unrelated old cloud session; session never created, prompt and draft lost

Open
#95,295 0 comments 0 reactions 0 assignees View on GitHub
area:desktop bug data-loss platform:macos
Dominant language
Python
Stars
145k
Forks
23.1k
PR merge metrics
PR metrics pending

Description

### What's Wrong?

In the Claude desktop app (Code tab, macOS), I typed a long prompt into the **new-session composer** (the prompt began with a `/workflow` slash command) and pressed Enter. Instead of creating the session, the window navigated to an unrelated, weeks-old **cloud** session. The new session never appeared in the sidebar, and the typed prompt was gone. Quitting and relaunching the app did not bring it back.

The prompt was never delivered anywhere:

- No `LocalSessions.start` / `sendMessage` in `main.log` between the previous session start and the next one I manually created.
- No new transcript under `~/.claude/projects/`, no new session record under `Application Support/Claude/claude-code-sessions/`.
- The old cloud session the window jumped to has no new events (checked via the sessions API), and no new cloud session ID appears in the log.
- The composer draft (`composer-draft:epitaxy-draft` in the renderer's localStorage) was cleared on submit, even though no session was started, so the text was unrecoverable.

### What Should Happen?

Enter in the new-session composer should create the session and send the message. If session creation fails or navigation goes elsewhere, the composer draft should be preserved (or restored on next open) rather than discarded.

### Error Messages/Logs

`~/Library/Logs/Claude/main.log` (local time, UTC-5). The user was in the new-session composer from 00:40:33 (`setFocusedSession: sessionId=null`) and pressed Enter at ~00:47:04:

```
00:46:58 [info] [CCD] LocalSessions.setFocusedSession: sessionId=null
00:46:58 [info] [CCD] LocalSessions.setFocusedSession: sessionId=null
00:46:58 [info] [CCD] temporary query on required_version:2.1.274:…: 2 plugin(s) go to Claude Code over stdin (initialize request, --await-initialize)
00:46:58 [info] [CCD] temporary query on required_version:2.1.274:…: 2 plugin(s) go to Claude Code over stdin (initialize request, --await-initialize)
00:47:01 [info] [CCD] /stats (worker) scanned 230/243 transcript files since 2026-08-30
00:47:04 [info] [CCD] LocalSessions.setFocusedSession: sessionId=null
00:47:04 [info] [CCD] LocalSessions.setFocusedSession: sessionId=session_01XZ… <-- old cloud session, last active Sep 9
00:47:04 [info] handoff: publishing session_01XZ…
00:47:12 [info] [CCD] LocalSessions.setFocusedSession: sessionId=null
00:47:29 [info] [CCD] LocalSessions.setFocusedSession: sessionId=local_952c… <-- another old local session
```

No `LocalSessions.start:` line between 00:21:12 and 00:49:56 (the next session I created by hand). No error was logged.

Possibly related: memory pressure at the time (`[process-memory] trigger=pressure … sys_free≈1.3–1.6GB/16GB`) with ~21 local sessions open and `CliGovernor at cap=6` evicting/yielding warm spawns. After relaunch, a similar flicker happened once more: from the new-session composer, focus jumped to an old local session for <1s and back (00:49:22).

### Steps to Reproduce

1. Claude desktop app → Code tab → New session (in a project with many existing sessions, ~20).
2. Type a long, multi-line prompt that starts with a slash command (here `/workflow …`), taking several minutes.
3. Press Enter.
4. Observe: window shows an unrelated old session; no new session in sidebar; prompt gone; draft not restored after relaunch.

Not reliably reproducible so far — happened once.

### Claude Model

Unknown — the session never started.

### Is this a regression?

Unknown

### Claude Code Version

Claude Code 2.1.274 (bundled), Claude desktop app 2.2553.0

### Platform

Claude desktop app (macOS)

### Operating System

macOS 26.6.2 (25G83)

### Terminal/Shell

N/A (desktop app)

### Additional Information

Suggested fix regardless of root cause: don't clear the new-session composer draft until the session is confirmed created and the message accepted. That alone would have made this a minor annoyance instead of lost work.

Related (not duplicates — different trigger, same class of loss): #83248 (Cowork composer draft cleared when session start fails), #90637 (Desktop submitted message becomes "Queued" and is lost).

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing the desktop Code-tab new-session composer around the LocalSessions.setFocusedSession and LocalSessions.start events described in main.log. Check how composer-draft:epitaxy-draft in renderer localStorage is cleared, then use the provided reproduction steps and logs to verify that Enter creates the intended session, sends the message, and preserves the draft when creation or navigation fails.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos, python
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.