/resume loses sessions in containers due to PID-keyed session index

Resolved 💬 2 comments Opened Apr 12, 2026 by nick0pen Closed Jun 4, 2026

Description

When running Claude Code inside a devcontainer (or any container) with ~/.claude bind-mounted from the host, the /resume command fails to show most previous sessions after container restarts.

Root Cause

Session metadata files in ~/.claude/sessions/ are named by PID (e.g., 8743.json). When a container restarts, the PID namespace resets. New processes can be assigned the same PIDs, causing their session metadata files to overwrite the old ones. This destroys the mapping from PID → session UUID, making those sessions invisible to /resume.

The actual session conversation data (JSONL files in ~/.claude/projects/) is intact and unaffected — only the index is lost.

Steps to Reproduce

  1. Run Claude Code inside a devcontainer with ~/.claude bind-mounted from the host
  2. Have a conversation, exit
  3. Rebuild/restart the container
  4. Run Claude Code again, use /resume
  5. The session from step 2 is missing from the list

Expected Behavior

All previous sessions for the current project should appear in /resume, regardless of container restarts.

Suggested Fix

Consider using session UUID as the filename for session metadata instead of PID, or maintain a separate index that isn't tied to ephemeral PIDs. The PID can still be stored inside the file for detecting active sessions.

Environment

  • Claude Code in VS Code devcontainer
  • ~/.claude bind-mounted: source=${localEnv:HOME}/.claude,target=/home/vscode/.claude,type=bind,consistency=cached
  • Linux (WSL2)

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗