Skip to content

ci(pages): the whole Pages run is GitHub-hosted and restores no cache - #4008

Open
devswha wants to merge 1 commit into
mainfrom
ci/pages-run-hosted-only
Open

devswha wants to merge 1 commit into
mainfrom
ci/pages-run-hosted-only

Conversation

@devswha

@devswha devswha commented Nov 17, 2026

Copy link
Copy Markdown
Owner

What

The Pages run is GitHub-hosted as a whole and restores no Actions cache, and a job that holds a write
permission, an environment or a secret never names a runner that is not GitHub-hosted.

  • pages.yml: build, current and deploy run on ubuntu-24.04; build installs without a cache
    (setup-ci's new cache: none).
  • pages.yml's manual validation calls ci.yml with a new workflow_call input, hosted_only: true.
    With it, every ci.yml job takes a hosted label (a prefix on its runs-on, and a first branch in
    scripts/ci-runner-route.sh), and its caches are off (setup-ci cache: none; the hc and Playwright
    cache steps skipped). ci.yml's own runs (push, pull request, manual) and its other callers
    (release validation, relay deploy) leave the input unset and run exactly as before.
  • release.yml publish and shell-attach, windows-app.yml attach and mac-dmg.yml gate name
    ubuntu-24.04 literally. With CI_SELF_HOSTED_LABELS unset they already ran there; now that
    variable can never move them.

A hosted label is a boundary as observed, not as documented: a job that asks only for ubuntu-24.04
or ubuntu-latest ran on GitHub's own runners even while a self-registered runner carrying that label
was online and idle (a trial on 2026-11-17, 14 of 14 jobs); GitHub's documentation does not state it.

pages.yml does not run for pull requests, so this pull request's checks do not exercise the Pages
path; it first runs on main after the merge.

The release and the other publishers (desktop, pty-sidecar, remote-bundles, windows-app, mac-dmg,
beta, relay-deploy, shell-preview) follow in a second pull request.

Why

Anyone who holds a runner registration token can register a self-hosted runner under any label, and
that runner then takes the jobs that ask for the label, with the run's token:

  • every job of a run can write that run's artifacts, add one or replace one, whether or not it
    declares an upload step; actions/deploy-pages takes the run's github-pages artifact by its
    name, so any job of the Pages run could supply the site it publishes, which serves the install
    scripts;
  • any job of a main run can write an Actions cache under any key that later runs restore, so a job
    that restores a cache can run code a self-registered runner planted.

Today the Pages build, current and deploy take the light runner expression, which a push to main
resolves to CI_MAIN_SELF_HOSTED_LABELS (self-hosted labels), and a manual Pages run's validation
runs ci.yml's light jobs self-hosted even with every variable unset.

Run Jobs Before After
after main's CI (workflow_run) build, current, deploy self-hosted on main ubuntu-24.04, no cache
manual the same, plus ci.yml under validate light jobs self-hosted; the rest hosted while CI_SELF_HOSTED_LABELS is unset; caches restored every job hosted, no cache

Nothing is lost: every ci.yml job already runs on GitHub's runners for a fork's pull request, and
the routed ones already ran hosted in this call. Hosted runs check more, not less (the self-hosted
runner skips a few unit tests); only the runners' seeded caches go.

How it is held

scripts/privileged-jobs-workflow.test.ts parses every workflow and holds two rules to exact forms. It
fails closed on any other form, whatever that form would evaluate to:

  • a job with a write permission, id-token: write, an environment or a secret (from the job, its
    workflow's env, secrets[...] or toJSON(secrets)) names a label from an explicit list of
    GitHub-hosted labels, or a matrix of them; ubuntu-99.99 and lookalikes are refused;
  • in a run that contains actions/deploy-pages:
    • every job of its workflow, and of each workflow it calls, names a listed label literally, or
      uses exactly ${{ inputs.hosted_only && '<listed label>' || ... }} in a workflow whose call
      passes hosted_only: true literally;
    • setup-ci has cache: none, or ${{ inputs.hosted_only && 'none' || ... }} under such a call;
    • actions/cache and actions/cache/restore steps have !inputs.hosted_only as a top-level &&
      term of their if (a term inside an || does not count), under such a call;
    • every action is a reviewed one at its exact reference (actions/checkout@3d3c42e... and so on;
      the same tag or another commit fails), and setup-ci's own steps are held the same way; its cache
      steps need inputs.cache == 'save' or 'restore' as a top-level && term of their condition, so
      none of them can run under cache: none.

The test reads runner labels, actions and their inputs. It does not inspect shell commands or scripts
for cache access. Its negative cases include the forms the reviews raised: a runner hosted only in a
workflow_run event's test context, one hosted only while a variable is set, cache steps gated on the
triggering run's conclusion, on a variable, on failure(), on a step output, or on an input the call
never sets.

That ci.yml's own runs are unchanged rests on two things. light-runner-workflow.test.ts pins, as
text, each prefixed expression's remainder to the exact expression main has (LIGHT, MAC, ROUTED,
ROUTED_FAST), each cache step's condition before && !inputs.hosted_only to main's condition, and
setup-ci's mode to main's; it also pins the exact set of places in ci.yml that read hosted_only, so a
new step gated on it fails. ci-runner-route.test.ts runs the route for every routing it covers and
finds byte-identical output with HOSTED_ONLY unset, empty or false, and ubuntu-24.04 with
true. The 1,296-context evaluation in the same test, which finds each prefixed expression equal to
main's for the input unset, null or false, holds by construction (false && x || y is y); it guards
the evaluator and the prefix's precedence, not ci.yml's content. release-ci-reuse.test.ts accepts
reads of hosted_only only in those exact expressions.

scripts/workflow-expression.ts evaluates GitHub expressions (the subset the workflows use, with
GitHub's loose equality: null == '', null == false are true). It is used only by
light-runner-workflow.test.ts, for the evaluation above, and by its own test; the Pages rule does not
evaluate anything.

The rule rests on one observed fact, stated in the README: a job that asks only for a hosted label
(ubuntu-24.04, ubuntu-latest) ran on GitHub's own runners even while a self-registered runner
carrying that label was online and idle; only a job that also asked for self-hosted reached it.
Observed by a trial on 2026-11-17 (14 of 14 jobs); not documented by GitHub.

Cost

  • Manual Pages run: about 15 to 17 minutes. Recent hosted CI runs (all Linux jobs on
    ubuntu-24.04, four browser shards) took 903 s and 933 s; the installs and Chromium downloads
    without a cache add about a minute, mostly inside the longest job.
  • Pages after main's CI: the build took a median 40 s on the self-hosted runners (44 runs,
    2026-11-15 to 2026-11-17), with no hosted run since at least 2026-11-10. Comparable hosted jobs
    with a cold install take about 47 s, so expect 45 to 60 s, plus 1 to 3 s of hosted queue for each
    of the three jobs. pages.yml does not run for a pull request; the first push to main after the
    merge gives the measured number.

Not in this pull request

The release and the other publishers (desktop, pty-sidecar, remote-bundles, windows-app, mac-dmg,
beta, relay-deploy, shell-preview): which job builds what they publish, which artifacts they take and
how, and their caches. A second pull request takes them.

Validation

  • bun test of the new and touched files: privileged-jobs-workflow, workflow-expression,
    light-runner-workflow, release-ci-reuse, ci-runner-route, ci-setup, pages-gate,
    hook-kill-tests-workflow, release-validate-workflow, relay-deploy-workflow, workflow-needs,
    shell-deploy-workflow, shell-preview-workflow, server-binary-workflow, pr-title,
    ci-concurrency, ci-browser-parallel: 429 pass, 0 fail.
  • Red before the change: against main's workflows, the new test names pages.yml deploy (privileged
    on the light expression) and the release-side jobs, and in the Pages run pages.yml build, current
    and deploy, and every ci.yml job whose runner or cache is not in a reviewed form. Mutations of this
    branch fail too: an allowed action at a tag, a step gated on toJSON(inputs.hosted_only) == 'false',
    a cache condition whose !inputs.hosted_only sits inside an ||, and a setup-ci cache step whose
    mode comparison sits behind an ||.
  • bun run check fast on this head: exit 0 on 288f81d (workflow syntax, generated types and themes, typecheck, build, unit: 18169 pass, 0 fail, 61 skip in 986 files).
  • Not run here: the Pages path itself (it runs only on main), and the hosted Windows and macOS jobs,
    which this pull request's own run covers.

… and keep privileged jobs off self-hosted labels

Anyone who holds a runner registration token can register a self-hosted runner under any label. Every
job of a run can write that run's artifacts with its own token, and actions/deploy-pages takes the
run's github-pages artifact by name; any job of a main run can write an Actions cache that later runs
restore. So the Pages run is GitHub-hosted and cacheless as a whole:

- pages.yml build, current and deploy run on ubuntu-24.04; build uses setup-ci's new cache: none.
- Its manual validation calls ci.yml with the new workflow_call input hosted_only: true: every ci.yml
  job then takes a hosted label (a prefix on its runs-on, and ci-runner-route.sh's first branch), and
  its caches are off (setup-ci cache: none, the hc and Playwright cache steps skipped). ci.yml's own
  runs and its other callers leave the input unset and run as before.
- release.yml publish and shell-attach, windows-app.yml attach and mac-dmg.yml gate name ubuntu-24.04
  literally; with CI_SELF_HOSTED_LABELS unset they already ran there.

scripts/privileged-jobs-workflow.test.ts holds two rules to exact forms and fails closed on any other:
a job with a write permission, an environment or a secret (workflow env, secrets[...] and
toJSON(secrets) included) names a label from an explicit list of GitHub-hosted labels; in a run with
actions/deploy-pages, every job names a listed label literally or the hosted_only prefix under a call
that passes hosted_only: true literally, setup-ci's cache and cache steps' conditions are off in a
reviewed form, and every action is a reviewed one at its exact reference. It reads runner labels,
actions and their inputs, not shell commands or scripts.

ci.yml's own runs keep their runners and caches: light-runner-workflow.test.ts pins the old
expressions, conditions and modes behind the prefix and the exact places that read hosted_only;
ci-runner-route.test.ts finds the route's output identical with the input unset or false.
scripts/workflow-expression.ts (GitHub's expression semantics, loose equality included) serves the
light-runner evaluation and has its own test.
@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Chores
    • CI workflows can now be run on GitHub-hosted runners without restoring or saving Actions caches.
    • Pages validation and deployment now use GitHub-hosted runners, with cache disabled.
    • Jobs handling release publishing or other privileged operations now run on GitHub-hosted runners.
  • Documentation
    • Updated development guidance to explain runner routing, cache behavior, and Pages validation and deployment requirements.

The reusable CI workflow adds a hosted_only option that selects GitHub-hosted runners and disables cache use. Pages and selected release, Windows, and macOS DMG jobs now use fixed hosted runners. Workflow tests and documentation cover the routing and cache rules.

Changes: Hosted CI execution

Layer / File(s) Summary
Hosted-only CI routing
.github/workflows/ci.yml, scripts/ci-runner-route.sh, scripts/ci-runner-route.test.ts, scripts/light-runner-workflow.test.ts, scripts/workflow-expression.ts, scripts/workflow-expression.test.ts
The callable CI workflow adds hosted_only, and runner selection uses hosted labels when it is true. Routing tests cover hosted-only calls and runner expressions. The workflow-expression evaluator and tests support expression checks.
Cache mode controls
.github/actions/setup-ci/action.yml, .github/workflows/ci.yml, .github/workflows/pages.yml, scripts/ci-setup.test.ts, scripts/light-runner-workflow.test.ts, scripts/release-validate-workflow.test.ts, scripts/shell-workflow-rules.ts, docs/development.md
The setup action adds cache: none, which disables Bun and Actions cache use. CI and Pages configure cache modes for hosted-only jobs. Tests check cache inputs and step conditions.
Fixed hosted runners and Pages workflow
.github/workflows/pages.yml, .github/workflows/mac-dmg.yml, .github/workflows/release.yml, .github/workflows/windows-app.yml, docs/development.md, scripts/self-hosted-runner/README.md
Pages jobs and selected release, Windows, and macOS DMG jobs use fixed GitHub-hosted runners. Documentation describes the runner assignments and Pages cache behavior.
Workflow policy checks
scripts/privileged-jobs-workflow.test.ts, scripts/release-ci-reuse.test.ts, scripts/shell-workflow-rules.ts
Workflow tests check runner labels, privilege rules, Pages-run cache conditions, and reviewed action references. Release workflow checks account for the new hosted-only expressions.

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Other

Possibly related PRs

  • devswha/ovis#2723: Changes CI_SELF_HOSTED_LABELS routing, which is also relevant to the runner selection changes in this PR.

Suggested labels: github_actions

Merge Risk: Minimal · up to 288f8

This change routes Pages and selected privileged jobs to GitHub-hosted runners and disables caching for those runs. No concrete merge-blocking defect remains; the Pages path will first run on main after merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the Pages run is GitHub-hosted and restores no cache. The changeset moves pages.yml jobs to ubuntu-24.04 and sets cache: none, and adds a hosted_only input to ci.yml f…
Description check Passed The description follows the repository template's Change and Validation sections. The Change section explains the problem (privileged jobs on self-hosted runners could read or write artifacts and cach…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: the Pages run is GitHub-hosted and restores no cache. The changeset moves pages.yml jobs to ubuntu-24.04 and sets cache: none, and adds a hosted_only input to ci.yml for manual validation. The title covers the primary intent. It omits the hardening of other privileged jobs, which is acceptable.

Full details: Description check

Explanation

The description follows the repository template's Change and Validation sections. The Change section explains the problem (privileged jobs on self-hosted runners could read or write artifacts and caches) and the resulting behavior. The Validation section lists bun test results, the bun run check fast result (exit 0 on 288f81d), and the checks not run (Pages path, hosted Windows and macOS jobs). The description is long and dense, but it covers the required information. It does not link a maintainer-agreed issue, which the template asks for on feature work. This is a fix/hardening change, so that gap is minor.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 192f55e and 288f81d.

Files selected for processing: 18

  • .github/actions/setup-ci/action.yml
  • .github/workflows/ci.yml
  • .github/workflows/mac-dmg.yml
  • .github/workflows/pages.yml
  • .github/workflows/release.yml
  • .github/workflows/windows-app.yml
  • docs/development.md
  • scripts/ci-runner-route.sh
  • scripts/ci-runner-route.test.ts
  • scripts/ci-setup.test.ts
  • scripts/light-runner-workflow.test.ts
  • scripts/privileged-jobs-workflow.test.ts
  • scripts/release-ci-reuse.test.ts
  • scripts/release-validate-workflow.test.ts
  • scripts/self-hosted-runner/README.md
  • scripts/shell-workflow-rules.ts
  • scripts/workflow-expression.test.ts
  • scripts/workflow-expression.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

This branch has not been deployed

No deployments
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