Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
docs(#5984): CHANGELOG entry and the lanes/startup/foreground before-and-after record
garrytan05c1aa5ed293
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 12f0dbf4d2..66149ffcb7 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -10,6 +10,54 @@ credits are retained; no result has been reassigned to another provider. Originaidentifiers and attribution are available in the pre-removal Git revision`6040075c6cb95be5881cc2e1b76ef7d71f4e5d29` (retained on 2026-09-23).+## [0.60.107.0] - 2026-10-07++**Managed Postgres sync catches up more than twice as fast, starts committing in about 20 seconds instead of 80, and a page you save during a catch-up no longer waits behind it.**++When a git source falls behind on a managed brain whose database is far away (57 ms round trips in our test), `gbrain sync` used to spend most of its time with idle connections: one process prepared the next batch of pages one statement at a time while up to six publishers waited. A 10,000-page backlog took about 75 minutes, the first page landed after about 80 seconds, and a `put_page` from your agent took 9 to 12 seconds even when nothing else was running. Now batches are prepared in bulk, publishers stay busy, a single page write takes about 2.5 seconds, and a foreground write goes ahead of queued sync batches that don't touch the same page.++### How to use it++```bash+gbrain sync --source <id> # nothing to change: the defaults pick up the new path+gbrain config set sync.lanes 12 # up to 16 publishers, clamped by the connection pool+gbrain config set sync.foreground_priority false # back to strict arrival order for page writes during a sync+GBRAIN_PG_TYPE_CACHE=0 gbrain serve # turn off the shared parameter-type cache if a driver issue appears+```++### The numbers that matter++Same 16-core machine and same Postgres, 57 ms round trips, default settings, master before vs this release.++| What you do | Before | Now |+|---|---|---|+| Catch up a 10,000-page backlog | 74.5 min | 33.5 min |+| Pages per minute once the catch-up is running | 175 | 373 |+| Time until the first page is committed | 79 s | 20 s |+| Save one page with nothing else running (typical / slow) | 8.6 s / 11.6 s | 2.5 s / 2.8 s |+| Save one page during a catch-up (typical / slow) | 11.3 s / 17.1 s | 6.9 s / 8.4 s |+| Catch-up speed while your agent saves a page every 5 s | 4.6 pages/min | 58 pages/min |+| Catch-up next to the database (about 0 ms) | 2,404 pages/min | 2,862 pages/min |++### Things to watch++- **More publishers help up to a point.** With a 20-connection pool, 8 to 16 publishers all run at about 410 to 420 pages/min against 375 at the default 6. The drain prints a `[sync] lanes:` line saying what limited it (the pool, the server's free connections or your setting).+- **Writes during a catch-up still cost something.** A page write waits for the sync batches already publishing, so during a catch-up it takes about 7 s, and a steady stream of writes slows the catch-up to about 15% of its idle speed.+- **Every new path has a switch** that accepts `0` or `false`: `persistence.single_write_group`, `persistence.preadmit_cache`, `sync.waive_batch`, `sync.foreground_priority` (environment: `GBRAIN_SINGLE_WRITE_GROUP`, `GBRAIN_PREADMIT_CACHE`, `GBRAIN_SYNC_WAIVE_BATCH`, `GBRAIN_SYNC_FOREGROUND_PRIORITY`). A running `serve` picks up a config change within 5 seconds.++### Itemized changes++- Sync feeder: a group's admission and the cursor save that records it are one transaction; window groups are admitted in batches with the request inserts and counter updates pipelined; admit-ahead never asks for more requests than the writer's outstanding limit leaves room for (it used to refuse at 8+ lanes and on a local database, serializing the lanes).+- Lanes: up to 16 (`sync.lanes`, `--lanes`), clamped by the pool and the server's free connections; groups are sized by measured apply time inside a 5 s budget (2 s while foreground writes are recent), and the first group is one or two pages. Group publication pipelines the page apply.+- Startup: runs of entries that need no write (already-deleted files, unchanged imports) are waived in one transaction instead of one each.+- Single page writes publish as a group of one on a warm reserved connection, with a per-process cache of pre-admission reads that admission rechecks under lock, and the writer's own admission claims the request directly.+- Foreground priority: a page write passes queued, unstarted sync groups that don't name its page (slug, page id or rename source); a sync group naming the page keeps its place; after each foreground commit the drain may start a group, so a stream of writes can't stall it. Every reader of request sequence order was audited for writes committed out of order; receipt health now judges a claimed write only against earlier started writes.+- Postgres: described parameter types are shared across a pool's connections (patched `[email protected]`, `GBRAIN_PG_TYPE_CACHE=0` turns it off); managed link extraction derives four pages at once with one config read per run.+- A sync group member after an uncommitted member is cancelled, never published ahead of it (#6252).+- Write receipts no longer call an ordinary publication in progress `blocked` / `recovery_required`: a request needs recovery only when it is recovering or holds a recovery record without a live claim, and the requests behind a live publication show as waiting (#6275).+- Remote `put_page` skips the similar-pages advisory while `put_page.similar_pages` is off (the default) and runs it with JIT off when on; remote `get_page` / `fetch` read the page with JIT off, so brains past about 1,000 pages stop paying JIT compile time on every call (#6276).+- Bench: `scripts/bench/managed-sync-catchup.ts` reports feeder and lane timing, steady state, per-write foreground spans, an open-loop foreground row and `--pool-size`; results in `docs/eval/managed-sync-catchup.md`.+## [0.60.106.0] - 2026-10-07**Fix wave 12: one bad link no longer stops extraction, cut-off model answers stop counting as real ones, and paid loops stop paying.**diff --git a/docs/eval/managed-sync-catchup.md b/docs/eval/managed-sync-catchup.mdindex ea8032ad76..3b71bd8812 100644--- a/docs/eval/managed-sync-catchup.md+++ b/docs/eval/managed-sync-catchup.md@@ -810,3 +810,50 @@ What is left between the steady state and the wall figure is the startup:discovery and already-deleted files run one at a time before the firstgroup. At 57 ms that is about 80 s for this corpus, which is why the wallrate of a short backlog stays below 150 even when the lanes run at it.++## Feeder, lanes to 16 and foreground priority (lanes/startup/foreground plan)++Before and after on one Ubicloud `standard-16` VM (Ubuntu 24.04, Postgres in+Docker, toxiproxy at 57 ms), default settings unless a row says otherwise:+master `a865f8f8` against the branch at `d00f4d035`. The 57 ms `cli` rows ran+on 1,500 files time-boxed at 10 min (8 min for the lane sweep); the 10k row+ran to completion. **Steady** is pages/min between the 10% and 90% commits;+**first commit** is from the sync process's first statement.++| Gate | Master | Branch | Target | Result |+|---|---|---|---|---|+| G1 steady, 10k corpus | 174.8 | 372.7 | >= 300 | met |+| G2 10k backlog wall | 74.5 min | 33.5 min | <= 40 min | met |+| G3 first commit, 1,500 files (34 waived first) | 78.9 s | 20.3 s | <= 15 s | missed |+| G4 steady at 4 / 6 / 8 / 12 / 16 lanes, pool 20 | falls past 6 | 333.5 / 369.4 / 418.1 / 418.8 / 409.3 | non-decreasing within the 6-lane spread | see below |+| G5 `put_page` idle p50 / p95 | 8.6 / 11.6 s | 2.53 / 2.78 s | <= 3 / 4 s | met |+| G6 `put_page` during catch-up p50 / p95 | 11.3 / 17.1 s | 6.9 / 8.4 s | <= idle + 1 s (provisional) | missed |+| G7 catch-up while a write arrives every 5 s | 4.6 | 58.2 (15% of idle) | >= 50% of idle | missed |+| G8 steady at ~0 ms | 2,404 | 2,862 | >= 700 | met |++The three repeated default (6-lane) runs gave 381.3, 378.9 and 374.5 pages/min.++**G3.** Of the 20 s before the first commit, about 5.4 s is startup reads (90+serial round trips: configuration, source, writer and checkpoint reads), 5.6 s+is the 34 waived deletions (screened four at a time, then one waiver+transaction), 3.3 s is the first group's freeze and admission, 2.7 s its+preparation and about 3.5 s its publication. Each is a serial chain of round+trips; no single step holds the missing 5 s.++**G6 and G7.** A foreground write waits for the sync groups already+publishing, then publishes alone while no new group starts (about 2 s at 57+ms). With a write every 5 s and about 6.3 s from admission to visible, one is+almost always pending, so lanes average 1.1 busy. Letting each foreground+commit start a full round of groups instead of one did not move it (local+4-core bench, 55.2 to 57.4 pages/min, within noise): the foreground+publication's exclusive time sets the ceiling. Reaching half the idle rate+needs a foreground write to publish beside lane groups, which the plan's+ordering rule (no sync group starts while a disjoint-page write waits) does+not allow.++**Admit-ahead fix.** Before `d00f4d035`, admit-ahead asked for more requests+at once than the writer's outstanding-request limit (100) allowed whenever+groups were large (16 pages at ~0 ms) or lanes were many (8+); the admission+was refused and lanes ran one at a time. The sweep at `4004f1f2f` shows it:+8 / 12 / 16 lanes at 88.1 / 69.2 / 56.5 pages/min. Now the batch takes only the+room left after the cursor's next group and a reserve of 10.