Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix(fence-repair): relink fix names the fence repair without a hand-built command; docs command parser drops sentence punctuation; remote doctor registry golden lists fence_integrity (#6188)

garrytan5a1f840b5bea
diff --git a/docs/guides/facts-relink.md b/docs/guides/facts-relink.md
index 206cc315fa..fe947861f1 100644
--- a/docs/guides/facts-relink.md
+++ b/docs/guides/facts-relink.md
@@ -114,7 +114,7 @@ gbrain remember "<the fact>" --provenance "<source>" --entity <slug>
| `withdrawn` | no | This claim was explicitly forgotten for that entity, so relink will not attach it there. |
| `page_file_missing` | no | The entity page exists in the database but its file is missing from the source tree. Restore the file or run gbrain sync, then rerun. |
| `unfenceable` | no | The source writes through to files but has no canonical owner. Bind the source (gbrain sources writer status <source> --json, then gbrain sources writer claim <source> --path <checkout> --admin-intent writer_claim --expected-state <admin_state>), then rerun. |
-| `fence_malformed` | no | The entity page has a ## Facts fence that cannot be normalized. Preview its repair with gbrain repair fences --slug <entity-slug> (read-only; it names the exact edit when gbrain will not repair it), apply it, then rerun. |
+| `fence_malformed` | no | The entity page has a ## Facts fence that cannot be normalized. Preview the fence repair of that page (`repair fences --slug <entity-slug>` on the brain host; read-only, and it names the exact edit for anything it will not repair), apply it, then rerun. |
| `claim_unfenceable` | no | The claim text cannot be written to a fence row unchanged (for example it is wrapped in ~~). Forget it and remember a cleaned-up claim with --entity. |
| `visibility_conflict` | no | The entity already has the same claim from the same source with the other visibility, and a page indexes only one. Forget the copy you do not want, then rerun. |
| `fence_owned` | no | The fact lives in another page fence (a transcript). Relink does not move fence-owned facts. |
diff --git a/src/core/facts/relink-reasons.ts b/src/core/facts/relink-reasons.ts
index e7f7339c62..022e75645f 100644
--- a/src/core/facts/relink-reasons.ts
+++ b/src/core/facts/relink-reasons.ts
@@ -15,7 +15,7 @@ export const RELINK_REASONS = {
withdrawn: { memoized: false, fix: 'This claim was explicitly forgotten for that entity, so relink will not attach it there.' },
page_file_missing: { memoized: false, fix: 'The entity page exists in the database but its file is missing from the source tree. Restore the file or run gbrain sync, then rerun.' },
unfenceable: { memoized: false, fix: 'The source writes through to files but has no canonical owner. Bind the source (gbrain sources writer status <source> --json, then gbrain sources writer claim <source> --path <checkout> --admin-intent writer_claim --expected-state <admin_state>), then rerun.' },
- fence_malformed: { memoized: false, fix: 'The entity page has a ## Facts fence that cannot be normalized. Preview its repair with gbrain repair fences --slug <entity-slug> (read-only; it names the exact edit when gbrain will not repair it), apply it, then rerun.' },
+ fence_malformed: { memoized: false, fix: 'The entity page has a ## Facts fence that cannot be normalized. Preview the fence repair of that page (`repair fences --slug <entity-slug>` on the brain host; read-only, and it names the exact edit for anything it will not repair), apply it, then rerun.' },
claim_unfenceable: { memoized: false, fix: 'The claim text cannot be written to a fence row unchanged (for example it is wrapped in ~~). Forget it and remember a cleaned-up claim with --entity.' },
visibility_conflict: { memoized: false, fix: 'The entity already has the same claim from the same source with the other visibility, and a page indexes only one. Forget the copy you do not want, then rerun.' },
fence_owned: { memoized: false, fix: 'The fact lives in another page fence (a transcript). Relink does not move fence-owned facts.' },
diff --git a/test/fence-docs-config-commands.test.ts b/test/fence-docs-config-commands.test.ts
index e7e3ff9836..ea5946c8db 100644
--- a/test/fence-docs-config-commands.test.ts
+++ b/test/fence-docs-config-commands.test.ts
@@ -28,7 +28,8 @@ const DOCS = [
'docs/guides/troubleshooting.md', 'docs/guides/repair.md', 'docs/operations/spend-controls.md',
];
const OPT_OUTS = ['gbrain config set fences.normalize false', 'gbrain config set fences.repair.enabled false', 'gbrain config set fences.repair.llm false'];
-const COMMAND = /gbrain config set (fences\.[A-Za-z_.]*[A-Za-z_])\s+([^\s`'")]+)/g;
+/** The value ends before closing quotes, brackets or the sentence punctuation of the prose (or CLI output line) that prints it. */
+const COMMAND = /gbrain config set (fences\.[A-Za-z_.]*[A-Za-z_])\s+([^\s`'")]+?)(?=[.,;:]?(?:\s|$|[`'")]))/g;
/** A placeholder value (`<usd>`, `<n>`) stands for a number the user picks. */
const sample = (value: string) => (/^<[a-z_]+>$/.test(value) ? '2' : value);
diff --git a/test/fixtures/goldens/doctor/registry-report-remote.json b/test/fixtures/goldens/doctor/registry-report-remote.json
index eeefefa308..c8b08eb94c 100644
--- a/test/fixtures/goldens/doctor/registry-report-remote.json
+++ b/test/fixtures/goldens/doctor/registry-report-remote.json
@@ -221,6 +221,10 @@
"category": "brain",
"name": "connector_held_items"
},
+ {
+ "category": "brain",
+ "name": "fence_integrity"
+ },
{
"category": "brain",
"name": "unbound_source"