Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

Merge remote-tracking branch 'origin/capy/lph-efg' into capy/large-pages-hardening

garrytand94aaf970fb2
diff --cc src/core/behavior-change-notice.ts
index 0b605c9b9e,9139625085..2abbfd439d
--- a/src/core/behavior-change-notice.ts
+++ b/src/core/behavior-change-notice.ts
@@@ -903,10 -903,8 +903,12 @@@ export const BEHAVIOR_CHANGES: Readonly
{ since: '0.60.299.0', text: 'Doctor `segmented_storage` no longer tells you to upgrade this host when the only writes holding segmented storage off are this host\'s own from before its upgrade and the upgraded gbrain has since made the same kind of write (the same import or sync type, resident kind or managed principal), after the last of them: it reports the hold as information with the time it clears. Another host, an older `serve` or worker still running on this host, or an older write this build has not matched (a cron job or `npx` run on this host) keeps the warning and the `gbrain upgrade` fix.' },
{ since: '0.60.299.0', text: 'Managed sync of a Markdown file over 24 MiB whose origin another page records (a page renamed with its file) now imports it into that page, as for a smaller file, instead of failing it `revision_conflict` ("A different page already owns this file identity") and stopping the source\'s sync at it.' },
{ since: '0.60.299.0', text: '`gbrain repair stuck-recovery` now resolves a page recovery whose file is over 24 MiB, which used to be listed as refused (`recovery_large_file_unsupported`) with no exit while it stopped every write on its source\'s worktree. The preview lists it with both fingerprints and the state of the staged copy of the prior file, backs up both versions, and writes a summary instead of a full diff (both hashes and sizes, the first byte where they differ, and a window of at most 1 KiB); `--apply --expect <hash> --keep prior|disk --yes` resolves it as it does a small file. Every read, hash and copy of the large file is done in pieces of at most a segment. When the staged copy of the prior file is missing or damaged, `--keep prior` refuses with `recovery_prior_stage_unavailable`, whose fix is the `--keep disk` apply, which keeps a damaged copy in the backup directory and removes it from the checkout.' },
+ { since: 'TBD', text: 'New `gbrain repair segmented-mirror [--source <id>]` for brains that ran a gbrain older than v0.60.299.0 with `pages.segmented_storage` on: on those versions a withdrawal (`forget`, `forget_fact`, `purge_fact`) of a row in a page stored in segments struck it in the database but left the page\'s canonical file holding it (the mirror skipped the page with `page_body_segmented`). Upgrading does not rewrite those files. Run the preview on the source\'s owner host: it lists each file-backed segmented page whose file still holds a withdrawn or purged row and otherwise matches the database, with the file\'s SHA-256 and size and those of the page\'s canonical render (`gbrain export`\'s bytes), and prints a hash; a file that also differs from the database for another reason is listed held (`file_database_drift`) and never rewritten. `--apply --expect <hash> --yes` rewrites each listed file to that render through the withdrawal mirror (one receipted write request per page, `operation: repair_segmented_mirror`) and its Git effect commits it; a file or page that changed since the preview refuses the apply with `preview_changed`. Doctor does not scan for these files (that needs every segmented file read), so run the preview once if this brain ever ran such a version.' },
+ // LPH (d): recovery records of unknown versions, and no version 2 mirror record while an older writer is seen.
+ { since: 'TBD', text: 'A publication or withdrawal-mirror recovery record of a version this gbrain does not know (one a newer gbrain wrote) is now refused with `recovery_version_unsupported` before anything reads it: the record, its staged files and the canonical file are left exactly as they are, the effect keeps retrying instead of parking, and `gbrain sources writer status` and a stalled sync name it as a blocker whose fix is `gbrain upgrade` on the owner host. Before, recovery could read a newer record as an older one: a withdrawal-mirror recovery published the bytes the record embedded, removed its staging file and cleared the record, and a request recovery tried to rewrite the record\'s staging (the database refused it with an untyped `unsupported_mutation_protocol`). v0.60.290.0 and older still read a version 2 withdrawal-mirror record as version 1 and fail every attempt with an untyped `effect_unavailable` while the record holds every write and effect on the worktree; they never delete the record or its staging file, and an upgraded owner finishes it.' },
+ { since: 'TBD', text: 'While a gbrain older than the segmented writer floor (v0.60.290.0 included) that doctor `segmented_storage` still warns about wrote to the brain in the last 7 days (another host, an older `serve` or worker still running on this host, or an older write this build has not matched; doctor names the host), a withdrawal (`forget`, `forget_fact`, `purge_fact`) on a page stored in segments still commits, but its withdrawal mirror no longer writes a version 2 recovery record, which that older gbrain cannot read and would wedge the worktree on. The mirror refuses `segmented_mirror_writer_gate` (its fix names the hosts to upgrade), retries, and parks after five attempts like any failed mirror, so writes on the worktree are not held; the page\'s canonical file keeps the withdrawn row and the withdrawal\'s Git effect waits meanwhile. Once the older writer is upgraded and out of the 7-day window, the parked mirror runs again by itself (checked at most once a minute), rewrites the file and the Git effect commits it. `gbrain sources writer retry-effects` retries it at any time. A hold left only by this host\'s own writes from before it upgraded, which the upgraded gbrain has since superseded with the same kind of write (doctor reports it as information), still keeps new pages inline but does not hold the mirror: an upgraded single-host brain mirrors withdrawals at once.' },
+ // Large-pages hardening (f).
+ { since: 'TBD', text: 'A withdrawal (`forget`, `forget_fact`, `purge_fact`) of a claim in a facts fence that crosses a forced segment cut, when that one fence holds more than 16,384 rows (or more than 8 MiB of rows to check), is still refused `withdrawal_capacity` (the bound is unchanged), but the refusal now says why: it carries reason `split_fence_rows`, names the page, the fence\'s row count and the limit, and its fix asks you to split that fence into fences of at most 16,384 rows and write the page again. It used to say discovery "could not prove a bounded complete target set" and told you not to split the source.' },
];
/** The newest disclosed change's release: the notice id moves only when a release adds rows. */
diff --cc test/postgres-unit-arms.txt
index 90d32879db,105832eaf9..ad5a65751f
--- a/test/postgres-unit-arms.txt
+++ b/test/postgres-unit-arms.txt
@@@ -254,9 -254,8 +254,11 @@@ test/pathological/b-9-enrich-retired-al
test/pathological/b6-triage-verdict-surrogate.test.ts
test/pathological/c-23-override-and-doctor-fixes.test.ts
test/pathological/c-9-facts-absorb-dead.test.ts
+test/pathological/lp-a-segmented-mirror.test.ts
+test/pathological/lp-d-recovery-version.test.ts
+test/pathological/lp-d-segmented-mirror-gate.test.ts
+ test/pathological/lp-f-split-fence-withdrawal-capacity.test.ts
+ test/pathological/lp-g-file-digest-fence-bound.test.ts
test/persistence-background-pause.test.ts
test/persistence-bounded-read-session.test.ts
test/persistence-capacity-forecast.test.ts