Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

v0.60.27.0 chore(runtime): require Bun 1.4.0 or newer (#5838)

Garry Tanad7900d8dcd2
diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json
index 7b7164998d..2a5465bd7d 100644
--- a/.claude-plugin/plugin.json
+++ b/.claude-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "gbrain",
- "version": "0.60.26.0",
+ "version": "0.60.27.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 2d383b0905..9c461310b5 100644
--- a/.codex-plugin/plugin.json
+++ b/.codex-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "gbrain",
- "version": "0.60.26.0",
+ "version": "0.60.27.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 51b82c1229..09272c2f05 100644
--- a/.github/workflows/native-locks.yml
+++ b/.github/workflows/native-locks.yml
@@ -59,11 +59,11 @@ jobs:
strategy:
fail-fast: false
matrix:
- bun: ['1.3.11', '1.3.13', '1.4.2']
+ bun: ['1.4.0', '1.4.2']
target: [linux-x64-glibc, linux-arm64-glibc, darwin-arm64, darwin-x64, win32-x64, win32-arm64]
# Pull requests: primary Bun on every target (native paths changed) or
# the Linux x64 glibc smoke cell. Runners map from the target above.
- exclude: ${{ fromJSON(inputs.scope == 'full' && '[]' || inputs.scope == 'primary' && '[{"bun":"1.3.11"},{"bun":"1.3.13"}]' || '[{"bun":"1.3.11"},{"bun":"1.3.13"},{"target":"linux-arm64-glibc"},{"target":"darwin-arm64"},{"target":"darwin-x64"},{"target":"win32-x64"},{"target":"win32-arm64"}]') }}
+ exclude: ${{ fromJSON(inputs.scope == 'full' && '[]' || inputs.scope == 'primary' && '[{"bun":"1.4.0"}]' || '[{"bun":"1.4.0"},{"target":"linux-arm64-glibc"},{"target":"darwin-arm64"},{"target":"darwin-x64"},{"target":"win32-x64"},{"target":"win32-arm64"}]') }}
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6
@@ -119,8 +119,8 @@ jobs:
fail-fast: false
matrix:
runner: [windows-2022, windows-11-arm]
- bun: ['1.3.11', '1.3.13', '1.4.2']
- exclude: ${{ fromJSON(inputs.scope == 'full' && '[]' || '[{"bun":"1.3.11"},{"bun":"1.3.13"}]') }}
+ bun: ['1.4.0', '1.4.2']
+ exclude: ${{ fromJSON(inputs.scope == 'full' && '[]' || '[{"bun":"1.4.0"}]') }}
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6
@@ -146,8 +146,8 @@ jobs:
fail-fast: false
matrix:
runner: [windows-2022, windows-11-arm]
- bun: ['1.3.11', '1.3.13', '1.4.2']
- exclude: ${{ fromJSON(inputs.scope == 'full' && '[]' || '[{"bun":"1.3.11"},{"bun":"1.3.13"}]') }}
+ bun: ['1.4.0', '1.4.2']
+ exclude: ${{ fromJSON(inputs.scope == 'full' && '[]' || '[{"bun":"1.4.0"}]') }}
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6
@@ -173,9 +173,9 @@ jobs:
strategy:
fail-fast: false
matrix:
- bun: ['1.3.11', '1.3.13', '1.4.2']
+ bun: ['1.4.0', '1.4.2']
target: [linux-x64-musl, linux-arm64-musl]
- exclude: ${{ fromJSON(inputs.scope == 'full' && '[]' || '[{"bun":"1.3.11"},{"bun":"1.3.13"}]') }}
+ exclude: ${{ fromJSON(inputs.scope == 'full' && '[]' || '[{"bun":"1.4.0"}]') }}
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6
diff --git a/.github/workflows/persistence-validation.yml b/.github/workflows/persistence-validation.yml
index d426e79d28..6e0f6be6db 100644
--- a/.github/workflows/persistence-validation.yml
+++ b/.github/workflows/persistence-validation.yml
@@ -16,10 +16,10 @@ jobs:
fail-fast: false
matrix:
engine: [pglite, postgres]
- bun: ['1.3.11', '1.4.2']
+ bun: ['1.4.0', '1.4.2']
# Pull requests run the primary Bun version; pushes, schedules and
# manual runs keep every supported version.
- exclude: ${{ fromJSON(github.event_name == 'pull_request' && '[{"bun":"1.3.11"}]' || '[]') }}
+ exclude: ${{ fromJSON(github.event_name == 'pull_request' && '[{"bun":"1.4.0"}]' || '[]') }}
services:
postgres:
image: pgvector/pgvector:pg16
@@ -57,10 +57,10 @@ jobs:
strategy:
fail-fast: false
matrix:
- bun: ['1.3.11', '1.4.2']
+ bun: ['1.4.0', '1.4.2']
# Pull requests run the primary Bun version; pushes, schedules and
# manual runs keep every supported version.
- exclude: ${{ fromJSON(github.event_name == 'pull_request' && '[{"bun":"1.3.11"}]' || '[]') }}
+ exclude: ${{ fromJSON(github.event_name == 'pull_request' && '[{"bun":"1.4.0"}]' || '[]') }}
services:
postgres:
image: pgvector/pgvector:pg16
@@ -168,10 +168,10 @@ jobs:
fail-fast: false
matrix:
engine: [pglite, postgres]
- bun: ['1.3.11', '1.4.2']
+ bun: ['1.4.0', '1.4.2']
# Pull requests run the primary Bun version; pushes, schedules and
# manual runs keep every supported version.
- exclude: ${{ fromJSON(github.event_name == 'pull_request' && '[{"bun":"1.3.11"}]' || '[]') }}
+ exclude: ${{ fromJSON(github.event_name == 'pull_request' && '[{"bun":"1.4.0"}]' || '[]') }}
services:
postgres:
image: pgvector/pgvector:pg16
@@ -217,10 +217,10 @@ jobs:
fail-fast: false
matrix:
engine: [pglite, postgres]
- bun: ['1.3.11', '1.4.2']
+ bun: ['1.4.0', '1.4.2']
# Pull requests run the primary Bun version; pushes, schedules and
# manual runs keep every supported version.
- exclude: ${{ fromJSON(github.event_name == 'pull_request' && '[{"bun":"1.3.11"}]' || '[]') }}
+ exclude: ${{ fromJSON(github.event_name == 'pull_request' && '[{"bun":"1.4.0"}]' || '[]') }}
services:
postgres:
image: pgvector/pgvector:pg16
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index d14913a558..48f0ca0ff6 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -127,10 +127,10 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-26, windows-latest]
- bun: ['1.3.11', '1.4.2']
+ bun: ['1.4.0', '1.4.2']
# Pull requests run the primary Bun version on every OS; pushes,
# schedules and manual runs add the oldest supported version.
- exclude: ${{ fromJSON(github.event_name == 'pull_request' && '[{"bun":"1.3.11"}]' || '[]') }}
+ exclude: ${{ fromJSON(github.event_name == 'pull_request' && '[{"bun":"1.4.0"}]' || '[]') }}
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
diff --git a/BOOTSTRAP_FOR_AGENTS.md b/BOOTSTRAP_FOR_AGENTS.md
index de3e6d06d2..adc956e3fd 100644
--- a/BOOTSTRAP_FOR_AGENTS.md
+++ b/BOOTSTRAP_FOR_AGENTS.md
@@ -1,4 +1,4 @@
-<!-- gbrain-runbook-stamp: 0.60.26.0 -->
+<!-- gbrain-runbook-stamp: 0.60.27.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. -->
@@ -43,7 +43,8 @@ read it and relay it to the human in plain language. Never work around a refusal
⛔ **VERIFY BEFORE CLAIMING DONE.** The install is done when `gbrain bootstrap
verify` exits 0 — not when the transcript looks good. Paste its report to the human.
-⛔ **RESPECT THE TOOLCHAIN TRUST RULES.** Install bun via a platform package manager
+⛔ **RESPECT THE TOOLCHAIN TRUST RULES.** GBrain needs Bun 1.4.0 or newer (`bun upgrade`
+updates an older Bun). Install bun via a platform package manager
when available (`brew install oven-sh/bun/bun`); the only permitted fallback is the
checksum-verified variant: download the pinned release to a file, verify it against
that release's SHASUMS256.txt, and only then execute. Install gh the same way —
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 53d0bff423..cf13ada029 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,83 @@ 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.27.0] - 2026-10-01
+
+**GBrain now needs Bun 1.4 or newer, because a bug in older Bun releases could make GBrain wait forever on a helper process that had already finished.**
+
+GBrain starts small helper processes all the time: `git` for your brain repo, background workers, syncs. Older Bun releases had a bug where one of those helpers could exit and Bun would never pass the news along, so whatever was waiting for it waited forever. On a laptop that looks like a command that never returns. On an always-on brain it looks like a worker that quietly stops making progress. Bun 1.4 includes the fix, so 1.4.0 is now the minimum.
+
+Compiled release binaries already carry Bun 1.4.2, so if you run the `gbrain` binary there is nothing to do. If you installed from source with Bun, run `bun upgrade` first.
+
+On an older Bun, every command (including `serve`, `jobs work`, hooks and autopilot) stops at startup with one message that names your Bun, the minimum and the fix, instead of starting and hanging later:
+
+```
+GBrain requires Bun 1.4.0 or newer (found Bun 1.3.14).
+Fix: run `bun upgrade`, then restart GBrain. If a `gbrain upgrade` stopped here, finish it with `gbrain post-upgrade`.
+```
+
+| You run GBrain on | What happens after this release |
+| --- | --- |
+| The compiled `gbrain` binary | Nothing changes |
+| Bun 1.4.0 or newer | Nothing changes; `gbrain doctor` shows a new `bun_runtime` row |
+| Bun 1.3.x | Commands refuse with the message above until you run `bun upgrade` |
+
+### Things to watch
+
+- If you run `gbrain upgrade` while still on Bun 1.3, the new version installs but its migrations stop at the runtime check, and the install prints the same message. Run `bun upgrade`, then `gbrain post-upgrade`.
+- Services under launchd, systemd or cron keep retrying and recover by themselves once Bun is upgraded. The refusal is in `~/.gbrain/autopilot.log`.
+- `gbrain --version` still answers on an older Bun, so tools that check the version keep working.
+
+## To take advantage of v0.60.27.0
+
+1. **Upgrade Bun** (source installs only; compiled binaries skip this):
+ ```bash
+ bun upgrade
+ bun --version # 1.4.0 or newer
+ ```
+2. **Upgrade GBrain, or finish an upgrade that stopped at the runtime check:**
+ ```bash
+ gbrain upgrade # or, if you already upgraded on the old Bun: gbrain post-upgrade
+ ```
+ Then restart anything long-running: `gbrain serve` (restart your agent harness for stdio MCP), `gbrain jobs supervisor`, autopilot.
+3. **Your agent reads `skills/migrations/v0.60.27.0.md` the next time you interact with it.** It checks the runtime, asks before running `bun upgrade` for you, and finishes the upgrade.
+4. **Verify the outcome:**
+ ```bash
+ gbrain doctor # bun_runtime: "Bun 1.4.x (minimum 1.4.0)"
+ ```
+5. **If any step fails,** please file an issue:
+ https://github.com/garrytan/gbrain/issues with:
+ - output of `gbrain doctor`
+ - output of `bun --version` and `which -a bun`
+ - contents of `~/.gbrain/upgrade-errors.jsonl` if it exists
+
+ This feedback loop is how the gbrain maintainers find fragile upgrade paths. Thank you.
+
+**Say to your agent:** *"Is my Bun new enough for GBrain?"* or *"Finish upgrading GBrain after the Bun upgrade."*
+
+### Itemized changes
+
+#### Runtime floor
+
+- `MINIMUM_BUN_VERSION` in `src/core/runtime-version.ts` and `engines.bun` in `package.json` are now 1.4.0, the lowest 1.4 release. It carries the Linux child-exit fix (oven-sh/bun#30301, first shipped in 1.3.14), and `test/bounded-child-exec.test.ts` passes on it.
+- `unsupportedBunMessage()` builds the one refusal text: found version, minimum, `bun upgrade`, restart, and `gbrain post-upgrade` for an interrupted upgrade. `assertSupportedBun()` throws it with code `UNSUPPORTED_RUNTIME`.
+- The CLI entrypoint (`src/cli.ts`) checks before any command runs, so every subcommand fails fast with exit 1. `gbrain --version` prints the version and exits 0, with the refusal on stderr, so an upgrade started by an older gbrain can still confirm what it installed. `gbrain autopilot` also writes the refusal to stdout, because its services log stdout to `autopilot.log` and stderr to an `autopilot.err` nothing points at.
+- `scripts/postinstall.ts` prints the refusal when an install or `bun update` lands on an older Bun, and still exits 0.
+- New doctor check `bun_runtime` (ops): `Bun <version> (minimum 1.4.0)`, or a failure with the fix command.
+- `gbrain bootstrap cloud-setup-script` installs Bun through npm when the sandbox has no Bun or one older than 1.4.0, and its launcher runs that Bun.
+- Install docs (README, `INSTALL_FOR_AGENTS.md`, `BOOTSTRAP_FOR_AGENTS.md`, `CONTRIBUTING.md`, `SECURITY.md`, `docs/guides/authorization-upgrade.md`) state Bun 1.4.0 or newer and name `bun upgrade`.
+
+#### What Bun 1.4 does not fix
+
+- Bun still drops a child's pipe events when a callback re-enters the event loop (for example bun:test `expect().resolves`); a raw repro without `execFileBounded` still hangs on 1.4.2. The in-code bounds on `git` children stay, and their comments now say which part Bun fixed.
+
+### For contributors
+
+- The minimum-version CI lanes move to 1.4.0: `test.yml` security regressions and all four `persistence-validation.yml` matrices run 1.4.0 and 1.4.2 (pull requests still skip the minimum). `native-locks.yml` drops 1.3.11 and 1.3.13 and runs 1.4.0 and 1.4.2 on full scope (16 native pairs, 4 musl, 4 per Windows probe).
+- `test/scripts/ci-pr-scope.test.ts` requires every minimum-version matrix to be exactly `[MINIMUM_BUN_VERSION, primary]`. New `test/runtime-version.test.ts` pins the refusal text, the doctor row, and the floor in `package.json` and the cloud setup script.
+- Doctor goldens scrub the running Bun version (`Bun <bun-version>`).
+- If your local Bun is 1.3.x, `bun upgrade` before running the CLI or CLI-spawning tests.
+
## [0.60.26.0] - 2026-10-01
**System One: a fast decision model can now make some of your brain's small judgment calls, starting with which chats are worth remembering and which facts replace older ones. If you have a TypeSafe key installed, upgrading turns those two on.**
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index b3d40a4da9..f22459886f 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -9,7 +9,7 @@ bun install
bun test
```
-Requires Bun 1.3.11 or newer, matching `package.json`.
+Requires Bun 1.4.0 or newer, matching `package.json`.
### Windows
diff --git a/INSTALL_FOR_AGENTS.md b/INSTALL_FOR_AGENTS.md
index b7a904bacd..49559bd8fa 100644
--- a/INSTALL_FOR_AGENTS.md
+++ b/INSTALL_FOR_AGENTS.md
@@ -38,7 +38,7 @@ If you fetched this file by URL without cloning yet, the companion files live at
> garrytan/gbrain` + `/plugin install gbrain@gbrain`). Details:
> docs/mcp/CODEX.md and docs/mcp/CLAUDE_CODE.md.
-Default path (Bun is required — gbrain is a Bun + TypeScript runtime):
+Default path (Bun 1.4.0 or newer is required — gbrain is a Bun + TypeScript runtime; on an older Bun, run `bun upgrade` first):
```bash
curl -fsSL https://bun.sh/install | bash
diff --git a/README.md b/README.md
index d9622db591..8fdaa736c9 100644
--- a/README.md
+++ b/README.md
@@ -85,7 +85,7 @@ This is the difference between a search engine and a brain. Search finds the pag
## Install
-Requires **Bun 1.3.11 or newer**. Existing worker installations should follow the
+Requires **Bun 1.4.0 or newer**. Existing worker installations should follow the
[authorization and queue upgrade guide](docs/guides/authorization-upgrade.md)
before restarting services with this version.
diff --git a/SECURITY.md b/SECURITY.md
index 68a651b317..a76eeb11eb 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -387,7 +387,7 @@ clients in the existing Agents page.
Queued work also retains its submitting authority and is revalidated before
execution. Worker upgrades require a stopped-service cutover; see the
[authorization and worker upgrade guide](docs/guides/authorization-upgrade.md)
-before migrating an existing queue. That guide also covers the Bun 1.3.11
+before migrating an existing queue. That guide also covers the Bun 1.4.0
minimum and guarded outbound connections.
```bash
diff --git a/VERSION b/VERSION
index 944df9d277..ffc4da6137 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.60.26.0
+0.60.27.0
diff --git a/docs/TESTING.md b/docs/TESTING.md
index e1a2ef72c6..dd21200673 100644
--- a/docs/TESTING.md
+++ b/docs/TESTING.md
@@ -54,10 +54,10 @@ manual dispatch. Pull requests run a narrower matrix of the same files:
| Lane | Pull request | Push to master, nightly, manual |
| --- | --- | --- |
-| Security regressions | Linux, macOS and Windows on Bun 1.4.2 | Also Bun 1.3.11 |
-| Persistence read latency, deployment matrix, soak, reconciliation crashes | Bun 1.4.2 | Bun 1.3.11 and 1.4.2 |
+| Security regressions | Linux, macOS and Windows on Bun 1.4.2 | Also Bun 1.4.0 |
+| Persistence read latency, deployment matrix, soak, reconciliation crashes | Bun 1.4.2 | Bun 1.4.0 and 1.4.2 |
| Persistence soak size | 2,500 writes | 10,000 writes |
-| Native writer locks, native paths changed | Every target on Bun 1.4.2, musl, both Windows probes, OpenClaw | Every target, musl and Windows probe on Bun 1.3.11, 1.3.13 and 1.4.2, OpenClaw |
+| Native writer locks, native paths changed | Every target on Bun 1.4.2, musl, both Windows probes, OpenClaw | Every target, musl and Windows probe on Bun 1.4.0 and 1.4.2, OpenClaw |
| Native writer locks, other changes | `linux-x64-glibc / Bun 1.4.2` smoke cell (full native step list) | Same as above |
| `test/export-scale.slow.test.ts` | 10,001 pages | 100,001 pages |
@@ -502,7 +502,7 @@ checks real process exclusion, crash handoff, retained files, cancellation,
missing-addon failure and source/binary manifest integrity. Tests use isolated
temporary paths and never open an operator datastore. The required
`native-locks.yml` lane rebuilds and executes all eight OS/architecture/libc
-targets on Bun 1.3.11, 1.3.13 and 1.4.2, including native musl Docker userspace.
+targets on Bun 1.4.0 and 1.4.2, including native musl Docker userspace.
Every pair also runs `bun scripts/native/compiled-smoke.ts` to prove compiled
process locking. Release CI verifies the shipped CLI embeds the matching
addon and runs the compiled smoke on its two release platforms. Rebuild
@@ -703,7 +703,7 @@ boundaries, followed by a small multi-process soak. The Postgres test creates
and drops fresh test databases, requiring CREATEDB on the explicit test URL.
It never truncates the shared E2E database. The reusable
`persistence-validation.yml` gate runs 1,000 schedules and 10,000 writes per
-engine under Bun 1.3.11 and 1.4.2 and uploads actual executed-case manifests.
+engine under Bun 1.4.0 and 1.4.2 and uploads actual executed-case manifests.
See [`scripts/persistence/README.md`](../scripts/persistence/README.md) for
workloads, reruns, performance measurements and the process-crash scope.
@@ -2169,7 +2169,7 @@ existing fence and timeline suites.
`test/guarded-http.test.ts` and `test/guarded-http-tls.serial.test.ts` cover DNS,
TLS identity and ports, redirects, deadlines, body limits, and cleanup. CI runs
-these boundaries on Bun 1.3.11 and 1.4.2, audits root and admin dependencies, and
+these boundaries on Bun 1.4.0 and 1.4.2, audits root and admin dependencies, and
executes `scripts/test-gitleaks-config.sh` to prove fixture exceptions still
report an unrelated secret in the same file. `scripts/scan-worktree-secrets.sh`
scans tracked files plus new files eligible for commit; tracked ignored files
diff --git a/docs/architecture/key-files/core-persistence.md b/docs/architecture/key-files/core-persistence.md
index d55c4f9453..f23c85c0b1 100644
--- a/docs/architecture/key-files/core-persistence.md
+++ b/docs/architecture/key-files/core-persistence.md
@@ -41,7 +41,7 @@ The page operations that submit through this layer are in [Core Services (2/3)](
- `src/core/persistence/effect-recovery-scan.ts` — bounded owner-scoped recovery selection rotates through durable effect IDs even when an earlier root has no available native lock, and wraps to retry prior roots. It never changes recovery authority or releases reservations. `test/persistence-effect-recovery-fairness.test.ts` holds two real native roots, recovers a later mirror, then verifies wraparound cleanup and exact counters on both engines.
-- `src/core/persistence/native-lock.ts` + `native/locks/` — lazy portable Node-API v3 kernel locks (`flock` / `LockFileEx`) with opaque handles, retained stable lock files, cancellable asynchronous waiting and fail-closed capability errors. Eight vendored prebuilds support script-disabled source installs; pinned Zig recipes and source/artifact hashes live in `scripts/native/`. Actual competing-process, crash-handoff and compiled-executable tests run across eight platform/architecture targets and Bun 1.3.11 / 1.3.13 / 1.4.2. The compiled smoke waits for child exit before cleanup; `scripts/native/compiled-smoke-cleanup.ts` bounds retries to transient Windows `EBUSY` errors, with persistent and permission failures pinned by `test/scripts/native-compiled-cleanup.test.ts`. Windows-only `windows-ipc.h` supplies opaque Global mutex claims (same-thread recursion refused, abandoned owner handoff) and exact-handle stale AF_UNIX deletion after a verified reparse tag under a retained binding claim. CNG hashing and native casing make pipe identities independent of homes and logon sessions. Build and ownership contract: `native/locks/README.md`.
+- `src/core/persistence/native-lock.ts` + `native/locks/` — lazy portable Node-API v3 kernel locks (`flock` / `LockFileEx`) with opaque handles, retained stable lock files, cancellable asynchronous waiting and fail-closed capability errors. Eight vendored prebuilds support script-disabled source installs; pinned Zig recipes and source/artifact hashes live in `scripts/native/`. Actual competing-process, crash-handoff and compiled-executable tests run across eight platform/architecture targets and Bun 1.4.0 / 1.4.2. The compiled smoke waits for child exit before cleanup; `scripts/native/compiled-smoke-cleanup.ts` bounds retries to transient Windows `EBUSY` errors, with persistent and permission failures pinned by `test/scripts/native-compiled-cleanup.test.ts`. Windows-only `windows-ipc.h` supplies opaque Global mutex claims (same-thread recursion refused, abandoned owner handoff) and exact-handle stale AF_UNIX deletion after a verified reparse tag under a retained binding claim. CNG hashing and native casing make pipe identities independent of homes and logon sessions. Build and ownership contract: `native/locks/README.md`.
- `src/core/persistence/page-input.ts` — freezes scoped subagent type normalization at durable admission, after existing-request replay. An explicit undeclared model-authored type becomes `note` with `legacy_type` retained using the then-active schema pack; a replay keeps its original normalized payload when the pack changes. Caller intent remains unchanged for idempotency checks. Raw input size is checked before normalization and malformed Markdown is left to the importer’s sanitized error contract. `test/brain-allowlist.serial.test.ts` pins changed-pack replay, raw-size refusal, and private parse-error redaction.
diff --git a/docs/architecture/key-files/core-utilities-2.md b/docs/architecture/key-files/core-utilities-2.md
index 623ee6cf90..7e83226594 100644
--- a/docs/architecture/key-files/core-utilities-2.md
+++ b/docs/architecture/key-files/core-utilities-2.md
@@ -7,7 +7,7 @@ Current behavior and load-bearing invariants; history belongs in Git and CHANGEL
- `src/core/rerank-audit.ts` — failure-only JSONL audit at `~/.gbrain/audit/rerank-failures-YYYY-Www.jsonl` (ISO-week rotation, mirrors `src/core/audit-slug-fallback.ts`). Exports `logRerankFailure({reason, model, query_hash, doc_count, error_summary})` + `readRecentRerankFailures(days)`. The `no_key` reason is written ONCE per process per model by the gateway itself (not per query by `applyReranker`): the provider key is absent, so calls are skipped without HTTP and results pass through unreranked; `auth` means key present but rejected. Deliberately no `logRerankSuccess`: writing once per tokenmax search is hot-path I/O churn AND success events leak query volume + timing into a local audit file. `gbrain doctor`'s `reranker_health` check (`doctor/checks/calibration.ts`) resolves enablement + model through `resolveSearchMode(loadSearchModeConfig)` — the plane search reranks with — and `rerankerReadiness` before reading the audit: readiness is evaluated against the DB-merged config plane (`loadConfigWithEngine`, so DB-plane provider keys and `provider_base_urls` self-host overrides count, exactly like the gateway the CLI configures): a brain with NO embedding provider (`isAvailable('embedding')` false on a configured gateway) is `ok` even when not ready — search runs keyword-only there and never reaches `applyReranker`, so there is nothing to fix; otherwise enabled-but-not-ready (key absent / unknown model) warns with the paste-ready fix; only audit rows for the RESOLVED model count (rows for any other model never make the live default warn or send the operator to verify the wrong key); `no_key` skip rows are informational once ready (those processes ran unreranked; a long-lived worker started before the key was added keeps skipping until restarted) and never outlive the fix as a warn; then the auth / payload / budget / transient / unknown ladders on the non-skip rows; disabled → ok (with an enable hint when the default is ready). Query text SHA-256-prefix-hashed (8 hex chars) for privacy. `GBRAIN_AUDIT_DIR` env override honored via the shared `resolveAuditDir()`.
-- `src/core/runtime-version.ts` — Bun 1.3.11 minimum enforced by the CLI entrypoint and guarded HTTP transport, with upgrade/restart guidance. Package engines and runtime checks share the same supported floor.
+- `src/core/runtime-version.ts` — Bun 1.4.0 minimum (`MINIMUM_BUN_VERSION`; the lowest 1.4 release, carrying the Linux child-exit fix oven-sh/bun#30301). `unsupportedBunMessage` names the found and required versions and the fix (`bun upgrade`, restart, `gbrain post-upgrade` for an interrupted upgrade). `exitOnUnsupportedBun` is the CLI entrypoint gate: every command below the floor exits 1 before dispatch (`--version` still prints, exit 0, so an older gbrain's upgrade can verify the swap; `autopilot` also writes the refusal to stdout, its service log); `scripts/postinstall.ts` prints it when an install lands on an older Bun; the guarded HTTP transport asserts it; doctor reports it as `bun_runtime`. Package engines, runtime checks and the CI minimum-version lanes share the same floor (`test/scripts/ci-pr-scope.test.ts`).
- `src/core/sort-newest-first.ts` — single source of truth for the descending-lex sort that `gbrain import` and `gbrain sync` both apply. Mutates in place (Array.prototype.sort semantics), returns the same array reference for fluent chaining. Empty/single-element inputs short-circuit. Future ordering changes flip one line here instead of touching two CLI commands. Pinned by `test/sort-newest-first.test.ts` (descending order, mixed prefixes, empty, single-element, in-place-mutation contract).
diff --git a/docs/architecture/key-files/files-and-sync-1.md b/docs/architecture/key-files/files-and-sync-1.md
index 22cf7ca243..7a8fe494fd 100644
--- a/docs/architecture/key-files/files-and-sync-1.md
+++ b/docs/architecture/key-files/files-and-sync-1.md
@@ -5,7 +5,7 @@ Current behavior and load-bearing invariants; history belongs in Git and CHANGEL
- `src/core/audit-week-file.ts` — single source of truth for ISO-week audit JSONL filename math. Exports `isoWeek(d)`, `isoWeekFilename(prefix, now?)`, `resolveAuditDir()` (honors `GBRAIN_AUDIT_DIR`). Year-boundary correctness pinned by tests at 2020-W53 (the 53-week year), 2025-W01 rolling in from 2024-12-30 (Monday), 2026-W01. Four call sites: `src/core/minions/handlers/shell-audit.ts`, `src/core/facts/phantom-audit.ts`, `src/core/audit-slug-fallback.ts`, `src/core/cycle/budget-meter.ts`. Each keeps its `compute<X>AuditFilename` thin wrapper.
-- `src/core/brain-repo-durability.ts` + `src/commands/sources-harden.ts` — brain-repo git durability. `hardenBrainRepo(opts)` makes a brain's working tree durable, idempotently: divergence-safe pull, a LOCAL untracked `.git/hooks/post-commit` auto-push safety net (never committed — a pulled commit can't rewrite executed code next to the token; installed into the active `core.hooksPath` dir and excluded via `.git/info/exclude` when that dir is tracked), a committed `scripts/brain-commit-push.sh` that refuses to exit 0 without a successful push or confirmation that the exact destination branch on origin contains the attempted commit and stages+commits BEFORE any pull so a dirty tree of modified pages (the write-through shape) can still be committed — the push-retry's rebase-on-reject handles a remote that advanced (hook + helper render from ONE bash push-retry template — DRY at the TS source, not by the hook sourcing a repo-controlled script), durability rules patched into the active resolver file (`findResolverFile` → RESOLVER.md > AGENTS.md; taxonomy rendered from the bundled `_brain-filing-rules.json`), a minimal DB-free pull cron (launchd/crontab running `gbrain sources pull --path <dir>` so it never opens the PGLite single-writer lock), and a push-probe verify (no heartbeat commit). Credential is REPO-scoped (`acceptPat` from `--pat-file`/`GBRAIN_GITHUB_PAT`, warns on loose perms; reuses an existing repo-local `credential.helper`, else a `0600` store wired via repo-local config); the token is redacted everywhere via `redactSecretsInText` and never enters the repo, remote URL, logs, or `DurabilityReport`. `unhardenBrainRepo` removes the cron/hook/credential wiring (ownership-fingerprinted); `sources remove` runs it only AFTER the source row's DELETE commits (a refused or raced delete leaves the scaffolding intact; post-commit teardown failure is loud but non-fatal). CLI: `gbrain sources harden <id|--all>` / `pull <id>|--path <dir>` / `unharden <id>`; auto-harden fires on `sources add --url ... --pat-file` for managed clones (`--no-harden` opts out). `sources pull --path` is dispatched in `src/cli.ts` BEFORE `connectEngine` so the cron stays DB-free. CLI-only (writes executables + an OS cron + a credential helper on the host); never exposed over MCP. `isDurabilityHardened(repoPath)` (the durability hook banner is installed) and `commitWriteThroughFile(repoPath, absPath, slug, action = 'write-through')` are the shared helpers every write-through sink (page write/delete, facts fence, timeline, lint --fix) uses to best-effort commit ONE file path-limited on a hardened repo — never throws, false on any failure; `action` only labels the subject (`gbrain: <action> <slug>`; `'delete write-through'` for removals). `isDurabilityHardenedAsync(repoPath)` is the non-blocking probe long-running persistence owners use; it and the persistence Git runner (`effect-git.ts`) spawn through `execFileBounded`, which settles at its deadline or on abort from its own timer because Bun 1.3.x can drop a child's exit and pipe events when bun:test `expect().resolves/.rejects` re-enters the event loop (oven-sh/bun#30301); an unbounded wait there stranded `disposePersistenceConsumer` and hung every later test in the file (test: `test/bounded-child-exec.test.ts`). Tests: `test/brain-repo-durability.serial.test.ts`, `test/git-remote-durable.serial.test.ts`, `test/brain-durability-hook.serial.test.ts`, `test/durability-cron.test.ts`. `brain_remote_contains_commit` checks the exact `refs/heads/<branch>` at every effective push URL, fetches each advertised tip without writing `FETCH_HEAD`, and proves ancestry of the captured commit; branch existence, a different fetch destination, or a stale tracking ref is not enough. Probe diagnostics are suppressed, ambiguous URL resolution fails closed, and recovery is skipped if local HEAD has moved since the failed push. This check runs after a rejected push and after retry failure, logging `ok-already-on-remote` on confirmation; `getLastPushOutcome` recognizes it as success. Existing unmanaged installations must rerun `gbrain sources harden <source-id>` to refresh both the local hook and committed helper; upgrading the CLI alone does not rewrite those scripts. Managed worktrees retain the persistence outbox as their Git writer; generated legacy helpers refuse to bypass it. `GBRAIN_PUSH_LOCK_WAIT_SECONDS` (default 30, env-only) tunes the `flock -w` wait in the rendered push-retry block that both the committed helper and the local hook share; on lock timeout the synchronous helper returns rc 1 (fail-loud, no push was attempted) while the detached post-commit hook returns rc 0 (another holder is already pushing — the designed coalescing outcome).
+- `src/core/brain-repo-durability.ts` + `src/commands/sources-harden.ts` — brain-repo git durability. `hardenBrainRepo(opts)` makes a brain's working tree durable, idempotently: divergence-safe pull, a LOCAL untracked `.git/hooks/post-commit` auto-push safety net (never committed — a pulled commit can't rewrite executed code next to the token; installed into the active `core.hooksPath` dir and excluded via `.git/info/exclude` when that dir is tracked), a committed `scripts/brain-commit-push.sh` that refuses to exit 0 without a successful push or confirmation that the exact destination branch on origin contains the attempted commit and stages+commits BEFORE any pull so a dirty tree of modified pages (the write-through shape) can still be committed — the push-retry's rebase-on-reject handles a remote that advanced (hook + helper render from ONE bash push-retry template — DRY at the TS source, not by the hook sourcing a repo-controlled script), durability rules patched into the active resolver file (`findResolverFile` → RESOLVER.md > AGENTS.md; taxonomy rendered from the bundled `_brain-filing-rules.json`), a minimal DB-free pull cron (launchd/crontab running `gbrain sources pull --path <dir>` so it never opens the PGLite single-writer lock), and a push-probe verify (no heartbeat commit). Credential is REPO-scoped (`acceptPat` from `--pat-file`/`GBRAIN_GITHUB_PAT`, warns on loose perms; reuses an existing repo-local `credential.helper`, else a `0600` store wired via repo-local config); the token is redacted everywhere via `redactSecretsInText` and never enters the repo, remote URL, logs, or `DurabilityReport`. `unhardenBrainRepo` removes the cron/hook/credential wiring (ownership-fingerprinted); `sources remove` runs it only AFTER the source row's DELETE commits (a refused or raced delete leaves the scaffolding intact; post-commit teardown failure is loud but non-fatal). CLI: `gbrain sources harden <id|--all>` / `pull <id>|--path <dir>` / `unharden <id>`; auto-harden fires on `sources add --url ... --pat-file` for managed clones (`--no-harden` opts out). `sources pull --path` is dispatched in `src/cli.ts` BEFORE `connectEngine` so the cron stays DB-free. CLI-only (writes executables + an OS cron + a credential helper on the host); never exposed over MCP. `isDurabilityHardened(repoPath)` (the durability hook banner is installed) and `commitWriteThroughFile(repoPath, absPath, slug, action = 'write-through')` are the shared helpers every write-through sink (page write/delete, facts fence, timeline, lint --fix) uses to best-effort commit ONE file path-limited on a hardened repo — never throws, false on any failure; `action` only labels the subject (`gbrain: <action> <slug>`; `'delete write-through'` for removals). `isDurabilityHardenedAsync(repoPath)` is the non-blocking probe long-running persistence owners use; it and the persistence Git runner (`effect-git.ts`) spawn through `execFileBounded`, which settles at its deadline or on abort from its own timer because Bun can drop a child's pipe events (still on 1.4.2) and, before 1.3.14, its exit event (oven-sh/bun#30301) when bun:test `expect().resolves/.rejects` re-enters the event loop; an unbounded wait there stranded `disposePersistenceConsumer` and hung every later test in the file (test: `test/bounded-child-exec.test.ts`). Tests: `test/brain-repo-durability.serial.test.ts`, `test/git-remote-durable.serial.test.ts`, `test/brain-durability-hook.serial.test.ts`, `test/durability-cron.test.ts`. `brain_remote_contains_commit` checks the exact `refs/heads/<branch>` at every effective push URL, fetches each advertised tip without writing `FETCH_HEAD`, and proves ancestry of the captured commit; branch existence, a different fetch destination, or a stale tracking ref is not enough. Probe diagnostics are suppressed, ambiguous URL resolution fails closed, and recovery is skipped if local HEAD has moved since the failed push. This check runs after a rejected push and after retry failure, logging `ok-already-on-remote` on confirmation; `getLastPushOutcome` recognizes it as success. Existing unmanaged installations must rerun `gbrain sources harden <source-id>` to refresh both the local hook and committed helper; upgrading the CLI alone does not rewrite those scripts. Managed worktrees retain the persistence outbox as their Git writer; generated legacy helpers refuse to bypass it. `GBRAIN_PUSH_LOCK_WAIT_SECONDS` (default 30, env-only) tunes the `flock -w` wait in the rendered push-retry block that both the committed helper and the local hook share; on lock timeout the synchronous helper returns rc 1 (fail-loud, no push was attempted) while the detached post-commit hook returns rc 0 (another holder is already pushing — the designed coalescing outcome).
- `src/core/content-sanity-literals.ts` — operator literal-substring loader. Reads `~/.gbrain/junk-substrings.txt`, one literal per non-comment non-blank line; optional `# name=<id>` header pairs an identifier with the following literal so audit JSONL groups by site (`linkedin_auth_wall`, `reddit_blocked`, etc.). Fail-soft on ENOENT (missing file = empty array). Loaded on every ingest. Deliberately literal substrings (NOT regex) to defeat ReDoS. Pinned by `test/content-sanity-literals.test.ts`.
diff --git a/docs/architecture/key-files/security.md b/docs/architecture/key-files/security.md
index 0f20144975..3aad12214f 100644
--- a/docs/architecture/key-files/security.md
+++ b/docs/architecture/key-files/security.md
@@ -11,7 +11,7 @@ Current behavior and load-bearing invariants; history belongs in Git and CHANGEL
- `src/core/grants/lifecycle.ts` + `src/commands/serve-http-clients.ts` — owner-authenticated client inspection, setup, export and lifecycle endpoints. Token invalidation/revoke/delete lock the OAuth client row, require reviewed revisions and explicit application, and commit an audit record atomically. Deletion records a tombstone while preserving request history and spending reservations/settlement; missing clients become terminal delegated denials while transient lookup failures remain retryable.
-- `src/core/guarded-http.ts` + `src/core/ssrf-validate.ts` — DNS answer classification, validated-address connections with original TLS/HTTP hostname and port, shared deadline/redirect policy, header-only probes, and bounded gzip/deflate/Brotli decoding. Ambient proxies fail closed with restart guidance. Consumers: URL reachability, remote images, and HTTP integration checks. Real TLS fixtures run on Bun 1.3.11 and 1.4.2.
+- `src/core/guarded-http.ts` + `src/core/ssrf-validate.ts` — DNS answer classification, validated-address connections with original TLS/HTTP hostname and port, shared deadline/redirect policy, header-only probes, and bounded gzip/deflate/Brotli decoding. Ambient proxies fail closed with restart guidance. Consumers: URL reachability, remote images, and HTTP integration checks. Real TLS fixtures run on Bun 1.4.0 and 1.4.2.
- `src/core/guardrails.ts` — vendor-neutral content guardrail seams (`registerGuardrailProvider`, `classify`). `loadGuardrailProvidersFromEnv(env = process.env, opts?: { cwd, skipCwdCheck })` accepts ONLY an absolute path or a `~/` path for `GBRAIN_GUARDRAILS_MODULE`; cwd-relative specs (`./`, `../`, bare `.`) and bare package specifiers (`pkg`, `@scope/pkg`, `pkg/sub` — in the compiled binary Bun's module walk-up starts at the cwd, so a hostile checkout's `node_modules/<name>/` would load) throw `GuardrailLoadError` before any import, and when `env` is `process.env` (or `opts.cwd` is given) a spec that a cwd .env file assigns is refused via `cwdDotenvAssignsKey` (message composed from env-trust's `CWD_DOTENV_REMEDIATION`) unless `opts.skipCwdCheck` (preflight's cwd == config-dir case). node:path/url/os are static imports. Registration is counted by EVENTS against a pre-import baseline so import-time side-effect registration and same-id replacement are accepted (#3688 residual). Pinned by `test/guardrails.test.ts` + `test/guardrails-env-load.test.ts`.
diff --git a/docs/guides/authorization-upgrade.md b/docs/guides/authorization-upgrade.md
index 4cbea5961d..ccf3abdf59 100644
--- a/docs/guides/authorization-upgrade.md
+++ b/docs/guides/authorization-upgrade.md
@@ -10,7 +10,7 @@ uses `gbrain jobs authorize-legacy` to preview selected work for review.
## Runtime and outbound requests
-Use Bun **1.3.11 or newer**. CI covers 1.3.11 and the build runtime, 1.4.2.
+Use Bun **1.4.0 or newer**; run `bun upgrade` on an older Bun. CI covers 1.4.0 and the build runtime, 1.4.2.
Compiled distributions include their Bun runtime.
URL reachability checks, HTTP integration checks, and remote image loading use
diff --git a/llms-full.txt b/llms-full.txt
index 5529f172c4..2024d108fd 100644
--- a/llms-full.txt
+++ b/llms-full.txt
@@ -2421,7 +2421,7 @@ If you fetched this file by URL without cloning yet, the companion files live at
> garrytan/gbrain` + `/plugin install gbrain@gbrain`). Details:
> docs/mcp/CODEX.md and docs/mcp/CLAUDE_CODE.md.
-Default path (Bun is required — gbrain is a Bun + TypeScript runtime):
+Default path (Bun 1.4.0 or newer is required — gbrain is a Bun + TypeScript runtime; on an older Bun, run `bun upgrade` first):
```bash
curl -fsSL https://bun.sh/install | bash
@@ -3299,7 +3299,7 @@ This is the difference between a search engine and a brain. Search finds the pag
## Install
-Requires **Bun 1.3.11 or newer**. Existing worker installations should follow the
+Requires **Bun 1.4.0 or newer**. Existing worker installations should follow the
[authorization and queue upgrade guide](docs/guides/authorization-upgrade.md)
before restarting services with this version.
diff --git a/native/locks/README.md b/native/locks/README.md
index 887a6a2050..8c9ef2356c 100644
--- a/native/locks/README.md
+++ b/native/locks/README.md
@@ -42,7 +42,7 @@ All eight addons are checked in, so source installs work with
`bun install --frozen-lockfile --ignore-scripts`. They support x64 and arm64
on Linux glibc (2.17 ABI baseline), Linux musl, macOS (13.0 deployment
target), and Windows. The required CI matrix covers the repository's minimum
-Bun 1.3.11, Bun 1.3.13, and the release compiler, Bun 1.4.2. OS compatibility
+Bun 1.4.0 and the release compiler, Bun 1.4.2. OS compatibility
also requires the selected Bun version's own platform minimums.
Node-API headers and their upstream license are vendored from Node
diff --git a/openclaw.plugin.json b/openclaw.plugin.json
index f7c4566703..654531841d 100644
--- a/openclaw.plugin.json
+++ b/openclaw.plugin.json
@@ -1,7 +1,7 @@
{
"id": "gbrain-context-engine",
"name": "gbrain",
- "version": "0.60.26.0",
+ "version": "0.60.27.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 0dc9cf95d4..84398a877b 100644
--- a/package.json
+++ b/package.json
@@ -201,10 +201,10 @@
"@electric-sql/pglite"
],
"engines": {
- "bun": ">=1.3.11"
+ "bun": ">=1.4.0"
},
"license": "MIT",
- "version": "0.60.26.0",
+ "version": "0.60.27.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 37b0db515c..5c3bb914cc 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.26.0",
+ "version": "0.60.27.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 2ce0a9ea3f..123ba5239b 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.26.0",
+ "version": "0.60.27.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 8af9ca6c6d..1b0f815ce8 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.26.0 -->
+<!-- gbrain-plugin-tree-stamp: 0.60.27.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 fc29409813..4566b7eccc 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.26.0",
+ "version": "0.60.27.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 a9f2fb6043..01f5f304fa 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.26.0",
+ "version": "0.60.27.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 b61ce2207f..46e4aefd15 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.26.0 -->
+<!-- gbrain-plugin-tree-stamp: 0.60.27.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 a955067c28..b9d60822e6 100644
--- a/plugin/README.md
+++ b/plugin/README.md
@@ -1,4 +1,4 @@
-<!-- gbrain-plugin-tree-stamp: 0.60.26.0 -->
+<!-- gbrain-plugin-tree-stamp: 0.60.27.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/e2e-matrix.ts b/scripts/e2e-matrix.ts
index 176ba2d445..4b47ff04a7 100644
--- a/scripts/e2e-matrix.ts
+++ b/scripts/e2e-matrix.ts
@@ -6,7 +6,7 @@ import { resolve, relative, isAbsolute } from "node:path";
import { loadWeights, partition, type WeightMap } from "./sharding.ts";
// PR owner of the reconciliation crash suites is persistence-validation.yml
-// (called from test.yml on every PR; postgres x Bun 1.3.11/1.4.2; crash
+// (called from test.yml on every PR; postgres x Bun 1.4.0/1.4.2; crash
// manifests uploaded). Nightly full-corpus E2E still runs them.
export const PERSISTENCE_VALIDATION_OWNED = new Set([
'test/e2e/reconcile-crash.test.ts',
diff --git a/scripts/persistence/README.md b/scripts/persistence/README.md
index 6cd28c0de9..35a35c9c48 100644
--- a/scripts/persistence/README.md
+++ b/scripts/persistence/README.md
@@ -99,7 +99,7 @@ never a connection URL. Keep the retained directory private: its original
the diagnostic manifest. Successful runs retain no fixtures.
`persistence-validation.yml` runs the full gate on Linux x64 for both engines
-under Bun 1.3.11 and 1.4.2 and uploads every manifest. Native OS/architecture
+under Bun 1.4.0 and 1.4.2 and uploads every manifest. Native OS/architecture
coverage is separately required by `native-locks.yml`; its configured matrix
must not be mistaken for locally executed runtime evidence.
diff --git a/scripts/postinstall.ts b/scripts/postinstall.ts
index fe89a90649..42e1788e3d 100644
--- a/scripts/postinstall.ts
+++ b/scripts/postinstall.ts
@@ -20,6 +20,16 @@
// to quote). It NEVER fails the install: every path exits 0.
import { which } from 'bun';
+import { unsupportedBunMessage } from '../src/core/runtime-version.ts';
+
+// The install itself runs on the user's Bun, so this is the first place an
+// upgrade onto a newer Bun floor can say so. Nothing else here would work:
+// every gbrain command refuses until Bun is upgraded.
+const runtimeRefusal = unsupportedBunMessage();
+if (runtimeRefusal) {
+ console.error(`[gbrain] Installed, but gbrain will not start on this Bun.\n${runtimeRefusal}`);
+ process.exit(0);
+}
const HINT =
'[gbrain] postinstall skipped. If installed via bun install -g github:...: ' +
diff --git a/scripts/structural-suites.tsv b/scripts/structural-suites.tsv
index 871f745869..df1966eb10 100644
--- a/scripts/structural-suites.tsv
+++ b/scripts/structural-suites.tsv
@@ -237,6 +237,7 @@ test/reranker-default-seam.test.ts DEFAULT_RERANKER_MODEL seam (#3657, flipped v
test/resolver.test.ts RESOLVER.md trigger round-trip (D5/C) 2 readFileSync
test/resolver.test.ts Skill example-name validator (D13) 4 readFileSync
test/retrieval-reflex-recipe-routing.test.ts retrieval-reflex recipe routing is MECE with the query skill (#4292) 5 readFileSync
+test/runtime-version.test.ts stated Bun floor 1 readFileSync
test/schema-bootstrap-coverage.test.ts (file-level) 14 source-surface-helper
test/schema-pack-unify-types-handler.test.ts #1575 unify-types worker dry-run default 1 source-surface-helper
test/schema-pack/suggest.test.ts runSuggest — source-text contract (structural) 1 readFileSync
diff --git a/skills/migrations/v0.60.27.0.md b/skills/migrations/v0.60.27.0.md
new file mode 100644
index 0000000000..c40cb558f8
--- /dev/null
+++ b/skills/migrations/v0.60.27.0.md
@@ -0,0 +1,56 @@
+# Upgrade to v0.60.27.0: GBrain now needs Bun 1.4.0 or newer
+
+Older Bun releases had a bug where a finished child process could go
+unnoticed, so GBrain could wait forever on a helper process that had already
+exited. Bun 1.4 carries the fix, and this release makes Bun 1.4.0 the minimum. On an older Bun
+every `gbrain` command, including `serve`, `jobs work`, hooks and autopilot,
+stops at startup with:
+
+```
+GBrain requires Bun 1.4.0 or newer (found Bun 1.3.x).
+Fix: run `bun upgrade`, then restart GBrain. If a `gbrain upgrade` stopped here, finish it with `gbrain post-upgrade`.
+```
+
+`gbrain --version` still answers on an older Bun. Compiled release binaries
+carry their own Bun 1.4.2 and need nothing. There is no schema change and no
+config change.
+
+Upgrading Bun changes the user's runtime for every Bun program on the machine,
+so ask before running `bun upgrade` on their behalf.
+
+1. **Check the runtime.** Run `bun --version` on the brain host (and on any
+ machine running a source-installed thin client). If it prints 1.4.0 or
+ newer, or the user runs a compiled `gbrain` binary, skip to step 4.
+
+2. **Upgrade Bun, with the user's agreement.**
+ ```bash
+ bun upgrade
+ bun --version # 1.4.0 or newer
+ ```
+ A Bun installed by a package manager upgrades through it instead
+ (`brew upgrade oven-sh/bun/bun`, `npm install -g bun`). If `bun --version`
+ still shows the old version, an older `bun` comes first on `PATH`; find it
+ with `which -a bun`.
+
+3. **Finish the GBrain upgrade.** If `gbrain upgrade` ran on the old Bun, its
+ migrations stopped at the runtime check. Run:
+ ```bash
+ gbrain post-upgrade
+ ```
+ It is idempotent, so running it when nothing is pending is harmless.
+
+4. **Restart long-running GBrain processes** so they pick up the new runtime:
+ a `gbrain serve` (stdio MCP: restart the agent harness; HTTP: restart the
+ service), a `gbrain jobs supervisor`, and autopilot. Services managed by
+ launchd, systemd or cron retry on their own and come back once Bun is
+ upgraded; their refusal lines are in `~/.gbrain/autopilot.log` and
+ `~/.gbrain/autopilot.err`.
+
+5. **Verify.**
+ ```bash
+ gbrain doctor
+ ```
+ `bun_runtime` reports `Bun 1.4.x (minimum 1.4.0)`. If `upgrade_errors`
+ still points at a post-upgrade failure from the old runtime, run
+ `gbrain apply-migrations --yes --no-autopilot-install` once and re-run
+ `gbrain doctor`.
diff --git a/skills/skills.lock.json b/skills/skills.lock.json
index 4195df7127..7941f4246a 100644
--- a/skills/skills.lock.json
+++ b/skills/skills.lock.json
@@ -154,6 +154,7 @@
"migrations/v0.60.11.0.md": "ad3086df4eceff272f08bf16d674be404b97963292729b280f44268c583f77c5",
"migrations/v0.60.20.0.md": "9266863a9f76164c64a72b1be17b8ddb3bb97e1c3c5db9f666b69ebc7a228fdd",
"migrations/v0.60.26.0.md": "30d761ef5a2361bad66053f97b7b659304a591274be33e281f4f6df0d7d5566e",
+ "migrations/v0.60.27.0.md": "1c3ac6a23ccfce8ad299457799b02958f7d21fcd967c471634f73bdb66f2b603",
"migrations/v0.60.5.0.md": "0d3ee19359a2740de08ac9ec388ddc15e7c72d663afe33832e1e54170528acab",
"migrations/v0.60.6.0.md": "1cbfca2c899e1348acbd61f0baa4c8e723b5283ff868c710c74e116c0cb6726e",
"migrations/v0.7.0.md": "97c2740445a10b1c5c7123c17dbd625fa27a94095b85d27c2b278da756c4c59a",
diff --git a/src/cli.ts b/src/cli.ts
index 37f90faeb1..8256406007 100755
--- a/src/cli.ts
+++ b/src/cli.ts
@@ -47,7 +47,7 @@ import { maybePromptForUpgrade } from './core/thin-client-upgrade-prompt.ts';
import { CLI_FLAG_REGISTRY } from './core/cli-flag-registry.generated.ts';
import { migrationCliArgumentError } from './core/embedding-migration-cli.ts';
import { VERSION } from './version.ts';
-import { assertSupportedBun } from './core/runtime-version.ts';
+import { exitOnUnsupportedBun } from './core/runtime-version.ts';
import { bigintToStringReplacer } from './core/utils.ts';
import {
CLI_ONLY,
@@ -3095,11 +3095,7 @@ Run gbrain <command> --help for command-specific help.
// process alive. A fatal error still exits 1 for every command, daemons
// included (matches the prior unconditional process.exit(1) on rejection).
if (import.meta.main) {
- try { assertSupportedBun(); }
- catch (error) {
- console.error((error as Error).message);
- process.exit(1);
- }
+ exitOnUnsupportedBun(process.argv[2], VERSION);
// v0.41.6.0 D5: cleanup registry + signal handlers for SIGTERM/SIGHUP/SIGPIPE/
// uncaughtException. NOT SIGINT (the existing AbortController path owns SIGINT).
// Installed before main() so locks acquired during boot (e.g. connectEngine's
diff --git a/src/commands/doctor/checks/local-runtime.ts b/src/commands/doctor/checks/local-runtime.ts
index ebfa680b05..271ee2b2bd 100644
--- a/src/commands/doctor/checks/local-runtime.ts
+++ b/src/commands/doctor/checks/local-runtime.ts
@@ -12,7 +12,7 @@ import { compareVersions } from '../../migrations/index.ts';
import { bootstrapDoctorChecks } from '../bootstrap-checks.ts';
import { buildMemorableRelayCheck } from './integrations-memorable.ts';
import { buildMemoryWritebackCheck } from './memory-writeback.ts';
-import { checkSelfUpgradeHealth, checkUpgradeErrors } from './upgrade-health.ts';
+import { checkBunRuntime, checkSelfUpgradeHealth, checkUpgradeErrors } from './upgrade-health.ts';
import type { Check } from '../../doctor.ts';
import type { DoctorContext, DoctorEntry } from '../context.ts';
@@ -199,11 +199,12 @@ async function runMinionsMigration(ctx: DoctorContext): Promise<Check[]> {
// so a wedged auto-upgrade loop was invisible exactly where it would be
// diagnosed. Sits beside the upgrade_errors trail it complements.
checks.push(checkSelfUpgradeHealth());
+ checks.push(checkBunRuntime());
return checks;
}
export const minionsMigrationEntry: DoctorEntry = {
name: 'minions_migration',
- emits: ['minions_migration', 'upgrade_errors', 'self_upgrade_health'],
+ emits: ['minions_migration', 'upgrade_errors', 'self_upgrade_health', 'bun_runtime'],
run: runMinionsMigration,
};
diff --git a/src/commands/doctor/checks/upgrade-health.ts b/src/commands/doctor/checks/upgrade-health.ts
index 98cb0b0ffc..4db360be6d 100644
--- a/src/commands/doctor/checks/upgrade-health.ts
+++ b/src/commands/doctor/checks/upgrade-health.ts
@@ -1,6 +1,7 @@
/**
* Upgrade trail checks: `upgrade_errors` (post-upgrade failure ledger with the
- * #4517 superseded-record re-verification) and `self_upgrade_health`.
+ * #4517 superseded-record re-verification), `self_upgrade_health` and
+ * `bun_runtime`.
* Peeled verbatim from doctor.ts (refactor wave 1, W4 doctor); doctor.ts
* re-exports every symbol under its original name.
*/
@@ -9,6 +10,7 @@ import { existsSync, readFileSync } from 'fs';
import type { BrainEngine } from '../../../core/engine.ts';
import { gbrainPath } from '../../../core/config.ts';
import { LATEST_VERSION } from '../../../core/migrate.ts';
+import { MINIMUM_BUN_VERSION, unsupportedBunMessage } from '../../../core/runtime-version.ts';
import { VERSION as GBRAIN_BINARY_VERSION } from '../../../version.ts';
import type { Check } from '../../doctor.ts';
@@ -160,3 +162,14 @@ export async function checkUpgradeErrors(
return null;
}
}
+
+/**
+ * The running Bun against the supported floor. The CLI refuses to start below
+ * it, so a local doctor normally reports ok; the fail row keeps the fix
+ * command for any caller that reaches doctor on an older runtime.
+ */
+export function checkBunRuntime(version = typeof Bun === 'undefined' ? '' : Bun.version): Check {
+ const refusal = unsupportedBunMessage(version);
+ if (refusal) return { name: 'bun_runtime', status: 'fail', message: refusal.replaceAll('\n', ' ') };
+ return { name: 'bun_runtime', status: 'ok', message: `Bun ${version} (minimum ${MINIMUM_BUN_VERSION})` };
+}
diff --git a/src/core/brain-repo-durability.ts b/src/core/brain-repo-durability.ts
index cc9df5e1fd..b90dc7a13b 100644
--- a/src/core/brain-repo-durability.ts
+++ b/src/core/brain-repo-durability.ts
@@ -501,9 +501,10 @@ export interface BoundedExecOptions {
/**
* `execFile` that settles within `timeout` or on abort even when the runtime
- * never delivers the child's exit or pipe close. Bun through 1.3.x drops
- * one-shot pidfd and pipe events when a callback re-enters the event loop
- * (bun:test `expect().resolves/.rejects`, oven-sh/bun#30301): execFile's
+ * never delivers the child's exit or pipe close. Bun drops one-shot pipe
+ * events (and, before 1.3.14, pidfd exit events: oven-sh/bun#30301) when a
+ * callback re-enters the event loop (bun:test `expect().resolves/.rejects`;
+ * pipe loss still reproduces on 1.4.2): execFile's
* callback and its own `timeout` then never fire and the child stays a zombie,
* so the deadline and abort are enforced with our own timer.
*
diff --git a/src/core/doctor-categories.ts b/src/core/doctor-categories.ts
index 7a41442fee..fa82f8bc8e 100644
--- a/src/core/doctor-categories.ts
+++ b/src/core/doctor-categories.ts
@@ -227,6 +227,7 @@ export const OPS_CHECK_NAMES: ReadonlySet<string> = new Set([
'decide_health',
'pool_reap_health',
'self_upgrade_health',
+ 'bun_runtime',
'stale_locks',
'subagent_capability',
'subagent_health',
diff --git a/src/core/guarded-http.ts b/src/core/guarded-http.ts
index eddfbdf6e2..c2785d0947 100644
--- a/src/core/guarded-http.ts
+++ b/src/core/guarded-http.ts
@@ -1,7 +1,8 @@
/**
* The only network adapter for untrusted URLs. The caller has already checked
* every DNS answer; connect to that literal while preserving the HTTP authority
- * and TLS identity. Bun >= 1.3.11 is required for explicit TLS serverName.
+ * and TLS identity. Explicit TLS serverName needs the supported Bun floor
+ * (MINIMUM_BUN_VERSION in runtime-version.ts).
*
* Bun's native fetch and node:http wrapper cannot reliably disable environment
* proxies per request. Fail closed in that environment: a proxy could resolve
diff --git a/src/core/runtime-version.ts b/src/core/runtime-version.ts
index 7336bba4cf..fb376986c5 100644
--- a/src/core/runtime-version.ts
+++ b/src/core/runtime-version.ts
@@ -1,10 +1,35 @@
-/** Required for the guarded transport's TLS identity and connection behavior. */
-export const MINIMUM_BUN_VERSION = '1.3.11';
+/**
+ * Lowest supported Bun: contains the Linux child-exit fix (oven-sh/bun#30301)
+ * and the guarded transport's explicit TLS serverName support.
+ */
+export const MINIMUM_BUN_VERSION = '1.4.0';
-export function assertSupportedBun(version = typeof Bun === 'undefined' ? '' : Bun.version): void {
- if (!/^\d+\.\d+\.\d+(?:\+.*)?$/.test(version) || !Bun.semver.satisfies(version, `>=${MINIMUM_BUN_VERSION}`)) {
- const error = new Error(`GBrain requires Bun ${MINIMUM_BUN_VERSION} or newer. Run bun upgrade, then restart GBrain.`);
- Object.assign(error, { code: 'UNSUPPORTED_RUNTIME' });
- throw error;
+export function unsupportedBunMessage(version = typeof Bun === 'undefined' ? '' : Bun.version): string | null {
+ if (/^\d+\.\d+\.\d+(?:\+.*)?$/.test(version) && Bun.semver.satisfies(version, `>=${MINIMUM_BUN_VERSION}`)) return null;
+ return `GBrain requires Bun ${MINIMUM_BUN_VERSION} or newer (found ${version ? `Bun ${version}` : 'no Bun runtime'}).\n`
+ + 'Fix: run `bun upgrade`, then restart GBrain. If a `gbrain upgrade` stopped here, finish it with `gbrain post-upgrade`.';
+}
+
+export function assertSupportedBun(version?: string): void {
+ const message = unsupportedBunMessage(version);
+ if (message) throw Object.assign(new Error(message), { code: 'UNSUPPORTED_RUNTIME' });
+}
+
+/**
+ * The CLI entrypoint gate: below the floor every command exits 1 before any
+ * work starts. `--version` still answers (exit 0, refusal on stderr) so an
+ * upgrade run by an older gbrain can confirm the swapped version. Autopilot
+ * services log stdout to autopilot.log and stderr to an unsurfaced
+ * autopilot.err, so its refusal goes to both.
+ */
+export function exitOnUnsupportedBun(command: string | undefined, cliVersion: string, version?: string): void {
+ const refusal = unsupportedBunMessage(version);
+ if (!refusal) return;
+ console.error(refusal);
+ if (command === '--version' || command === 'version') {
+ console.log(`gbrain ${cliVersion}`);
+ process.exit(0);
}
+ if (command === 'autopilot') console.log(`${new Date().toISOString()} [autopilot] ${refusal}`);
+ process.exit(1);
}
diff --git a/templates/bootstrap/cloud-setup-script.sh b/templates/bootstrap/cloud-setup-script.sh
index 21154b7377..dc46884c1c 100644
--- a/templates/bootstrap/cloud-setup-script.sh
+++ b/templates/bootstrap/cloud-setup-script.sh
@@ -5,9 +5,15 @@
# reused by later sessions). Printed by: gbrain bootstrap cloud-setup-script
set -eu
-# 1. Bun runtime (gbrain runs on bun). Installed VIA npm — bun's own package
-# fetching is proxy-incompatible in cloud sandboxes; npm's is not.
-command -v bun >/dev/null 2>&1 || npm install -g bun
+# 1. Bun runtime, at least GBrain's minimum (1.4.0; older Bun is refused).
+# Installed VIA npm — bun's own package fetching is proxy-incompatible in
+# cloud sandboxes; npm's is not. A preinstalled older Bun stays untouched.
+GBRAIN_BUN=$(command -v bun || true)
+if [ -z "$GBRAIN_BUN" ] || ! "$GBRAIN_BUN" -e 'process.exit(Bun.semver.satisfies(Bun.version, ">=1.4.0") ? 0 : 1)'; then
+ npm install -g bun
+ GBRAIN_BUN="$(npm prefix -g)/bin/bun"
+fi
+export PATH="$(dirname "$GBRAIN_BUN"):$PATH"
# 2. gbrain from the canonical GitHub source. NEVER `npm install -g gbrain`:
# the npm registry package with that name is unrelated squatter code.
@@ -27,9 +33,9 @@ npm install --no-audit --no-fund
# 3. PATH-resolved launcher: the repo-committed hook commands and MCP
# registration expect `gbrain` on PATH (they are fail-open where it isn't).
-cat > /usr/local/bin/gbrain <<'LAUNCHER'
+cat > /usr/local/bin/gbrain <<LAUNCHER
#!/bin/sh
-exec bun /opt/gbrain/src/cli.ts "$@"
+exec '$GBRAIN_BUN' /opt/gbrain/src/cli.ts "\$@"
LAUNCHER
chmod +x /usr/local/bin/gbrain
diff --git a/templates/bootstrap/template-repo/README.md b/templates/bootstrap/template-repo/README.md
index 0e87800fcc..12045ca232 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.26.0 -->
+<!-- gbrain-template-stamp: 0.60.27.0 -->
This repository is the **"Use this template"** distribution artifact for a
[gbrain](https://github.com/garrytan/gbrain) personal-agent workspace — the same
diff --git a/test/bounded-child-exec.test.ts b/test/bounded-child-exec.test.ts
index 1777fa085d..9f99d5a91f 100644
--- a/test/bounded-child-exec.test.ts
+++ b/test/bounded-child-exec.test.ts
@@ -9,9 +9,9 @@ afterAll(() => rmSync(dir, { recursive: true, force: true }));
/**
* Starts short-lived children whose first exit callback re-enters the event
- * loop the way bun:test `expect().resolves/.rejects` does. On Bun 1.3.x that
- * drops the other exit and pipe events of the same poll batch
- * (oven-sh/bun#30301), which is how managed-maintenance, persistence-reconcile
+ * loop the way bun:test `expect().resolves/.rejects` does. Bun drops the other
+ * pipe events of the same poll batch (still on 1.4.2) and, before 1.3.14, the
+ * exit events too (oven-sh/bun#30301), which is how managed-maintenance, persistence-reconcile
* and google-attachments hung behind a persistence consumer's git probe.
*/
function nestedTickDuring<T>(work: () => Promise<T>[]): Promise<T[]> {
diff --git a/test/fixtures/goldens/doctor/early-stop-connection-failure.json b/test/fixtures/goldens/doctor/early-stop-connection-failure.json
index 495bdfd6c1..60174e785d 100644
--- a/test/fixtures/goldens/doctor/early-stop-connection-failure.json
+++ b/test/fixtures/goldens/doctor/early-stop-connection-failure.json
@@ -178,6 +178,11 @@
"name": "self_upgrade_health",
"status": "ok"
},
+ {
+ "message": "Bun <bun-version> (minimum 1.4.0)",
+ "name": "bun_runtime",
+ "status": "ok"
+ },
{
"message": "disabled (opt-in). Enable with: gbrain config set autopilot.nightly_quality_probe.enabled true",
"name": "nightly_quality_probe_health",
diff --git a/test/fixtures/goldens/doctor/early-stop-null-engine-connect-error.json b/test/fixtures/goldens/doctor/early-stop-null-engine-connect-error.json
index 4770c0052d..ba73856cce 100644
--- a/test/fixtures/goldens/doctor/early-stop-null-engine-connect-error.json
+++ b/test/fixtures/goldens/doctor/early-stop-null-engine-connect-error.json
@@ -144,6 +144,11 @@
"name": "self_upgrade_health",
"status": "ok"
},
+ {
+ "message": "Bun <bun-version> (minimum 1.4.0)",
+ "name": "bun_runtime",
+ "status": "ok"
+ },
{
"message": "disabled (opt-in). Enable with: gbrain config set autopilot.nightly_quality_probe.enabled true",
"name": "nightly_quality_probe_health",
diff --git a/test/fixtures/goldens/doctor/early-stop-null-engine-fast.json b/test/fixtures/goldens/doctor/early-stop-null-engine-fast.json
index 16de835e8e..708731aab1 100644
--- a/test/fixtures/goldens/doctor/early-stop-null-engine-fast.json
+++ b/test/fixtures/goldens/doctor/early-stop-null-engine-fast.json
@@ -144,6 +144,11 @@
"name": "self_upgrade_health",
"status": "ok"
},
+ {
+ "message": "Bun <bun-version> (minimum 1.4.0)",
+ "name": "bun_runtime",
+ "status": "ok"
+ },
{
"message": "disabled (opt-in). Enable with: gbrain config set autopilot.nightly_quality_probe.enabled true",
"name": "nightly_quality_probe_health",
diff --git a/test/fixtures/goldens/doctor/early-stop-null-engine-no-config.json b/test/fixtures/goldens/doctor/early-stop-null-engine-no-config.json
index 10fa8b615c..de529a7e28 100644
--- a/test/fixtures/goldens/doctor/early-stop-null-engine-no-config.json
+++ b/test/fixtures/goldens/doctor/early-stop-null-engine-no-config.json
@@ -144,6 +144,11 @@
"name": "self_upgrade_health",
"status": "ok"
},
+ {
+ "message": "Bun <bun-version> (minimum 1.4.0)",
+ "name": "bun_runtime",
+ "status": "ok"
+ },
{
"message": "disabled (opt-in). Enable with: gbrain config set autopilot.nightly_quality_probe.enabled true",
"name": "nightly_quality_probe_health",
diff --git a/test/fixtures/goldens/doctor/json-pglite-degraded.json b/test/fixtures/goldens/doctor/json-pglite-degraded.json
index 68359d3129..abca8293a3 100644
--- a/test/fixtures/goldens/doctor/json-pglite-degraded.json
+++ b/test/fixtures/goldens/doctor/json-pglite-degraded.json
@@ -208,6 +208,12 @@
"name": "self_upgrade_health",
"status": "ok"
},
+ {
+ "category": "ops",
+ "message": "Bun <bun-version> (minimum 1.4.0)",
+ "name": "bun_runtime",
+ "status": "ok"
+ },
{
"category": "brain",
"message": "disabled (opt-in). Enable with: gbrain config set autopilot.nightly_quality_probe.enabled true",
diff --git a/test/fixtures/goldens/doctor/json-pglite-fast.json b/test/fixtures/goldens/doctor/json-pglite-fast.json
index c5fcdcbd45..b0b717946c 100644
--- a/test/fixtures/goldens/doctor/json-pglite-fast.json
+++ b/test/fixtures/goldens/doctor/json-pglite-fast.json
@@ -172,6 +172,12 @@
"name": "self_upgrade_health",
"status": "ok"
},
+ {
+ "category": "ops",
+ "message": "Bun <bun-version> (minimum 1.4.0)",
+ "name": "bun_runtime",
+ "status": "ok"
+ },
{
"category": "brain",
"message": "disabled (opt-in). Enable with: gbrain config set autopilot.nightly_quality_probe.enabled true",
diff --git a/test/fixtures/goldens/doctor/json-pglite-fresh.json b/test/fixtures/goldens/doctor/json-pglite-fresh.json
index 4dab2f566f..057441e99c 100644
--- a/test/fixtures/goldens/doctor/json-pglite-fresh.json
+++ b/test/fixtures/goldens/doctor/json-pglite-fresh.json
@@ -208,6 +208,12 @@
"name": "self_upgrade_health",
"status": "ok"
},
+ {
+ "category": "ops",
+ "message": "Bun <bun-version> (minimum 1.4.0)",
+ "name": "bun_runtime",
+ "status": "ok"
+ },
{
"category": "brain",
"message": "disabled (opt-in). Enable with: gbrain config set autopilot.nightly_quality_probe.enabled true",
diff --git a/test/fixtures/goldens/doctor/json-postgres-fresh.json b/test/fixtures/goldens/doctor/json-postgres-fresh.json
index e83fabc1d2..e9223514af 100644
--- a/test/fixtures/goldens/doctor/json-postgres-fresh.json
+++ b/test/fixtures/goldens/doctor/json-postgres-fresh.json
@@ -208,6 +208,12 @@
"name": "self_upgrade_health",
"status": "ok"
},
+ {
+ "category": "ops",
+ "message": "Bun <bun-version> (minimum 1.4.0)",
+ "name": "bun_runtime",
+ "status": "ok"
+ },
{
"category": "brain",
"message": "disabled (opt-in). Enable with: gbrain config set autopilot.nightly_quality_probe.enabled true",
diff --git a/test/fixtures/goldens/doctor/json-postgres-unreachable-fast.json b/test/fixtures/goldens/doctor/json-postgres-unreachable-fast.json
index d41e56217d..3302f2e430 100644
--- a/test/fixtures/goldens/doctor/json-postgres-unreachable-fast.json
+++ b/test/fixtures/goldens/doctor/json-postgres-unreachable-fast.json
@@ -172,6 +172,12 @@
"name": "self_upgrade_health",
"status": "ok"
},
+ {
+ "category": "ops",
+ "message": "Bun <bun-version> (minimum 1.4.0)",
+ "name": "bun_runtime",
+ "status": "ok"
+ },
{
"category": "brain",
"message": "disabled (opt-in). Enable with: gbrain config set autopilot.nightly_quality_probe.enabled true",
diff --git a/test/fixtures/goldens/doctor/json-postgres-unreachable.json b/test/fixtures/goldens/doctor/json-postgres-unreachable.json
index 16e417656a..2e387c6b42 100644
--- a/test/fixtures/goldens/doctor/json-postgres-unreachable.json
+++ b/test/fixtures/goldens/doctor/json-postgres-unreachable.json
@@ -171,6 +171,12 @@
"name": "self_upgrade_health",
"status": "ok"
},
+ {
+ "category": "ops",
+ "message": "Bun <bun-version> (minimum 1.4.0)",
+ "name": "bun_runtime",
+ "status": "ok"
+ },
{
"category": "brain",
"message": "disabled (opt-in). Enable with: gbrain config set autopilot.nightly_quality_probe.enabled true",
diff --git a/test/fixtures/goldens/doctor/registry-build-checks.json b/test/fixtures/goldens/doctor/registry-build-checks.json
index cc6eb10edb..6f952e24e8 100644
--- a/test/fixtures/goldens/doctor/registry-build-checks.json
+++ b/test/fixtures/goldens/doctor/registry-build-checks.json
@@ -101,6 +101,10 @@
"category": "ops",
"name": "self_upgrade_health"
},
+ {
+ "category": "ops",
+ "name": "bun_runtime"
+ },
{
"category": "ops",
"name": "supervisor"
diff --git a/test/guarded-http.test.ts b/test/guarded-http.test.ts
index 6aa124482b..fceb1aed08 100644
--- a/test/guarded-http.test.ts
+++ b/test/guarded-http.test.ts
@@ -14,10 +14,10 @@ afterEach(() => __setDnsLookupForTests(undefined));
const probe = { headerOnly: true };
test('unsupported runtime refuses guarded operations with upgrade guidance', () => {
- for (const version of ['', '1.3.10', '1.2.99', '1.3.11-canary']) {
- expect(() => assertSupportedBun(version)).toThrow('Run bun upgrade');
+ for (const version of ['', '1.3.10', '1.2.99', '1.3.11', '1.3.14', '1.4.0-canary']) {
+ expect(() => assertSupportedBun(version)).toThrow('run `bun upgrade`');
}
- for (const version of ['1.3.11', '1.3.13', '1.4.0', '2.0.0']) {
+ for (const version of ['1.4.0', '1.4.2', '2.0.0']) {
expect(() => assertSupportedBun(version)).not.toThrow();
}
});
diff --git a/test/helpers/doctor-json-golden.ts b/test/helpers/doctor-json-golden.ts
index e11ff65e01..accea8618b 100644
--- a/test/helpers/doctor-json-golden.ts
+++ b/test/helpers/doctor-json-golden.ts
@@ -14,7 +14,7 @@
* Normalizer `doctor-json-v1`: ordered checks (name, status, message,
* details, issues) plus the report envelope, with volatile tokens replaced:
* temp home / repo / os tmpdir paths, UUIDs, ISO timestamps, the running
- * package version, the machine hostname, and `*_ms` / elapsed / pid-style
+ * package and Bun versions, the machine hostname, and `*_ms` / elapsed / pid-style
* detail keys. Check order is emitted order (deterministic; no Map/Set
* iteration is re-sorted). stderr lines are kept (normalized) because the
* early-stop paths announce themselves there.
@@ -138,6 +138,7 @@ export function normalizeDoctorText(text: string, roots: Record<string, string>,
out = scrubTimestamps(out).replace(UUID, '<uuid>');
out = out.replace(/\(most recent caller: at [^()]*\([^()]*\)\)/g, '(most recent caller: <frame>)');
out = out.split(PACKAGE_VERSION).join('<version>');
+ out = out.split(`Bun ${Bun.version}`).join('Bun <bun-version>');
const host = hostname();
if (host) out = out.split(host).join('<hostname>');
return out;
diff --git a/test/runtime-version.test.ts b/test/runtime-version.test.ts
new file mode 100644
index 0000000000..ee73ceafe3
--- /dev/null
+++ b/test/runtime-version.test.ts
@@ -0,0 +1,100 @@
+/**
+ * The Bun floor: every entrypoint refuses an older runtime with one actionable
+ * message, doctor reports it, and every place that states the floor agrees.
+ *
+ * Protects: the refusal text users on an old Bun see (found + required
+ * versions, `bun upgrade`, restart, `gbrain post-upgrade`), the CLI gate
+ * (exit 1 everywhere, `--version` still answering, autopilot's log copy), the
+ * `bun_runtime` doctor row, and the floor stated by package.json and the
+ * cloud setup script.
+ * Regression: a floor bump that misses one of those places, or a message
+ * edit that drops the fix command. Existing guarded-http coverage only checks
+ * that a refusal throws, not what it tells the user.
+ */
+import { describe, expect, spyOn, test } from 'bun:test';
+import { readFileSync } from 'node:fs';
+import { join } from 'node:path';
+import { MINIMUM_BUN_VERSION, assertSupportedBun, exitOnUnsupportedBun, unsupportedBunMessage } from '../src/core/runtime-version.ts';
+import { checkBunRuntime } from '../src/commands/doctor/checks/upgrade-health.ts';
+
+const root = join(import.meta.dir, '..');
+const OLD_BUN_REFUSAL = 'GBrain requires Bun 1.4.0 or newer (found Bun 1.3.14).\n'
+ + 'Fix: run `bun upgrade`, then restart GBrain. If a `gbrain upgrade` stopped here, finish it with `gbrain post-upgrade`.';
+
+describe('Bun runtime floor', () => {
+ test('an older Bun is refused with the found version, the floor and the fix', () => {
+ expect(MINIMUM_BUN_VERSION).toBe('1.4.0');
+ expect(unsupportedBunMessage('1.3.14')).toBe(OLD_BUN_REFUSAL);
+ let error: unknown;
+ try { assertSupportedBun('1.3.14'); } catch (caught) { error = caught; }
+ expect(error).toBeInstanceOf(Error);
+ expect((error as Error).message).toBe(OLD_BUN_REFUSAL);
+ expect((error as { code?: string }).code).toBe('UNSUPPORTED_RUNTIME');
+ });
+
+ test('every release below the floor, prereleases and a missing runtime are refused', () => {
+ for (const version of ['1.3.11', '1.3.13', '1.3.14', '1.2.99', '1.4.0-canary.1', '']) {
+ expect(unsupportedBunMessage(version)).toContain('Fix: run `bun upgrade`');
+ }
+ expect(unsupportedBunMessage('')).toStartWith('GBrain requires Bun 1.4.0 or newer (found no Bun runtime).');
+ });
+
+ test('the floor and newer releases start', () => {
+ for (const version of ['1.4.0', '1.4.2', '1.5.0', '2.0.0', '1.4.2+abc123']) {
+ expect(unsupportedBunMessage(version)).toBeNull();
+ expect(() => assertSupportedBun(version)).not.toThrow();
+ }
+ });
+
+ test('doctor reports the running Bun against the floor, with the fix on failure', () => {
+ expect(checkBunRuntime('1.4.2')).toEqual({ name: 'bun_runtime', status: 'ok', message: 'Bun 1.4.2 (minimum 1.4.0)' });
+ expect(checkBunRuntime('1.3.14')).toEqual({ name: 'bun_runtime', status: 'fail', message: OLD_BUN_REFUSAL.replace('\n', ' ') });
+ expect(checkBunRuntime().status).toBe('ok');
+ });
+});
+
+function runGate(command: string | undefined, version: string) {
+ const exit = spyOn(process, 'exit').mockImplementation(((code?: number) => { throw { exitCode: code }; }) as never);
+ const stderr = spyOn(console, 'error').mockImplementation(() => {});
+ const stdout = spyOn(console, 'log').mockImplementation(() => {});
+ let exitCode: number | undefined;
+ try { exitOnUnsupportedBun(command, '9.9.9.9', version); } catch (caught) { exitCode = (caught as { exitCode: number }).exitCode; }
+ const result = { exitCode, stderr: stderr.mock.calls.map(c => String(c[0])), stdout: stdout.mock.calls.map(c => String(c[0])) };
+ exit.mockRestore(); stderr.mockRestore(); stdout.mockRestore();
+ return result;
+}
+
+describe('CLI entrypoint gate', () => {
+ test('every command on an older Bun exits 1 with the refusal on stderr', () => {
+ for (const command of ['doctor', 'serve', 'jobs', 'hook', 'upgrade', 'post-upgrade', undefined]) {
+ expect(runGate(command, '1.3.14')).toEqual({ exitCode: 1, stderr: [OLD_BUN_REFUSAL], stdout: [] });
+ }
+ });
+
+ test('--version still answers on an older Bun so an older upgrade can verify the swap', () => {
+ for (const command of ['--version', 'version']) {
+ expect(runGate(command, '1.3.14')).toEqual({ exitCode: 0, stderr: [OLD_BUN_REFUSAL], stdout: ['gbrain 9.9.9.9'] });
+ }
+ });
+
+ test('autopilot also writes the refusal to stdout, its service log', () => {
+ const { exitCode, stderr, stdout } = runGate('autopilot', '1.3.14');
+ expect(exitCode).toBe(1);
+ expect(stderr).toEqual([OLD_BUN_REFUSAL]);
+ expect(stdout).toHaveLength(1);
+ expect(stdout[0]).toMatch(/^\d{4}-\d{2}-\d{2}T[\d:.]+Z \[autopilot\] GBrain requires Bun 1\.4\.0 or newer \(found Bun 1\.3\.14\)\./);
+ });
+
+ test('a supported Bun passes through silently', () => {
+ expect(runGate('doctor', '1.4.0')).toEqual({ exitCode: undefined, stderr: [], stdout: [] });
+ });
+});
+
+describe('stated Bun floor', () => {
+ test('package engines and the cloud setup script state the same floor', () => {
+ const pkg = JSON.parse(readFileSync(join(root, 'package.json'), 'utf8')) as { engines: { bun: string } };
+ expect(pkg.engines.bun).toBe(`>=${MINIMUM_BUN_VERSION}`);
+ const cloud = readFileSync(join(root, 'templates/bootstrap/cloud-setup-script.sh'), 'utf8');
+ expect(/Bun\.semver\.satisfies\(Bun\.version, ">=([\d.]+)"\)/.exec(cloud)?.[1]).toBe(MINIMUM_BUN_VERSION);
+ });
+});
diff --git a/test/scripts/ci-pr-scope.test.ts b/test/scripts/ci-pr-scope.test.ts
index 285468ecc8..f43c20564f 100644
--- a/test/scripts/ci-pr-scope.test.ts
+++ b/test/scripts/ci-pr-scope.test.ts
@@ -42,10 +42,10 @@ function classify(files: string): string {
describe('pull-request CI scope', () => {
test('pushes, schedules and manual runs keep every Bun version on every native target', () => {
const full = nativeCells('full');
- expect(full.native).toHaveLength(18);
- expect(full.musl).toHaveLength(6);
- expect(full.console).toHaveLength(6);
- expect(full.dotnet).toHaveLength(6);
+ expect(full.native).toHaveLength(12);
+ expect(full.musl).toHaveLength(4);
+ expect(full.console).toHaveLength(4);
+ expect(full.dotnet).toHaveLength(4);
expect(full.openclaw).toBe(true);
});
@@ -106,7 +106,7 @@ describe('pull-request CI scope', () => {
for (const name of ['read-performance', 'deployment-matrix', 'invariants', 'reconciliation']) {
const full = cells(persistence[name], push);
const primary = cells(persistence[name], pr);
- expect(full.filter(cell => cell.endsWith('1.3.11')).length, name).toBe(full.length / 2);
+ expect(full.filter(cell => cell.endsWith(MINIMUM_BUN_VERSION)).length, name).toBe(full.length / 2);
expect(primary, name).toEqual(full.filter(cell => cell.endsWith('1.4.2')));
}
});
@@ -139,7 +139,7 @@ describe('pull-request CI scope', () => {
expect(matrices).toHaveLength(5);
for (const bun of matrices) expect(bun).toEqual([MINIMUM_BUN_VERSION, primary]);
for (const job of ['native', 'musl', 'windows-backup-console', 'windows-backup-dotnet']) {
- expect(native[job].strategy!.matrix.bun as string[]).toEqual(expect.arrayContaining([MINIMUM_BUN_VERSION, primary]));
+ expect(native[job].strategy!.matrix.bun).toEqual([MINIMUM_BUN_VERSION, primary]);
}
});
});
diff --git a/test/scripts/data-safety-native-workflow.test.ts b/test/scripts/data-safety-native-workflow.test.ts
index 30a731772d..0ec5e7e335 100644
--- a/test/scripts/data-safety-native-workflow.test.ts
+++ b/test/scripts/data-safety-native-workflow.test.ts
@@ -38,7 +38,7 @@ describe('data-safety native CI coverage', () => {
expect(job['timeout-minutes']).toBe(5);
expect(job.strategy['fail-fast']).toBe(false);
expect(job.strategy.matrix.runner).toEqual(['windows-2022', 'windows-11-arm']);
- expect(job.strategy.matrix.bun).toEqual(['1.3.11', '1.3.13', '1.4.2']);
+ expect(job.strategy.matrix.bun).toEqual(['1.4.0', '1.4.2']);
expect(job.steps.some(entry => entry.run === 'bun scripts/native/verify.ts')).toBe(true);
const step = job.steps.find(entry => entry.name === 'Compare native hidden-window launch behavior');
expect(step).toBeDefined();
@@ -67,13 +67,13 @@ describe('data-safety native CI coverage', () => {
} finally { rmSync(temporary, { recursive: true, force: true }); }
});
- test('the direct dotnet program comparison has its own six-cell opt-in Windows job', () => {
+ test('the direct dotnet program comparison has its own four-cell opt-in Windows job', () => {
const job = workflow.jobs['windows-backup-dotnet'];
expect(job['runs-on']).toBe('${{ matrix.runner }}');
expect(job['timeout-minutes']).toBe(5);
expect(job.strategy['fail-fast']).toBe(false);
expect(job.strategy.matrix.runner).toEqual(['windows-2022', 'windows-11-arm']);
- expect(job.strategy.matrix.bun).toEqual(['1.3.11', '1.3.13', '1.4.2']);
+ expect(job.strategy.matrix.bun).toEqual(['1.4.0', '1.4.2']);
expect(job.steps.some(entry => entry.run === 'bun scripts/native/verify.ts')).toBe(true);
const step = job.steps.find(entry => entry.name === 'Compare cmdlet and direct dotnet ACL programs');
expect(step).toBeDefined();
diff --git a/test/scripts/native-lock-prebuilds.test.ts b/test/scripts/native-lock-prebuilds.test.ts
index 636dbec704..4917dc94ce 100644
--- a/test/scripts/native-lock-prebuilds.test.ts
+++ b/test/scripts/native-lock-prebuilds.test.ts
@@ -91,7 +91,7 @@ describe('native lock distribution integrity', () => {
continue;
}
const matrix = job.strategy.matrix;
- expect(matrix.bun).toEqual(['1.3.11', '1.3.13', '1.4.2']);
+ expect(matrix.bun).toEqual(['1.4.0', '1.4.2']);
const script = job.steps.map(step => step.run ?? '').join('\n');
expect(script).toContain('bun install --frozen-lockfile --ignore-scripts');
const lockTests = script.split('\n').find(line => /\bbun test\b/.test(line) && line.includes('test/native-lock.test.ts'));
@@ -108,7 +108,7 @@ describe('native lock distribution integrity', () => {
}
}
expect(pairs.sort()).toEqual(Object.keys(manifest.artifacts)
- .flatMap(target => ['1.3.11', '1.3.13', '1.4.2'].map(bun => `${target}/${bun}`)).sort());
- expect(new Set(pairs).size).toBe(24);
+ .flatMap(target => ['1.4.0', '1.4.2'].map(bun => `${target}/${bun}`)).sort());
+ expect(new Set(pairs).size).toBe(16);
});
});