Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

ci: make the .113 omni-build slot opt-in on main (USE_VPS_BUILD_RUNNER) (#16835)

Diego Rodrigues de Sa e Souzae62b4b71c5cf
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 9e4f8cf9c2..f230296f92 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -671,7 +671,7 @@ jobs:
# back to ubuntu-latest unless the PR head repo is this repository (push /
# dispatch events are own-origin by definition). Any failure path (VM down,
# var unset/false) also falls back to ubuntu-latest.
- runs-on: ${{ (vars.USE_VPS_RUNNER == 'true' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)) && fromJSON('["self-hosted","omni-build"]') || 'ubuntu-latest' }}
+ runs-on: ${{ (vars.USE_VPS_RUNNER == 'true' && vars.USE_VPS_BUILD_RUNNER == 'true' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)) && fromJSON('["self-hosted","omni-build"]') || 'ubuntu-latest' }}
needs: changes
# The .113 pool runs ONE next-build with room to spare and two at the edge: the
# box has 31 GB and a single next-build peaks at 14–16 GB RSS. On 2026-08-28
diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml
index 2d00eea44c..4afe5a4dfe 100644
--- a/.github/workflows/docker-publish.yml
+++ b/.github/workflows/docker-publish.yml
@@ -135,7 +135,7 @@ jobs:
# (run 33253576569). The same tree's arm64 webpack build on hosted ARM
# succeeded (run 33264823398). Dockerfile already documents webpack as the
# Docker escape hatch (OMNIROUTE_USE_TURBOPACK=0).
- runs-on: ${{ matrix.arch == 'amd64' && (vars.USE_VPS_RUNNER == 'true' && fromJSON('["self-hosted","omni-build"]') || 'ubuntu-24.04') || 'ubuntu-24.04-arm' }}
+ runs-on: ${{ matrix.arch == 'amd64' && (vars.USE_VPS_RUNNER == 'true' && vars.USE_VPS_BUILD_RUNNER == 'true' && fromJSON('["self-hosted","omni-build"]') || 'ubuntu-24.04') || 'ubuntu-24.04-arm' }}
# Share the 1-slot omni-build ceiling (#12048) with ci.yml `Build` /
# npm-publish. Same group as main's Build so a :next publish waits beside
# the artefact instead of sitting next to it. arm64 is hosted — its own
diff --git a/.github/workflows/nightly-release-green.yml b/.github/workflows/nightly-release-green.yml
index 596b84d012..7a770a2d2d 100644
--- a/.github/workflows/nightly-release-green.yml
+++ b/.github/workflows/nightly-release-green.yml
@@ -68,7 +68,7 @@ jobs:
# this runs on the dedicated VPS runner — clean env (no operator OMNIROUTE_API_KEY,
# no local noauth CLIs => zero machine-specific false positives) and no contention.
# Nightly cron normally finds the var false (VM off) and falls back to hosted.
- runs-on: ${{ (vars.USE_VPS_RUNNER == 'true' && fromJSON('["self-hosted","omni-build"]')) || 'ubuntu-latest' }}
+ runs-on: ${{ (vars.USE_VPS_RUNNER == 'true' && vars.USE_VPS_BUILD_RUNNER == 'true' && fromJSON('["self-hosted","omni-build"]')) || 'ubuntu-latest' }}
env:
JWT_SECRET: ci-nightly-secret-with-sufficient-length-for-validation
API_KEY_SECRET: ci-nightly-api-key-secret-long
@@ -243,7 +243,7 @@ jobs:
# On a push, only run for a push to main — a push to release/* is handled by
# release-green above. Schedule/dispatch always run (they also sweep main).
if: ${{ github.event_name != 'push' || github.ref_name == 'main' }}
- runs-on: ${{ (vars.USE_VPS_RUNNER == 'true' && fromJSON('["self-hosted","omni-build"]')) || 'ubuntu-latest' }}
+ runs-on: ${{ (vars.USE_VPS_RUNNER == 'true' && vars.USE_VPS_BUILD_RUNNER == 'true' && fromJSON('["self-hosted","omni-build"]')) || 'ubuntu-latest' }}
env:
JWT_SECRET: ci-nightly-secret-with-sufficient-length-for-validation
API_KEY_SECRET: ci-nightly-api-key-secret-long
diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml
index fddcff49cc..ca1d29a27c 100644
--- a/.github/workflows/npm-publish.yml
+++ b/.github/workflows/npm-publish.yml
@@ -63,7 +63,7 @@ jobs:
# mid-"Creating an optimized production build" while v3.8.48 had still fit in 16min.
# This job never runs on `pull_request`, so the fork-safety clause is always true here;
# it is kept verbatim so the expression stays greppable against ci.yml.
- runs-on: ${{ (vars.USE_VPS_RUNNER == 'true' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)) && fromJSON('["self-hosted","omni-build"]') || 'ubuntu-latest' }}
+ runs-on: ${{ (vars.USE_VPS_RUNNER == 'true' && vars.USE_VPS_BUILD_RUNNER == 'true' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)) && fromJSON('["self-hosted","omni-build"]') || 'ubuntu-latest' }}
outputs:
version: ${{ steps.resolve.outputs.version }}
tag: ${{ steps.resolve.outputs.tag }}
diff --git a/tests/unit/vps-build-runner-gate.test.ts b/tests/unit/vps-build-runner-gate.test.ts
new file mode 100644
index 0000000000..ad20670dd2
--- /dev/null
+++ b/tests/unit/vps-build-runner-gate.test.ts
@@ -0,0 +1,60 @@
+/**
+ * USE_VPS_BUILD_RUNNER — the opt-in for the .113 `omni-build` slot.
+ *
+ * Since 2026-10-06 every `Build` that landed on omniroute-113-5 died: `next-build` (Turbopack,
+ * Next 16.3.x) grew to 16–41 GB on the 32-core box and the guest OOM-killer took it
+ * (`CONSTRAINT_NONE`, the whole 47 GB VM — not the runner's MemoryMax). ~200 runs in a row,
+ * each one swap-thrashing for 17–90 min; the same build passes in 8–12 min on the 16 GB / 4-vCPU
+ * hosted runner (fork PRs). The slot is single (#12048), so every same-repo PR queued behind it
+ * for up to 12 h only to fail.
+ *
+ * `omni-build` therefore became opt-in: a job reaches it only when BOTH `USE_VPS_RUNNER` and
+ * `USE_VPS_BUILD_RUNNER` are 'true'. Unset (the default) = hosted fallback, so a parked or broken
+ * build box can never again stall publishes.
+ */
+import test from "node:test";
+import assert from "node:assert/strict";
+import fs from "node:fs";
+import path from "node:path";
+import { fileURLToPath } from "node:url";
+import { load } from "js-yaml";
+
+const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../..");
+const workflowDir = path.join(repoRoot, ".github/workflows");
+const GATE = /vars\.USE_VPS_BUILD_RUNNER == 'true'/;
+
+type Job = { "runs-on"?: unknown; if?: string };
+type Workflow = { jobs?: Record<string, Job> };
+
+function omniBuildJobs(): Array<{ id: string; runsOn: string }> {
+ const out: Array<{ id: string; runsOn: string }> = [];
+ for (const name of fs.readdirSync(workflowDir)) {
+ if (!/\.ya?ml$/.test(name)) continue;
+ const wf = load(fs.readFileSync(path.join(workflowDir, name), "utf8")) as Workflow;
+ for (const [job, def] of Object.entries(wf?.jobs ?? {})) {
+ const runsOn = typeof def?.["runs-on"] === "string" ? (def["runs-on"] as string) : "";
+ if (runsOn.includes("omni-build")) out.push({ id: `${name}:${job}`, runsOn });
+ }
+ }
+ return out;
+}
+
+test("every omni-build job is opt-in through USE_VPS_BUILD_RUNNER", () => {
+ const jobs = omniBuildJobs();
+ // Guard against a vacuous pass: these are the heavy jobs known on 2026-10-16.
+ for (const id of ["ci.yml:build", "docker-publish.yml:build", "npm-publish.yml:publish"]) {
+ assert.ok(
+ jobs.some((j) => j.id === id),
+ `${id} should still target omni-build`
+ );
+ }
+ const ungated = jobs.filter((j) => !GATE.test(j.runsOn)).map((j) => j.id);
+ assert.deepEqual(ungated, [], "these jobs would reach the .113 build slot without the opt-in");
+});
+
+test("every omni-build job keeps a hosted fallback", () => {
+ const noFallback = omniBuildJobs()
+ .filter((j) => !/\|\|\s*'ubuntu-[\w.-]+'/.test(j.runsOn))
+ .map((j) => j.id);
+ assert.deepEqual(noFallback, []);
+});