Skip to content

ci: give pushes to main self-hosted runners of their own - #1906

Merged
devswha merged 2 commits into
mainfrom
ci/main-priority-runner
Oct 24, 2026
Merged

devswha merged 2 commits into
mainfrom
ci/main-priority-runner

Conversation

@devswha

@devswha devswha commented Oct 24, 2026 •

Copy link
Copy Markdown
Owner

What this does

Gives pushes to main self-hosted runners of their own, so a merge's CI stops queueing behind pull request runs on the P620.

  • scripts/self-hosted-runner/run.sh --reserved N registers the first N of its --count slots with --reserved-labels (default self-hosted-ovis-main) instead of --labels. It is still one launcher with one network namespace, so the reserved slots share check.ts's slots (CHECK_HOST_MAX_RUNS) with the others. The reserve takes runners away from PRs, not extra load. A --reserved that is not a whole number up to --count is refused before anything starts, and that includes a number long enough to wrap around in shell arithmetic.
  • scripts/ci-runner-route.sh (Detect changes in ci.yml): for a push of refs/heads/main, the repository variable CI_MAIN_SELF_HOSTED_LABELS takes precedence over CI_SELF_HOSTED_LABELS when it is set.
    • ["self-hosted","self-hosted-ovis-main"] sends main to the reserved slots.
    • "ubuntu-24.04" keeps only main GitHub-hosted.
    • Deleting the variable puts main back on the shared runners, exactly as before this PR.
    • Nothing else reads the variable: same-repo PRs, fork PRs, dispatches, workflow_call from release.yml/pages.yml, and pushes of other refs.
    • CI_SELF_HOSTED_LABELS='"ubuntu-24.04"' still keeps every job hosted.
    • A malformed value fails Detect changes, as the other variable does.
  • README, docs/development.md and a changelog fragment document the flip. A job waits for a runner with every label it asks for, and the maintainer PC's fallback unit has no reserved slots. So when the P620 goes offline, also gh variable delete CI_MAIN_SELF_HOSTED_LABELS, or main's Linux jobs wait.

Why

The merge pass checks main's CI after each merge batch. Main's run waited behind about 10 PR runs for the same P620 runners, so merges crawled.

Before this change (12 P620 runners, 5 slots), main push runs took 13.8 to 88 minutes from creation to completion: 13.8, 17.3, 18.4, 19.3, 22.1, 35.8, 43.6 and 88 minutes. Main's Linux jobs waited 2-649 s for a runner. On top of that, the integration and browser jobs waited 6-242 s for a check.ts slot.

At 01:00 KST, run 40106555178 had been queued for 45 minutes. It waited 19 minutes behind the previous main run in the concurrency group, and its three heavy jobs then sat queued for runners while the P620 was cut from 12 to 8 runners.

Runner side and rollout

From 00:56 to 01:58 KST the P620 ran --count 8 --reserved 2, which is how the dispatch run below was checked. But until this PR merges, main's ci.yml still asks for self-hosted-ovis, so the idle reserved pair took capacity from main as well as from PRs and main's CI stalled. The P620 is back to --count 8 --reserved 0 (eight shared runners), and CI_MAIN_SELF_HOSTED_LABELS is deleted, so merging this changes no routing by itself.

After the merge, the variable is set to ["self-hosted","self-hosted-ovis-main"] and the P620 restarts with --reserved 2 in one step. The next push to main is then checked to start its Linux jobs on P620-1/P620-2.

Not covered

Main's herdr-backed jobs still share the P620's 3 check.ts slots with PR jobs, so they can wait there for one. Giving a main run priority in slot admission would be a check.ts change and is left as a follow-up.

Two runners for main's four Linux jobs means Fast checks and one slot job start first, and the other two follow.

Verification

  • bun test scripts/ci-runner-route.test.ts scripts/self-hosted-runner.test.ts: 32 pass. The 6 new cases each fail under their mutation:
    • drop the main branch;
    • drop the ref check;
    • give every slot --labels;
    • drop the --reserved ≤ --count check;
    • drop the digit bound.
  • bun run check fast passes: typecheck, build and 6416 unit tests, report verified on 351af69.
  • P620 with --reserved 2 (00:56-01:58 KST): the runners API listed 8 online P620 runners, 2 self-hosted-ovis-main and 6 self-hosted-ovis, and no PR job started on the reserved pair.
  • A manual CI run on this branch with self_hosted_labels=["self-hosted","self-hosted-ovis-main"]: run 40109536147 passed. All four Linux jobs ran on the reserved runners and none on the six PR runners: both Browser jobs started on P620-1 and P620-2 within 2 s, and Fast checks and Integration waited 344 s and 491 s for one of those two to free up instead of taking a PR runner.

Review

This changes runs-on routing in a workflow and the self-hosted runner launcher, so it needs a real review before merging.

  • omo-native-code-reviewer: APPROVE, with four doc nits.
    • Three were fixed: a bare ["self-hosted"] in CI_SELF_HOSTED_LABELS would let PRs onto reserved slots, the "P620 runs eight" wording was stale, and the docs now say which host has reserved slots.
    • One was kept: the P620 paragraph documents the unit line this PR changes.
  • Codex (gpt-6.1-sol, high): three findings.
    1. A manual dispatch can name the reserved labels. Kept as is. self_hosted_labels is a write-access-only override for one run, and it is how this PR was checked on the reserved runners. The README now says so.
    2. The dispatch input overrides CI_SELF_HOSTED_LABELS='"ubuntu-24.04"'. Pre-existing and intended: ci-runner-route.test.ts requires it. Unchanged.
    3. A 2^64 --reserved wrapped to 0. Fixed, and the test covers it.

mp added 2 commits October 25, 2026 00:56
run.sh --reserved N registers the first N of its --count slots with
--reserved-labels (default self-hosted-ovis-main) instead of --labels.
They stay in the launcher's network namespace, so they share check.ts's
slots with the other runners: the reserve takes runners, not load.
A --reserved that is not a whole number up to --count (or is long enough
to wrap in shell arithmetic) is refused before anything starts.
A push to main takes the repository variable CI_MAIN_SELF_HOSTED_LABELS
over CI_SELF_HOSTED_LABELS when it is set, so main's Linux jobs can run on
runners pull requests never take (run.sh --reserved) instead of queueing
behind their runs. "ubuntu-24.04" there keeps only main hosted; deleting
it puts main back on the shared runners. CI_SELF_HOSTED_LABELS set to
"ubuntu-24.04" still keeps every job hosted, and no other event reads it.
@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 3346b03 and 351af69.

Files selected for processing: 8
  • .github/workflows/ci.yml
  • changelog.d/ci-main-runners.md
  • docs/development.md
  • scripts/ci-runner-route.sh
  • scripts/ci-runner-route.test.ts
  • scripts/self-hosted-runner.test.ts
  • scripts/self-hosted-runner/README.md
  • scripts/self-hosted-runner/run.sh

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

📝 Summary

Summary by CodeRabbit

  • New Features
    • Linux CI jobs triggered by pushes to main can use separately configured self-hosted runners, with an option to keep those jobs on hosted runners.
    • Self-hosted runner setups can reserve a configurable number of slots for main pushes while remaining slots use the regular labels.
  • Documentation
    • Updated runner setup guidance with configuration examples and notes on runner availability and slot selection.
  • Tests
    • Added coverage for runner routing, reserved slots, and invalid configuration values.

The runner launcher now supports reserved slots with separate labels. Linux CI passes the current Git ref and a main-specific label setting to the routing script, which can use that setting for pushes to main.

Changes: Main-push runner routing

Layer / File(s) Summary
Reserved runner slots
scripts/self-hosted-runner/run.sh, scripts/self-hosted-runner.test.ts, scripts/self-hosted-runner/README.md
The launcher supports reserved slots with configurable labels and validates the reserved count. Tests cover label assignment and invalid counts. Documentation describes the reserved-slot configuration and updates the P620 runner configuration.
Main-push CI routing
scripts/ci-runner-route.sh, .github/workflows/ci.yml, scripts/ci-runner-route.test.ts, docs/development.md, changelog.d/ci-main-runners.md
The workflow passes the Git ref and CI_MAIN_SELF_HOSTED_LABELS to the routing script. For pushes to main, the script uses the main-specific setting when nonempty; tests cover overrides, fallback, other events, and invalid values. Documentation describes the setting and its effects.

Priority: Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Possibly related PRs

  • devswha/ovis#1743: Established the existing runner-label routing contract that this change extends for main pushes.
Merge Risk: Minimal · up to 351af

No actionable merge-blocking issue remains; the change is ready for normal checks and merge.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 4 files. (4 skipped: 4 … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: dedicated self-hosted runners for pushes to main.
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.
Description check Passed The description clearly explains the change, motivation, rollout, limitations, and validation results. It does not use the required "## Change" and "## Validation" headings and does not link an issue …
Full details: Description check

Explanation

The description clearly explains the change, motivation, rollout, limitations, and validation results. It does not use the required "## Change" and "## Validation" headings and does not link an issue where a maintainer approved this feature, but the required information is otherwise present.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 4 files. (4 skipped: 4 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 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

Comment @coderabbitai help to get the list of available commands.

@devswha

devswha commented Oct 24, 2026

Copy link
Copy Markdown
Owner Author

Merge pass review-work report. Overall: PASSED. CodeRabbit did not review this workflow PR (rate-limited); the gate review below stands in for it.

Lane Verdict Confidence
Manual QA (artifacts kept) PASS -
Gate review (another model; programming + remove-ai-slops applied directly) REJECT on one point, resolved below HIGH

QA

Gate

  • Routing: only a push of refs/heads/main reads CI_MAIN_SELF_HOSTED_LABELS.
    • Fork PRs stay GitHub-hosted.
    • Same-repo PRs, pushes of other refs and workflow_call keep CI_SELF_HOSTED_LABELS.
    • A malformed value fails Detect changes.
    • Deleting the variable restores the old routing, as documented.
  • --reserved validation: 0, N = count, N > count, negative, huge and non-numeric values all behave as the PR states. Without --reserved the default is unchanged.
  • The one point raised: a workflow_dispatch that names self-hosted-ovis-main in its self_hosted_labels input lands on the reserved runners. The gate held on this only because the merge pass's brief said no dispatch should. That rule was too strict:
    • The self_hosted_labels dispatch input already exists on main and can already name any self-hosted labels.
    • Only users with write access can dispatch.
    • So this is the existing maintainer override with one more label it can name, and it is how the proof run 40109536147 reached P620-1/2 in 2 s.
    • Untrusted code (fork PRs) can't reach the reserved runners.
    • The merge pass accepts this. The only cost is that a manual dispatch can briefly take main's reserved slots.

All required checks are green and no review thread is open.

@devswha
devswha merged commit 5761411 into main Oct 24, 2026
26 of 28 checks passed
@devswha
devswha deleted the ci/main-priority-runner branch October 24, 2026 17:44
@devswha

devswha commented Oct 24, 2026

Copy link
Copy Markdown
Owner Author

Merge pass: merged as 5761411. For the ci-main-priority lane: main pushes now read CI_MAIN_SELF_HOSTED_LABELS. Please re-reserve P620-1/2 (--reserved 2) and set the variable to ["self-hosted","self-hosted-ovis-main"], as agreed. If the P620 goes offline, delete the variable.

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