Repository navigation
Let the torch tag check tell the handoff restore from a conditional report - #10524
Merged
Merged
Conversation
|
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. |
danielhanchen
added a commit
that referenced
this pull request
Sep 9, 2026
… it drives (#10538) * Catch the handoff harness up with the block it drives, and make it say why when it cannot main fails four cases in tests/test_windows_amd_gpu_scan_fallback.py. The lifecycle harness lifts install.ps1's save / set / try / finally block and runs it with the setup call replaced by a probe. That block has since grown a dependency on the installer's own inputs and helpers (Get-ExpectedTorchFlavorTag and the torch pin check from #10524, Write-ApplicationControlBlocked from #8066), and it reads $script:ManagedUnslothCliExit on the line right after the call it replaces, then returns early when that exit code is null. None of those were bound, so under ErrorActionPreference Stop the block threw, the harness's own catch swallowed it, and every assertion read "never ran" -- which looks like a handoff defect and is not one. Bound them, and made the harness loud rather than silent: the replacement is asserted to have matched, the swallowed error is reported back and fails the test with its message, and the report is read as the last JSON line so a stub's own output cannot be mistaken for it. The fourth failure was an ordering assertion, that the save appears after the --with-llama-cpp-dir bail in file order. That bail now sits inside the try whose finally restores, which is a stronger arrangement than the ordering stood for, so the check is now the arrangement itself: save, then the bail, then the restore. Still a real test: dropping the inherited-handoff clear from install.ps1 fails stale_only, and restoring it passes. 82 tests in the file. * Run the bail rather than reading its offsets, and require the injected throw Two review points, both about this harness accepting less than it claims. The setup_throws cases skipped the error assertion entirely, so any exception passed: a helper failing before the setup call would leave the shipped finally to restore the environment, and every assertion would hold without the failure path ever running. They now require the injected "setup exploded" and fail on anything else. Checked by calling an undefined function before the setup call: all four cases fail, and pass again once it is removed. The restore invariant was three string offsets, which establish order and not structure. The block now runs inside a function, so its own return leaves the block rather than the script, and a new case takes the --with-llama-cpp-dir bail with a directory that does not exist and reads the environment afterwards. It asserts on the two variables the block sets at the top of its try, above the bail, since those are what say the finally ran rather than that nothing happened. Checked by moving the assignments and the bail out of the try, which the textual ordering still accepts and this rejects. 83 tests in the file. * Tighten the comments in the handoff lifecycle harness Collapse the multi-line explanations added with the bail test down to one or two lines each, and drop the parts the code already says. No behaviour change: comments and whitespace only. --------- Co-authored-by: danielhanchen <[email protected]>
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.
What
tests/studio/test_amd_venv_repair_loop.ps1fails on main since #8066:The check rejects any
if (...) {followed by an assignment toUNSLOTH_INSTALLER_TORCH_TAG, to make sure the report is unconditional. #8066 added afinallythat puts the caller's own value back:That is a conditional assignment too, but it is the restore, not the report, so the check now trips on a correct tree.
Fix
The negative half of the check ignores an assignment from a
$previous*variable. A conditional report is still rejected:if ($known) { $env:UNSLOTH_INSTALLER_TORCH_TAG = $tag }One line in one test; no product code changes.