Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

docs: ubicloud README for burst sizing, overlapped setup, the opt-in image and slot findings; CHANGELOG entry

garrytana8a3234b44e2
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2a1797d687..c59544cb8d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,16 +12,30 @@ identifiers and attribution are available in the pre-removal Git revision
## [0.60.93.0] - 2026-10-06
-**The embedding-migration bad-flag test stops timing out in serial shard 3, and it now actually catches a CLI that opens the brain before rejecting a flag.**
+**The full Ubicloud test gate finishes in about five and a half minutes instead of ten to fifteen, and the embedding-migration bad-flag test stops timing out.**
-No user-facing behavior changes. A bad flag on `gbrain migrate embeddings` or `gbrain retrieval-upgrade` already exits 2 with an `unknown_flag` envelope before touching the brain, and it still does when another process holds the brain lock. For contributors and agents working on gbrain:
+No user-facing behavior changes. `bun run ci:ubicloud`, the full pre-ship gate for contributors and agents, now borrows more machines when the shared quota is free, gets each machine ready faster, and no longer waits on one nine-minute test file at the end. Every test still runs with the same assertions.
+| Full gate | Machines | Wall | Machine setup | End of the run |
+|---|---|---|---|---|
+| Before | 4 | 942 s | 80-85 s | one file still running (graduation-cli, 543 s) |
+| After | 8 | 359 s | 61-80 s | every slot busy to the end |
+| After | 10 | 326 s | 66-71 s | the last items of about 100 s finishing |
+
+### Itemized changes
+
+- **Burst sizing.** With no `--vms`, `ci:ubicloud` reads `scripts/ubicloud/ubi-runner.sh usage` and provisions as many `standard-16` VMs as fit under 448 of the project's 512 vCPUs, between the default 4 and a burst maximum of 10, and never more than the queued work can use. It logs the decision (`fleet: project VMs hold 192 vCPUs, ceiling 448: 10 VM(s) × 16 vCPUs (burst maximum 10)`) and falls back to 4 when the quota is busy or usage can't be read. `--vms N` still overrides. Ubicloud location capacity can still leave VMs `waiting for capacity`; the run continues on the VMs that started.
+- **Long-pole files split.** The files that ran past two and a half minutes are now files of about two minutes, with every test body unchanged and shared steps in helpers: `graduation-cli` (agent flow, topologies, the 1k-page history round trip, and zero-mutation polling split three ways by custody boundary), `graduation-crash-run-{1,2,3}` and `graduation-crash-rollback-{1,2}`, `graduation-clients` and `graduation-clients-serve`, `reconcile-crash-{unactivated,activated}-{1,2}.slow`, and `write-attribution-timeline-10k-postgres` (backend matrix). The GitHub Tier 1 graduation step, the selected-E2E exclusions, the per-file timeouts, persistence-validation, the nightly slow coverage lane, `test-shard.sh`, the stress plan and both weight maps name the new files.
+- **Faster VM setup.** The checkout is packed while VMs boot, and setup is streamed over SSH while the checkout uploads, so apt, the Bun and gitleaks downloads and the image pulls overlap it. apt skips fsync, man-db, needrestart and the translation, AppStream and command-not-found indexes, and installs `gcc` and `libc6-dev` (the native fault test compiles a shim) instead of `build-essential`. The tarball carries a `.git` with only what `HEAD` and `origin/master` reach: about 80 MB instead of 250 MB from a checkout that fetched every branch. Downloads retry, and database containers start only after apt, because a systemd reload during `docker run` failed containers.
+- **Prebaked image (opt-in).** `scripts/ubicloud/build-ci-image.sh` builds the `gbrain-ci` machine image with the apt packages and database images baked in; `--image gbrain-ci@latest` or `UBI_CI_IMAGE` boots it and cuts the setup script to about 18 s.
+- **Scheduler.** The VM running gitleaks, verify and the machine-exclusive serial files no longer counts toward heavy-item spreading or total slots. While it ran, it held every other VM to one item of a minute or more, so items of 100-120 s started two minutes late.
+- **Slots per VM stay at 8.** On eight VMs, 12 slots raised test compute 27% and finished in 353 s, against 359 s at 8 slots. 16 slots raised compute 52% and took 444 s. Neither caused a failure.
- **`test/migrate-embeddings-recovery-cli.serial.test.ts`** never had a hung child. Its matrix test ran 126 cold CLI starts and 126 in-process PGLite reopens, one after another, inside a single 180-second budget. That took 69 s on an idle 4-core machine and more than 180 s on a shared CI runner, where the runner killed whichever child was running at the deadline ("killed 1 dangling process"). Every control is still checked on both routes, now in-process through the same `parseGlobalFlags` and `migrationCliArgumentError` call the CLI entry makes. One real CLI process runs for each distinct rejection (14 per route), and the test takes 27 s instead of 69 s. Pinned to one core beside three other serial files, the old test hit its 180 s timeout and the new one passed in 135 s.
- **The test is stronger.** After each rejected run, it now requires the brain directory to be untouched (same size, mtime and ctime for every file), and it still compares the row snapshot once per route. It also runs a bad flag while the test itself holds the brain open. A mutation that opens the engine before validating the flags passed the old test, but it fails the new one on both checks.
## To take advantage of v0.60.93.0
-Nothing to do: this release changes a test only.
+Nothing to do: this release changes tests and CI tooling only. Agents running `bun run ci:ubicloud` get burst sizing automatically; pass `--vms 4` to keep the old fleet.
## [0.60.93.0] - 2026-10-06
diff --git a/scripts/ubicloud/README.md b/scripts/ubicloud/README.md
index 1c992d1e14..4e4fa21353 100644
--- a/scripts/ubicloud/README.md
+++ b/scripts/ubicloud/README.md
@@ -43,19 +43,45 @@ destroys your own VMs older than HOURS).
and vCPUs per owner across the project, which shows who holds the shared quota.
Each VM runs `scripts/ubicloud/setup-ci-vm.sh`: the pinned Bun from
-`docker-compose.ci.yml`, the runner container's test prerequisites plus Node,
-frozen dependencies, both PGLite snapshot fixtures, and one
+`docker-compose.ci.yml`, the runner container's test prerequisites plus Node
+and a C compiler, frozen dependencies, both PGLite snapshot fixtures, and one
`pgvector/pgvector:pg16` server fronted by a transaction-mode PgBouncer per
slot. Every slot's schema is bootstrapped with `setupLegacyEmbeddingDB()`, the
same step nightly full-corpus E2E workers run, so no E2E file depends on which
-file reaches a database first. Setup takes 70-90 seconds, including VM boot.
+file reaches a database first.
+
+Setup takes 60-80 seconds, including VM boot (about 25 seconds). The
+orchestrator packs the checkout while the VMs boot, then streams the setup
+script over SSH as soon as a VM answers, so apt, the Bun and gitleaks
+downloads and the image pulls run while the checkout is still uploading; the
+script waits for a marker file before the steps that need the checkout. apt
+skips fsync, man-db, needrestart and the translation, AppStream and
+command-not-found indexes. Database containers start only after apt finishes,
+because a package's systemd reload during `docker run` fails the container.
+The tarball carries a slim `.git` holding only what `HEAD` and `origin/master`
+reach, plus the branch, index and config, so a checkout that fetched many
+branches uploads about 80 MB instead of 250 MB. The critical path is now apt's
+package installs (about 23 seconds of dpkg work); downloads take two seconds.
+
+`scripts/ubicloud/build-ci-image.sh` builds the `gbrain-ci` machine image
+(apt packages and both database images baked in), and `--image
+gbrain-ci@latest` or `UBI_CI_IMAGE` boots it, which cuts the setup script from
+about 40 seconds to 18. It is opt-in until image boots prove as reliable as
+stock ones: on its first full gate five of eight VMs sat in `waiting for
+capacity`. Stock VMs hit the same wait later (six of ten in one burst), so
+`eu-central-h1` capacity, not just the quota, can shrink a fleet; the run
+then continues on the VMs that did start. Rebuild the image when the package
+list or images change; setup still pulls the floating image tags, so a stale
+image costs time, not correctness.
Scheduling is dynamic. Every unit, serial, slow and E2E file is one item in a
global queue ordered by weight, heaviest first. Each idle slot on any VM takes
the next item, so a slow VM or a mis-weighted file delays only the slot holding
it. Light items leave in same-lane batches to amortize SSH round trips, and the
batch target shrinks as the queue drains. Items of 60 seconds or more are the
-run's long poles, so they spread one per VM before any VM takes a second one.
+run's long poles, so they spread one per VM before any VM takes a second one;
+the VM running the machine-level items below counts only once it joins the
+pool.
The first VM to finish setup runs the
machine-level work first: gitleaks, `verify`, then the serial lane's
machine-exclusive files one at a time with nothing else on that VM. After that
@@ -76,26 +102,35 @@ when any item fails, an item never produces a result, or no VM becomes ready.
An item whose SSH batch dies without a result is retried once on any slot, and a
VM with three such infrastructure errors is retired.
-Defaults are four `standard-16` VMs (64 vCPUs) in `eu-central-h1` with 8 slots
-each, one per two vCPUs (`--vms`, `--size`, `--slots`, `--location`). The
-Ubicloud project's vCPU quota (256) is shared with pull-request CI, so the
-default leaves room for about two concurrent PR runs; the former default of
-ten VMs took 160 vCPUs and queued PR jobs for up to 28 minutes. In a
-multi-lane wave, each lane runs `ci:ubicloud:diff` or its targeted suites, and
-only the integrator runs the full gate; four lanes each running the full gate
-take 256 vCPUs, the whole quota. A VM that the
-quota refuses fails to provision and the run continues on the VMs that did
-start, so a busy project shrinks the fleet instead of failing. The runner
-prints the refusal (needed, used and maximum vCPUs) with the project's VMs
-and vCPUs per owner; used vCPUs beyond that table are other usage, such as
-managed GitHub runners. Pass `--vms 10`
-only when the quota is idle. Slow-lane items run `test/export-scale.slow.test.ts`
+The fleet is sized from the quota. Without `--vms`, the run reads
+`ubi-runner.sh usage` and takes as many `standard-16` VMs as fit under 448 of
+the project's 512 vCPUs, between the default of four (64 vCPUs) and the burst
+maximum of ten (160 vCPUs), and never more than the work can use (each slot
+needs at least two minutes of weighted work, so `--lanes gitleaks` gets one
+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 are
+headroom for the managed GitHub runners `usage` can't see. When usage can't
+be read, or the project is busy, the run takes the default. Slots default to
+one per two vCPUs (`--slots`); `--size` and `--location` pick the VM shape. In
+a multi-lane wave, each lane runs `ci:ubicloud:diff` or its targeted suites,
+and only the integrator runs the full gate. A VM that the quota refuses fails
+to provision and the run continues on the VMs that did start, so a busy
+project shrinks the fleet instead of failing. The runner prints the refusal
+(needed, used and maximum vCPUs) with the project's VMs and vCPUs per owner;
+used vCPUs beyond that table are other usage, such as managed GitHub runners. Slow-lane items run `test/export-scale.slow.test.ts`
at the pull-request scale (`GBRAIN_TEST_EXPORT_SCALE_PAGES=10001`). `--lanes` runs a
subset, `--keep` leaves the VMs up for debugging, and `--diff` follows
-`ci:local:diff` (a doc-only diff runs the doc checks and gitleaks alone). The corpus is roughly
-8,000 seconds of test compute at that density, so 80 slots finish everything
-but the longest files about two minutes after setup; more slots per VM add CPU
-contention that slows timing-sensitive files without shortening the run. Wall time is bounded
-by setup plus the longest single file,
-`test/reindex-markdown-persistence.slow.test.ts` (one test, about 230 seconds),
-so adding VMs past the default does not shorten a run.
+`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
+the heaviest-first queue keeps every slot busy almost to the end, so wall
+time is setup plus compute divided by slots. No single file runs much past
+three minutes: the former long poles are split into files of about two
+minutes (`graduation-cli*`, `graduation-crash-*`, `graduation-clients*`,
+`reconcile-crash-*.slow`, `write-attribution-timeline-10k-postgres`), and the
+longest 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.