Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

v0.60.17.0 ci(native-locks): download the pinned Zig archive from community mirrors with stall timeouts, cache it (#5786)

Garry Tan0b7939307d41
diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json
index 7c1463dd55..6a7edc889a 100644
--- a/.claude-plugin/plugin.json
+++ b/.claude-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "gbrain",
- "version": "0.60.16.0",
+ "version": "0.60.17.0",
"description": "Personal knowledge brain for your coding agent — hybrid search, synthesis, graph traversal, and durable cross-session memory over Postgres/PGLite with pgvector, plus a curated brain-first skill set.",
"author": {
"name": "Garry Tan",
diff --git a/.codex-plugin/plugin.json b/.codex-plugin/plugin.json
index 8cbf78e360..d636ef4ed6 100644
--- a/.codex-plugin/plugin.json
+++ b/.codex-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "gbrain",
- "version": "0.60.16.0",
+ "version": "0.60.17.0",
"description": "Personal knowledge brain for your coding agent — hybrid search, synthesis, graph traversal, and durable cross-session memory over Postgres/PGLite with pgvector, plus a curated brain-first skill set.",
"author": {
"name": "Garry Tan",
diff --git a/.github/workflows/native-locks.yml b/.github/workflows/native-locks.yml
index 4d95e8b1ee..6bb06e9ef9 100644
--- a/.github/workflows/native-locks.yml
+++ b/.github/workflows/native-locks.yml
@@ -70,6 +70,13 @@ jobs:
with:
bun-version: ${{ matrix.bun }}
- run: bun install --frozen-lockfile --ignore-scripts
+ # The pinned Zig archive, cached per runner OS/arch (setup-toolchain.ts re-verifies its sha256).
+ - uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
+ with:
+ path: |
+ ${{ runner.temp }}/gbrain-zig/zig-*.zip
+ ${{ runner.temp }}/gbrain-zig/zig-*.tar.xz
+ key: zig-archive-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('scripts/native/toolchain.json') }}
- run: bun scripts/native/setup-toolchain.ts --dir "${{ runner.temp }}/gbrain-zig" --github-path
- run: bun scripts/native/build.ts --target ${{ matrix.target }} --output "${{ runner.temp }}/native-rebuilt"
- run: bun scripts/native/verify.ts --rebuilt "${{ runner.temp }}/native-rebuilt"
@@ -174,6 +181,13 @@ jobs:
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6
with:
bun-version: ${{ matrix.bun }}
+ # The pinned Zig archive, cached per runner OS/arch (setup-toolchain.ts re-verifies its sha256).
+ - uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
+ with:
+ path: |
+ ${{ runner.temp }}/gbrain-zig/zig-*.zip
+ ${{ runner.temp }}/gbrain-zig/zig-*.tar.xz
+ key: zig-archive-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('scripts/native/toolchain.json') }}
- run: bun scripts/native/setup-toolchain.ts --dir "${{ runner.temp }}/gbrain-zig" --github-path
- run: bun scripts/native/build.ts --target ${{ matrix.target }} --output "${{ runner.temp }}/native-rebuilt"
- run: bun scripts/native/verify.ts --rebuilt "${{ runner.temp }}/native-rebuilt"
diff --git a/BOOTSTRAP_FOR_AGENTS.md b/BOOTSTRAP_FOR_AGENTS.md
index e82668eb6b..620f1d5708 100644
--- a/BOOTSTRAP_FOR_AGENTS.md
+++ b/BOOTSTRAP_FOR_AGENTS.md
@@ -1,4 +1,4 @@
-<!-- gbrain-runbook-stamp: 0.60.16.0 -->
+<!-- gbrain-runbook-stamp: 0.60.17.0 -->
<!-- This stamp must equal the VERSION file at every release; CI enforces it
(scripts/check-bootstrap-tag.sh). `gbrain bootstrap status` compares it to
the installed binary and warns on skew. -->
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5b8d0a5925..597b8110e3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,29 @@ 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.17.0] - 2026-09-30
+
+**The Windows native lock checks stop timing out on pull requests. They download the pinned Zig compiler from a fast mirror, cache it, and fail within minutes with every source named if all downloads stall.**
+
+Every recent pull request that bumps the version got its `native-locks / win32-x64` and `win32-arm64` cells cancelled at the 15-minute job limit, which failed `test-status`. The cause was not a runner change or a test. The first build step downloads the pinned Zig archive from ziglang.org, which throttles automated downloads (about 180 KB/s measured). The Windows archive is 82 MB, so that step alone ran past 14 minutes, and on good runs it still took about 4 minutes. The Zig project asks CI to use its community mirrors instead. CI speed change #5727 (v0.60.8.0) did not touch this job's timeout or runners. It keeps these cells on any pull request that changes `package.json`, which every release bump does, so the slow download now showed up on every such PR.
+
+| Zig archive download (82 MB Windows zip) | Before | After |
+| --- | --- | --- |
+| Source | ziglang.org (throttled) | community mirrors in order, ziglang.org last |
+| Measured time | 4 to 14+ minutes | about 3 seconds from a mirror; seconds from the cache |
+| A stalled source | hangs until the 15-minute job limit | abandoned after 30 s without bytes (4 minutes per source at most) |
+| Integrity | pinned sha256 | the same pinned sha256, checked for every source before use |
+
+### To take advantage of v0.60.17.0
+
+Nothing to do: this changes CI only. `bun scripts/native/setup-toolchain.ts` downloads from the mirrors for local native builds too.
+
+### Itemized changes
+
+- `scripts/native/setup-toolchain.ts` streams the pinned archive from five community mirrors in order, with ziglang.org as the last resort. Each attempt aborts after 30 s without bytes or 4 minutes in total. An archive is kept only when its sha256 matches the pinned value, so a mirror can fail but cannot substitute bytes. When every source fails, the error lists each source and why it failed. A cached archive is re-verified before reuse, and a corrupt one is discarded.
+- `native-locks.yml` caches the archive per runner OS and architecture, keyed on `scripts/native/toolchain.json`, in the native and musl jobs. `timeout-minutes` is unchanged.
+- `scripts/native/toolchain.json` is unchanged, so the native build input digest and the committed prebuilds do not move.
+
## [0.60.16.0] - 2026-09-30
**Long-running brains stop getting stuck waiting on a `git` check that already finished.**
diff --git a/VERSION b/VERSION
index 95046d679b..f181ed73a1 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.60.16.0
+0.60.17.0
diff --git a/openclaw.plugin.json b/openclaw.plugin.json
index 98855f5e80..a08891f173 100644
--- a/openclaw.plugin.json
+++ b/openclaw.plugin.json
@@ -1,7 +1,7 @@
{
"id": "gbrain-context-engine",
"name": "gbrain",
- "version": "0.60.16.0",
+ "version": "0.60.17.0",
"description": "Personal knowledge brain with Postgres + pgvector hybrid search",
"family": "bundle-plugin",
"kind": "context-engine",
diff --git a/package.json b/package.json
index 3e459c3f15..9fc2a6ff18 100644
--- a/package.json
+++ b/package.json
@@ -204,7 +204,7 @@
"bun": ">=1.3.11"
},
"license": "MIT",
- "version": "0.60.16.0",
+ "version": "0.60.17.0",
"overrides": {
"@ai-sdk/provider-utils": "4.0.33",
"@hono/node-server": "^2.0.5",
diff --git a/plugin-variants/gbrain-coding/.claude-plugin/plugin.json b/plugin-variants/gbrain-coding/.claude-plugin/plugin.json
index 5aed54dd96..4c56215b7b 100644
--- a/plugin-variants/gbrain-coding/.claude-plugin/plugin.json
+++ b/plugin-variants/gbrain-coding/.claude-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "gbrain-coding",
- "version": "0.60.16.0",
+ "version": "0.60.17.0",
"description": "Brain-first coding agent working inside a repo: retrieval, routing, ingest discipline, correction hygiene. Default persona for the claude-code harness bridge; also published as the gbrain-coding marketplace variant. (persona variant of the gbrain plugin — 21 skills)",
"author": {
"name": "Garry Tan",
diff --git a/plugin-variants/gbrain-coding/.codex-plugin/plugin.json b/plugin-variants/gbrain-coding/.codex-plugin/plugin.json
index 62d1e8e5ae..5b7a797840 100644
--- a/plugin-variants/gbrain-coding/.codex-plugin/plugin.json
+++ b/plugin-variants/gbrain-coding/.codex-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "gbrain-coding",
- "version": "0.60.16.0",
+ "version": "0.60.17.0",
"description": "Brain-first coding agent working inside a repo: retrieval, routing, ingest discipline, correction hygiene. Default persona for the claude-code harness bridge; also published as the gbrain-coding marketplace variant. (persona variant of the gbrain plugin — 21 skills)",
"author": {
"name": "Garry Tan",
diff --git a/plugin-variants/gbrain-coding/README.md b/plugin-variants/gbrain-coding/README.md
index 50a062d256..d5116aedbb 100644
--- a/plugin-variants/gbrain-coding/README.md
+++ b/plugin-variants/gbrain-coding/README.md
@@ -1,4 +1,4 @@
-<!-- gbrain-plugin-tree-stamp: 0.60.16.0 -->
+<!-- gbrain-plugin-tree-stamp: 0.60.17.0 -->
# gbrain-coding (generated persona variant — do not hand-edit)
Brain-first coding agent working inside a repo: retrieval, routing, ingest discipline, correction hygiene. Default persona for the claude-code harness bridge; also published as the gbrain-coding marketplace variant.
diff --git a/plugin-variants/gbrain-daily/.claude-plugin/plugin.json b/plugin-variants/gbrain-daily/.claude-plugin/plugin.json
index d2aac707c4..b262246abe 100644
--- a/plugin-variants/gbrain-daily/.claude-plugin/plugin.json
+++ b/plugin-variants/gbrain-daily/.claude-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "gbrain-daily",
- "version": "0.60.16.0",
+ "version": "0.60.17.0",
"description": "Personal knowledge-brain daily use: meetings, tasks, briefings, reading, research. Published as the gbrain-daily marketplace variant. (persona variant of the gbrain plugin — 20 skills)",
"author": {
"name": "Garry Tan",
diff --git a/plugin-variants/gbrain-daily/.codex-plugin/plugin.json b/plugin-variants/gbrain-daily/.codex-plugin/plugin.json
index 7c0bd83cb6..d6dc636b91 100644
--- a/plugin-variants/gbrain-daily/.codex-plugin/plugin.json
+++ b/plugin-variants/gbrain-daily/.codex-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "gbrain-daily",
- "version": "0.60.16.0",
+ "version": "0.60.17.0",
"description": "Personal knowledge-brain daily use: meetings, tasks, briefings, reading, research. Published as the gbrain-daily marketplace variant. (persona variant of the gbrain plugin — 20 skills)",
"author": {
"name": "Garry Tan",
diff --git a/plugin-variants/gbrain-daily/README.md b/plugin-variants/gbrain-daily/README.md
index 3079b91f52..2ed25dfd7f 100644
--- a/plugin-variants/gbrain-daily/README.md
+++ b/plugin-variants/gbrain-daily/README.md
@@ -1,4 +1,4 @@
-<!-- gbrain-plugin-tree-stamp: 0.60.16.0 -->
+<!-- gbrain-plugin-tree-stamp: 0.60.17.0 -->
# gbrain-daily (generated persona variant — do not hand-edit)
Personal knowledge-brain daily use: meetings, tasks, briefings, reading, research. Published as the gbrain-daily marketplace variant.
diff --git a/plugin/README.md b/plugin/README.md
index e5eebcb71e..f3e8091a1b 100644
--- a/plugin/README.md
+++ b/plugin/README.md
@@ -1,4 +1,4 @@
-<!-- gbrain-plugin-tree-stamp: 0.60.16.0 -->
+<!-- gbrain-plugin-tree-stamp: 0.60.17.0 -->
# gbrain plugin skill tree (generated — do not hand-edit)
This tree is the curated skill set for the gbrain Codex and Claude Code
diff --git a/scripts/native/setup-toolchain.ts b/scripts/native/setup-toolchain.ts
index e316fbec59..46f3ae41e6 100644
--- a/scripts/native/setup-toolchain.ts
+++ b/scripts/native/setup-toolchain.ts
@@ -1,11 +1,25 @@
#!/usr/bin/env bun
-/** Download the exact compiler archive pinned in the checked-in manifest. */
+/**
+ * Download the exact compiler archive pinned in the checked-in manifest.
+ *
+ * ziglang.org throttles CI downloads (about 180 KB/s measured, so the 82 MB
+ * Windows archive outran the 15-minute job limit), and the Zig project asks
+ * automated downloads to use its community mirrors instead
+ * (https://ziglang.org/download/community-mirrors/). Sources are tried in
+ * order, each attempt aborts when bytes stop arriving or it runs too long,
+ * and every archive must match the pinned sha256, so a mirror can fail but
+ * never substitute bytes. ziglang.org stays the last resort.
+ */
import { createHash } from 'node:crypto';
import { execFileSync } from 'node:child_process';
-import { appendFileSync, existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from 'node:fs';
+import { appendFileSync, createWriteStream, existsSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync } from 'node:fs';
import { dirname, join, resolve } from 'node:path';
import toolchain from './toolchain.json';
+const MIRRORS = ['https://pkg.hexops.org/zig', 'https://zig.linus.dev/zig', 'https://zig.squirl.dev', 'https://zigmirror.com', 'https://pkg.earth/zig'];
+const STALL_MS = 30_000;
+const ATTEMPT_MS = 240_000;
+
const args = process.argv.slice(2);
const index = args.indexOf('--dir');
const directory = resolve(index < 0 ? '.context/native-toolchain' : args[index + 1]);
@@ -15,13 +29,60 @@ const key = `${arch}-${platform}` as keyof typeof toolchain.archives;
const archiveInfo = toolchain.archives[key];
if (!archiveInfo) throw new Error(`No pinned Zig archive for ${key}`);
mkdirSync(directory, { recursive: true });
-const archive = join(directory, archiveInfo.tarball.split('/').at(-1)!);
-if (!existsSync(archive)) {
- const response = await fetch(archiveInfo.tarball);
- if (!response.ok) throw new Error(`Compiler download failed: HTTP ${response.status}`);
- writeFileSync(archive, new Uint8Array(await response.arrayBuffer()));
+const name = archiveInfo.tarball.split('/').at(-1)!;
+const archive = join(directory, name);
+
+const sha256 = (file: string) => createHash('sha256').update(readFileSync(file)).digest('hex');
+
+/** One source: stream to a temp file, abort on a stall or overrun, keep it only if the checksum matches. */
+async function fetchVerified(url: string): Promise<void> {
+ const partial = `${archive}.partial`;
+ const controller = new AbortController();
+ let reason = '';
+ const abort = (why: string) => { reason = why; controller.abort(); };
+ const overall = setTimeout(() => abort(`exceeded ${ATTEMPT_MS / 1000}s`), ATTEMPT_MS);
+ let stall = setTimeout(() => abort(`no bytes for ${STALL_MS / 1000}s`), STALL_MS);
+ const started = Date.now();
+ let received = 0;
+ try {
+ const response = await fetch(url, { signal: controller.signal });
+ if (!response.ok || !response.body) throw new Error(`HTTP ${response.status}`);
+ const out = createWriteStream(partial);
+ for await (const chunk of response.body) {
+ clearTimeout(stall);
+ stall = setTimeout(() => abort(`no bytes for ${STALL_MS / 1000}s`), STALL_MS);
+ received += chunk.length;
+ if (!out.write(chunk)) await new Promise(r => out.once('drain', r));
+ }
+ await new Promise<void>((ok, fail) => out.end((error?: Error | null) => (error ? fail(error) : ok())));
+ if (sha256(partial) !== archiveInfo.shasum) throw new Error('checksum mismatch');
+ renameSync(partial, archive);
+ console.error(`zig archive: ${received} bytes in ${((Date.now() - started) / 1000).toFixed(1)}s from ${url}`);
+ } catch (error) {
+ rmSync(partial, { force: true });
+ throw new Error(reason ? `${reason} after ${received} bytes` : error instanceof Error ? error.message : String(error));
+ } finally {
+ clearTimeout(overall);
+ clearTimeout(stall);
+ }
+}
+
+if (existsSync(archive) && sha256(archive) !== archiveInfo.shasum) rmSync(archive);
+if (existsSync(archive)) {
+ console.error(`zig archive: reusing ${archive}`);
+} else {
+ const failures: string[] = [];
+ for (const url of [...MIRRORS.map(m => `${m}/${name}?source=gbrain-ci`), archiveInfo.tarball]) {
+ try {
+ await fetchVerified(url);
+ break;
+ } catch (error) {
+ failures.push(`${url}: ${(error as Error).message}`);
+ console.error(`zig archive: ${url} failed (${(error as Error).message}); trying the next source`);
+ }
+ }
+ if (!existsSync(archive)) throw new Error(`Compiler download failed from every source:\n ${failures.join('\n ')}`);
}
-if (createHash('sha256').update(readFileSync(archive)).digest('hex') !== archiveInfo.shasum) throw new Error('Pinned compiler checksum mismatch');
execFileSync('tar', ['-xf', archive, '-C', directory], { stdio: 'inherit' });
const extracted = readdirSync(directory, { withFileTypes: true }).find(entry => entry.isDirectory() && entry.name.startsWith('zig-'));
if (!extracted) throw new Error('Compiler archive did not contain Zig');
diff --git a/templates/bootstrap/template-repo/README.md b/templates/bootstrap/template-repo/README.md
index f21001ffb1..3b6cff5f3d 100644
--- a/templates/bootstrap/template-repo/README.md
+++ b/templates/bootstrap/template-repo/README.md
@@ -1,6 +1,6 @@
# gbrain agent workspace — template
-<!-- gbrain-template-stamp: 0.60.16.0 -->
+<!-- gbrain-template-stamp: 0.60.17.0 -->
This repository is the **"Use this template"** distribution artifact for a
[gbrain](https://github.com/garrytan/gbrain) personal-agent workspace — the same