Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
feat(doctor): worktree_refresh_stuck check; regenerate catalog, doctor and migration goldens
garrytane0e5da3ed183
diff --git a/src/commands/doctor/checks/schema-health.ts b/src/commands/doctor/checks/schema-health.tsindex 557496caad..43bc80c700 100644--- a/src/commands/doctor/checks/schema-health.ts+++ b/src/commands/doctor/checks/schema-health.ts@@ -13,6 +13,7 @@ import { schemaVersionHealth } from '../../../core/schema-version-health.ts';import { pgvectorCheck, pagesUpsertArbiterCheck, linkSourceCheckConstraintCheck } from './core-health.ts';import { pgliteScaleCheck } from './engine-fit.ts';import { checkParkedEffects } from './parked-effects.ts';+import { checkWorktreeRefreshStuck } from './worktree-refresh.ts';import { checkPersistenceCapacity } from './persistence-capacity.ts';import { checkPostgresCancellationDriver } from './postgres-cancellation.ts';import { checkProjectionReadiness } from './projection-readiness.ts';@@ -38,7 +39,7 @@ async function runPgvector(ctx: DoctorContext): Promise<Check[]> {// 4a-bis. Managed write capacity (#5470) and parked postcommit effects (#5612).progress.heartbeat('persistence_capacity');- checks.push(await checkPersistenceCapacity(engine), await checkParkedEffects(engine));+ checks.push(await checkPersistenceCapacity(engine), await checkParkedEffects(engine), await checkWorktreeRefreshStuck(engine));// 4a-ter. #4613: links_link_source_check shape — a ledger-current brain// whose CHECK reverted to the pre-v114 allowlist rejects every kebab@@ -65,6 +66,7 @@ export const pgvectorEntry: DoctorEntry = {'text_projection_readiness','persistence_capacity','parked_effects',+ 'worktree_refresh_stuck','links_link_source_check','pglite_scale',],diff --git a/src/commands/doctor/checks/worktree-refresh.ts b/src/commands/doctor/checks/worktree-refresh.tsnew file mode 100644index 0000000000..cc8d2a83d4--- /dev/null+++ b/src/commands/doctor/checks/worktree-refresh.ts@@ -0,0 +1,27 @@+import type { BrainEngine } from '../../../core/engine.ts';+import type { Check } from '../../doctor.ts';+import { stuckWorktreeRefreshes } from '../../../core/persistence/worktree-refresh.ts';++const STUCK_MINUTES = 15;++/**+ * F0: a `gbrain sources refresh` whose row stayed active (draining, fenced,+ * merged, syncing or recovery_required) for over 15 minutes keeps its+ * worktree's writes refused. Each row names the resume command.+ */+export async function checkWorktreeRefreshStuck(engine: BrainEngine): Promise<Check> {+ try {+ const rows = await stuckWorktreeRefreshes(engine, STUCK_MINUTES);+ const refreshes = rows.map(row => ({ id: row.id, state: row.state, source_ids: row.source_ids,+ command: `gbrain sources refresh ${row.source_ids[0]} --resume` }));+ if (!refreshes.length) return { name: 'worktree_refresh_stuck', status: 'ok', message: 'No worktree refresh is stuck.', details: { refreshes } };+ return { name: 'worktree_refresh_stuck', status: 'warn', details: { refreshes },+ message: `${refreshes.length} worktree refresh(es) have been active for over ${STUCK_MINUTES} minutes; writes to their worktrees are refused until they finish. `+ + `Run on the owner host: ${refreshes.map(r => `${r.command} (${r.state}, sources ${r.source_ids.join(',')})`).join(' | ')}. `+ + 'A recovery_required refresh needs the user to decide how to reset the checkout; the resume command prints both options.' };+ } catch (error) {+ return { name: 'worktree_refresh_stuck', status: 'warn',+ message: `Worktree refreshes could not be read: ${error instanceof Error ? error.message : String(error)}. Health is unknown; run gbrain apply-migrations --yes if the table is missing.`,+ details: { health: 'unknown' } };+ }+}diff --git a/src/core/doctor-categories.ts b/src/core/doctor-categories.tsindex 42abaa19e4..ec95793c73 100644--- a/src/core/doctor-categories.ts+++ b/src/core/doctor-categories.ts@@ -215,6 +215,7 @@ export const OPS_CHECK_NAMES: ReadonlySet<string> = new Set(['oauth_confidential_client_health','orphan_clones','persistence_capacity',+ 'worktree_refresh_stuck','persistence_request_growth','persistence_request_indexes','stale_embedding_effects',diff --git a/test/fixtures/goldens/catalog/pglite-engine-init-default.json b/test/fixtures/goldens/catalog/pglite-engine-init-default.jsonindex 7bb9733603..f64583f07b 100644--- a/test/fixtures/goldens/catalog/pglite-engine-init-default.json+++ b/test/fixtures/goldens/catalog/pglite-engine-init-default.json@@ -190,6 +190,9 @@"persistence_topology_changes.persistence_topology_changes_recovery_bytes_check": "c CHECK ((recovery_bytes >= 0))","persistence_topology_changes.persistence_topology_changes_state_check": "c CHECK ((state = ANY (ARRAY['recovering'::text, 'committed'::text, 'failed'::text])))","persistence_topology_changes.persistence_topology_changes_terminal_bytes_check": "c CHECK ((terminal_bytes >= 0))",+ "persistence_worktree_refreshes.persistence_worktree_refreshes_pkey": "p PRIMARY KEY (id)",+ "persistence_worktree_refreshes.persistence_worktree_refreshes_state_check": "c CHECK ((state = ANY (ARRAY['draining'::text, 'fenced'::text, 'merged'::text, 'syncing'::text, 'completed'::text, 'aborted'::text, 'recovery_required'::text])))",+ "persistence_worktree_refreshes.persistence_worktree_refreshes_worktree_id_fkey": "f FOREIGN KEY (worktree_id) REFERENCES persistence_worktrees(id)","persistence_worktrees.persistence_worktrees_pkey": "p PRIMARY KEY (id)","persistence_worktrees.persistence_worktrees_state_check": "c CHECK ((state = ANY (ARRAY['active'::text, 'draining'::text, 'recovering'::text, 'retired'::text])))","persistence_writer_protocols.persistence_writer_protocols_pkey": "p PRIMARY KEY (worktree_id, host_id)",@@ -520,6 +523,9 @@"persistence_topology_changes": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],+ "persistence_worktree_refreshes": [+ "<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"+ ],"persistence_worktrees": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],@@ -869,6 +875,8 @@"persistence_topology_changes_pkey": "CREATE UNIQUE INDEX persistence_topology_changes_pkey ON public.persistence_topology_changes USING btree (id)","persistence_topology_changes_principal_id_request_id_key": "CREATE UNIQUE INDEX persistence_topology_changes_principal_id_request_id_key ON public.persistence_topology_changes USING btree (principal_id, request_id)","persistence_topology_recovering": "CREATE INDEX persistence_topology_recovering ON public.persistence_topology_changes USING btree (created_at) WHERE (state = 'recovering'::text)",+ "persistence_worktree_refreshes_active": "CREATE UNIQUE INDEX persistence_worktree_refreshes_active ON public.persistence_worktree_refreshes USING btree (worktree_id) WHERE (state = ANY (ARRAY['draining'::text, 'fenced'::text, 'merged'::text, 'syncing'::text, 'recovery_required'::text]))",+ "persistence_worktree_refreshes_pkey": "CREATE UNIQUE INDEX persistence_worktree_refreshes_pkey ON public.persistence_worktree_refreshes USING btree (id)","persistence_worktrees_pkey": "CREATE UNIQUE INDEX persistence_worktrees_pkey ON public.persistence_worktrees USING btree (id)","persistence_writer_protocols_pkey": "CREATE UNIQUE INDEX persistence_writer_protocols_pkey ON public.persistence_writer_protocols USING btree (worktree_id, host_id)","query_cache_pkey": "CREATE UNIQUE INDEX query_cache_pkey ON public.query_cache USING btree (id)",@@ -2134,6 +2142,26 @@],"flags": "relkind=r rls=false force_rls=false"},+ "persistence_worktree_refreshes": {+ "columns": [+ "1 id uuid/uuid NOT NULL DEFAULT gen_random_uuid()",+ "2 worktree_id uuid/uuid NOT NULL",+ "3 source_ids ARRAY/_text NOT NULL",+ "4 principal_id uuid/uuid NOT NULL",+ "5 owner_epoch bigint/int8 NOT NULL",+ "6 topology_generation bigint/int8 NOT NULL",+ "7 state text/text NOT NULL",+ "8 old_head text/text NOT NULL",+ "9 target_head text/text NOT NULL",+ "10 upstream_ref text/text NOT NULL",+ "11 preserved_uncommitted ARRAY/_text NOT NULL DEFAULT '{}'::text[]",+ "12 outcome jsonb/jsonb NOT NULL DEFAULT '{}'::jsonb",+ "13 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",+ "14 updated_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",+ "15 completed_at timestamp with time zone/timestamptz NULL"+ ],+ "flags": "relkind=r rls=false force_rls=false"+ },"persistence_worktrees": {"columns": ["1 id uuid/uuid NOT NULL DEFAULT gen_random_uuid()",diff --git a/test/fixtures/goldens/catalog/pglite-engine-init-fts-portuguese.json b/test/fixtures/goldens/catalog/pglite-engine-init-fts-portuguese.jsonindex 7447ae5006..5711bbc42b 100644--- a/test/fixtures/goldens/catalog/pglite-engine-init-fts-portuguese.json+++ b/test/fixtures/goldens/catalog/pglite-engine-init-fts-portuguese.json@@ -190,6 +190,9 @@"persistence_topology_changes.persistence_topology_changes_recovery_bytes_check": "c CHECK ((recovery_bytes >= 0))","persistence_topology_changes.persistence_topology_changes_state_check": "c CHECK ((state = ANY (ARRAY['recovering'::text, 'committed'::text, 'failed'::text])))","persistence_topology_changes.persistence_topology_changes_terminal_bytes_check": "c CHECK ((terminal_bytes >= 0))",+ "persistence_worktree_refreshes.persistence_worktree_refreshes_pkey": "p PRIMARY KEY (id)",+ "persistence_worktree_refreshes.persistence_worktree_refreshes_state_check": "c CHECK ((state = ANY (ARRAY['draining'::text, 'fenced'::text, 'merged'::text, 'syncing'::text, 'completed'::text, 'aborted'::text, 'recovery_required'::text])))",+ "persistence_worktree_refreshes.persistence_worktree_refreshes_worktree_id_fkey": "f FOREIGN KEY (worktree_id) REFERENCES persistence_worktrees(id)","persistence_worktrees.persistence_worktrees_pkey": "p PRIMARY KEY (id)","persistence_worktrees.persistence_worktrees_state_check": "c CHECK ((state = ANY (ARRAY['active'::text, 'draining'::text, 'recovering'::text, 'retired'::text])))","persistence_writer_protocols.persistence_writer_protocols_pkey": "p PRIMARY KEY (worktree_id, host_id)",@@ -520,6 +523,9 @@"persistence_topology_changes": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],+ "persistence_worktree_refreshes": [+ "<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"+ ],"persistence_worktrees": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],@@ -869,6 +875,8 @@"persistence_topology_changes_pkey": "CREATE UNIQUE INDEX persistence_topology_changes_pkey ON public.persistence_topology_changes USING btree (id)","persistence_topology_changes_principal_id_request_id_key": "CREATE UNIQUE INDEX persistence_topology_changes_principal_id_request_id_key ON public.persistence_topology_changes USING btree (principal_id, request_id)","persistence_topology_recovering": "CREATE INDEX persistence_topology_recovering ON public.persistence_topology_changes USING btree (created_at) WHERE (state = 'recovering'::text)",+ "persistence_worktree_refreshes_active": "CREATE UNIQUE INDEX persistence_worktree_refreshes_active ON public.persistence_worktree_refreshes USING btree (worktree_id) WHERE (state = ANY (ARRAY['draining'::text, 'fenced'::text, 'merged'::text, 'syncing'::text, 'recovery_required'::text]))",+ "persistence_worktree_refreshes_pkey": "CREATE UNIQUE INDEX persistence_worktree_refreshes_pkey ON public.persistence_worktree_refreshes USING btree (id)","persistence_worktrees_pkey": "CREATE UNIQUE INDEX persistence_worktrees_pkey ON public.persistence_worktrees USING btree (id)","persistence_writer_protocols_pkey": "CREATE UNIQUE INDEX persistence_writer_protocols_pkey ON public.persistence_writer_protocols USING btree (worktree_id, host_id)","query_cache_pkey": "CREATE UNIQUE INDEX query_cache_pkey ON public.query_cache USING btree (id)",@@ -2134,6 +2142,26 @@],"flags": "relkind=r rls=false force_rls=false"},+ "persistence_worktree_refreshes": {+ "columns": [+ "1 id uuid/uuid NOT NULL DEFAULT gen_random_uuid()",+ "2 worktree_id uuid/uuid NOT NULL",+ "3 source_ids ARRAY/_text NOT NULL",+ "4 principal_id uuid/uuid NOT NULL",+ "5 owner_epoch bigint/int8 NOT NULL",+ "6 topology_generation bigint/int8 NOT NULL",+ "7 state text/text NOT NULL",+ "8 old_head text/text NOT NULL",+ "9 target_head text/text NOT NULL",+ "10 upstream_ref text/text NOT NULL",+ "11 preserved_uncommitted ARRAY/_text NOT NULL DEFAULT '{}'::text[]",+ "12 outcome jsonb/jsonb NOT NULL DEFAULT '{}'::jsonb",+ "13 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",+ "14 updated_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",+ "15 completed_at timestamp with time zone/timestamptz NULL"+ ],+ "flags": "relkind=r rls=false force_rls=false"+ },"persistence_worktrees": {"columns": ["1 id uuid/uuid NOT NULL DEFAULT gen_random_uuid()",diff --git a/test/fixtures/goldens/catalog/pglite-engine-init-high-dims.json b/test/fixtures/goldens/catalog/pglite-engine-init-high-dims.jsonindex c228f4da8d..5ed84f3b5e 100644--- a/test/fixtures/goldens/catalog/pglite-engine-init-high-dims.json+++ b/test/fixtures/goldens/catalog/pglite-engine-init-high-dims.json@@ -190,6 +190,9 @@"persistence_topology_changes.persistence_topology_changes_recovery_bytes_check": "c CHECK ((recovery_bytes >= 0))","persistence_topology_changes.persistence_topology_changes_state_check": "c CHECK ((state = ANY (ARRAY['recovering'::text, 'committed'::text, 'failed'::text])))","persistence_topology_changes.persistence_topology_changes_terminal_bytes_check": "c CHECK ((terminal_bytes >= 0))",+ "persistence_worktree_refreshes.persistence_worktree_refreshes_pkey": "p PRIMARY KEY (id)",+ "persistence_worktree_refreshes.persistence_worktree_refreshes_state_check": "c CHECK ((state = ANY (ARRAY['draining'::text, 'fenced'::text, 'merged'::text, 'syncing'::text, 'completed'::text, 'aborted'::text, 'recovery_required'::text])))",+ "persistence_worktree_refreshes.persistence_worktree_refreshes_worktree_id_fkey": "f FOREIGN KEY (worktree_id) REFERENCES persistence_worktrees(id)","persistence_worktrees.persistence_worktrees_pkey": "p PRIMARY KEY (id)","persistence_worktrees.persistence_worktrees_state_check": "c CHECK ((state = ANY (ARRAY['active'::text, 'draining'::text, 'recovering'::text, 'retired'::text])))","persistence_writer_protocols.persistence_writer_protocols_pkey": "p PRIMARY KEY (worktree_id, host_id)",@@ -520,6 +523,9 @@"persistence_topology_changes": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],+ "persistence_worktree_refreshes": [+ "<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"+ ],"persistence_worktrees": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],@@ -865,6 +871,8 @@"persistence_topology_changes_pkey": "CREATE UNIQUE INDEX persistence_topology_changes_pkey ON public.persistence_topology_changes USING btree (id)","persistence_topology_changes_principal_id_request_id_key": "CREATE UNIQUE INDEX persistence_topology_changes_principal_id_request_id_key ON public.persistence_topology_changes USING btree (principal_id, request_id)","persistence_topology_recovering": "CREATE INDEX persistence_topology_recovering ON public.persistence_topology_changes USING btree (created_at) WHERE (state = 'recovering'::text)",+ "persistence_worktree_refreshes_active": "CREATE UNIQUE INDEX persistence_worktree_refreshes_active ON public.persistence_worktree_refreshes USING btree (worktree_id) WHERE (state = ANY (ARRAY['draining'::text, 'fenced'::text, 'merged'::text, 'syncing'::text, 'recovery_required'::text]))",+ "persistence_worktree_refreshes_pkey": "CREATE UNIQUE INDEX persistence_worktree_refreshes_pkey ON public.persistence_worktree_refreshes USING btree (id)","persistence_worktrees_pkey": "CREATE UNIQUE INDEX persistence_worktrees_pkey ON public.persistence_worktrees USING btree (id)","persistence_writer_protocols_pkey": "CREATE UNIQUE INDEX persistence_writer_protocols_pkey ON public.persistence_writer_protocols USING btree (worktree_id, host_id)","query_cache_pkey": "CREATE UNIQUE INDEX query_cache_pkey ON public.query_cache USING btree (id)",@@ -2130,6 +2138,26 @@],"flags": "relkind=r rls=false force_rls=false"},+ "persistence_worktree_refreshes": {+ "columns": [+ "1 id uuid/uuid NOT NULL DEFAULT gen_random_uuid()",+ "2 worktree_id uuid/uuid NOT NULL",+ "3 source_ids ARRAY/_text NOT NULL",+ "4 principal_id uuid/uuid NOT NULL",+ "5 owner_epoch bigint/int8 NOT NULL",+ "6 topology_generation bigint/int8 NOT NULL",+ "7 state text/text NOT NULL",+ "8 old_head text/text NOT NULL",+ "9 target_head text/text NOT NULL",+ "10 upstream_ref text/text NOT NULL",+ "11 preserved_uncommitted ARRAY/_text NOT NULL DEFAULT '{}'::text[]",+ "12 outcome jsonb/jsonb NOT NULL DEFAULT '{}'::jsonb",+ "13 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",+ "14 updated_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",+ "15 completed_at timestamp with time zone/timestamptz NULL"+ ],+ "flags": "relkind=r rls=false force_rls=false"+ },"persistence_worktrees": {"columns": ["1 id uuid/uuid NOT NULL DEFAULT gen_random_uuid()",diff --git a/test/fixtures/goldens/catalog/pglite-schema-blob-default.json b/test/fixtures/goldens/catalog/pglite-schema-blob-default.jsonindex 5713375a5c..249700dff1 100644--- a/test/fixtures/goldens/catalog/pglite-schema-blob-default.json+++ b/test/fixtures/goldens/catalog/pglite-schema-blob-default.json@@ -145,6 +145,9 @@"persistence_topology_changes.persistence_topology_changes_recovery_bytes_check": "c CHECK ((recovery_bytes >= 0))","persistence_topology_changes.persistence_topology_changes_state_check": "c CHECK ((state = ANY (ARRAY['recovering'::text, 'committed'::text, 'failed'::text])))","persistence_topology_changes.persistence_topology_changes_terminal_bytes_check": "c CHECK ((terminal_bytes >= 0))",+ "persistence_worktree_refreshes.persistence_worktree_refreshes_pkey": "p PRIMARY KEY (id)",+ "persistence_worktree_refreshes.persistence_worktree_refreshes_state_check": "c CHECK ((state = ANY (ARRAY['draining'::text, 'fenced'::text, 'merged'::text, 'syncing'::text, 'completed'::text, 'aborted'::text, 'recovery_required'::text])))",+ "persistence_worktree_refreshes.persistence_worktree_refreshes_worktree_id_fkey": "f FOREIGN KEY (worktree_id) REFERENCES persistence_worktrees(id)","persistence_worktrees.persistence_worktrees_pkey": "p PRIMARY KEY (id)","persistence_worktrees.persistence_worktrees_state_check": "c CHECK ((state = ANY (ARRAY['active'::text, 'draining'::text, 'recovering'::text])))","persistence_writer_protocols.persistence_writer_protocols_pkey": "p PRIMARY KEY (worktree_id, host_id)",@@ -406,6 +409,9 @@"persistence_topology_changes": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],+ "persistence_worktree_refreshes": [+ "<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"+ ],"persistence_worktrees": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],@@ -647,6 +653,8 @@"persistence_topology_changes_pkey": "CREATE UNIQUE INDEX persistence_topology_changes_pkey ON public.persistence_topology_changes USING btree (id)","persistence_topology_changes_principal_id_request_id_key": "CREATE UNIQUE INDEX persistence_topology_changes_principal_id_request_id_key ON public.persistence_topology_changes USING btree (principal_id, request_id)","persistence_topology_recovering": "CREATE INDEX persistence_topology_recovering ON public.persistence_topology_changes USING btree (created_at) WHERE (state = 'recovering'::text)",+ "persistence_worktree_refreshes_active": "CREATE UNIQUE INDEX persistence_worktree_refreshes_active ON public.persistence_worktree_refreshes USING btree (worktree_id) WHERE (state = ANY (ARRAY['draining'::text, 'fenced'::text, 'merged'::text, 'syncing'::text, 'recovery_required'::text]))",+ "persistence_worktree_refreshes_pkey": "CREATE UNIQUE INDEX persistence_worktree_refreshes_pkey ON public.persistence_worktree_refreshes USING btree (id)","persistence_worktrees_pkey": "CREATE UNIQUE INDEX persistence_worktrees_pkey ON public.persistence_worktrees USING btree (id)","persistence_writer_protocols_pkey": "CREATE UNIQUE INDEX persistence_writer_protocols_pkey ON public.persistence_writer_protocols USING btree (worktree_id, host_id)","raw_data_page_id_source_key": "CREATE UNIQUE INDEX raw_data_page_id_source_key ON public.raw_data USING btree (page_id, source)",@@ -1607,6 +1615,26 @@],"flags": "relkind=r rls=false force_rls=false"},+ "persistence_worktree_refreshes": {+ "columns": [+ "1 id uuid/uuid NOT NULL DEFAULT gen_random_uuid()",+ "2 worktree_id uuid/uuid NOT NULL",+ "3 source_ids ARRAY/_text NOT NULL",+ "4 principal_id uuid/uuid NOT NULL",+ "5 owner_epoch bigint/int8 NOT NULL",+ "6 topology_generation bigint/int8 NOT NULL",+ "7 state text/text NOT NULL",+ "8 old_head text/text NOT NULL",+ "9 target_head text/text NOT NULL",+ "10 upstream_ref text/text NOT NULL",+ "11 preserved_uncommitted ARRAY/_text NOT NULL DEFAULT '{}'::text[]",+ "12 outcome jsonb/jsonb NOT NULL DEFAULT '{}'::jsonb",+ "13 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",+ "14 updated_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",+ "15 completed_at timestamp with time zone/timestamptz NULL"+ ],+ "flags": "relkind=r rls=false force_rls=false"+ },"persistence_worktrees": {"columns": ["1 id uuid/uuid NOT NULL DEFAULT gen_random_uuid()",diff --git a/test/fixtures/goldens/catalog/pglite-schema-blob-fts-portuguese.json b/test/fixtures/goldens/catalog/pglite-schema-blob-fts-portuguese.jsonindex df29c05ed7..d119c8beb6 100644--- a/test/fixtures/goldens/catalog/pglite-schema-blob-fts-portuguese.json+++ b/test/fixtures/goldens/catalog/pglite-schema-blob-fts-portuguese.json@@ -145,6 +145,9 @@"persistence_topology_changes.persistence_topology_changes_recovery_bytes_check": "c CHECK ((recovery_bytes >= 0))","persistence_topology_changes.persistence_topology_changes_state_check": "c CHECK ((state = ANY (ARRAY['recovering'::text, 'committed'::text, 'failed'::text])))","persistence_topology_changes.persistence_topology_changes_terminal_bytes_check": "c CHECK ((terminal_bytes >= 0))",+ "persistence_worktree_refreshes.persistence_worktree_refreshes_pkey": "p PRIMARY KEY (id)",+ "persistence_worktree_refreshes.persistence_worktree_refreshes_state_check": "c CHECK ((state = ANY (ARRAY['draining'::text, 'fenced'::text, 'merged'::text, 'syncing'::text, 'completed'::text, 'aborted'::text, 'recovery_required'::text])))",+ "persistence_worktree_refreshes.persistence_worktree_refreshes_worktree_id_fkey": "f FOREIGN KEY (worktree_id) REFERENCES persistence_worktrees(id)","persistence_worktrees.persistence_worktrees_pkey": "p PRIMARY KEY (id)","persistence_worktrees.persistence_worktrees_state_check": "c CHECK ((state = ANY (ARRAY['active'::text, 'draining'::text, 'recovering'::text])))","persistence_writer_protocols.persistence_writer_protocols_pkey": "p PRIMARY KEY (worktree_id, host_id)",@@ -406,6 +409,9 @@"persistence_topology_changes": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],+ "persistence_worktree_refreshes": [+ "<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"+ ],"persistence_worktrees": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],@@ -647,6 +653,8 @@"persistence_topology_changes_pkey": "CREATE UNIQUE INDEX persistence_topology_changes_pkey ON public.persistence_topology_changes USING btree (id)","persistence_topology_changes_principal_id_request_id_key": "CREATE UNIQUE INDEX persistence_topology_changes_principal_id_request_id_key ON public.persistence_topology_changes USING btree (principal_id, request_id)","persistence_topology_recovering": "CREATE INDEX persistence_topology_recovering ON public.persistence_topology_changes USING btree (created_at) WHERE (state = 'recovering'::text)",+ "persistence_worktree_refreshes_active": "CREATE UNIQUE INDEX persistence_worktree_refreshes_active ON public.persistence_worktree_refreshes USING btree (worktree_id) WHERE (state = ANY (ARRAY['draining'::text, 'fenced'::text, 'merged'::text, 'syncing'::text, 'recovery_required'::text]))",+ "persistence_worktree_refreshes_pkey": "CREATE UNIQUE INDEX persistence_worktree_refreshes_pkey ON public.persistence_worktree_refreshes USING btree (id)","persistence_worktrees_pkey": "CREATE UNIQUE INDEX persistence_worktrees_pkey ON public.persistence_worktrees USING btree (id)","persistence_writer_protocols_pkey": "CREATE UNIQUE INDEX persistence_writer_protocols_pkey ON public.persistence_writer_protocols USING btree (worktree_id, host_id)","raw_data_page_id_source_key": "CREATE UNIQUE INDEX raw_data_page_id_source_key ON public.raw_data USING btree (page_id, source)",@@ -1607,6 +1615,26 @@],"flags": "relkind=r rls=false force_rls=false"},+ "persistence_worktree_refreshes": {+ "columns": [+ "1 id uuid/uuid NOT NULL DEFAULT gen_random_uuid()",+ "2 worktree_id uuid/uuid NOT NULL",+ "3 source_ids ARRAY/_text NOT NULL",+ "4 principal_id uuid/uuid NOT NULL",+ "5 owner_epoch bigint/int8 NOT NULL",+ "6 topology_generation bigint/int8 NOT NULL",+ "7 state text/text NOT NULL",+ "8 old_head text/text NOT NULL",+ "9 target_head text/text NOT NULL",+ "10 upstream_ref text/text NOT NULL",+ "11 preserved_uncommitted ARRAY/_text NOT NULL DEFAULT '{}'::text[]",+ "12 outcome jsonb/jsonb NOT NULL DEFAULT '{}'::jsonb",+ "13 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",+ "14 updated_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",+ "15 completed_at timestamp with time zone/timestamptz NULL"+ ],+ "flags": "relkind=r rls=false force_rls=false"+ },"persistence_worktrees": {"columns": ["1 id uuid/uuid NOT NULL DEFAULT gen_random_uuid()",diff --git a/test/fixtures/goldens/catalog/pglite-schema-blob-high-dims.json b/test/fixtures/goldens/catalog/pglite-schema-blob-high-dims.jsonindex 3a97f0e912..a488ec2435 100644--- a/test/fixtures/goldens/catalog/pglite-schema-blob-high-dims.json+++ b/test/fixtures/goldens/catalog/pglite-schema-blob-high-dims.json@@ -145,6 +145,9 @@"persistence_topology_changes.persistence_topology_changes_recovery_bytes_check": "c CHECK ((recovery_bytes >= 0))","persistence_topology_changes.persistence_topology_changes_state_check": "c CHECK ((state = ANY (ARRAY['recovering'::text, 'committed'::text, 'failed'::text])))","persistence_topology_changes.persistence_topology_changes_terminal_bytes_check": "c CHECK ((terminal_bytes >= 0))",+ "persistence_worktree_refreshes.persistence_worktree_refreshes_pkey": "p PRIMARY KEY (id)",+ "persistence_worktree_refreshes.persistence_worktree_refreshes_state_check": "c CHECK ((state = ANY (ARRAY['draining'::text, 'fenced'::text, 'merged'::text, 'syncing'::text, 'completed'::text, 'aborted'::text, 'recovery_required'::text])))",+ "persistence_worktree_refreshes.persistence_worktree_refreshes_worktree_id_fkey": "f FOREIGN KEY (worktree_id) REFERENCES persistence_worktrees(id)","persistence_worktrees.persistence_worktrees_pkey": "p PRIMARY KEY (id)","persistence_worktrees.persistence_worktrees_state_check": "c CHECK ((state = ANY (ARRAY['active'::text, 'draining'::text, 'recovering'::text])))","persistence_writer_protocols.persistence_writer_protocols_pkey": "p PRIMARY KEY (worktree_id, host_id)",@@ -406,6 +409,9 @@"persistence_topology_changes": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],+ "persistence_worktree_refreshes": [+ "<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"+ ],"persistence_worktrees": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],@@ -646,6 +652,8 @@"persistence_topology_changes_pkey": "CREATE UNIQUE INDEX persistence_topology_changes_pkey ON public.persistence_topology_changes USING btree (id)","persistence_topology_changes_principal_id_request_id_key": "CREATE UNIQUE INDEX persistence_topology_changes_principal_id_request_id_key ON public.persistence_topology_changes USING btree (principal_id, request_id)","persistence_topology_recovering": "CREATE INDEX persistence_topology_recovering ON public.persistence_topology_changes USING btree (created_at) WHERE (state = 'recovering'::text)",+ "persistence_worktree_refreshes_active": "CREATE UNIQUE INDEX persistence_worktree_refreshes_active ON public.persistence_worktree_refreshes USING btree (worktree_id) WHERE (state = ANY (ARRAY['draining'::text, 'fenced'::text, 'merged'::text, 'syncing'::text, 'recovery_required'::text]))",+ "persistence_worktree_refreshes_pkey": "CREATE UNIQUE INDEX persistence_worktree_refreshes_pkey ON public.persistence_worktree_refreshes USING btree (id)","persistence_worktrees_pkey": "CREATE UNIQUE INDEX persistence_worktrees_pkey ON public.persistence_worktrees USING btree (id)","persistence_writer_protocols_pkey": "CREATE UNIQUE INDEX persistence_writer_protocols_pkey ON public.persistence_writer_protocols USING btree (worktree_id, host_id)","raw_data_page_id_source_key": "CREATE UNIQUE INDEX raw_data_page_id_source_key ON public.raw_data USING btree (page_id, source)",@@ -1606,6 +1614,26 @@],"flags": "relkind=r rls=false force_rls=false"},+ "persistence_worktree_refreshes": {+ "columns": [+ "1 id uuid/uuid NOT NULL DEFAULT gen_random_uuid()",+ "2 worktree_id uuid/uuid NOT NULL",+ "3 source_ids ARRAY/_text NOT NULL",+ "4 principal_id uuid/uuid NOT NULL",+ "5 owner_epoch bigint/int8 NOT NULL",+ "6 topology_generation bigint/int8 NOT NULL",+ "7 state text/text NOT NULL",+ "8 old_head text/text NOT NULL",+ "9 target_head text/text NOT NULL",+ "10 upstream_ref text/text NOT NULL",+ "11 preserved_uncommitted ARRAY/_text NOT NULL DEFAULT '{}'::text[]",+ "12 outcome jsonb/jsonb NOT NULL DEFAULT '{}'::jsonb",+ "13 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",+ "14 updated_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",+ "15 completed_at timestamp with time zone/timestamptz NULL"+ ],+ "flags": "relkind=r rls=false force_rls=false"+ },"persistence_worktrees": {"columns": ["1 id uuid/uuid NOT NULL DEFAULT gen_random_uuid()",diff --git a/test/fixtures/goldens/doctor/json-pglite-degraded.json b/test/fixtures/goldens/doctor/json-pglite-degraded.jsonindex 1e43169ad1..df7df2ecc2 100644--- a/test/fixtures/goldens/doctor/json-pglite-degraded.json+++ b/test/fixtures/goldens/doctor/json-pglite-degraded.json@@ -363,6 +363,15 @@"name": "parked_effects","status": "ok"},+ {+ "category": "ops",+ "details": {+ "refreshes": []+ },+ "message": "No worktree refresh is stuck.",+ "name": "worktree_refresh_stuck",+ "status": "ok"+ },{"category": "meta","message": "links_link_source_check has the v114 kebab-case gate",@@ -383,13 +392,13 @@},{"category": "meta",- "message": "Version 192 (latest: 192)",+ "message": "Version 193 (latest: 193)","name": "schema_version","status": "ok"},{"category": "meta",- "message": "813 column(s) verified against live schema",+ "message": "828 column(s) verified against live schema","name": "schema_columns","status": "ok"},diff --git a/test/fixtures/goldens/doctor/json-pglite-fresh.json b/test/fixtures/goldens/doctor/json-pglite-fresh.jsonindex 34d18106b9..f81cd56991 100644--- a/test/fixtures/goldens/doctor/json-pglite-fresh.json+++ b/test/fixtures/goldens/doctor/json-pglite-fresh.json@@ -363,6 +363,15 @@"name": "parked_effects","status": "ok"},+ {+ "category": "ops",+ "details": {+ "refreshes": []+ },+ "message": "No worktree refresh is stuck.",+ "name": "worktree_refresh_stuck",+ "status": "ok"+ },{"category": "meta","message": "links_link_source_check has the v114 kebab-case gate",@@ -383,13 +392,13 @@},{"category": "meta",- "message": "Version 192 (latest: 192)",+ "message": "Version 193 (latest: 193)","name": "schema_version","status": "ok"},{"category": "meta",- "message": "813 column(s) verified against live schema",+ "message": "828 column(s) verified against live schema","name": "schema_columns","status": "ok"},diff --git a/test/fixtures/goldens/doctor/registry-build-checks.json b/test/fixtures/goldens/doctor/registry-build-checks.jsonindex c759f9f9e5..c24d4007be 100644--- a/test/fixtures/goldens/doctor/registry-build-checks.json+++ b/test/fixtures/goldens/doctor/registry-build-checks.json@@ -249,6 +249,10 @@"category": "brain","name": "parked_effects"},+ {+ "category": "ops",+ "name": "worktree_refresh_stuck"+ },{"category": "meta","name": "links_link_source_check"diff --git a/test/fixtures/goldens/migrations/records.json b/test/fixtures/goldens/migrations/records.jsonindex 62e8b3e37c..65579705ec 100644--- a/test/fixtures/goldens/migrations/records.json+++ b/test/fixtures/goldens/migrations/records.json@@ -1,6 +1,6 @@{"golden": {- "count": 187,+ "count": 188,"gaps": [17,18,@@ -28,7 +28,7 @@"slugifyPath": "401dbca23580865d8b168dd8d84db4a6c708c6610d7cb61abafc7d0ee9809063","verifyProjectionStatistics": "59d9ccfea1c53384d8607874a51209a9c2dfd51b2b85a2cb6269fa4120faf1f3"},- "latest": 192,+ "latest": 193,"records": [{"handler": {@@ -2852,6 +2852,19 @@"transaction": "absent","verify": "absent","version": 192+ },+ {+ "handler": "absent",+ "idempotent": true,+ "name": "f0_worktree_refreshes",+ "sql": {+ "length": 935,+ "sha256": "77ca451abde39586cefffb674e0ac0c36e371165a2d63e9c8b022557e48172ed"+ },+ "sqlFor": "absent",+ "transaction": "absent",+ "verify": "absent",+ "version": 193}],"versions": [@@ -3041,7 +3054,8 @@189,190,191,- 192+ 192,+ 193]},"normalizer": "migrations-record-v1"