claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

Desktop app: chat scrollback permanently truncated at a fixed mid-conversation point after app restart (session JSONL intact)

Open melikarslan opened this issue 3 months ago • 2 comments

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

After closing and reopening the Claude Code desktop app, the chat view for a long session always starts rendering from the same fixed mid-conversation message. Everything before that point is not visible and there is no way to scroll or load earlier history. New messages continue to append normally. The truncation point does NOT move as the conversation grows and is identical across multiple app restarts.

What I verified on disk:

  • The session JSONL (~/.claude/projects/<project-slug>/<session-id>.jsonl) is complete: 1,184 records, all messages present including the ones the UI no longer shows.
  • There are NO summary / compact_boundary records in the file — the render cutoff does not correspond to any marker in the session log.
  • The first message the UI renders corresponds to record ~844 of 1,184 — an ordinary user message; adjacent records are ordinary queue-operation / stop_hook_summary entries.
  • So this appears to be app-side view/resume state (Electron storage), not session-file corruption or context compaction.

Context that may matter: session spans 3 days, ~135 user/assistant messages, heavy subagent/background-task usage, several MCP servers connecting/disconnecting during the session, and the app was quit at least once while background shells were still running.

What Should Happen?

Full transcript scrollback after app restart, or an affordance to load earlier history — the data exists intact in the session JSONL.

Error Messages/Logs


Steps to Reproduce

  1. Run a long multi-day session in the desktop app (hundreds of messages, background bash tasks and subagents running).
  2. Quit the desktop app while the session still has running background shells; reopen the app and resume the same session.
  3. Observe: chat scrollback starts at a fixed mid-conversation message; all earlier messages are missing from the view.
  4. Quit and reopen again: the view starts at the exact same message (fixed point; does not shift as new messages are added).

Session ID in case telemetry helps: e69a4590-ed0a-4bc9-b3dc-a6c2b2eea026

Claude Model

Other

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.1.226 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Other

Additional Information

Workarounds tried: regenerated a readable transcript from the JSONL manually (works — confirms no data loss); claude --resume from the project directory in the terminal as an alternate render path. Happy to provide the JSONL record-type breakdown privately if useful.

melikarslan avatar Aug 20 '26 08:08 melikarslan

Same symptom here on macOS desktop, but with one important difference from your report: in my case the session .jsonl is NOT intact. You explicitly ruled out session-file corruption; mine is measurably corrupted, so it may be worth checking whether both cases share that.

Environment: observed on Claude Code 2.1.271, desktop app (Code tab), macOS 26.5. Since updated to 2.1.276, not yet re-tested there. Session: 15 days, 24,565 lines, 138 MB .jsonl.

My trigger is different too. I did not quit the app — I closed the laptop lid mid-session and reopened it ~3h45m later. And what is missing is the most recent part of the conversation, not the beginning. So: sleep/wake rather than app restart, and the view is rewound rather than truncated at a fixed early point.

What the transcript looks like

entries with a uuid ................  16,318
distinct uuids .....................  15,382
entries written more than once .....     936   <-- should be 0
entries out of chronological order .   1,266   <-- should be 0
worst backwards jump ...............  23 hours

Blocks of the transcript are re-appended verbatim. The first entries of the session (lines 37–42) appear again at lines 1643–1648 with the same uuids. And the same compact_boundary record is written twice, identical timestamp and token counts, at two different positions:

line 6220  2026-09-07T15:22:52Z  trigger=auto  preTokens=978885  postTokens=13203
line 8968  2026-09-07T15:22:52Z  trigger=auto  preTokens=978885  postTokens=13203   <-- same record again

Line 8968 is also where the file jumps 23 hours backwards (line 8955 is 2026-09-08T14:24:46Z).

That is a plausible mechanism for both our symptoms: if the renderer walks this file and lands inside a re-appended older region, the view would start in the wrong place. In your case at a fixed early point, in mine rewound past the recent messages.

Check for anyone else on this thread

python3 - <<'PY'
import json, collections, datetime
f = "<path to a long session>.jsonl"   # ~/.claude/projects/<project>/<session-id>.jsonl
uu = collections.Counter(); seq = []
for i, l in enumerate(open(f, encoding="utf-8", errors="replace")):
    try: d = json.loads(l)
    except Exception: continue
    if d.get("uuid"): uu[d["uuid"]] += 1
    if d.get("timestamp"):
        seq.append((i, datetime.datetime.fromisoformat(d["timestamp"].replace("Z","+00:00"))))
print("duplicated entries:", sum(c-1 for c in uu.values() if c > 1))
print("out of order      :", sum(1 for a, b in zip(seq, seq[1:]) if b[1] < a[1]))
PY

Both numbers should be 0. @melikarslan — if yours also prints non-zero, the two reports are the same bug and the file is the cause rather than the Electron view state. If yours prints zeros, then there are two separate defects here and the transcript integrity one probably needs its own issue.

Ruled out on my side

  • iCloud "Desktop & Documents Folders" sync is enabled on this machine (FXICloudDriveDesktop = 1). But ~/.claude lives directly in the home directory — not under ~/Desktop or ~/Documents — so it is outside that sync scope. Verified by inode: ~/.claude is not reachable through ~/Library/Mobile Documents/, which only contains symlinks to ~/Desktop and ~/Documents.
  • The project directory is under ~/dev/, also outside the synced trees.
  • No .icloud placeholders and no "conflicted copy" files anywhere under ~/.claude.
  • The session file's only extended attribute is com.apple.provenance.
  • lsof on bird and cloudd shows no handle under ~/.claude. MEGAsync is installed and running but also has no handle there.

So the duplication appears to originate inside Claude Code, not from an external sync process.

The duplicated entries in my transcript span 2.1.258, 2.1.260, 2.1.266 and 2.1.271, so whatever writes them is not specific to one release.

Happy to share the full integrity dump — the transcript itself contains private work, but the uuid/timestamp statistics can be shared as-is. If maintainers would rather have the transcript-integrity part as a separate issue, say so and I will file it with this evidence.

xaron98 avatar Sep 18 '26 10:09 xaron98

I can confirm this on Windows. In one of my long sessions the desktop app shows the conversation only up to a certain point; roughly one hour of messages is missing from the view, also after restarting the app. The session .jsonl file on disk is complete and contains all messages, so the data is intact and only the display is affected.

Possibly relevant: the session had been compacted before, my last "yes" was still waiting as a queued message (queue-operation), and Remote Control was active at the time.

Expected: the view shows the complete history, or at least warns visibly that part of the history is not displayed.

gandora-hup avatar Nov 17 '26 18:11 gandora-hup