Compact loses active git worktree context and falls back to main repository

Open 💬 2 comments Opened Jun 11, 2026 by CloudSen
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

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?

  1. Create a new chat with new git worktree, and start long-time working inside the worktree
  2. Let it automatic trigger compact
  3. 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_

View original on GitHub ↗

2 Comments

CloudSen · 2 months ago

This issue has persisted for months. At this price point, it’s disappointing that even basic long-running tasks still cannot be executed reliably.

github-actions[bot] contributor · 2 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #25958

Powered by Codex Action