Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

Merge origin/master into capy/fence-adoption-unmanaged-widening

garrytand83d5bd91948
diff --cc CHANGELOG.md
index 9a7100be5d,9d77fdb261..8d4dbdd45b
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -10,15 -10,20 +10,29 @@@ 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]
+
+**The v0.60.218.0 notes now say where a private fact could become world.** Before v0.60.218.0, fencing a legacy fact into a leftover fence row with a different visibility was refused on a managed brain. An unmanaged brain had no such check, so a private fact could be published as world, in the page file and in the database. The `BEHAVIOR_CHANGES` row and `docs/guides/write-refusals.md#fence_unrenderable` claimed the refusal held everywhere; both now describe the two paths. Code is unchanged: v0.60.218.0 already closed the unmanaged path.
+
+### Itemized changes
+
+- **Docs**: the v0.60.218.0 fact-fence row in `src/core/behavior-change-notice.ts` (wording only) and the `fence_unrenderable` entry in `docs/guides/write-refusals.md` name the unmanaged path.
+- **Regression test**: `test/fact-fence-adoption-exits.test.ts` covers an unmanaged brain (PGLite and Postgres): a leftover world cell plus a private legacy fact with the same claim and source keeps the fact private in the file and the database after `extract_facts`. It fails on the build before v0.60.218.0 and passes now.
+
+ ## [0.60.233.0] - 2026-10-14
+
+ **An autopilot `sync` job on a managed brain now drains its source until it is caught up or its deadline arrives, instead of landing about one page per job (#6706).** On a managed brain each `sync` Minions job ran a single pass: it admitted one page write, waited 5 s for it and returned `partial`. Where a write takes 10-20 s to commit, each freshness job landed about one page and still reported `completed`, so a 10-entry delta took 3 hours while `gbrain sync` drained the same backlog in under 2 minutes. Now the job drains on one lane until the source is synced or its deadline (less a reserve for cleanup) arrives, queues one follow-up job when work is left, and reports its result in the same shape as the CLI. To go back: `gbrain config set sync.job_drain false`. Inline `gbrain jobs work` and supervisor workers need a restart to pick it up.
+
+ ### Itemized changes
+
+ - **The job drains to its deadline** (`src/core/minions/handlers/sync-job-drain.ts`, `src/core/minions/handlers/sync.ts`): the deadline is the job's `timeout_at`, or the queue's wall-clock kill instant for a job without `timeout_ms`, capped at an hour and less `min(60 s, remaining/4)` so git, cleanup and the embed submission finish in time. Embeds are queued once when the job ends, as before.
+ - **Bounded drain** (`src/core/persistence/sync-drain.ts`): `runDrain` takes a caller deadline, and the earlier of it and the CLI run deadline wins. A deadline already past makes no pass. A deadline that lands in a retry backoff, a capacity wait or a hung reconnect returns `resumable / deadline` instead of throwing; fatal errors still throw. A pass that ignores the abort is abandoned after 10 s and fenced at its next step.
+ - **One drainer per source** (`src/commands/autopilot-dispatch.ts`): freshness dispatch keeps at most one pending sync job per source and skips a source that already has a live sync job. A second managed sync job that starts while another drains its source completes as `skipped: sync_in_progress` with `running_job_id` and a `next` that watches it.
+ - **One follow-up job** (`src/core/minions/handlers/sync.ts`): when a drain stops with work left, made progress and is safe to loop, the job queues one continuation (priority 5 or lower, behind waiting embeds, with the parent's `timeout_ms`) and names it in `continuation_job_id`. Only worker-backed brains and trusted submitters get one.
+ - **Job results** (`src/core/minions/handlers/sync-job-drain.ts`): a drained job result carries `outcome`, `drain`, `next` and `incomplete`, with `pagesAffected` and `held` trimmed to 50 entries plus counts, and `gbrain jobs get` shows progress while it runs. Results from non-managed brains are unchanged.
+ - **Liveness** (`src/core/persistence/sync-movement.ts`, `src/core/persistence/sync-status.ts`): `gbrain sources status` and `writer movement` treat a live sync job as the source's drain (`live.drain_job_id`), and `gbrain sync status` names it in `live_job_id` and points `next` at it instead of starting a second drainer.
+ - **Tests:** `test/sync-handler-drain-6706.test.ts` (PGLite and Postgres) holds each write past the 5 s single pass: the previous handler lands no page, the new one lands all four in one job. `test/sync-drain-deadline-6706.test.ts` covers every deadline stop, the abandoned-pass fence and `jobDisposition` per stop reason.
+
## [0.60.232.0] - 2026-10-14
**MCP `list_write_conflicts` refuses a source outside the caller's grant and bounds its window to that source's own requests (#6643 follow-up).** A remote caller that named a source outside its grant used to get an empty report back. The response's `window` sequences were also brain-wide, so polling one granted source showed write activity in sources the caller cannot see. Both were found by GBRA-60's D5 agent smoke.