Support non-interactive Python environment configuration#25939
Draft
eleanorjboyd wants to merge 9 commits into
Draft
Support non-interactive Python environment configuration#25939eleanorjboyd wants to merge 9 commits into
eleanorjboyd wants to merge 9 commits into
Conversation
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
…ter path support for direct setup Co-authored-by: Copilot <copilot@github.com>
Avoid stale environment results and cross-workspace event races when a tool receives a Python path. Propagate cancellation through interactive and post-creation waits, and strengthen focused unit coverage.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
eleanorjboyd
force-pushed
the
technological-worm
branch
from
July 20, 2026 18:41
effe575 to
42a887d
Compare
Provide a complete PythonExecInfo fixture and safely narrow language-model result content in assertions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Apply the repository Prettier configuration to the non-interactive environment setup implementation and tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep direct interpreter selection on the public configure tool and preserve legacy package-install behavior. Remove the redundant hidden-tool fast path and its tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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
Summary
pythonPathinput toconfigure_python_environment, allowing agents to select a known interpreter without opening blocking UI.Validation