Cross-session cache misses on every fresh remote (SSH / WSL / dev container / codespace)
@eleanorjboyd ci sta già lavorando.
Dal 17/6/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Problem
The cross-session cache for the discovered global system Python (PR #1455) lives in context.globalState. In remote scenarios, context.globalState is scoped to the remote machine, not the local one. As a result, the cache never primes on a fresh remote and every first connection to a new SSH host, dev container, codespace, attached container, or WSL distro starts cold and falls through to a full PET refresh on the foreground env-selection path.
This also affects the local case any time globalState is wiped (e.g. extension reinstall, profile reset).
Current behavior
getSystemEnvForGlobal()/setSystemEnvForGlobal()read/writeSYSTEM_GLOBAL_KEYviagetGlobalPersistentState(), which wrapscontext.globalState.getGlobalPersistedPathis wired intotryFastPathGet(fastPath.ts) for the system-Python path. WhenglobalStateis empty the fast path returnsundefinedand registration falls through to the slow path.- Workspace-scoped paths use
setSystemEnvForWorkspace/getSystemEnvForWorkspace, which write tocontext.workspaceState(keyed on workspace folder fsPath) — that path is unaffected.
Why it matters
Every time a user connects VS Code to a new remote (or reopens after the remote globalState is reset), the foreground env-selection path waits on a fresh PET refresh instead of validating a cached path. This is the dominant remaining hang scenario on Linux based on our most recent investigation, and ssh-remote, WSL, and dev-containers are all affected.
Acceptance criteria
- On a workspace where the global system Python has been resolved at least once, opening the same workspace folder in a fresh VS Code session on the same remote hits the cache without a PET refresh.
- On a brand-new workspace folder on the same remote, behavior is unchanged from today (cache miss → PET refresh).
- On a brand-new remote with a brand-new workspace folder, behavior is unchanged from today (option 1 doesn't claim to fix this case — option 2/3 would).
- No regression to existing telemetry:
global_env.cachecontinues to emithit/miss/stalecorrectly. - No regression to the workspace-scoped fast-path (
getSystemEnvForWorkspaceusers). - Unit tests covering: workspaceState-primary lookup, fallback to globalState, both write paths, and stale-path invalidation through both layers.
Related
- PR #1455 — original cross-session cache.
- PR #1564 — cheap
fs.accesscheck on persisted paths in fast-path resolution. (this helped fix the regression which the prior PR introduced)
- Lingua principale
- TypeScript
- Stelle
- 140
- Fork
- 63
- Merge medio
- 1g 4h
- PR unite (30g)
- 35
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di microsoft/vscode-python-environments
-
microsoft/vscode-python-environments#1799 · 1 assegnatario ·
-
microsoft/vscode-python-environments#1796 · 1 assegnatario ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
-
triage-needed
microsoft/vscode-python-environments#1791 · 1 reazione · 2 assegnatari ·
-
triage-needed
Difficoltà 4/5 3-5 giorni Idoneità per principianti 74/100
microsoft/vscode-python-environments#1779 · 1 commento · 1 reazione ·
Tutte le issue di microsoft/vscode-python-environments
Issue simili
-
Type/Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
OpenNSW/nsw-srilanka#497 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
0xMiden/bridge-portal#132 ·
-
react-doctor severity:warning tech-debt
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
digidem/comapeo-cloud-app#403 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100