Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix(#5988): integrate with the operator wave: protected chronicle keys, keyless remote refusals, lean-row stale, sequential hold reads, writer inventories, goldens
garrytand2ff1c52f2c8
diff --git a/docs/architecture/canonical-writers.tsv b/docs/architecture/canonical-writers.tsvindex 16828c41b3..764f72e6d3 100644--- a/docs/architecture/canonical-writers.tsv+++ b/docs/architecture/canonical-writers.tsv@@ -133,6 +133,7 @@ src/core/persistence/topology-recovery.ts 2 coordinator Verified directory-swapsrc/core/persistence/connector-sync.ts 4 coordinator Connector freshness and source-scoped deletion commit through original/current authority, source and revision guards, canonical publication and checkpoint CAS. A skipped unchanged checkpoint save stamps sources.last_sync_at/newest_content_at (never page content) inside withCoordinatedWrite, in a transaction that first asserts the connector sync lease, scoped to the source incarnation (#5686/#5470). Its importFromContent calls carry prepare and run inside the coordinator publication.src/core/persistence/prepared-maintenance.ts 5 coordinator Named local maintenance uses native owner publication; contributing semantic facts and take lifecycle are revalidated and committed together with canonical files and receipts; a chronicle event page and its depth timeline projection commit in one publication; v0.32.2 fact adoption re-locks the pinned legacy facts and their fence positions and sets their row positions ahead of the canonical projection in the same publication, then restores take resolutions recorded only in the database that the unchanged takes fence projection would clear.src/core/persistence/facts-prepare.ts 3 coordinator Multi-entity fact publication rechecks original/current source authority, origin and target revisions, withdrawals and deduplication under coordinated page locks; a direct single-fact write (supersede intent) strikes the superseded fence row and expires and links the old fact in the same publication transaction.+src/core/persistence/file-repair.ts 5 coordinator The managed_file_repair preparer (#5988) re-screens and re-prepares the repaired file exactly as a managed sync import (importFromContent with prepare, no write) and refuses any result that differs from the previewed digest; its apply runs inside the coordinated publication with the page key locked: updateSlug and the implicit type for a rename, the prepared import, source_path, projections, the hold clear and the import provenance commit with the file write.src/core/embed-facts.ts 1 projection Explicit bounded repair updates only fact embedding projections with selected-brain off-switch, invocation budget, source incarnation and fact-row version checks before atomic installation.src/core/shared-skills/knowledge-guard.ts 0 coordinator Page publication rejects registered skill namespaces and manifest paths using source incarnations, canonical roots and stored physical aliases; the coordinator rechecks before bytes and inside publication guards.src/core/skillpack/writer-guard.ts 0 filesystem_guard Legacy skill writers reuse durable managed-root and symlink-aware refusal; multiply linked sinks fail closed against out-of-root inode aliases, with put_skill and host-authorized adoption remedies.@@ -202,6 +203,7 @@ src/core/repair/extractor-facts.ts 1 coordinator `gbrain repair extractor-facts`src/core/repair/captured-facts.ts 1 coordinator `gbrain repair captured-facts` expires preview-approved capture-lane facts that have no fence row. On a managed brain the UPDATE runs only inside the managed_maintenance_expire_captured_facts publication (owner-checked by maintenancePreflight, page key locked); an unmanaged brain runs it in one transaction. Fenced rows are never updated here: they are struck in the page and expired by the canonical projection of a revision-bound put_page.src/core/persistence/atom-maintenance.ts 1 coordinator A managed atom retirement stamps retired_by/retired_at on the tombstone inside the coordinator publication of its managed_atom_delete request, after the page deletion path removed the canonical file, so the database row and file change commit or roll back together.src/core/repair/stale-atoms.ts 2 coordinator gbrain repair stale-atoms retires an atom on a managed brain through a managed_maintenance_retire_stale_atoms coordinated request (the marker stamp runs in its publication); only an unmanaged brain soft-deletes and stamps in a direct page-locked transaction, where no canonical writer enforcement applies.+src/core/repair/frontmatter.ts 2 coordinator `gbrain repair frontmatter --apply` (#5988) publishes a managed source's repaired file only through submitManagedFileRepair (the managed_file_repair request, preview-hash bound). On an unmanaged (legacy) source it writes the previewed bytes after a backup, moves a renamed page with updateSlug and its source_path in one maintenanceTransaction, then imports the file through importFromFile; no canonical writer enforcement applies there.src/commands/sources-mirror.ts 1 engine_guard `gbrain sources mirror-readonly|mirror-writable` (#5409) updates only sources.config.mirror_read_only, exactly as `sources federate` updates sources.config.federated; the sources managed_writer_guard trigger governs the row and no page, fact or file is written.src/core/sync-upstream.ts 1 engine_guard `recordUpstreamObservation` (#5255/#5176) updates only sources.upstream_checked_at, upstream_commit and upstream_behind, observations of the checkout's Git upstream outside managed_writer_guard's protected topology and checkpoint tuples; no page, fact or file is written, and a failure never fails the sync.src/core/persistence/mirror-read-only.ts 1 coordinator classifyMirrorPage stamps pages.database_only_reason=mirror_read_only only inside the coordinator publication transaction of a page write that published no file into a read-only mirror source (#5409), as classifyUnboundPage does for unbound sources.diff --git a/docs/architecture/system-of-record.md b/docs/architecture/system-of-record.mdindex 259b916c87..3750c6d9c7 100644--- a/docs/architecture/system-of-record.md+++ b/docs/architecture/system-of-record.md@@ -222,6 +222,7 @@ or a physical projection that leaves attribution untouched):- `src/core/persistence/connector-sync.ts` (2): connector publication inside `withCoordinatedWrite`.- `src/core/persistence/derived-facts.ts` (1): `withDerivedFactsWrite` (managed derived facts).- `src/core/persistence/facts-prepare.ts` (3): managed `extract_facts` request preparer.+- `src/core/persistence/file-repair.ts` (2): `managed_file_repair` request preparer (#5988).- `src/core/persistence/grandfather.ts` (2): request preparer.- `src/core/persistence/links-maintenance.ts` (1): coordinated maintenance.- `src/core/persistence/loop-fact-retirement.ts` (1): request preparer.@@ -232,6 +233,7 @@ or a physical projection that leaves attribution untouched):- `src/core/persistence/semantic-pages.ts` (1): `add_timeline_entry` request preparer.- `src/core/persistence/sync-prepare.ts` (4): managed sync request preparer.- `src/core/persistence/takes-prepare.ts` (3): takes request preparer.+- `src/core/repair/frontmatter.ts` (1): a `managed_file_repair` request on managed sources; the unmanaged rename runs in `maintenanceTransaction`.- `src/core/repair/stale-atoms.ts` (3): a request on managed brains; the unmanaged retirement runs in `maintenanceTransaction`.<!-- write-attribution-covered:end -->diff --git a/docs/mcp/TOOL_REFERENCE.md b/docs/mcp/TOOL_REFERENCE.mdindex 3ff9fcad4a..10ed2e610c 100644--- a/docs/mcp/TOOL_REFERENCE.md+++ b/docs/mcp/TOOL_REFERENCE.md@@ -156,7 +156,7 @@ Get recent ingestion log entries## `get_page`-Read a page by slug (supports optional fuzzy matching). Slug aliases left by renames redirect to the canonical page in the source that owns the alias (archived sources excluded); a redirected read reports `resolved_slug`. To edit a page, pass include_content: true — the returned `content` field is the canonical full markdown (frontmatter + body + timeline sentinel); edit THAT and pass it back to put_page to round-trip losslessly. Reassembling compiled_truth/timeline by hand risks dropping sections. Soft-deleted pages are hidden by default; pass include_deleted: true to surface them with deleted_at populated (see v0.26.5 recovery window). `timeline` is only the markdown section after the timeline sentinel; entries written by add_timeline_entry or extraction live in timeline rows, which include_timeline_entries: true returns as `timeline_entries` (the same rows get_timeline returns).+Read a page by slug (supports optional fuzzy matching). Slug aliases left by renames redirect to the canonical page in the source that owns the alias (archived sources excluded); a redirected read reports `resolved_slug`. To edit a page, pass include_content: true — the returned `content` field is the canonical full markdown (frontmatter + body + timeline sentinel); edit THAT and pass it back to put_page to round-trip losslessly. Reassembling compiled_truth/timeline by hand risks dropping sections. Soft-deleted pages are hidden by default; pass include_deleted: true to surface them with deleted_at populated (see v0.26.5 recovery window). `timeline` is only the markdown section after the timeline sentinel; entries written by add_timeline_entry or extraction live in timeline rows, which include_timeline_entries: true returns as `timeline_entries` (the same rows get_timeline returns). `file_held` means sync holds this page's newer file: you are reading the last good revision, and put_page refuses until the file is repaired (follow its `fix`).| Parameter | Type | Guidance || --- | --- | --- |diff --git a/src/commands/sync/holds.ts b/src/commands/sync/holds.tsindex 1c1ded38b8..dad014019a 100644--- a/src/commands/sync/holds.ts+++ b/src/commands/sync/holds.ts@@ -60,8 +60,9 @@ export async function openLegacyHolds(engine: BrainEngine, sourceId: string | unconst id = sourceId ?? DEFAULT_SOURCE_ID;const [row] = await engine.executeRaw<{ incarnation: string | null }>('SELECT incarnation::text AS incarnation FROM sources WHERE id=$1', [id]).catch(() => []);if (!row?.incarnation) return null;- const [policy, listed, retry] = await Promise.all([readSyncHoldPolicy(engine), readGitSourceHolds(engine, { sourceIds: [id] }),- readGitHoldRetryPaths(engine, id, row.incarnation)]);+ const policy = await readSyncHoldPolicy(engine);+ const listed = await readGitSourceHolds(engine, { sourceIds: [id] });+ const retry = await readGitHoldRetryPaths(engine, id, row.incarnation);return {sourceId: id, incarnation: row.incarnation, runId: `legacy-${randomUUID()}`, observedAt: new Date().toISOString(), policy,active: policy.mode === 'hold', existing: new Map((listed[0]?.holds ?? []).map(record => [record.path, record])), retryPaths: new Set(retry),diff --git a/src/core/frontmatter-recovery.ts b/src/core/frontmatter-recovery.tsindex aa5ce2435e..884b326db8 100644--- a/src/core/frontmatter-recovery.ts+++ b/src/core/frontmatter-recovery.ts@@ -26,7 +26,7 @@ export const RECOVERY_VERSION = 1;* `repair/visibility.ts`, connector publication). `test/frontmatter-recovery.test.ts`* greps those readers so a new key cannot be missed.*/-export const PROTECTED_FRONTMATTER_KEYS: readonly string[] = ['visibility', 'derived_from', 'source_slug', 'synthesized_by', 'concepts'];+export const PROTECTED_FRONTMATTER_KEYS: readonly string[] = ['visibility', 'derived_from', 'source_slug', 'synthesized_by', 'concepts', 'captured_via', 'event'];/** Keys that decide which page a file is. A duplicate is never resolved. */export const IDENTITY_FRONTMATTER_KEYS: readonly string[] = ['slug', 'type', 'id', 'source_id'];diff --git a/src/core/markdown.ts b/src/core/markdown.tsindex 7ec6d4d00b..5541a7e67a 100644--- a/src/core/markdown.ts+++ b/src/core/markdown.ts@@ -490,8 +490,8 @@ const HOLD_GUIDANCE: Record<InvalidFrontmatterReason, string> = {ambiguous_protected_key: 'gbrain never guesses who may read a page or where it came from. Write that key on its own line with one quoted value, then import it again.',};-const HOLD_MESSAGE = new RegExp(`^Invalid YAML frontmatter: (?:ambiguous (?:protected|identity) key "[\\w-]{1,100}" at line \\d+`- + `|key "[\\w-]{1,100}" at line \\d+ (?:continues on unquoted lines|appears more than once|opens \\[ or \\{ without closing it)`+const HOLD_MESSAGE = new RegExp(`^Invalid YAML frontmatter: (?:ambiguous (?:protected|identity) key(?: "[\\w-]{1,100}")? at line \\d+`+ + `|key(?: "[\\w-]{1,100}")? at line \\d+ (?:continues on unquoted lines|appears more than once|opens \\[ or \\{ without closing it)`+ `|[a-z ;,'-]{1,200}(?: at line \\d+(?:, column \\d+)?)?(?: \\(key "[\\w-]{1,100}"\\))?)\\. `+ `(?:${Object.values(HOLD_GUIDANCE).map(text => text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|')})$`);@@ -500,6 +500,11 @@ export function isFrontmatterHoldMessage(message: string | null | undefined): boreturn typeof message === 'string' && HOLD_MESSAGE.test(message);}+/** A hold message without its key names (keys can be private): line, cause and guidance only, for receipts and remote callers. */+export function frontmatterHoldMessageWithoutKeys(message: string): string {+ return message.replace(/ \(key "[\w-]{1,100}"\)/, '').replace(/key "[\w-]{1,100}"/, 'key');+}+/*** Map a validated parse (plus size and path context) to the one hold it* earns, or null when ingestion accepts it. Recovered (quoted) YAML, commentdiff --git a/src/core/ops/pages.ts b/src/core/ops/pages.tsindex 8092338058..8e61d67fd8 100644--- a/src/core/ops/pages.ts+++ b/src/core/ops/pages.ts@@ -78,7 +78,7 @@ const get_page: Operation = {name: 'get_page',idempotent: true,outputRedaction: { exempt: 'explicit page read by slug/id; governed by page visibility, not output redaction (CEO-17 raw-read exception)' },- description: 'Read a page by slug (fuzzy optional; renamed slugs redirect). To edit, pass include_content:true and send `content` to put_page, or use edit_page. Timeline rows need include_timeline_entries. `file_held` means sync holds this page\'s newer file: you are reading the last good revision, and put_page refuses until the file is repaired (follow its fix).',+ description: 'Read a page by slug (fuzzy optional; renamed slugs redirect). To edit, pass include_content:true and send `content` to put_page, or use edit_page. Timeline rows need include_timeline_entries.',params: {slug: { type: 'string', description: 'Page slug.', required: true },fuzzy: { type: 'boolean', description: 'Fuzzy slug match.' },diff --git a/src/core/persistence/page-prepare.ts b/src/core/persistence/page-prepare.tsindex 25d3dcef54..c5bf2f01bf 100644--- a/src/core/persistence/page-prepare.ts+++ b/src/core/persistence/page-prepare.ts@@ -6,7 +6,7 @@ import type { BrainEngine } from '../engine.ts';import type { GBrainConfig } from '../config.ts';import type { Page, PageVersion } from '../types.ts';import { importFromContent, type ParsedPage } from '../import-file.ts';-import { parseMarkdown, resolveParsedSubtype, serializePageToMarkdown, resolveSourceLocalFilePath, type ParseOpts } from '../markdown.ts';+import { frontmatterHoldMessageWithoutKeys, parseMarkdown, resolveParsedSubtype, serializePageToMarkdown, resolveSourceLocalFilePath, type ParseOpts } from '../markdown.ts';import { OperationError, opError } from '../ops/contract.ts';import { readFix } from '../ops/op-fix.ts';import { shellQuote, type Action } from '../agent-output.ts';@@ -334,7 +334,9 @@ export async function preparePageMutation(engine: BrainEngine, row: WriteRequest});signal?.throwIfAborted();if (!prepared) {- const refusal = result.refusal;+ // A remote caller's refusal names the line, never a key: keys can be private, and the receipt keeps the message.+ const refusal = result.refusal && row.authority.remote && result.refusal.code === 'invalid_frontmatter'+ ? { ...result.refusal, key: undefined, message: frontmatterHoldMessageWithoutKeys(result.refusal.message) } : result.refusal;if (refusal?.code === 'file_too_large') throw contentRefusalError(refusal, 'Split the content into smaller pages, then submit each with its own request_id.', { legacy_error: 'request_too_large' });if (refusal) throw contentRefusalError(refusal, `Correct ${refusal.line !== undefined ? `frontmatter line ${refusal.line}${refusal.key ? ` (key "${refusal.key}")` : ''}` : 'the frontmatter'}: one line per key with its whole value quoted, then submit the corrected content with a new request_id.`,{ legacy_error: 'invalid_params' });diff --git a/src/core/persistence/sync-holds.ts b/src/core/persistence/sync-holds.tsindex cf087b0c77..35ba78526a 100644--- a/src/core/persistence/sync-holds.ts+++ b/src/core/persistence/sync-holds.ts@@ -339,7 +339,10 @@ export async function readSyncHoldPolicy(engine: Pick<BrainEngine, 'getConfig'>)const parsed = value === null ? NaN : Number(value);return Number.isFinite(parsed) && parsed >= 0 ? parsed : fallback;};- const [mode, cap, count, pct, regression] = await Promise.all(['sync.holds', 'sync.hold_cap', 'sync.hold_escalate_count', 'sync.hold_escalate_pct', 'sync.parser_regression'].map(read));+ // Sequential: five point reads, without widening the caller's connection pool.+ const values: Array<string | null> = [];+ for (const key of ['sync.holds', 'sync.hold_cap', 'sync.hold_escalate_count', 'sync.hold_escalate_pct', 'sync.parser_regression']) values.push(await read(key));+ const [mode, cap, count, pct, regression] = values;return { mode: mode === 'fail' ? 'fail' : 'hold', cap: Math.floor(number(cap, GIT_HOLD_CAP)), escalateCount: number(count, GIT_HOLD_ESCALATE_COUNT),escalatePct: number(pct, GIT_HOLD_ESCALATE_PCT), parserRegression: regression === 'hold' ? 'hold' : 'stop' };}diff --git a/src/core/persistence/verb-errors.ts b/src/core/persistence/verb-errors.tsindex e584e40a08..72e4d7e9df 100644--- a/src/core/persistence/verb-errors.ts+++ b/src/core/persistence/verb-errors.ts@@ -2,7 +2,7 @@ import { verbError, OperationError } from '../ops/contract.ts';import { isTerminalWriteState, isWriteErrorCode, type WriteErrorCode, type WriteReceipt } from './types.ts';import { pendingWriteHint } from './health.ts';import { UNBOUND_COLLISION_MESSAGE, UNBOUND_PUBLICATION_MESSAGE } from './unbound-source.ts';-import { isFrontmatterHoldMessage } from '../markdown.ts';+import { frontmatterHoldMessageWithoutKeys, isFrontmatterHoldMessage } from '../markdown.ts';const FRONTMATTER_SLUG_CONFLICT = /^The frontmatter slug "[^"\n]{1,300}" in [^/"\n][^"\n]{0,1000} conflicts with its path, which expects slug "[^"\n]{1,300}"\. Remove `slug:` or make it match the path\.$/;@@ -83,7 +83,7 @@ export function writeFailureDiagnostic(code: string, message?: string | null): {suggestion: 'Read the current page and review the intended change before submitting a corrected write.' };if (code === 'invalid_params' && message && FRONTMATTER_SLUG_CONFLICT.test(message)) return { reason: code, message,suggestion: 'Correct the frontmatter in the file and commit the change.' };- if (code === 'invalid_params' && isFrontmatterHoldMessage(message)) return { reason: code, message: message!,+ if (code === 'invalid_params' && isFrontmatterHoldMessage(message)) return { reason: code, message: frontmatterHoldMessageWithoutKeys(message!),suggestion: 'Correct the named frontmatter line in the file (one line per key, the whole value quoted) and commit the change.' };return { reason: isWriteErrorCode(code) ? code : 'storage_error', message: 'The write did not commit. Inspect its durable request on the source host.',suggestion: 'Resolve the reported write failure before starting a corrected attempt.' };diff --git a/src/core/repair/frontmatter.ts b/src/core/repair/frontmatter.tsindex 38d1c7d2bc..5fb618a60d 100644--- a/src/core/repair/frontmatter.ts+++ b/src/core/repair/frontmatter.ts@@ -39,6 +39,7 @@*/import { execFileSync } from 'node:child_process';import { existsSync, lstatSync, readdirSync, readFileSync, writeFileSync } from 'node:fs';+import { maintenanceTransaction } from '../persistence/attribution.ts';import { join } from 'node:path';import type { BrainEngine } from '../engine.ts';import { opError, OperationError, type OperationContext } from '../ops/contract.ts';@@ -503,8 +504,12 @@ async function applyRepair(ctx: OperationContext, repair: ApprovedRepair, selectwriteFileSync(target, bound.content);}if (repair.rename_from) {- const moved = await ctx.engine.updateSlug(repair.rename_from.slug, repair.slug, { sourceId: repair.source_id });- if (moved === 1) await ctx.engine.executeRaw('UPDATE pages SET source_path=$1 WHERE id=$2 AND source_id=$3', [repair.source_path, repair.rename_from.pageId, repair.source_id]);+ const from = repair.rename_from;+ await maintenanceTransaction(ctx.engine, async tx => {+ if (await tx.updateSlug(from.slug, repair.slug, { sourceId: repair.source_id }) === 1) {+ await tx.executeRaw('UPDATE pages SET source_path=$1 WHERE id=$2 AND source_id=$3', [repair.source_path, from.pageId, repair.source_id]);+ }+ });}const imported = await importFromFile(ctx.engine, target, repair.source_path, { sourceId: repair.source_id, noEmbed: !embed });const ok = imported.status !== 'error' && !imported.refusal;diff --git a/src/core/search/lean-rows.ts b/src/core/search/lean-rows.tsindex bd5316feb7..d51730538c 100644--- a/src/core/search/lean-rows.ts+++ b/src/core/search/lean-rows.ts@@ -13,7 +13,7 @@* - safety and provenance markers whenever present: injection_suspected,* injection_p, unverified, content_flag, status, superseded, superseded_by,* message_id, thread_id, source_subject; modality when not text; stale- * only when true;+ * only when set (true, or the held-file object from #5988);* - `delivered: { truncated: true }` whenever evidence delivery truncated.* `fields: "full"`, the `mcp.result_rows: full` host config and gbrain's own* thin client get every field; trusted local callers always do.@@ -42,7 +42,7 @@ export function leanRow(row: Record<string, unknown>): Record<string, unknown> {for (const [key, value] of Object.entries(row)) {if (value === undefined || (value === null && key !== 'effective_date')) continue;if (KEPT_FIELDS.has(key)) out[key] = value;- else if (key === 'stale' && value === true) out[key] = true;+ else if (key === 'stale' && (value === true || (typeof value === 'object' && value !== null))) out[key] = value;else if (key === 'modality' && value !== 'text') out[key] = value;else if (key === 'delivered' && (value as { truncated?: unknown }).truncated === true) out[key] = { truncated: true };}diff --git a/test/fixtures/goldens/catalog/pglite-engine-init-default.json b/test/fixtures/goldens/catalog/pglite-engine-init-default.jsonindex 3d89719991..99a6d7000e 100644--- a/test/fixtures/goldens/catalog/pglite-engine-init-default.json+++ b/test/fixtures/goldens/catalog/pglite-engine-init-default.json@@ -857,6 +857,7 @@"oauth_tokens_pkey": "CREATE UNIQUE INDEX oauth_tokens_pkey ON public.oauth_tokens USING btree (token_hash)","op_checkpoint_paths_pkey": "CREATE UNIQUE INDEX op_checkpoint_paths_pkey ON public.op_checkpoint_paths USING btree (op, fingerprint, path)","op_checkpoints_pkey": "CREATE UNIQUE INDEX op_checkpoints_pkey ON public.op_checkpoints USING btree (op, fingerprint)",+ "op_checkpoints_sync_hold_page_idx": "CREATE INDEX op_checkpoints_sync_hold_page_idx ON public.op_checkpoints USING btree ((((completed_keys -> 0) ->> 'page_id'::text))) WHERE (op = 'sync-hold'::text)","op_checkpoints_updated_at_idx": "CREATE INDEX op_checkpoints_updated_at_idx ON public.op_checkpoints USING btree (updated_at)","open_loops_counterparty_idx": "CREATE INDEX open_loops_counterparty_idx ON public.open_loops USING btree (source_id, counterparty_slug) WHERE (status = 'open'::text)","open_loops_dedup": "CREATE UNIQUE INDEX open_loops_dedup ON public.open_loops USING btree (source_id, dedup_key)",diff --git a/test/fixtures/goldens/catalog/pglite-engine-init-fts-portuguese.json b/test/fixtures/goldens/catalog/pglite-engine-init-fts-portuguese.jsonindex b856786308..db8a7c1b35 100644--- a/test/fixtures/goldens/catalog/pglite-engine-init-fts-portuguese.json+++ b/test/fixtures/goldens/catalog/pglite-engine-init-fts-portuguese.json@@ -857,6 +857,7 @@"oauth_tokens_pkey": "CREATE UNIQUE INDEX oauth_tokens_pkey ON public.oauth_tokens USING btree (token_hash)","op_checkpoint_paths_pkey": "CREATE UNIQUE INDEX op_checkpoint_paths_pkey ON public.op_checkpoint_paths USING btree (op, fingerprint, path)","op_checkpoints_pkey": "CREATE UNIQUE INDEX op_checkpoints_pkey ON public.op_checkpoints USING btree (op, fingerprint)",+ "op_checkpoints_sync_hold_page_idx": "CREATE INDEX op_checkpoints_sync_hold_page_idx ON public.op_checkpoints USING btree ((((completed_keys -> 0) ->> 'page_id'::text))) WHERE (op = 'sync-hold'::text)","op_checkpoints_updated_at_idx": "CREATE INDEX op_checkpoints_updated_at_idx ON public.op_checkpoints USING btree (updated_at)","open_loops_counterparty_idx": "CREATE INDEX open_loops_counterparty_idx ON public.open_loops USING btree (source_id, counterparty_slug) WHERE (status = 'open'::text)","open_loops_dedup": "CREATE UNIQUE INDEX open_loops_dedup ON public.open_loops USING btree (source_id, dedup_key)",diff --git a/test/fixtures/goldens/catalog/pglite-engine-init-high-dims.json b/test/fixtures/goldens/catalog/pglite-engine-init-high-dims.jsonindex 0cf58938e1..796685335b 100644--- a/test/fixtures/goldens/catalog/pglite-engine-init-high-dims.json+++ b/test/fixtures/goldens/catalog/pglite-engine-init-high-dims.json@@ -853,6 +853,7 @@"oauth_tokens_pkey": "CREATE UNIQUE INDEX oauth_tokens_pkey ON public.oauth_tokens USING btree (token_hash)","op_checkpoint_paths_pkey": "CREATE UNIQUE INDEX op_checkpoint_paths_pkey ON public.op_checkpoint_paths USING btree (op, fingerprint, path)","op_checkpoints_pkey": "CREATE UNIQUE INDEX op_checkpoints_pkey ON public.op_checkpoints USING btree (op, fingerprint)",+ "op_checkpoints_sync_hold_page_idx": "CREATE INDEX op_checkpoints_sync_hold_page_idx ON public.op_checkpoints USING btree ((((completed_keys -> 0) ->> 'page_id'::text))) WHERE (op = 'sync-hold'::text)","op_checkpoints_updated_at_idx": "CREATE INDEX op_checkpoints_updated_at_idx ON public.op_checkpoints USING btree (updated_at)","open_loops_counterparty_idx": "CREATE INDEX open_loops_counterparty_idx ON public.open_loops USING btree (source_id, counterparty_slug) WHERE (status = 'open'::text)","open_loops_dedup": "CREATE UNIQUE INDEX open_loops_dedup ON public.open_loops USING btree (source_id, dedup_key)",diff --git a/test/fixtures/goldens/catalog/pglite-schema-blob-default.json b/test/fixtures/goldens/catalog/pglite-schema-blob-default.jsonindex ea2e975ae1..3a33f51e94 100644--- a/test/fixtures/goldens/catalog/pglite-schema-blob-default.json+++ b/test/fixtures/goldens/catalog/pglite-schema-blob-default.json@@ -631,6 +631,7 @@"oauth_tokens_pkey": "CREATE UNIQUE INDEX oauth_tokens_pkey ON public.oauth_tokens USING btree (token_hash)","op_checkpoint_paths_pkey": "CREATE UNIQUE INDEX op_checkpoint_paths_pkey ON public.op_checkpoint_paths USING btree (op, fingerprint, path)","op_checkpoints_pkey": "CREATE UNIQUE INDEX op_checkpoints_pkey ON public.op_checkpoints USING btree (op, fingerprint)",+ "op_checkpoints_sync_hold_page_idx": "CREATE INDEX op_checkpoints_sync_hold_page_idx ON public.op_checkpoints USING btree ((((completed_keys -> 0) ->> 'page_id'::text))) WHERE (op = 'sync-hold'::text)","op_checkpoints_updated_at_idx": "CREATE INDEX op_checkpoints_updated_at_idx ON public.op_checkpoints USING btree (updated_at)","open_loops_counterparty_idx": "CREATE INDEX open_loops_counterparty_idx ON public.open_loops USING btree (source_id, counterparty_slug) WHERE (status = 'open'::text)","open_loops_dedup": "CREATE UNIQUE INDEX open_loops_dedup ON public.open_loops USING btree (source_id, dedup_key)",diff --git a/test/fixtures/goldens/catalog/pglite-schema-blob-fts-portuguese.json b/test/fixtures/goldens/catalog/pglite-schema-blob-fts-portuguese.jsonindex f39fa71704..358ba68154 100644--- a/test/fixtures/goldens/catalog/pglite-schema-blob-fts-portuguese.json+++ b/test/fixtures/goldens/catalog/pglite-schema-blob-fts-portuguese.json@@ -631,6 +631,7 @@"oauth_tokens_pkey": "CREATE UNIQUE INDEX oauth_tokens_pkey ON public.oauth_tokens USING btree (token_hash)","op_checkpoint_paths_pkey": "CREATE UNIQUE INDEX op_checkpoint_paths_pkey ON public.op_checkpoint_paths USING btree (op, fingerprint, path)","op_checkpoints_pkey": "CREATE UNIQUE INDEX op_checkpoints_pkey ON public.op_checkpoints USING btree (op, fingerprint)",+ "op_checkpoints_sync_hold_page_idx": "CREATE INDEX op_checkpoints_sync_hold_page_idx ON public.op_checkpoints USING btree ((((completed_keys -> 0) ->> 'page_id'::text))) WHERE (op = 'sync-hold'::text)","op_checkpoints_updated_at_idx": "CREATE INDEX op_checkpoints_updated_at_idx ON public.op_checkpoints USING btree (updated_at)","open_loops_counterparty_idx": "CREATE INDEX open_loops_counterparty_idx ON public.open_loops USING btree (source_id, counterparty_slug) WHERE (status = 'open'::text)","open_loops_dedup": "CREATE UNIQUE INDEX open_loops_dedup ON public.open_loops USING btree (source_id, dedup_key)",diff --git a/test/fixtures/goldens/catalog/pglite-schema-blob-high-dims.json b/test/fixtures/goldens/catalog/pglite-schema-blob-high-dims.jsonindex 0343e664f0..c53886296f 100644--- a/test/fixtures/goldens/catalog/pglite-schema-blob-high-dims.json+++ b/test/fixtures/goldens/catalog/pglite-schema-blob-high-dims.json@@ -630,6 +630,7 @@"oauth_tokens_pkey": "CREATE UNIQUE INDEX oauth_tokens_pkey ON public.oauth_tokens USING btree (token_hash)","op_checkpoint_paths_pkey": "CREATE UNIQUE INDEX op_checkpoint_paths_pkey ON public.op_checkpoint_paths USING btree (op, fingerprint, path)","op_checkpoints_pkey": "CREATE UNIQUE INDEX op_checkpoints_pkey ON public.op_checkpoints USING btree (op, fingerprint)",+ "op_checkpoints_sync_hold_page_idx": "CREATE INDEX op_checkpoints_sync_hold_page_idx ON public.op_checkpoints USING btree ((((completed_keys -> 0) ->> 'page_id'::text))) WHERE (op = 'sync-hold'::text)","op_checkpoints_updated_at_idx": "CREATE INDEX op_checkpoints_updated_at_idx ON public.op_checkpoints USING btree (updated_at)","open_loops_counterparty_idx": "CREATE INDEX open_loops_counterparty_idx ON public.open_loops USING btree (source_id, counterparty_slug) WHERE (status = 'open'::text)","open_loops_dedup": "CREATE UNIQUE INDEX open_loops_dedup ON public.open_loops USING btree (source_id, dedup_key)",diff --git a/test/fixtures/goldens/catalog/postgres-db-initschema.json b/test/fixtures/goldens/catalog/postgres-db-initschema.jsonindex 922c8162ce..49158bae10 100644--- a/test/fixtures/goldens/catalog/postgres-db-initschema.json+++ b/test/fixtures/goldens/catalog/postgres-db-initschema.json@@ -663,6 +663,7 @@"oauth_tokens_pkey": "CREATE UNIQUE INDEX oauth_tokens_pkey ON public.oauth_tokens USING btree (token_hash)","op_checkpoint_paths_pkey": "CREATE UNIQUE INDEX op_checkpoint_paths_pkey ON public.op_checkpoint_paths USING btree (op, fingerprint, path)","op_checkpoints_pkey": "CREATE UNIQUE INDEX op_checkpoints_pkey ON public.op_checkpoints USING btree (op, fingerprint)",+ "op_checkpoints_sync_hold_page_idx": "CREATE INDEX op_checkpoints_sync_hold_page_idx ON public.op_checkpoints USING btree ((((completed_keys -> 0) ->> 'page_id'::text))) WHERE (op = 'sync-hold'::text)","op_checkpoints_updated_at_idx": "CREATE INDEX op_checkpoints_updated_at_idx ON public.op_checkpoints USING btree (updated_at)","open_loops_counterparty_idx": "CREATE INDEX open_loops_counterparty_idx ON public.open_loops USING btree (source_id, counterparty_slug) WHERE (status = 'open'::text)","open_loops_dedup": "CREATE UNIQUE INDEX open_loops_dedup ON public.open_loops USING btree (source_id, dedup_key)",diff --git a/test/fixtures/goldens/catalog/postgres-engine-init-default.json b/test/fixtures/goldens/catalog/postgres-engine-init-default.jsonindex 81a3ba1447..65013754c1 100644--- a/test/fixtures/goldens/catalog/postgres-engine-init-default.json+++ b/test/fixtures/goldens/catalog/postgres-engine-init-default.json@@ -861,6 +861,7 @@"oauth_tokens_pkey": "CREATE UNIQUE INDEX oauth_tokens_pkey ON public.oauth_tokens USING btree (token_hash)","op_checkpoint_paths_pkey": "CREATE UNIQUE INDEX op_checkpoint_paths_pkey ON public.op_checkpoint_paths USING btree (op, fingerprint, path)","op_checkpoints_pkey": "CREATE UNIQUE INDEX op_checkpoints_pkey ON public.op_checkpoints USING btree (op, fingerprint)",+ "op_checkpoints_sync_hold_page_idx": "CREATE INDEX op_checkpoints_sync_hold_page_idx ON public.op_checkpoints USING btree ((((completed_keys -> 0) ->> 'page_id'::text))) WHERE (op = 'sync-hold'::text)","op_checkpoints_updated_at_idx": "CREATE INDEX op_checkpoints_updated_at_idx ON public.op_checkpoints USING btree (updated_at)","open_loops_counterparty_idx": "CREATE INDEX open_loops_counterparty_idx ON public.open_loops USING btree (source_id, counterparty_slug) WHERE (status = 'open'::text)","open_loops_dedup": "CREATE UNIQUE INDEX open_loops_dedup ON public.open_loops USING btree (source_id, dedup_key)",diff --git a/test/fixtures/goldens/catalog/postgres-engine-init-fts-portuguese.json b/test/fixtures/goldens/catalog/postgres-engine-init-fts-portuguese.jsonindex 7773375bf7..ecdff86800 100644--- a/test/fixtures/goldens/catalog/postgres-engine-init-fts-portuguese.json+++ b/test/fixtures/goldens/catalog/postgres-engine-init-fts-portuguese.json@@ -861,6 +861,7 @@"oauth_tokens_pkey": "CREATE UNIQUE INDEX oauth_tokens_pkey ON public.oauth_tokens USING btree (token_hash)","op_checkpoint_paths_pkey": "CREATE UNIQUE INDEX op_checkpoint_paths_pkey ON public.op_checkpoint_paths USING btree (op, fingerprint, path)","op_checkpoints_pkey": "CREATE UNIQUE INDEX op_checkpoints_pkey ON public.op_checkpoints USING btree (op, fingerprint)",+ "op_checkpoints_sync_hold_page_idx": "CREATE INDEX op_checkpoints_sync_hold_page_idx ON public.op_checkpoints USING btree ((((completed_keys -> 0) ->> 'page_id'::text))) WHERE (op = 'sync-hold'::text)","op_checkpoints_updated_at_idx": "CREATE INDEX op_checkpoints_updated_at_idx ON public.op_checkpoints USING btree (updated_at)","open_loops_counterparty_idx": "CREATE INDEX open_loops_counterparty_idx ON public.open_loops USING btree (source_id, counterparty_slug) WHERE (status = 'open'::text)","open_loops_dedup": "CREATE UNIQUE INDEX open_loops_dedup ON public.open_loops USING btree (source_id, dedup_key)",diff --git a/test/fixtures/goldens/catalog/postgres-engine-init-high-dims.json b/test/fixtures/goldens/catalog/postgres-engine-init-high-dims.jsonindex 63875e6e84..a815cd1c99 100644--- a/test/fixtures/goldens/catalog/postgres-engine-init-high-dims.json+++ b/test/fixtures/goldens/catalog/postgres-engine-init-high-dims.json@@ -857,6 +857,7 @@"oauth_tokens_pkey": "CREATE UNIQUE INDEX oauth_tokens_pkey ON public.oauth_tokens USING btree (token_hash)","op_checkpoint_paths_pkey": "CREATE UNIQUE INDEX op_checkpoint_paths_pkey ON public.op_checkpoint_paths USING btree (op, fingerprint, path)","op_checkpoints_pkey": "CREATE UNIQUE INDEX op_checkpoints_pkey ON public.op_checkpoints USING btree (op, fingerprint)",+ "op_checkpoints_sync_hold_page_idx": "CREATE INDEX op_checkpoints_sync_hold_page_idx ON public.op_checkpoints USING btree ((((completed_keys -> 0) ->> 'page_id'::text))) WHERE (op = 'sync-hold'::text)","op_checkpoints_updated_at_idx": "CREATE INDEX op_checkpoints_updated_at_idx ON public.op_checkpoints USING btree (updated_at)","open_loops_counterparty_idx": "CREATE INDEX open_loops_counterparty_idx ON public.open_loops USING btree (source_id, counterparty_slug) WHERE (status = 'open'::text)","open_loops_dedup": "CREATE UNIQUE INDEX open_loops_dedup ON public.open_loops USING btree (source_id, dedup_key)",diff --git a/test/fixtures/goldens/cli/tools-json.json b/test/fixtures/goldens/cli/tools-json.jsonindex 32f5202206..8c613f7b27 100644--- a/test/fixtures/goldens/cli/tools-json.json+++ b/test/fixtures/goldens/cli/tools-json.json@@ -2,8 +2,8 @@"golden": {"exitCode": 0,"stderr": "",- "stdoutBytes": 196798,- "stdoutSha256": "61a528fc54b8970086f0c00b1d932206caf8f2fd5495d64e64cbad552dec416a",+ "stdoutBytes": 196835,+ "stdoutSha256": "7c6a8f58d1ecf9152a0bef45fe6b85d84ea6bc81c4610fc65b2a65eeec68370a","toolNames": ["remember","entity",@@ -6271,6 +6271,7 @@"listing_truncated","local_transcripts","onboard_opportunities",+ "recovered_frontmatter","source_binding_narrowed","synthesis_keyless","think_not_saved",diff --git a/test/fixtures/goldens/doctor/json-pglite-degraded.json b/test/fixtures/goldens/doctor/json-pglite-degraded.jsonindex becdf1fe67..22c4a12451 100644--- a/test/fixtures/goldens/doctor/json-pglite-degraded.json+++ b/test/fixtures/goldens/doctor/json-pglite-degraded.json@@ -507,7 +507,7 @@},{"category": "meta",- "message": "Version 199 (latest: 199)",+ "message": "Version 200 (latest: 200)","name": "schema_version","status": "ok"},diff --git a/test/fixtures/goldens/doctor/json-pglite-fresh.json b/test/fixtures/goldens/doctor/json-pglite-fresh.jsonindex 6123d72bfd..153d996111 100644--- a/test/fixtures/goldens/doctor/json-pglite-fresh.json+++ b/test/fixtures/goldens/doctor/json-pglite-fresh.json@@ -510,7 +510,7 @@},{"category": "meta",- "message": "Version 199 (latest: 199)",+ "message": "Version 200 (latest: 200)","name": "schema_version","status": "ok"},diff --git a/test/fixtures/goldens/doctor/json-postgres-fresh.json b/test/fixtures/goldens/doctor/json-postgres-fresh.jsonindex e644cc12ce..9ebd3e303b 100644--- a/test/fixtures/goldens/doctor/json-postgres-fresh.json+++ b/test/fixtures/goldens/doctor/json-postgres-fresh.json@@ -503,7 +503,7 @@},{"category": "meta",- "message": "Version 199 (latest: 199)",+ "message": "Version 200 (latest: 200)","name": "schema_version","status": "ok"},diff --git a/test/fixtures/goldens/exports/runtime.json b/test/fixtures/goldens/exports/runtime.jsonindex a13442d5a9..829c615c1b 100644--- a/test/fixtures/goldens/exports/runtime.json+++ b/test/fixtures/goldens/exports/runtime.json@@ -610,6 +610,7 @@"importImageFile","isImageFilePath","pLimit",+ "slugConflictHoldMessage","withImportTransaction"],"./ingestion": [@@ -654,13 +655,23 @@"unwrapWikilink"],"./markdown": [+ "HOLD_CODES",+ "IDENTITY_FRONTMATTER_KEYS",+ "INVALID_FRONTMATTER_REASONS",+ "PROTECTED_FRONTMATTER_KEYS",+ "RECOVERY_VERSION",+ "classifyImportHold","coerceFrontmatterString",+ "contentSizeHold","findTimelineSplitIndex","frontmatterBodyOffset",+ "frontmatterHoldMessageWithoutKeys","inferTypeAndSubtypeFromPack","inferTypeFromPack",+ "isFrontmatterHoldMessage","isRelativeFileUri","parseMarkdown",+ "recoverFrontmatter","resolvePageFilePath","resolveParsedSubtype","resolveSourceLocalFilePath",diff --git a/test/fixtures/goldens/exports/types.json b/test/fixtures/goldens/exports/types.jsonindex 5ccc50da53..b9ad5a25cb 100644--- a/test/fixtures/goldens/exports/types.json+++ b/test/fixtures/goldens/exports/types.json@@ -1350,7 +1350,7 @@"slug: string","source_id?: string | undefined","source_subject?: string | undefined",- "stale: boolean",+ "stale: boolean | { held_since: string; last_indexed_revision: string | null; }","status?: string | undefined","supersede_penalty?: number | undefined","superseded?: boolean | undefined",@@ -1756,7 +1756,7 @@"kind": "type","name": "ToolLoopStopReason","signature": [- "\"length\" | \"end\" | \"refusal\" | \"content_filter\" | \"max_turns\" | \"aborted\" | \"unrecoverable\""+ "\"length\" | \"unrecoverable\" | \"end\" | \"refusal\" | \"content_filter\" | \"max_turns\" | \"aborted\""]},{@@ -4185,10 +4185,12 @@"error?: string | undefined","flag_reason?: \"markup_heavy\" | \"oversized\" | undefined","flagged?: boolean | undefined",+ "frontmatter_recovery?: { quoted: boolean; comment_value: boolean; } | undefined","parsedPage?: ParsedPage | undefined","quarantined?: boolean | undefined",+ "refusal?: ContentRefusal | undefined","resealed?: { pendingChunks: number; pendingChars: number; } | undefined",- "skip_reason?: \"malformed_path\" | \"slug_collision\" | undefined",+ "skip_reason?: \"content_rejected\" | \"file_too_large\" | \"frontmatter_slug_conflict\" | \"invalid_frontmatter\" | \"parser_regression\" | \"rename_held\" | \"malformed_path\" | \"slug_collision\" | undefined","slug: string","status: \"error\" | \"imported\" | \"skipped\"","type_warning?: { kind: \"alias_of\" | \"undeclared\"; type: string; canonical?: string; directory?: string; } | undefined"@@ -4307,6 +4309,13 @@"(concurrency: number) => <T>(fn: () => Promise<T>) => Promise<T>"]},+ {+ "kind": "variable",+ "name": "slugConflictHoldMessage",+ "signature": [+ "(relativePath: string, expectedSlug: string) => string"+ ]+ },{"kind": "function","name": "withImportTransaction",@@ -4806,6 +4815,92 @@}],"./markdown": [+ {+ "kind": "interface",+ "members": [+ "code: \"file_too_large\" | \"frontmatter_slug_conflict\" | \"invalid_frontmatter\" | \"parser_regression\" | \"rename_held\"",+ "key?: string | undefined",+ "line?: number | undefined",+ "message: string",+ "reason?: \"yaml_parse\" | \"needs_interpretation\" | \"ambiguous_identity_key\" | \"ambiguous_protected_key\" | undefined"+ ],+ "name": "ContentHold"+ },+ {+ "kind": "interface",+ "members": [+ "block: string",+ "column?: number | undefined",+ "key?: string | undefined",+ "line?: number | undefined",+ "recovery_version: number",+ "status: FrontmatterRecoveryStatus",+ "steps: FrontmatterRecoveryStep[]",+ "yamlReason?: string | undefined"+ ],+ "name": "FrontmatterRecovery"+ },+ {+ "kind": "type",+ "name": "FrontmatterRecoveryStatus",+ "signature": [+ "\"needs_interpretation\" | \"ambiguous_identity_key\" | \"ambiguous_protected_key\" | \"clean\" | \"recovered\" | \"unrecoverable\""+ ]+ },+ {+ "kind": "interface",+ "members": [+ "key: string",+ "kind: RecoveryKind",+ "line: number",+ "original: string",+ "otherLine?: number | undefined",+ "replacement: string | null"+ ],+ "name": "FrontmatterRecoveryStep"+ },+ {+ "kind": "variable",+ "name": "HOLD_CODES",+ "signature": [+ "readonly [\"invalid_frontmatter\", \"frontmatter_slug_conflict\", \"file_too_large\", \"rename_held\", \"parser_regression\"]"+ ]+ },+ {+ "kind": "type",+ "name": "HoldCode",+ "signature": [+ "\"file_too_large\" | \"frontmatter_slug_conflict\" | \"invalid_frontmatter\" | \"parser_regression\" | \"rename_held\""+ ]+ },+ {+ "kind": "variable",+ "name": "IDENTITY_FRONTMATTER_KEYS",+ "signature": [+ "readonly string[]"+ ]+ },+ {+ "kind": "variable",+ "name": "INVALID_FRONTMATTER_REASONS",+ "signature": [+ "readonly [\"yaml_parse\", \"needs_interpretation\", \"ambiguous_identity_key\", \"ambiguous_protected_key\"]"+ ]+ },+ {+ "kind": "type",+ "name": "InvalidFrontmatterReason",+ "signature": [+ "\"yaml_parse\" | \"needs_interpretation\" | \"ambiguous_identity_key\" | \"ambiguous_protected_key\""+ ]+ },+ {+ "kind": "variable",+ "name": "PROTECTED_FRONTMATTER_KEYS",+ "signature": [+ "readonly string[]"+ ]+ },{"kind": "interface","members": [@@ -4827,10 +4922,32 @@"members": ["code: ParseValidationCode","line?: number | undefined",- "message: string"+ "message: string",+ "recoverable?: boolean | undefined",+ "recovery?: { kind: RecoveryKind; key: string; line: number; recovery_version: number; }[] | undefined"],"name": "ParseValidationError"},+ {+ "kind": "interface",+ "members": [+ "code: ParseWarningCode",+ "key: string",+ "kind?: RecoveryKind | undefined",+ "line: number",+ "message: string",+ "original?: string | undefined",+ "replacement?: string | undefined"+ ],+ "name": "ParseValidationWarning"+ },+ {+ "kind": "type",+ "name": "ParseWarningCode",+ "signature": [+ "\"FRONTMATTER_RECOVERED\" | \"FRONTMATTER_COMMENT_VALUE\""+ ]+ },{"kind": "interface","members": [@@ -4838,15 +4955,31 @@"errors?: ParseValidationError[] | undefined","frontmatter: Record<string, unknown>","inferredSubtype?: { type: string; name: string; } | undefined",+ "recovery?: FrontmatterRecovery | undefined","slug: string","tags: string[]","timeline: string","title: string","type: string",- "typeExplicit?: boolean | undefined"+ "typeExplicit?: boolean | undefined",+ "warnings?: ParseValidationWarning[] | undefined"],"name": "ParsedMarkdown"},+ {+ "kind": "variable",+ "name": "RECOVERY_VERSION",+ "signature": [+ "1"+ ]+ },+ {+ "kind": "type",+ "name": "RecoveryKind",+ "signature": [+ "\"quote\" | \"fold\" | \"dup\" | \"unclosed\""+ ]+ },{"kind": "interface","members": [@@ -4854,6 +4987,13 @@],"name": "SerializePageOpts"},+ {+ "kind": "function",+ "name": "classifyImportHold",+ "signature": [+ "(parsed: ParsedMarkdown, ctx?: { byteLength?: number; maxBytes?: number; codeFile?: boolean; expectedSlug?: string | null; slugExempt?: (declared: string) => boolean; slugConflictMessage?: (found: string, expected: string) => string; }) => ContentHold | null"+ ]+ },{"kind": "function","name": "coerceFrontmatterString",@@ -4861,6 +5001,13 @@"(v: unknown) => string"]},+ {+ "kind": "function",+ "name": "contentSizeHold",+ "signature": [+ "(byteLength: number, maxBytes: number, codeFile?: boolean) => ContentHold | null"+ ]+ },{"kind": "function","name": "findTimelineSplitIndex",@@ -4875,6 +5022,13 @@"(content: string) => number"]},+ {+ "kind": "function",+ "name": "frontmatterHoldMessageWithoutKeys",+ "signature": [+ "(message: string) => string"+ ]+ },{"kind": "function","name": "inferTypeAndSubtypeFromPack",@@ -4889,6 +5043,13 @@"(filePath: string | undefined, pack: { page_types: ReadonlyArray<{ name: string; path_prefixes: ReadonlyArray<string>; }>; }) => PageType"]},+ {+ "kind": "function",+ "name": "isFrontmatterHoldMessage",+ "signature": [+ "(message: string | null | undefined) => boolean"+ ]+ },{"kind": "function","name": "isRelativeFileUri",@@ -4903,6 +5064,13 @@"(content: string, filePath?: string, opts?: ParseOpts) => ParsedMarkdown"]},+ {+ "kind": "function",+ "name": "recoverFrontmatter",+ "signature": [+ "(block: string, lineOffset?: number) => FrontmatterRecovery"+ ]+ },{"kind": "function","name": "resolvePageFilePath",@@ -5456,7 +5624,7 @@{"kind": "class","members": [- "canonical?: \"unknown\" | \"projection_pending\" | \"timeout\" | \"writer_lock_unavailable\" | \"writer_pool_capacity\" | \"owner_unavailable\" | \"recovery_required\" | \"queue_capacity\" | \"revision_required\" | \"revision_conflict\" | \"idempotency_conflict\" | \"source_changed\" | \"write_pending\" | \"storage_error\" | \"cancelled\" | \"permission_denied\" | \"scope_denied\" | \"invalid_params\" | \"not_found\" | \"page_not_found\" | \"page_identity_changed\" | \"write_claim_lost\" | \"request_too_large\" | \"response_too_large\" | \"writer_registration_required\" | \"writer_identity_invalid\" | \"writer_not_initialized\" | \"writer_coordinator_required\" | \"fact_already_expired\" | \"source_writeback_required\" | \"unsupported_mutation_protocol\" | \"writer_upgrade_required\" | \"writer_not_quiesced\" | \"skill_bundle_required\" | \"take_row_collision\" | \"invalid_source_uri\" | \"writer_admin_locked\" | \"connector_account_changed\" | \"connector_intent_outdated\" | \"checkpoint_validation_timeout\" | \"invalid_connector_text\" | \"connector_holds_exhausted\" | \"connector_fence_below_timeline\" | \"embedding_failed\" | \"bucket_not_found\" | \"database_error\" | \"unknown_transport\" | \"rate_limited\" | \"extraction_failed\" | \"fact_not_found\" | \"provenance_required\" | \"unavailable\" | \"budget_unsatisfiable\" | \"embedding_budget_below_worst_case\" | \"access_command_failed\" | \"access_denied_test_user\" | \"access_env_missing\" | \"acknowledgment_unavailable\" | \"admin_policy_enforced\" | \"ambiguous_id\" | \"ambiguous_skill\" | \"api_not_enabled\" | \"approval_required\" | \"autopilot_job_owned_by_other_brain\" | \"benchmark_duplicate_task_id\" | \"benchmark_empty\" | \"benchmark_exists\" | \"benchmark_judge_llm_no_rubric\" | \"benchmark_judge_qrels_no_expected\" | \"benchmark_judge_rule_no_checks\" | \"benchmark_judge_unknown_kind\" | \"benchmark_malformed\" | \"benchmark_missing_judge\" | \"benchmark_missing_task\" | \"benchmark_missing_task_id\" | \"benchmark_not_found\" | \"benchmark_rule_check_bad_arg\" | \"benchmark_rule_check_malformed\" | \"benchmark_rule_check_unknown_op\" | \"bootstrap_empty\" | \"bootstrap_pending_review\" | \"bridge_ownership_conflict\" | \"catalog_unavailable\" | \"chronicle_skipped\" | \"no_pricing\" | \"checkpoint_missing\" | \"claim_already_used\" | \"client_json_unreadable\" | \"client_json_wrong_type\" | \"client_shape_invalid\" | \"code_callees_requires_symbol\" | \"code_callers_requires_symbol\" | \"code_def_requires_symbol\" | \"code_refs_requires_symbol\" | \"code_reused\" | \"colon_slug_windows_write_through\" | \"command_failed\" | \"config_error\" | \"confirmation_required\" | \"conflicting_source_scope\" | \"consent_timeout\" | \"cost_cap_exceeded\" | \"cost_preview_requires_yes\" | \"cycle_failed\" | \"d_sel_too_small\" | \"demo_graph_failed\" | \"demo_import_failed\" | \"demo_verification_failed\" | \"derived_cap_exhausted\" | \"destination_not_ready\" | \"dirty_tree\" | \"effect_not_failed\" | \"embedding_auth_failed\" | \"embedding_configuration\" | \"embedding_disabled\" | \"embedding_model_mismatch\" | \"embedding_plane_split\" | \"embedding_storage_unavailable\" | \"embedding_unavailable\" | \"embedding_unconfigured\" | \"embedding_width_mismatch\" | \"export_limit\" | \"extractor_identity_mismatch\" | \"facts_absorb_write_refused\" | \"facts_payload_expired\" | \"fetch_failed\" | \"full_resync_required\" | \"gate_failed\" | \"git_index_locked\" | \"git_index_stale\" | \"git_push_unavailable\" | \"git_target_unsafe\" | \"git_unavailable\" | \"graph_incomplete\" | \"held_out_overlaps_benchmark\" | \"held_out_required_for_bundled\" | \"independent_principal_required\" | \"insufficient_scope\" | \"internal\" | \"internal_error\" | \"interrupted\" | \"invalid_client\" | \"invalid_grant_clock_skew\" | \"invalid_grant_revoked\" | \"invalid_grant_testing_expiry\" | \"invalid_request\" | \"invalid_source\" | \"invalid_source_pin\" | \"invalid_token\" | \"invalid_write_wait\" | \"legacy_job_selection_invalid\" | \"legacy_jobs_active\" | \"local_conflict\" | \"lock_busy\" | \"managed_pull_skipped\" | \"method_not_allowed\" | \"migration_failed\" | \"migrations_pending\" | \"migrations_running\" | \"missing_source_scope\" | \"missing_source_value\" | \"models_strict_violation\" | \"no_refresh_token\" | \"no_routing_eval\" | \"no_skill_md\" | \"no_worker\" | \"no_worker_surface\" | \"not_a_git_repo\" | \"not_connected\" | \"no_brain\" | \"overlapping_path\" | \"parse_error\" | \"pasted_wrong_url\" | \"payload_too_large\" | \"pending_writes\" | \"pglite_busy\" | \"plan_output_failed\" | \"plan_stale\" | \"port_in_use\" | \"preview_changed\" | \"profile_incompatible\" | \"projection_owner_resident\" | \"publication_pending\" | \"redirect_uri_mismatch\" | \"refresh_dirty\" | \"refresh_diverged\" | \"refresh_drain_timeout\" | \"refresh_no_upstream\" | \"refresh_not_managed\" | \"refresh_not_owner\" | \"refresh_source_changed\" | \"relay_disabled\" | \"relay_session_expired\" | \"relay_unreachable\" | \"request_already_submitted\" | \"requirements_changed\" | \"requires_local_engine\" | \"resume_spec_mismatch\" | \"revision_unavailable\" | \"scope_missing\" | \"serve_port_in_use\" | \"serve_status_only\" | \"shared_skills_unavailable\" | \"shared_skills_unsupported\" | \"skill_asset_not_found\" | \"skill_candidate_invalid\" | \"skill_not_found\" | \"skill_retention_capacity\" | \"source_binding_required\" | \"source_id_taken\" | \"source_not_ready\" | \"source_profile_no_backfill\" | \"source_referenced\" | \"source_root_conflict\" | \"split_bad_ratio\" | \"split_unparseable\" | \"state_mismatch\" | \"sync_not_applicable\" | \"sync_in_progress\" | \"target_escape\" | \"topology_change_required\" | \"trusted_local_only\" | \"unexpected_file_bytes\" | \"unexpected_staging_bytes\" | \"unknown_command\" | \"unknown_flag\" | \"unknown_method\" | \"unknown_source\" | \"unknown_tool\" | \"unmanaged_path\" | \"unsupported_export_data\" | \"upstream\" | \"verification_failed\" | \"withdrawal_capacity\" | \"withdrawal_provenance\" | \"writer_admin_intent_required\" | \"writer_admin_state_changed\" | \"writer_busy\" | \"writer_identity_publish_failed\" | \"writer_manifest_mismatch\" | \"writer_manifest_unsafe\" | \"writer_regrant_required\" | \"writer_transfer_conflict\" | \"writer_transfer_required\" | \"wrong_account_consented\" | undefined",+ "canonical?: \"unknown\" | \"projection_pending\" | \"timeout\" | \"writer_lock_unavailable\" | \"writer_pool_capacity\" | \"owner_unavailable\" | \"recovery_required\" | \"queue_capacity\" | \"revision_required\" | \"revision_conflict\" | \"idempotency_conflict\" | \"source_changed\" | \"write_pending\" | \"storage_error\" | \"cancelled\" | \"permission_denied\" | \"scope_denied\" | \"invalid_params\" | \"not_found\" | \"page_not_found\" | \"page_identity_changed\" | \"write_claim_lost\" | \"request_too_large\" | \"response_too_large\" | \"writer_registration_required\" | \"writer_identity_invalid\" | \"writer_not_initialized\" | \"writer_coordinator_required\" | \"fact_already_expired\" | \"source_writeback_required\" | \"unsupported_mutation_protocol\" | \"writer_upgrade_required\" | \"writer_not_quiesced\" | \"skill_bundle_required\" | \"take_row_collision\" | \"invalid_source_uri\" | \"writer_admin_locked\" | \"connector_account_changed\" | \"connector_intent_outdated\" | \"checkpoint_validation_timeout\" | \"invalid_connector_text\" | \"connector_holds_exhausted\" | \"connector_fence_below_timeline\" | \"embedding_failed\" | \"bucket_not_found\" | \"database_error\" | \"unknown_transport\" | \"rate_limited\" | \"extraction_failed\" | \"fact_not_found\" | \"provenance_required\" | \"unavailable\" | \"budget_unsatisfiable\" | \"embedding_budget_below_worst_case\" | \"access_command_failed\" | \"access_denied_test_user\" | \"access_env_missing\" | \"acknowledgment_unavailable\" | \"admin_policy_enforced\" | \"ambiguous_id\" | \"ambiguous_skill\" | \"api_not_enabled\" | \"approval_required\" | \"autopilot_job_owned_by_other_brain\" | \"benchmark_duplicate_task_id\" | \"benchmark_empty\" | \"benchmark_exists\" | \"benchmark_judge_llm_no_rubric\" | \"benchmark_judge_qrels_no_expected\" | \"benchmark_judge_rule_no_checks\" | \"benchmark_judge_unknown_kind\" | \"benchmark_malformed\" | \"benchmark_missing_judge\" | \"benchmark_missing_task\" | \"benchmark_missing_task_id\" | \"benchmark_not_found\" | \"benchmark_rule_check_bad_arg\" | \"benchmark_rule_check_malformed\" | \"benchmark_rule_check_unknown_op\" | \"bootstrap_empty\" | \"bootstrap_pending_review\" | \"bridge_ownership_conflict\" | \"catalog_unavailable\" | \"changed_since_preview\" | \"chronicle_skipped\" | \"no_pricing\" | \"checkpoint_missing\" | \"claim_already_used\" | \"client_json_unreadable\" | \"client_json_wrong_type\" | \"client_shape_invalid\" | \"code_callees_requires_symbol\" | \"code_callers_requires_symbol\" | \"code_def_requires_symbol\" | \"code_refs_requires_symbol\" | \"code_reused\" | \"colon_slug_windows_write_through\" | \"command_failed\" | \"config_error\" | \"confirmation_required\" | \"conflicting_source_scope\" | \"consent_timeout\" | \"content_rejected\" | \"cost_cap_exceeded\" | \"cost_preview_requires_yes\" | \"cycle_failed\" | \"d_sel_too_small\" | \"demo_graph_failed\" | \"demo_import_failed\" | \"demo_verification_failed\" | \"derived_cap_exhausted\" | \"destination_not_ready\" | \"dirty_tree\" | \"effect_not_failed\" | \"embedding_auth_failed\" | \"embedding_configuration\" | \"embedding_disabled\" | \"embedding_model_mismatch\" | \"embedding_plane_split\" | \"embedding_storage_unavailable\" | \"embedding_unavailable\" | \"embedding_unconfigured\" | \"embedding_width_mismatch\" | \"export_limit\" | \"extractor_identity_mismatch\" | \"facts_absorb_write_refused\" | \"facts_payload_expired\" | \"fetch_failed\" | \"file_too_large\" | \"frontmatter_slug_conflict\" | \"full_resync_required\" | \"gate_failed\" | \"git_index_locked\" | \"git_index_stale\" | \"git_push_unavailable\" | \"git_target_unsafe\" | \"git_unavailable\" | \"graph_incomplete\" | \"held_out_overlaps_benchmark\" | \"held_out_required_for_bundled\" | \"independent_principal_required\" | \"insufficient_scope\" | \"internal\" | \"internal_error\" | \"interrupted\" | \"invalid_client\" | \"invalid_frontmatter\" | \"invalid_grant_clock_skew\" | \"invalid_grant_revoked\" | \"invalid_grant_testing_expiry\" | \"invalid_request\" | \"invalid_source\" | \"invalid_source_pin\" | \"invalid_token\" | \"invalid_write_wait\" | \"legacy_job_selection_invalid\" | \"legacy_jobs_active\" | \"local_conflict\" | \"lock_busy\" | \"managed_pull_skipped\" | \"method_not_allowed\" | \"migration_failed\" | \"migrations_pending\" | \"migrations_running\" | \"missing_source_scope\" | \"missing_source_value\" | \"models_strict_violation\" | \"no_refresh_token\" | \"no_routing_eval\" | \"no_skill_md\" | \"no_worker\" | \"no_worker_surface\" | \"not_a_git_repo\" | \"not_connected\" | \"no_brain\" | \"overlapping_path\" | \"parse_error\" | \"parser_regression\" | \"pasted_wrong_url\" | \"payload_too_large\" | \"pending_writes\" | \"pglite_busy\" | \"plan_output_failed\" | \"plan_stale\" | \"port_in_use\" | \"preview_changed\" | \"profile_incompatible\" | \"projection_owner_resident\" | \"publication_pending\" | \"redirect_uri_mismatch\" | \"refresh_dirty\" | \"refresh_diverged\" | \"refresh_drain_timeout\" | \"refresh_no_upstream\" | \"refresh_not_managed\" | \"refresh_not_owner\" | \"refresh_source_changed\" | \"relay_disabled\" | \"relay_session_expired\" | \"relay_unreachable\" | \"rename_held\" | \"request_already_submitted\" | \"requirements_changed\" | \"requires_local_engine\" | \"resume_spec_mismatch\" | \"revision_unavailable\" | \"scope_missing\" | \"serve_port_in_use\" | \"serve_status_only\" | \"shared_skills_unavailable\" | \"shared_skills_unsupported\" | \"skill_asset_not_found\" | \"skill_candidate_invalid\" | \"skill_not_found\" | \"skill_retention_capacity\" | \"source_binding_required\" | \"source_id_taken\" | \"source_not_ready\" | \"source_profile_no_backfill\" | \"source_referenced\" | \"source_root_conflict\" | \"split_bad_ratio\" | \"split_unparseable\" | \"state_mismatch\" | \"sync_not_applicable\" | \"sync_in_progress\" | \"sync_parser_regression\" | \"target_escape\" | \"topology_change_required\" | \"trusted_local_only\" | \"unexpected_file_bytes\" | \"unexpected_staging_bytes\" | \"unknown_command\" | \"unknown_flag\" | \"unknown_method\" | \"unknown_source\" | \"unknown_tool\" | \"unmanaged_path\" | \"unsupported_export_data\" | \"upstream\" | \"verification_failed\" | \"withdrawal_capacity\" | \"withdrawal_provenance\" | \"writer_admin_intent_required\" | \"writer_admin_state_changed\" | \"writer_busy\" | \"writer_identity_publish_failed\" | \"writer_manifest_mismatch\" | \"writer_manifest_unsafe\" | \"writer_regrant_required\" | \"writer_transfer_conflict\" | \"writer_transfer_required\" | \"wrong_account_consented\" | undefined","canonicalCode: string","cause?: unknown","code: ErrorCode",@@ -8065,7 +8233,7 @@"slug: string","source_id?: string | undefined","source_subject?: string | undefined",- "stale: boolean",+ "stale: boolean | { held_since: string; last_indexed_revision: string | null; }","status?: string | undefined","supersede_penalty?: number | undefined","superseded?: boolean | undefined",diff --git a/test/fixtures/goldens/pglite-upgrade-replay/catalog-after-boot.json b/test/fixtures/goldens/pglite-upgrade-replay/catalog-after-boot.jsonindex ab00615139..40df5ecbfd 100644--- a/test/fixtures/goldens/pglite-upgrade-replay/catalog-after-boot.json+++ b/test/fixtures/goldens/pglite-upgrade-replay/catalog-after-boot.json@@ -857,6 +857,7 @@"oauth_tokens_pkey": "CREATE UNIQUE INDEX oauth_tokens_pkey ON public.oauth_tokens USING btree (token_hash)","op_checkpoint_paths_pkey": "CREATE UNIQUE INDEX op_checkpoint_paths_pkey ON public.op_checkpoint_paths USING btree (op, fingerprint, path)","op_checkpoints_pkey": "CREATE UNIQUE INDEX op_checkpoints_pkey ON public.op_checkpoints USING btree (op, fingerprint)",+ "op_checkpoints_sync_hold_page_idx": "CREATE INDEX op_checkpoints_sync_hold_page_idx ON public.op_checkpoints USING btree ((((completed_keys -> 0) ->> 'page_id'::text))) WHERE (op = 'sync-hold'::text)","op_checkpoints_updated_at_idx": "CREATE INDEX op_checkpoints_updated_at_idx ON public.op_checkpoints USING btree (updated_at)","open_loops_counterparty_idx": "CREATE INDEX open_loops_counterparty_idx ON public.open_loops USING btree (source_id, counterparty_slug) WHERE (status = 'open'::text)","open_loops_dedup": "CREATE UNIQUE INDEX open_loops_dedup ON public.open_loops USING btree (source_id, dedup_key)",diff --git a/test/persistence-sync-options.serial.test.ts b/test/persistence-sync-options.serial.test.tsindex a669e850aa..2b4a3e1d81 100644--- a/test/persistence-sync-options.serial.test.ts+++ b/test/persistence-sync-options.serial.test.ts@@ -684,7 +684,10 @@ for (const boundary of ['retry-discovery', 'retry-commit', 'missing-manifest', 'if (boundary !== 'completed-cleanup') {writeFileSync(join(f.root, 'records/example-0.md'), '---\ntitle: [broken\n---\nSynthetic invalid document.\n');f.git.commitAll('Add synthetic failed import');- expect(await performSync(engine, f.opts)).toMatchObject({ status: 'blocked_by_failures' });+ // #5988: sync holds unreadable YAML by default; sync.holds=fail keeps the failed receipt this retry path needs.+ await engine.setConfig('sync.holds', 'fail');+ try { expect(await performSync(engine, f.opts)).toMatchObject({ status: 'blocked_by_failures' }); }+ finally { await engine.unsetConfig('sync.holds'); }writeFileSync(join(f.root, 'records/example-0.md'), body);f.git.commitAll('Repair synthetic failed import');} else expect(await performSync(engine, f.opts)).toMatchObject({ status: 'first_sync', added: 1 });diff --git a/test/reindex.test.ts b/test/reindex.test.tsindex 84167afbec..38d135da62 100644--- a/test/reindex.test.ts+++ b/test/reindex.test.ts@@ -471,7 +471,8 @@ describe('gbrain reindex --markdown (v0.32.7)', () => {test('source-file import errors are surfaced, counted, and fail the CLI', async () => {const repo = mkdtempSync(join(tmpdir(), 'gbrain-reindex-'));try {- writeFileSync(join(repo, 'bad.md'), '---\ntype: note\ntitle: Re: invalid yaml\n---\nbody\n');+ // #5988: `title: Re: ...` now imports by quoting; a mis-indented list cannot be read.+ writeFileSync(join(repo, 'bad.md'), '---\ntype: note\ntags:\n - a\n - b\n---\nbody\n');await seedLegacyPage('bad', 'old body', 'bad.md');const { result, stderr } = await captureOutput(() =>