Skip to content

Restore global manager routing after clearing an explicit interpreter - #1977

Closed
Eduardo Villalpando Mello (edvilme) with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-global-interpreter-stale-manager
Closed

Eduardo Villalpando Mello (edvilme) with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-global-interpreter-stale-manager

Conversation

Copilot AI commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Clearing python.defaultInterpreterPath could leave global reads routed through the cached environment’s stale owner. The cache remained unchanged and no environment-change event was emitted.

  • Routing provenance

    • Track the manager responsible for the global selection separately from the cached environment’s owner.
    • Clear that provenance with the explicit selection so routing returns to the configured/default manager.
  • Regression coverage

    • Verify global routing, reads, cache updates, and change events switch to the auto-discovered environment.

Co-authored-by: edvilme <5952839+edvilme@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix global interpreter stale manager issue on clear selection Restore global manager routing after clearing an explicit interpreter Nov 4, 2026
@edvilme Eduardo Villalpando Mello (edvilme) added the bug Issue identified by VS Code Team member as probable bug label Nov 4, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Clearing the global routing override can restore a stale system manager on later automatic resolution and publish environments that do not match global reads.

2 open issues
What changed in this PR

This PR addresses #1976 by separating global selection routing from cached environment ownership, allowing the configured/default manager to take over when an explicit interpreter is cleared.

Changes:

  • Track and clear the manager responsible for global selection routing.
  • Extend the existing regression test to assert routing returns to the venv manager.
File Description
src/​test/​features/​envManagers.unit.test.ts Adds a manager-routing assertion after clearing an explicit selection.
src/​features/​envManagers.ts Tracks global selection provenance and uses it when choosing the global manager.

Review effort: Balanced

Comment thread src/features/envManagers.ts Resolved
Comment thread src/features/envManagers.ts Resolved
Co-authored-by: edvilme <5952839+edvilme@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Superseded operations can overwrite newer selections, while routing resets and lookup failures can leave caches, events, and persisted selections inconsistent.

5 open issues
2 resolved since last review

Review effort: Balanced

Comment on lines +893 to +896
const newEnvironment =
explicitSelection === 'cleared'
? await this.getEnvironment(selection.scope)
: environment;
Comment on lines +893 to +896
const newEnvironment =
explicitSelection === 'cleared'
? await this.getEnvironment(selection.scope)
: environment;
Comment on lines +931 to +932
const newEnvironment =
explicitSelection === 'cleared' ? await this.getEnvironment(undefined) : environment;
Comment on lines +1024 to +1027
const newEnv =
explicitSelection === 'cleared'
? await this.getEnvironment(undefined)
: await manager.get(undefined);
Comment on lines +1159 to +1161
this.updateGlobalSelectionManager(key, undefined);
if (key === 'global') {
this._globalSelectionManagerCleared = true;
@bschnurr

Copy link
Copy Markdown
Member

🔒 Automated review in progress — Bill Schnurr (@bschnurr) is auto-reviewing this PR.

@edvilme

Copy link
Copy Markdown
Contributor

Superseded by #1979

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

Labels

bug Issue identified by VS Code Team member as probable bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

4 participants