You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Codex appears to ignore the Python interpreter selected in VSCode and instead uses the system Python interpreter.
Expected behavior:
When selecting a project-local virtual environment via:
Python: Select Interpreter
for example:
./xvx-venv/bin/python
Codex should inherit and use that interpreter/environment.
Observed behavior:
Codex uses:
/usr/bin/python
instead of the selected venv interpreter.
What steps can reproduce the bug?
Reproduction steps:
Create a project-local virtual environment:
python3 -m venv xvx-venv
Select the interpreter in VSCode:
./xvx-venv/bin/python
Open Codex inside VSCode
Ask Codex:
which python
Where interpreter_source is something like selected_interpreter | workspace_default | system_fallback.
That would make it obvious whether Codex lost VS Code's selected interpreter before the agent starts, versus inheriting it correctly and drifting later.
The AGENTS.md workaround is useful for now, but I think the real fix is making the interpreter decision inspectable at the moment the session boots. If helpful, I'm happy to pressure-test a tiny receipt shape against venv, uv, and pyenv edge cases.
Activity
magnetix-cgn commentedon May 21, 2026
Seems to be valid only for Copilot not Codex, please check maybe I have to create a Copilot issue
scarpma commentedon May 22, 2026
I also agree with this issue and that is not about copilot, but the codex extension for vscode
magnetix-cgn commentedon May 22, 2026
quick fix - workaround: please adapt to your settings
add to AGENTS.md
Always run Python commands in this repository with the existing project virtualenv:
xvx-venv/bin/python
Do not create a second Python environment for this workspace unless explicitly requeste
Keesan12 commentedon May 22, 2026
This feels easier to debug if startup emits one tiny interpreter receipt somewhere visible in diagnostics or
/status, for example:{ python_executable, sys_prefix, venv_root, interpreter_source, cwd }Where
interpreter_sourceis something likeselected_interpreter | workspace_default | system_fallback.That would make it obvious whether Codex lost VS Code's selected interpreter before the agent starts, versus inheriting it correctly and drifting later.
The AGENTS.md workaround is useful for now, but I think the real fix is making the interpreter decision inspectable at the moment the session boots. If helpful, I'm happy to pressure-test a tiny receipt shape against
venv,uv, andpyenvedge cases.