Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

integrate(#6317): fence_integrity stays beside search_mode in the doctor registry; goldens (doctor, pool gauge) regenerated; tests follow the merged stamp (last_sql), blockers SQL and claim.next wording

garrytan6387c7e56343
diff --git a/src/commands/doctor/registry.ts b/src/commands/doctor/registry.ts
index 1165cba5d7..2f8dc179d7 100644
--- a/src/commands/doctor/registry.ts
+++ b/src/commands/doctor/registry.ts
@@ -179,9 +179,9 @@ export const DOCTOR_CHECK_REGISTRY: readonly DoctorEntry[] = [
transcriptSecretExposureEntry,
revisionBackfillEntry,
coreMemoryEntry,
- fenceIntegrityEntry,
managedSyncMovementEntry,
persistenceConsumersEntry,
+ fenceIntegrityEntry,
searchModeEntry,
];
diff --git a/test/error-registry-6317-contract.test.ts b/test/error-registry-6317-contract.test.ts
index 312ff4142f..5886a2f6e7 100644
--- a/test/error-registry-6317-contract.test.ts
+++ b/test/error-registry-6317-contract.test.ts
@@ -151,7 +151,7 @@ describe('the doctor codes each have a troubleshooting symptom row that names wh
for (const step of ['gbrain sources status default --json', 'gbrain doctor --only managed_sync_not_moving --json', 'gbrain sources writer status --source default --json', 'gbrain sources retry-held default', 'gbrain sources writer movement default']) {
expect(doc, `transcript lacks ${step}`).toContain(step);
}
- expect(doc).toContain('"next_action"');
+ expect(doc).toContain('"next": { "code": "claim_overdue"');
expect(doc).toContain('cause=owner_wedged_here');
expect(doc).not.toContain('budget times its attempts');
});
diff --git a/test/fixtures/goldens/doctor/json-pglite-degraded.json b/test/fixtures/goldens/doctor/json-pglite-degraded.json
index 0639a1c203..8dcd5f3cac 100644
--- a/test/fixtures/goldens/doctor/json-pglite-degraded.json
+++ b/test/fixtures/goldens/doctor/json-pglite-degraded.json
@@ -1733,6 +1733,53 @@
"name": "core_memory",
"status": "ok"
},
+ {
+ "category": "ops",
+ "details": {
+ "count": 0,
+ "docs": "docs/guides/troubleshooting.md#managed-sync-not-moving",
+ "parked": 0,
+ "sources": []
+ },
+ "message": "No managed sync is pending.",
+ "name": "managed_sync_not_moving",
+ "status": "ok"
+ },
+ {
+ "category": "ops",
+ "details": {
+ "consumers": [],
+ "count": 0,
+ "docs": "docs/guides/troubleshooting.md#two-consumers-on-host"
+ },
+ "message": "PGLite admits one process; no consumer heartbeat rows are kept.",
+ "name": "two_consumers_on_host",
+ "status": "ok"
+ },
+ {
+ "category": "ops",
+ "details": {
+ "count": 0,
+ "docs": "docs/guides/troubleshooting.md#two-consumers-on-host",
+ "owners": []
+ },
+ "message": "PGLite admits one process; no consumer heartbeat rows are kept.",
+ "name": "consumers_without_heartbeat",
+ "status": "ok"
+ },
+ {
+ "category": "ops",
+ "details": {
+ "count": 0,
+ "docs": "docs/guides/troubleshooting.md#host-identity-mismatch",
+ "host_id": "<uuid>",
+ "host_json_path": "<home>/.gbrain/persistence/host.json",
+ "mismatches": []
+ },
+ "message": "This process's host identity (<home>/.gbrain/persistence/host.json) owns every binding this filesystem holds.",
+ "name": "host_identity_mismatch",
+ "status": "ok"
+ },
{
"category": "brain",
"details": {
@@ -1810,53 +1857,6 @@
"name": "fence_integrity",
"status": "ok"
},
- {
- "category": "ops",
- "details": {
- "count": 0,
- "docs": "docs/guides/troubleshooting.md#managed-sync-not-moving",
- "parked": 0,
- "sources": []
- },
- "message": "No managed sync is pending.",
- "name": "managed_sync_not_moving",
- "status": "ok"
- },
- {
- "category": "ops",
- "details": {
- "consumers": [],
- "count": 0,
- "docs": "docs/guides/troubleshooting.md#two-consumers-on-host"
- },
- "message": "PGLite admits one process; no consumer heartbeat rows are kept.",
- "name": "two_consumers_on_host",
- "status": "ok"
- },
- {
- "category": "ops",
- "details": {
- "count": 0,
- "docs": "docs/guides/troubleshooting.md#two-consumers-on-host",
- "owners": []
- },
- "message": "PGLite admits one process; no consumer heartbeat rows are kept.",
- "name": "consumers_without_heartbeat",
- "status": "ok"
- },
- {
- "category": "ops",
- "details": {
- "count": 0,
- "docs": "docs/guides/troubleshooting.md#host-identity-mismatch",
- "host_id": "<uuid>",
- "host_json_path": "<home>/.gbrain/persistence/host.json",
- "mismatches": []
- },
- "message": "This process's host identity (<home>/.gbrain/persistence/host.json) owns every binding this filesystem holds.",
- "name": "host_identity_mismatch",
- "status": "ok"
- },
{
"category": "ops",
"message": "Mode: conservative (no per-key overrides — mode bundle is canonical).",
diff --git a/test/fixtures/goldens/doctor/json-pglite-fresh.json b/test/fixtures/goldens/doctor/json-pglite-fresh.json
index 82e3e76027..f1a2fb9f38 100644
--- a/test/fixtures/goldens/doctor/json-pglite-fresh.json
+++ b/test/fixtures/goldens/doctor/json-pglite-fresh.json
@@ -1805,6 +1805,53 @@
"name": "core_memory",
"status": "ok"
},
+ {
+ "category": "ops",
+ "details": {
+ "count": 0,
+ "docs": "docs/guides/troubleshooting.md#managed-sync-not-moving",
+ "parked": 0,
+ "sources": []
+ },
+ "message": "No managed sync is pending.",
+ "name": "managed_sync_not_moving",
+ "status": "ok"
+ },
+ {
+ "category": "ops",
+ "details": {
+ "consumers": [],
+ "count": 0,
+ "docs": "docs/guides/troubleshooting.md#two-consumers-on-host"
+ },
+ "message": "PGLite admits one process; no consumer heartbeat rows are kept.",
+ "name": "two_consumers_on_host",
+ "status": "ok"
+ },
+ {
+ "category": "ops",
+ "details": {
+ "count": 0,
+ "docs": "docs/guides/troubleshooting.md#two-consumers-on-host",
+ "owners": []
+ },
+ "message": "PGLite admits one process; no consumer heartbeat rows are kept.",
+ "name": "consumers_without_heartbeat",
+ "status": "ok"
+ },
+ {
+ "category": "ops",
+ "details": {
+ "count": 0,
+ "docs": "docs/guides/troubleshooting.md#host-identity-mismatch",
+ "host_id": "<uuid>",
+ "host_json_path": "<home>/.gbrain/persistence/host.json",
+ "mismatches": []
+ },
+ "message": "This process's host identity (<home>/.gbrain/persistence/host.json) owns every binding this filesystem holds.",
+ "name": "host_identity_mismatch",
+ "status": "ok"
+ },
{
"category": "brain",
"details": {
@@ -1882,53 +1929,6 @@
"name": "fence_integrity",
"status": "ok"
},
- {
- "category": "ops",
- "details": {
- "count": 0,
- "docs": "docs/guides/troubleshooting.md#managed-sync-not-moving",
- "parked": 0,
- "sources": []
- },
- "message": "No managed sync is pending.",
- "name": "managed_sync_not_moving",
- "status": "ok"
- },
- {
- "category": "ops",
- "details": {
- "consumers": [],
- "count": 0,
- "docs": "docs/guides/troubleshooting.md#two-consumers-on-host"
- },
- "message": "PGLite admits one process; no consumer heartbeat rows are kept.",
- "name": "two_consumers_on_host",
- "status": "ok"
- },
- {
- "category": "ops",
- "details": {
- "count": 0,
- "docs": "docs/guides/troubleshooting.md#two-consumers-on-host",
- "owners": []
- },
- "message": "PGLite admits one process; no consumer heartbeat rows are kept.",
- "name": "consumers_without_heartbeat",
- "status": "ok"
- },
- {
- "category": "ops",
- "details": {
- "count": 0,
- "docs": "docs/guides/troubleshooting.md#host-identity-mismatch",
- "host_id": "<uuid>",
- "host_json_path": "<home>/.gbrain/persistence/host.json",
- "mismatches": []
- },
- "message": "This process's host identity (<home>/.gbrain/persistence/host.json) owns every binding this filesystem holds.",
- "name": "host_identity_mismatch",
- "status": "ok"
- },
{
"category": "ops",
"message": "Mode: conservative (no per-key overrides — mode bundle is canonical).",
diff --git a/test/fixtures/goldens/doctor/json-postgres-fresh.json b/test/fixtures/goldens/doctor/json-postgres-fresh.json
index c3a35d1a27..d9b3102844 100644
--- a/test/fixtures/goldens/doctor/json-postgres-fresh.json
+++ b/test/fixtures/goldens/doctor/json-postgres-fresh.json
@@ -1795,6 +1795,54 @@
"name": "core_memory",
"status": "ok"
},
+ {
+ "category": "ops",
+ "details": {
+ "count": 0,
+ "docs": "docs/guides/troubleshooting.md#managed-sync-not-moving",
+ "parked": 0,
+ "sources": []
+ },
+ "message": "No managed sync is pending.",
+ "name": "managed_sync_not_moving",
+ "status": "ok"
+ },
+ {
+ "category": "ops",
+ "details": {
+ "consumers": [],
+ "count": 0,
+ "docs": "docs/guides/troubleshooting.md#two-consumers-on-host",
+ "min_age_ms": "<volatile>"
+ },
+ "message": "No persistence consumer is running on this host.",
+ "name": "two_consumers_on_host",
+ "status": "ok"
+ },
+ {
+ "category": "ops",
+ "details": {
+ "count": 0,
+ "docs": "docs/guides/troubleshooting.md#two-consumers-on-host",
+ "owners": []
+ },
+ "message": "Every owner of a live running claim on this host has a consumer heartbeat row.",
+ "name": "consumers_without_heartbeat",
+ "status": "ok"
+ },
+ {
+ "category": "ops",
+ "details": {
+ "count": 0,
+ "docs": "docs/guides/troubleshooting.md#host-identity-mismatch",
+ "host_id": "<uuid>",
+ "host_json_path": "<home>/.gbrain/persistence/host.json",
+ "mismatches": []
+ },
+ "message": "This process's host identity (<home>/.gbrain/persistence/host.json) owns every binding this filesystem holds.",
+ "name": "host_identity_mismatch",
+ "status": "ok"
+ },
{
"category": "brain",
"details": {
@@ -1872,54 +1920,6 @@
"name": "fence_integrity",
"status": "ok"
},
- {
- "category": "ops",
- "details": {
- "count": 0,
- "docs": "docs/guides/troubleshooting.md#managed-sync-not-moving",
- "parked": 0,
- "sources": []
- },
- "message": "No managed sync is pending.",
- "name": "managed_sync_not_moving",
- "status": "ok"
- },
- {
- "category": "ops",
- "details": {
- "consumers": [],
- "count": 0,
- "docs": "docs/guides/troubleshooting.md#two-consumers-on-host",
- "min_age_ms": "<volatile>"
- },
- "message": "No persistence consumer is running on this host.",
- "name": "two_consumers_on_host",
- "status": "ok"
- },
- {
- "category": "ops",
- "details": {
- "count": 0,
- "docs": "docs/guides/troubleshooting.md#two-consumers-on-host",
- "owners": []
- },
- "message": "Every owner of a live running claim on this host has a consumer heartbeat row.",
- "name": "consumers_without_heartbeat",
- "status": "ok"
- },
- {
- "category": "ops",
- "details": {
- "count": 0,
- "docs": "docs/guides/troubleshooting.md#host-identity-mismatch",
- "host_id": "<uuid>",
- "host_json_path": "<home>/.gbrain/persistence/host.json",
- "mismatches": []
- },
- "message": "This process's host identity (<home>/.gbrain/persistence/host.json) owns every binding this filesystem holds.",
- "name": "host_identity_mismatch",
- "status": "ok"
- },
{
"category": "ops",
"message": "Mode: conservative (no per-key overrides — mode bundle is canonical).",
diff --git a/test/fixtures/goldens/doctor/registry-build-checks.json b/test/fixtures/goldens/doctor/registry-build-checks.json
index d3d1a89198..eeefd5635f 100644
--- a/test/fixtures/goldens/doctor/registry-build-checks.json
+++ b/test/fixtures/goldens/doctor/registry-build-checks.json
@@ -705,10 +705,6 @@
"category": "brain",
"name": "core_memory"
},
- {
- "category": "brain",
- "name": "fence_integrity"
- },
{
"category": "ops",
"name": "managed_sync_not_moving"
@@ -725,6 +721,10 @@
"category": "ops",
"name": "host_identity_mismatch"
},
+ {
+ "category": "brain",
+ "name": "fence_integrity"
+ },
{
"category": "ops",
"name": "search_mode"
diff --git a/test/fixtures/goldens/postgres-engine-gauge/sequence.json b/test/fixtures/goldens/postgres-engine-gauge/sequence.json
index d13ea9a8d2..e686a69e03 100644
--- a/test/fixtures/goldens/postgres-engine-gauge/sequence.json
+++ b/test/fixtures/goldens/postgres-engine-gauge/sequence.json
@@ -3,7 +3,9 @@
{
"diagnostics": {
"poisonedDiscards": 0,
+ "pool": null,
"poolMax": 10,
+ "prepare": null,
"tracked": {
"direct": 0,
"raw": 0,
@@ -16,7 +18,9 @@
{
"diagnostics": {
"poisonedDiscards": 0,
+ "pool": null,
"poolMax": 10,
+ "prepare": null,
"tracked": {
"direct": 0,
"raw": 1,
@@ -29,7 +33,9 @@
{
"diagnostics": {
"poisonedDiscards": 0,
+ "pool": null,
"poolMax": 10,
+ "prepare": null,
"tracked": {
"direct": 1,
"raw": 1,
@@ -42,7 +48,9 @@
{
"diagnostics": {
"poisonedDiscards": 0,
+ "pool": null,
"poolMax": 10,
+ "prepare": null,
"tracked": {
"direct": 1,
"raw": 2,
@@ -55,7 +63,9 @@
{
"diagnostics": {
"poisonedDiscards": 0,
+ "pool": null,
"poolMax": 10,
+ "prepare": null,
"tracked": {
"direct": 1,
"raw": 2,
@@ -68,7 +78,9 @@
{
"diagnostics": {
"poisonedDiscards": 0,
+ "pool": null,
"poolMax": 10,
+ "prepare": null,
"tracked": {
"direct": 1,
"raw": 2,
@@ -81,7 +93,9 @@
{
"diagnostics": {
"poisonedDiscards": 0,
+ "pool": null,
"poolMax": 10,
+ "prepare": null,
"tracked": {
"direct": 1,
"raw": 2,
@@ -94,7 +108,9 @@
{
"diagnostics": {
"poisonedDiscards": 0,
+ "pool": null,
"poolMax": 10,
+ "prepare": null,
"tracked": {
"direct": 1,
"raw": 2,
@@ -107,7 +123,9 @@
{
"diagnostics": {
"poisonedDiscards": 0,
+ "pool": null,
"poolMax": 10,
+ "prepare": null,
"tracked": {
"direct": 1,
"raw": 3,
@@ -120,7 +138,9 @@
{
"diagnostics": {
"poisonedDiscards": 0,
+ "pool": null,
"poolMax": 10,
+ "prepare": null,
"tracked": {
"direct": 1,
"raw": 2,
@@ -133,7 +153,9 @@
{
"diagnostics": {
"poisonedDiscards": 0,
+ "pool": null,
"poolMax": 10,
+ "prepare": null,
"tracked": {
"direct": 1,
"raw": 2,
@@ -146,7 +168,9 @@
{
"diagnostics": {
"poisonedDiscards": 0,
+ "pool": null,
"poolMax": 10,
+ "prepare": null,
"tracked": {
"direct": 1,
"raw": 1,
@@ -159,7 +183,9 @@
{
"diagnostics": {
"poisonedDiscards": 0,
+ "pool": null,
"poolMax": 10,
+ "prepare": null,
"tracked": {
"direct": 0,
"raw": 1,
@@ -172,7 +198,9 @@
{
"diagnostics": {
"poisonedDiscards": 0,
+ "pool": null,
"poolMax": 10,
+ "prepare": null,
"tracked": {
"direct": 0,
"raw": 0,
@@ -185,7 +213,9 @@
{
"diagnostics": {
"poisonedDiscards": 0,
+ "pool": null,
"poolMax": 10,
+ "prepare": null,
"tracked": {
"direct": 0,
"raw": 0,
@@ -198,7 +228,9 @@
{
"diagnostics": {
"poisonedDiscards": 0,
+ "pool": null,
"poolMax": 10,
+ "prepare": null,
"tracked": {
"direct": 0,
"raw": 0,
@@ -211,7 +243,9 @@
{
"diagnostics": {
"poisonedDiscards": 0,
+ "pool": null,
"poolMax": 10,
+ "prepare": null,
"tracked": {
"direct": 0,
"raw": 1,
@@ -224,7 +258,9 @@
{
"diagnostics": {
"poisonedDiscards": 0,
+ "pool": null,
"poolMax": 10,
+ "prepare": null,
"tracked": {
"direct": 0,
"raw": 0,
diff --git a/test/persistence-claim-step.test.ts b/test/persistence-claim-step.test.ts
index 4a5ddf5a9b..112b958c5a 100644
--- a/test/persistence-claim-step.test.ts
+++ b/test/persistence-claim-step.test.ts
@@ -48,7 +48,7 @@ describe('claimPhaseStamp and claimStateOf', () => {
const clock = startClaimPhase(Date.parse('2026-10-08T03:00:00Z'));
enterClaimStep(clock, 'origin_check', undefined, 'db', Date.parse('2026-10-08T03:01:00Z'));
expect(JSON.parse(claimPhaseStamp(clock, 'tok-1'))).toEqual({ phase: 'preparing', claimed_at: '2026-10-08T03:00:00.000Z', since: '2026-10-08T03:00:00.000Z', token: 'tok-1',
- step: 'origin_check', step_since: '2026-10-08T03:01:00.000Z', waiting_on: 'db', owner: { kind: 'sync', pid: 4242, version: '0.60.200.0' } });
+ step: 'origin_check', step_since: '2026-10-08T03:01:00.000Z', waiting_on: 'db', last_sql: null, owner: { kind: 'sync', pid: 4242, version: '0.60.200.0' } });
});
test('the default owner is this process: the gbrain command (cli when none), pid, build and (#6317) its nonce and pid namespace', () => {
const owner = claimOwner();
diff --git a/test/persistence-diagnostics.test.ts b/test/persistence-diagnostics.test.ts
index e716d10f4c..ba9a32f2fd 100644
--- a/test/persistence-diagnostics.test.ts
+++ b/test/persistence-diagnostics.test.ts
@@ -63,7 +63,7 @@ for (const reason of ['writer_busy', 'database_contention']) test.each([0, 18000
const row = { request_id: randomUUID(), state: 'queued', blocked_reason: reason, error_code: null,
worktree_id: null, created_at: new Date(Date.now() - age) };
const engine = { kind: 'pglite', executeRaw: async (sql: string) =>
- sql.startsWith('SELECT request_id,worktree_id,state,blocked_reason') ? [row] : [] } as unknown as BrainEngine;
+ sql.startsWith('SELECT request_id,worktree_id,source_id,state,blocked_reason') ? [row] : [] } as unknown as BrainEngine;
const [blocker] = (await readWriterDiagnostics(engine)).blockers;
expect(blocker.diagnostic?.next_action).toBe(age >= 120000 ? 'inspect_owner' : 'poll');
expect(blocker.next_action).toContain(WRITER_NEXT_ACTIONS[reason]);