Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix(doctor): nightly_quality_probe_health names the failing judge dimension, the bar and the next step (#7145)

garrytan6453e002e1cb
diff --git a/src/commands/doctor/checks/local-audits.ts b/src/commands/doctor/checks/local-audits.ts
index e8d65bcca4..b5fffb9f16 100644
--- a/src/commands/doctor/checks/local-audits.ts
+++ b/src/commands/doctor/checks/local-audits.ts
@@ -191,7 +191,8 @@ async function runExtractionBacklogs(ctx: DoctorContext): Promise<Check[]> {
probeEnabled = resolveProbeEnabled(dbVal, (cfg as any)?.autopilot?.nightly_quality_probe?.enabled);
} catch { /* config unavailable → treat as disabled */ }
const events = readRecentQualityProbeEvents(7);
- const check = computeNightlyQualityProbeHealthCheck(probeEnabled, events);
+ const { PROBE_QA_DIMENSIONS } = await import('../../../core/cycle/nightly-probe-adapters.ts');
+ const check = computeNightlyQualityProbeHealthCheck(probeEnabled, events, PROBE_QA_DIMENSIONS);
checks.push(check);
} catch {
// Best-effort; audit-log read failure shouldn't stop doctor.
diff --git a/src/commands/doctor/checks/search-eval.ts b/src/commands/doctor/checks/search-eval.ts
index a8c2c4acf6..6fdf02e535 100644
--- a/src/commands/doctor/checks/search-eval.ts
+++ b/src/commands/doctor/checks/search-eval.ts
@@ -10,6 +10,7 @@ import type { Check } from '../../doctor.ts';
// isn't imported from extract-conversation-facts.ts directly (#4135).
import { ALLOWED_TYPES, conversationFactsEligibleSql, pageTypesForAllowed, isConversationFactsEligiblePage, requireParseableConversationFlag } from '../../../core/facts/conversation-types.ts';
import { checkError } from '../check-fix.ts';
+import { PASS_FLOOR_THRESHOLD, PASS_MEAN_THRESHOLD } from '../../../core/cross-modal-eval/aggregate.ts';
/**
* v0.32.3 [CDX-20]: surface mode + per-key override drift.
@@ -480,9 +481,61 @@ function judgePanelNote(event: ProbeJudgePanelFields): string {
return panel;
}
+interface ProbeFailureFields {
+ failures?: ReadonlyArray<{ question_id?: string; dimensions?: ReadonlyArray<{ dimension: string; mean?: number; scores?: ReadonlyArray<number | null>; fail_reason: string }> }>;
+ reader_model?: string;
+ receipt_dir?: string;
+}
+
+/**
+ * #7145: which judge dimension the non-PASS runs failed on, against the bar (every dimension's mean across judges
+ * >= PASS_MEAN_THRESHOLD and every judge >= PASS_FLOOR_THRESHOLD, on the 1-10 scale), what the dimension asks
+ * (`rubric`: the probe's own dimension texts, PROBE_QA_DIMENSIONS), and where to look. A dimension failing while
+ * correctness never does means the answers were right and judged on style: the reader or the rubric, not retrieval.
+ * Empty when no run recorded a failing dimension.
+ */
+function probeFailureExplanation(bad: ReadonlyArray<ProbeFailureFields>, rubric: readonly string[]): { text: string; details?: Record<string, unknown> } {
+ const tally = new Map<string, { runs: number; questions: number; means: number[]; reasons: Set<string> }>();
+ for (const event of bad) {
+ const seen = new Set<string>();
+ for (const failure of event.failures ?? []) {
+ for (const d of failure.dimensions ?? []) {
+ const key = d.dimension.trim().toLowerCase();
+ const t = tally.get(key) ?? { runs: 0, questions: 0, means: [], reasons: new Set<string>() };
+ if (!seen.has(key)) { t.runs++; seen.add(key); }
+ t.questions++;
+ if (typeof d.mean === 'number' && Number.isFinite(d.mean)) t.means.push(d.mean);
+ t.reasons.add(d.fail_reason);
+ tally.set(key, t);
+ }
+ }
+ }
+ if (tally.size === 0) return { text: '' };
+ const dims = [...tally].sort((a, b) => b[1].questions - a[1].questions).map(([dimension, t]) => ({ dimension, runs: t.runs, questions: t.questions,
+ mean_min: t.means.length ? Math.min(...t.means) : null, mean_max: t.means.length ? Math.max(...t.means) : null, fail_reasons: [...t.reasons].sort() }));
+ const asks = (dimension: string) => rubric.find(r => r.split('—')[0]!.trim().toLowerCase() === dimension)?.split('—')[1]?.trim();
+ const range = (d: typeof dims[number]) => d.mean_min === null ? '' : `, judge mean ${d.mean_min}${d.mean_max !== d.mean_min ? `-${d.mean_max}` : ''}`;
+ const parts = dims.map(d => `${d.dimension} in ${plural(d.runs, 'run')} (${plural(d.questions, 'question')}${range(d)}; ${d.fail_reasons.join(', ')})`);
+ const top = dims[0]!;
+ const question = asks(top.dimension);
+ const styleOnly = !tally.has('correctness');
+ const latest = bad[bad.length - 1]!;
+ const receipt = [...bad].reverse().find(e => typeof e.receipt_dir === 'string')?.receipt_dir;
+ const text = ` Failing judge dimension(s): ${parts.join('; ')}. The bar is a mean of at least ${PASS_MEAN_THRESHOLD} across judges and no judge below ${PASS_FLOOR_THRESHOLD}, on a 1-10 scale.`
+ + (question ? ` ${top.dimension} asks: ${question}` : '')
+ + (styleOnly ? ` Correctness never failed, so the answers matched the expected facts and were judged on ${top.dimension} alone: this points at the reader's answer style`
+ + `${latest.reader_model ? ` (reader ${latest.reader_model})` : ''} or the judges' rubric, not at retrieval or your brain.` : '')
+ + ` Next: read the answers and per-judge scores the run kept ${receipt ? `in ${receipt} (lme-output.jsonl, summary.json)` : "under the audit dir's nightly-probe/ receipts"}; `
+ + 'an answer carrying notes or reasoning means the reader ran without --reader-mode direct (an autopilot daemon started before an upgrade keeps running the old probe: restart it); '
+ + "a terse correct answer scored low means the judges' rubric needs recalibrating (models.eval.cross_modal.slot_a, slot_b and slot_c choose the judges, models.eval.longmemeval the reader).";
+ return { text, details: { failing_dimensions: dims, bar: { mean_at_least: PASS_MEAN_THRESHOLD, every_judge_at_least: PASS_FLOOR_THRESHOLD, scale: '1-10' }, correctness_failed: !styleOnly,
+ ...(latest.reader_model ? { reader_model: latest.reader_model } : {}), ...(receipt ? { receipt_dir: receipt } : {}) } };
+}
+
export function computeNightlyQualityProbeHealthCheck(
probeEnabled: boolean,
- events: ReadonlyArray<{ outcome: string; ts: string; detail?: string } & ProbeJudgePanelFields>,
+ events: ReadonlyArray<{ outcome: string; ts: string; detail?: string } & ProbeJudgePanelFields & ProbeFailureFields>,
+ rubric: readonly string[] = [],
): Check {
const name = 'nightly_quality_probe_health';
if (!probeEnabled && events.length === 0) {
@@ -517,10 +570,12 @@ export function computeNightlyQualityProbeHealthCheck(
`no_embed_key=${events.filter(e => e.outcome === 'no_embedding_key').length} ` +
`rate_limited=${events.filter(e => e.outcome === 'rate_limited').length}` +
(skipped > 0 ? ` skipped=${skipped}` : '');
+ const explained = probeFailureExplanation(bad, rubric);
return {
name,
status: 'warn',
- message: `${bad.length} non-PASS run${bad.length === 1 ? '' : 's'} in last 7d (${counts}). Latest: ${latest.outcome} at ${latest.ts}${latest.detail ? ` (${latest.detail})` : ''}.${judgePanelNote(latest)}`,
+ message: `${bad.length} non-PASS run${bad.length === 1 ? '' : 's'} in last 7d (${counts}). Latest: ${latest.outcome} at ${latest.ts}${latest.detail ? ` (${latest.detail})` : ''}.${judgePanelNote(latest)}${explained.text}`,
+ ...(explained.details ? { details: explained.details } : {}),
};
}
return {
diff --git a/src/core/cross-modal-eval/aggregate.ts b/src/core/cross-modal-eval/aggregate.ts
index b0180b3e46..dc55769d2a 100644
--- a/src/core/cross-modal-eval/aggregate.ts
+++ b/src/core/cross-modal-eval/aggregate.ts
@@ -57,8 +57,8 @@ export interface AggregateResult {
verdictMessage: string;
}
-const PASS_MEAN_THRESHOLD = 7;
-const PASS_FLOOR_THRESHOLD = 5;
+export const PASS_MEAN_THRESHOLD = 7;
+export const PASS_FLOOR_THRESHOLD = 5;
const MIN_SUCCESSES_FOR_VERDICT = 2;
const TOP_IMPROVEMENTS_CAP = 10;
const DEDUP_PREFIX_LEN = 40;
diff --git a/test/nightly-quality-probe.test.ts b/test/nightly-quality-probe.test.ts
index 30e1e1799d..cceb408035 100644
--- a/test/nightly-quality-probe.test.ts
+++ b/test/nightly-quality-probe.test.ts
@@ -885,3 +885,35 @@ describe('computeNightlyQualityProbeHealthCheck: judge panel (#5506)', () => {
});
});
});
+
+describe('#7145 nightly_quality_probe_health explains a failing judge dimension', () => {
+ const failure = (id: string, dimension: string, mean: number, scores: number[]) =>
+ ({ question_id: id, verdict: 'fail', dimensions: [{ dimension, mean, scores, fail_reason: 'mean_below_7' }] });
+
+ test('one dimension failing while correctness never does: named, observed against the bar, with what it asks and where to look', async () => {
+ const { computeNightlyQualityProbeHealthCheck } = await import('../src/commands/doctor.ts');
+ const { PROBE_QA_DIMENSIONS } = await import('../src/core/cycle/nightly-probe-adapters.ts');
+ const events = [
+ { outcome: 'fail', ts: '2026-05-20T03:00:00Z', reader_model: 'anthropic:reader-example', failures: [failure('nightly-1', 'directness', 6.3, [6, 7, 6]), failure('nightly-2', 'directness', 5.7, [5, 6, 6])] },
+ { outcome: 'fail', ts: '2026-05-21T03:00:00Z', reader_model: 'anthropic:reader-example', receipt_dir: '/synthetic/audit/nightly-probe/run-2', failures: [failure('nightly-1', 'directness', 6.7, [7, 7, 6])] },
+ ];
+ const check = computeNightlyQualityProbeHealthCheck(true, events, PROBE_QA_DIMENSIONS);
+ expect(check.status).toBe('warn');
+ expect(check.message).toContain('Failing judge dimension(s): directness in 2 runs (3 questions, judge mean 5.7-6.7; mean_below_7).');
+ expect(check.message).toContain('a mean of at least 7 across judges and no judge below 5, on a 1-10 scale');
+ expect(check.message).toContain('directness asks: Does it answer THIS question without hedging or padding or answering something else?');
+ expect(check.message).toContain('Correctness never failed');
+ expect(check.message).toContain('(reader anthropic:reader-example)');
+ expect(check.message).toContain('/synthetic/audit/nightly-probe/run-2 (lme-output.jsonl, summary.json)');
+ expect(check.details).toMatchObject({ failing_dimensions: [{ dimension: 'directness', runs: 2, questions: 3, mean_min: 5.7, mean_max: 6.7 }],
+ bar: { mean_at_least: 7, every_judge_at_least: 5, scale: '1-10' }, correctness_failed: false });
+ });
+
+ test('a correctness failure is not called a style problem', async () => {
+ const { computeNightlyQualityProbeHealthCheck } = await import('../src/commands/doctor.ts');
+ const check = computeNightlyQualityProbeHealthCheck(true, [{ outcome: 'fail', ts: '2026-05-21T03:00:00Z', failures: [failure('nightly-3', 'correctness', 3, [3, 3, 3])] }]);
+ expect(check.message).toContain('correctness in 1 run');
+ expect(check.message).not.toContain('Correctness never failed');
+ expect(check.details).toMatchObject({ correctness_failed: true });
+ });
+});