Skip to content

Cross-session cache for discovered system Python path#1455

Draft
eleanorjboyd wants to merge 3 commits intomicrosoft:mainfrom
eleanorjboyd:electrical-mongoose
Draft

Cross-session cache for discovered system Python path#1455
eleanorjboyd wants to merge 3 commits intomicrosoft:mainfrom
eleanorjboyd:electrical-mongoose

Conversation

@eleanorjboyd
Copy link
Copy Markdown
Member

@eleanorjboyd eleanorjboyd commented Apr 14, 2026

Persist the discovered system Python path (e.g., /usr/bin/python3 or C:\Python312\python.exe) to globalState. On next startup, use the cached path immediately and verify it's still valid in the background.

Potential risk: The cache could become stale if the user uninstalls/upgrades Python. Background verification mitigates this — the cached env is used immediately, and if verification fails, a re-scan is triggered. The user would see a brief env switch in the rare case the cache is wrong.

@eleanorjboyd eleanorjboyd changed the title Electrical mongoose Cross-session cache for discovered system Python path Apr 14, 2026
@eleanorjboyd eleanorjboyd reopened this Apr 14, 2026
@eleanorjboyd eleanorjboyd requested a review from Copilot April 14, 2026 21:11
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR adds a cross-session “fast path” for resolving the system Python by persisting the discovered global Python path and using it immediately on next startup, while verifying validity in the background.

Changes:

  • Add optional global-scope persisted-path support to tryFastPathGet() and emit telemetry for global cache hit/miss/stale.
  • Update system Python manager/cache to read/write the global persisted path via global persistent state.
  • Extend unit tests to cover global-scope fast-path behavior and telemetry emission.
Show a summary per file
File Description
src/test/managers/fastPath.get.unit.test.ts Stubs global cache getter to avoid test behavior changes with new global fast-path support.
src/test/managers/common/fastPath.unit.test.ts Adds test coverage for global persisted-path behavior and verifies telemetry results.
src/managers/common/fastPath.ts Implements optional global persisted-path lookup and emits global cache telemetry.
src/managers/builtin/sysPythonManager.ts Wires system manager into new global persisted-path fast-path option.
src/managers/builtin/cache.ts Moves global key storage to global persistent state and clears workspace/global keys in their respective stores.
src/common/telemetry/constants.ts Adds GLOBAL_ENV_CACHE event and GDPR property mapping for the new telemetry.

Copilot's findings

  • Files reviewed: 6/6 changed files
  • Comments generated: 2

Comment thread src/managers/common/fastPath.ts
Comment thread src/managers/common/fastPath.ts Outdated
@eleanorjboyd
Copy link
Copy Markdown
Member Author

@copilot resolve the merge conflicts in this pull request

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.

2 participants