feat: implement fast path resolution for Python environment managers#1408
Merged
eleanorjboyd merged 8 commits intomicrosoft:mainfrom Apr 1, 2026
Merged
feat: implement fast path resolution for Python environment managers#1408eleanorjboyd merged 8 commits intomicrosoft:mainfrom
eleanorjboyd merged 8 commits intomicrosoft:mainfrom
Conversation
Member
eleanorjboyd
commented
Mar 27, 2026
- Added fast path resolution logic in SysPythonManager, VenvManager, CondaEnvManager, PipenvManager, and PyEnvManager to directly resolve persisted environments without waiting for full initialization.
- Enhanced error handling with logging for failed resolutions in the fast path.
- Introduced unit tests to validate the fast path behavior across different environment managers, ensuring correct resolution and background initialization handling.
dmitrivMS
previously approved these changes
Mar 27, 2026
…ure retry, dedup lambdas, test parameterization
…condition fix, failure retry
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a shared “fast path” for EnvironmentManager.get() so managers can immediately resolve a persisted environment selection (from workspace state) without waiting for full environment discovery to complete, while discovery continues in the background.
Changes:
- Added a reusable
tryFastPathGet()helper (plus a sharedgetProjectFsPathForScope()accessor) and integrated it into built-in and tool-based managers. - Updated
get()implementations in SysPython/Venv/Conda/Pipenv/PyEnv managers to attempt fast resolution and trigger background initialization. - Added unit tests for both the shared helper and manager-level behavior; updated startup-flow documentation to describe the new execution fork.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/managers/common/fastPath.ts | New shared helper implementing the fast-path resolution + background init orchestration. |
| src/managers/builtin/sysPythonManager.ts | Uses fast-path helper before falling back to standard initialization. |
| src/managers/builtin/venvManager.ts | Uses fast-path helper and starts background refresh via internalRefresh. |
| src/managers/conda/condaEnvManager.ts | Uses fast-path helper and runs discovery under withProgress. |
| src/managers/pipenv/pipenvManager.ts | Uses fast-path helper and runs discovery under withProgress. |
| src/managers/pyenv/pyenvManager.ts | Uses fast-path helper and runs discovery under withProgress. |
| src/test/managers/common/fastPath.unit.test.ts | New unit tests validating tryFastPathGet() behavior and background init semantics. |
| src/test/managers/fastPath.get.unit.test.ts | New unit tests validating fast-path behavior across multiple managers’ get() implementations. |
| docs/startup-flow.md | Documentation updates describing the new fast-path vs slow-path fork during startup/selection. |
Comments suppressed due to low confidence (1)
src/managers/common/fastPath.ts:94
- Same as the traceError case above:
traceWarn(... ${err})will often lose the error stack/details. Prefer passing the error object as a separate argument totraceWarnsoutil.formatcan render it more helpfully.
traceWarn(
`[${opts.label}] Fast path resolve failed for '${persistedPath}', falling back to full init: ${err}`,
);
}
}
bpasero
approved these changes
Apr 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.