Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

docs(sync): final counted numbers for v0.60.111.0; G3, G6 and G7 recorded as missed

garrytanb8ca6b81b0cd
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2b41330560..1a072d7669 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,9 +12,9 @@ identifiers and attribution are available in the pre-removal Git revision
## [0.60.111.0] - 2026-10-08
-**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.**
+**Managed Postgres sync catches up more than twice as fast, starts committing in about 18 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.
+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 publishes beside the running sync batches when it doesn't touch the same page.
### How to use it
@@ -31,18 +31,18 @@ Same 16-core machine and same Postgres, 57 ms round trips, default settings, mas
| 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 |
+| Catch up a 10,000-page backlog | 74.5 min | 33.6 min |
+| Pages per minute once the catch-up is running | 175 | 368 |
+| Time until the first page is committed | 79 s | 18 s |
+| Save one page with nothing else running (typical / slow) | 8.6 s / 11.6 s | 2.5 s / 2.7 s |
+| Save one page during a catch-up (typical / slow) | 11.3 s / 17.1 s | 3.1 s / 4.1 s |
+| Catch-up speed while your agent saves a page every 5 s | 0.4 pages/min, 115 of 120 saves failed | 174 pages/min, no saves failed |
+| Catch-up next to the database (about 0 ms) | 2,404 pages/min | 3,332 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 400 to 410 pages/min against 378 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.
+- **Writes during a catch-up still cost something.** A page save takes about 1.5 s longer at the slow end than with nothing running, and a save every 5 s slows the catch-up to about 45% of its idle speed. With a save every 5 s the slowest saves (p95) take about 22 s.
- **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
@@ -51,7 +51,7 @@ Same 16-core machine and same Postgres, 57 ms round trips, default settings, mas
- 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.
+- Foreground priority: a page write that names no queued or running sync group's page (slug, page id or rename source) publishes beside the running lane groups in the sync process; new lane groups wait only while such a write waits to be claimed, and background effects defer to lanes instead of interrupting them. A sync group naming the page keeps its place. 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).
diff --git a/docs/eval/managed-sync-catchup.md b/docs/eval/managed-sync-catchup.md
index 141666e73b..42a7e3cd07 100644
--- a/docs/eval/managed-sync-catchup.md
+++ b/docs/eval/managed-sync-catchup.md
@@ -813,47 +813,55 @@ rate 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
+Before and after on Ubicloud `standard-16` VMs (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.
+master `a865f8f8` against the branch at `0ba3b1f7c` (G4's lane means are from
+`d00f4d035`, the same lane code). 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. G7 is the open-loop row:
+one `put_page` every 5 s for the whole run, whether or not the last one
+finished. G6 is the closed-loop row (next write when the last returns, 1 s
+floor).
| 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 |
+| G1 steady, 10k corpus | 174.8 | 367.9 | >= 300 | met |
+| G2 10k backlog wall | 74.5 min | 33.6 min | <= 40 min | met |
+| G3 first commit, 1,500 files (34 waived first) | 78.9 s | 18.4 s | <= 15 s | missed |
| G4 steady at 4 / 6 / 8 / 12 / 16 lanes, pool 20 | falls past 6 | 333.5 / 369.4 / 399.9 / 406.6 / 408.5 (8 to 16: mean of 3 runs) | non-decreasing within the 6-lane spread | met |
-| 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 |
+| G5 `put_page` idle p50 / p95 | 8.6 / 11.6 s | 2.46 / 2.72 s | <= 3 / 4 s | met |
+| G6 `put_page` during catch-up p95, closed loop | 17.1 s | 4.06 s (idle 2.59 s), 0 of 184 failed | <= idle + 1 s (provisional) | missed (idle + 1.5 s) |
+| G7 catch-up while a write arrives every 5 s, open loop | 0.4 (115 of 120 writes failed) | 174.4 (45% of idle 391.1), 0 of 120 failed; writes p50 / p95 3.5 / 21.9 s | >= 50% of idle | missed |
+| G8 steady at ~0 ms | 2,404 | 3,332 | >= 700 | met |
The three repeated default (6-lane) runs gave 381.3, 378.9 and 374.5 pages/min.
The 8, 12 and 16 lane rows ran three times each: 418.1 / 384.8 / 396.9, 418.8 /
-392.5 / 408.4 and 409.3 / 398.5 / 417.6. A single 16-lane run first measured below
-the 12-lane run (409.3 against 418.8); the repeats show runs at one lane count
-spread by about 30 pages/min, and the means rise with the lane count.
-
-**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.
+392.5 / 408.4 and 409.3 / 398.5 / 417.6. Runs at one lane count spread by about
+30 pages/min, and the means rise with the lane count. A single sweep at
+`0ba3b1f7c` gave 334.2 / 388.7 / 395.7 / 415.5 / 371.9 for 4 / 6 / 8 / 12 / 16;
+its 16-lane run sits inside the spread of single runs but below 12, and was not
+repeated.
+
+An earlier open-loop run at `e2656589d` measured G7 at 204.2 pages/min (53% of
+idle 385), writes p50 / p95 3.2 / 14.6 s; the code between it and `0ba3b1f7c`
+changed startup only. One run at each head is not enough to tell a regression
+from run-to-run spread, so G7 is recorded from the final run.
+
+**G3.** Of the 18 s before the first commit, about 3.9 s is startup reads, 3.9
+s the 34 waived deletions (screened four at a time, then one waiver
+transaction), 3.2 s the first group's waiver and admission, about 3 s its claim
+and preparation and 3.3 s its publication. Each is a serial chain of round
+trips; about 2 s of it is first-use statement descriptions, which a
+cross-process description cache in the driver would remove.
+
+**G6 and G7.** A foreground write that names no queued or running group's page
+now publishes beside running lane groups in the sync process, instead of
+waiting for them and holding new groups back. On the open-loop row master
+catches up at 0.4 pages/min with 115 of 120 writes failing; the branch runs at
+174 to 204 pages/min with none failing. The remaining tail is
+writes in the drain's first minute waiting on the brain-wide persistence
+counters that every lane group also updates.
**Admit-ahead fix.** Before `d00f4d035`, admit-ahead asked for more requests
at once than the writer's outstanding-request limit (100) allowed whenever