[BUG] Shell Snapshot cause incorrect environment loaded
Environment
- Platform (select one):
- [x] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other: <!-- specify -->
- Claude CLI version: 1.0.48 (Claude Code)
- Operating System: macOS 15.4.1
- Terminal: Ghostty + tmux + zsh
Bug Description
The shell snapshot feature causes the environment lookup to be incorrect.
Steps to Reproduce
When I work with 2 directories with uv venv feature:
/project_a/.venv
/project_b/.venv
I run the claude to enter Claude Code at /project_a and it snapshots the PATH=/project_a/.venv/bin. Then, I switch to /project_b and enter the Claude Code, the PATH is still PATH=/project_a/.venv/bin cannot be changed to PATH=/project_b/.venv/bin
Expected Behavior
Switch to another directory, it should follow the shell's environment instead of the "first enter claude shell" status.
Actual Behavior
When entering Claude at any shell, it always uses the same configuration and cannot be changed unless the snapshot file is removed. It causes many environment-based config losses and cannot work with the correct terminal config.
Additional Context
<!-- Add any other context about the problem here, such as screenshots, logs, etc. -->
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗