VS Code extension: wrong working directory after automatic context compaction

Resolved 💬 2 comments Opened Mar 5, 2026 by Razpines Closed Mar 6, 2026
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What version of the IDE extension are you using?

26.304.20706

What subscription do you have?

Plus

Which IDE are you using?

VS Code

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64

What issue are you seeing?

After automatic context compaction in the VS Code extension, Codex appears to switch to the wrong working directory.

Expected workspace/cwd:
C:\projects\roly-poly

Observed after compaction:
C:\projects\poly

I see evidence in responses such as:
"I'm in c:\projects\poly and that script path isn't present here, so I'll locate the equivalent..."

If this is not caught immediately by the user, Codex can continue operating against a different folder entirely. It may run scripts/tools and resolve local paths using the wrong directory prefix, which can cause unintended file access/edits and incorrect command execution.

After this happens, path resolution fails or Codex starts looking for files in the wrong location.

What steps can reproduce the bug?

  1. Open VS Code workspace at C:\projects\roly-poly.
  2. Start/continue a Codex thread and work long enough for automatic context compaction to occur.
  3. Continue in the same thread.
  4. Observe Codex behavior/messages indicating cwd has changed to C:\projects\poly.

What is the expected behavior?

CWD/workspace context should remain pinned to C:\projects\roly-poly across automatic context compaction.

Additional information

  • Thread ID: 019ca480-8b20-7531-b24e-0c77db4588f9
  • I already submitted /feedback for this.
  • Possible clue: path includes a hyphen (roly-poly), and truncation may be related.
  • Related issues that seem similar but not exact:
  • #11757 (rehydrate stale workspace instructions)
  • #5957 (compaction-related context drift)
  • #4222, #7281, #9989 (extension cwd/workspace mismatch in related flows)

View original on GitHub ↗

2 Comments

github-actions[bot] contributor · 5 months ago

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

  • #11757
  • #13253
  • #13337

Powered by Codex Action

Razpines · 5 months ago

Correction: this appears to be expected session behavior, not a bug.

I originally started the conversation in poly, then instructed Codex to switch to roly-poly within the same long-lived thread.
After context compaction, cwd returned to the conversation's original workspace (poly), which made it look like cwd drift.

So this is not a hyphen/path-truncation issue and likely not an extension bug.