Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix(GST-1209): verify guards: spawn seam, vetted tiling builders, parsed-markdown reader row, scoped hint
garrytan4eebef1bdc54
diff --git a/scripts/check-engine-sql-dynamic.ts b/scripts/check-engine-sql-dynamic.tsindex 29c3b6b411..472e297a1c 100644--- a/scripts/check-engine-sql-dynamic.ts+++ b/scripts/check-engine-sql-dynamic.ts@@ -84,6 +84,8 @@ const VETTED_BUILDERS: Record<string, string> = {factVisibilitySql: 'src/core/access/member-facts.ts: visibility values filtered to the constant set world/private; widened only by memberFactAdmitSql, whose member id passed ACCESS_ID_RE (no quote) and whose page test is privatePagesFilterForCaller; no values',onMemberPageSql: 'src/core/access/member-facts.ts: constant memory/members/ prefix test over a code-provided facts alias; no values',privateProvenanceFilterUnderPolicy: 'src/core/search/private-visibility.ts: constant fact-provenance predicate (readers part with no identity, or the caller identity on its own member page whose id passed ACCESS_ID_RE; privacy part dropped only under an operator relaxation); no values',+ liveTilingSql: 'src/core/page-body/schema.ts: constant LATERAL aggregate of the live manifest rows of a caller page alias (count, covered bytes, gapless); no values (GST-1209)',+ untiledSql: 'src/core/page-body/schema.ts: constant predicate over caller page and tiling aliases; no values (GST-1209)',stagingNeedsTextSql: 'src/core/page-body/schema.ts: constant live-staging text-reference EXISTS predicate over a caller text alias; no values (Wave B purge)',atomRetirementPurgeHold: 'src/core/persistence/atom-retirement-hold.ts: constant #7013 restorable-atom purge-hold predicate over a caller pages alias; no values',derivedRetirementPurgeHold: 'src/core/persistence/derived-retirement-hold.ts: constant GBRA-161 derived-retirement purge-hold predicate over a caller pages alias; no values',diff --git a/scripts/page-body-readers-baseline.tsv b/scripts/page-body-readers-baseline.tsvindex 69875bdbc6..6c41410e6d 100644--- a/scripts/page-body-readers-baseline.tsv+++ b/scripts/page-body-readers-baseline.tsv@@ -556,6 +556,7 @@ src/core/repair/secret-spans.ts readFields field INLINE inline body columns; a ssrc/core/repair/secret-spans.ts writePage call:contentHash INLINE runs only for an inline page; a segmented body is restaged through prepareSegmentedBody and applySegmentedBodysrc/core/repair/secret-spans.ts writePage sql INLINE runs only for an inline page; a segmented body is restaged through prepareSegmentedBody and applySegmentedBodysrc/core/repair/segmented-mirror.ts fileHoldsWithdrawnRows field NONE the overlay result of one file fragment (a facts fence block) for the region digests (body-digests.ts); no page body is read+src/core/repair/segmented-tiling.ts republish field NONE reads the compiled_truth and timeline parseMarkdown returns for the file blob HEAD holds; no stored page body is read (the damaged one is never read)src/core/repair/slug-conflicts.ts pageContent call:serializePageToMarkdown SEGWsrc/core/repair/split-facts.ts mergeOne call:serializePageToMarkdown SEGWsrc/core/repair/split-facts.ts mergeSplitFacts call:serializePageToMarkdown SEGWdiff --git a/src/core/page-body/body-tiling.ts b/src/core/page-body/body-tiling.tsindex a4939fe21e..c3fff40f69 100644--- a/src/core/page-body/body-tiling.ts+++ b/src/core/page-body/body-tiling.ts@@ -21,7 +21,7 @@ export function assertRowsTile(rows: readonly RowSpan[], at: { slug: string; sou}if (end >= 0 && (at.total === null ? rows.length > 0 : end === at.total)) return;throw opError('page_body_rows_unreadable', `Page ${at.slug} (source ${at.sourceId}): the segment rows readable here do not cover its ${at.total ?? 'stored'}-byte body, so nothing was read.`,- 'Give the role that reads the brain the same access to page_body_manifest and page_segment_texts it has to pages, then read again. When gbrain doctor --only segmented_tiling lists the page, its rows are missing: preview gbrain repair segmented-tiling --source <id>.',+ `Give the role that reads the brain the same access to page_body_manifest and page_segment_texts it has to pages, then read again. When gbrain doctor --only segmented_tiling lists the page, its rows are missing: preview gbrain repair segmented-tiling --source ${at.sourceId}.`,{ detail: JSON.stringify({ rows: rows.length, covered_bytes: end >= 0 ? end : null, body_bytes: at.total }) });}diff --git a/src/core/repair/segmented-tiling.ts b/src/core/repair/segmented-tiling.tsindex 049597f7a2..98a445410e 100644--- a/src/core/repair/segmented-tiling.ts+++ b/src/core/repair/segmented-tiling.ts@@ -19,7 +19,7 @@* stored page in anything else imports normally), and writes the page's receipt, also appended to the `segmented-tiling`* audit log. Explicit-only: never from doctor, a remediation plan or an upgrade.*/-import { execFileSync } from 'node:child_process';+import { execFileSync } from '../spawn.ts';import { createHash } from 'node:crypto';import { join } from 'node:path';import type { BrainEngine } from '../engine.ts';