Summary
The Codex VS Code extension spawns MCP servers from the VS Code installation directory instead of the workspace directory. This fundamentally breaks semantic code analysis tools like Serena that rely on correct working directory to index and analyze codebases.
Impact
Serena provides symbolic code operations that are essential for large codebase work:
find_symbol / find_referencing_symbols - call graph traversal
replace_symbol_body - precise symbol-level edits
get_symbols_overview - fast structural understanding
Without correct cwd, these tools cannot auto-detect the project, forcing users to manually activate projects every session. This defeats the purpose of semantic tooling.
Current State
| Client |
MCP Server cwd |
Works? |
| Codex CLI |
Project directory |
✅ |
| Codex VS Code (Remote: WSL) |
/mnt/c/.../Microsoft VS Code |
❌ |
Proposed Fix
When spawning MCP servers, pass cwd: ${workspaceFolder} (or the active workspace root). This is a one-line fix that would unblock all path-dependent MCP tools.
Workarounds Attempted
--project-from-cwd flag in Serena - fails because cwd is wrong
- Manual
activate_project each session - works but error-prone
- Wrapper scripts - cannot access workspace info at spawn time
CODEX_WORKSPACE_ROOT env var - only available at tool-call time, not spawn time
I've also filed a feature request on Serena to use CODEX_WORKSPACE_ROOT at tool-call time (oraios/serena#970), but the proper fix should be in the VS Code extension.
Related Issues
Environment
- Codex VS Code extension: v0.4.67
- Platform: WSL2 Ubuntu on Windows 11
- VS Code: Remote - WSL
Summary
The Codex VS Code extension spawns MCP servers from the VS Code installation directory instead of the workspace directory. This fundamentally breaks semantic code analysis tools like Serena that rely on correct working directory to index and analyze codebases.
Impact
Serena provides symbolic code operations that are essential for large codebase work:
find_symbol/find_referencing_symbols- call graph traversalreplace_symbol_body- precise symbol-level editsget_symbols_overview- fast structural understandingWithout correct cwd, these tools cannot auto-detect the project, forcing users to manually activate projects every session. This defeats the purpose of semantic tooling.
Current State
/mnt/c/.../Microsoft VS CodeProposed Fix
When spawning MCP servers, pass
cwd: ${workspaceFolder}(or the active workspace root). This is a one-line fix that would unblock all path-dependent MCP tools.Workarounds Attempted
--project-from-cwdflag in Serena - fails because cwd is wrongactivate_projecteach session - works but error-proneCODEX_WORKSPACE_ROOTenv var - only available at tool-call time, not spawn timeI've also filed a feature request on Serena to use
CODEX_WORKSPACE_ROOTat tool-call time (oraios/serena#970), but the proper fix should be in the VS Code extension.Related Issues
Environment