Repository navigation
Extract the API-only Studio boot into one script - #8029
Conversation
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Chef's kiss. 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". |
Twenty-one steps across eight workflows ran the same five-line body, varying only in port, log filename and the name of the environment variable the pid lands in. .github/scripts/boot-studio-api-only.sh takes those three as flags. Three parts of that body are easy to get subtly wrong, which is the argument for one definition rather than twenty-one: rm -rf, not `reset-password`. The boot only re-seeds a fresh .bootstrap_password when the auth directory is absent, so a caller that resets keeps the old password and the test authenticates against stale state. The pid has to reach $GITHUB_ENV, because the step that stops the server is a different step with a different shell. Both streams go to the log. The server writes startup diagnostics to stderr, so a redirect without 2>&1 leaves an empty log on exactly the failure someone needs it for. Not folded into serve-unsloth-run.sh, despite the plan saying so. That script boots `unsloth run --disable-tools` and its body is banner-key parsing and /v1/models resolution; these boot `unsloth studio --api-only` with auth wiped and no banner. The two share the word boot and nothing else, and each header now says which is which. Deliberately does not wait for health: the callers' waits differ, some polling /api/health and stopping while others go on to rotate the password and load a model in the same step. Left alone: three boots inside Playwright retry loops, which re-boot mid-loop and reassign the pid in the running shell, and three boot-briefly-and-kill steps that keep the pid in a local variable rather than $GITHUB_ENV. Each caller's paths filter gains the script, so an edit to it re-runs the workflows that call it -- the trap #8015 hit when the install body moved out from under those filters.
f348925 to
0da5b90
Compare
|
@codex review |
3 similar comments
|
@codex review |
|
@codex review |
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. 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". |
Twenty-one steps across eight workflows ran the same five-line body, varying only in three values.
.github/scripts/boot-studio-api-only.shtakes those as flags:--port,--log,--pid-var.becomes
105 lines of duplicated YAML down to 31.
Why this one is worth extracting
Three parts of that body are easy to get subtly wrong, and each failure is quiet:
rm -rf, notunsloth studio reset-password. The boot re-seeds a fresh.bootstrap_passwordonly when the auth directory is absent. A caller that "resets" instead keeps the old password, and the test then authenticates against stale state rather than the state it thinks it created.$GITHUB_ENV. The step that stops the server is a different step with a different shell, so$!alone dies with the step that made it.2>&1produces an empty log on exactly the failure a reader needs it for.One departure from the plan
The plan said to extend
.github/scripts/serve-unsloth-run.sh. That is the wrong home. It bootsunsloth run --disable-toolsand its entire body is banner API-key parsing and/v1/modelsresolution; these twenty-one bootunsloth studio --api-onlywith auth wiped and no banner at all. They share the word "boot" and nothing else. Each script's header now says which is which, so the next person does not have to work it out twice.The script also deliberately does not wait for health. The callers' waits differ: some poll
/api/healthand stop, others go straight on to rotate the bootstrap password and load a model in the same step. Folding the simple case in would leave the rest calling a helper that does half their work.Not converted
$GITHUB_ENVand never wipe auth. Converting those would change the pid contract for no gain.Verification
Every call site asks for exactly what its old inline body did. A checker reconstructs
(port, log, pid-var)from each pre-change body atorigin/mainand compares it to the arguments now passed: 21 call sites checked, 0 mismatches, 0 left unconverted.That check had to walk steps positionally. Keying on
(job, step name)looked right and was not: the consolidated workflows have two steps with the same name in the same job (phase 1 and phase 3), so a dict kept only the last and silently compared phase 1's call against phase 3's body, reporting two mismatches that did not exist.The background process still outlives the step. Moving the launch one shell level deeper is the one behavioural risk here, so it was tested rather than assumed, against a stub
unslothonPATHwithHOMEpointed at a scratch directory:shellcheckclean.actionlintreports nothing new across the eight workflows.Each caller's
paths:filter gains the script, so an edit to it re-runs the workflows that call it. That is the trap #8015 hit: centralising a body moves it out from under filters that only name the workflow file.