Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
ci(ubicloud): six slots per 16-vCPU gate VM (load p90 1.39 -> 0.95 per vCPU); every gate reports VM load and warns when oversubscribed
garrytaned8d75567186
diff --git a/scripts/ci-ubicloud.ts b/scripts/ci-ubicloud.tsindex 776ef0107d..b393b4113a 100755--- a/scripts/ci-ubicloud.ts+++ b/scripts/ci-ubicloud.ts@@ -10,7 +10,7 @@* --vms N VMs to provision in parallel (default: burst-sized from* `ubi-runner.sh usage`; 4 when the quota is busy)* --size SIZE Ubicloud size (default standard-16)- * --slots N concurrent work slots per VM (default: half of --size's vCPUs)+ * --slots N concurrent work slots per VM (default: three per eight of --size's vCPUs)* --location LOC Ubicloud location (default eu-central-h1). A full gate* runs only there; another location needs --lanes and* is a diagnostic run, never gate evidence@@ -158,10 +158,11 @@ function parseArgs(argv: string[]): Opts {if (opts.location !== GATE_LOCATION && !argv.includes("--lanes")) usage(`a full gate runs only in ${GATE_LOCATION}. Test timeouts and the mined shard weights are calibrated there; on 2026-10-19 us-east-a2 ran about half as fast and timed out tests that pass in ${GATE_LOCATION}, so a full run in ${opts.location} is not gate evidence. Wait for ${GATE_LOCATION} capacity or run bun run ci:local (and report it as local). To run a diagnostic subset in ${opts.location}, pass --lanes.`);if (!Number.isInteger(opts.ttlHours) || opts.ttlHours < 0 || opts.ttlHours > 8760) usage("--ttl-hours must be a whole number of hours from 0 (no expiry) to 8760");if (!Number.isInteger(opts.vms) || opts.vms < 0 || (opts.vms === 0 && argv.includes("--vms"))) usage("--vms must be a positive integer");- // One slot per two vCPUs: the whole corpus still fits inside the longest- // single file's runtime at the default fleet size, and the headroom keeps- // timing-sensitive files (and that longest file) from starving for CPU.- if (!opts.slots) opts.slots = Math.max(1, Math.round(vcpusOf(opts.size) / 2));+ // Three slots per eight vCPUs: each slot's bun process, its children and its+ // own PostgreSQL and PgBouncer keep about 2.5 threads runnable. One slot per+ // two vCPUs measured a 1-minute load of 1.11 per vCPU at p50 and 1.39 at p90+ // and timed out a file that passes at this density (0.79 p50, 0.95 p90).+ if (!opts.slots) opts.slots = Math.max(1, Math.floor((vcpusOf(opts.size) * 3) / 8));if (!Number.isInteger(opts.slots) || opts.slots < 1) usage("--slots must be a positive integer");return opts;}@@ -544,6 +545,12 @@ async function main() {const ready = vms.filter((vm) => vm.setupMs !== undefined);console.log(` VMs: ${ready.length}/${opts.vms} ready${ready.length ? `, setup ${Math.round(Math.min(...ready.map((v) => v.setupMs!)) / 1000)}-${Math.round(Math.max(...ready.map((v) => v.setupMs!)) / 1000)}s` : ""}`);console.log(` wall ${Math.round(wallMs / 1000)}s, ${Math.round(computeMs / 1000)}s of test compute`);+ const loads = all.flatMap((r) => (r.load === undefined ? [] : [r.load])).sort((a, b) => a - b);+ if (loads.length) {+ const at = (q: number) => loads[Math.min(loads.length - 1, Math.floor(q * loads.length))]!.toFixed(2);+ console.log(` VM load (1-minute load average per vCPU as each item ended, ${opts.slots} slots per VM): p50 ${at(0.5)}, p90 ${at(0.9)}, max ${at(1)}`);+ if (Number(at(0.9)) > 1.1) console.log(` WARNING: VMs ran oversubscribed (p90 ${at(0.9)} runnable per vCPU), so timing-sensitive tests ran slower than the weights and file caps assume. Lower --slots.`);+ }console.log(" slowest items:");for (const r of [...all].sort((a, b) => b.ms - a.ms).slice(0, 8)) console.log(` ${Math.round(r.ms / 1000)}s ${r.lane} ${r.file}`);diff --git a/scripts/ubicloud/README.md b/scripts/ubicloud/README.mdindex 5197a32835..6965b3e212 100644--- a/scripts/ubicloud/README.md+++ b/scripts/ubicloud/README.md@@ -179,7 +179,7 @@ VM). The decision is logged (`fleet: project VMs hold 192 vCPUs, ceiling 448:10 VM(s) × 16 vCPUs (burst maximum 10)`). The 64 vCPUs above the ceiling areheadroom for the managed GitHub runners `usage` can't see. When usage can'tbe read, or the project is busy, the run takes the default. Slots default to-one per two vCPUs (`--slots`); `--size` picks the VM shape. A full gate runs only in+three per eight vCPUs (`--slots`, six on a standard-16); `--size` picks the VM shape. A full gate runs only in`eu-central-h1` (the default `--location`): test timeouts and the mined shard weights are calibrated onits VMs, and on 2026-10-19 two full gates in `us-east-a2` ran about half as fast and timed out tests thatpass there. Another `--location` is refused unless `--lanes` names a diagnostic subset, whose summary@@ -192,15 +192,19 @@ at the pull-request scale (`GBRAIN_TEST_EXPORT_SCALE_PAGES=10001`). `--lanes` rusubset, `--keep` leaves the VMs up for debugging, and `--diff` follows`ci:local:diff` (a doc-only diff runs the doc checks and gitleaks alone).-A full gate is about 16,000 seconds of test compute at 8 slots per VM, and+A full gate is about 35,000 seconds of test compute at 6 slots per VM, andthe heaviest-first queue keeps every slot busy almost to the end, so walltime is setup plus compute divided by slots. No single file runs much pastthree minutes: the former long poles are split into files of about twominutes (`graduation-cli*`, `graduation-crash-*`, `graduation-clients*`,`reconcile-crash-*.slow`, `write-attribution-timeline-10k-postgres`), and thelongest single test left is the 1k-page graduation round trip (about 150-seconds). More slots per VM do not help: on eight VMs, 12 slots raised-compute 27% (unit 27%, E2E 25%, serial 31%) and finished in 353 seconds-against 359 at 8 slots, and 16 slots raised it 52% and took 444 seconds.-Neither produced a failure, but the extra contention buys no wall time, so 8-slots (one per two vCPUs) stays the default and bursts add VMs instead.+seconds). Slots are sized by load, not by vCPU count alone. Each slot's bun process, its child+processes and its own PostgreSQL and PgBouncer keep about 2.5 threads runnable, so on+2026-10-20 one slot per two vCPUs (8 on standard-16) measured a 1-minute load of 1.11 per+vCPU at p50 and 1.39 at p90, ran 45,565 s of test compute and timed out+`persistence-sync-options-parity` on its PgBouncer pass. Six slots on the same tree+measured 0.79 and 0.95, ran 35,393 s (22% less) and passed; at eight VMs that is about+the same wall time. Every gate prints this load line, and warns when p90 passes 1.1:+test timeouts, `run-e2e.sh`'s per-file cap and the mined shard weights assume a VM+that is not oversubscribed. More slots do not buy wall time; bursts add VMs instead.diff --git a/scripts/ubicloud/ci-item.sh b/scripts/ubicloud/ci-item.shindex 8ce392c268..7f852fcfd4 100755--- a/scripts/ubicloud/ci-item.sh+++ b/scripts/ubicloud/ci-item.sh@@ -18,6 +18,7 @@# Every item is bracketed by marker lines the orchestrator parses:# __ubi_item_begin__ <lane> <file># __ubi_item__ rc=<exit> ms=<duration> lane=<lane> file=<file>+# __ubi_load__ load1=<1-minute load average> vcpus=<nproc> (the VM's load as the item ended)set -uo pipefailcd "$(dirname "$0")/../.."@@ -78,4 +79,5 @@ for item in "${items[@]}"; dorun_item "$item" 2>&1rc=$?echo "__ubi_item__ rc=$rc ms=$(( $(date +%s%3N) - start )) lane=$lane file=$item"+ echo "__ubi_load__ load1=$(cut -d' ' -f1 /proc/loadavg) vcpus=$(nproc)"donediff --git a/scripts/ubicloud/schedule.ts b/scripts/ubicloud/schedule.tsindex f98413fa94..e970b64ad0 100644--- a/scripts/ubicloud/schedule.ts+++ b/scripts/ubicloud/schedule.ts@@ -101,6 +101,8 @@ export interface ItemResult {rc: number;ms: number;output: string;+ /** The VM's 1-minute load average per vCPU as the item ended (ci-item.sh's __ubi_load__ line). */+ load?: number;}/** Split a ci-item.sh log into per-item results using its marker lines. */@@ -118,6 +120,11 @@ export function parseItemLog(log: string): ItemResult[] {lines = [];continue;}+ const load = /^__ubi_load__ load1=([\d.]+) vcpus=(\d+)$/.exec(line);+ if (load && results.length) {+ results[results.length - 1]!.load = Number(load[1]) / Number(load[2]);+ continue;+ }lines.push(line);}return results;diff --git a/test/scripts/ci-ubicloud-schedule.test.ts b/test/scripts/ci-ubicloud-schedule.test.tsindex b3e07c0475..ec1826b770 100644--- a/test/scripts/ci-ubicloud-schedule.test.ts+++ b/test/scripts/ci-ubicloud-schedule.test.ts@@ -105,6 +105,22 @@ describe("parseItemLog", () => {{ lane: "unit", file: "test/b.test.ts", rc: 1, ms: 45, output: "b failed" },]);});++ it("attaches the VM load sampled after an item to that item, never to its output or the next item", () => {+ const log = [+ "__ubi_item_begin__ e2e test/e2e/a.test.ts",+ "a output",+ "__ubi_item__ rc=0 ms=120 lane=e2e file=test/e2e/a.test.ts",+ "__ubi_load__ load1=18.40 vcpus=16",+ "__ubi_item_begin__ e2e test/e2e/b.test.ts",+ "b output",+ "__ubi_item__ rc=0 ms=45 lane=e2e file=test/e2e/b.test.ts",+ ].join("\n");+ expect(parseItemLog(log)).toEqual([+ { lane: "e2e", file: "test/e2e/a.test.ts", rc: 0, ms: 120, output: "a output", load: 1.15 },+ { lane: "e2e", file: "test/e2e/b.test.ts", rc: 0, ms: 45, output: "b output" },+ ]);+ });});describe("burst fleet sizing", () => {