anthropics / anthropics/claude-code
[BUG] VS Code extension: reopening a past conversation renders only a prefix of it — the final assistant message is absent from the UI while the .jsonl is complete and correctly chained
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 147k
- Forks
- 24k
- PR merge metrics
- PR metrics pending
Description
Preflight Checklist
- I have searched existing issues and this hasn't been reported yet (the near misses are listed under Related below)
- This is a single bug report (please file separate reports for different bugs)
- I am using the latest version of Claude Code
What's Wrong?
Opening a previous conversation in the Claude Code VS Code extension renders only a prefix of the transcript. The conversation appears to end mid-turn, at an arbitrary tool call — there is no "N messages hidden" marker, no gap indicator, and no error. Scrolling to the bottom does not reveal the rest.
The data is not lost. The on-disk .jsonl contains the missing messages with an intact parent chain. So this is a render/replay-side truncation of the tail, not a persistence failure.
This is not focus mode: I grepped the shipped webview bundle (webview/index.js, 2.1.278) and it has no focus-mode concept — no focusMode identifier, no "messages hidden" string, and every focus* identifier in the bundle is ordinary DOM focus (isFocused, focusin, focusBorder, …). The collapsed tool rows in this UI are the extension's normal rendering.
What Should Happen?
Opening a past conversation should render the whole transcript, ending with the last assistant message. If the UI deliberately elides part of it, it should say so.
Environment
- VS Code extension
anthropic.claude-code2.1.278 (win32-x64), bundled native binary 2.1.278 - Separately installed CLI on PATH: 2.1.273
- Windows 10 Pro 19045
- The session is small: at the moment the truncation was seen it held 175 records / ~0.75 MB, produced by two human prompts and roughly eighty tool calls. This is not the multi-megabyte, many-turn case of #79042.
| Form field | Answer |
|---|---|
| Claude Model | Opus |
| Is this a regression? | I don't know — I have no version where I can confirm the same conversation rendered whole. But this problem started to appear in the last few days. Earlier old sessions never had this problem as far as I remember. |
| Claude Code Version | 2.1.273 (Claude Code) on PATH; extension and its bundled binary both 2.1.278 |
| Platform | Anthropic API |
| Operating System | Windows |
| Terminal/Shell | Other — this is the VS Code extension's webview, not a terminal |
Record numbers below are 0-based line indices into ~/.claude/projects/<project>/<session-id>.jsonl.
Evidence: the transcript on disk is complete and correctly chained
Tail of the session .jsonl, content elided, types only:
| # | record type |
content blocks | text len | stop_reason |
|---|---|---|---|---|
| 163 | user |
tool_result |
— | — |
| 164 | attachment |
— | — | — |
| 165 | last-prompt |
— | — | — |
| 166 | ai-title |
— | — | — |
| 167 | atis-latch |
— | — | — |
| 168 | assistant |
thinking |
— | tool_use |
| 169 | assistant |
tool_use |
— | tool_use |
| 170 | user |
tool_result |
— | — |
| 171 | attachment |
— | — | — |
| 172 | assistant |
thinking |
— | end_turn |
| 173 | assistant |
text |
5407 | end_turn |
| 174 | system |
— | — | — |
- Record 173 is the answer I never saw. It is a standalone
text-only message withstop_reason: end_turn. - Every
parentUuidfrom the last user prompt (record 138) through 173 resolves; nothing is orphaned. - The
last-promptmarker that follows the final turn (record 175) hasleafUuid→ record 174, i.e. the tip pointer is correct, not stale.
What the UI shows
The rendered conversation stops at record 95, a tool call — 79 records early, with the last 30 minutes of the session absent. Missing from the UI, besides the final answer: an entire second user prompt and three further assistant text messages.
This was verified scrolled to the true bottom of the pane. Directly beneath that last tool call the extension renders its idle notice — "Idle 1d 18h. The prompt cache has likely expired, so your next message will re-cache about 95k tokens." — and then the composer. That is the end-of-conversation affordance, drawn at the truncation point, which is what makes the failure indistinguishable from a session that genuinely ended there.
Possibly a coincidence, possibly the lead: the cut lands exactly on a record that a last-prompt marker points at. Record 96 is a last-prompt whose leafUuid is record 95 — the last record the UI renders. Twelve such markers existed in the file, so ~7% of records are marker leaves; suggestive rather than conclusive. (Note that these markers are rewritten repeatedly within a single turn — ten of the twelve carry the identical first prompt — so a marker is not a turn boundary.)
Error Messages/Logs
From Claude VSCode.log (paths and ids redacted). The webview asks the host for the transcript, then launches a resume; nothing between them reports a limit, a parse failure, or a truncation:
[info] Received message from webview: {"type":"request","requestId":"...","request":{"type":"get_session_request","sessionId":"<session-id>","purpose":"transcript_open"}}
[info] Received message from webview: {"type":"launch_claude","channelId":"...","cwd":"<project-dir>","resume":"<session-id>","freshStartIfUnresumable":false,"permissionMode":"auto","thinkingLevel":"default_on"}
[info] Launching Claude on channel: ...
[info] Spawning Claude with SDK query function - cwd: <project-dir>, permission mode: auto, version: 2.1.278, <ext-dir>\resources\native-binary\claude.exe, resume: <session-id>
[info] From claude: [DEBUG] FileHistory: No need to copy file history for resuming with same session id: <session-id>
When it appears
Established from the timestamps: records 0 through 174 were all written in one live sitting of about 30 minutes. Record 95 — where the UI now stops — was written two minutes into that sitting; the final answer came 28 minutes later. Whatever decides the cut, it is not something that happened while the conversation was being produced.
The session has since been opened in several different VS Code windows; its id appears in four separate Claude VSCode.log files across three days. The truncation was observed on the third of those opens, ~1 day 18 h after the sitting. I did not check the earlier two, so I cannot say whether the cut point is stable or moves.
Assumption, not verified: a conversation that stays open in its original window appears to keep its full scrollback — I have never seen a live session lose its tail, though I have not left one open longer than ~12 h. If that holds, the trigger is the re-read from disk when an old conversation is opened in a fresh window, not the conversation's age or size.
Steps to Reproduce
- In the VS Code extension, run a session that is long in tool calls rather than in turns — two prompts and ~80 tool calls over half an hour is what produced this — ending on a long text-only answer.
- Close VS Code entirely and reopen it, to force a fresh read of the session from disk rather than reuse of in-memory state. Then open that conversation from the sessions sidebar. (This one sat ~1 day 18 h in between, but see When it appears — the delay may not be the variable.)
- Scroll to the bottom of the conversation.
- Observe: the last thing rendered is a tool call from much earlier in the session; the final answer is not on screen, and the idle notice is drawn as though the conversation ended there.
- Open
~/.claude/projects/<project>/<session-id>.jsonland read the tail — the missing records are all there, chained.
Impact
The failure is silent and indistinguishable from "the session ended there". A user who does not already suspect the bug has no reason to go and read the raw transcript, and the message that disappears is structurally the most valuable one in the turn — the conclusion. Where the final message contains the plan, the decision, or the handoff, the whole turn is lost to the reader while looking complete.
Related
- #79042 — truncated scrollback on resume, but truncated at the head and on a ~5.8 MB session; closed by the stale bot 2026-09-03.
- #8667 — "resuming loads truncated conversation history missing recent messages" in VS Code while the TUI shows the same file complete; auto-closed and locked.
- #35000 — loses the last message on restart, but after a hang rather than a cleanly finished turn.
- #29017 / #29148 — partial history loss on reopening a chat tab.
- #89318 / #50894 / #67474 — the same felt symptom in the TUI and desktop app, but those are focus-mode render rules; the VS Code webview has no focus mode, so this is a different mechanism.
None of the above pins the case where the session is small, the .jsonl is provably complete and correctly chained, and the loss is at the tail.
Workaround
Read ~/.claude/projects/<project>/<session-id>.jsonl directly — the missing messages are the trailing assistant records with text blocks. (I found it that way because a local hook of mine copies the last message out of the transcript; that hook is not part of Claude Code, so the raw file is the reproducible route.)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the VS Code extension's get_session_request and launch_claude entries in the Claude VSCode.log, then inspect the shipped webview/index.js bundle and the transcript replay path. Reproduce with the supplied session shape and compare the rendered records with the complete .jsonl, including record 173. Done means reopening the session renders the full transcript through its final assistant message and places the idle notice after the true end.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vscode
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100