Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

wip(#6712 PR 4a): convergence check sits before fence_integrity; mode matrix expects the standard tier (deep entries skip)

garrytand016a44400a2
diff --git a/src/commands/doctor/registry.ts b/src/commands/doctor/registry.ts
index a32c407c4e..87f1ee3bd5 100644
--- a/src/commands/doctor/registry.ts
+++ b/src/commands/doctor/registry.ts
@@ -239,9 +239,9 @@ export const DOCTOR_CHECK_REGISTRY: readonly DoctorEntry[] = [
ghostPagesEntry,
missingRecordedFilesEntry,
syncConfigKeysEntry,
- fenceIntegrityEntry,
// #6712 PR 4a: the read-only convergence shadow (deep tier: a full level read per source).
managedSyncConvergenceEntry,
+ fenceIntegrityEntry,
searchModeEntry,
];
diff --git a/test/doctor-mode-matrix.serial.test.ts b/test/doctor-mode-matrix.serial.test.ts
index 0b128ba8c8..7654e3eaa7 100644
--- a/test/doctor-mode-matrix.serial.test.ts
+++ b/test/doctor-mode-matrix.serial.test.ts
@@ -32,6 +32,7 @@ import { LATEST_VERSION } from '../src/core/migrate.ts';
import { PGLiteEngine } from '../src/core/pglite-engine.ts';
import type { BrainEngine } from '../src/core/engine.ts';
import { resetPgliteState } from './helpers/reset-pglite.ts';
+import { entryRunsAt } from '../src/commands/doctor/budget.ts';
const ENV_KEYS = ['PATH', 'GBRAIN_HOME', 'HOME', 'GBRAIN_AUDIT_DIR', 'GBRAIN_SYNC_FAILURES_DIR', 'DATABASE_URL', 'GBRAIN_DATABASE_URL', 'GBRAIN_SKILLS_DIR', 'OPENCLAW_WORKSPACE'] as const;
const SKILL_BODY = '## Iron Law: Back-Linking (MANDATORY)\n\nbody paragraph.\n';
@@ -174,6 +175,8 @@ const byName = (name: string, e: DoctorEntry[] = [...DOCTOR_CHECK_REGISTRY]) =>
const [OFFLINE, DB_GATE, LIVE, CONN_GATE] = byName('connection');
const RESOLVER = byName('resolver_health')[0];
const SEARCH_MODE = DOCTOR_CHECK_REGISTRY.at(-1)!;
+/** Every entry the default (`standard`) tier runs; `deep` entries run only under `--tier deep`. */
+const STANDARD = DOCTOR_CHECK_REGISTRY.flatMap((e, i) => entryRunsAt(e.tier, 'standard') ? [i] : []);
const upTo = (entry: DoctorEntry) => DOCTOR_CHECK_REGISTRY.slice(0, indexOf(entry) + 1).map((_, i) => i);
const dryViolations = (checks: Check[]) =>
(checks.find((c) => c.name === 'resolver_health')?.issues ?? []).filter((i) => i.type === 'dry_violation' && i.skill === 'demo-example');
@@ -191,7 +194,7 @@ describe('doctor mode matrix (registry runner, EO11)', () => {
await pglite.setConfig('version', String(LATEST_VERSION));
const calls: string[] = [];
const run = await runMode(recordingEngine(pglite, calls), [], calls);
- expect(run.ran.map((r) => r.entry)).toEqual(DOCTOR_CHECK_REGISTRY.map((_, i) => i));
+ expect(run.ran.map((r) => r.entry)).toEqual(STANDARD);
expect(run.ran.some((r) => r.result === 'stop')).toBe(false);
expect(run.ran.find((r) => r.entry === indexOf(OFFLINE))?.result).toBe(0);
expect(run.checks.find((c) => c.name === 'connection')?.status).toBe('ok');
@@ -221,7 +224,7 @@ describe('doctor mode matrix (registry runner, EO11)', () => {
await seedDeadHolderLock();
const calls: string[] = [];
const run = await runMode(recordingEngine(pglite, calls), ['--fix'], calls);
- expect(run.ran.map((r) => r.entry)).toEqual(DOCTOR_CHECK_REGISTRY.map((_, i) => i));
+ expect(run.ran.map((r) => r.entry)).toEqual(STANDARD);
expect(run.ctx?.autoFixReport?.fixed.map((f) => f.skill)).toEqual(['demo-example']);
expect(skillFile()).not.toContain(SKILL_BODY);
expect(dryViolations(run.checks)).toEqual([]);
@@ -233,7 +236,7 @@ describe('doctor mode matrix (registry runner, EO11)', () => {
await seedDeadHolderLock();
const calls: string[] = [];
const run = await runMode(recordingEngine(pglite, calls), ['--fix', '--dry-run'], calls);
- expect(run.ran.map((r) => r.entry)).toEqual(DOCTOR_CHECK_REGISTRY.map((_, i) => i));
+ expect(run.ran.map((r) => r.entry)).toEqual(STANDARD);
expect(run.ctx?.autoFixReport?.fixed.map((f) => f.skill)).toEqual(['demo-example']);
expect(skillFile()).toContain(SKILL_BODY);
expect(dryViolations(run.checks).length).toBeGreaterThan(0);
diff --git a/test/fixtures/goldens/doctor/registry-build-checks.json b/test/fixtures/goldens/doctor/registry-build-checks.json
index fec0e56f2d..9b80a92bc6 100644
--- a/test/fixtures/goldens/doctor/registry-build-checks.json
+++ b/test/fixtures/goldens/doctor/registry-build-checks.json
@@ -853,14 +853,14 @@
"category": "meta",
"name": "sync_config_keys"
},
- {
- "category": "brain",
- "name": "fence_integrity"
- },
{
"category": "ops",
"name": "managed_sync_convergence"
},
+ {
+ "category": "brain",
+ "name": "fence_integrity"
+ },
{
"category": "ops",
"name": "search_mode"