Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
docs(release): CHANGELOG entry and upgrade note for fence_integrity and the fence repair caps (#6188)
garrytanef840134feff
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 31f8b324b2..0c6464ec28 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -10,6 +10,32 @@ 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.100.0] - 2026-10-06++**`gbrain doctor` now counts every broken facts or takes table still waiting in your brain, and says what would fix each one.**++After v0.60.98.0 and v0.60.99.0 a broken table never blocks a sync: gbrain repairs it in place when it can, and holds it otherwise. That still left one question without an answer: how many are left, and where? A held file was visible in `gbrain sources status`, but a page an older release imported with a broken table, or a file edited in the checkout and not yet synced, showed up nowhere. The new `fence_integrity` check finds all three, counts each table once, and splits them by what would fix them. Tables gbrain repairs by itself are fixed the next time the file syncs or the page is written. The rest need the named table edited. The same check shows the oldest hold and how many tables were repaired in the last 7 days and by which writer. A source at 20 or more warns, because something keeps writing broken tables.++### What you see++| Where | What changed |+|---|---|+| `gbrain doctor` | New `fence_integrity` check. Per source: held files, stored pages and unsynced checkout files with a broken table, each counted once, split by tier (`deterministic`, `resolver`, `llm`, `manual`). It also shows the oldest hold's age, the last 7 days of repaired tables with the top writers, and the model-repair caps with today's spend. The fix names the next step: `gbrain sources status <id>` for held files, `gbrain get --source <id> -- <slug>` (then write the page again) for stored pages, `gbrain sync --source <id> --no-pull` for unsynced files. |+| Scan budget | Each doctor run scans stored pages and source checkouts for up to 10 seconds (`GBRAIN_DOCTOR_FENCE_TIMEOUT_MS`) and resumes where the last run stopped. Until a scan finishes, the check reports partial, never ok. A brain with nothing to scan stores nothing. |+| New settings | `fences.repair.max_usd_per_page` (default $0.05) and `fences.repair.max_usd_per_day` (default $1.00) cap model repair of tables, per page and per UTC day across every gbrain process; `0` turns model spend off. They are validated at `gbrain config set` and shown by doctor. Nothing spends under them yet. |+| `gbrain repair`, `doctor --remediate` | A repair kind that calls a paid chat model reports `cost.llm_usd` and what is left under its cap. `--remediation-plan` includes that spend in the step's estimate, and `--remediate --max-usd` gives the step what is left of the budget and counts its spend once. No shipped kind calls a model yet. |++### Itemized changes++- The fence census (`src/core/fence-repair/census.ts`) finds candidates per source: `invalid_fence` holds, stored pages whose tables fail the repair step, and checkout files. Stored pages: a one-time resumable backfill, then incremental passes over pages updated since a watermark. Each new watermark starts before the oldest writer transaction still open, so a page written by a transaction that committed late is still read. Checkout files: a resumable full walk, then only changed, untracked and already-flagged files. Every finding is bound to the bytes it judged and records locations and reason codes only, never a cell value.+- Census state, the per-source repaired-table trend and paid-repair attempt claims live in `op_checkpoints` and survive the 7-day checkpoint purge while their source lives. A sync run writes one trend row; each repaired page write adds one row in its own publication.+- The durable per-UTC-day USD ledger (`src/core/budget/daily-ledger.ts`, over the existing `budget_ledger` and `budget_reservations` tables) and the attempt memo for paid table repairs (`src/core/fence-repair/attempts.ts`) ship for the model repair that follows. Doctor reads today's ledger spend.+- Repair kinds can declare `spends: 'llm'`. The repair runner then passes a per-run allowance to the kind and stops when it is used up. The doctor remediation run reserves only the embedding part of such a step up front and settles the model spend once.++### For contributors++- `test/fence-census.test.ts` (PGLite, Postgres through `test/e2e/fence-census-postgres.test.ts`) covers dedup across holds, pages and files with tiers, the watermark (a late commit simulated on PGLite; a real open transaction in a second session on Postgres), backfill and file-walk resume across several deadlines, the changed-file walk, the purge exemption, trend replay safety and the privacy sentinel. `test/doctor-fence-integrity.test.ts` covers ok, warn, partial, the trend threshold at 20 and not below, and caps display. `test/repair-llm-cost.test.ts` covers the cost surfaces and doctor budget composition with a stub kind. `test/daily-ledger.test.ts` and `test/fence-repair-attempts.test.ts` cover the ledger and attempt memo on both engines.+## [0.60.99.0] - 2026-10-06**A facts or takes table with one obvious meaning is now fixed in place instead of held: managed sync rewrites it, commits the file and keeps going.**diff --git a/skills/migrations/v0.60.100.0.md b/skills/migrations/v0.60.100.0.mdnew file mode 100644index 0000000000..52db4f795e--- /dev/null+++ b/skills/migrations/v0.60.100.0.md@@ -0,0 +1,64 @@+# Upgrade to v0.60.100.0: doctor counts the broken facts and takes tables left++`gbrain doctor` has a new `fence_integrity` check. Per source, it counts every+malformed facts or takes table still waiting, once each: a file managed sync+held (`invalid_fence`), a stored page an older release imported with a broken+table, and a checkout file not yet synced. It splits them by the tier that+would fix them: `deterministic` (gbrain repairs it the next time the file+syncs or the page is written), `resolver` (a holder name to resolve), `llm` (a+table only a rewrite can realign) and `manual` (an edit only a person can+decide). It also shows the oldest hold, the tables repaired in the last 7 days+with their top writers, and the model-repair caps with today's spend.++1. **Finish the upgrade.** `gbrain upgrade` runs it; no schema migration is+ added. Restart every `gbrain serve`, autopilot and worker.++2. **Run the check.**+ ```bash+ gbrain doctor --only fence_integrity --json+ ```+ Each run scans stored pages and source checkouts for up to 10 seconds+ (`GBRAIN_DOCTOR_FENCE_TIMEOUT_MS`) and resumes where the last run stopped.+ A `partial` result means the scan has not finished: run the same command+ again until `details.partial` is `false`. Do not report a partial result+ as healthy.++3. **Act on what it lists.** `details.sources[]` gives each source's counts+ by bucket and tier, and `details.sources[].sample` the first tables (slug,+ path, tier, reasons; never a cell value). The check's `fix` is the next+ step:+ - Held files: `gbrain sources status <id>` names the file, table, section,+ rows and reason. Read the page (`gbrain get --source <id> -- <slug>`),+ edit only that table in the file, commit, then+ `gbrain sync --source <id> --no-pull`.+ - Stored pages: read the page with `gbrain get --source <id> -- <slug>`+ and write it again with `put_page`. gbrain repairs a fixable table in+ that write and reports `fences_normalized`; a table it cannot repair+ refuses `invalid_fence` with `fence_issues` naming every row and column+ to fix.+ - Unsynced files: `gbrain sync --source <id> --no-pull`. A fixable table is+ repaired and committed; any other is held, then fixed as above.+ Write facts with `remember` and takes with `takes_add`: their rows never+ need repair.++4. **Tell the user about a noisy writer.** When a source had 20 or more tables+ repaired in 7 days, the check warns and names the top writers (a receipt+ principal such as `oauth_client`, or a top directory for sync). Something+ keeps writing broken tables; tell the user so it can be fixed at the+ source.++5. **Know the new settings.** `fences.repair.max_usd_per_page` (default+ `0.05`) and `fences.repair.max_usd_per_day` (default `1.00`) cap model+ repair of tables, per page and per UTC day across every gbrain process.+ `0` turns model spend off. Nothing spends under them in this release.+ Raising them is the user's call:+ ```bash+ gbrain config set fences.repair.max_usd_per_day <usd>+ ```++6. **Verify:**+ ```bash+ gbrain doctor --only fence_integrity --json+ ```+ `status: "ok"` means nothing is waiting, every source's scan is complete,+ and no source is at the repair-trend threshold.diff --git a/skills/skills.lock.json b/skills/skills.lock.jsonindex cf0ad15f68..a7d660321c 100644--- a/skills/skills.lock.json+++ b/skills/skills.lock.json@@ -152,6 +152,7 @@"migrations/v0.59.0.0.md": "7903e547e79ad3429a393d9102a610e2674388bfaa71607431b1cd857b4af939","migrations/v0.59.10.0.md": "e0268a05ab184d5518f88747313e772629b2af91db59eacbba728f2ebd9db3cd","migrations/v0.59.2.0.md": "b6d61af8ef48c154a26e8d427dd6f6570e99efb82b891728426046eea493247b",+ "migrations/v0.60.100.0.md": "63583a73e957c5421bb826f2be48ac1aafaaa994392c1a05f26d1516b48c8573","migrations/v0.60.11.0.md": "1e503113f591c5cd142b78ab4472bbdbceb890c6cbac2fbdf8aa61cd087200b8","migrations/v0.60.20.0.md": "9266863a9f76164c64a72b1be17b8ddb3bb97e1c3c5db9f666b69ebc7a228fdd","migrations/v0.60.26.0.md": "30d761ef5a2361bad66053f97b7b659304a591274be33e281f4f6df0d7d5566e",