VS Code extension: sessions not saved, history tab clears current chat, and history shows empty sessions
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?
Environment
- Claude Code VS Code extension
- OS: Linux (Ubuntu)
Bugs
- Sessions are not being saved
Completed chat sessions do not appear in the history panel and no corresponding
.jsonl files are created under ~/.claude/projects/<project>/
- Sessions only saved when Claude accesses the session directory mid-conversation
The only sessions that were saved are ones where Claude ran filesystem commands
against ~/.claude/projects/ during the conversation (e.g. ls, cat on session files).
This suggests that accessing the session directory mid-conversation triggers an
unintended flush/save as a side effect — not normal intended save behavior.
- Clicking the history tab clears the current chat
As soon as the history tab is opened, all messages in the currently active chat
disappear from view.
- Sessions in the history panel show no messages
Clicking on any session in the history panel displays an empty chat — no messages
are rendered even when the underlying .jsonl file exists on disk with correct content.
What Should Happen?
- All sessions should be continuously saved to disk and appear in the history panel
- Sessions should only be saved due to normal session lifecycle events, not as a
side effect of filesystem access
- Clicking the history tab should not affect the currently active chat session
- Selecting a session in the history panel should render all its messages from the
corresponding .jsonl file on disk
Error Messages/Logs
No visible error messages. The chat silently clears and the history panel silently
shows empty sessions with no error output.
Steps to Reproduce
For bug 3 & 4:
- Start a chat session in the VS Code extension and exchange several messages
- Click the history tab/button in the chat panel
- Observe: all messages in the current chat disappear from view
- Click on the current session in the history panel
- Observe: the session shows no messages despite the .jsonl file existing on disk
For bug 1:
- Start and complete multiple chat sessions in the VS Code extension
- Close each session normally
- Check ~/.claude/projects/<project>/ — most session .jsonl files will be missing
- Only sessions where Claude ran ls/cat commands on ~/.claude/projects/ during the
conversation will have corresponding .jsonl files on disk
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.168
Platform
Other
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Other
Additional Information
Related issue: #59202 (VS Code webview discards sessionID on re-deserialization).
Bug 3 & 4 may share the same root cause — clicking history triggers a webview
re-render which discards the sessionID, orphaning the current session.
Bug 1 & 2 appear to be unreported and may be a separate issue where sessions are
only flushed to disk when the project directory is accessed, rather than on a
normal save/close lifecycle.
Verified: the surviving .jsonl file contains correct content (confirmed by reading
it directly), so the issue is in session lifecycle management and UI rendering,
not data corruption.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗