Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix(doctor): a selected check the early stop skipped marks the report incomplete (#8114)

garrytan682837a2b46c
diff --git a/src/commands/doctor/registry.ts b/src/commands/doctor/registry.ts
index 19501f763d..0dca2f7676 100644
--- a/src/commands/doctor/registry.ts
+++ b/src/commands/doctor/registry.ts
@@ -371,7 +371,7 @@ function onlyResult(checks: Check[], only: ReadonlySet<string>, stopped: boolean
const kept = checks.filter((c) => only.has(c.name) || (stopped && missing.length > 0 && c.name === 'connection'));
for (const name of missing) {
kept.push(stopped
- ? { name, status: 'warn', message: 'Not run: the database checks stopped early (see the connection check).', fix_unavailable_reason: 'check_errored' }
+ ? { name, status: 'warn', message: 'Not run: the database checks stopped early (see the connection check).', details: { health: 'unknown' }, fix_unavailable_reason: 'check_errored' }
: infoCheck(name, 'No finding: this check does not apply to this brain right now.', 'not_applicable'));
}
return kept;
diff --git a/test/doctor-only-skipped-8114.test.ts b/test/doctor-only-skipped-8114.test.ts
new file mode 100644
index 0000000000..8595913ccf
--- /dev/null
+++ b/test/doctor-only-skipped-8114.test.ts
@@ -0,0 +1,43 @@
+/**
+ * #8114: `gbrain doctor --fast --only <db check>` stops before the database checks, so the
+ * selected check does not run. Its not-run placeholder must mark the report incomplete
+ * (unknown health); a run that executes the same check stays complete.
+ */
+import { afterAll, beforeAll, expect, test } from 'bun:test';
+import { PGLiteEngine } from '../src/core/pglite-engine.ts';
+import { buildChecks, computeDoctorReport } from '../src/commands/doctor.ts';
+import { doctorRunSummary, startDoctorDeadline } from '../src/commands/doctor/budget.ts';
+
+let engine: PGLiteEngine;
+
+beforeAll(async () => {
+ engine = new PGLiteEngine();
+ await engine.connect({});
+ await engine.initSchema();
+});
+
+afterAll(async () => {
+ await engine.disconnect();
+});
+
+async function report(db: PGLiteEngine | null, args: string[]) {
+ const deadline = startDoctorDeadline(args);
+ const checks = await buildChecks(db, args, undefined, undefined, deadline);
+ return computeDoctorReport(checks, { run: doctorRunSummary(args, deadline) });
+}
+
+test('a selected check the --fast early stop skipped leaves the report incomplete', async () => {
+ const r = await report(null, ['--fast', '--json', '--only', 'persistence_capacity', '--budget-ms', '30000']);
+ const check = r.checks.find((c) => c.name === 'persistence_capacity');
+ expect(check?.message).toContain('Not run');
+ expect(r.complete).toBe(false);
+ expect(r.unknown_sections).toEqual(['persistence_capacity']);
+});
+
+test('control: the same selected check, run, keeps the report complete', async () => {
+ const r = await report(engine, ['--json', '--only', 'persistence_capacity', '--budget-ms', '30000']);
+ const check = r.checks.find((c) => c.name === 'persistence_capacity');
+ expect(check?.message ?? '').not.toContain('Not run');
+ expect(r.complete).toBe(true);
+ expect(r.unknown_sections).toEqual([]);
+});