Repository navigation
CI: prove an interrupted install can never masquerade as a healthy one - #7552
Conversation
Nothing in CI had ever interrupted an install, which is how the reported failure shipped: quit the desktop app mid-install, the app SIGTERMs the installer process group, and if that lands during 'studio deps' the venv loses structlog. Preflight then probes 'unsloth -h' and 'studio desktop-capabilities', both of which succeed because the CLI's own deps are core, so the app reported ManagedReady with can_auto_repair=false while the backend died on import. A permanent dead end. This kills the installer at each interesting phase and asserts the result is either genuinely healthy or explicitly repairable, never silently ready. 13 legs across macos-14, ubuntu-latest and windows: each of the dependency-pass steps plus the coarse phases (venv, torch, unsloth, setup). The kill targets the process GROUP, matching install.rs. Killing only the leader leaves uv and python children to finish the dependency pass, and the test would quietly prove nothing. Windows has no process groups, so that leg walks the CIM parent links instead, which is the same reason the app carries windows_job.rs. One shared probe for all platforms. The Windows check used to be bespoke inline PowerShell that only ran -h and desktop-capabilities, so it could not observe studio_install_ok, verify-install or desktop-runtime-check: it would have reported FALSE_READY for the very PRs that add them, no matter how well they worked. The probe boots the backend as ground truth and owns the whole process tree, since terminating only the parent leaves children holding the port. install.sh runs with --local, which is load-bearing rather than a convenience: without it the installer resolves unsloth from PyPI and the venv gets the PUBLISHED CLI, so no branch-side change is present and every deeper probe reports 'absent' regardless of what the branch does. Verified: against a tree without the detection, windows kill@studio-deps reports FALSE_READY, reproducing the user report exactly. With #7492 merged the same leg reports REPAIRABLE, and all 13 legs pass.
install.sh --tauri rejects a custom UNSLOTH_STUDIO_HOME outright (the desktop app
still uses the legacy ~/.unsloth/studio root), and this workflow set one at
workflow level for every job. So all 11 macOS and Linux legs exited about a second
in with
ERROR: UNSLOTH_STUDIO_HOME is not supported with --tauri.
produced no CLI, took the probe's NO_CLI 'safe' branch and reported success. They
were vacuously green. Only the two Windows legs were real, because install.ps1 has
no equivalent guard.
The override now applies to the Windows job only, and the POSIX legs read the
legacy root, which is where --tauri installs. The runner is ephemeral so the real
home is as disposable as the override.
Also adds the check that makes this class of mistake loud: a leg asserts its kill
actually landed on the marker it was aimed at, using the interrupt_reason the
driver already records. A leg that never reached its kill point proves nothing,
and NO_CLI made that indistinguishable from a pass.
|
Correcting the verification claim in the description: "all 13 legs pass on current main" was true but misleading, and I have pushed a fix.
produced no CLI, took the probe's So the result that stands from the earlier run is the Windows one, which is the leg that matters most anyway, since it is the one that reproduced the reported dead end:
The macOS and Linux verdicts are not yet established. They are re-running. What changed
That second point is the more valuable half. The bug was not really the env var, it was that the workflow had a success path for "nothing happened". Worth reviewing that guard specifically. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6d99729d58
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| elif (facts.get("verify_install") == "failed" | ||
| or facts.get("desktop_runtime_check") == "failed" | ||
| or facts.get("capabilities.studio_install_ok") is False | ||
| or facts.get("install_in_progress_marker") is True |
There was a problem hiding this comment.
Do not treat the synthetic marker as repair evidence
Both interrupt drivers create .desktop-install-in-progress before every install and deliberately never remove it, so this condition is true for every backend failure. In the reviewed tree, a repo-wide search shows no production/Tauri consumer of that marker—only these two drivers and this probe reference it—so a genuinely false-ready install is always classified as REPAIRABLE and exits successfully, preventing the workflow from detecting the regression it is intended to cover.
Useful? React with 👍 / 👎.
| - '.github/scripts/interrupt*-install*' | ||
| - '.github/scripts/interrupted-install-probe.sh' |
There was a problem hiding this comment.
Include the Python probe in the path filter
The added probe is named interrupted_install_probe.py, but neither this hyphenated shell-script path nor the preceding interrupt*-install* pattern matches it. A pull request that changes only the probe therefore does not run this workflow, allowing its verdict logic to regress without exercising any interrupted-install leg.
Useful? React with 👍 / 👎.
| name: windows kill@${{ matrix.label }} | ||
| runs-on: windows-latest | ||
| timeout-minutes: 60 | ||
| continue-on-error: true |
There was a problem hiding this comment.
Make Windows probe failures block the workflow
With job-level continue-on-error: true, a Windows leg whose probe exits nonzero for FALSE_READY does not fail the overall workflow. Consequently regressions specific to the separate PowerShell installer or Windows process-tree interruption remain mergeable even though these are the only jobs exercising those paths.
Useful? React with 👍 / 👎.
| if [ -n "$MARKER" ] && ! grep -qE "$MARKER" "$LOG" 2>/dev/null; then | ||
| echo "::warning::marker '$MARKER' never appeared -- this leg killed at the deadline, not at the intended step" |
There was a problem hiding this comment.
Fail when the requested interruption marker is not reached
When an installer exits before the marker, or a marker is renamed or skipped, this driver emits only a warning and still exits successfully. The workflow can then classify a completed install as HEALTHY or a pre-CLI failure as NO_CLI, so the matrix leg passes without ever interrupting the phase named by the leg; the PowerShell counterpart has the same fail-open behavior.
Useful? React with 👍 / 👎.
| # could not observe studio_install_ok / verify-install / | ||
| # desktop-runtime-check -- it would have failed the very PRs that add them, | ||
| # no matter how well they worked. | ||
| python .github/scripts/interrupted_install_probe.py $bin --out probe |
There was a problem hiding this comment.
Verify Windows installations can repair after interruption
Unlike the POSIX job, the Windows job proceeds directly from the initial probe to log upload and never reruns install.ps1 or boots the backend afterward. A partial Windows install may therefore be correctly detected as repairable while the PowerShell installer's version fast path still short-circuits over it, leaving users unable to repair even though both Windows legs pass their only assertion.
Useful? React with 👍 / 👎.
| env: | ||
| UNSLOTH_STUDIO_HOME: ${{ github.workspace }}/.studio-home | ||
| UNSLOTH_STUDIO_DISABLE_PUBLIC_CHECK: '1' |
There was a problem hiding this comment.
Do not combine a custom install root with Tauri mode
Every macOS and Linux leg inherits this workspace-local UNSLOTH_STUDIO_HOME and later invokes install.sh --tauri, but install.sh explicitly exits at startup when --tauri is combined with a non-legacy root because the desktop app supports only ~/.unsloth/studio. The interrupt wrapper then converts that exit to success and the probe reports NO_CLI, so none of the eleven POSIX legs currently starts an installation or reaches its interruption marker.
Useful? React with 👍 / 👎.
| run: | | ||
| pwsh -NoProfile -File .github/scripts/interrupt-install.ps1 ` | ||
| -Marker '${{ matrix.marker }}' -LogPath logs/install.log ` | ||
| -InstallArgs '-SkipTorch --local' -KillAtSeconds 1500 |
There was a problem hiding this comment.
Pass the supported no-torch argument on Windows
install.ps1 parses --no-torch and silently ignores the supplied -SkipTorch, so this option has no effect. The Windows studio-deps leg consequently downloads and installs the full torch stack despite explicitly requesting a skip, substantially increasing runtime and timeout risk; the argument should be selected per matrix leg so the torch-marker leg can still install torch.
Useful? React with 👍 / 👎.
The probe treated a present .desktop-install-in-progress marker as proof of a repairable state, but the drivers seed it unconditionally and never clear it, so REPAIRABLE was unconditional and FALSE_READY unreachable. The Windows leg had no kill-landed guard, blanket continue-on-error, and no repair re-run; -SkipTorch was silently dropped, since install.ps1 parses only --no-torch. Judge the re-run by whether the backend boots, on both platforms. The log grep matched the frontend build printing "up to date" and failed a leg whose venv was fine.
|
@codex review |
install.sh --local sets skip_base, so install_python_stack returns before any "base packages" label is printed. The kill had nothing to land on and the installer ran to completion, reaching [TAURI:DONE] in 62s.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 987d999688
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| (out / "cli-h.log").write_text(log, encoding = "utf-8", errors = "replace") | ||
| say("cli_h_ok", rc == 0) | ||
|
|
||
| rc, caps_raw = run([binp, "studio", "desktop-capabilities", "--json"], timeout = 180) |
There was a problem hiding this comment.
Exercise the managed capability cache
When a previously healthy installation has populated desktop_capability_cache.json and a later update is interrupted, probe_managed_bin can return ManagedProbe::Ready from read_cached_capability without invoking this command. Because every workflow leg starts with an empty cache and this probe calls desktop-capabilities directly, a regression in preflight/managed.rs that lets a healthy cached fingerprint survive manifest removal or dependency loss will pass while the desktop still reports the interrupted install as ready.
Useful? React with 👍 / 👎.
| - 'studio/src-tauri/src/install.rs' | ||
| - 'studio/src-tauri/src/preflight.rs' | ||
| - 'studio/src-tauri/src/preflight/**' | ||
| - 'unsloth_cli/commands/studio.py' |
There was a problem hiding this comment.
Trigger the workflow for manifest implementation changes
A pull request changing only unsloth_cli/_studio_deps.py or studio/install_manifest.py will not run this workflow, even though those files implement the studio_install_ok and verify-install decisions being asserted here. For example, a regression that makes install_state() accept a missing manifest can therefore merge without any interrupted-install leg running; include both implementation paths in this filter.
Useful? React with 👍 / 👎.
| env: | ||
| # These legs run install.ps1 WITHOUT --tauri (install.ps1:189-215 rejects a custom | ||
| # root under --tauri exactly like install.sh:100-147), so the workspace-scoped | ||
| # root is usable here. | ||
| UNSLOTH_STUDIO_HOME: ${{ github.workspace }}/.studio-home |
There was a problem hiding this comment.
Run the Windows installer in desktop mode
The Windows desktop path in studio/src-tauri/src/install.rs always invokes install.ps1 with --tauri and removes custom-root variables, whereas this job deliberately uses a custom root and omits --tauri. That changes installer behavior guarded by $TauriMode, including UNSLOTH_TAURI_MODE, frontend skipping, bundled-file handling, and failure control flow, so a Windows interruption or repair regression confined to the actual desktop mode can pass these legs; use the default root and invoke the same --tauri --local mode as the app.
Useful? React with 👍 / 👎.
| sleep "${KILL_AFTER_MARKER_SECONDS:-3}" | ||
| killed=true |
There was a problem hiding this comment.
Recheck the installer before recording a successful kill
If an installer finishes during this three-second delay—for example when a late dependency step is already cached—the script still sets killed=true and preserves reason=marker-hit, even though the subsequent signal reaches no process. The workflow's landing assertion then accepts the leg and a completed install reports HEALTHY, so it passes without testing an interruption; recheck the process after the delay before recording the kill. The PowerShell driver has the same unconditional transition after its marker delay.
Useful? React with 👍 / 👎.
| facts.get("verify_install") == "failed" | ||
| or facts.get("desktop_runtime_check") == "failed" |
There was a problem hiding this comment.
Base repairability only on probes the desktop consumes
When desktop-capabilities still reports a ready installation but verify-install or desktop-runtime-check fails, this branch labels the state REPAIRABLE and lets the workflow pass. The managed desktop preflight in the reviewed tree never invokes either deeper command—it decides readiness from -h and desktop-capabilities—so in that scenario the app still returns ManagedReady with no repair even though this probe claims the break is detectable; these commands should not count as repair evidence until the desktop actually consumes them.
Useful? React with 👍 / 👎.
The driver set reason=marker-hit before the post-marker sleep and never rechecked, so a step whose work was already cached could run to completion inside that beat and still be recorded as an interruption. The landing assertion tests reason != marker-hit, so a fully completed install passed green having interrupted nothing. Reproduced with a stub that exits during the delay: reported marker-hit / killed=true / exit=0 next to "install finished fully". Set the reason after the sleep, on both drivers. Also trigger on _studio_deps.py and install_manifest.py, where the two decisions the probe asserts on are actually implemented.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3100e90453
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| if backend_ok: | ||
| verdict = "HEALTHY" |
There was a problem hiding this comment.
Classify incomplete installs as repairable
When an interruption occurs after the backend requirements are installed but before the final install manifest is written—for example during data designer deps—the backend can boot while studio_install_ok is false. This ordering nevertheless returns HEALTHY, causing the workflow to skip the repair assertion; the post-repair probe can likewise accept a rerun that failed after installing only the boot dependencies. As a result, missing later dependencies or a broken installer fast path can pass while the desktop still sees an incomplete installation.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not taking this one. After a kill in data designer deps the manifest is indeed missing (install_python_stack.py:3255 writes it last), but a booting backend together with studio_install_ok=false is the app correctly seeing an incomplete install and offering repair, which is the safe outcome rather than the stranding this workflow exists to catch. FALSE_READY at interrupted_install_probe.py:199-210 stays reachable and no assertion becomes unable to fail. Promoting boot-ok plus manifest-false to REPAIRABLE would force a re-run assertion on legs whose venv is already usable, trading signal for noise. Both legs that can land there are experimental.
| if [ -n "$MARKER" ] && grep -qE "$MARKER" "$LOG" 2>/dev/null; then | ||
| # Let it get a beat into the step, so the kill lands mid-work rather than on the | ||
| # boundary where the step has not started touching the venv yet. | ||
| sleep "${KILL_AFTER_MARKER_SECONDS:-3}" |
There was a problem hiding this comment.
Reject kills that advance beyond the requested phase
The new process-alive recheck only catches completion of the whole installer. When the requested phase finishes during this three-second delay but the installer continues into its next phase, the PID is still alive, so the script records marker-hit and the workflow accepts a kill that occurred in the wrong phase; fast phases such as venv creation or pip bootstrap can therefore silently stop covering their named partial-install state. The PowerShell driver has the same gap.
Useful? React with 👍 / 👎.
| - 'install.ps1' | ||
| - 'studio/setup.sh' | ||
| - 'studio/setup.ps1' | ||
| - 'studio/install_python_stack.py' |
There was a problem hiding this comment.
Run the workflow when dependency manifests change
A pull request that changes only studio/backend/requirements/studio.txt or one of the tracked single-env requirement files does not match this path filter, even though those files define the boot dependencies and later dependency phases whose interrupted states the workflow is intended to validate. A newly added boot requirement or a changed late dependency can therefore alter whether a partial install is usable without running any interruption or repair leg; include the Studio requirements tree in the filter.
Useful? React with 👍 / 👎.
| for _ in $(seq 1 "$KILL_GRACE"); do | ||
| kill -0 "$PID" 2>/dev/null || break |
There was a problem hiding this comment.
Wait for the entire process group to exit
When the install.sh group leader exits after SIGTERM while a uv or Python descendant is still shutting down or ignores the signal, kill -0 "$PID" reports the leader as gone even though the process group still exists. The loop then skips the group SIGKILL and wait reaps only the leader, allowing the surviving dependency process to continue mutating the venv while the probe runs and invalidating the interrupted-install result; test the negative process-group ID throughout the grace period instead.
Useful? React with 👍 / 👎.
| stdout = subprocess.PIPE, | ||
| stderr = subprocess.STDOUT, |
There was a problem hiding this comment.
Drain backend logs during health polling
If backend startup emits more output than the OS pipe can buffer before binding the HTTP port—for example from warning-heavy imports—the child blocks because this pipe is not read until after the polling loop and process teardown. The probe then times out and reports a healthy or repaired installation as non-booting, potentially failing the repair leg with FALSE_READY; consume output concurrently or redirect it directly to the artifact file.
Useful? React with 👍 / 👎.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3100e90453
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| if backend_ok: | ||
| verdict = "HEALTHY" |
There was a problem hiding this comment.
Keep incomplete installs from being classified as healthy
When an interruption occurs after the backend boot dependencies finish but before the final install manifest is written—for example during the later data-designer dependency phase—the health endpoint can return 200 while studio_install_ok and verify_install still report an incomplete installation. This branch nevertheless emits HEALTHY, and both “A re-run must repair” steps explicitly skip that verdict, so the workflow never verifies that the installer can repair this partial state and a broken version fast path can pass unnoticed. Gate HEALTHY on install completeness as well, or drive the repair condition from the install probes independently of backend bootability.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
backend_ok is deliberately the ground truth here: if the backend boots, preflight is not lying and the user is not stranded, so HEALTHY is correct and there is nothing for a re-run to repair. The only legs where a booting backend can coexist with an incomplete manifest are unsloth-extras and data-designer (lines 88-89), both experimental: true, so gating HEALTHY on install completeness would add no merge-gating assertion. It also pulls against the P1 above, which is right that the verdict should follow the signals the desktop actually consumes.
| - 'studio/setup.sh' | ||
| - 'studio/setup.ps1' | ||
| - 'studio/install_python_stack.py' |
There was a problem hiding this comment.
Run interruption recovery for requirement changes
A PR that changes only studio/backend/requirements/studio.txt—the exact dependency source called out above as producing the interrupted-install failure—does not match this paths filter, nor do changes to the other requirement files used by the dependency-pass legs. Such changes therefore never exercise this workflow's interruption and repair assertions; add studio/backend/requirements/** to the trigger list so dependency-only regressions cannot bypass the new coverage.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Agreed, and this is already in: studio/backend/requirements/** is on the trigger list at line 44, with a comment noting that studio.txt is where structlog is declared and that the single-env files drive the later steps.
| - {label: studio-deps, marker: 'studio deps', installArgs: '--no-torch --local'} | ||
| - {label: torch, marker: 'Installing PyTorch', installArgs: '--local'} |
There was a problem hiding this comment.
Exercise the Windows installer in Tauri mode
The production Windows desktop path always appends --tauri in studio/src-tauri/src/install.rs, but both Windows matrix entries omit it and instead perform a custom-root shell install. This bypasses Tauri-specific branches in install.ps1, including the bundled-file overlay, frontend skipping, UNSLOTH_TAURI_MODE propagation, default-root handling, and Tauri failure behavior, so a Windows regression confined to the actual desktop installation path can leave these jobs green. Run these legs at the isolated runner's default root with --tauri --local, matching the production invocation.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, and stronger than stated: install.rs:202 always leads with --tauri and :356 env_removes UNSLOTH_STUDIO_HOME, and 'Installing PyTorch' is printed only by Write-TauriLog (install.ps1:2440), so without --tauri the torch leg's marker could never appear and it was killed at the deadline. Fixed in 5c65d06: the job-level UNSLOTH_STUDIO_HOME is gone, both legs run --tauri --local at the runner's default root, and the probe and re-run steps resolve the CLI under %USERPROFILE%.unsloth\studio\unsloth_studio\Scripts.
| Start-Sleep -Seconds $KillAfterMarkerSeconds | ||
| # The installer can finish inside the delay; recording marker-hit before it | ||
| # let a COMPLETED install satisfy the landing assertion and probe HEALTHY. | ||
| if ($proc.HasExited) { $reason = 'exited-during-marker-delay'; break } | ||
| $reason = 'marker-hit' |
There was a problem hiding this comment.
Confirm the target phase is still running before marker-hit
When a marked operation completes within the fixed three-second delay but the installer continues into a later phase, the parent process is still alive, so this records marker-hit and the workflow's landing assertion passes even though the kill no longer targets the named operation. The POSIX driver has the same PID-only check. This is particularly plausible for cached or short dependency steps such as pip bootstrap, and lets a leg pass while testing a different partial state; add phase-completion/current-step evidence rather than using overall installer liveness as proof that the target phase is still active.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
The 3 second delay exists so the kill lands mid-work, and the one outcome that would void a leg, the installer finishing inside that delay, is already caught: sh:66 and ps1:71 record exited-during-marker-delay instead of marker-hit, and the landing assertion then fails the leg. If a short step ends and the installer moves into the next phase, the leg still interrupts a live install and asserts the same state-independent property (never FALSE_READY, and a re-run must repair), so no failure is swallowed. The phase labels come from _progress (install_python_stack.py:2433), which rewrites a single line with a carriage return, so current-step evidence means parsing a progress bar to buy label precision only.
| elif ( | ||
| facts.get("verify_install") == "failed" | ||
| or facts.get("desktop_runtime_check") == "failed" |
There was a problem hiding this comment.
Use only desktop-consumed probes as repair evidence
The actual managed preflight in studio/src-tauri/src/preflight/managed.rs runs only unsloth -h and studio desktop-capabilities --json; it never invokes verify-install or desktop-runtime-check. Treating failures from those standalone commands as sufficient for REPAIRABLE therefore creates a false negative: if desktop-capabilities regresses to reporting a valid ready payload while verify-install still detects the torn install, this workflow passes even though the desktop reports ManagedReady and the backend crashes. Either wire these commands into the desktop preflight first or exclude them from the verdict and require repair evidence that the app actually consumes.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Confirmed and fixed in 5c65d06. probe_managed_bin runs only -h and 'studio desktop-capabilities --json' (managed.rs:357) and reads studio_install_ok from that payload (managed.rs:445); grep finds no verify-install or desktop-runtime-check anywhere under studio/src-tauri. REPAIRABLE now requires a desktop-consumed signal (cli -h failure, capabilities failure, or studio_install_ok false); the two deeper commands are still run and recorded in verdict.json, but no longer count as repair evidence.
The escalation was gated on the leader still being alive, so a leader that exits promptly on SIGTERM while a uv or python descendant ignores it skipped the SIGKILL entirely, and wait reaped only the leader. Proven with a descendant that traps TERM: pre-fix its heartbeat keeps ticking while the probe would be running, post-fix it stops. Signal the group unconditionally and drain it after the reap, since an unreaped leader is still a member of its own group. The probe started the backend on stdout=PIPE and read nothing until after the poll loop, so a backend logging more than the pipe buffer during import blocked before binding. Measured 65536 bytes here; a child emitting 200 KB never reaches its bind line, which would make backend_ok false for a healthy install. Write straight to the artefact file. Also trigger on studio/backend/requirements/**, where structlog is declared.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 80fc65dfe3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| else: | ||
| proc.terminate() | ||
| try: | ||
| proc.wait(timeout = 10) | ||
| except subprocess.TimeoutExpired: | ||
| proc.kill() |
There was a problem hiding this comment.
Terminate the Windows backend process tree
On Windows, the managed CLI launches the actual Studio server as a child process (unsloth_cli/commands/studio.py:1543-1548), but this branch terminates only the CLI wrapper; CREATE_NEW_PROCESS_GROUP does not make terminate() kill descendants. If startup exceeds --boot-timeout while the child remains alive, the workflow proceeds to the repair step with that server still using the venv, which can lock files and make the repair assertion flaky or invalid. Kill the full tree here (for example with taskkill /T or a Job Object), matching the process-tree ownership promised above.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct: on win32 the CLI re-spawns the server through subprocess.Popen and waits on it (commands/studio.py:1543), and CREATE_NEW_PROCESS_GROUP does not make terminate() reach descendants, so a server surviving a boot-timeout would hold the venv open while the repair step reinstalls into it. Fixed in 5c65d06: the Windows reap runs taskkill /F /T /PID and only falls back to terminate/kill if that does not finish it.
| - name: A re-run must repair, not short-circuit | ||
| # Only meaningful when the install is broken but present. The bug's second half | ||
| # is that `install.sh` sees a "current" version and no-ops over a broken venv. | ||
| if: always() && steps.probe.outputs.verdict != 'NO_CLI' && steps.probe.outputs.verdict != 'HEALTHY' |
There was a problem hiding this comment.
Exercise recovery when interruption leaves no CLI
When a kill lands during venv creation or PyTorch installation, it normally occurs before the later Unsloth step creates the CLI, so these matrix legs produce NO_CLI; this condition (and its Windows counterpart) then skips the only installer rerun. A regression where the partial venv makes the next normal install fail or short-circuit therefore leaves users unable to recover while these dedicated early-phase legs pass. Rerun the installer for NO_CLI too and assert that the backend becomes healthy.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Genuine, and fixed in 3e7fc34. Both re-run steps are now if: always() && steps.probe.outputs.verdict != 'HEALTHY' (lines 159 and 276), so the NO_CLI legs re-run the installer and assert the backend boots, each behind a binary-existence guard first (lines 169 and 282) so a still-missing CLI is reported rather than crashing the json.load.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 80fc65dfe3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| facts.get("verify_install") == "failed" | ||
| or facts.get("desktop_runtime_check") == "failed" |
There was a problem hiding this comment.
Restrict repair evidence to desktop preflight signals
When a broken install makes verify-install or desktop-runtime-check fail while -h and desktop-capabilities still report ready, this branch returns REPAIRABLE and the workflow passes. However, probe_managed_bin in studio/src-tauri/src/preflight/managed.rs only runs -h and desktop-capabilities; it never consults either deeper command, so the actual app remains ManagedReady in precisely that scenario. This masks a regression where a new verification command detects the damage but is not wired into desktop preflight.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Same finding as the P1 above and correct for the same reason; fixed once in 5c65d06. The verdict's REPAIRABLE branch now lists only cli_h_ok, capabilities_ok and capabilities.studio_install_ok, with a comment pointing at managed.rs:357/:445 so the two sets do not drift apart again.
| # These legs run install.ps1 WITHOUT --tauri (install.ps1:189-215 rejects a custom | ||
| # root under --tauri exactly like install.sh:100-147), so the workspace-scoped | ||
| # root is usable here. | ||
| UNSLOTH_STUDIO_HOME: ${{ github.workspace }}/.studio-home |
There was a problem hiding this comment.
Exercise the Windows desktop installer path
In the Windows matrix, setting a custom UNSLOTH_STUDIO_HOME forces the workflow to invoke install.ps1 without --tauri, whereas resolve_install_script in studio/src-tauri/src/install.rs always supplies --tauri and removes both custom-root variables. Consequently these legs exercise the shell-install/custom-root path (UNSLOTH_TAURI_MODE=0, frontend installation enabled, and different root resolution), so a Windows regression limited to the actual desktop/default-root path can merge while this purported desktop interruption coverage stays green.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Same point as the Windows matrix note above, fixed once in 5c65d06: UNSLOTH_STUDIO_HOME is removed from the job and both legs now run --tauri --local at the default root, matching install.rs:202 and :356.
| proc = subprocess.Popen( | ||
| [binp, "studio", "--api-only", "-H", "127.0.0.1", "-p", str(port)], | ||
| stdout = blog_fh, | ||
| stderr = subprocess.STDOUT, | ||
| text = True, | ||
| **popen_kw, |
There was a problem hiding this comment.
Classify an unspawnable CLI as repairable
When interruption leaves an executable path in place but the launcher cannot be spawned—for example, a Unix entry point whose venv interpreter is missing—run() correctly records both desktop probes as failed by catching OSError, but this unconditional Popen raises the same error without producing verdict.json. Both workflow variants then fail while trying to read that file instead of accepting the state as REPAIRABLE, even though the actual desktop preflight treats an unlaunchable CLI as stale and offers repair.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Reproduced exactly: with the console script present but its venv interpreter gone, run() catches FileNotFoundError and reports both desktop probes failed, while the Popen raises, so no verdict.json is written and the workflow dies on the json.load instead of reporting. Fixed in 5c65d06: the spawn is guarded, the failure is recorded as backend_spawn_error, backend_ok stays false and the run now ends REPAIRABLE with exit 0.
| foreach ($name in 'uv', 'python') { | ||
| Get-Process -Name $name -ErrorAction SilentlyContinue | | ||
| Where-Object { $_.Path -and $_.Path -like "*$env:UNSLOTH_STUDIO_HOME*" } | | ||
| ForEach-Object { try { Stop-Process -Id $_.Id -Force } catch { } } |
There was a problem hiding this comment.
Kill escaped global uv processes on Windows
When an immediate installer child exits before Stop-Tree enumerates it, a still-running descendant is no longer reachable through the recursive parent lookup, which is why this fallback sweep exists. However, install.ps1 obtains uv.exe from PATH via winget, Astral's installer, or the runner tool cache, so its executable path is normally outside UNSLOTH_STUDIO_HOME and this predicate excludes it. Such an escaped uv process can continue modifying the venv while the probe runs, allowing a Windows leg to report HEALTHY even though the intended process-tree interruption was incomplete.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Genuine, fixed in 3e7fc34. Verified in pwsh that the old predicate $_.Path -like "$env:UNSLOTH_STUDIO_HOME" matched nothing at all, not even the venv's own python.exe: the workflow joined github.workspace with a forward slash so the value arrived as D:\a\r\r/.studio-home while Process.Path is all backslashes, and uv is never under the studio home anyway since install.ps1 takes it from winget or astral.sh. The sweep now normalises separators, matches uv by name, and guards an empty home (lines 91-100).
Two of the interrupted-install legs were passing without testing anything.
The re-run assertion skipped verdict=NO_CLI, but a kill at "venv" or "torch"
lands before install.sh ever prints "Installing Unsloth" (:2125, :3667, :3961),
so those legs can only ever produce NO_CLI. Three non-gating-exempt cells
(macos-14 kill@venv, macos-14 kill@torch, ubuntu-latest kill@torch) therefore
asserted nothing beyond a marker appearing in a log. NO_CLI is now included:
a re-run must produce a booting backend regardless of how little the first run
managed to install. Each re-run step grows an existence check first, because
the probe exits without writing verdict.json when the binary is absent and the
json.load would crash rather than report.
The Windows straggler sweep matched nothing at all. UNSLOTH_STUDIO_HOME arrives
as D:\a\r\r/.studio-home, since the workflow joins ${{ github.workspace }} with
a forward slash, while Process.Path is all backslashes, so the literal -like
missed even the venv's own python.exe. uv is never under the studio home in any
case: install.ps1 takes it from winget or astral.sh. Normalise the separators,
match uv by name (the runner is ephemeral and runs no other uv), and skip the
home comparison entirely when the variable is empty, which would otherwise turn
the pattern into "**" and kill every python on the runner.
…eflight reads The Windows matrix set a workspace-scoped UNSLOTH_STUDIO_HOME, which forces install.ps1 down the shell-install path: install.ps1:189-215 rejects a custom root under --tauri, so those legs ran with UNSLOTH_TAURI_MODE=0, the frontend build on and no bundled-file overlay, while the desktop always spawns the installer as --tauri with the variable scrubbed (install.rs:202 and :356). The torch leg could not even reach its marker: "Installing PyTorch" is printed only by Write-TauriLog (install.ps1:2440), so it was killed at the deadline. Both legs now run --tauri --local at the default root, and the probe and re-run resolve the CLI under %USERPROFILE%\.unsloth\studio. The probe counted `studio verify-install` and `studio desktop-runtime-check` failures as proof the app can repair, but preflight/managed.rs runs only `-h` and `studio desktop-capabilities --json` (:357) and reads studio_install_ok from that payload (:445); neither deeper command is invoked anywhere under studio/src-tauri. A leg where capabilities regressed to ready while only those standalone commands saw the damage would have passed green with the app stuck on ManagedReady, which is the exact false negative this workflow exists to catch. They are still run and recorded in verdict.json, just no longer repair evidence. An interrupted install can leave the console script in place while its venv interpreter is gone. The probes go through run(), which catches OSError, but the backend spawn did not, so the probe aborted before writing verdict.json and both workflows died on the json.load instead of reporting. That state is now recorded as backend_spawn_error and lands on REPAIRABLE, which is what `-h` failing already implies. On win32 the CLI re-spawns the server as a child and waits on it (unsloth_cli/commands/studio.py:1543), and CREATE_NEW_PROCESS_GROUP does not make terminate() reach descendants, so the reap left a server holding the venv open while the repair step reinstalled into files Windows had locked. Use taskkill /F /T for the tree. The straggler sweep now falls back to the default studio root, since under --tauri there is no UNSLOTH_STUDIO_HOME to match on.
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5c65d06b0f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| # skipping the re-run left three non-experimental legs asserting nothing but | ||
| # that a marker appeared. The bug's second half is that `install.sh` sees a | ||
| # "current" version and no-ops over a broken venv. | ||
| if: always() && steps.probe.outputs.verdict != 'HEALTHY' |
There was a problem hiding this comment.
Exercise repair when an incomplete install still boots
When an interruption occurs after studio deps completes but before the final manifest is written—such as the data-designer leg—the backend can answer /api/health, causing the probe to emit HEALTHY, while desktop-capabilities still reports studio_install_ok=false. This condition then skips the repair run, so the workflow can pass without verifying that the installer's version fast path clears the incomplete state; a broken rerun would leave the desktop repeatedly detecting the install as stale. Run the repair unless both the backend and install manifest are healthy.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, and it is the data-designer leg specifically: install_python_stack.py:3255 writes the manifest last, so a kill at 'data designer deps' (line 3191) leaves studio.txt installed, the backend booting, and studio_install_ok false, which managed.rs:445 turns into Stale. The probe called that HEALTHY, so the re-run step at line 159 was skipped and the leg asserted nothing past marker-hit. Fixed in the probe rather than in the workflow condition: HEALTHY now requires the backend to boot AND desktop-capabilities to report the install complete, so the leg reaches the re-run and the post-repair HEALTHY check covers the manifest too.
| paths: | ||
| - 'install.sh' |
There was a problem hiding this comment.
Trigger interrupted-install CI for pyproject changes
Add pyproject.toml to this path filter. Every leg installs the checkout with --local, so changes to its editable-install metadata, dependencies, console entry points, or packaged studio files can change whether an interrupted environment retains a working CLI, manifest, or backend. Other install smoke workflows do not interrupt the installer, so such a PR currently bypasses the recovery coverage introduced here.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Agreed. Every leg runs with --local, and pyproject.toml is where the unsloth console script and the core deps live; the probe's whole premise is that -h and desktop-capabilities survive a torn install because typer/click/rich are core, so moving one of them to an extra changes what every interrupted venv looks like. It is also the convention here, 18 other workflows already filter on that path. Added at line 34.
| if ! kill -0 "$PID" 2>/dev/null; then | ||
| reason="exited-during-marker-delay" | ||
| break | ||
| fi | ||
| reason="marker-hit" |
There was a problem hiding this comment.
Verify the target step remains active before recording marker-hit
For fast phases such as Creating virtual environment or pip bootstrap, the marked command can finish during this three-second delay while the overall installer continues into a later phase. Since the check only tests whether the installer PID is alive, it still records marker-hit, and the workflow's landing assertion passes even though the kill occurred in a different phase; the PowerShell driver has the same issue. Verify that the target phase has not advanced, or use explicit phase-end markers, before accepting the landing.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Already answered on 3668521355 and the code has not changed. The only outcome that voids a leg is the installer finishing inside the three second delay, and that is caught at interrupt-install.sh:66 and interrupt-install.ps1:71 as exited-during-marker-delay, which the landing assertion then rejects. A kill that lands one phase later still asserts the same state-independent property: whatever partial venv it produces must be genuinely healthy or explicitly repairable. Phase labels come from _progress, which rewrites one line with a carriage return, so there is no cheap end-of-phase marker to observe.
| p = subprocess.run(cmd, capture_output = True, text = True, timeout = timeout) | ||
| return p.returncode, (p.stdout or "") + (p.stderr or "") |
There was a problem hiding this comment.
Parse capabilities from stdout exactly as desktop preflight does
When desktop-capabilities emits valid JSON on stdout plus any warning or diagnostic on stderr, run() concatenates the streams, so json.loads(caps_raw[brace:]) sees trailing non-JSON text and leaves studio_install_ok as absent. With a broken backend the probe then reports FALSE_READY, even though the real desktop discards stderr, parses the valid stdout payload, and sees the install as repairable. Capture stdout and stderr separately and apply the desktop's strict stdout JSON parsing to avoid rejecting valid recovery changes.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Confirmed against managed.rs: the probe pipes stdout and sends stderr to /dev/null (managed.rs:358), then feeds the entire stdout buffer to serde_json (managed.rs:414), which rejects leading or trailing non-JSON. The old line 49 concatenated both streams and line 104 scanned to the first brace, so one stderr line was enough for json.loads to raise Extra data and leave studio_install_ok absent, reporting FALSE_READY over an install the desktop parses and calls repairable. Now captured separately and parsed strictly from stdout; an unparseable payload counts as repair evidence, matching the Stale at managed.rs:521 when the capability probe returns nothing.
| try: | ||
| proc.wait(timeout = 10) | ||
| return |
There was a problem hiding this comment.
Escalate against the process group after reaping its leader
If the POSIX backend leader exits promptly on SIGTERM while one of its children remains alive, proc.wait() succeeds and this return skips the SIGKILL iteration entirely. That leaves the descendant holding the selected port or venv while the repair step starts, despite the probe's stated process-tree ownership guarantee. Retain the original process-group ID and always signal the group with SIGKILL after reaping the leader, as the interrupt driver already does.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Right, and reproduced: with a leader that exits on SIGTERM and a child that ignores it, the old loop at line 197 returned as soon as proc.wait() succeeded and the group was still alive afterwards; with the unconditional group SIGKILL it is empty. The old code also read os.getpgid(proc.pid) after the reap, which raises. The pgid is now captured before the first signal and SIGKILL always goes to the group, the same escalation interrupt-install.sh:94 makes for the same reason.
Read desktop-capabilities the way the desktop reads it. preflight/managed.rs pipes stdout and sends stderr to /dev/null (managed.rs:358), then hands the whole stdout buffer to serde_json (managed.rs:414). The probe concatenated both streams and scanned to the first brace, so a single diagnostic line on stderr made json.loads raise on the trailing text, studio_install_ok stayed "absent", and a broken backend was reported FALSE_READY over an install the real app parses, sees as incomplete, and offers to repair. That fails a valid recovery change for a reason that exists only in the probe. stdout and stderr are now captured separately and stdout is parsed strictly; a payload that does not parse counts as repair evidence, matching the Stale the desktop reports when the capability probe returns nothing (managed.rs:521). A booting backend alone is not a finished install. The manifest is written last (install_python_stack.py:3255), so a kill after "studio deps" but before it, the data-designer leg, leaves a venv whose backend boots while desktop-capabilities still reports studio_install_ok=false and preflight reports Stale (managed.rs:445). Calling that HEALTHY skipped the re-run step, so the leg asserted nothing beyond a marker appearing and never exercised the version fast path that is supposed to clear an incomplete install, which is the half of the bug that strands the user. HEALTHY now requires both. Escalate to the process group after reaping the probe's backend. reap() returned as soon as proc.wait() succeeded, and the leader exits promptly on SIGTERM while a uvicorn worker does not, so the SIGKILL iteration was skipped and that worker kept the port and the venv open while the repair step reinstalled underneath it. It also read os.getpgid(proc.pid) after the reap, which raises. The pgid is now captured up front and SIGKILL always goes to the group, the same escalation interrupt-install.sh:94 makes. A heartbeat experiment left the group alive with the old sequence and empty with the new one. Trigger the workflow on pyproject.toml. Every leg installs the checkout with --local, so that file decides the unsloth console script and the core dependencies the probe leans on: -h and desktop-capabilities only survive a torn install because typer/click/rich are declared there. No other install workflow interrupts the installer, so such a change would otherwise merge without a single leg running.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 18b7de14e1
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| # Stale (managed.rs:445) rather than Ready. Calling that HEALTHY skipped the | ||
| # re-run step, so the leg asserted nothing beyond a marker appearing and never | ||
| # exercised the fast path that is supposed to clear an incomplete install. | ||
| if backend_ok and caps_ready is not False: |
There was a problem hiding this comment.
Treat missing capability fields as stale
When desktop-capabilities omits studio_install_ok or otherwise cannot prove the new contract, caps_ready remains "absent", and this condition classifies the install as HEALTHY whenever the backend happens to boot. The actual desktop preflight treats studio_install_ok != Some(true) as stale (managed.rs:445), so a regression that drops this field during a late interruption can skip the repair assertion even though the app would offer repair.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Agreed, fixed. managed.rs:445 tests studio_install_ok != Some(true), so an absent field is Stale exactly like a false one, and a CLI too old to carry it is already rejected one check earlier on desktop_manageability_version. caps_ready is now simply caps_rc == 0 and studio_install_ok is True, so a payload that stopped carrying the field can no longer report HEALTHY on a booting leg and skip the re-run assertion.
| # printed and the kill can never land. It ran to completion instead, | ||
| # proving nothing. | ||
| - {os: macos-14, label: unsloth-extras, marker: 'unsloth extras', experimental: true} | ||
| - {os: macos-14, label: data-designer, marker: 'data designer deps', experimental: true} |
There was a problem hiding this comment.
Make data-designer recovery blocking
Because the job sets continue-on-error: ${{ matrix.experimental }}, this data-designer leg is allowed to fail without failing the workflow. That is the late phase where studio deps have already been installed but the final manifest has not been written, so a broken repair fast path for an incomplete-but-booting install can still merge even though this workflow is intended to assert that state is repaired.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Declining. data-designer is step 9 of 15 in install_python_stack.py:3191, so reaching its marker needs the whole torch plus unsloth plus studio pass to finish inside KILL_AT_SECONDS=1500 on a shared runner; that timing, not the value of the assertion, is why the leg is experimental. The repair fast path itself is already blocking through studio-deps, venv, torch, unsloth and setup, which all take the re-run step since it now runs for every non-HEALTHY verdict.
| parsed = json.loads(caps_out) | ||
| if isinstance(parsed, dict): | ||
| v = parsed.get("studio_install_ok") | ||
| install_ok = "absent" if v is None else bool(v) |
There was a problem hiding this comment.
Parse studio_install_ok as a JSON boolean
If a regression serializes studio_install_ok as a string or number, this bool(v) conversion treats values like "false" as ready, while the desktop's typed Rust deserialization would reject the payload and mark the install stale. In that scenario the probe can skip the repair assertion for an incomplete-but-booting install, or fail a leg as FALSE_READY even though the app would actually offer repair; require v to be a real JSON boolean before setting caps_ready.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Declining. The only emitter is unsloth_cli/commands/studio.py:2830, which writes bool(state["ok"]), so json.dumps always produces a real JSON boolean and no interruption can change its type. Reaching the case you describe needs a source change that retypes that line, not a torn install, which is outside what this workflow asserts.
| elif install_ok is True: | ||
| caps_ready = True |
There was a problem hiding this comment.
Honor the rest of the desktop capability contract
This marks capabilities ready solely from studio_install_ok, but the desktop also rejects incompatible protocol/manageability versions, missing API/auth/backend-ownership support, and stale backend versions before returning ManagedReady. If an interrupted install reports studio_install_ok: true while any of those other fields are missing or stale, this probe can classify a booting backend as HEALTHY and skip the repair assertion even though the real app would mark the install stale and repair it.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Declining. Every other field in desktop_capability_stale_reason is a constant in the payload at unsloth_cli/commands/studio.py:2814-2821 (protocol 1, manageability 2, three literal Trues), so no interruption can move them. The one interruption-sensitive field is studio_install_ok, and since install_python_stack.py:3255 writes the manifest last, any interruption already makes it false, which dominates the verdict. Mirroring the constants in Python would only duplicate version.rs and drift against it.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 18b7de14e1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| caps_ready: object = "absent" | ||
| if caps_rc != 0 or install_ok is False or install_ok == "unparseable": | ||
| caps_ready = False |
There was a problem hiding this comment.
Treat an absent install status as stale
When an interruption leaves a CLI predating studio_install_ok—for example, during the unsloth phase before the local checkout is overlaid—this keeps caps_ready as "absent". A broken backend with a working -h then becomes FALSE_READY, even though preflight/managed.rs rejects a missing studio_install_ok as Stale and offers repair; conversely, a booting backend is labeled HEALTHY and skips the repair assertion. Treat the absent field as not ready, matching the desktop's stale predicate.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Same finding as 3669540499 and fixed by the same change. Worth calling out the second direction you noted: with the field absent the old code also reported FALSE_READY for a broken backend with a working -h, which is a hard CI failure over an install the app sends to repair. Both directions now resolve to REPAIRABLE, matching the Stale arm.
| if [ -n "$MARKER" ] && grep -qE "$MARKER" "$LOG" 2>/dev/null; then | ||
| # Let it get a beat into the step, so the kill lands mid-work rather than on the | ||
| # boundary where the step has not started touching the venv yet. | ||
| sleep "${KILL_AFTER_MARKER_SECONDS:-3}" |
There was a problem hiding this comment.
Verify the target phase is still running before killing
For fast phases such as virtual-environment creation or the cached pip bootstrap, the three-second delay can let the marked phase finish while the installer continues into a later phase. The subsequent check only proves that the overall installer is alive, so it still records marker-hit and the workflow's “kill must have landed where aimed” assertion passes even though that phase was never interrupted. This can make multiple matrix cells exercise the same later partial state and leave the intended early-phase recovery paths uncovered.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Declining, third time for this claim after 3668521355 and 3668913487. The only outcome that voids a leg, the installer finishing inside the three second delay, is already caught at interrupt-install.sh:66 and interrupt-install.ps1:71 as exited-during-marker-delay. A kill that lands one phase later still asserts the same state-independent property, and phase labels come from _progress, which rewrites one line with a carriage return, so whether a phase is still active is not cheaply observable.
| # Stale (managed.rs:445) rather than Ready. Calling that HEALTHY skipped the | ||
| # re-run step, so the leg asserted nothing beyond a marker appearing and never | ||
| # exercised the fast path that is supposed to clear an incomplete install. | ||
| if backend_ok and caps_ready is not False: |
There was a problem hiding this comment.
Require the CLI help probe before declaring health
If unsloth -h fails but the backend command still reaches its health endpoint, this branch declares the install HEALTHY whenever capabilities are not explicitly false. The real desktop returns Stale immediately when its -h probe fails (probe_managed_bin in preflight/managed.rs), so this result skips the repair rerun for an install the application considers repairable. Include cli_h_ok in the healthy condition rather than consulting it only in the later broken-backend branch.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, fixed. probe_managed_bin runs -h first and returns Stale cli_unusable at managed.rs:465-478 before it ever reaches the capability probe, so cli_h_ok now gates the HEALTHY arm rather than only appearing in the repairable one. A CLI that cannot print help no longer counts as healthy just because the backend booted.
The probe left studio_install_ok=absent undecided and judged those installs on whether the backend booted. preflight/managed.rs:445 tests studio_install_ok != Some(true), so an absent field is Stale exactly like a false one; a CLI too old to carry it is already rejected one check earlier on desktop_manageability_version. The gap mattered in both directions: a payload that stopped carrying the field reported HEALTHY on every booting leg and skipped the re-run assertion this workflow exists to make, and a torn venv with a working -h was failed as FALSE_READY even though the app would have offered repair. unsloth_cli/commands/studio.py is in this workflow's path filter precisely to catch that class of change, so it must not be the thing that silences it. The verdict also consulted cli_h_ok only in the repairable arm, so a CLI that cannot print help was called HEALTHY whenever the backend happened to boot. probe_managed_bin runs -h first and returns Stale cli_unusable before it ever reaches the capability probe (managed.rs:465-478), so that install goes to repair in the real app and the leg must assert it here.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e5b40c11cf
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| # Depth-first, so a parent cannot respawn a child we already killed. CIM gives the | ||
| # parent link Windows does not expose via process groups. | ||
| $kids = @(Get-CimInstance Win32_Process -Filter "ParentProcessId=$RootId" -ErrorAction SilentlyContinue) | ||
| foreach ($k in $kids) { Stop-Tree ([int]$k.ProcessId) } |
There was a problem hiding this comment.
Record descendant termination before requiring a root kill
When interruption lands while install.ps1 is waiting on a child such as uv or Python, this depth-first traversal kills that child first; PowerShell can then observe the failed command and exit before recursion returns to the root. In that race, the driver did deliver the interruption, but the root Stop-Process throws, interrupt_root_killed remains false, and the workflow's hard check fails the Windows leg spuriously. Suspend or terminate the root before walking descendants, or record successful termination of an installer descendant as proof that the driver caused the failure.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Confirmed and fixed in 4493b14. It is not theoretical: in staging run 30424366953 the Windows studio-deps leg's install.log already carries [TAURI:ERROR_DEFAULT] unsloth studio setup failed (exit code -1), so install.ps1 had observed the child's death and was on its own error path by the time Stop-Process reached it. Stop-Process happened to win there, but the new root-kill assertion would have failed that leg outright the other way round.
Root first rather than descendant-as-proof, since a descendant kill only shows the driver touched the tree, not that it took the process whose exit status the leg reads. The tree is snapshotted before anything dies (an orphaned child has no ParentProcessId left to walk), then the root goes down ahead of its descendants. A dead leader cannot react to a child dying, and it cannot respawn one either, which is all the depth-first order was buying.
Staging run 30426111484 failed the macOS torch leg on the landing check: the 3s beat carried the signal from "Installing PyTorch" into "Installing Unsloth", because the PyTorch step, which this workflow called minutes long, finished in under three seconds. The beat only ever existed to land mid-work, and it cannot do that safely: every label prints before its work starts, so detection is already inside the phase, and any wait is a bet on how long that phase runs. It lost in 30419729244 and again here. So the beat is gone rather than retuned, and with it the matrix knob and the driver parameter on both platforms. The landing check stays and can still fail, since a phase shorter than one poll is seen only after it ends. The Windows driver also polled every 500ms while its own comment claimed a fifth of a second. That is 2.5 slices of overshoot the POSIX side does not carry, and it is now 200ms like the POSIX loop.
The depth-first walk killed the child install.ps1 was waiting on and only then the root, which races the leader's own reaction to that death. It is not a theoretical race: in staging run 30424366953 install.ps1 had already printed "unsloth studio setup failed (exit code -1)" by the time Stop-Process reached it. A leader that wins the race makes Stop-Process throw, and the new root-kill assertion would then fail a leg whose interruption the driver really did deliver. The tree is now snapshotted first, since a dead parent leaves nothing to walk, then the root goes down ahead of its descendants. A dead leader cannot react to a child and cannot respawn one either, which is what the depth-first order was for.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4493b14647
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| # one check earlier on desktop_manageability_version. Leaving "absent" undecided | ||
| # reported HEALTHY on every booting leg and skipped the repair assertion -- the very | ||
| # regression `unsloth_cli/commands/studio.py` sits in the path filter to catch. | ||
| caps_ready = caps_rc == 0 and install_ok is True |
There was a problem hiding this comment.
Mirror the full desktop capability predicate
When a PR changes any preflight gate other than studio_install_ok, this can disagree with the application it claims to reproduce. desktop_capability_stale_reason() in studio/src-tauri/src/preflight/managed.rs also validates the protocol version, API-only/auth/ownership support, manageability version, and package version; for example, after raising DESKTOP_MANAGEABILITY_VERSION, the desktop would correctly classify the current CLI as repairable while this probe would keep caps_ready true and report FALSE_READY for a broken backend. Since changes under that preflight directory explicitly trigger this workflow, derive readiness from all of the same fields rather than only studio_install_ok.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Declining, tenth pass at this claim (3669540508, 3669882986, 3670006961, 3670127677, 3670238840, 3670327594, 3670558505, 3670620267, 3671198616). Re-checked against the current tree and the answer is unchanged, including for the new manageability angle.
Every other arm of desktop_capability_stale_reason reads a value the CLI emits unconditionally: unsloth_cli/commands/studio.py:3008-3014 hardcodes desktop_protocol_version 1, desktop_manageability_version 2 and the three supports_* flags to true, and preflight/version.rs:3,7 hardcode the same 1 and 2. Every leg installs that checkout with --local, so those arms answer identically whether the kill landed at studio deps or the install ran to completion. studio_install_ok is the only field in the predicate that tracks how much of the install actually ran, which is the only thing this workflow can judge.
On the specific scenario: a PR that raises DESKTOP_MANAGEABILITY_VERSION in version.rs while leaving the CLI at 2 ships a desktop that calls its own bundled CLI stale, and that combination is already tested where the constants are in scope, in managed.rs:606 (older_cli_is_rejected_on_manageability_before_the_install_check). Mirroring it here is also not writable in Python: the predicate ends in backend_version_stale_reason, which branches on cfg!(debug_assertions) (version.rs:145, :163), a Rust build profile the probe cannot see, and the thresholds are Rust consts. Copying them into the probe creates a second source of truth that goes stale silently, which is the failure mode the comment describes.
Direction matters too. FALSE_READY is exactly backend-broken AND caps-ready, so every clause added to caps_ready can only move a leg from FALSE_READY to REPAIRABLE, that is from failing to passing. That shrinks the one outcome this workflow exists to catch, on conditions no leg can produce.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 31af36153b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| ap.add_argument("bin", help = "path to the unsloth CLI") | ||
| ap.add_argument("--port", type = int, default = 0, help = "0 picks a free port") | ||
| ap.add_argument("--out", default = "probe", help = "directory for probe artefacts") | ||
| ap.add_argument("--boot-timeout", type = int, default = 120) |
There was a problem hiding this comment.
Match the desktop backend startup grace period
When a valid interrupted or repaired install takes more than 120 seconds to complete its first backend import, this probe kills it and reports FALSE_READY, failing a required matrix leg even though the desktop explicitly tolerates startup for five minutes (studio/src-tauri/src/commands.rs:9, 839-879) and the frontend waits without its own deadline. This is particularly relevant to fresh torch-heavy starts on slower runners; use at least the desktop's startup grace period before deciding that a ready-looking installation cannot boot.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, and fixed in 5cdf9b5. The probe allowed 120s while BACKEND_STARTUP_GRACE_PERIOD is 5 minutes (commands.rs:9), so a slow but healthy start was reported FALSE_READY and failed a required leg. Reproduced with a stand-in CLI whose backend binds its port after 15s: at a 5s deadline the probe printed backend_ok = False and VERDICT = FALSE_READY, at a 60s deadline the same install printed backend_ok = True and VERDICT = HEALTHY. The default is now 300, matching the desktop.
It costs the assertion nothing: a broken backend exits on the failed import and the poll loop breaks on proc.poll(), so the deadline only ever bounds a LIVE backend. Re-checked with the same stand-in forced to die on import structlog at the new 300s default: VERDICT = FALSE_READY after 1 second.
| if [ "$v" = "HEALTHY" ]; then | ||
| echo "re-run repaired the install (verdict=HEALTHY)" | ||
| exit 0 |
There was a problem hiding this comment.
Require the repair command to succeed
When the repair installer writes the dependency manifest and then fails in a later setup phase, this accepts HEALTHY and exits successfully even though rc is nonzero; setup.sh performs fallible sidecar and GPU setup after install_python_stack.py writes the manifest, so the CLI and backend can pass this probe despite the installer reporting failure. The real desktop returns a repair error immediately when its installer fails (studio/src-tauri/src/commands.rs:615-630) and does not proceed to start the backend, so require a zero repair exit in addition to HEALTHY; the Windows repair step likewise currently ignores powershell.exe's exit status.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Right, and fixed in 5cdf9b5 on both platforms. The step judged the repair only by the probe, so an installer that wrote the manifest and then failed in setup.sh's sidecar or GPU setup passed as repaired. Reproduced with a stand-in repair that prints sidecar setup failed and exits 3 while the probe still reads HEALTHY: the old step printed repair exit: 3 then re-run repaired the install (verdict=HEALTHY) and exited 0; the new one prints repair exit: 3 then ::error::the repair installer exited 3 and exits 1. With the installer exiting 0 the step still passes, so the gate is not a blanket fail.
The Windows leg did ignore powershell.exe's status entirely, and it now captures it. Tee-Object is a cmdlet, so $LASTEXITCODE still carries the native command's code: & bash -c "exit 3" *>&1 | Tee-Object -FilePath ... then $LASTEXITCODE gives 3 under pwsh 7.6.0 locally, and the Windows leg of staging run 30444400897 prints repair exit: 0 from the runner itself.
The gate is one a real failure has to trip rather than a formality: all 26 POSIX repairs across staging runs 30424366953, 30426699078 and 30427378808 exited 0.
The probe allowed the backend 120s to answer /api/health while the desktop waits 5 minutes (BACKEND_STARTUP_GRACE_PERIOD, commands.rs:9), so a slow but healthy install could be reported FALSE_READY. A broken backend exits at once and the poll breaks on it, so the longer deadline only bounds a live backend. The re-run step also accepted a HEALTHY probe over an installer that exited nonzero. setup.sh does fallible sidecar and GPU setup after the manifest is written, and the desktop returns the repair error without starting the backend (commands.rs:615-630). The Windows leg ignored powershell.exe's status entirely.
Comments only: shorter wording for the same rationale, no code touched.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3012d0da9f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| shift 2 || true | ||
| [ "${1:-}" = "--" ] && shift | ||
| KILL_AT_SECONDS="${KILL_AT_SECONDS:-900}" | ||
| KILL_GRACE="${KILL_GRACE:-10}" |
There was a problem hiding this comment.
Match the desktop's five-second escalation behavior
When SIGTERM cleanup or an installer descendant lasts between five and ten seconds, this default lets it continue until ten seconds and the later escalation SIGKILLs the entire process group. The actual desktop waits only five seconds and then calls child.kill() on the installer leader (studio/src-tauri/src/install.rs:830-854), or returns immediately when that leader exits. The CI driver can therefore allow rollback work to finish, or remove lingering writers that survive the real quit path, before probing a materially different partial installation; mirror the desktop's timeout and escalation semantics.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Declining, on both halves.
The 5-to-10 second window is never entered. install.sh's TERM trap (install.sh:708-717) restores the venv replacement and removes its temp dirs, which is a no-op on a fresh runner, then exits 143, so the leader is gone before the grace loop's first kill -0. Measured on all eight POSIX legs of staging run 30444400897, SIGTERM line to SIGKILL line: studio-deps 7ms, unsloth-extras 11ms, setup 8ms, ubuntu studio-deps 3ms, data-designer 28ms, macos torch 2ms, ubuntu torch 2ms, unsloth 9ms. KILL_GRACE is a ceiling that no leg has ever reached, so 5 against 10 cannot change what the probe sees.
The escalation semantics are a deliberate divergence, not an oversight. stop_install SIGTERMs the group and then calls child.kill(), which signals the LEADER only (install.rs:830-854), and returns early if the leader exits first, so the real quit path can leave uv/python writers running. Copying that is what the driver must not do: those children finish the dependency pass under the probe, the venv it then inspects is no longer the interrupted one, and the leg proves nothing. That is how the "studio deps" leg of staging run 30419729244 probed backend_ok=true having installed the structlog it exists to remove. The driver therefore escalates to the group unconditionally, and the probed state is strictly more torn than the app's, which is the safe direction: it can never turn a broken install green.
| interrupt: | ||
| name: ${{ matrix.os }} kill@${{ matrix.label }} | ||
| runs-on: ${{ matrix.os }} | ||
| timeout-minutes: 60 |
There was a problem hiding this comment.
Allow time for both installation and probe passes
On a slow but valid runner, a repair-required leg can spend up to 25 minutes merely reaching the interruption marker (KILL_AT_SECONDS=1500), while each invocation of interrupted_install_probe.py can consume about 17 minutes from its two 60-second help checks, two 300-second deep checks, and 300-second backend wait. The leg runs that probe both before and after a full repair installation, so the configured operations can legitimately exceed this 60-minute job limit and be canceled before the recovery assertion completes; the Windows job has the same limit. Increase the job timeout beyond the configured component deadlines or reduce those deadlines coherently.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, and fixed in 24d29a2 -- both jobs are now 90 minutes. The arithmetic holds: 1500s to the marker plus KILL_GRACE, then two probe passes of up to 1040s each (two 10s preflight calls, two 60s --help checks, two 300s deep checks, a 300s backend wait) around a repair install, which is roughly 70 minutes against a 60 minute limit. The 300s backend wait landed this round, so the ceiling moved up by 6 minutes.
A cancelled job is the failure mode this workflow exists to avoid: it is a red leg that asserted nothing. Legs land in 6 to 10 minutes in practice (staging run 30444400897), so this is a ceiling, not a target.
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! 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". |
A leg configures up to 25 minutes to the marker plus two probe passes of up to 17 minutes each around a repair install, so the 60 minute limit could cancel a slow runner mid-assertion. Legs land in 6 to 10 minutes in practice.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 24d29a2a6e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| # desktop_manageability_version. Leaving "absent" undecided reported HEALTHY on every | ||
| # booting leg and skipped the repair assertion -- the regression | ||
| # `unsloth_cli/commands/studio.py` sits in the path filter to catch. | ||
| caps_ready = caps_rc == 0 and install_ok is True |
There was a problem hiding this comment.
Mirror the full desktop-capability readiness predicate
When desktop-capabilities returns studio_install_ok: true but has an incompatible protocol/version or lacks one of the required API-only, auth, manageability, or backend-ownership capabilities, this sets caps_ready even though desktop_capability_stale_reason() in studio/src-tauri/src/preflight/managed.rs makes the real app report Stale. If the backend boots, the probe consequently emits HEALTHY and the workflow skips its repair assertion, allowing a CLI change that remains Stale after every reinstall to pass. Parse and validate all fields used by the desktop readiness predicate rather than only studio_install_ok.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Declining, eleventh pass at this claim (3669540508, 3669882986, 3670006961, 3670127677, 3670238840, 3670327594, 3670558505, 3670620267, 3671198616, 3671590146). Re-checked against the current tree once more and nothing has moved.
The scenario as stated cannot occur on any leg: unsloth_cli/commands/studio.py:3008-3014 emits desktop_protocol_version 1, desktop_manageability_version 2 and the three supports_* flags as literals, preflight/version.rs:3,7 hardcode the same 1 and 2, and every leg installs that checkout with --local. Those fields answer identically whether the kill landed at studio deps or the install ran to completion, so "true studio_install_ok with an incompatible protocol or a missing capability" is not a state an interrupted install can reach. studio_install_ok is the only field in the predicate that varies with how much of the install ran.
The predicate is also not writable here: it ends in backend_version_stale_reason, which branches on cfg!(debug_assertions) (version.rs:145, :163), a Rust build profile the probe cannot observe, and its thresholds are Rust consts. Copying them creates a second source of truth that goes stale silently. The full predicate is tested where those constants are in scope, in managed.rs:564-620.
And the direction is wrong: FALSE_READY is backend-broken AND caps-ready, so each clause added to caps_ready only moves legs from failing to passing.
| caps_rc, caps_out, caps_err = run( | ||
| [binp, "studio", "desktop-capabilities", "--json"], timeout = PREFLIGHT_TIMEOUT | ||
| ) |
There was a problem hiding this comment.
Exercise the cached preflight path before declaring repairable
The real probe_managed_bin() returns Ready from read_cached_capability() without invoking desktop-capabilities, but this probe always invokes the command directly and every matrix leg starts from a fresh runner with no healthy capability cache. Consequently, a regression in managed_bin_fingerprint() or cache_matches() that lets a pre-interruption Ready cache survive a torn update will pass these legs as REPAIRABLE, while an existing user's desktop takes the cached Ready path and recreates the false-ready failure. Seed a healthy cached install and interrupt an update, or otherwise exercise the cache lookup, before relying on this verdict.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Declining, third pass at this claim (3669882997, 3670238843), and managed.rs still answers it. read_cached_capability only returns a capability when cache_matches holds (managed.rs:247-258), which requires the cached capability to be Ready AND the fingerprint to match on bin path, size and mtime, studio_root_id, and the marker path, size and mtime. unsloth_install_manifest.json is the first entry in FALLBACK_MARKER_NAMES (managed.rs:26-33) precisely so a repair that touches only studio.txt cannot leave a stale Ready entry alive, and a torn update moves the manifest or the console script and so misses the fingerprint. The schema and both version constants are compared as well.
Beyond that it is a different scenario from the one this workflow reproduces: these legs interrupt a FIRST install on an ephemeral runner, which is the reported bug. Seeding a healthy install, letting it write a cache and then interrupting an UPDATE is a separate lane; it would need a second full install per leg on top of a budget that already reaches 25 minutes to the marker. I would rather add that as its own workflow than fold it into legs whose label says what phase they kill.
| for path in ("/api/health", "/healthz"): | ||
| try: | ||
| with urllib.request.urlopen(f"http://127.0.0.1:{port}{path}", timeout = 2) as r: | ||
| if r.status == 200: | ||
| backend_ok = True |
There was a problem hiding this comment.
Validate the same health response as the desktop
When /api/health returns any HTTP 200 with a malformed or incompatible payload, or when only the fallback /healthz endpoint responds, this sets backend_ok even though check_health_inner() in studio/src-tauri/src/commands.rs queries only /api/health and requires JSON containing status == "healthy" and service == "Unsloth UI Backend". The probe can therefore emit HEALTHY and skip the repair assertion for a backend that the desktop never considers started; query the same endpoint and validate the same payload fields.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Declining, second pass at this claim (3670006964, answered on 3670100168), and the code still rules it out.
/api/health is the only health route the backend serves: studio/backend/main.py:1089 is the sole @app.get for it and there is no /healthz route in the file, so the fallback path can never be the one that answers for this backend. The body it returns is literal constants, status: "healthy" and service: "Unsloth UI Backend" at main.py:1098-1101, both unauthenticated. A 200 from that endpoint therefore carries exactly the two fields check_health_inner (commands.rs:277-297) compares, so the probe's check and the desktop's cannot disagree, and no interrupted install can produce a 200 with a different payload.
The port is not shared either: the probe binds a free port itself (free_port()), so an unrelated 200 on that port is not reachable.
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 24d29a2a6e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| # desktop_manageability_version. Leaving "absent" undecided reported HEALTHY on every | ||
| # booting leg and skipped the repair assertion -- the regression | ||
| # `unsloth_cli/commands/studio.py` sits in the path filter to catch. | ||
| caps_ready = caps_rc == 0 and install_ok is True |
There was a problem hiding this comment.
Mirror every desktop capability readiness gate
When desktop-capabilities returns studio_install_ok: true but another required field is incompatible—such as a wrong protocol/manageability version, a false support flag, or a backend version below the minimum—the real desktop returns Stale via desktop_capability_stale_reason, while this probe sets caps_ready to true. If the interrupted backend also fails to boot, the job therefore reports FALSE_READY even though the desktop would offer repair; capability/preflight changes covered by this workflow can consequently fail these legs for a state that is actually repairable. Parse and apply all readiness predicates used by managed.rs, not only studio_install_ok.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Declining, twelfth pass at this claim (3669540508, 3669882986, 3670006961, 3670127677, 3670238840, 3670327594, 3670558505, 3670620267, 3671198616, 3671590146, 3673680834). The tree is unchanged since the last two answers and so is this one.
The premise is a payload with studio_install_ok: true alongside a wrong version or a false support flag. No leg can produce it: unsloth_cli/commands/studio.py:3008-3014 emits protocol 1, manageability 2 and the three supports_* flags as literals, preflight/version.rs:3,7 hardcode the matching 1 and 2, and --local installs that same checkout on every leg, so those fields are constant across all ten regardless of where the kill landed.
A hand-edited constant is a Rust-side change, and it is covered where the constants are in scope, in managed.rs:564-620 (including older_cli_is_rejected_on_manageability_before_the_install_check). It is not reproducible in the probe either, since the predicate ends in backend_version_stale_reason, which branches on cfg!(debug_assertions) (version.rs:145, :163) and reads Rust consts the probe cannot see; copying them here is a second source of truth that goes stale silently.
Direction, last: FALSE_READY is backend-broken AND caps-ready, so any clause added to caps_ready can only turn a failing leg green, on conditions no leg can reach.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 24d29a2a6e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| # desktop_manageability_version. Leaving "absent" undecided reported HEALTHY on every | ||
| # booting leg and skipped the repair assertion -- the regression | ||
| # `unsloth_cli/commands/studio.py` sits in the path filter to catch. | ||
| caps_ready = caps_rc == 0 and install_ok is True |
There was a problem hiding this comment.
Mirror the full desktop capability predicate
caps_ready only checks the command exit code and studio_install_ok, whereas desktop_capability_stale_reason() also rejects incompatible protocol/manageability versions, missing API-only/auth/backend-ownership support, and stale package versions. If any of those fields is invalid while the interrupted backend cannot boot, the real desktop reports the installation as repairable, but this probe reports FALSE_READY and fails the workflow, producing a false regression result for changes to those capabilities.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Declining, thirteenth pass at this claim (3669540508, 3669882986, 3670006961, 3670127677, 3670238840, 3670327594, 3670558505, 3670620267, 3671198616, 3671590146, 3673680834, 3673821499). Nothing in the tree has changed since the last three answers, so the answer is the same one: the other fields are literals the CLI emits unconditionally (studio.py:3008-3014) matching the Rust consts (version.rs:3,7), --local puts that same CLI on every leg, the tail of the predicate branches on cfg!(debug_assertions) and Rust consts the probe cannot see, managed.rs:564-620 covers the predicate where those constants are in scope, and every extra clause on caps_ready can only turn a failing leg green.
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? 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". |
The failure this covers
A user quit the desktop app while it was installing:
The kill landed at
deps [==========----------] 5/10 studio deps, the step that installsstudio/backend/requirements/studio.txt, wherestructlogis declared. On relaunch, preflight probedunsloth -h(ok) andstudio desktop-capabilities(ok) because the CLI's own dependencies are core, so the app reportedManagedReadywithcan_auto_repair=false. The backend then died:can_auto_repair=falseon aReadydisposition means the user is stuck permanently.Nothing in CI had ever interrupted an install, which is how this shipped.
What this does
Kills the installer at each interesting phase and asserts the result is either genuinely healthy or explicitly repairable, never silently ready. 13 legs across
macos-14(the reported platform),ubuntu-latestandwindows: each dependency-pass step plus the coarse phases (venv, torch, unsloth, setup).Per leg it checks that a re-run repairs rather than short-circuiting on a "current" version check, and that the backend actually boots afterwards.
Three details that decide whether this proves anything
The kill targets the process group, matching
install.rs. Killing only the leader leavesuvandpythonchildren to finish the dependency pass, and the test would quietly pass while proving nothing. Windows has no process groups, so that leg walks CIM parent links instead, which is the same reason the app carrieswindows_job.rs.One shared probe for all platforms. The Windows check was originally bespoke inline PowerShell that only ran
-handdesktop-capabilities. It could not observestudio_install_ok,verify-installordesktop-runtime-check, so it would have reportedFALSE_READYfor the very PRs that add those signals, no matter how well they worked. Worth calling out because that mistake nearly produced the conclusion "neither PR fixes it".install.shruns with--local. Without it the installer resolvesunslothfrom PyPI, so the venv gets the published CLI and no branch-side change is present. Every deeper probe then reportsabsentregardless of the branch, and the whole workflow becomes incapable of observing the thing it exists to test.The probe boots the backend as ground truth and owns the whole process tree, because terminating only the parent leaves children holding the port and the next leg hangs.
Verified
windows kill@studio-depsstudio_install_ok=absent,backend_ok=False, FALSE_READYstudio_install_ok=False,verify_install=failed, REPAIRABLEThe first row is the user's report reproduced exactly. The second is #7492 working. All 13 legs pass on current main.
Pairs with #7550, which stops the app destroying an install in the first place.