claude-code - 💡(How to fix) Fix [BUG] /desktop switch causes silent file state corruption — session handoff loses model + context, model edits based on stale history [2 comments, 3 participants]

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…
GitHub stats
anthropics/claude-code#48822Fetched 2026-04-16 06:49:59
View on GitHub
Comments
2
Participants
3
Timeline
10
Reactions
0
Timeline (top)
labeled ×5commented ×2mentioned ×1renamed ×1

Root Cause

When /desktop hands off to a new model with the full conversation history:

  1. No temporal ordering of file state: Messages from March 10 and April 15 are presented with equal weight. The model cannot tell which Edit calls were superseded by later ones.

  2. Chat messages ≠ file state: Early messages say "the skills line contains JAX, Horovod" — but the file was edited many times since. The model treats chat text as ground truth instead of reading the file.

  3. MEMORY.md is insufficient: Memory files capture architecture decisions but not line-level file contents. The gap between memory and actual file state is filled by stale chat context.

  4. Confidence without verification: The model makes Edit tool calls without first Read-ing the file to verify current state, because the chat history gives it false confidence that it "knows" what's in the file.

Code Example

Note: This session was handed off from terminal to Desktop. File contents referenced in earlier messages may be outdated. Always use the Read tool to verify current file state before making edits.
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this has not been reported yet
  • This is a single bug report
  • I am using the latest version of Claude Code

What's Wrong?

Running /desktop to switch from Claude Code terminal to Claude Desktop does not port the session intact. Instead of preserving the model and context, it switches the model and triggers an uncached full-history re-read. The new model has no mechanism to distinguish current file state from historical file state. In long sessions with iterative file edits, this causes the model to make confident but incorrect Edit tool calls that revert files to outdated states.

This is a distinct failure mode from #46420 (context loss). Context loss is noticeable. This is silent corruption — the model acts authoritatively on stale data, and the user may not catch the regression.

What /desktop should do

Port the session as-is — same model, same context, same state. Just change the interface from terminal to Desktop.

What /desktop actually does

  • Switches the model (not just the interface)
  • Triggers an uncached full-history re-read with a different model
  • Destroys temporal awareness — the new model treats all 985 messages as equally current
  • Model acts confidently on weeks-old information without reading files first

Reproduction

Concrete Case (April 15 2026)

  1. Terminal session: 985 user messages across 8 active days (Mar 10 – Apr 15), iteratively editing a LaTeX resume
  2. File state at switch time: Skills section had been restructured weeks earlier (JAX/Horovod removed, LangGraph/LangSmith added, GPU & Inference split into two lines)
  3. User ran /desktop to move the session to Claude Desktop
  4. After switch: New model's first action was to "drop JAX and Horovod and add LangGraph" — changes already made 3+ weeks ago
  5. The model did not Read the file first — it acted on stale chat messages from early March as if they described current state
  6. If the user hadn't caught it, the file would have been silently reverted to a 5-week-old state

Root Cause Analysis

When /desktop hands off to a new model with the full conversation history:

  1. No temporal ordering of file state: Messages from March 10 and April 15 are presented with equal weight. The model cannot tell which Edit calls were superseded by later ones.

  2. Chat messages ≠ file state: Early messages say "the skills line contains JAX, Horovod" — but the file was edited many times since. The model treats chat text as ground truth instead of reading the file.

  3. MEMORY.md is insufficient: Memory files capture architecture decisions but not line-level file contents. The gap between memory and actual file state is filled by stale chat context.

  4. Confidence without verification: The model makes Edit tool calls without first Read-ing the file to verify current state, because the chat history gives it false confidence that it "knows" what's in the file.

Expected Behavior

/desktop should:

  1. Preserve the model — don't switch models just because the interface changed
  2. Preserve context — same session, same state, just rendered in Desktop instead of terminal
  3. If a model switch is unavoidable, inject a staleness warning so the model reads files before editing

Suggested Fix

Minimal fix (ship today): /desktop should not change the model. Port the session with the same model to Desktop.

If model switch is unavoidable: After the switch, inject a system message:

Note: This session was handed off from terminal to Desktop. File contents referenced in earlier messages may be outdated. Always use the Read tool to verify current file state before making edits.

Better fix: Track which files were modified during the session (already tracked in file-history-snapshot JSONL entries) and inject their current state or a staleness warning into the context after any model/interface switch.

Best fix: On any session handoff, append a "file state checkpoint" — a summary of all files modified during the session with their current content or hash, so the new model has ground truth.

Impact

  • Data corruption: Files silently reverted to outdated states
  • Trust erosion: Users cannot trust the model after a /desktop switch without manually verifying every edit
  • Disproportionate risk in long sessions: The longer the session, the more stale state exists, the worse the corruption
  • Breaks the /desktop workflow entirely: Users avoid /desktop because it's destructive

Related Issues

  • #46420 — Model provider switch resets conversation context (context loss variant; commented with this case as evidence)
  • #46423 — Feature request for persistent context across switches
  • #48087 — /model docs omit uncached history warning

Environment

  • Windows 11
  • Claude Code terminal → Claude Desktop via /desktop
  • Session: 985 messages, 4154 JSONL lines, 8 active days

extent analysis

TL;DR

The most likely fix is to preserve the model and context when switching from terminal to Desktop using the /desktop command, and inject a staleness warning to ensure the model reads files before editing.

Guidance

  • To fix the issue, the /desktop command should not switch the model, but instead port the session with the same model to Desktop.
  • If a model switch is unavoidable, inject a system message warning about potential staleness of file contents referenced in earlier messages.
  • Consider tracking modified files during the session and injecting their current state or a staleness warning into the context after any model/interface switch.
  • Verify the fix by testing the /desktop command with a long session and checking that the model preserves the correct file state and does not make incorrect edits.

Example

// Inject staleness warning system message
Note: This session was handed off from terminal to Desktop. File contents referenced in earlier messages may be outdated. Always use the Read tool to verify current file state before making edits.

Notes

The provided fix assumes that preserving the model and context is feasible. If a model switch is unavoidable, the injected staleness warning should help mitigate the issue. However, a more robust solution would involve tracking file state changes during the session and providing the new model with ground truth.

Recommendation

Apply the workaround by preserving the model and context when switching to Desktop, and inject a staleness warning if a model switch is unavoidable. This will help prevent data corruption and trust erosion until a more permanent fix can be implemented.

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