Skip to content

Clearing an explicit global interpreter leaves global reads on the stale manager #1976

Open

Description

Problem

After python.defaultInterpreterPath is removed, the global environment can remain stuck on the previously configured interpreter.

For example, file-scoped reads correctly switch from system-312 to the auto-discovered system-314, but getEnvironment(undefined) still returns system-312. No environment-change event is emitted, so consumers may continue using the stale interpreter.

Failed CI job: https://github.com/microsoft/vscode-python-environments/actions/runs/41732632176/job/126253626955

Cause

Global routing uses the manager that owns the cached environment before checking the configured default manager. When the explicit selection is cleared, the cache still points to the old system manager, so the refresh reads the old interpreter again.

This regression was introduced by #1887 on November 2, 2026. The failing branch only removes an unrelated workflow.

Expected behavior

After an explicit global interpreter is cleared, routing should return to the configured/default environment manager, update the cached environment, and emit a change event.

Suggested fix

Track which manager made the global selection separately from which manager owns the environment, and route through the configured/default manager after the explicit selection is cleared.

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions