Skip to content

ci: switch Windows Stop Studio to a cmd no-op marker - #5462

Merged
danielhanchen merged 1 commit into
mainfrom
ci-windows-stop-studio-no-op
May 15, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
ci-windows-stop-studio-no-op

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

Test plan

  • Job 3 (JSON, images) on dependent PRs reaches green when the test work succeeds.

The prior set +e + redirect + exit 0 fix in #5460 did not stop the
Stop Studio step from exiting 143 (SIGTERM) on Git Bash; bash on
windows-latest exits with that signal before any inline guard
runs, regardless of redirection. The teardown does not gate
correctness -- the runner reclaims the Studio child process at
job end -- so swap the shell from Git Bash to cmd and just emit
a marker line.

After this, Job 3 (JSON, images) and the two other Windows GGUF
CI jobs cannot fail at the teardown step.
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

@danielhanchen
danielhanchen merged commit 85cf0a4 into main May 15, 2026
8 of 9 checks passed
@danielhanchen
danielhanchen deleted the ci-windows-stop-studio-no-op branch May 15, 2026 20:14
danielhanchen added a commit that referenced this pull request Aug 6, 2026
Two real defects the consolidation introduced, both found in review.

Phase environment steps rode the implicit success() while every other
step in their phase carried the explicit
`!cancelled() && steps.assert-prebuilt.outcome == 'success'` gate. A
phase 1 TEST failure therefore skipped 'Phase 2 environment' but still
ran the rest of phase 2, which then inherited phase 1's GGUF_REPO,
GGUF_FILE, STUDIO_PORT and HF_HOME: the tool phase would have talked to
the previous phase's port and cached under the wrong key. Exactly the
failure the job header warns about. Both later phase environment steps
now carry their phase's gate.

Stop Unsloth was an explicit no-op that relied on the runner reclaiming
the process at job end. That was correct while each phase was its own
job; in one job the phase 1 server stayed alive through phases 2 and 3,
holding its model resident and still owning ~/.unsloth/studio/auth while
the next phase wipes and re-seeds that directory for a fresh bootstrap
password.

The obvious fix is the one that was already tried and reverted: a plain
`kill` under Git Bash exits 143 and fails the step (#5460, #5462). This
runs under pwsh instead, so it never goes through Git Bash, and kills by
listening port rather than PID, because STUDIO_PID is bash's $! -- an
MSYS pid that Stop-Process cannot resolve to the real Windows process.
Every failure is swallowed and the step ends in exit 0, so teardown still
cannot fail the job.

The third review item, setup-python being separated from its with block,
was real but already fixed in 578767f: it was the syntax error actionlint
caught before the review landed.
danielhanchen added a commit that referenced this pull request Aug 6, 2026
* CI: run the three Windows inference smokes as phases of one job

openai-anthropic, tool-calling and json-images differed only in model,
port and test body. The checkout, setup-node, setup-python, npm/Defender
tweaks, install.ps1 --local --no-torch and prebuilt assertion were
identical in all three, so every triggering PR ran the same Windows
install three times concurrently.

Windows is where that actually costs something. Measured over recent
successful runs, setup is ~7.0 min per job (install.ps1 alone is ~6.4)
against ~3.8 min of tests. Setup dominates, so sharing it once saves
~14 runner-minutes and 2 of the 60 concurrent-job slots, at roughly
+4 min of wall time on this workflow.

The same trade is deliberately NOT made on ubuntu. In
studio-inference-smoke.yml setup is ~1.9 min against ~3.0 min of tests,
so consolidating there would add more feedback latency than the slots
are worth, and minutes are free on public repos.

Phase independence is preserved rather than assumed. Each phase keeps
its own model cache directory (hf-cache, gguf-cache-tools,
hf-cache-vision), its own HF_HOME, port, server log and artifact, and
each phase is gated on the SHARED preamble rather than on the phase
before it, so one failing phase does not swallow the next and earlier
logs survive.

Collisions the merge had to resolve, since all three were written
assuming they owned the runner: the cache-hf and prime-hf step ids
appeared in both phase 1 and phase 3, both used the hf-cache directory
and the same HF_HOME, and all three wrote logs/studio.log. Ids are now
phase-scoped, cache directories are split, and the logs are
studio.log / studio_tools.log / studio_vision.log.

Model, GGUF file, port and HF_HOME move from job-level env to per-phase
$GITHUB_ENV writes, and the cache keys inline their values as literals,
so no phase can inherit another's. Every step that can block carries its
own timeout-minutes; the 90 min job cap is the outer guard only, because
hf-download-with-retry.sh retries forever by design.

Windows jobs on this workflow: 10 to 8. Validated with actionlint (clean
apart from the four pre-existing windows-2025-vs2026 custom-label
warnings that main already emits) and an assertion-preservation diff:
the set of test commands across all workflows is unchanged at 121.

* CI: stop each phase's server and gate the phase environment steps

Two real defects the consolidation introduced, both found in review.

Phase environment steps rode the implicit success() while every other
step in their phase carried the explicit
`!cancelled() && steps.assert-prebuilt.outcome == 'success'` gate. A
phase 1 TEST failure therefore skipped 'Phase 2 environment' but still
ran the rest of phase 2, which then inherited phase 1's GGUF_REPO,
GGUF_FILE, STUDIO_PORT and HF_HOME: the tool phase would have talked to
the previous phase's port and cached under the wrong key. Exactly the
failure the job header warns about. Both later phase environment steps
now carry their phase's gate.

Stop Unsloth was an explicit no-op that relied on the runner reclaiming
the process at job end. That was correct while each phase was its own
job; in one job the phase 1 server stayed alive through phases 2 and 3,
holding its model resident and still owning ~/.unsloth/studio/auth while
the next phase wipes and re-seeds that directory for a fresh bootstrap
password.

The obvious fix is the one that was already tried and reverted: a plain
`kill` under Git Bash exits 143 and fails the step (#5460, #5462). This
runs under pwsh instead, so it never goes through Git Bash, and kills by
listening port rather than PID, because STUDIO_PID is bash's $! -- an
MSYS pid that Stop-Process cannot resolve to the real Windows process.
Every failure is swallowed and the step ends in exit 0, so teardown still
cannot fail the job.

The third review item, setup-python being separated from its with block,
was real but already fixed in 578767f: it was the syntax error actionlint
caught before the review landed.

* Restore the per-phase bounds and gates the consolidation dropped

Four things the three separate jobs gave for free, which merging them lost:

Per-step timeouts. The old jobs capped themselves at 30/30/35 minutes, so a
hung phase died on its own and the other two ran anyway. One job with a single
90-minute cap means a hang in phase 1 eats the whole budget and phases 2 and 3
never start. The unbounded steps (boot, password rotation, model load, and the
three test steps) now carry step timeouts. A step timeout is a failure, not a
cancellation, so the later phases still run behind their !cancelled() gates.

The install gate. It had picked up 'if: ${{ !cancelled() }}' during the blanket
gating pass, which is wrong for that step specifically: on main it had no 'if:'
and rode the implicit success(), so a failed preamble stopped the job. With
!cancelled() a broken setup-python or setup-node would still install,
assert-prebuilt would pass, and all three phases would run on an
incompletely prepared runner. Removed, with a comment saying why it stays off.

Phase-local prerequisites. Phase 1 rides success() and so chains correctly, but
phases 2 and 3 gated every step on the shared assert-prebuilt alone, so a failed
download or a server that never came up still ran the test against it. Each
phase now also gates on its own download and boot, which keeps the
phase-independence the shared gate buys while restoring within-phase chaining.

Cache keys. gguf-cache -> gguf-cache-tools and hf-cache -> hf-cache-vision kept
their -v1/-v2 suffixes. actions/cache identifies an entry by key AND a version
hash over 'path', but key uniqueness is global, so the renamed paths would miss
forever and never save. This is the same failure measured on staging during the
Mac consolidation; bumped to -v2 and -v3.

* Make the shared preamble the only cross-phase prerequisite

Four gate corrections that all come from the same root cause: after
consolidation, 'shared' and 'phase 1' were still interleaved.

Phase 1's environment and HF cache ran BEFORE the installer, which is where
they sat when phase 1 was its own job. Harmless then, since a priming failure
killed only that job. Shared now, so the same failure skipped the installer
under the implicit success(), skipped assert-prebuilt with it, and evaluated
every phase 2 and phase 3 gate false. A transient HF download took the whole
workflow down. Moved the block after the shared preamble, so a phase-1 resource
failure is phase-local again while a genuine preamble failure still stops
everything.

The phase gates keyed on assert-prebuilt, which is not the last thing every
phase needs. A failed 'Add Unsloth shim to GITHUB_PATH' left the gates true and
both later phases booted a Studio that was not on PATH. The gates now key on the
shim step, which only runs when the assertion passed, so it implies the old
condition and catches the shim too.

Phase 3 imports openai and anthropic, and installed them itself before
consolidation. It now shares the preamble's install, so it also gates on it.
Phase 2 drives the API with curl and deliberately does not.

Teardown killed by listening port, which finds nothing when Studio hangs during
startup and never binds. That is the exact case the health wait exists for, and
it left the process alive to collide with the next phase. Added a command-line
sweep scoped to a process naming both unsloth and studio, which cannot reach the
runner's own python from actions/setup-python.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant