Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

v0.60.207.0 ci(ubicloud): verify's typecheck runs warm from a buildinfo built while the VMs boot

garrytan3ab15f6ef5df
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 088e28a0d1..a8209a6c55 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,30 @@ credits are retained; no result has been reassigned to another provider. Origina
identifiers and attribution are available in the pre-removal Git revision
`6040075c6cb95be5881cc2e1b76ef7d71f4e5d29` (retained on 2026-09-23).
+## [0.60.207.0] - 2026-10-13
+
+**The Ubicloud gate's `verify` typecheck runs warm, so it no longer crosses the 120 s per-check cap on a loaded VM.** It crossed the cap at 121 s on two gates on 2026-10-13 (#6618, #6612), and both passed on rerun. The cause wasn't contention with test items: the VM that runs `verify` runs nothing else until verify is done. The cause was that every gate VM typechecked from scratch. `bun run typecheck` is `tsc --incremental` against `node_modules/.cache/gbrain-typecheck.tsbuildinfo`, and the checkout tarball never carries that file. A cold `tsc` takes 81 s on a 16-vCPU gate VM with nothing else running, so verify had 1.4x headroom before any host load. The cap is unchanged.
+
+### Itemized changes
+
+- **`scripts/ci-ubicloud.ts` + `scripts/ubicloud/typecheck-state.ts`:**
+ - When the verify lane runs, the orchestrator starts `bun run typecheck` on the local checkout (the same files it uploads) while the VMs boot, then uploads the resulting buildinfo to the control VM before `verify`.
+ - The local build takes 68-69 s cold on a 4-core runner and about 17 s warm. It overlaps VM setup (59-83 s), so it added 2 s to a cold start.
+ - tsc rereads every file and compares content hashes, so a buildinfo from another path, machine or tree changes only the time, never the result. A buildinfo that records type errors reports them again on the VM.
+ - The run log says whether verify's typecheck ran warm or cold, and why. The local build's output is in `logs/local-typecheck.log`.
+- **Docs:** `scripts/ubicloud/README.md` describes the upload. `docs/TESTING.md` no longer says CI never restores typecheck results; GitHub CI's verify job has restored them since #6056.
+- **Proof, on a 16-vCPU gate VM (`ci:ubicloud --lanes verify --vms 1`, then the gate's `bun run verify` with the cap lifted to measure):**
+
+ | Load | Cold typecheck | Warm typecheck |
+ | --- | --- | --- |
+ | typecheck alone | 81 s | 16 s |
+ | inside verify's 16-way pool (the gate's load) | 84 s | 18-19 s |
+ | + 8 busy loops | 87 s | 22 s |
+ | + 16 busy loops (a loaded host) | 126 s, 123 s, over the cap | 32 s, 31 s |
+
+ With the new code, the gate's own verify step logged `local incremental typecheck (exit 0, 69s) uploaded …; verify's typecheck runs warm`, and its typecheck took 19 s. `check:test-isolation` (61-78 s) is now verify's longest check.
+- **`test/scripts/ubicloud-typecheck-state.test.ts`** pins that the uploaded file is the one the repo's typecheck script writes, and that building it reports the script's exit code even when the typecheck fails.
+
## [0.60.206.0] - 2026-10-13
**CI's Playwright browser install stops on a real stall, finishes a slow download instead of restarting it, and usually skips the CDN.** On master .204 and .205, the `admin-browser` job was cancelled at its 12-minute job timeout. `bunx playwright install --with-deps chromium` crawled through the Chrome download, which Playwright's CDN was serving at about 250 KB/s. A plain per-attempt cap doesn't fix that. The first version of this PR used a 240 s cap and failed on its own CI: the download was still moving (10%, then 30%), and Playwright doesn't resume downloads, so each retry started over from 0%. The second version failed too: its single attempt was still downloading when the 480 s budget ran out, after `apt-get update` alone took 4 minutes at 54 kB/s. So a stall now means silence, the whole step has one time budget sized to the job, only the headless shell the suite uses is downloaded, and the downloaded browser is cached. The bounded-run logic from #6594 is now one shared script, and it ends a stalled attempt together with every process the attempt started.
diff --git a/VERSION b/VERSION
index f75b97b9a7..11b174d670 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.60.206.0
+0.60.207.0
diff --git a/docs/TESTING.md b/docs/TESTING.md
index f7d4a61084..90eba7860e 100644
--- a/docs/TESTING.md
+++ b/docs/TESTING.md
@@ -440,8 +440,8 @@ self-test" below).
`bun run typecheck` ([heap ceiling](operations/verify-and-nightly-e2e.md#typecheck-heap)) uses TypeScript's native incremental analysis in
`node_modules/.cache/gbrain-typecheck.tsbuildinfo`. Every invocation still runs
the compiler; source, root-file, configuration and dependency changes invalidate
-the affected analysis, and cached diagnostics remain failures. The cache is local
-and ignored by Git; CI does not restore prior typecheck results.
+the affected analysis, and cached diagnostics remain failures. CI restores it
+(#6056) and `ci:ubicloud` uploads it (scripts/ubicloud/README.md).
The local Docker runner isolates root and admin `node_modules`, plus the generated
admin bundle, in named volumes. Admin build dependencies, Vite's generated cache
diff --git a/scripts/ci-ubicloud.ts b/scripts/ci-ubicloud.ts
index c9754eccfe..572115b953 100755
--- a/scripts/ci-ubicloud.ts
+++ b/scripts/ci-ubicloud.ts
@@ -44,7 +44,7 @@
*/
import { spawnSync, type ChildProcess } from "node:child_process";
-import { appendFileSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
+import { appendFileSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
import { tmpdir } from "node:os";
import { dirname, join, resolve } from "node:path";
import {
@@ -62,6 +62,7 @@ import {
type WeightTable,
} from "./ubicloud/schedule.ts";
import { runScript, type RunScriptOpts } from "./ubicloud/run-script.ts";
+import { buildTypecheckState, typecheckBuildInfo } from "./ubicloud/typecheck-state.ts";
const ROOT = resolve(import.meta.dir, "..");
const RUNNER = join(ROOT, "scripts/ubicloud/ubi-runner.sh");
@@ -256,6 +257,14 @@ async function main() {
// ── Checkout tarball, packed once while the VMs boot ─────────────────────
const tarball = join(tmpdir(), `gbrain-ci-ubicloud-${process.pid}.tgz`);
const packed = runner(["pack", ROOT], { out: tarball, stdoutOnly: true });
+ // verify's typecheck runs warm from a buildinfo of this tree, built while the VMs boot (scripts/ubicloud/typecheck-state.ts).
+ const buildInfo = opts.lanes.has("verify") ? typecheckBuildInfo(ROOT) : null;
+ const typecheckState = buildInfo
+ ? buildTypecheckState(ROOT, join(runDir, "logs", "local-typecheck.log"), (child) => {
+ children.set(child, "typecheck");
+ child.once("close", () => children.delete(child));
+ })
+ : null;
// Faster create and SSH polling than the runner's interactive default.
process.env.UBI_POLL_SECONDS ??= "2";
@@ -392,6 +401,15 @@ async function main() {
const runControl = async (vm: Vm) => {
vm.control = true;
for (const step of control) {
+ if (step.lane === "verify" && typecheckState) {
+ const { code, ms } = await typecheckState;
+ const sent = existsSync(join(ROOT, buildInfo!))
+ ? await runner(["ssh", vm.name, `mkdir -p ${quote(dirname(`${REMOTE_DIR}/${buildInfo}`))} && cat > ${quote(`${REMOTE_DIR}/${buildInfo}`)}`], { input: join(ROOT, buildInfo!) })
+ : null;
+ log(sent?.code === 0
+ ? `typecheck state: local incremental typecheck (exit ${code}, ${Math.round(ms / 1000)}s) uploaded to ${vm.name}; verify's typecheck runs warm`
+ : `typecheck state: ${sent ? `upload to ${vm.name} failed (exit ${sent.code})` : `no ${buildInfo} after the local typecheck (exit ${code})`}; verify's typecheck runs cold`);
+ }
log(`control on ${vm.name}: ${step.lane}${step.files.length ? ` (${step.files.length} exclusive files, sequential)` : ""}`);
const { parsed, logPath } = await runBatch(vm, 1, step.lane, step.files);
const done = new Set(parsed.map((r) => r.file));
diff --git a/scripts/structural-suites.tsv b/scripts/structural-suites.tsv
index 17ebe8907e..b93f0adc1b 100644
--- a/scripts/structural-suites.tsv
+++ b/scripts/structural-suites.tsv
@@ -322,6 +322,7 @@ test/scripts/stress-plan.test.ts execution profiles 3 readFileSync
test/scripts/test-env-opt-ins-guard.test.ts check-test-env-opt-ins 5 readFileSync
test/scripts/test-shard.slow.test.ts test-shard.sh — LPT balance contract 5 readFileSync
test/scripts/test-shard.slow.test.ts test-shard.sh — exclusion contract 7 readFileSync
+test/scripts/ubicloud-typecheck-state.test.ts (file-level) 2 readFileSync
test/search/graph-signals-wire-integration.test.ts v0.40.4 — source-grep regression guard 1 source-surface-helper
test/serve-behavior-notice-6543.test.ts (file-level) 3 readFileSync
test/serve-http-admin-route-guard.test.ts (file-level) 6 readFileSync
diff --git a/scripts/ubicloud/README.md b/scripts/ubicloud/README.md
index e4f475ae07..99c8e35eeb 100644
--- a/scripts/ubicloud/README.md
+++ b/scripts/ubicloud/README.md
@@ -86,7 +86,15 @@ 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
-it joins the pool. Items run through the `ci:local` wrappers
+it joins the pool. Before `verify`, it uploads the incremental typecheck state
+(`node_modules/.cache/gbrain-typecheck.tsbuildinfo`, which the checkout
+tarball never carries). The orchestrator builds that state with
+`bun run typecheck` on the local checkout while the VMs boot
+(`scripts/ubicloud/typecheck-state.ts`). Cold, verify's typecheck took 81-84 s
+on a 16-vCPU VM and crossed the 120 s per-check cap on a loaded host; warm, it
+takes 16-19 s. tsc revalidates every file by content hash, so the state never
+changes the result. The run log says whether verify's typecheck ran warm or
+cold, and the local build's output is in `logs/local-typecheck.log`. Items run through the `ci:local` wrappers
(`scripts/ubicloud/ci-item.sh`): `run-unit-shard.sh`, `run-serial-tests.sh` and
`run-slow-tests.sh` accept explicit file arguments for this purpose, and
`run-e2e.sh` runs each E2E file against its slot's own server and pooler. The
diff --git a/scripts/ubicloud/typecheck-state.ts b/scripts/ubicloud/typecheck-state.ts
new file mode 100644
index 0000000000..d1cd84f22c
--- /dev/null
+++ b/scripts/ubicloud/typecheck-state.ts
@@ -0,0 +1,41 @@
+/**
+ * scripts/ubicloud/typecheck-state.ts — the incremental typecheck state the
+ * gate hands to the VM that runs verify.
+ *
+ * `bun run typecheck` is `tsc --incremental` against a buildinfo under
+ * node_modules/.cache, which the checkout tarball never carries, so every gate
+ * VM typechecked cold: ~81 s on a 16-vCPU VM with nothing else running, and
+ * 123-126 s, past verify's 120 s per-check cap, beside verify's own pool on a
+ * loaded host. The orchestrator builds the buildinfo locally while the VMs
+ * boot (68 s cold on a 4-core runner, ~17 s warm) and uploads it before
+ * verify. tsc rereads every file and compares content hashes, so a stale or
+ * foreign buildinfo costs time, never correctness; type errors are recorded
+ * in it and reported again on the VM.
+ */
+
+import { spawn, type ChildProcess } from "node:child_process";
+import { closeSync, openSync, readFileSync } from "node:fs";
+import { join } from "node:path";
+
+/** The buildinfo path `bun run typecheck` writes, relative to the checkout, or null when it writes none. */
+export function typecheckBuildInfo(root: string): string | null {
+ try {
+ const script = (JSON.parse(readFileSync(join(root, "package.json"), "utf8")) as { scripts?: Record<string, string> }).scripts?.typecheck;
+ return script?.match(/--tsBuildInfoFile\s+(\S+)/)?.[1] ?? null;
+ } catch {
+ return null;
+ }
+}
+
+/** Run `bun run typecheck` in `root`, output to `logPath`; resolves with its exit code and duration. */
+export function buildTypecheckState(root: string, logPath: string, onSpawn: (child: ChildProcess) => void): Promise<{ code: number; ms: number }> {
+ const started = Date.now();
+ const fd = openSync(logPath, "w");
+ const child = spawn(process.execPath, ["run", "typecheck"], { cwd: root, stdio: ["ignore", fd, fd] });
+ closeSync(fd);
+ onSpawn(child);
+ return new Promise((done) => {
+ child.once("error", () => done({ code: 127, ms: Date.now() - started }));
+ child.once("close", (code) => done({ code: code ?? 1, ms: Date.now() - started }));
+ });
+}
diff --git a/test/scripts/ubicloud-typecheck-state.test.ts b/test/scripts/ubicloud-typecheck-state.test.ts
new file mode 100644
index 0000000000..96e444df1e
--- /dev/null
+++ b/test/scripts/ubicloud-typecheck-state.test.ts
@@ -0,0 +1,39 @@
+/**
+ * scripts/ubicloud/typecheck-state.ts: the gate uploads the buildinfo that
+ * `bun run typecheck` itself writes, built from the gate's own checkout, so
+ * verify's typecheck on the VM runs incrementally instead of cold.
+ */
+import { afterEach, expect, test } from 'bun:test';
+import { existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
+import { tmpdir } from 'node:os';
+import { join, resolve } from 'node:path';
+import { buildTypecheckState, typecheckBuildInfo } from '../../scripts/ubicloud/typecheck-state.ts';
+
+const ROOT = resolve(import.meta.dir, '..', '..');
+const dirs: string[] = [];
+afterEach(() => { for (const dir of dirs.splice(0)) rmSync(dir, { recursive: true, force: true }); });
+const scratch = (pkg: unknown) => {
+ const dir = mkdtempSync(join(tmpdir(), 'gbrain-typecheck-state-'));
+ dirs.push(dir);
+ writeFileSync(join(dir, 'package.json'), JSON.stringify(pkg));
+ return dir;
+};
+
+test("the buildinfo is the one the repo's typecheck script writes", () => {
+ const script = (JSON.parse(readFileSync(join(ROOT, 'package.json'), 'utf8')) as { scripts: Record<string, string> }).scripts.typecheck!;
+ expect(script).toContain('--incremental');
+ expect(typecheckBuildInfo(ROOT)).toBe('node_modules/.cache/gbrain-typecheck.tsbuildinfo');
+ expect(typecheckBuildInfo(scratch({ scripts: { typecheck: 'tsc --noEmit' } }))).toBeNull();
+ expect(typecheckBuildInfo(scratch({}))).toBeNull();
+ expect(typecheckBuildInfo(join(tmpdir(), 'gbrain-no-such-checkout'))).toBeNull();
+});
+
+test('building the state runs the typecheck script and reports its exit code, even when it fails', async () => {
+ const dir = scratch({ scripts: { typecheck: `echo checked > out.txt && exit 3` } });
+ const spawned: number[] = [];
+ const result = await buildTypecheckState(dir, join(dir, 'log.txt'), child => spawned.push(child.pid ?? -1));
+ expect(result.code).toBe(3);
+ expect(spawned).toHaveLength(1);
+ expect(readFileSync(join(dir, 'out.txt'), 'utf8')).toBe('checked\n');
+ expect(existsSync(join(dir, 'log.txt'))).toBe(true);
+});