Desktop Code mode creates an orphan empty-context session instead of resuming; UI keeps showing full scrollback
Summary
In Claude Desktop "Code" mode, sending a message into an existing session can cause a brand-new backend session to be created with an empty context, instead of resuming the visible session. The desktop window keeps rendering the prior conversation's full scrollback (it draws from its own visual store), so the user sees continuity while the model receives zero conversation history and cold-starts.
This is distinct from context compaction. Compaction reuses the same session file and injects a summary; here a new session file is created with no history and no summary.
Impact
The model answers as if the entire prior conversation never happened (denies earlier statements, re-asks for context). For a long working session this silently discards the working context. A related downstream effect: because the orphaned session never reaches a normal close/wrap, in-progress work can be left uncommitted.
Evidence
Reproduced from the on-disk session transcripts (~/.claude/projects/<project>/*.jsonl). When the discontinuity occurred, a new transcript file appeared whose:
- first line is the mid-conversation user message (not a session-start record),
parentUuidisnull(no resume link to the prior session),- contains zero
isCompactSummaryentries (so it was not a compaction handoff), - has
nullforversion,gitBranch, andcwdon that first line (the normal session-bootstrap metadata is absent, i.e. the message was injected into a bare session shell rather than started through the standard launch path).
The prior session's tail was a /close flow, which may be the trigger: the close tore down the session and the desktop client failed to reopen it, creating a fresh one on the next message.
Reproduction (hypothesis)
- Run a long session in Desktop Code mode.
- Reach a point that ends/tears down the session (e.g. a
/close-style flow), or trigger a client reconnect (app backgrounded, update, tab switch). - Send another message in the same visible thread.
- Observe: model has no prior context, while the window still shows the full history.
Diagnostic check
ls -lat ~/.claude/projects/<project>/*.jsonl
If the newest file's first line is a mid-conversation user message with parentUuid: null and no compact-summary markers, the session was orphaned rather than resumed.
Environment
- Surface: Claude Desktop, "Code" mode
- claude-code version observed in normal sessions: 2.1.195
- Not observed in the VS Code extension (single long-lived session, resumes correctly) over ~1 year of use.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗