You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
v0.31.4.1 still fails to upgrade legacy schema-v10 origin Postgres brains. The forward-reference bootstrap fixes from #776 (lane 1: #740/#741 covering v39–v41) and the mcp_request_log.agent_name work referenced when closing #695/#657 do not cover the v0.13.0 failure point. Migration v0.13.0 ("Frontmatter becomes a graph") trips on column "page_id" does not exist on the files table before the column has been added.
This appears to be the same class as #366 (v0.13.x → v0.18.1, closed as duplicate of #695) and #451 (pre-v17 bootstrap, also closed via #695), but neither was actually patched for the entry point at v0.12 → v0.13.
Brain content: ~12,200 pages, ~30,000 chunks, 100% embed coverage. Brain is fully queryable on the v0.12.2 CLI; queries continue to work on 0.31.4.1 as long as migrations don't run.
macOS 14, Node.js via Bun
Repro
cd~/gbrain
git pull # master at 943e7b9
bun install
# the postinstall (`gbrain apply-migrations --yes --non-interactive`) fires automatically and fails as below
gbrain apply-migrations --yes --non-interactive
Trace (relevant excerpt)
⚠️ Schema version 10 is behind latest 49.
Schema migrations run automatically on next connectEngine() / initSchema().
To run them now: gbrain init --migrate-only
Migration v0.12.0 is WEDGED (3+ consecutive partials with no completion).
Check ~/.gbrain/upgrade-errors.jsonl for the last failure reasons, fix the underlying
issue, then run:
gbrain apply-migrations --force-retry 0.12.0
Then re-run `gbrain apply-migrations --yes`.
=== Applying migration v0.13.0: Frontmatter becomes a graph — company, investors,
attendees now create typed edges automatically ===
=== v0.13.0 — Frontmatter relationship indexing ===
NOTICE: extension "vector" already exists, skipping
NOTICE: extension "pg_trgm" already exists, skipping
NOTICE: extension "pgcrypto" already exists, skipping
NOTICE: relation "sources" already exists, skipping
NOTICE: relation "pages" already exists, skipping
NOTICE: relation "idx_pages_type" already exists, skipping
NOTICE: relation "idx_pages_frontmatter" already exists, skipping
NOTICE: relation "files" already exists, skipping
NOTICE: column "storage_url" of relation "files" does not exist, skipping
NOTICE: relation "idx_files_page" already exists, skipping
column "page_id" does not exist
Migration v0.13.0 reported status=failed.
The idx_files_page "already exists" notice is the smoking gun: the schema replay creates an index on files(page_id) before migration v0.13.0 has added the page_id column. Same class of forward-reference bootstrap bug as #366 / #695, just at a much earlier table/column pair.
The hinted ~/.gbrain/upgrade-errors.jsonl does not exist on this install — that file is never written. (Minor side bug: the wedge-recovery hint should either point to a path that exists or stop suggesting it.)
None of these touch the v0.13.0 → files.page_id path. The same chicken-and-egg pattern lives much earlier in the migration chain than the fixes have reached.
Side bug: postinstall auto-attempts migration
The npm/bun postinstall script runs gbrain apply-migrations --yes --non-interactive automatically. On a wedged brain this means every bun install attempts the migration, fails, and bumps the wedge counter — without the operator opting in. Suggest either gating this behind a GBRAIN_AUTO_MIGRATE=1 env var or running gbrain doctor first and skipping if a migration is already wedged.
Is there a recommended manual ALTER TABLE files ADD COLUMN page_id … shape that would let the v0.13.0 migration proceed on Postgres engines, or is the cleaner path to extend applyForwardReferenceBootstrap() to cover this column too?
Confirm whether the wipe-and-reimport escape hatch is still the recommended fallback for brains this old.
Summary
v0.31.4.1still fails to upgrade legacy schema-v10 origin Postgres brains. The forward-reference bootstrap fixes from #776 (lane 1: #740/#741 covering v39–v41) and themcp_request_log.agent_namework referenced when closing #695/#657 do not cover the v0.13.0 failure point. Migration v0.13.0 ("Frontmatter becomes a graph") trips oncolumn "page_id" does not existon thefilestable before the column has been added.This appears to be the same class as #366 (v0.13.x → v0.18.1, closed as duplicate of #695) and #451 (pre-v17 bootstrap, also closed via #695), but neither was actually patched for the entry point at v0.12 → v0.13.
Environment
gbrain --version→0.31.4.1(master at943e7b9, post v0.31.4.1 chore: align VERSION + package.json with #795 + mandate 4-segment versions #815)0.31.4.1as long as migrations don't run.Repro
Trace (relevant excerpt)
The
idx_files_page"already exists" notice is the smoking gun: the schema replay creates an index onfiles(page_id)before migration v0.13.0 has added thepage_idcolumn. Same class of forward-reference bootstrap bug as #366 / #695, just at a much earlier table/column pair.The hinted
~/.gbrain/upgrade-errors.jsonldoes not exist on this install — that file is never written. (Minor side bug: the wedge-recovery hint should either point to a path that exists or stop suggesting it.)Why the v0.31.4.1 fix wave didn't help here
PR #776's upgrade-path lane covered:
connect()in v0.29.1 Phase B+C)mcp_request_log.agent_name— pre-v0.26.3 PGLite brains wedge on upgrade #695)None of these touch the v0.13.0 → files.page_id path. The same chicken-and-egg pattern lives much earlier in the migration chain than the fixes have reached.
Side bug: postinstall auto-attempts migration
The npm/bun
postinstallscript runsgbrain apply-migrations --yes --non-interactiveautomatically. On a wedged brain this means everybun installattempts the migration, fails, and bumps the wedge counter — without the operator opting in. Suggest either gating this behind aGBRAIN_AUTO_MIGRATE=1env var or runninggbrain doctorfirst and skipping if a migration is already wedged.Asks
ALTER TABLE files ADD COLUMN page_id …shape that would let the v0.13.0 migration proceed on Postgres engines, or is the cleaner path to extendapplyForwardReferenceBootstrap()to cover this column too?Happy to test patches against this exact brain.