Skip to content

Fix #26034: interpreter selection reverting to default interpreter#26063

Open
mohityadav8 wants to merge 1 commit into
microsoft:mainfrom
mohityadav8:fix-26034-interpreter-selection
Open

Fix #26034: interpreter selection reverting to default interpreter#26063
mohityadav8 wants to merge 1 commit into
microsoft:mainfrom
mohityadav8:fix-26034-interpreter-selection

Conversation

@mohityadav8

@mohityadav8 mohityadav8 commented Jul 26, 2026

Copy link
Copy Markdown

Fixes #26034

Root Cause

  1. Gate Mismatch (Single File Revert Bug): When a user has ms-python.vscode-python-envs installed but python.useEnvironmentsExtension is not explicitly set, shouldEnvExtHandleActivation() correctly yields control of the status bar to the Environments extension. However, setInterpreter.ts and resetInterpreter.ts were only checking useEnvExtension(), meaning they never reported interpreter selections to the Environments extension. The visible status bar therefore kept showing its default when working outside a workspace.
  2. Stale Cache Race Condition: getActiveInterpreter() races resolution against a 100ms timeout. On timeout, it falls back to a cached value. Previously, this cache wasn't cleared on config changes, so slow resolutions would surface old interpreters in the UI and get stuck there.

Changes

  • Widened gates in setInterpreter.ts, resetInterpreter.ts, and interpreterService.ts (resolveActiveInterpreter) to check useEnvExtension() || shouldEnvExtHandleActivation().
  • Added .catch() handling around legacy calls so synchronization failures don't undo the native setting.
  • Updated _onConfigChanged in interpreterService.ts to clear lastKnownActiveInterpreter and in-flight states when paths change.
  • Added timedOutActiveInterpreterKeys tracking to proactively trigger a display refresh once delayed resolutions finally complete.
  • Added shouldEnvExtHandleActivationStub to associated unit tests to support the widened logic gate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot select interpreters

1 participant