Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
Merge remote-tracking branch 'origin/master' into capy/freeze-yield-gbra133
garrytanf0fade222238
diff --cc CHANGELOG.mdindex dc2644d548,e05c3a88cb..d3c0d15b00--- a/CHANGELOG.md+++ b/CHANGELOG.md@@@ -10,16 -10,44 +10,54 @@@ 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 managed sync's file freeze no longer holds timers through its Git reads++**While a managed sync freezes a file, it now lets timers and other work run between its Git reads once it has run about 30 ms, so searches, lease renewals and heartbeats are no longer held behind them.** Before, the freeze ran its reads of the file, its pinned blob, its content, its filter driver and HEAD one after another with no break. On a slow machine the first freeze of a large sync held timers past the 100 ms bound that `test/sync-pass-batch-entries-6712.test.ts` sets.++- What a freeze records is unchanged. The reads of a committed file are of the pinned commit, or of HEAD checked by hash against the file's first read, so a write that lands during a break keeps the pinned content instead of importing the new bytes. A working-tree file is still read twice with no break between. The run is checked again after each break, so a cancelled run stops there.+- `test/sync-freeze-turn-write-gbra133.test.ts` commits new bytes for the file during a break, between the file's first read and its HEAD read, on PGLite and Postgres. The frozen request keeps the pinned content and is not published, and a later freeze imports the new bytes under their own hash.+- A fourth test in `test/sync-pass-batch-entries-6712.test.ts` adds 40 ms of CPU to each of the first freeze's reads. Before this change the longest stretch was 205 to 211 ms; it now stays under 100 ms.++ ## [0.60.671.0] - 2026-11-11++ **A team member's `forget` now says who can withdraw a fact, instead of answering that the fact does not exist.** A remote credential bound to a member, the brain owner's included, withdraws only the facts on its own member page. When it tried to forget a fact it can read but that lives elsewhere (one it saved with `share: true`, or a teammate's shared fact), it got `not_found`, so its agent believed the fact was gone while every reader still recalled it. It is now refused with a reply saying the brain host withdraws it with `gbrain forget <id>`, and the fact stays. A fact the caller cannot read still answers `not_found`, so the reply never confirms a hidden fact exists. An attested QM call (`x-qm-actor`) is unchanged and still answers `not_found` for any fact off the person's page, as QM's published contract says. The docs that said `remember` defaults to `world` now say that a member-bound credential saves privately on its member page unless it passes `share: true`. Reported by @andreineacsu (#9101).++ **An agent that passes `source` to `remember` is now pointed at `provenance`.** The `remember` description said "provenance (required: source)", and agents read that as a parameter named `source`. The call was refused, and since v0.60.635.0 the refusal suggested `source_id`, the write source, which is not what the agent meant. In the nightly write evals, that one refusal caused every failed refresh-barrier episode on master. The description now says "provenance (required)", and an unknown `source` on `remember` suggests `provenance`.++ **A write that a refresh holds back now says which request_id to retry with.** While `gbrain sources refresh` is updating a checkout, a write to it is refused as `worktree_refreshing`, and the refusal said "Retry the same request_id". A write sent without a `request_id` had no id to reuse, so an agent's retry went out as a new request. The refusal now names the request_id it was refused under, a new one when the call sent none, and over MCP its `fix.mcp` is the exact call to repeat with that id after `retry_after_ms`. A refused batch (`put_pages`, or `remember` with `items`) names the batch's own request_id, and `memory_write`, which replays by its `idempotency_key`, is told that key instead. Nothing is recorded for the refused call, as before. The retry commits under that id, and reusing the id later for a different write is refused (`idempotency_conflict`) like any reused id. A database-only (repo-less) source is never held back.++ **GPT-6.1 Sol's recorded-time page reads and typed graph chains now get answers instead of refusals, and two regressions that shipped without a test now have one.** Sol fills in every optional argument of a tool call. A `get_page` with `known_as_of` (the page as the brain had recorded it at an instant) arrived beside `include_content: true`, `include_timeline_entries: true`, a one-line `lines` window, `view: "read"` and the rest, and gbrain refused the whole call because a recorded-time read does not serve those arguments. A `traverse_graph` with `hops` arrived beside `depth`, `link_type` and `direction`, and was refused the same way. Sol does not follow the refusal's fix, so in a replay of its recorded calls 178 of 651 `get_page` and `traverse_graph` calls failed on arguments alone. Both calls now run: a recorded-time read returns the whole page as recorded, a chain walks its hops, and the response's `set_aside` names each argument that was ignored and why. `body: outline` or `window` with `known_as_of` still refuses, because that names a read mode the ledger cannot serve.++ The regressions: v0.60.58.0 sent one Postgres round trip per member of a bulk sync group (#5984), and v0.60.554.0 shipped a compiled binary whose admin UI could not load its JavaScript bundle. Both were caught by users, not CI. A Postgres unit test now holds a bulk group page to its statement budget, and the native and release builds now start the compiled binary and load the admin UI with every asset it references.++ ### Itemized changes++ - `src/core/persistence/memory-mutations.ts`: when a member caller's `forget` misses its own member page, the fact is checked against the same visibility, privacy and eligibility filters `recall` uses for that caller; a readable fact is refused (`scope_denied` from `forget`, `permission_denied` from `forget_fact`, class `host_only`) and an unreadable one stays `not_found`.+ - Docs: `docs/guides/access-designations.md` (fact visibility), `docs/mcp/TOOL_REFERENCE.md` (`remember`), `skills/brain-ops/SKILL.md` (and the generated plugin copies), and the `facts.default_visibility` bootstrap check's detail now name the member-bound default.+ - Tests: `test/member-forget-refusal-9101.test.ts` on PGLite and Postgres with member- and owner-bound OAuth credentials on a repo-less brain.+ - `src/mcp/validate-params.ts`: `remember`'s parameter hints map `source` to `provenance` ahead of the source-scope aliases; `src/core/verbs.ts` drops "source" from the description (the starter tool list stays inside its budget). Test in `test/validate-params.test.ts`.+ - `src/core/persistence/journal.ts`: the `worktree_refreshing` refusal's message, suggestion and fix name the request_id it was refused under and set it on the error (it already crosses the persistence owner's IPC hop as `request_id`); `verb-errors.ts` keeps it on the memory verbs' frozen `unavailable` refusal. `src/mcp/dispatch.ts`: a mutating call refused retryable with a request id gets `fix.mcp` = the same tool and arguments plus that `request_id`, and the fix still renders `next: wait`. Docs: the error registry suggestion, `docs/guides/write-refusals.md` and the generated `docs/guides/error-codes.md`. Tests: `test/refresh-fence-retry-id-gst2353.test.ts` (PGLite and Postgres, repo-less case included); `test/refresh-retry-hint-gst1582.test.ts` reads the new wording.+ - `src/core/ops/known-as-of.ts`: `get_page {known_as_of}` sets aside the arguments that shape a current read (window selectors, `section`, `grep`, `context`, `include_content`, `content_only`, `include_timeline_entries`, `view`, `max_bytes`, `fuzzy` and the rest) and returns `set_aside {ignored, note}`; only `body: outline|window` and `include_quarantined: true` refuse `invalid_params`, with the same keep-only-what-applies `fix`.+ - `src/core/ops/links.ts`: `traverse_graph` with `hops` walks the chain with `depth`, `link_type` and `direction` set aside and named in `set_aside`; malformed hops still refuse.+ - `src/core/behavior-change-notice.ts`: one row for the changed refusals.+ - Docs: `docs/guides/multi-hop.md`, the key-files rows for `known-as-of.ts` and `links.ts`.+ - Tests: `test/tool-args-empty-optional-sol.test.ts` replays Sol's shapes on every entry point (MCP remote and local, `gbrain call`, the SkillOpt rollout and write-capture registries, the subagent registry) against a ledger-enabled brain; `test/traverse-graph-hops.test.ts` and `test/get-page-slices.test.ts` assert the set-aside contract where they asserted the refusal.+ - `test/managed-sync-bulk-round-trips-5984.test.ts` (Postgres unit arm, registered in `test/postgres-unit-arms.txt`): a managed bulk sync of a multi-member group stays within 27 publication and 74 run statements per page (measured 24.2 and about 67); a probe adding 4 statements per member fails it.+ - `scripts/native/compiled-admin-smoke.ts`: starts the compiled `gbrain` binary's HTTP server, fetches `/admin/` and every same-origin script and stylesheet the page loads, and fails unless each returns 200 with a JavaScript or CSS content type (the SPA fallback answered the missing bundle with `text/html`). It runs in `.github/workflows/native-locks.yml` and `.github/workflows/release.yml`, pinned by `test/release-workflow.test.ts`.++ ## [0.60.670.0] - 2026-11-11++ ### A nightly soak test for a busy personal agent, and a fixed convergence-nightly flake++ **The convergence nightly now also runs the managed-sync harness under a busy personal agent's workload, and its kill loop no longer fails by chance on the `sync:passed_over` round.** This change touches only tests, the nightly workflow and docs. Nothing in `src/` changed.++ - **Busy-agent soak cell.** `test/busy-agent-soak.serial.test.ts` runs six modes, (h) to (m), against a real Postgres behind transaction-mode PgBouncer: refresh ticks with writes inside the refresh barrier, doctor `foreign_writers` beside plain-git committers, `sources git-gap` on legacy rows, a strict conversion stalled between adopt groups, segmented staging that expires before publication, and the cron `commit-push --base` against MCP `edit_page` race. Every mode ends with the convergence oracle. The counts and cadences come from the committed generic profile `test/fixtures/busy-agent-profile.json`, which holds no content. Run it with `GBRAIN_TEST_BUSY_AGENT=1 bun run test:busy-agent`.+ - **Informational nightly job.** `busy-agent` in `.github/workflows/convergence-nightly.yml` runs the cell every night at 50 ms latency, with the run id as the seed. It is `continue-on-error`, so it never changes the convergence job's result. On failure it writes a summary that carries the seed, and it uploads the logs. A `.github/nightly-known-red.tsv` row parks its known red (#8975, tracked in TODOS.md), so a red in the convergence job itself still shows as unparked.+ - **Shared harness.** `test/helpers/convergence-brain.ts` now holds the real-process brain that both suites use. The convergence gate's oracle also counts `deferred` requests as open. When a recovery sync reports `synced` but HEAD has moved past the commit it synced, the harness runs its second allowed plain sync instead of stopping.+ - **Kill-loop flake (#8838).** The two kill-loop rounds whose fault point is `sync:passed_over` now sync with `--no-bulk`. Before, a bulk group could freeze the round's primed file and then drop it without admitting it. When sync froze the file again, it read the edited bytes and held it at once, so the pass-over never fired and the run failed "every planned fault fired". A forced probe (an edit at the freeze, then a kill at the next freeze) fails with bulk on and passes with `--no-bulk`.+## [0.60.669.0] - 2026-11-11### Five flaky tests fixed at their cause