Repository navigation
Description
Written with Claude Code (AI-assisted) and reviewed by me.
Environment data
- Python Environments extension version: 1.42.0
- Python extension (
ms-python.python) version: 2026.10.0 - VS Code version (Help → About): 1.145.2
- OS and version: Windows 11 (10.0.26200)
- Python version (& distribution if applicable, e.g. Anaconda): 3.15.2 (Pixi environment)
- Environment manager in use: Pixi, via the
renan-r-santos.pixi-codeextension (0.2.0) - Shell (bash / zsh / fish / pwsh / cmd / other): cmd, pwsh
- Remote / container scenario (none / WSL / SSH Remote / Dev Container / Codespaces): none
- Workspace type (single folder / multi-root / mono-repo): single folder
- Is this a regression? If yes, last known working extension version: No. Follow-up to Probable race condition when searching for env managers: ’environment manager “pypa.hatch:hatch” is not registered’ #1517 / Fix false-positive "environment manager not registered" warning on startup #1533.
Repro Steps
- Install an extension that contributes an environment manager through
registerEnvironmentManager, e.g. Pixi Code (renan-r-santos.pixi-code), and open a project it manages. - Set
"python-envs.defaultEnvManager": "renan-r-santos.pixi-code:pixi". In my casepython.defaultInterpreterPathalso points to a Miniconda interpreter. - Reload the window.
Expected behavior
The workspace ends up on the configured manager's environment (here LearningMLDL:default).
Actual behavior
The priority chain runs before the third-party manager has registered (its extension only activates after this extension returns its API), so selection falls back to python.defaultInterpreterPath. Since #1533 the warning is correctly suppressed, but the selection itself is never re-evaluated once the manager registers, so the workspace stays on the fallback (base) until the user picks the environment again.
Logs
Released 1.42.0 (timestamps from one reload):
12:09:30.779 [interpreterSelection] Applying initial environment selection for 1 workspace folder(s)
12:09:30.779 [warning] [priorityChain] d:\Projects\LearningMLDL defaultEnvManager 'renan-r-santos.pixi-code:pixi' not found, trying next priority
12:09:30.861 Extension for manager renan-r-santos.pixi-code:pixi is not active: Activating...
12:09:31.073 Extension for manager renan-r-santos.pixi-code:pixi is now active.
12:09:32.915 [interpreterSelection] LearningMLDL: base (3.13.5) (source: defaultInterpreterPath)
The manager is checked about 80 ms before its extension even starts activating, so this can't be fixed on the contributing extension's side: any extension that depends on ms-python.vscode-python-envs activates only after the check has already run.
In this run the Pixi extension later restored its own saved selection, which happened to correct things. In another run with the same setup, the in-flight startup selection overwrote that correction:
12:32:56.728 Changed environment from undefined to LearningMLDL:default (3.15.2) for: d:\Projects\LearningMLDL
12:32:57.165 Changed environment from LearningMLDL:default (3.15.2) to base (3.13.5) for: d:\Projects\LearningMLDL
12:32:57.167 [interpreterSelection] LearningMLDL: base (3.13.5) (source: defaultInterpreterPath)
Additional context
- Probable race condition when searching for env managers: ’environment manager “pypa.hatch:hatch” is not registered’ #1517 / Fix false-positive "environment manager not registered" warning on startup #1533 fixed the false-positive warning from this race. The Fix false-positive "environment manager not registered" warning on startup #1533 description deliberately didn't fix the race itself, because waiting for an unknown set of managers needs an arbitrary deadline and would delay startup or real error reporting.
- A fix that avoids those concerns: don't wait at all, but remember which workspace folders fell back because their configured manager was missing, and re-select just those folders when that manager registers (
EnvironmentManagers.onDidChangeEnvironmentManageralready fireskind: 'registered'), within the same 30s windowmanagerReadyuses. There's no deadline at startup, no change to startup ordering, misspelled ids still warn immediately, and an extension that shows up much later doesn't switch the interpreter mid-session. - Same root cause reported on the Pixi side: Warning environment manager pixi is not registered prefix-dev/pixi-code#44. Likely also affects Hatch (
pypa.hatch:hatch, see Probable race condition when searching for env managers: ’environment manager “pypa.hatch:hatch” is not registered’ #1517).
I have a PR ready implementing this, with unit tests.
Activity