[VS Code] New Codex Agent remains bound to a stale selected-project instead of the current workspace
What version of the IDE extension are you using?
26.715.31925
What subscription do you have?
Pro (5x)
Which IDE are you using?
VS Code 1.129.1
What platform is your computer?
Darwin 25.5.0 arm64 arm
What issue are you seeing?
The Codex VS Code extension initializes new chats and agents with a previously opened project instead of the folder currently open in VS Code.
The current VS Code workspace and Explorer show:
~/path/to/current-project
I am trying to start a new Codex conversation specifically for this current project. However, when I use either of these commands:
Codex: New Chat in ChatGPT SidebarCodex: New Codex Agent
the new session is always initialized with:
~/path/to/previous-project
An previous existing Codex conversation can report the correct current project, but I cannot create a new conversation that uses it. Reloading VS Code and disabling and re-enabling the extension do not correct the project binding.
This blocks me from using Codex for the currently opened project. Any new agent may read files, execute commands, or make changes in the previous repository while VS Code visibly shows the current project.
What steps can reproduce the bug?
- Open
~/path/to/current-projectin VS Code. - Confirm that the VS Code Explorer shows
current-projectas the active workspace. - Try creating a new Codex session using each of these commands:
Codex: New Chat in ChatGPT SidebarCodex: New Codex Agent
- In each newly created session, ask Codex to run:
``sh``
pwd
- Observe that sessions created by both commands use:
~/path/to/previous-project
instead of the currently opened project:
~/path/to/current-project
The issue reproduces every time with both commands. Reloading VS Code and disabling and re-enabling the extension do not resolve it.
What is the expected behavior?
New Codex chats and agents should use the folder currently open in VS Code:
~/path/to/current-project
Both Codex: New Chat in ChatGPT Sidebar and Codex: New Codex Agent should initialize the new session with the current VS Code workspace, rather than a previously selected project.
Additional information
An existing Codex conversation reports the current project when asked, while newly created chats and agents are initialized with the previous project.
For diagnostic purposes, I inspected the extension's persisted VS Code state. It contained an entry similar to:
{
"selected-project": {
"type": "local",
"projectId": "/Users/<username>/path/to/previous-project"
}
}
After I removed the selected-project entry as a diagnostic test and reloaded VS Code, the extension recreated it with the previous project path.
The issue has persisted for at least two days. Reloading VS Code and disabling and re-enabling the extension have not resolved it.