Enhance Python environment configuration tools with optional interpreter path support for direct setup#25939
Draft
eleanorjboyd wants to merge 4 commits intomicrosoft:mainfrom
Draft
Enhance Python environment configuration tools with optional interpreter path support for direct setup#25939eleanorjboyd wants to merge 4 commits intomicrosoft:mainfrom
eleanorjboyd wants to merge 4 commits intomicrosoft:mainfrom
Conversation
…ter path support for direct setup Co-authored-by: Copilot <copilot@github.com>
There was a problem hiding this comment.
Pull request overview
This PR enhances the Python environment configuration chat tools to optionally accept a pythonPath so the interpreter can be set directly (skipping interactive UI), which is particularly useful for autopilot/bypass-approvals flows.
Changes:
- Add optional
pythonPathsupport toconfigure_python_environmentandselectEnvironmenttools (plus input schema updates inpackage.json). - Wrap additional operations with
raceCancellationErrorto better respect cancellation tokens. - Fix virtual environment resolution polling loop condition and adjust venv creation options.
Show a summary per file
| File | Description |
|---|---|
| src/client/chat/selectEnvTool.ts | Adds pythonPath fast-path and wraps UI selection flows with cancellation handling. |
| src/client/chat/createVirtualEnvTool.ts | Improves cancellation handling, tweaks venv creation options, and fixes the env-resolution polling loop condition. |
| src/client/chat/configurePythonEnvTool.ts | Adds pythonPath argument + direct interpreter setup path, updates tool argument typing. |
| package.json | Extends language model tool schemas/descriptions to document and accept pythonPath. |
Copilot's findings
Comments suppressed due to low confidence (1)
src/client/chat/selectEnvTool.ts:87
- After calling
updateActiveEnvironmentPath, the code immediately callsgetActiveEnvironmentPath()/resolveEnvironment().updateActiveEnvironmentPathonly updates configuration; the active environment change is asynchronous (see code that waits ononDidChangeActiveEnvironmentPath, e.g.venvSwitchPython.ts). This fast-path can therefore resolve and return details for the previous environment. Wait forthis.api.onDidChangeActiveEnvironmentPath(matchingpythonPath) or otherwise confirm the switch before resolving/returning environment details.
await raceCancellationError(
this.api.updateActiveEnvironmentPath(options.input.pythonPath, resource),
token,
);
const env = await raceCancellationError(
this.api.resolveEnvironment(this.api.getActiveEnvironmentPath(resource)),
token,
);
- Files reviewed: 4/4 changed files
- Comments generated: 3
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.
fixes #25940
Co-authored-by: Copilot copilot@github.com