You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
VS Code extension: wrong working directory after automatic context compaction #13627
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?
Open VS Code workspace at C:\projects\roly-poly.
Start/continue a Codex thread and work long enough for automatic context compaction to occur.
Continue in the same thread.
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.
changed the title [-]VS Code extension: automatic context compaction switches cwd from C:\projects\roly-poly to C:\projects\poly[/-][+]VS Code extension: workspace cwd changes unexpectedly after context compaction[/+]on Mar 5, 2026
changed the title [-]VS Code extension: workspace cwd changes unexpectedly after context compaction[/-][+]VS Code extension: wrong working directory after automatic context compaction[/+]on Mar 5, 2026
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.
Activity
github-actions commentedon Mar 5, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
[-]VS Code extension: automatic context compaction switches cwd from C:\projects\roly-poly to C:\projects\poly[/-][+]VS Code extension: workspace cwd changes unexpectedly after context compaction[/+][-]VS Code extension: workspace cwd changes unexpectedly after context compaction[/-][+]VS Code extension: wrong working directory after automatic context compaction[/+]Razpines commentedon Mar 6, 2026
Correction: this appears to be expected session behavior, not a bug.
I originally started the conversation in
poly, then instructed Codex to switch toroly-polywithin 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.
Replace synthetic few-shot anchors with real bug reports + add anti-b…