Scope Codex VS Code chats to the current workspace/project
What variant of Codex are you using?
IDE Extension
cc @etraut-openai, opening this as a fresh feature request per your guidance in https://github.com/openai/codex/issues/17185#issuecomment-4583634793.
What feature would you like to see?
In the Codex VS Code extension, chat/thread history should be scoped, grouped, or filtered by the current workspace/project.
Right now, chats from different projects appear together in one shared history list. When working across multiple repositories, VS Code windows, remote workspaces, WSL/SSH sessions, or unrelated codebases, it becomes easy to resume the wrong thread or confuse which chat belongs to which project.
This creates a real workflow problem because Codex threads carry project-specific context. Accidentally continuing a thread from another project can lead to irrelevant suggestions, wrong assumptions, and extra mental overhead.
A useful MVP could be:
- Associate each thread with its originating VS Code workspace folder or working directory.
- Show current-workspace threads first in the extension history.
- Hide, collapse, or visually separate threads from other workspaces.
- Provide an “all threads” view or toggle for users who intentionally want global history.
- Preserve existing thread rename/archive behavior.
This does not need to introduce a full project-management system. The most important behavior is that when I am in Project A, I should not have to scan through chats from Projects B, C, and D to find the relevant Codex thread.
Additional information
This is related to the closed issue #17185, but I am opening a new feature request per maintainer guidance here:
https://github.com/openai/codex/issues/17185#issuecomment-4583634793
There is also related discussion in #12564, where the VS Code extension recently gained thread renaming. Renaming helps, but it is only a mitigation for the broader issue: chats from unrelated projects are still mixed together.
A commenter noted that Codex CLI already appears to have working-directory-based isolation by default, with codex resume --all available for showing all threads:
https://github.com/openai/codex/issues/17185#issuecomment-4582037042
If that is accurate, the VS Code extension could potentially reuse the same working-directory concept and expose it in the extension history UI.
16 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
I agree this is a natural fit for the next step after adding the capability to rename threads.
One important thing though, that if filtration of threads by working directory is added to VS Code extension, there also should be a way to "Show All". Because, for instance, if you move or copy a project to a different directory, there should be a way to resume the old thread about this project in the new location as well.
This has my vote. When I'm working on an Arduino project, I don't need to see web development threads.
That would be so nice, especially for linux users that still don't have the app :)
This is very important for those working across multiple projects.
I want to add a more severe real-world impact case here.
This is not just a history/navigation issue. In my setup, Codex chat sessions appeared to leak across multiple VS Code windows and repositories, and this resulted in unintended changes being applied across multiple repos.
Environment:
Setup:
Current local evidence, redacted:
.github/dependabot.ymlfiles.Impact:
In my view this should be treated as a bug / safety issue, not only an enhancement request. Other coding assistants such as Claude and GitHub Copilot handle multi-window / multi-repo project separation in a way that does not expose the same kind of cross-repo session confusion.
Expected behavior:
Related issues:
I think #25319 should be separated from full multi-root workspace support in #2909.
Multi-root is hard because VS Code can have many workspace folders in one window, while a Codex core session still has one effective
cwd. That is a real model mismatch, and fixing it properly probably belongs in #2909.But the common single-root VS Code workspace case is much simpler. Codex already records cwd for each session, and
thread/list.cwdalready supports filtering by cwd.So the VS Code extension can fix the main #25319 problem by passing the current workspace folder / effective cwd into its
thread/listrequests. When no workspace folder is open, it can keep showing the global history; multi-root can keep today's effective behavior for now and leave true multi-root semantics to #2909.Until there is an official fix, Codex Workspace Filter can be used as a small workaround.
I am curious about why this feature is not supported until now. When open codex in vscode, it is hard to find the thread I want from hundred of my chats.
Because #17185 didn't get enough interest from the community.
Please upvote this one.
+1. I strongly support this request.
I use the Codex VS Code extension across multiple repositories and VS Code windows every day, and the current global mixed history makes the extension much harder to use than it should be.
The main issue is that Codex threads are project-specific by nature. A thread usually contains assumptions about a particular repository, file structure, build system, dependencies, and task context. When threads from unrelated projects all appear in one shared history list, it becomes very easy to reopen or continue the wrong conversation.
This is not just a small navigation inconvenience. It creates real workflow risk:
The CLI already appears to have a better mental model here by scoping resume behavior around the working directory, with an option to show all sessions. The VS Code extension should follow a similar model.
A good MVP would be:
This would make the extension much safer and easier to use for people who work across multiple active projects. Right now, the lack of project/workspace separation is one of the biggest sources of friction in the VS Code extension.
For anyone affected by this before an upstream fix lands, I published a small experimental workaround:
https://github.com/Efs-O/codex-sessions-workspace-patch-kit
Current pre-release:
https://github.com/Efs-O/codex-sessions-workspace-patch-kit/releases/tag/v0.4.0
It patches the shipped
openai.chatgptVS Code extension bundle locally so Codex session history is filtered to the active VS Code workspace roots. It also widensthread/listrequests before filtering, so older matching workspace sessions are less likely to be hidden behind newer sessions from unrelated workspaces.Compatibility note: this has been tested locally against
openai.chatgpt 26.616.xextension bundles. It is a pre-release workaround, not an upstream source patch. Because it patches minified shipped extension code, a new Codex/VS Code extension version can overwrite the patch or change the anchors so the patch no longer applies.Please run the dry-run flow before applying:
To undo it:
Feedback would be very helpful, especially reports about version drift, missing anchors, and workspace-history edge cases.
This is soo usefull! thanks. I just tested a few moments and works like a charm, but I have a question, this fix will only separated just at visual level or will separate at logical level, like you know, codex will not mix context or will do?
<img width="1343" height="298" alt="Image" src="https://github.com/user-attachments/assets/52add731-77e0-4696-bcff-f5c6e2b642cc" />
Thanks for testing it.
This workaround is primarily a history/sidebar filter, not a full logical isolation fix.
What it does:
thread/listresults in the VS Code extension host so the visible history only shows sessions whose savedcwdbelongs to the current VS Code workspace rootsthread/listrequest before filtering so older matching workspace sessions are less likely to be hidden behind newer sessions from other workspacesWhat it does not fully solve:
So yes: it should reduce accidental cross-project history selection, but it should be treated as a UI/history workaround, not a complete logical sandbox. The proper upstream fix should scope both history and resume/restore behavior to the workspace, with an explicit "show all / resume from another workspace" flow.
This feature is so needed asap.
Additional concrete reproduction: active IDE workspace and thread
cwdcan silently divergeI encountered a concrete instance of the risk described in this issue. This report is intentionally sanitized: repository names, usernames, absolute paths, remotes, commit hashes, prompts, and organization details have been replaced or omitted.
Environment
openai.chatgpt 26.715.319251.128.1AGENTS.mdObserved behavior
The IDE context showed a file from Repository B, and the user supplied a task whose baseline commit, target files, and branch invariants all belonged to Repository B. However, the active Codex thread had retained Repository A as its recorded
cwdand writable workspace root. The agent therefore received and followed Repository A's project instructions.The mismatch was not apparent from the visible editor tab or the task context. It became visible only because the agent ran defensive preflight checks:
The requested files and baseline commit did not exist in Repository A. A separate read-only check then confirmed that Repository B contained the expected files, branch, remote, and baseline.
No wrong-repository write occurred because the agent stopped on the baseline mismatch. Without those checks, a plausible outcome would have been creating similarly named files, committing them, or pushing a branch in the wrong repository.
Why this matters
This is more than chat-list clutter. It is a repository-boundary and instruction-boundary risk:
cwdand writable root from another repository.AGENTS.mdinstructions are then loaded from the stale thread workspace.This appears related to #25319 (workspace-scoped thread history) and #11757 (stale cross-workspace project instructions), but this case specifically demonstrates a silent divergence between the active IDE context and the thread's executable/writable workspace.
Reproduction outline
AGENTS.mdand Git remote.cwd, uses Repository A's project guidance, and has Repository A as its writable root.pwd,git rev-parse --show-toplevel, andgit remote -v.I cannot yet determine whether the triggering action was thread restoration, panel/window restoration, or selection from the global thread list. Please consider checking all three paths.
Expected behavior
At minimum, the extension should make the distinction explicit and prevent silent cross-repository execution. Possible safeguards:
cwddiffer, show a blocking confirmation before sending or executing a task.AGENTS.mdsources belong to the selected workspace chain.cwd, writable sandbox roots, and Git root. A mismatch should fail closed or require confirmation.Current workaround
Users can reduce the risk by opening the intended repository as the VS Code folder, reloading the window, creating a new Codex thread, and manually checking
pwd, the Git root, and the remote before allowing writes. This is useful defensively, but it should not be required for every resumed IDE thread.I did not attach raw session logs because they can contain private prompts, local paths, repository names, remotes, and configuration details. I can provide additional sanitized diagnostics if maintainers identify the specific extension/app-server fields needed.
Please also include per-workspace active-thread restoration, not only filtering/grouping the history list.
Concrete workflow:
Expected behavior:
workspace identity -> last active Codex thread..code-workspaceidentity plus its roots.cwdbelongs to another workspace.This is distinct from transcript persistence: the conversations are still present, but the extension does not remember which one was active for each workspace. Claude Code's VS Code workflow already behaves as users expect here: reopening a saved workspace returns directly to the last conversation for that workspace.