Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
Run the macOS typecheck through the same abort retry, and fix the coverage lane count
garrytanfc63c22e1c27
diff --git a/.github/workflows/macos-validation.yml b/.github/workflows/macos-validation.ymlindex 11e5d42d88..f9423f07bd 100644--- a/.github/workflows/macos-validation.yml+++ b/.github/workflows/macos-validation.yml@@ -129,12 +129,15 @@ jobs:# GST-2333: on Intel (4 cores, 14 GB). tsc on this tree peaks near 6.7 GB# resident; the 7 GB arm64 runner swapped, and a check from an older state# took 7 to 15 minutes (915 s hit the step cap, run 42813311634). Intel,- # cold: 234 s, 6.68 GB peak, no swap (run 42821135693).+ # cold: 234 s, 6.68 GB peak, no swap (run 42821135693). An attempt that+ # aborts (exit 134 or a signal: a run seeded from another head's state can+ # pass the heap cap) runs once more from cold (scripts/ci-typecheck.sh), so+ # the step and job allow two 15-minute attempts.if: |github.event_name != 'pull_request' ||contains(github.event.pull_request.labels.*.name, 'macos-validation')runs-on: macos-26-intel- timeout-minutes: 25+ timeout-minutes: 40steps:- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2@@ -152,13 +155,17 @@ jobs:key: tsbuildinfo-${{ runner.os }}-${{ hashFiles('bun.lock', 'tsconfig.json') }}-${{ github.sha }}restore-keys: |tsbuildinfo-${{ runner.os }}-${{ hashFiles('bun.lock', 'tsconfig.json') }}-- - name: Typecheck (tsc, incremental)- timeout-minutes: 15- run: bun run typecheck+ - name: Typecheck (tsc, incremental; cold once more on an abort)+ id: tsc+ timeout-minutes: 30+ env:+ GBRAIN_TYPECHECK_ATTEMPT_SECONDS: '900'+ run: bash scripts/ci-typecheck.sh bun run typecheck# Saved even when tsc finds type errors or another job fails: tsc- # writes its state on an error too, so the next run starts warm.+ # writes its state on an error too, so the next run starts warm. Not+ # saved when its last attempt aborted or timed out: it wrote no state.- name: Save the typecheck state- if: always()+ if: always() && steps.tsc.outputs.state_written == 'true'uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3with:path: node_modules/.cache/gbrain-typecheck.tsbuildinfodiff --git a/CHANGELOG.md b/CHANGELOG.mdindex 975fd6cf9c..9b2497ee1f 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -21,7 +21,7 @@ identifiers and attribution are available in the pre-removal Git revision- `scripts/bench/sync-freshness-gate.ts`: the Postgres managed serve-watch cell is now measured 3 times, and the gate uses the median of the three p50s, as the PGLite managed cell already did. The baseline and the 25% limit are unchanged. The cell's nightly p50 moves in steps of the 50 ms probe. Single runs at 656.5, 659.2 and 706.8 ms failed the 627 ms limit on 3 of 19 nightlies, and each passed when rerun on the same commit. A regression that slows every run still fails.- `scripts/ci-census-tests.sh`: the pull-request census job now also runs `test/scripts/run-unit-shard.test.ts` (1.5 s, no database). It reads every test file's per-test timeouts, so a bad timeout now fails the pull request instead of a later full run.- `scripts/sharding.ts`, `.github/workflows/test.yml`, `.github/workflows/e2e.yml`: the unit suite now splits into 30 shards instead of 28, run two per job (15 jobs), and the shard weights are refreshed from the median of five Test nightlies and the latest full E2E nightly. On the new weights 28 shards came to about 601 s each, over the 600 s per-shard budget; 30 shards come to about 561 s. Both coverage merges now expect shards 29 and 30.-- `scripts/ci-typecheck.sh`, `.github/workflows/test.yml`: when the typecheck job's tsc aborts without a type error (exit 134 or a signal, as when V8 hits the heap limit), the job deletes the restored `tsbuildinfo` and runs tsc once more from cold. A run seeded with a distant head's state could go past the heap cap where a cold run of the same tree fits, and because the aborted run saved that same state under its own head's key, every rerun failed the same way. A type error (exit 1 or 2) still fails at once with no retry, and a run whose tsc aborted or timed out no longer saves its state. `test/scripts/ci-typecheck.test.ts` pins the retry to aborts only.+- `scripts/ci-typecheck.sh`, `.github/workflows/test.yml`: when the typecheck job's tsc aborts without a type error (exit 134 or a signal, as when V8 hits the heap limit), the job deletes the restored `tsbuildinfo` and runs tsc once more from cold. A run seeded with a distant head's state could go past the heap cap where a cold run of the same tree fits, and because the aborted run saved that same state under its own head's key, every rerun failed the same way. A type error (exit 1 or 2) still fails at once with no retry, and a run whose tsc aborted or timed out no longer saves its state. `test/scripts/ci-typecheck.test.ts` pins the retry to aborts only. The macOS validation typecheck job (`.github/workflows/macos-validation.yml`) uses the same step, with two 15-minute attempts.- `scripts/postgres-unit-arms.ts`, `.github/workflows/persistence-validation.yml`: the PostgreSQL arms of unit-lane suites now run in 21 shards instead of 19. On current weights the largest shard planned at 554.6 s against its 570 s budget, so the next few arm files would have failed the budget test; at 21 it plans at 502.3 s. The budget and its assertion are unchanged.## [0.60.689.0] - 2026-11-12diff --git a/docs/TESTING.md b/docs/TESTING.mdindex 75470b4c5b..9ed8d71fd3 100644--- a/docs/TESTING.md+++ b/docs/TESTING.md@@ -1301,7 +1301,7 @@ normalizes `COVERAGE_DIR` to an absolute path before moving `HOME`, andcoverage lane). Both names avoid the `GBRAIN_` prefix so the env scrub keepsthem.-**Two corpora.** `prCorpus` is the 34 coverage-collecting lanes in+**Two corpora.** `prCorpus` is the 36 coverage-collecting lanes in`test.yml` (30 unit shards, 4 serial partitions, `slow-entity-resolve-perf` and`slow-brainbench-e2e`), identical on every PR; the gates run against it.`fullCorpus` is the nightly (or manual `full_corpus=true`) set in `e2e.yml`:diff --git a/scripts/ci-typecheck.sh b/scripts/ci-typecheck.shindex b149eb1a89..0f2ec23bf1 100755--- a/scripts/ci-typecheck.sh+++ b/scripts/ci-typecheck.sh@@ -1,6 +1,6 @@#!/usr/bin/env bash-# test.yml's typecheck step: run the incremental tsc, and if it aborts, run it-# once more from cold.+# The typecheck step of test.yml and macos-validation.yml: run the incremental+# tsc, and if it aborts, run it once more from cold.## Usage: scripts/ci-typecheck.sh <command>... (test.yml: bun run typecheck)#@@ -23,7 +23,8 @@# head's key would make every rerun restore it again.## GBRAIN_TYPECHECK_ATTEMPT_SECONDS bounds each attempt (default 360, the-# measured bound the step had before the retry).+# measured bound test.yml's step had before the retry), through timeout(1)+# or, on macOS, gtimeout. With neither, only the step's own timeout applies.set -uo pipefail[ "$#" -gt 0 ] || { echo "usage: scripts/ci-typecheck.sh <command>..." >&2; exit 64; }@@ -37,7 +38,12 @@ record() {return 0}-timeout "$SECONDS_PER_ATTEMPT" "$@"+LIMIT=()+if command -v timeout >/dev/null 2>&1; then LIMIT=(timeout "$SECONDS_PER_ATTEMPT")+elif command -v gtimeout >/dev/null 2>&1; then LIMIT=(gtimeout "$SECONDS_PER_ATTEMPT")+fi++${LIMIT[@]+"${LIMIT[@]}"} "$@"status=$?if [ "$status" -le 128 ]; thenrecord "$status"@@ -46,7 +52,7 @@ fiecho "::warning title=typecheck aborted::tsc ended by abort or signal (exit $status) without a type error; deleting $BUILDINFO and running it once more from cold"rm -f "$BUILDINFO"-timeout "$SECONDS_PER_ATTEMPT" "$@"+${LIMIT[@]+"${LIMIT[@]}"} "$@"status=$?record "$status"if [ "$status" -gt 128 ]; thendiff --git a/test/scripts/ci-gates.test.ts b/test/scripts/ci-gates.test.tsindex 7918d0f519..afd3496381 100644--- a/test/scripts/ci-gates.test.ts+++ b/test/scripts/ci-gates.test.ts@@ -78,17 +78,19 @@ describe('CI execution evidence', () => {expect(aggregate(unit, 'test-status', 'push', { typecheck: 'failure' })).toBe(1);});- test('macOS 26 validation typechecks in its own job, under a measured step timeout, saves its state on every outcome, and its verify skips tsc (#6056)', () => {+ test('macOS 26 validation typechecks in its own job, under a measured step timeout, saves its state whenever tsc finished, and its verify skips tsc (#6056)', () => {const mac = loadWorkflow('macos-validation.yml') as Workflow & { jobs: Record<string, Job & { 'runs-on'?: string }> };const job = mac.jobs.typecheck;expect(job['runs-on']).toBe('macos-26-intel');expect(job.if).toBe(mac.jobs['macos-26'].if);- const tsc = job.steps.find(step => step.run === 'bun run typecheck')!;- expect(tsc['timeout-minutes']).toBe(15);+ const tsc = job.steps.find(step => step.run === 'bash scripts/ci-typecheck.sh bun run typecheck')! as Job['steps'][number] & { id?: string };+ expect(tsc.id).toBe('tsc');+ expect(tsc['timeout-minutes']).toBe(30);+ expect(tsc.env?.GBRAIN_TYPECHECK_ATTEMPT_SECONDS).toBe('900');const restore = job.steps.find(step => step.uses?.startsWith('actions/cache/restore@') && step.with?.path === 'node_modules/.cache/gbrain-typecheck.tsbuildinfo')!;expect(restore.with!.key).toBe(unit.jobs.typecheck.steps.find(step => step.uses?.startsWith('actions/cache/restore@') && step.with?.path === restore.with!.path)!.with!.key);const save = job.steps.find(step => step.uses?.startsWith('actions/cache/save@'))!;- expect(save.if).toBe('always()');+ expect(save.if).toBe("always() && steps.tsc.outputs.state_written == 'true'");expect(save.with).toEqual({ path: restore.with!.path, key: restore.with!.key });expect(job.steps.indexOf(restore)).toBeLessThan(job.steps.indexOf(tsc));expect(job.steps.indexOf(save)).toBeGreaterThan(job.steps.indexOf(tsc));