Repository navigation
studio: report why launcher recovery failed, not that it was absent - #9924
danielhanchen merged 5 commits into
Conversation
|
Confirmed main still prints the pre-recovery error at unsloth_cli/commands/studio.py:4654, so a failed interpreter probe is reported as "not on disk" as in #9804, and returning the reason from the same walk keeps exit unchanged. Will get this reviewed. |
`validate_launcher` sampled `_launcher_health_error()` before attempting
recovery and then printed that, while `_restore_runnable()` returned a bare
bool -- so the verdict recovery actually acted on was computed and discarded.
Reproduced at head with the file's own fixtures: launcher quarantined away,
managed CLI answering `returncode = 3`. `_recovered_cli_health_error()`
returns "the managed Python CLI returned 3 for --version", and the user is
told:
Error: Unsloth Studio update failed because the updated launcher is not on disk.
Once the launcher is gone `_launcher_health_error()` answers `_LAUNCHER_ABSENT`
whatever the cause, so that message named the one condition
`_recovered_cli_health_error` exists to excuse (unslothai#8592) and said nothing about
the update. It is why unslothai#9804 cannot be diagnosed from its own log: the report
shows "not on disk" and "Manual recovery copy retained at", which together mean
the interpreter probe failed too -- on an install whose Studio then started
normally -- and nothing says why.
`_restore_failure_reason()` is the same walk returning the reason;
`_restore_runnable()` is now the bool of it, so `__exit__` is unchanged.
`validate_launcher` reports `reason or error`: the sampled error still answers
when recovery SUCCEEDED and the launcher setup published is itself the broken
one, which is what the `published` arm is for.
`_recover_missing_launcher` already reports its cause this way, so this is the
exit-time half of a convention the entry-time half already keeps.
Regression tests `test_a_failed_recovery_reports_the_verdict_it_acted_on` and
`test_a_failed_recovery_with_no_interpreter_says_both` pin both reasons the
interpreter fallback can give; both fail on the unfixed code. The second also
covers `_interpreter_health_error`'s "is missing" wording, which had no test
and is only reachable through `_recovered_cli_health_error`.
`test_a_recovered_launcher_still_reports_what_setup_published` is the parity
guard for the case the reason must not speak in.
One consequence worth naming: the message for a failed recovery now varies with
what the interpreter said, where it was previously fixed. Nothing asserted the
old text, but a downstream log scraper matching the literal absence string
would stop matching.
Refs unslothai#9804.
4e48c9d to
feb3885
Compare
|
Review record for #9924, carried over from the mirror it was reviewed on: danielhanchen/unsloth-staging-review#433. Findings are quoted as posted and attributed to the account that posted them. The reactions shown are the triage recorded on the mirror; none were re-applied here. Commits are named as the mirror's, with this PR's equivalent where one was found. Round 1: reviewed mirror
|
Refs #9804.
The defect
validate_launcher()samples_launcher_health_error()before attempting recovery andreports that value, while
_restore_runnable()returns a bare bool — so the verdictrecovery actually acted on is computed and then discarded.
Once the launcher is gone,
erroris_LAUNCHER_ABSENTwhatever the cause. So a failuredecided by the interpreter probe is reported as absence — the one condition
_recovered_cli_health_errorexists to excuse (#8592).Reproduced at head
Using the file's own fixtures — launcher quarantined away, managed CLI answering
returncode = 3:_recovered_cli_health_error()returnedthe managed Python CLI returned 3 for --version...because the updated launcher is not on diskThis is why #9804 cannot be diagnosed from its own log. That report shows
not on disktogether with
Manual recovery copy retained at:. The second line only prints whenrestoredis false, so recovery's own check failed as well, on an install whose Studio thenstarted normally, and nothing says what failed. With a backup on disk, as that line shows, the
check is the restored launcher's own
--version; the interpreter is asked only if no restoredcopy is left on disk or the copy is blocked by policy. An earlier version of this description
said the interpreter probe failed; the log does not show which check did.
The report also prints that line once.
validate_launcherraises inside thewithblock and__exit__runs recovery again, so a failure that persists with the backup intact prints ittwice. Replayed with this file's fixtures, a persistent failure prints it twice, and one that
clears before
__exit__prints it once. So by then, either recovery succeeded or the backup wasno longer usable. That fits a transient failure, which is not confirmed.
The change
_restore_failure_reason()is the same walk returning the reason;_restore_runnable()isnow the bool of it, so
__exit__is unchanged.validate_launcherreports that reason only when the sampled error is_LAUNCHER_ABSENT, theone value that cannot name a cause. Any other sampled error is the failure of the launcher setup
published, and it stays whether or not recovery succeeded, since by then the reason describes the
copy put back in its place. That second half is
oobabooga'sfeb3885a2: Codex found that thefirst version,
reason or error, reported the restored copy's failure over the publishedlauncher's.
_recover_missing_launcheralready reports its cause this way, so this is the exit-timehalf of a convention the entry-time half already keeps.
Tests
tests/python/test_windows_studio_update_launcher.py, 4 added:test_a_failed_recovery_reports_the_verdict_it_acted_ontest_a_failed_recovery_with_no_interpreter_says_both_recovered_cli_health_errortest_a_recovered_launcher_still_reports_what_setup_publishedtest_a_published_launcher_keeps_its_own_verdict_when_recovery_also_failsreason or errorRe-measured 2026-09-16 with this branch merged into
mainat1066d16af. The file passes 66 onWindows and 62 on Linux, where 4 Windows-only tests skip. With
main'sstudio.pyunder thesetests, exactly the two marked yes fail, printing "the updated launcher is not on disk".
With
unsloth_cli/testsadded, nothing that passes onmainfails here. Linux fails the same 4tests by name on both sides, with 1,531 passes against 1,527. Windows fails 66 here against
main's 67, all of them shared; the one extra onmain,test_update_verifies_by_default,passes on both when its file runs alone.
An earlier version of this description predated
feb3885a2and the rebase ontoc8ed02f69. Itsaid 3 tests and
reason or error, and gave counts from the old base.One consequence worth naming
The message for a failed recovery now varies with what recovery found, where it was
previously fixed. Nothing asserted the old text, but a downstream log scraper matching the
literal absence string would stop matching.