Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

Merge remote-tracking branch 'origin/master' into capy/pglite-analyze-replan

garrytan2521090fdce3
diff --cc CHANGELOG.md
index 7b27a2ad68,b28593a159..d50e3438af
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -10,14 -10,21 +10,29 @@@ credits are retained; no result has bee
identifiers and attribution are available in the pre-removal Git revision
`6040075c6cb95be5881cc2e1b76ef7d71f4e5d29` (retained on 2026-09-23).
+## [Unreleased]
+
+**A long-running PGLite process picks up fresh planner statistics instead of keeping the plans it made before them.** PGLite has no autovacuum, so a freshly imported brain has no statistics until planner-stats' first-read refresh runs `ANALYZE`. But gbrain's PGLite statement cache keeps named prepared statements, and PostgreSQL keeps a prepared statement's plan across `ANALYZE`, so every statement prepared before the refresh kept its no-statistics plan for the life of the process (a `gbrain serve`, an agent session, a script). On a 55,838-page brain imported without statistics, `entity names` with 50 names stayed at 3.4 to 3.7 s for every call after the refresh. With this fix the calls after the first take 1.2 to 1.5 s, the same as a freshly started process.
+
+### Itemized changes
+
+- **`ANALYZE` and `VACUUM` clear the PGLite statement cache** (`src/core/pglite-statements.ts`), like DDL already did, so the next call re-prepares and plans with the new statistics. This covers planner-stats' refreshes, `gbrain repair planner-stats`, projection statistics and the persistence journal's `VACUUM (ANALYZE)`. Postgres is unchanged. `test/pglite-statements.test.ts` checks that a statement prepared before `ANALYZE` is re-prepared after it; the check fails without the fix.
+
+ ## [0.60.195.0] - 2026-10-13
+
+ **CI and the release build move to Bun 1.4.3, which carries the fix for the spawnSync hang that poisoned whole test shards (#6586).** On Bun 1.4.0 to 1.4.2, a garbage-collection finalizer that runs while `Bun.spawnSync` waits can leave the runtime's private spawnSync loop miscounted for the rest of the process (oven-sh/bun#34069). After that, a synchronous child spawn may never notice its child exit. A spawn with a timeout comes back `ETIMEDOUT` even though the child finished, and one without a timeout spins until the test deadline kills it. Run 38335527492 hit this twice: `test (2)` hung in `test/managed-sync-pinned-reads.test.ts` and was cancelled, while the identical code on the identical file order passed on master and on #6576. Bun 1.4.3 (released 2026-10-10) contains upstream commit 13a98b0. `compare/bun-v1.4.3...13a98b0` reports `behind`, which means the release already has the commit. The supported install floor stays at Bun 1.4.0.
+
+ Three gaps the hang exposed are fixed too, plus one Bun 1.4.3 change in `fetch` error wording that made a thin client's unreachable remote host read as a database error. A managed sync no longer mistakes a timed-out `git` child for a lost database connection. CI names the signature as soon as it appears instead of only when the test process exits. And the pinned-reads test no longer keeps running behind the next test after it times out.
+
+ ### Itemized changes
+
+ - **Bun 1.4.3 everywhere CI pins one version:** every `bun-version:` in `.github/workflows/`, the `['1.4.0', '1.4.3']` floor-plus-primary matrices (the 1.4.0 cells stay, since 1.4.0 is the supported floor), `docker-compose.ci.yml` (`bun run ci:local`), `scripts/ubicloud/setup-ci-vm.sh` and `scripts/ci-ubicloud.ts` (`bun run ci:ubicloud`), `tests/docker/`, and `scripts/setup-in-agent.sh`'s runtime pin for new in-agent installs (repairs keep the version their receipt records). `test/scripts/ci-pr-scope.test.ts` still requires every single-version pin to equal the primary. The release compiler (`release.yml`) now builds the published binaries on 1.4.3, so a compiled `gbrain` no longer carries the defect.
+ - **`isConnectionDrop` (`src/core/persistence/sync-drain.ts`):** a child-process error is no longer a dropped database connection. That covers Node's `syscall: 'spawnSync git'` and any message of the form `spawn(Sync) <cmd> E…`. Before, the drain's git reads coming back `spawnSync git ETIMEDOUT` printed "database connection dropped", reconnected the database, and counted a strike toward `connection_lost`, which pointed the operator at the wrong component. Now the error takes the drain's ordinary transient retry, with no reconnect and no connection line. The test throws a real `spawnSync` timeout and a synthetic `spawnSync git ETIMEDOUT` through `runDrain`. It fails on the old code, where the first is classified as a drop.
+ - **`scripts/capture-test-log.ts`:** two live notes, each printed once to stderr and appended to the job's step summary as soon as its evidence arrives. The first, `bun_spawnsync_poisoned?`, fires on the first `spawnSync <cmd> ETIMEDOUT` line and names its file. The second is the existing `bun_spawnsync_poisoned` verdict, the moment it holds. Before, the classifier ran only when the test process exited, so the cancelled #6578 job never named the signature. The tests replay that job's log shape and check a still-running capture's summary. Both fail on the old script.
+ - **`test/managed-sync-pinned-reads.test.ts`:** `afterEach` aborts the running arm's sync (`performSync` now gets the arm's signal), waits up to 20 s for the arm to unwind so its PATH override is gone, and prints the arm's Git calls: how long each took and which never finished. Each counter wraps the Git and PATH the file loaded with, never another arm's shim. Before, a timed-out test left PATH on its counting `git` shim. It also kept spawning Git behind the next test and threw `ENOENT` into the temp home that `afterAll` had already removed. The shim now records a start and end line per call (`calls()` counts are unchanged). Forced probe: with the test deadline cut to 4 s and a `git` that sleeps 200 ms, a trailing test that checks PATH and the arm's Git log fails on the old file and passes on the new one.
+ - **A thin client's refused remote MCP host no longer reads as a database error on Bun 1.4.3 (`src/cli/cli-error.ts`).** Bun 1.4.3's `fetch` reports a refused connection as `ECONNREFUSED: Unable to connect…` with code `ECONNREFUSED`, where 1.4.2 said `Unable to connect…` with code `ConnectionRefused`. The fatal CLI seam ran every error through the database access classifier first. So on 1.4.3, a thin client whose remote host was down printed `GBRAIN_DB_ACCESS conn_refused` and "switch to the transaction pooler … Run: gbrain db-repair" instead of `Error [unavailable] … Fix: gbrain remote doctor`. The first full gate on 1.4.3 caught it in `test/cli-thin-client-refusal-matrix.test.ts`. A `RemoteMcpError` now skips the database classifier, and a refused Postgres connection still gets the marker and the db-repair line. `test/cli-fatal-remote-mcp-6586.test.ts` fails on the old seam on any Bun. The thin-client goldens (`test/fixtures/goldens/cli/thin-client-{cases,routing}.json`) take 1.4.3's `ECONNREFUSED: ` message prefix, and no other line changes. This affects anyone already running gbrain from source on Bun 1.4.3, not only CI.
+ - `TODOS.md`: the P2 "Bump Bun when a release carries 13a98b0" item is done. `docs/TESTING.md`, `docs/RELEASING.md`, `docs/guides/authorization-upgrade.md` and `native/locks/README.md` name 1.4.3 as the CI and build runtime.
+
## [0.60.194.0] - 2026-10-13
**A Postgres read that follows a failed statement on the same pooled connection now gets back only its own rows.** A statement that streamed rows and then failed (a runtime error after its first rows, or a cancel or timeout while it was still producing them) left its row count behind in the driver. The next statement on that connection then returned its rows after that many empty slots. So `persistence_brain`'s one-row read came back as two rows, and a managed connector sync refused with `storage_error` ("requires exactly one known boolean persistence state") before its sweep started. Before the strict readers, the same read came back as `enabled = false` and the run took the unmanaged path (#6482). A cancel at consumer stop is enough to leave the count behind.