Compact loses active git worktree context and falls back to main repository
What version of the Codex App are you using (From “About Codex” dialog)?
Version 26.608.12217 • Released Jun 9, 2026
What subscription do you have?
Pro Lite
What platform is your computer?
Darwin 25.5.0 arm64 arm
What issue are you seeing?
Summary
<img width="865" height="500" alt="Image" src="https://github.com/user-attachments/assets/0ea591f5-660c-4d5c-90c1-a5028834a21f" />
After running compact, the session lost the active git worktree context and switched back to the main repository directory.
The expected behavior is that the session should continue operating inside the previously active worktree. Instead, after compacting the context, the execution environment appears to have fallen back to the main repository path and branch, which creates a risk of applying changes to the wrong branch.
Current State After Compact
After compacting, the actual execution context is:
pwd
/Users/clouds3n/Coding/open-source/ai/Tron
git branch --show-current
master
git status
clean
The registered git worktrees are:
/Users/clouds3n/Coding/open-source/ai/Tron
-> master
/Users/clouds3n/.codex/worktrees/Tron/feature/clouds3n/openapi-open-app-management/base
-> feature/clouds3n/openapi-open-app-management/base
What steps can reproduce the bug?
- Create a new chat with new git worktree, and start long-time working inside the worktree
- Let it automatic trigger compact
- After compacted, observe or ask the assistant to verify the current execution context
What is the expected behavior?
After compact, the session should preserve:
- the active working directory
- the active git worktree
- the active branch
- the intended execution context for future file edits and shell commands
Additional information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗