Repository navigation
CI: extract the POSIX local install into a composite action - #8015
Conversation
13 jobs across 8 workflows ran `install.sh --local --no-torch` with a byte-identical body. They now call one composite action. The point is not line count. Workflows lose 49 lines and the action adds about 60, so the diff is roughly neutral. The point is that the invocation went from 13 definitions to 1. Two things made that worth doing: the `set -o pipefail` + `tee` idiom is easy to get subtly wrong (without pipefail the step reports tee's exit status, not install.sh's, so a failed install passes green), and any change to the flags or the log path previously had to be applied to 13 places consistently. Composite actions cannot read the `secrets` context, so both tokens are explicit inputs each caller passes. That is deliberate rather than unavoidable boilerplate: it keeps the PR-withholding decision visible at the call site instead of hidden behind a default. Twelve callers withhold HF_TOKEN on pull_request, because the step runs checked-out PR code. The thirteenth, local-agent-guides-ci's `resume` job, passes it unconditionally. That is preserved rather than normalised, and it is correct: `resume` is gated on `github.event_name == 'workflow_dispatch'`, so it cannot run on a pull request and the withholding expression would be a no-op there. `id`, `if` and `timeout-minutes` stay on the caller's step, so the four `steps.install_unsloth.outcome` / `steps.install.outcome` gates in studio-mac-ui-smoke and studio-mac-inference-smoke keep working unchanged; those read the caller's step, not the action's internals. The Windows `install.ps1` path is a different script with a different body and stays separate. Verified with actionlint (no new findings; the remaining ones are pre-existing custom runner labels, publish-desktop-updater's `queue: max` and security-audit's empty `needs: []`), a check that every call site has actions/checkout before it, and an assertion-preservation diff: the set of test commands across all workflows is unchanged at 121.
GitHub evaluates expression syntax inside an action manifest, including inside the description strings, and neither the github nor the secrets context exists at manifest-parse time. The hf-token description spelled the PR-withholding conditional out in full as documentation, which the runner tried to evaluate and rejected: Unrecognized named-value: 'github'. Located at position 1 within expression: github.event_name != 'pull_request' && secrets.HF_TOKEN || '' That fails the whole action, so every caller's install step died. Staging CI caught it on the first workflow to reach the step. The description now says what the idiom is in prose and points at the call sites for the literal, and records why it must not be written out here so the next person does not helpfully add it back.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 24f9e2ad2d
ℹ️ 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".
| - name: Install Unsloth (--local, --no-torch) | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| uses: ./.github/actions/install-unsloth-local |
There was a problem hiding this comment.
Trigger callers when the shared action changes
For a pull request whose only changed file is .github/actions/install-unsloth-local/action.yml, this workflow is skipped because its pull_request.paths list does not include the new action; the same omission exists in all eight caller workflows. Consequently, changes to the now-centralized installer can merge without exercising any of its 13 call sites and can subsequently break every affected CI job. Add the shared action path to each caller's path filter.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Genuine, and a regression this PR introduces. Fixed in d12ea8a.
Verified the gap mechanically rather than by eye -- all eight callers, both trigger types:
local-agent-guides-ci pull_request paths=Y n=13 self=True action=False
local-agent-guides-ci push paths=Y n=13 self=True action=False
studio-api-smoke pull_request paths=Y n= 7 self=True action=False
studio-inference-smoke pull_request paths=Y n= 6 self=True action=False
studio-mac-inference-smoke pull_request paths=Y n= 6 self=True action=False
studio-mac-install-matrix pull_request paths=Y n= 5 self=True action=False
studio-mac-ui-smoke pull_request paths=Y n= 9 self=True action=False
studio-ui-smoke pull_request paths=Y n= 8 self=True action=False
studio-update-smoke pull_request paths=Y n= 9 self=True action=False
self=True on every row is what made this a regression rather than a pre-existing hole. The filters were already correct for the old layout: the install body lived inside the workflow file, so editing it tripped the workflow's own self-reference. Centralising the step moved that body out from under the filters without moving the filters, so the coverage was lost silently.
Fix adds the action to all nine filters, including the push filter on local-agent-guides-ci, which is the only caller that has one. Re-audit reports missing: 0, and actionlint is clean on all eight files.
Worth noting for anyone extending this: the same trap applies to the .github/scripts/ helpers, and the repo already handles it -- local-agent-guides-ci lists serve-unsloth-run.sh, assert-prompt-cache.sh and agent-guides-install.sh explicitly. This just brings the new action into the same convention. Tier 3b extends serve-unsloth-run.sh to more callers, and those filters will need the same treatment.
| description: >- | ||
| Hugging Face token, or the empty string to run unauthenticated. Callers | ||
| that reach this step on a `pull_request` event should withhold it with | ||
| `${{ github.event_name != 'pull_request' && secrets.HF_TOKEN || '' }}`, |
There was a problem hiding this comment.
Escape the expression in the input description
When the runner loads this local action, it parses the ${{ ... }} sequence as an Actions expression rather than documentation, but an input-description field does not provide the secrets expression context. The manifest therefore fails validation on secrets.HF_TOKEN before its composite steps can run, breaking all 13 callers; remove this example from the metadata or escape the expression syntax so it remains literal text.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Right diagnosis, already fixed -- this comment is against 24f9e2a, and 81e5272 landed before the review posted.
You called it exactly: expression syntax inside an action manifest is evaluated even in a description: string, and neither secrets nor github exists at manifest-parse time. It failed with Unrecognized named-value: 'github' on the github.event_name half before it ever reached secrets.HF_TOKEN.
I did not escape it, because a description that documents the idiom in escaped syntax is a description nobody can copy. The example is gone and the prose warns the next person off re-adding it:
Do not write that conditional out as a literal template expression here. GitHub evaluates expression syntax inside an action manifest, including inside these description strings [...]
The only remaining \${{ }} in the manifest are the two inputs.* references under runs:, which are the supported context there.
Every one of the eight callers filters on `paths:` and self-references its own file, so before this PR an edit to the install step re-ran the workflow that contained it. Centralising the step moved that body out of the workflow files, and none of the filters name the new action, so a PR touching only `.github/actions/install-unsloth-local/action.yml` would have skipped all eight and merged without exercising any of the 13 call sites. Add the action to each caller's filter, including the `push` filter in local-agent-guides-ci.yml, which is the only caller that has one.
|
@codex review |
|
Codex Review: Didn't find any major issues. Bravo. 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.
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.
13 jobs across 8 workflows ran
install.sh --local --no-torchwith a byte-identical body. They now call one composite action,.github/actions/install-unsloth-local.This is not a line-count win, and I want to be straight about that
Workflows lose 49 lines; the action adds about 60. The diff is roughly neutral. What changes is that the invocation went from 13 definitions to 1.
Two things make that worth doing:
set -o pipefail+teeidiom is easy to get subtly wrong. Withoutpipefailthe step reportstee's exit status rather thaninstall.sh's, so a failed install passes green. That is one line to get right in one place now, instead of 13 places that have to agree.This is also the first composite action in the repo. The existing sharing idiom is
.github/scripts/*.sh(19 helpers), which stays the right tool for pure shell. A composite action is used here specifically because this step's duplication includes non-run:keys — theenv:block carrying secrets — which a shell script cannot absorb.Tokens are inputs, deliberately
Composite actions cannot read the
secretscontext, so both tokens are explicit inputs each caller passes. That is a design choice rather than unavoidable boilerplate: it keeps the PR-withholding decision visible at the call site instead of hidden behind a default.The one caller that differs is correct
Twelve callers withhold
HF_TOKENonpull_request, because the step runs checked-out PR code and a hostile PR could exfiltrate it. The thirteenth,local-agent-guides-ci'sresumejob, passes it unconditionally.I preserved that rather than normalising it, and checked why before deciding:
resumeis gated ongithub.event_name == 'workflow_dispatch', so it cannot run on a pull request and the withholding expression would be a no-op there. Not a gap.Caller-side keys are untouched
id,ifandtimeout-minutesstay on the caller's step. They are step-level keys on theuses:step, so the four downstream gates keep working unchanged — they read the caller's step, not the action's internals:The Windows
install.ps1path is a different script with a different body and stays separate.Verification
macos-26/macos-15-intel/windows-11-armcustom runner labels,publish-desktop-updater'squeue: max,security-audit's emptyneeds: []).actions/checkoutbefore it, which a local action requires. Checked mechanically, not by eye.