@@ -62,24 +62,25 @@ python environments extension begins activation
6262 → falls through to ` await result.manager.get(scope) `
6363
6464 **--- inner fork: fast path vs slow path (tryFastPathGet in fastPath.ts) ---**
65- three conditions checked :
65+ Conditions checked before entering fast path :
6666 a. ` _initialized ` deferred is undefined (never created) OR has not yet completed
6767 b. scope is a ` Uri ` (not global/undefined)
68- c. a persisted env path exists in workspace state for this scope (folder Uri)
6968
70- FAST PATH (run if above three conditions are true ):
69+ FAST PATH (background init kickoff + optional early return ):
7170 **Race-condition safety (runs before any await):**
7271 1. if `_initialized` doesn't exist yet:
7372 - create deferred and **register immediately** via `setInitialized()` callback
7473 - this blocks concurrent callers from spawning duplicate background inits
75- - kick off `startBackgroundInit()` as fire-and-forget
74+ - kick off `startBackgroundInit()` as fire-and-forget
75+ - this happens as soon as (a) and (b) are true, **even if** no persisted path exists
7676 2. get project fsPath: `getProjectFsPathForScope(api, scope)`
7777 - prefers resolved project path if available, falls back to scope.fsPath
7878 - shared across all managers to avoid lambda duplication
79- 3. read persisted path
80- 4. `resolve(persistedPath)`
81- 1. failure → see SLOW PATH
82- 2. successful → return env immediately (background init continues in parallel)
79+ 3. read persisted path (only if scope is a `Uri`; may return undefined)
80+ 4. if a persisted path exists:
81+ - attempt `resolve(persistedPath)`
82+ - failure (no env, mismatched manager, etc.) → fall through to SLOW PATH
83+ - success → return env immediately (background init continues in parallel)
8384 **Failure recovery (in startBackgroundInit error handler):**
8485 - if background init throws: `setInitialized(undefined)` — clear deferred so next `get()` call retries init
8586
0 commit comments