Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
Merge remote-tracking branch 'origin/master' into capy/pglite-analyze-replan
garrytanfb602b7263e7
diff --cc CHANGELOG.mdindex e2aae7af14,75a5612fc5..03bcbf52cf--- a/CHANGELOG.md+++ b/CHANGELOG.md@@@ -10,15 -10,15 +10,24 @@@ credits are retained; no result has beeidentifiers 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.+- **Shell jobs keep output that is read after the child's `'exit'`** (`src/core/minions/handlers/shell.ts`). The handler resolved on `'exit'` and took `stdout_tail`/`stderr_tail` right after reaping the process group, but `'exit'` can fire before the last chunk is read; only `'close'` means the pipes ended. A CI run on Bun 1.4.3 got `stdout_tail: ""` for an `echo hello` job that exited 0 (`test/e2e/minions-shell-pglite.test.ts`). After the reap, the handler now waits for `'close'`, at most 2 s, before taking the tails; #5062's reap still ends the job when its leader exits, and a process that left the group and holds a pipe costs at most those 2 s. `test/minions-shell-process-tree.test.ts` adds a writer that leaves the group and writes after the leader exits: it fails without the fix and passes with it. Diagnosis with GBRA-84.++ ## [0.60.199.0] - 2026-10-13++ **A new opt-in search knob, `search.diverse_pool_depth`, gives the reranker a deeper candidate pool with one row per conversation session; it ships off because its measured gain did not clear the preregistered bar (wave 3 item S1).** The BEAM-1M failure analysis found that 30 of the 57 questions with no gold in the top 5 were semantic drift, where several chunks of one session took the reranker's slots. On BEAM-1M dev (gbrain-evals v0.10.83), depth 100 raised strict recall at 10 from 76 to 83 of 198 (+3.5 points, [0.0, 6.6]) and moved strict recall at 5 by +0.5 ([-1.5, 2.5]); answers moved +0.3, +0.3 and -0.4 points for gpt-6.1-sol, Sonnet 5.5 and Opus 5.5. The flip rule needed an interval above zero and no reader below zero, so the default is 0 in every bundle and nothing changes for any brain unless its owner sets the knob.++ ### Itemized changes++ - **`search.diverse_pool_depth`** (integer 0 to 100, `off` = 0): with N > 0 on the fused embedding path of `hybridSearch`, every retrieval arm fetches at least N candidates (still capped at 100), the deduped pool keeps one row per session (`capPerSession` in the new `src/core/search/diverse-pool.ts`; a session is the chat, session or dated slug prefix, otherwise the page), and the reranker reads at least N rows. Keyword-only paths are unchanged. One range contract (`normalizeDiversePoolDepth`) serves config parsing and the `gbrain config set` refusal; the knob joins the cache knobs hash only when on, so existing cache keys are unchanged.+ - **Tests:** `test/search/diverse-pool.test.ts` and `test/search/diverse-pool-hybrid.serial.test.ts` (the session cap, pool floor and reranker width, and the off path byte-identical), plus `test/search-mode.test.ts`. Documented in `docs/architecture/RETRIEVAL.md`.+## [0.60.198.0] - 2026-10-13**The lock-order race test retries a topology change that ran out of lock wait, as the product tells callers to, so a single lock timeout on a loaded runner no longer fails it (#6586).** `test/e2e/persistence-publish-lock-order-postgres.test.ts` checks that ordinary writes racing claims and topology changes never form a lock-wait cycle and never deadlock. Each topology change runs with the production 1 s `lock_timeout`. When that wait runs out, the change ends `write_pending` with "Retry the same lifecycle request_id after the current writer finishes". The race recorded that as a failure. On #6591's gate-ahead run it did, once: one topology step hit 55P03 on a loaded gate VM with `cycles: []` and `deadlocks: 0`. The rerun on the same head passed, and 60 local runs with four CPU burners passed.