Repository navigation
install.ps1: guard the mirror env restore and run its test in Windows CI - #12849
Conversation
@($null.Keys) is a one-item array holding $null, so the restore loop ran once with a null key and indexing threw, stopping the finally before the overrides file and UNSLOTH_KEPT_TORCH were cleaned up. Guard it the same way as the WoA resolver restore just above it. Production initialises MirrorEnvSaved before the try, so this only hardens the path. test_unsloth_torch_override.ps1 replays that finally and had been failing since #11786 added the restore, unnoticed because no CI job ran it. Cover both the nothing-saved and the saved-variables cases and run the test in the Windows inference smoke job with the other installer .ps1 tests.
|
@codex review |
|
You have reached your Codex usage limits for security reviews. Please try again later. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
tests/studio/test_unsloth_torch_override.ps1has been failing since #11786, and nothing caught it because no CI job runs that file.The test replays the outer
finallyofinstall.ps1on its own, with only the variables that thefinallyitself touches. #11786 added the mirror env restore to thatfinally:When
MirrorEnvSavedis$null,@($null.Keys)is a one-item array holding$null. The loop therefore runs once, and indexing with a null key throws. That aborts thefinallybefore the temp overrides file andUNSLOTH_KEPT_TORCHare cleaned up.Which side was wrong
install.ps1) is correct in production.$script:MirrorEnvSaved = @{}is set before thetry, so the null case cannot happen in a real run.if ($script:WoaResolverEnvSaved), and this one was not. Any future path that reaches thefinallywithout the init, or that resets the table, would silently skip the remaining cleanup.MirrorEnvSaved, and it never checked that the restore actually returns the caller's values.Changes
install.ps1: guard the mirror restore the same way as the WoA restore. Behaviour is unchanged when the table is initialised.tests/studio/test_unsloth_torch_override.ps1: set the nothing-saved state explicitly. Add a case where a variable the fallback added is removed and a variable the caller had is restored, with the overrides file still deleted afterwards.studio-windows-inference-smoke.yml: run the test alongside the other installer.ps1tests, so a regression here fails CI.Verification
maininstall.ps1test_unsloth_torch_override.ps1(pwsh 7, Linux)e27337cd89(before #11786)tests/studio/test_installer_av_shapes.pyscripts/lint_av_shapes.py