Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

Merge origin/master (v0.60.38.0, #5985) into capy/5974-reconcile-diagnostics; renumber to migration v198 and v0.60.40.0

garrytan3d5243518bc3
diff --cc .claude-plugin/plugin.json
index e082884888,e082884888..4b0544508a
--- a/.claude-plugin/plugin.json
+++ b/.claude-plugin/plugin.json
@@@ -1,6 -1,6 +1,6 @@@
{
"name": "gbrain",
-- "version": "0.60.38.0",
++ "version": "0.60.40.0",
"description": "Personal knowledge brain for your coding agent — hybrid search, synthesis, graph traversal, and durable cross-session memory over Postgres/PGLite with pgvector, plus a curated brain-first skill set.",
"author": {
"name": "Garry Tan",
diff --cc .codex-plugin/plugin.json
index c53d1ffe8c,c53d1ffe8c..0f0bd0e47e
--- a/.codex-plugin/plugin.json
+++ b/.codex-plugin/plugin.json
@@@ -1,6 -1,6 +1,6 @@@
{
"name": "gbrain",
-- "version": "0.60.38.0",
++ "version": "0.60.40.0",
"description": "Personal knowledge brain for your coding agent — hybrid search, synthesis, graph traversal, and durable cross-session memory over Postgres/PGLite with pgvector, plus a curated brain-first skill set.",
"author": {
"name": "Garry Tan",
diff --cc BOOTSTRAP_FOR_AGENTS.md
index 4be8b13ccb,4be8b13ccb..a25adbbf42
--- a/BOOTSTRAP_FOR_AGENTS.md
+++ b/BOOTSTRAP_FOR_AGENTS.md
@@@ -1,4 -1,4 +1,4 @@@
--<!-- gbrain-runbook-stamp: 0.60.38.0 -->
++<!-- gbrain-runbook-stamp: 0.60.40.0 -->
<!-- This stamp must equal the VERSION file at every release; CI enforces it
(scripts/check-bootstrap-tag.sh). `gbrain bootstrap status` compares it to
the installed binary and warns on skew. -->
diff --cc CHANGELOG.md
index 4488bc76c5,88755852d3..542c131c1f
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -10,94 -10,46 +10,143 @@@ credits are retained; no result has bee
identifiers and attribution are available in the pre-removal Git revision
`6040075c6cb95be5881cc2e1b76ef7d71f4e5d29` (retained on 2026-09-23).
- ## [0.60.38.0] - 2026-10-03
++## [0.60.40.0] - 2026-10-04
+
+**When a page repair fails, gbrain now says exactly what stopped it, and pages whose file only gained new lines can be repaired in a few commands instead of by hand.**
+
+Each page lives twice in a managed brain: as a markdown file and as a database row. When something edits the file directly, gbrain stops saving new facts to that page so it never overwrites one copy with the other. The repair tool for that (`gbrain sources reconcile`) could fail with `Publication failed (P0001). Inspect owner diagnostics.`, and the diagnostics said nothing. P0001 comes from a safety check inside the database, and gbrain threw away its reason. Now the failure names the table, the kind of write, which safety rule fired and the gbrain build that ran the job, so the next report pins the cause.
+
+Repairs got easier too. A new read-only classification sorts drifted pages by how they drifted. A new opt-in preview mode fills in the decisions for changes that only add things: contacts appended to a list, a "last used" date that moved forward. Lines added to the body or timeline are shown as suggestions you accept explicitly, because an added line can still contradict an older one. Anything that changed or removed existing text, or touched privacy, titles, tags or other policy fields, still waits for a person.
+
+### How to use it
+
+```bash
+# 1. See how a source's drifted pages drifted (read-only, no page text in the output)
+gbrain sources reconcile <source> --brain host --audit --classify --limit 25 --json
+
+# 2. Preview one page with the additive rules, read the inserted lines in the private file
+gbrain sources reconcile <source> <slug> --brain host --preview --auto-additive --out ~/.gbrain/repair/p.json --json
+
+# 3. Accept the inserted lines once you (or the user) have read them, then apply
+gbrain sources reconcile <source> <slug> --brain host --preview --auto-additive --accept-suggested --out ~/.gbrain/repair/p2.json --json
+gbrain sources reconcile <source> <slug> --brain host --apply ~/.gbrain/repair/p2.json --request-id "$(bun -e 'console.log(crypto.randomUUID())')" --json
+
+# 4. Retry the write that was blocked, with a new request id
+```
+
+### What you'd see
+
+| Drift on the page | Classification | What the preview does |
+| --- | --- | --- |
+| Contacts appended after every stored entry, repeats kept | `structurally_additive` | Decides it |
+| `updated` or `phone_last_used` moved forward | `structurally_additive` | Decides it |
+| New lines in the body or timeline, nothing removed | `additive_with_suggestions` | Suggests it; needs `--accept-suggested` |
+| A stored sentence edited or deleted | `review_required` | Leaves it for a person |
+| `visibility`, `access`, title, tags or an `expires_at` changed | `review_required` | Leaves it for a person |
+
+A refused write now reads like this in the receipt (`write_error_detail`), with no page text and no source names:
+
+| Field | Example |
+| --- | --- |
+| `write_error` | `writer_coordinator_required` |
+| `table` / `op` | `pages` / `INSERT` |
+| `branch` / `relationship` | `allowlist` / `different_source` |
+| `stage` | `publication` or `after_file_publication` |
+
+`gbrain sources writer status --probe --json` adds `recent_failures`, which also carries the source ids and the gbrain build and host that ran the failed attempt. Those stay owner-only because a source name can itself be private.
+
++### Two new doctor checks
++
++- `managed_guard_schema_drift` warns when a guarded table (pages, tags, timeline entries, takes, facts, aliases, sources) carries a column gbrain never created, and calls out a `source_id` on tags, timeline entries or takes, the #5983 cause.
++- `publication_refusals` counts writes the database refused in the last 7 days, split by the managed-writer guard, another trigger, and older unclassified P0001 failures, and says what to run next.
++
+### Things to watch
+
+- Restart every long-running gbrain process that shares the database (serve, autopilot, sync jobs) after upgrading. A refusal is most often one older process doing a write the current guard refuses, and the new record names that process's build.
+- "Structurally additive" checks structure, not truth. The rules never decide prose for you.
+- Preview files with automatic decisions use artifact format 2. An older gbrain refuses them as malformed rather than guessing.
+
+### What we caught and fixed before merging
+
- The plan went through CEO, engineering and outside-voice review. The reviewers caught that an appended line can contradict an old one, so prose became a suggestion instead of an automatic decision. They caught that the first draft of the diagnostic would have shown source names to remote callers, so names moved behind the owner-only status command. They also caught that the failure record would have been erased by receipt compaction and lost across crash recovery, so it now survives both. We could not reproduce the reporter's P0001: 14 page and brain states committed cleanly on v0.60.35.0 and v0.60.37.0 against real Postgres. The new record is what will name the cause.
++The plan went through CEO, engineering and outside-voice review. The reviewers caught that an appended line can contradict an old one, so prose became a suggestion instead of an automatic decision. They caught that the first draft of the diagnostic would have shown source names to remote callers, so names moved behind the owner-only status command. They also caught that the failure record would have been erased by receipt compaction and lost across crash recovery, so it now survives both. We could not reproduce the reporter's P0001 on a clean schema: 14 page and brain states committed on v0.60.35.0 and v0.60.37.0 against real Postgres. The cause turned out to be a schema change on the reporter's brain (a `source_id` column on tags, timeline and take tables that gbrain never creates), fixed in v0.60.38.0 (#5983). With this release, that failure would have reported `relationship: missing_source` on `tags`, and the new doctor check names the stray column directly.
+
- ## To take advantage of v0.60.38.0
++## To take advantage of v0.60.40.0
+
- `gbrain upgrade` applies schema migration v197 (a nullable `error_detail` column on write receipts and a re-installed managed-writer guard). If it did not, or `gbrain doctor` warns about a partial migration:
++`gbrain upgrade` applies schema migration v198 (a nullable `error_detail` column on write receipts and a re-installed managed-writer guard). If it did not, or `gbrain doctor` warns about a partial migration:
+
+1. **Run the orchestrator:**
+ ```bash
+ gbrain apply-migrations --yes --no-autopilot-install
+ ```
+2. **Restart every gbrain process that shares this database** so all of them run the same build.
+3. **Verify:**
+ ```bash
+ gbrain sources writer status --probe --json # recent_failures is present (often empty)
+ gbrain sources reconcile <source> --brain host --audit --classify --limit 5 --json
+ ```
+4. **If any step fails,** file an issue at https://github.com/garrytan/gbrain/issues with the output of `gbrain doctor` and `~/.gbrain/upgrade-errors.jsonl` if it exists.
+
+### Itemized changes
+
+#### Diagnostics (#5974)
- - `gbrain_require_managed_writer()` raises with `TABLE`, `SCHEMA`, `CONSTRAINT = managed_writer_guard:<checkpoint|topology|allowlist>` and a JSON `DETAIL` (`op`, `relationship`, source ids). Migration v197 re-installs it and adds `persistence_requests.error_detail jsonb`.
++- `gbrain_require_managed_writer()` raises with `TABLE`, `SCHEMA`, `CONSTRAINT = managed_writer_guard:<checkpoint|topology|allowlist>` and a JSON `DETAIL` (`op`, `relationship`, source ids). Migration v198 re-installs it and adds `persistence_requests.error_detail jsonb`.
+- New `src/core/persistence/publication-failure.ts`: `databaseRefusal` maps a guard P0001 to `writer_coordinator_required` (`origin: database_guard`) and any other P0001 to `storage_error` naming the raising function from the error's `where`. Raw messages, SQL and row values are never kept. `withAttempt` stamps stage, build and host; `publicFailureDetail` strips source ids, build and host for receipts.
+- `requestError`, `finishUnpublishedFailure`, `markRecovering`, `recoverPublication` and `completeWrite` carry the detail; compaction keeps it. The consumer logs publication failures that used to return without a log line.
+- Receipts gain `write_error_detail`; refusals carry an agent-facing suggestion (`DATABASE_REFUSAL_HINT`). `sources writer status` gains `recent_failures`. New row in `docs/guides/write-refusals.md`.
+
+#### Additive drift resolution (#5974)
+- New `src/core/persistence/reconcile-additive.ts`: `classifyDrift` over the complete file/database delta; `additiveDecisions`; `assertAutoDecisions` rechecks rule, rule version and evidence digest at apply and owner preparation.
+- `sources reconcile --preview --auto-additive [--accept-suggested]`; preview returns `classification`, `drift_paths`, `auto_decided_paths` and `next_action`. Artifact `format_version: 2` adds `auto_decisions`.
+- `sources reconcile --audit --classify` adds per-page `classification`, `drift_paths` and `file_modified_after_database`, plus `classified` counts.
+- Docs: `docs/guides/concurrent-writes.md` (classify and additive section), `RECONCILE_HELP`.
+
++#### Doctor (#5983, #5974)
++- New `src/commands/doctor/checks/managed-guard.ts`: `managed_guard_schema_drift` (columns on `GUARDED_TABLES` outside `GUARDED_TABLE_COLUMNS`, pinned to the catalog goldens by `test/doctor-managed-guard.test.ts`) and `publication_refusals` (7-day count by origin). Both link `docs/guides/write-refusals.md#managed-guard-page-children`. `PAGE_CHILD_TABLES` and `GUARDED_TABLES` are now exported from `writer-guard-schema.ts`.
++- Migration v198 replaces only the guard function (`MANAGED_WRITER_GUARD_FUNCTION_SQL`, no table lock) on top of v197's page-child source resolution.
++
+#### Tests
+- `test/persistence-publication-refusal-5974.test.ts` (PGLite and Postgres): cross-source write inside publication, refusal after file replacement with exact restoration, redaction, compaction survival, other P0001 raisers.
+- `test/persistence-reconcile-additive-5974.test.ts` (PGLite and Postgres): classifier truth table; the reporter's page shape through audit, preview, apply, `remember` and MCP readback; a replaced page staying blocked; tampered evidence and a concurrent file change refusing apply. Both files join the PostgreSQL persistence-validation workflow.
+ ## [0.60.38.0] - 2026-10-03
+
+ **On a managed brain whose `tags`, `timeline_entries` or `takes` table carries a `source_id` column gbrain never created, every tag, timeline and take write was refused, even coordinated ones. Managed sync stalled at the first tagged page, `facts relink` aborted, autopilot dropped timeline rows every cycle, and `remember`, `add_timeline_entry` and maintenance-page writes failed. Those writes commit again (#5983).**
+
+ The managed writer guard (`gbrain_require_managed_writer`) decides which source a row belongs to before it lets a write through. It took the row's `source_id` whenever the column existed, even when the value was NULL. gbrain's schema has no such column on those three tables, so on a canonical brain the guard looked up the parent page instead. A brain where something else had added a nullable `source_id` column to them sent every insert and update to the "no source" branch and refused it as `writer_coordinator_required`. Deletes passed through the NULL-source cascade exemption, so delete-only work kept succeeding. The client saw `storage_error: Publication failed (P0001). Inspect owner diagnostics.`
+
+ Tags, timeline entries and takes now always take their source from their page. A `source_id` column on them is ignored whatever it holds, so it can neither block a write nor let one through for another source. On such a brain, an uncoordinated delete of a tag, timeline or take row on a live page now needs the coordinator, as it always did on a canonical brain. Deleting a page still removes its children. Migration v197 replaces the guard function only; it re-creates no trigger.
+
+ ## To take advantage of v0.60.38.0
+
+ `gbrain upgrade` installs the binary and runs schema migration v197. Run the upgrade on the brain host (a thin client cannot run it; hand the owner these steps). Pause autopilot during the upgrade: as on every upgrade, the schema replay re-creates the guard triggers.
+
+ 1. **Keep the failed writes' content while you recover.** Failed write requests keep their original content for 30 days (`persistence.receipt_retention_days`). Brains hit by this bug since activation should keep them longer until the replay tool lands:
+ ```bash
+ gbrain config set persistence.receipt_retention_days 90
+ ```
+ 2. **Run the migration if the upgrade did not, then verify:**
+ ```bash
+ gbrain apply-migrations --yes --no-autopilot-install
+ gbrain doctor --json # the schema_version check reports 197 or later
+ ```
+ 3. **Unstick each managed sync.** Re-run the original sync invocation for each affected source unchanged (same brain, source, `--working-tree` and other options), adding `--no-pull --retry-failed --json`. A different sync can succeed while the original failed run stays unresolved.
+ ```bash
+ gbrain sync --source <id> --no-pull --retry-failed --json
+ ```
+ Check that the source's `last_commit` advances (`gbrain sources status <id>`).
+ 4. **Rebuild the timeline rows autopilot dropped:**
+ ```bash
+ gbrain extract --stale --source-id <id> --json
+ gbrain extract timeline --source db --source-id <id> --json # rows the page text has but the table lacks
+ ```
+ Run the second command until it reports no new rows.
+ 5. **Re-link facts. Preview first; the model tier costs money, so ask the user before it:**
+ ```bash
+ gbrain facts relink --source <id> --dry-run
+ gbrain facts relink --source <id> --no-llm
+ gbrain facts relink --source <id> --max-usd <n> # only after the user agrees
+ ```
+ Follow the printed `next_command` until `has_more` is false. Exit 0 alone does not mean the backlog is done.
+ 6. **Writes that failed outright are not replayed by the upgrade.** A `remember`, `add_timeline_entry` or maintenance-page write refused by this bug keeps its failed receipt; resubmitting the same request id returns that failure. Re-issue the ones you have a record of with a new request id, and tell the user which writes from the incident window could not be recovered.
## [0.60.37.0] - 2026-10-03
diff --cc VERSION
index 403e6a4253,403e6a4253..a35e988522
--- a/VERSION
+++ b/VERSION
@@@ -1,1 -1,1 +1,1 @@@
--0.60.38.0
++0.60.40.0
diff --cc openclaw.plugin.json
index fd6523249b,fd6523249b..58fe8d87ac
--- a/openclaw.plugin.json
+++ b/openclaw.plugin.json
@@@ -1,7 -1,7 +1,7 @@@
{
"id": "gbrain-context-engine",
"name": "gbrain",
-- "version": "0.60.38.0",
++ "version": "0.60.40.0",
"description": "Personal knowledge brain with Postgres + pgvector hybrid search",
"family": "bundle-plugin",
"kind": "context-engine",
diff --cc package.json
index 2802979c87,2802979c87..f180deec1e
--- a/package.json
+++ b/package.json
@@@ -207,7 -207,7 +207,7 @@@
"bun": ">=1.4.0"
},
"license": "MIT",
-- "version": "0.60.38.0",
++ "version": "0.60.40.0",
"overrides": {
"@ai-sdk/provider-utils": "4.0.56",
"@hono/node-server": "^2.0.5",
diff --cc plugin-variants/gbrain-coding/.claude-plugin/plugin.json
index ccac395ad3,ccac395ad3..6f36b0fb78
--- a/plugin-variants/gbrain-coding/.claude-plugin/plugin.json
+++ b/plugin-variants/gbrain-coding/.claude-plugin/plugin.json
@@@ -1,6 -1,6 +1,6 @@@
{
"name": "gbrain-coding",
-- "version": "0.60.38.0",
++ "version": "0.60.40.0",
"description": "Brain-first coding agent working inside a repo: retrieval, routing, ingest discipline, correction hygiene. Default persona for the claude-code harness bridge; also published as the gbrain-coding marketplace variant. (persona variant of the gbrain plugin — 21 skills)",
"author": {
"name": "Garry Tan",
diff --cc plugin-variants/gbrain-coding/.codex-plugin/plugin.json
index 78f43e1338,78f43e1338..f981caee89
--- a/plugin-variants/gbrain-coding/.codex-plugin/plugin.json
+++ b/plugin-variants/gbrain-coding/.codex-plugin/plugin.json
@@@ -1,6 -1,6 +1,6 @@@
{
"name": "gbrain-coding",
-- "version": "0.60.38.0",
++ "version": "0.60.40.0",
"description": "Brain-first coding agent working inside a repo: retrieval, routing, ingest discipline, correction hygiene. Default persona for the claude-code harness bridge; also published as the gbrain-coding marketplace variant. (persona variant of the gbrain plugin — 21 skills)",
"author": {
"name": "Garry Tan",
diff --cc plugin-variants/gbrain-coding/README.md
index 4df2184dfe,4df2184dfe..867a487551
--- a/plugin-variants/gbrain-coding/README.md
+++ b/plugin-variants/gbrain-coding/README.md
@@@ -1,4 -1,4 +1,4 @@@
--<!-- gbrain-plugin-tree-stamp: 0.60.38.0 -->
++<!-- gbrain-plugin-tree-stamp: 0.60.40.0 -->
# gbrain-coding (generated persona variant — do not hand-edit)
Brain-first coding agent working inside a repo: retrieval, routing, ingest discipline, correction hygiene. Default persona for the claude-code harness bridge; also published as the gbrain-coding marketplace variant.
diff --cc plugin-variants/gbrain-daily/.claude-plugin/plugin.json
index b07cbb6b7c,b07cbb6b7c..194ab739ba
--- a/plugin-variants/gbrain-daily/.claude-plugin/plugin.json
+++ b/plugin-variants/gbrain-daily/.claude-plugin/plugin.json
@@@ -1,6 -1,6 +1,6 @@@
{
"name": "gbrain-daily",
-- "version": "0.60.38.0",
++ "version": "0.60.40.0",
"description": "Personal knowledge-brain daily use: meetings, tasks, briefings, reading, research. Published as the gbrain-daily marketplace variant. (persona variant of the gbrain plugin — 20 skills)",
"author": {
"name": "Garry Tan",
diff --cc plugin-variants/gbrain-daily/.codex-plugin/plugin.json
index 328fe99fc2,328fe99fc2..920b3f41ed
--- a/plugin-variants/gbrain-daily/.codex-plugin/plugin.json
+++ b/plugin-variants/gbrain-daily/.codex-plugin/plugin.json
@@@ -1,6 -1,6 +1,6 @@@
{
"name": "gbrain-daily",
-- "version": "0.60.38.0",
++ "version": "0.60.40.0",
"description": "Personal knowledge-brain daily use: meetings, tasks, briefings, reading, research. Published as the gbrain-daily marketplace variant. (persona variant of the gbrain plugin — 20 skills)",
"author": {
"name": "Garry Tan",
diff --cc plugin-variants/gbrain-daily/README.md
index b5336ae6c6,b5336ae6c6..ea751d525c
--- a/plugin-variants/gbrain-daily/README.md
+++ b/plugin-variants/gbrain-daily/README.md
@@@ -1,4 -1,4 +1,4 @@@
--<!-- gbrain-plugin-tree-stamp: 0.60.38.0 -->
++<!-- gbrain-plugin-tree-stamp: 0.60.40.0 -->
# gbrain-daily (generated persona variant — do not hand-edit)
Personal knowledge-brain daily use: meetings, tasks, briefings, reading, research. Published as the gbrain-daily marketplace variant.
diff --cc plugin/README.md
index d4e6aa3fa7,d4e6aa3fa7..a1562e496d
--- a/plugin/README.md
+++ b/plugin/README.md
@@@ -1,4 -1,4 +1,4 @@@
--<!-- gbrain-plugin-tree-stamp: 0.60.38.0 -->
++<!-- gbrain-plugin-tree-stamp: 0.60.40.0 -->
# gbrain plugin skill tree (generated — do not hand-edit)
This tree is the curated skill set for the gbrain Codex and Claude Code
diff --cc src/core/persistence/writer-guard-schema.ts
index a780b7c77e,b43decd8e5..fd9362e566
--- a/src/core/persistence/writer-guard-schema.ts
+++ b/src/core/persistence/writer-guard-schema.ts
@@@ -1,9 -1,11 +1,11 @@@
import { ROW_ATTRIBUTION_COLUMNS } from './attribution-schema.ts';
+ const ROW_ATTRIBUTION_KEYS = `ARRAY[${ROW_ATTRIBUTION_COLUMNS.map(column => `'${column}'`).join(',')}]`;
+ /** Guarded tables with no canonical source_id: their source is always their page's (#5983). */
-const PAGE_CHILD_TABLES = ['tags', 'timeline_entries', 'takes'];
-const GUARDED_TABLES = ['pages', 'tags', 'slug_aliases', 'page_aliases', 'facts', 'takes', 'timeline_entries', 'sources'];
+export const PAGE_CHILD_TABLES = ['tags', 'timeline_entries', 'takes'];
+export const GUARDED_TABLES = ['pages', 'tags', 'slug_aliases', 'page_aliases', 'facts', 'takes', 'timeline_entries', 'sources'];
- const ROW_ATTRIBUTION_KEYS = `ARRAY[${ROW_ATTRIBUTION_COLUMNS.map(column => `'${column}'`).join(',')}]`;
- /** Defense in depth for inventoried legacy writers. Manual SQL is outside the protocol. */
- export const MANAGED_WRITER_GUARD_SQL = `
+ const sqlList = (names: string[]) => names.map(name => `'${name}'`).join(',');
+ /** The guard function alone: replacing it takes no table lock (v197). */
+ export const MANAGED_WRITER_GUARD_FUNCTION_SQL = `
CREATE OR REPLACE FUNCTION gbrain_require_managed_writer() RETURNS trigger LANGUAGE plpgsql AS $fn$
DECLARE target_source text; old_source text; row_data jsonb; old_data jsonb; allowed jsonb;
BEGIN
diff --cc src/core/schema-migrations/registry.generated.ts
index 593f50645c,e75bc6a321..13fe187cb2
--- a/src/core/schema-migrations/registry.generated.ts
+++ b/src/core/schema-migrations/registry.generated.ts
@@@ -197,7 -197,7 +197,8 @@@ import { v193 } from './v193-f1-write-a
import { v194 } from './v194-f0-worktree-refreshes.ts';
import { v195 } from './v195-f3-access-token-grants.ts';
import { v196 } from './v196-f4-planner-stats.ts';
- import { v197 } from './v197-publication-failure-detail.ts';
+ import { v197 } from './v197-managed-guard-null-source-fallback.ts';
++import { v198 } from './v198-publication-failure-detail.ts';
// Array order is historical (see HISTORICAL_ARRAY_ORDER in the generator); the
// runner sorts by version before applying.
@@@ -394,4 -394,4 +395,5 @@@ export const MIGRATIONS: Migration[] =
v195,
v196,
v197,
++ v198,
];
diff --cc src/core/schema-migrations/v198-publication-failure-detail.ts
index 4851d85deb,0000000000..efffc28dca
mode 100644,000000..100644
--- a/src/core/schema-migrations/v198-publication-failure-detail.ts
+++ b/src/core/schema-migrations/v198-publication-failure-detail.ts
@@@ -1,21 -1,0 +1,21 @@@
+import type { Migration } from './types.ts';
- import { MANAGED_WRITER_GUARD_SQL } from '../persistence/writer-guard-schema.ts';
++import { MANAGED_WRITER_GUARD_FUNCTION_SQL } from '../persistence/writer-guard-schema.ts';
+
+// Applied by src/core/migrate.ts on the next initSchema(); see docs/ENGINES.md
+// ("Canonical schema sources") for when schema.sql or a TS fragment also changes.
+//
+// #5974: a refused publication names what refused it. The managed-writer guard
- // is re-installed so each RAISE carries TABLE/SCHEMA, a
++// function is replaced (no table lock, as in v197) so each RAISE carries TABLE/SCHEMA, a
+// CONSTRAINT='managed_writer_guard:<branch>' marker and a JSON DETAIL with the
+// operation and source relationship (no row values). persistence_requests gains
+// error_detail, the bounded structured failure (publication-failure.ts) that
+// survives recovery and compaction. Column-only and nullable; like v178 it is
+// migration-created on PGLite and no index references it.
- export const v197: Migration = {
- version: 197,
++export const v198: Migration = {
++ version: 198,
+ name: 'publication_failure_detail',
+ idempotent: true,
+ sql: `
+ ALTER TABLE persistence_requests ADD COLUMN IF NOT EXISTS error_detail jsonb;
- ${MANAGED_WRITER_GUARD_SQL}`,
++ ${MANAGED_WRITER_GUARD_FUNCTION_SQL}`,
+};
diff --cc templates/bootstrap/template-repo/README.md
index 1c5ec6eab1,1c5ec6eab1..e310ad5da0
--- a/templates/bootstrap/template-repo/README.md
+++ b/templates/bootstrap/template-repo/README.md
@@@ -1,6 -1,6 +1,6 @@@
# gbrain agent workspace — template
--<!-- gbrain-template-stamp: 0.60.38.0 -->
++<!-- gbrain-template-stamp: 0.60.40.0 -->
This repository is the **"Use this template"** distribution artifact for a
[gbrain](https://github.com/garrytan/gbrain) personal-agent workspace — the same
diff --cc test/fixtures/goldens/catalog/pglite-engine-init-default.json
index 9f9b1f453f,4f0686f397..17417b46da
--- a/test/fixtures/goldens/catalog/pglite-engine-init-default.json
+++ b/test/fixtures/goldens/catalog/pglite-engine-init-default.json
@@@ -311,7 -311,7 +311,7 @@@
"gbrain_lease_shared_skill_delivery()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=5e493c1ac8dce8cb025a736629e563437c4b214744137c302c532c20bf7e7acf",
"gbrain_preserve_fact_withdrawal()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=9beb118551a08451a228146373f50f2aa2ce0cfe89937e937d361b33224aa0aa",
"gbrain_queue_page_projection()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=6c544b9c129b6a17dcabeb5ee8d44a2b0e0af9d02ca3fe47c7d7f22ec313042c",
- "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=f23ed35b3590e5290a8045c1867957a1227d8fbccf6a6ada70e506098c234fc2",
- "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=1ba3002d6485edf4f92ea4d380299b2f0872f49ad827e7e76381f9a75efaa404",
++ "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=9dc91548479da39c77e3015481b89901ef13fb02ce496597606fbac592c05201",
"gbrain_require_persistence_protocol(required integer)": "RETURNS void kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=af07b7fac60dec0a4fe568217931ac449d32f73b3a53a047b3b02a5f59cb5058",
"gbrain_stamp_revision_attribution()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=d446ed1145d8bb9c93cb0ca4aa076a5dc7a5fe07b3e79518adaf1b17b0a51216",
"gbrain_stamp_version_attribution()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=1b28a0e5769198d86490dc20b2aee80b7e6595670428a63ac9c6825cd2a35b10",
diff --cc test/fixtures/goldens/catalog/pglite-engine-init-fts-portuguese.json
index 2b71d87416,7f41912877..65632263f3
--- a/test/fixtures/goldens/catalog/pglite-engine-init-fts-portuguese.json
+++ b/test/fixtures/goldens/catalog/pglite-engine-init-fts-portuguese.json
@@@ -311,7 -311,7 +311,7 @@@
"gbrain_lease_shared_skill_delivery()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=5e493c1ac8dce8cb025a736629e563437c4b214744137c302c532c20bf7e7acf",
"gbrain_preserve_fact_withdrawal()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=9beb118551a08451a228146373f50f2aa2ce0cfe89937e937d361b33224aa0aa",
"gbrain_queue_page_projection()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=6c544b9c129b6a17dcabeb5ee8d44a2b0e0af9d02ca3fe47c7d7f22ec313042c",
- "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=f23ed35b3590e5290a8045c1867957a1227d8fbccf6a6ada70e506098c234fc2",
- "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=1ba3002d6485edf4f92ea4d380299b2f0872f49ad827e7e76381f9a75efaa404",
++ "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=9dc91548479da39c77e3015481b89901ef13fb02ce496597606fbac592c05201",
"gbrain_require_persistence_protocol(required integer)": "RETURNS void kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=af07b7fac60dec0a4fe568217931ac449d32f73b3a53a047b3b02a5f59cb5058",
"gbrain_stamp_revision_attribution()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=d446ed1145d8bb9c93cb0ca4aa076a5dc7a5fe07b3e79518adaf1b17b0a51216",
"gbrain_stamp_version_attribution()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=1b28a0e5769198d86490dc20b2aee80b7e6595670428a63ac9c6825cd2a35b10",
diff --cc test/fixtures/goldens/catalog/pglite-engine-init-high-dims.json
index 47f6f215f3,4b4462cd73..f019053672
--- a/test/fixtures/goldens/catalog/pglite-engine-init-high-dims.json
+++ b/test/fixtures/goldens/catalog/pglite-engine-init-high-dims.json
@@@ -311,7 -311,7 +311,7 @@@
"gbrain_lease_shared_skill_delivery()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=5e493c1ac8dce8cb025a736629e563437c4b214744137c302c532c20bf7e7acf",
"gbrain_preserve_fact_withdrawal()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=9beb118551a08451a228146373f50f2aa2ce0cfe89937e937d361b33224aa0aa",
"gbrain_queue_page_projection()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=6c544b9c129b6a17dcabeb5ee8d44a2b0e0af9d02ca3fe47c7d7f22ec313042c",
- "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=f23ed35b3590e5290a8045c1867957a1227d8fbccf6a6ada70e506098c234fc2",
- "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=1ba3002d6485edf4f92ea4d380299b2f0872f49ad827e7e76381f9a75efaa404",
++ "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=9dc91548479da39c77e3015481b89901ef13fb02ce496597606fbac592c05201",
"gbrain_require_persistence_protocol(required integer)": "RETURNS void kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=af07b7fac60dec0a4fe568217931ac449d32f73b3a53a047b3b02a5f59cb5058",
"gbrain_stamp_revision_attribution()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=d446ed1145d8bb9c93cb0ca4aa076a5dc7a5fe07b3e79518adaf1b17b0a51216",
"gbrain_stamp_version_attribution()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=1b28a0e5769198d86490dc20b2aee80b7e6595670428a63ac9c6825cd2a35b10",
diff --cc test/fixtures/goldens/catalog/pglite-schema-blob-default.json
index cf9e17da42,3aebc0d724..46f619fe29
--- a/test/fixtures/goldens/catalog/pglite-schema-blob-default.json
+++ b/test/fixtures/goldens/catalog/pglite-schema-blob-default.json
@@@ -242,7 -242,7 +242,7 @@@
"gbrain_guard_skill_publication()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=e854c0d058e75a65c3a90127c5c417380975100e83fc34288f6085e786df10a9",
"gbrain_lease_shared_skill_delivery()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=5e493c1ac8dce8cb025a736629e563437c4b214744137c302c532c20bf7e7acf",
"gbrain_queue_page_projection()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=6c544b9c129b6a17dcabeb5ee8d44a2b0e0af9d02ca3fe47c7d7f22ec313042c",
- "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=f23ed35b3590e5290a8045c1867957a1227d8fbccf6a6ada70e506098c234fc2",
- "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=1ba3002d6485edf4f92ea4d380299b2f0872f49ad827e7e76381f9a75efaa404",
++ "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=9dc91548479da39c77e3015481b89901ef13fb02ce496597606fbac592c05201",
"gbrain_require_persistence_protocol(required integer)": "RETURNS void kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=af07b7fac60dec0a4fe568217931ac449d32f73b3a53a047b3b02a5f59cb5058",
"update_page_search_vector()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public] body_sha256=8e2e253471f22c3e70b2fa2e67ba9162ee3d2c764d175cb5b674db2b907d1e9d"
},
diff --cc test/fixtures/goldens/catalog/pglite-schema-blob-fts-portuguese.json
index 855c61a3da,c2c25193a5..418a265f75
--- a/test/fixtures/goldens/catalog/pglite-schema-blob-fts-portuguese.json
+++ b/test/fixtures/goldens/catalog/pglite-schema-blob-fts-portuguese.json
@@@ -242,7 -242,7 +242,7 @@@
"gbrain_guard_skill_publication()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=e854c0d058e75a65c3a90127c5c417380975100e83fc34288f6085e786df10a9",
"gbrain_lease_shared_skill_delivery()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=5e493c1ac8dce8cb025a736629e563437c4b214744137c302c532c20bf7e7acf",
"gbrain_queue_page_projection()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=6c544b9c129b6a17dcabeb5ee8d44a2b0e0af9d02ca3fe47c7d7f22ec313042c",
- "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=f23ed35b3590e5290a8045c1867957a1227d8fbccf6a6ada70e506098c234fc2",
- "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=1ba3002d6485edf4f92ea4d380299b2f0872f49ad827e7e76381f9a75efaa404",
++ "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=9dc91548479da39c77e3015481b89901ef13fb02ce496597606fbac592c05201",
"gbrain_require_persistence_protocol(required integer)": "RETURNS void kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=af07b7fac60dec0a4fe568217931ac449d32f73b3a53a047b3b02a5f59cb5058",
"update_page_search_vector()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public] body_sha256=3d98cc6ce4387bd742c1588ddc2133d036c7c5c8c64f7d33d1909c9ae44e73a6"
},
diff --cc test/fixtures/goldens/catalog/pglite-schema-blob-high-dims.json
index 1d83679dc6,fc97debbf9..b95612896e
--- a/test/fixtures/goldens/catalog/pglite-schema-blob-high-dims.json
+++ b/test/fixtures/goldens/catalog/pglite-schema-blob-high-dims.json
@@@ -242,7 -242,7 +242,7 @@@
"gbrain_guard_skill_publication()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=e854c0d058e75a65c3a90127c5c417380975100e83fc34288f6085e786df10a9",
"gbrain_lease_shared_skill_delivery()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=5e493c1ac8dce8cb025a736629e563437c4b214744137c302c532c20bf7e7acf",
"gbrain_queue_page_projection()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=6c544b9c129b6a17dcabeb5ee8d44a2b0e0af9d02ca3fe47c7d7f22ec313042c",
- "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=f23ed35b3590e5290a8045c1867957a1227d8fbccf6a6ada70e506098c234fc2",
- "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=1ba3002d6485edf4f92ea4d380299b2f0872f49ad827e7e76381f9a75efaa404",
++ "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=9dc91548479da39c77e3015481b89901ef13fb02ce496597606fbac592c05201",
"gbrain_require_persistence_protocol(required integer)": "RETURNS void kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=af07b7fac60dec0a4fe568217931ac449d32f73b3a53a047b3b02a5f59cb5058",
"update_page_search_vector()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public] body_sha256=8e2e253471f22c3e70b2fa2e67ba9162ee3d2c764d175cb5b674db2b907d1e9d"
},
diff --cc test/fixtures/goldens/catalog/postgres-db-initschema.json
index a895e5dfd2,05b9aa898c..a2e7a4a2cc
--- a/test/fixtures/goldens/catalog/postgres-db-initschema.json
+++ b/test/fixtures/goldens/catalog/postgres-db-initschema.json
@@@ -251,7 -251,7 +251,7 @@@
"gbrain_guard_skill_publication()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=e854c0d058e75a65c3a90127c5c417380975100e83fc34288f6085e786df10a9",
"gbrain_lease_shared_skill_delivery()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=5e493c1ac8dce8cb025a736629e563437c4b214744137c302c532c20bf7e7acf",
"gbrain_queue_page_projection()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=6c544b9c129b6a17dcabeb5ee8d44a2b0e0af9d02ca3fe47c7d7f22ec313042c",
- "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=f23ed35b3590e5290a8045c1867957a1227d8fbccf6a6ada70e506098c234fc2",
- "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=1ba3002d6485edf4f92ea4d380299b2f0872f49ad827e7e76381f9a75efaa404",
++ "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=9dc91548479da39c77e3015481b89901ef13fb02ce496597606fbac592c05201",
"gbrain_require_persistence_protocol(required integer)": "RETURNS void kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=af07b7fac60dec0a4fe568217931ac449d32f73b3a53a047b3b02a5f59cb5058",
"notify_minion_job_change()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public] body_sha256=17f7c36408688409c80befd0a9ef9314e597d78a195418d1b94426e3d0b662f8",
"update_chunk_search_vector()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public] body_sha256=d6d7b39b09838a1f5aaf343b766f21d2cd36f9d552a72b757266c779467f9647",
diff --cc test/fixtures/goldens/catalog/postgres-engine-init-default.json
index d079a52b23,89df97d14c..c59395dac1
--- a/test/fixtures/goldens/catalog/postgres-engine-init-default.json
+++ b/test/fixtures/goldens/catalog/postgres-engine-init-default.json
@@@ -314,7 -314,7 +314,7 @@@
"gbrain_lease_shared_skill_delivery()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=5e493c1ac8dce8cb025a736629e563437c4b214744137c302c532c20bf7e7acf",
"gbrain_preserve_fact_withdrawal()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=9beb118551a08451a228146373f50f2aa2ce0cfe89937e937d361b33224aa0aa",
"gbrain_queue_page_projection()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=6c544b9c129b6a17dcabeb5ee8d44a2b0e0af9d02ca3fe47c7d7f22ec313042c",
- "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=f23ed35b3590e5290a8045c1867957a1227d8fbccf6a6ada70e506098c234fc2",
- "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=1ba3002d6485edf4f92ea4d380299b2f0872f49ad827e7e76381f9a75efaa404",
++ "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=9dc91548479da39c77e3015481b89901ef13fb02ce496597606fbac592c05201",
"gbrain_require_persistence_protocol(required integer)": "RETURNS void kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=af07b7fac60dec0a4fe568217931ac449d32f73b3a53a047b3b02a5f59cb5058",
"gbrain_stamp_revision_attribution()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=d446ed1145d8bb9c93cb0ca4aa076a5dc7a5fe07b3e79518adaf1b17b0a51216",
"gbrain_stamp_version_attribution()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=1b28a0e5769198d86490dc20b2aee80b7e6595670428a63ac9c6825cd2a35b10",
diff --cc test/fixtures/goldens/catalog/postgres-engine-init-fts-portuguese.json
index 15f08dcda1,bcdf3cadc6..28990d8a20
--- a/test/fixtures/goldens/catalog/postgres-engine-init-fts-portuguese.json
+++ b/test/fixtures/goldens/catalog/postgres-engine-init-fts-portuguese.json
@@@ -314,7 -314,7 +314,7 @@@
"gbrain_lease_shared_skill_delivery()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=5e493c1ac8dce8cb025a736629e563437c4b214744137c302c532c20bf7e7acf",
"gbrain_preserve_fact_withdrawal()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=9beb118551a08451a228146373f50f2aa2ce0cfe89937e937d361b33224aa0aa",
"gbrain_queue_page_projection()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=6c544b9c129b6a17dcabeb5ee8d44a2b0e0af9d02ca3fe47c7d7f22ec313042c",
- "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=f23ed35b3590e5290a8045c1867957a1227d8fbccf6a6ada70e506098c234fc2",
- "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=1ba3002d6485edf4f92ea4d380299b2f0872f49ad827e7e76381f9a75efaa404",
++ "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=9dc91548479da39c77e3015481b89901ef13fb02ce496597606fbac592c05201",
"gbrain_require_persistence_protocol(required integer)": "RETURNS void kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=af07b7fac60dec0a4fe568217931ac449d32f73b3a53a047b3b02a5f59cb5058",
"gbrain_stamp_revision_attribution()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=d446ed1145d8bb9c93cb0ca4aa076a5dc7a5fe07b3e79518adaf1b17b0a51216",
"gbrain_stamp_version_attribution()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=1b28a0e5769198d86490dc20b2aee80b7e6595670428a63ac9c6825cd2a35b10",
diff --cc test/fixtures/goldens/catalog/postgres-engine-init-high-dims.json
index e047cbde65,e8393fc246..1b721c4e0e
--- a/test/fixtures/goldens/catalog/postgres-engine-init-high-dims.json
+++ b/test/fixtures/goldens/catalog/postgres-engine-init-high-dims.json
@@@ -314,7 -314,7 +314,7 @@@
"gbrain_lease_shared_skill_delivery()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=5e493c1ac8dce8cb025a736629e563437c4b214744137c302c532c20bf7e7acf",
"gbrain_preserve_fact_withdrawal()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=9beb118551a08451a228146373f50f2aa2ce0cfe89937e937d361b33224aa0aa",
"gbrain_queue_page_projection()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=6c544b9c129b6a17dcabeb5ee8d44a2b0e0af9d02ca3fe47c7d7f22ec313042c",
- "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=f23ed35b3590e5290a8045c1867957a1227d8fbccf6a6ada70e506098c234fc2",
- "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=1ba3002d6485edf4f92ea4d380299b2f0872f49ad827e7e76381f9a75efaa404",
++ "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=9dc91548479da39c77e3015481b89901ef13fb02ce496597606fbac592c05201",
"gbrain_require_persistence_protocol(required integer)": "RETURNS void kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=af07b7fac60dec0a4fe568217931ac449d32f73b3a53a047b3b02a5f59cb5058",
"gbrain_stamp_revision_attribution()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=d446ed1145d8bb9c93cb0ca4aa076a5dc7a5fe07b3e79518adaf1b17b0a51216",
"gbrain_stamp_version_attribution()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=1b28a0e5769198d86490dc20b2aee80b7e6595670428a63ac9c6825cd2a35b10",
diff --cc test/fixtures/goldens/doctor/json-pglite-degraded.json
index ca5b4c45df,450fd2f82d..c233e0acdc
--- a/test/fixtures/goldens/doctor/json-pglite-degraded.json
+++ b/test/fixtures/goldens/doctor/json-pglite-degraded.json
@@@ -416,7 -392,7 +416,7 @@@
},
{
"category": "meta",
-- "message": "Version 197 (latest: 197)",
++ "message": "Version 198 (latest: 198)",
"name": "schema_version",
"status": "ok"
},
diff --cc test/fixtures/goldens/doctor/json-pglite-fresh.json
index 451b6f502d,fce5a69488..8a43f71e09
--- a/test/fixtures/goldens/doctor/json-pglite-fresh.json
+++ b/test/fixtures/goldens/doctor/json-pglite-fresh.json
@@@ -416,7 -392,7 +416,7 @@@
},
{
"category": "meta",
-- "message": "Version 197 (latest: 197)",
++ "message": "Version 198 (latest: 198)",
"name": "schema_version",
"status": "ok"
},
diff --cc test/fixtures/goldens/doctor/json-postgres-fresh.json
index 50cd6a0625,286d7522f2..dce38ab1c6
--- a/test/fixtures/goldens/doctor/json-postgres-fresh.json
+++ b/test/fixtures/goldens/doctor/json-postgres-fresh.json
@@@ -422,7 -398,7 +422,7 @@@
},
{
"category": "meta",
-- "message": "Version 197 (latest: 197)",
++ "message": "Version 198 (latest: 198)",
"name": "schema_version",
"status": "ok"
},
diff --cc test/fixtures/goldens/migrations/records.json
index f80055caee,29faf71e5a..609b8742b2
--- a/test/fixtures/goldens/migrations/records.json
+++ b/test/fixtures/goldens/migrations/records.json
@@@ -1,6 -1,6 +1,6 @@@
{
"golden": {
-- "count": 192,
++ "count": 193,
"gaps": [
17,
18,
@@@ -28,7 -28,7 +28,7 @@@
"slugifyPath": "401dbca23580865d8b168dd8d84db4a6c708c6610d7cb61abafc7d0ee9809063",
"verifyProjectionStatistics": "59d9ccfea1c53384d8607874a51209a9c2dfd51b2b85a2cb6269fa4120faf1f3"
},
-- "latest": 197,
++ "latest": 198,
"records": [
{
"handler": {
@@@ -2222,8 -2222,8 +2222,8 @@@
"idempotent": true,
"name": "durable_concurrent_persistence",
"sql": {
- "length": 10099,
- "sha256": "0efb22aee75bab0a8bd8c67e9e7b73370a5729b270c7a7d815b2cbc43483fcb3"
- "length": 9235,
- "sha256": "ea16d9ba06b20c1651e1ed1afb6429c66271e926f2f92965da3fbe97ba643238"
++ "length": 10148,
++ "sha256": "ef80a3b5175372ceeceedaa599641e6313bb8998e28719372f9a1cb11e548abc"
},
"sqlFor": "absent",
"transaction": "absent",
@@@ -2287,8 -2287,8 +2287,8 @@@
"idempotent": true,
"name": "managed_alias_and_source_checkpoint_guards",
"sql": {
- "length": 5250,
- "sha256": "17fd401c0b6172a7c7cd3533e65db534f25d718b4bda4f3b08d85191244486e3"
- "length": 4386,
- "sha256": "9d283e56dae87829d0e524f8b2677e1c970c78eb13eefbece81642905a93cdc1"
++ "length": 5299,
++ "sha256": "dc17c52129cc4504c716a29e84ccb0dbbaaf973b2359e522b226a69e7e872baf"
},
"sqlFor": "absent",
"transaction": "absent",
@@@ -2446,8 -2446,8 +2446,8 @@@
"idempotent": true,
"name": "fact_embedding_identity",
"sql": {
- "length": 5395,
- "sha256": "739cd1a06f34d163fce0baf2e51923fdc590bc05ad1f5448cc50408dc3bf491c"
- "length": 4531,
- "sha256": "2af5c7c84952f4fd836302ec2328adc07afeaa3cb11d95e609e478f026953641"
++ "length": 5444,
++ "sha256": "afc6dc24ee5a44d7bc4629b9b02b7eb0193265c2d03456dce0590d28b9481ea3"
},
"sqlFor": "absent",
"transaction": "absent",
@@@ -2845,8 -2845,8 +2845,8 @@@
"idempotent": true,
"name": "take_embedding_identity",
"sql": {
- "length": 5395,
- "sha256": "8000426f0aba734fe12c6cda1a9f7419a95eee444b25efab7396c7eabdf2aa5d"
- "length": 4531,
- "sha256": "b0b66298c9c33314cc08f532de9a8a18af1e96a91dc4dcbe243d525399e9f90c"
++ "length": 5444,
++ "sha256": "ece0222a3769627f4da004eaea23104a715e1d19a702412d9c6fa2fb747656a5"
},
"sqlFor": "absent",
"transaction": "absent",
@@@ -2858,8 -2858,8 +2858,8 @@@
"idempotent": true,
"name": "f1_write_attribution",
"sql": {
- "length": 14092,
- "sha256": "7668900f69f4873d6312626da009416076284f840ca18d1018d736b974a20faf"
- "length": 13228,
- "sha256": "897907a8669f828ba0e8302c7d2198bf5fa2d70a0e10dbbf9e6a2a4b85c68a64"
++ "length": 14141,
++ "sha256": "84a871cf72f406995b8596058c0943fa261db4532c0a0bc0cb10b443ce224bb9"
},
"sqlFor": "absent",
"transaction": "absent",
@@@ -2914,15 -2914,15 +2914,28 @@@
{
"handler": "absent",
"idempotent": true,
- "name": "publication_failure_detail",
+ "name": "managed_guard_null_source_fallback",
"sql": {
- "length": 5341,
- "sha256": "ceb9f3bbeb67523178d1c130a5657122941cf06620f17f4bed964c8af394bd04"
- "length": 3888,
- "sha256": "2484a363d88e487d1c8972f22aef4a604134f240e9d56f81f3df0276ccbe6c26"
++ "length": 4801,
++ "sha256": "37663cf40c990e0d7c8f0b4a88f561b12b376df6c49a9dc073ef3f555fe459e8"
},
"sqlFor": "absent",
"transaction": "absent",
"verify": "absent",
"version": 197
++ },
++ {
++ "handler": "absent",
++ "idempotent": true,
++ "name": "publication_failure_detail",
++ "sql": {
++ "length": 4892,
++ "sha256": "12aed519e77f91a5e04a0bbc00d425773178a5c1b84d46dca37509ee3adf26eb"
++ },
++ "sqlFor": "absent",
++ "transaction": "absent",
++ "verify": "absent",
++ "version": 198
}
],
"versions": [
@@@ -3117,7 -3117,7 +3130,8 @@@
194,
195,
196,
-- 197
++ 197,
++ 198
]
},
"normalizer": "migrations-record-v1"
diff --cc test/fixtures/goldens/pglite-upgrade-replay/catalog-after-boot.json
index 57110027fa,54d1aba780..79f326f61e
--- a/test/fixtures/goldens/pglite-upgrade-replay/catalog-after-boot.json
+++ b/test/fixtures/goldens/pglite-upgrade-replay/catalog-after-boot.json
@@@ -311,7 -311,7 +311,7 @@@
"gbrain_lease_shared_skill_delivery()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=5e493c1ac8dce8cb025a736629e563437c4b214744137c302c532c20bf7e7acf",
"gbrain_preserve_fact_withdrawal()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=9beb118551a08451a228146373f50f2aa2ce0cfe89937e937d361b33224aa0aa",
"gbrain_queue_page_projection()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=6c544b9c129b6a17dcabeb5ee8d44a2b0e0af9d02ca3fe47c7d7f22ec313042c",
- "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=f23ed35b3590e5290a8045c1867957a1227d8fbccf6a6ada70e506098c234fc2",
- "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=1ba3002d6485edf4f92ea4d380299b2f0872f49ad827e7e76381f9a75efaa404",
++ "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=9dc91548479da39c77e3015481b89901ef13fb02ce496597606fbac592c05201",
"gbrain_require_persistence_protocol(required integer)": "RETURNS void kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=af07b7fac60dec0a4fe568217931ac449d32f73b3a53a047b3b02a5f59cb5058",
"gbrain_stamp_revision_attribution()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=d446ed1145d8bb9c93cb0ca4aa076a5dc7a5fe07b3e79518adaf1b17b0a51216",
"gbrain_stamp_version_attribution()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=1b28a0e5769198d86490dc20b2aee80b7e6595670428a63ac9c6825cd2a35b10",
diff --cc test/schema-bootstrap-coverage.test.ts
index 7629c49042,15ac790955..f3824b72a4
--- a/test/schema-bootstrap-coverage.test.ts
+++ b/test/schema-bootstrap-coverage.test.ts
@@@ -1022,10 -1022,6 +1022,10 @@@ const COLUMN_EXEMPTIONS = new Set<strin
'persistence_requests.consumer_host_id',
'persistence_requests.published_at',
'persistence_brain.writer_version_cutoff',
- // #5974 (migration v197) — structured publication failure detail. Same
++ // #5974 (migration v198) — structured publication failure detail. Same
+ // posture as v178: persistence_requests is migration-created on PGLite, no
+ // index references the column, and every reader treats NULL as no detail.
+ 'persistence_requests.error_detail',
// #5455 (migration v183) — managed mode epoch. persistence_brain is
// migration-created on PGLite; no index in either blob references it, and
// pre-migration readers go through to_jsonb(persistence_brain)->'mode_epoch'.