Skip to content

fix: invalidate stale interpreter cache after fast-path resolution failures - #1926

Open
Mateeh Ullah (MateehUllah) wants to merge 5 commits into
microsoft:mainfrom
MateehUllah:fix/1795-stale-interpreter-cache
Open

Mateeh Ullah (MateehUllah) wants to merge 5 commits into
microsoft:mainfrom
MateehUllah:fix/1795-stale-interpreter-cache

Conversation

@MateehUllah

Copy link
Copy Markdown

Summary

Fixes stale interpreter-cache handling in the Python Environments extension when fast-path environment resolution fails.

Previously, a persisted interpreter path could remain cached even when resolving that interpreter failed. This change ensures that stale cache entries are cleared so subsequent environment discovery can proceed without repeatedly relying on an invalid entry.

Changes

  • Clear stale persisted interpreter paths when fast-path resolution throws an error.
  • Handle cache invalidation for both global and workspace scopes.
  • Improve fallback behavior when a cached interpreter cannot be resolved.
  • Add regression-test assertions to verify that the appropriate cache-clearing callback is invoked.

Related Issue

Related to #1795.

This PR addresses the stale interpreter-cache handling identified during investigation of that issue. It does not claim to resolve the complete Jupyter kernel connection hang or incomplete Python version metadata.

Testing

Added regression-test assertions in src/test/managers/common/fastPath.unit.test.ts covering:

  • Global-scope cache invalidation when interpreter resolution fails.
  • Workspace-scope cache invalidation when interpreter resolution throws an error.
  • Fallback behavior when a cached interpreter cannot be resolved.

Validation status:

  • Reviewed the proposed source changes and regression-test assertions.
  • Run npm run unittest locally.
  • Run lint and build checks.
  • Verify behavior through VS Code integration testing.
  • Reproduce the original Windows/Jupyter scenario.

The full test suite has not been executed locally. CI validation and maintainer review are required.

Scope

This PR is intentionally limited to stale interpreter-cache invalidation. It does not modify Jupyter kernel startup behavior or Python version-discovery logic.

AI Assistance

AI assistance was used for code analysis and PR preparation. The changes remain subject to test verification and maintainer review.

@MateehUllah

Copy link
Copy Markdown
Author

Mateeh Ullah (Mateeh Ullah (@MateehUllah)) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@microsoft-github-policy-service agree

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.

1 participant