Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

Merge master into capy/flake-wave-gst2422 (CHANGELOG only)

garrytan5f19208ba976
diff --cc CHANGELOG.md
index ab2a489409,5eed5fa90d..6803563f2f
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -10,19 -10,40 +10,53 @@@ 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]
+
+### Five flaky tests fixed at their cause
+
+**Five tests that failed by chance on some machines now pass or fail for a real reason. No assertion, bound or timeout was loosened, and nothing in `src/` changed.** Each fix comes with a probe that forces the failure every time on master and passes with the fix.
+
+- `test/helpers/statement-counter.ts`: the PGLite statement counter named a Bind by the last Parse it had seen. The engine's statement cache (`src/core/pglite-statements.ts`) prepares a statement the second time it runs, so a statement prepared before counting started was recorded under the text of the statement before it. `test/fold-hook-noop-6712.test.ts` then failed whenever background config reads had prepared `SELECT value FROM config WHERE key = $1` before its window. The counter now reads a bound statement's text from the engine's cache, and records an unknown name as a placeholder. `test/statement-counter-warm-cache.test.ts` pins it.
+- `test/persistence-consumer-idle.test.ts`: the first tick's maintenance count read 8, 9 or 10. On a slow machine the next tick's idle probe landed inside the count, and the compacted-receipt sweep added a statement until an earlier test had finished its cursor. The test now walks that cursor to done first and holds later ticks until the first tick is counted. The count is still exactly 8.
+- `test/e2e/evidence-long-page.test.ts`: with provider keys in the environment, every search called the live reranker, whose scores for identical calls differ in the last digits, so the byte comparison failed. The file now runs keyless, as CI's Selected E2E runs it.
+- `test/e2e/source-retire-batched-postgres.test.ts` ran into its 180 s cap. It now retires 2,017 pages (four full batches and a partial one) instead of 60,000, and a statement trigger records every committed page delete. So each test asserts the batches themselves: their sizes, the per-batch bound and one transaction each. Removing the batch `LIMIT` fails the remove and purge tests. The file takes about 57 s.
+- `test/config-file-plane-keys.test.ts`, `test/consent.test.ts`: the memorable enable tests hung waiting for a `[y/N]` answer when stdin was a terminal. They now pin `process.stdin.isTTY` to false while the command runs, so they test the non-interactive refusal however the runner's stdin is set up.
+- `scripts/ci-census-tests.sh`: the pull-request census job now runs 15 more tests that read every file under `src/` (or a whole `src/` subtree), such as `test/cli-exit-verdict-pin.test.ts`. Before, a change that broke one of them passed its pull-request checks and failed only in the full run. `test/scripts/ci-census-tests.test.ts` pins `cli-exit-verdict-pin` in the list.
+
+ ## [0.60.666.0] - 2026-11-11
+
+ **QM, the AI helper that can use gbrain as one of its memories, gets a fourth contract version, and each fact it recalls now says whether the person can forget it.** `docs/contracts/qm-memory-provider/v4.json` describes owner-approved proposals (`memory_propose`), marks which personal tools read named sources as a shared scope, and adds `own_page` to every recalled fact. v1, v2 and v3 are byte-identical, so QM keeps whatever version it vendors until it moves.
+
+ ### What changed
+
+ | Area | Before | Now |
+ |---|---|---|
+ | `memory_recall` fact rows | `id`, `text`, `date`, `kind`, `arm` | also `own_page`: `true` when the fact is on the person's own member page in the connection's source, the same check `forget_fact` makes, so `forget_fact` accepts it on ownership; `false` when `forget_fact` for that attested person answers `fact_not_found`. `arm` is unchanged |
+ | `get_write_request` / `cancel_write_request` on a proposal | `request_id`, `state`, `retry_after_ms`, `operation`, `source_id`, `slug`, `proposal`, and `decision` / `write_error` when closed | also `created_at` and `updated_at`, as a write's receipt carries them |
+ | QM contract | v3: no proposal, no scope marking, no `own_page` | v4 adds `memory_propose` (arguments, caps, the held answer, the proposal receipt and its states, `cancel_write_request` as the proposer's cancel, how long a closed proposal is kept, and "a state not listed means unknown, not published"), `scope_read: true`/`false` on each personal tool, and `own_page`; v1-v3 unchanged |
+
+ ### Itemized changes
+
+ - `src/core/access/member-facts.ts`: `ownMemberFactIds` returns the facts on the caller's own member page. `forget` and `forget_fact` decide ownership with it, and `memory_recall` sets `own_page` from it, so the two cannot disagree.
+ - `src/core/ops/qm-memory.ts`: each recalled row carries `own_page`.
+ - `src/core/persistence/memory-proposals.ts`: the proposal receipt carries `created_at` and `updated_at`.
+ - `scripts/build-qm-memory-contract.ts`, `docs/contracts/qm-memory-provider/v4.json` (new): contract v4, generated from the live registry; the `actor_required` fix row names `memory_propose` from v4 on.
+ - Docs: `docs/contracts/qm-memory-provider/README.md`, `docs/guides/qm.md`, `docs/architecture/key-files/access.md`.
+ - Tests: `test/qm-memory-tools.test.ts` checks on PGLite and Postgres that every `own_page: true` row is one `forget_fact` withdraws and every `false` row is refused `fact_not_found`, whichever arm found it; `test/qm-memory-contract.test.ts` pins the v1-v3 bytes and checks v4 against the registry; `test/qm-memory-propose.test.ts` checks the held answer, the receipt and the cancel against v4.
+
+ ## [0.60.665.0] - 2026-11-11
+
+ **One file in a group of Git effects can no longer park the whole group, and a failed step no longer leaves files staged.** A page write's Git effect commits in a group of up to 100 files that share one `git add`. When one of them was already tracked and a later ignore rule covered its folder (a rule ending in `/`), `git add` staged every file it was given and still exited 1. gbrain read that as the whole group failing and parked every effect as `git_unavailable`, including files whose bytes were already committed. Retrying parked them again, and their files stayed staged in the checkout. Every later `gbrain git commit-push` naming those folders then refused with `commit_prestaged_paths`. Now a tracked file is committed even when an ignore rule covers its folder, as plain git does. A new file an ignore rule covers is still never added and parks alone as `git_target_ignored`, naming the rule. A file git refuses fails by itself while the rest of its group commits. Whenever a group's add or commit fails, the index entries it staged are put back. A commit that already landed is never undone.
+
+ ### Itemized changes
+
+ - `src/core/persistence/effect-git.ts`: in a group, tracked files stage with `git add -u` (which never adds an untracked file) and new files with `git add -A` (which refuses an ignored one). When the group add fails, each file is staged alone, and a refused file fails by itself, as `git_target_ignored` naming the rule when that is the cause, and what was staged of it is put back. When every file fails for another reason, the group fails as before. Every failed step, an abort included, restores the group's index entries and their assume-unchanged and skip-worktree flags. Entries already equal to HEAD are left alone, so a commit that landed before its step failed is never reversed.
+ - `src/core/git/commit-push.ts`: a file another writer adds or edits under a named folder after the commit lands is no longer reported as skipped (`commit_paths_skipped`). The `commit_prestaged_paths` fix text also says that files a parked gbrain Git effect left staged are gbrain's own, and that `gbrain sources writer retry-effects` commits them.
+ - Tests:
+ - `test/effect-git-failed-commit-unstages-gst2128.test.ts` (failed commit, refused add, throwing step, landed commit, tracked file under an ignored folder, untracked ignored file whether status saw it as ignored or not);
+ - `test/effect-retry-already-committed-gst2128.test.ts` (retried effects already in HEAD next to a tracked file under an ignored folder; a push the secret scan holds);
+ - `test/git-commit-push-skipped-paths-gst2116.test.ts` (a post-commit add or edit under a named folder).
+
## [0.60.664.0] - 2026-11-11
**The Git effects of page writes no longer publish a script's secret.** A script that commits into a managed checkout with plain `git commit` never passes the write path's secret scan. The refresh publish refused such a commit with `publish_secret_found`, but the next page write's Git effect pushed it anyway. Its plain push published every unpublished commit unscanned, and when the remote had moved its keep-checkout publish ran without the scan. Both paths now scan the exact commits they push, except the ones gbrain made itself for page writes (a Git effect's commit, recorded only after checking it holds exactly the bytes the effect wrote, or a hosted repository's door commit, as its commit ledger records them): page bodies are stored raw by design and their Git backups keep going, and the refresh publish now skips them the same way. A value that looks like a secret, added text too large to scan, a commit that changes `.gbrain-scan-allow` or a `.gitattributes` holds the effects with `publish_secret_found`; commits the scan cannot read in full hold them with `publish_scan_unreadable`. A first push to a remote that has no such branch yet scans the branch's whole history and creates the branch only when that scan passes. A commit that changes `.gbrain-scan-allow` or a `.gitattributes` is never published automatically, so the user reviews it and pushes it. Nothing is pushed, and the page writes stay safe in the database and in local commits. `gbrain sync status` and doctor name the user's choice, which is to remove the value from those commits or to allowlist a false positive by fingerprint. Then `gbrain sources writer retry-effects <source> --parked-pushes` runs the effects that parked. Every scanned push is also leased on the remote tip it scanned against. Before, a remote rewound past a pushed secret (an admin removing it with a force-push) left a stale tracking ref that hid the commit from the scan, and the next fast-forward put it back; now the scan runs against the remote's real tip. The in-process scan on the owner's event loop is capped at 10 seconds, inside the writer heartbeat's live window; a longer range goes to the keep-checkout publish, whose child process scans with the full budget.