claude-code - 💡(How to fix) Fix Session resume does not display assistant messages completed while user was absent [1 comments, 2 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#52398Fetched 2026-04-24 06:08:14
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Timeline (top)
labeled ×4closed ×1commented ×1

When a user leaves a Claude Code interactive session while the assistant is streaming a response (session lobby, terminal reload, CTRL+C), and then re-enters the session, the completed assistant response is NOT displayed. The session lobby correctly shows "unread message," but entering the session renders nothing. The JSONL session log on disk contains the complete response data.

Impact: Users lose visibility of completed work, leading to duplicate requests, missed instructions, and wasted API budget.

Root Cause

Root Cause Hypothesis

Code Example

SESSION_ID=$(uuidgen)
timeout 3 claude --bare --print --output-format stream-json \
  --include-partial-messages --session-id "$SESSION_ID" \
  "Write a 500-word essay about distributed systems" > /tmp/partial.jsonl 2>&1

sleep 15

# JSONL has the complete response:
find ~/.claude/projects -name "${SESSION_ID}.jsonl" -exec wc -l {} \;

# Resume shows nothing:
claude --bare --print --output-format stream-json \
  --resume "$SESSION_ID" "What did you just say?"
RAW_BUFFERClick to expand / collapse

Summary

When a user leaves a Claude Code interactive session while the assistant is streaming a response (session lobby, terminal reload, CTRL+C), and then re-enters the session, the completed assistant response is NOT displayed. The session lobby correctly shows "unread message," but entering the session renders nothing. The JSONL session log on disk contains the complete response data.

Impact: Users lose visibility of completed work, leading to duplicate requests, missed instructions, and wasted API budget.

Reproduction Steps

  1. Start a Claude Code session: claude
  2. Send a prompt that takes several seconds: Write a detailed 500-word essay about distributed systems.
  3. While streaming, press / to open the session lobby (or CTRL+C)
  4. Wait 10-15 seconds for the response to finish in the background
  5. Re-enter the session from the lobby
  6. Observe: The assistant's response is missing

Scriptable reproduction

SESSION_ID=$(uuidgen)
timeout 3 claude --bare --print --output-format stream-json \
  --include-partial-messages --session-id "$SESSION_ID" \
  "Write a 500-word essay about distributed systems" > /tmp/partial.jsonl 2>&1

sleep 15

# JSONL has the complete response:
find ~/.claude/projects -name "${SESSION_ID}.jsonl" -exec wc -l {} \;

# Resume shows nothing:
claude --bare --print --output-format stream-json \
  --resume "$SESSION_ID" "What did you just say?"

Expected Behavior

ScenarioExpectedActual
Leave during stream, return after completionFull response displayedEmpty chat
Leave during stream, return during streamStream continuesEmpty chat
Lobby shows "unread message"Entering shows the messageMessage invisible

Evidence

We've confirmed this across 3+ sessions. In every case:

  • The JSONL file contains the complete assistant response with intact parentUuid chains
  • All type: "text" content blocks have full text
  • The TUI does not replay these messages on re-entry

Root Cause Hypothesis

The session resume/hydration path reads the JSONL and reconstructs the conversation tree via parentUuid chains. Messages that were generated after the user disconnected may not be in the TUI's in-memory conversation state, and the hydration pass may not incorporate messages newer than the user's last-seen timestamp.

Environment

  • Claude Code 2.1.98 (native binary, Arch Linux)
  • Platform: Linux x86_64
  • Terminal: kitty + tmux

Related Issues

  • #44907 — SDK/print mode docs omit interrupted partial response persistence
  • #40316 — Session becomes permanently unrecoverable after streaming errors
  • #21617 — Conversation chain breaks mid-session
  • #46603 — Resume shows stale messages: broken parentUuid chain
  • #41230 — Messages sent to stdin during active turn are not persisted

Integration Tests

We've written 7 integration tests validating the expected contract (session JSONL completeness, resume display, interrupted stream recovery, multi-turn continuity, concurrent access, fork preservation). Available for reference if helpful.

extent analysis

TL;DR

The issue can be fixed by modifying the session resume/hydration path to incorporate messages newer than the user's last-seen timestamp.

Guidance

  • Review the session resume/hydration logic to ensure it correctly handles messages generated after the user disconnected.
  • Verify that the parentUuid chains in the JSONL file are correctly reconstructed and used to display the conversation tree.
  • Check if the TUI's in-memory conversation state is updated correctly when the user re-enters the session.
  • Consider adding logging or debugging statements to the session resume/hydration code to understand why the messages are not being displayed.

Example

No code snippet is provided as the issue does not contain enough information about the specific code implementation.

Notes

The root cause hypothesis suggests that the issue is related to the session resume/hydration path not incorporating messages newer than the user's last-seen timestamp. However, without more information about the code implementation, it is difficult to provide a more specific solution.

Recommendation

Apply a workaround by modifying the session resume/hydration path to incorporate messages newer than the user's last-seen timestamp, as this is the most likely cause of the issue.

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

claude-code - 💡(How to fix) Fix Session resume does not display assistant messages completed while user was absent [1 comments, 2 participants]