Skip to content

VS Code extension: wrong working directory after automatic context compaction #13627

Closed

Description

@Razpines

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

Activity

  1. 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
  2. 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
  3. added
    contextIssues related to context management (including compaction)
    on Mar 6, 2026
  4. Razpines commented on Mar 6, 2026

    @Razpines
    Author

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    contextIssues related to context management (including compaction)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions