[BUG] Local session history not restored after devcontainer rebuild when ~/.claude is volume-mounted
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?
I was trying to persist my session history in vscode devcontainers and troubleshooting through claude code, then it checked and suggested and populated this bug report.
What Should Happen?
When using Claude Code inside a devcontainer with ~/.claude volume-mounted to the host, local session .jsonl files persist correctly across container rebuilds, but the VSCode extension's session list does not show them after a rebuild.
Expected: Previously created sessions appear in the Local sessions list (the .jsonl data is intact)
Actual: Sessions list is empty, even though the .jsonl files are present on disk
Root cause hypothesis: The extension maintains a session registry/index in its own storage (likely ~/.vscode-server/ or extension host storage), which is ephemeral and lost on container rebuild. On startup, the extension does not re-index existing .jsonl files under ~/.claude/projects/.
Environment:
OS: Linux
Shell: bash
Claude Code in VSCode devcontainer
~/.claude is volume-mounted from host
Suggested fix: On extension startup, scan ~/.claude/projects/<project>/ for existing .jsonl files and re-populate the session index if the registry is missing or empty.
Error Messages/Logs
Steps to Reproduce
Open a project in a devcontainer with ~/.claude volume-mounted
Start a Claude Code session (Local tab) and have a conversation
Verify the session .jsonl exists: ~/.claude/projects/<project>/
Rebuild the devcontainer (Dev Containers: Rebuild Container)
Open Claude Code → Local sessions tab
Claude Model
Sonnet (default)
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
2.1.81 (Claude Code)
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
VS Code integrated terminal
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗