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/write SYSTEM_GLOBAL_KEY via getGlobalPersistentState(), which wraps context.globalState.
getGlobalPersistedPath is wired into tryFastPathGet (fastPath.ts) for the system-Python path. When globalState is empty the fast path returns undefined and registration falls through to the slow path.
- Workspace-scoped paths use
setSystemEnvForWorkspace / getSystemEnvForWorkspace, which write to context.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
Related
Problem
The cross-session cache for the discovered global system Python (PR #1455) lives in
context.globalState. In remote scenarios,context.globalStateis 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
globalStateis 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.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
globalStateis 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
global_env.cachecontinues to emithit/miss/stalecorrectly.getSystemEnvForWorkspaceusers).Related
fs.accesscheck on persisted paths in fast-path resolution. (this helped fix the regression which the prior PR introduced)