Repository navigation
Fix Poetry package actions targeting mismatched environments - #1956
Open
Stella Huang (StellaHuang95) wants to merge 1 commit into
Open
Stella Huang (StellaHuang95) wants to merge 1 commit into
Stella Huang (StellaHuang95) wants to merge 1 commit into
Conversation
Verify and pin project-scoped Poetry operations to the selected environment, keep package caches and events correctly attributed, and preserve cancellation and public package-manager behavior. Fixes microsoft#1866 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: e9acda38-e616-4bc7-a805-f32670a99b94
Contributor
|
🔒 Automated review in progress — Rich Chiodo (@rchiodo) is auto-reviewing this PR. |
Rich Chiodo (rchiodo)
approved these changes
Oct 27, 2026
Rich Chiodo (rchiodo)
left a comment
Contributor
There was a problem hiding this comment.
Approved via Review Center.
Bill Schnurr (bschnurr)
approved these changes
Oct 27, 2026
Bill Schnurr (bschnurr)
left a comment
Member
There was a problem hiding this comment.
Approved via Review Center.
Heejae Chang (heejaechang)
approved these changes
Oct 27, 2026
Heejae Chang (heejaechang)
left a comment
There was a problem hiding this comment.
Approved via Review Center.
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.
Summary
Fix project-scoped Poetry package actions so they cannot mutate or inspect Poetry environment B while attributing packages and events to a different selected environment A.
VIRTUAL_ENV, then verify the pin before mutationpoetry showbehavior, private/headless process policy, cancellation, and non-Poetry callersFixes #1866
Root cause
Project tree commands combined the displayed/selected environment with the project's configured Poetry package manager. Poetry commands execute from the project directory, so Poetry selected its own project environment, while package caches and change events used the supplied selected environment object. Only the private tooling path had a target check, and ordinary cached reads could bypass Poetry entirely.
A real Poetry probe also demonstrated that verify-once is insufficient if the inherited environment changes: after
poetry env info --pathreported B, changing onlyVIRTUAL_ENVcaused the immediately followingpoetry addto mutate A. The fix therefore verifies and pins one filesystem-identified target for each operation.Validation
npm run lintnpm run compile-testsnpm run unittest— 3,447 passing, 10 pendingnpm run compile(webpack) passed.venvB, paths containing spaces, and an offline wheel:VERIFIED_TARGET=B, inheritedVIRTUAL_ENV=A, unpinned mutation installed only into A)Review hardening
The final implementation additionally covers:
Notes
The Extension Host verification used the extension's registered test commands after configuring the real project, selected environment, and project-scoped Poetry override; it did not automate mouse interaction with the package input box. Input cancellation and matched interactive manager behavior are covered by production-manager tests with real Poetry plus unit coverage.