Skip to content

Support for multi-root workspaces #2909

Closed

Description

@bscan

What version of the VS Code extension are you using?

0.4.0

Which IDE are you using?

VS Code

What platform is your computer?

Linux 6.15.7-200.fc42.x86_64 x86_64 unknown

What steps can reproduce the bug?

When using a Multi-root Workspace, codex is unable to locate files in any folder other than the first. The image shows the extension is able to resolve the relative file paths (see the highlighted links to my_script), but codex does not see the file. If you grant Full Access to the Agent, it can sometimes navigate the file system and find the script, but that's a slow and unreliable mechanism considering the extension has already identified the correct file.

Image Image

What is the expected behavior?

The extension should submit the full path of the current active file instead of submitting a relative path that codex does not understand.

What do you see instead?

Codex is unable to find the active file.

Additional information

These are related: #471 , #2797 and are discussing support for multiple folders. That is also a nice enhancement and would be needed for full multi-root workspace support. However, given that codex is currently limited to a single folder, it is a bug that the vscode extension is sending relative paths that codex does not understand.

Activity

  1. added
    extensionIssues related to the VS Code extension
    on Aug 29, 2025
  2. Pengi123 commented on Dec 25, 2025

    @Pengi123

    I think this is already added in the CLI. I'm not sure why it hasn't yet been added to the extension?
    Pls see this #2797

    It would be so amazing to have that added to the extension!

  3. tlerbao commented on Jan 13, 2026

    @tlerbao

    Eagerly hoping the vscode plugin also supports --add-dir

  4. NateLangloisProscia commented on Jan 31, 2026

    @NateLangloisProscia

    This is killing me trying to move to using Codex as my primary coding assistant agent. It works so great on my first project/root in my multi-root workspace. However, working with other projects/roots is very painful with worse results and constant lack of permission (it needs to keep asking me, despite autoApprove configuration of **/* which works as expected for the 1st root).

  5. ribber commented on Mar 4, 2026

    @ribber

    This problem has troubled me for a long time, and I hope it can be resolved.

  6. Achour commented on Mar 14, 2026

    @Achour

    still waiting ..

  7. praemon commented on Apr 7, 2026

    @praemon

    This is such an important "feature" to be missing. Makes Codex unusable for those with multiple root folders. Other extensions like Copilot and Claude have no issues with this.

  8. brandonbloom commented on Apr 25, 2026

    @brandonbloom
  9. bscan commented on Apr 28, 2026

    @bscan
    Author

    This is currently the most upvoted open issue affecting the VS Code extension that causes broken behavior (e.g., incorrect paths, broken links, and approval request issues).

    Given that this is a confirmed bug impacting core functionality for many users, would it make sense to add the "bug" label for better visibility and triage?

    For reference: https://github.com/openai/codex/issues?q=is%3Aissue%20state%3Aopen%20sort%3Areactions-%2B1-desc%20label%3Aextension

  10. 1 remaining item

  11. emiltin commented on Jun 11, 2026

    @emiltin

    Yes, this absolutely needs to be fixed. It makes no sense that Codex can only work in one of the folder in the workspace.

  12. flamein commented on Jun 15, 2026

    @flamein

    asked codex about this bug:

    Summary
    The VS Code extension handles multi-root UI links, but Codex receives paths relative to the first workspace root. Users report broken file lookup, broken links, and approval prompts for non-first roots. Comments confirm this affects Linux and Windows, and users specifically ask for --add-dir / multi-root support.
    Proposed Fix
    Make the VS Code extension send workspace-root information explicitly.
    In the extension, enumerate vscode.workspace.workspaceFolders.
    Use absolute folder.uri.fsPath values only.
    Pick cwd as:the workspace folder containing the active editor or referenced file;
    otherwise the first workspace folder.

    Send all workspace folders to Codex:CLI / TypeScript SDK path: workingDirectory = cwd, additionalDirectories = allRootsExceptCwd.
    app-server v2 path: send cwd plus runtimeWorkspaceRoots = allRoots.

    The backend already supports the required shape:
    TS SDK forwards additionalDirectories as repeated --add-dir: exec.ts (line 22), exec.ts (line 114)
    app-server v2 has thread/start.runtimeWorkspaceRoots: thread.rs (line 112)
    app-server v2 has turn/start.runtimeWorkspaceRoots: turn.rs (line 96)
    backend dedupes runtime roots: request_processors.rs (line 534)
    core already tests rebinding permission profiles to runtime workspace roots: session/tests.rs (line 2495)
    Extra Detail
    The extension should also rewrite editor/file mentions to absolute paths before placing them in the prompt context. Relative display labels are fine in the UI, but the payload to Codex needs either absolute paths or a root-qualified form that the backend can resolve.
    Tests
    Add VS Code extension tests for:
    two workspace folders, active file in second root;
    prompt references a file in second root;
    generated request includes all roots and cwd points at the containing root;
    Windows paths round-trip correctly;
    approval/auto-approve behavior works for files outside the first root.
    This is mainly an extension-side bug. The repo already has most backend/SDK machinery needed.

    This suggest to me that this bug is in the wrong repository, and it should be in the vscode extension repository, that I haven't found yet 😅

  13. emiltin commented on Jun 16, 2026

    @emiltin

    This suggest to me that this bug is in the wrong repository, and it should be in the vscode extension repository, that I haven't found yet 😅

    I did not experience this bug with Claude.

  14. ShunnyBunny commented on Jun 26, 2026

    @ShunnyBunny

    +1 for first-class Codex App support for multi-root workspaces.

    My workflow often spans separate repos like frontend, backend, and shared libraries. CLI --add-dir / workspace_roots can grant access, but the App still feels centered on one project root per thread.

    I’d love a reusable Codex App workspace with multiple roots where file search, @ mentions, diffs, Git actions, worktrees, and per-repo AGENTS.md context all work naturally across roots.

    Main use case: one product change that updates an API, web client, shared types, and tests across multiple repos without splitting the work into separate Codex threads.

  15. emiltin commented on Jun 26, 2026

    @emiltin

    As a workaround I place all repos in a folder which is then the only folder added to the workspace. It works well with Codex, but requires you to move repos around if you want a different workspace with some of the same repos, so it's hardly ideal.

  16. flamein commented on Jun 29, 2026

    @flamein

    This suggest to me that this bug is in the wrong repository, and it should be in the vscode extension repository, that I haven't found yet 😅

    I did not experience this bug with Claude.

    Github copilot vscode extension also does not have this problem
    My point was that I don't think this codex repo has the source for the vscode-extension

  17. flamein commented on Jun 29, 2026

    @flamein

    As a workaround I place all repos in a folder which is then the only folder added to the workspace. It works well with Codex, but requires you to move repos around if you want a different workspace with some of the same repos, so it's hardly ideal.

    won't this absolutely blow up your IDE context, eating away your input tokens?

  18. emiltin commented on Jun 30, 2026

    @emiltin

    As a workaround I place all repos in a folder which is then the only folder added to the workspace. It works well with Codex, but requires you to move repos around if you want a different workspace with some of the same repos, so it's hardly ideal.

    won't this absolutely blow up your IDE context, eating away your input tokens?

    It works for me, I have maybe 4-5 repos in the workspace. I don't think it would be different from have multiple repos in the workspace root.

  19. java668-real1 commented on Jul 24, 2026

    @java668-real1

    为什么还不支持

  20. ShunnyBunny commented on Jul 24, 2026

    @ShunnyBunny

    为什么还不支持

    I think support was added today. But I have not tried it

  21. Pengi123 commented on Jul 24, 2026

    @Pengi123

    I tested, and I see that the codex team added support for multi-root workspace.

  22. tlerbao commented on Jul 24, 2026

    @tlerbao

    @Pengi123 Where is it

  23. tlerbao commented on Jul 24, 2026

    @tlerbao

    @Pengi123 Yeah, I see it. Now we can add extra folders to the project, and we can switch project folders in the Files panel. However, in the Review panel, we can't switch project folders. When I'm working on both frontend and backend projects, both being git repositories, I can only see the git changes for the main folder. This isn't good and should be improved.

  24. etraut-openai commented on Aug 6, 2026

    @etraut-openai
    Contributor

    The extension now enumerates all workspaceFolders.

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

    enhancementNew feature or requestextensionIssues related to the VS Code extension

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions