Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix(eval): nightly probe uses the direct reader its directness rubric grades (#6627)

time-attackfe1b9e343ad1
diff --git a/docs/architecture/key-files/core-cycle.md b/docs/architecture/key-files/core-cycle.md
index 867dbcc459..ade2eab11d 100644
--- a/docs/architecture/key-files/core-cycle.md
+++ b/docs/architecture/key-files/core-cycle.md
@@ -33,7 +33,7 @@ Current behavior and load-bearing invariants; history belongs in Git and CHANGEL
- `src/core/cycle/link-manifest.ts` — pre-retrieval LINK CANDIDATES manifest. `buildManifestContext(engine, sourceId?)` snapshots the source's slugs + basename index once per phase; `buildLinkManifest(engine, ctx, verdict, basename, {outputRoot, sourceId})` resolves wikilink candidates ZERO-EMBED from the triage verdict's cached entities/segment notes (basename-index exact/slugified matches first, bounded `searchKeyword` FTS second), excludes dream-output prefixes (self-consumption guard), renders `- [[slug]] — <deterministic first-two-sentence one-liner>` under hard caps (20 pages / 2400 chars) with buildTriageMapBlock's injection posture (whitespace-collapse + length caps + a 'data, not instructions' header). Best-effort everywhere — any failure degrades to the manifest-less prompt. Pinned by `test/cycle-link-manifest.test.ts`.
-- `src/core/cycle/nightly-probe-adapters.ts` — bridges the autopilot's object-shape `NightlyProbeDeps` to the argv-shape `runEvalLongMemEval` + `runEvalCrossModal` CLI functions. Cross-modal adapter argv MUST include `--output summaryPath` (without it the summary lands at the default receipt path and the adapter reads nothing from `summaryPath`). In-process invocation (NOT subprocess) avoids gbrain-version-drift for source-tree CI. The LongMemEval adapter passes `exitOnError: false`: failures throw into the nightly audit/rate-limit boundary instead of exiting the host process, with resolved chat providers checked before embedding work. The LongMemEval argv always carries `--no-embed-cache` (C-N5: the eval cache swaps the gateway's process-global embed transport, which inside the daemon would catch every other embed call). The pure builders `buildLongMemEvalProbeCall` / `buildCrossModalProbeCall` carry the brain-resolved `modelRoutes`: the reader as `--model`, the extractor as `RunOpts.extractorModel`, each set judge slot as `--slot-<x>-model`, and `{ useConfiguredGateway: true }` so the batch keeps the daemon's gateway; with no routes both calls are the pre-routing ones. The summary parse keeps `total`, `malformed_count`, `judge_models` (slot order), `panel` (with per-slot `slot_scored_questions`) and every non-passing question as `failures`: scores come from the batch's slot-indexed `slot_scores`, a failing dimension outside `PROBE_QA_DIMENSIONS` is recorded as `unrecognized`, error text is cut at the `--- raw ---` model-output marker, redacted and cut to 200 characters, and a malformed entry yields what can be read instead of a throw. Pinned by `test/cycle/nightly-probe-adapters.test.ts` (incl. the argv-shape guard for the `--output` requirement, the builder cases with and without routes, and the summary parse over a canned summary) and `test/nightly-probe-gateway-isolation.test.ts` (the real adapters leave the daemon's embed transport, chat model, provider chat options and env unchanged).
+- `src/core/cycle/nightly-probe-adapters.ts` — bridges the autopilot's object-shape `NightlyProbeDeps` to the argv-shape `runEvalLongMemEval` + `runEvalCrossModal` CLI functions. Cross-modal adapter argv MUST include `--output summaryPath` (without it the summary lands at the default receipt path and the adapter reads nothing from `summaryPath`). In-process invocation (NOT subprocess) avoids gbrain-version-drift for source-tree CI. The LongMemEval adapter passes `--reader-mode direct` (#6627: the probe's judge grades DIRECTNESS, and the notes reader's notes-plus-reasoning text would be the whole hypothesis; the shared reader prompts are untouched; `test/nightly-probe-reader-mode.test.ts`) and `exitOnError: false`: failures throw into the nightly audit/rate-limit boundary instead of exiting the host process, with resolved chat providers checked before embedding work. The LongMemEval argv always carries `--no-embed-cache` (C-N5: the eval cache swaps the gateway's process-global embed transport, which inside the daemon would catch every other embed call). The pure builders `buildLongMemEvalProbeCall` / `buildCrossModalProbeCall` carry the brain-resolved `modelRoutes`: the reader as `--model`, the extractor as `RunOpts.extractorModel`, each set judge slot as `--slot-<x>-model`, and `{ useConfiguredGateway: true }` so the batch keeps the daemon's gateway; with no routes both calls are the pre-routing ones. The summary parse keeps `total`, `malformed_count`, `judge_models` (slot order), `panel` (with per-slot `slot_scored_questions`) and every non-passing question as `failures`: scores come from the batch's slot-indexed `slot_scores`, a failing dimension outside `PROBE_QA_DIMENSIONS` is recorded as `unrecognized`, error text is cut at the `--- raw ---` model-output marker, redacted and cut to 200 characters, and a malformed entry yields what can be read instead of a throw. Pinned by `test/cycle/nightly-probe-adapters.test.ts` (incl. the argv-shape guard for the `--output` requirement, the builder cases with and without routes, and the summary parse over a canned summary) and `test/nightly-probe-gateway-isolation.test.ts` (the real adapters leave the daemon's embed transport, chat model, provider chat options and env unchanged).
- `src/core/cycle/nightly-probe-fixtures.ts` — `NIGHTLY_PROBE_FIXTURES`: the LongMemEval nightly fixture and the conversation-parser probe's two fixture files, embedded with `import ... with { type: 'file' }` (types in `src/types/jsonl-assets.d.ts`). A source checkout resolves them to `test/fixtures/...`, a compiled binary to a `/$bunfs/` path `readFileSync` reads, so both installs run the probes (#5187, C-N6). Pinned by `test/nightly-probe-compiled-binary.serial.test.ts` (a `bun build --compile` harness copied to an empty dir runs both autopilot probe steps on a hermetic provider, plus a source-mode run).
diff --git a/docs/eval-bench.md b/docs/eval-bench.md
index 1e7c6b5e92..9ccc57b6c0 100644
--- a/docs/eval-bench.md
+++ b/docs/eval-bench.md
@@ -1239,7 +1239,11 @@ bun test test/nightly-quality-probe.test.ts
score for your brain. It answers the 10 committed questions in
`test/fixtures/longmemeval-nightly.jsonl` from an isolated in-memory
benchmark brain, with your search mode, reranker and model routes, and has
-three judges grade the answers. A PASS says the retrieval-plus-answer
+three judges grade the answers. It uses the direct reader (`--reader-mode
+direct`, the original terse prompt and 512-token budget), because the judges
+grade directness and the default notes reader's notes and reasoning would be
+graded as the answer (#6627). Standalone `gbrain eval longmemeval` runs keep
+the notes default. A PASS says the retrieval-plus-answer
pipeline and the judges work end to end tonight; it says nothing about the
pages in your own brain. The fixture is embedded in the gbrain binary, so
source checkouts and compiled installs run the same probe.
diff --git a/src/core/cycle/nightly-probe-adapters.ts b/src/core/cycle/nightly-probe-adapters.ts
index 5c72f3933e..345edeb297 100644
--- a/src/core/cycle/nightly-probe-adapters.ts
+++ b/src/core/cycle/nightly-probe-adapters.ts
@@ -95,9 +95,12 @@ export async function runLongMemEvalForProbe(args: LongMemEvalProbeArgs): Promis
* `--model` and the extractor `RunOpts.extractorModel`. `--no-embed-cache`
* (C-N5): the cache swaps the gateway's process-global embed transport for
* the run, which inside the daemon would also catch every other embed call.
+ * `--reader-mode direct` (#6627): the judge grades DIRECTNESS, and the notes
+ * reader's whole notes-plus-reasoning text becomes the hypothesis, so the
+ * probe uses the original terse reader. The shared reader prompts stay as-is.
*/
export function buildLongMemEvalProbeCall(args: LongMemEvalProbeArgs): { argv: string[]; runOpts: RunOpts } {
- const argv = [args.fixturePath, '--output', args.outputPath, '--no-embed-cache'];
+ const argv = [args.fixturePath, '--output', args.outputPath, '--no-embed-cache', '--reader-mode', 'direct'];
const runOpts: RunOpts = { searchConfigSnapshot: args.searchConfigSnapshot, exitOnError: false };
if (args.modelRoutes) {
argv.push('--model', args.modelRoutes.reader.model);
diff --git a/test/cycle/nightly-probe-adapters.test.ts b/test/cycle/nightly-probe-adapters.test.ts
index 081506b75c..bc7076efa6 100644
--- a/test/cycle/nightly-probe-adapters.test.ts
+++ b/test/cycle/nightly-probe-adapters.test.ts
@@ -127,7 +127,7 @@ describe('nightly-probe-adapters: argv shape regression (codex round-2 #1)', ()
const fs = require('node:fs');
const source = fs.readFileSync(path, 'utf-8');
// longmemeval adapter: first positional arg is fixturePath, then --output outputPath.
- expect(source).toContain("[args.fixturePath, '--output', args.outputPath, '--no-embed-cache']");
+ expect(source).toContain("[args.fixturePath, '--output', args.outputPath, '--no-embed-cache', '--reader-mode', 'direct']");
});
test('runLongMemEvalForProbe passes the live search config snapshot via RunOpts', () => {
@@ -161,12 +161,12 @@ describe('nightly-probe-adapters: model routes reach the eval commands', () => {
{
name: 'with routes: --model carries the reader, RunOpts.extractorModel the extractor',
modelRoutes: ROUTES,
- argv: ['/f.jsonl', '--output', '/w/lme.jsonl', '--no-embed-cache', '--model', 'claude-cli:claude-opus-5-5'],
+ argv: ['/f.jsonl', '--output', '/w/lme.jsonl', '--no-embed-cache', '--reader-mode', 'direct', '--model', 'claude-cli:claude-opus-5-5'],
runOpts: { searchConfigSnapshot: SNAPSHOT, exitOnError: false, extractorModel: 'claude-cli:claude-sonnet-5' },
},
{
- name: 'no routes: the pre-#5872 call (embed cache off, C-N5)',
- argv: ['/f.jsonl', '--output', '/w/lme.jsonl', '--no-embed-cache'],
+ name: 'no routes: the pre-#5872 call (embed cache off, C-N5; direct reader, #6627)',
+ argv: ['/f.jsonl', '--output', '/w/lme.jsonl', '--no-embed-cache', '--reader-mode', 'direct'],
runOpts: { searchConfigSnapshot: SNAPSHOT, exitOnError: false },
},
];
diff --git a/test/nightly-probe-reader-mode.test.ts b/test/nightly-probe-reader-mode.test.ts
new file mode 100644
index 0000000000..7bdc212ea9
--- /dev/null
+++ b/test/nightly-probe-reader-mode.test.ts
@@ -0,0 +1,37 @@
+/**
+ * #6627 (D30): the nightly probe's judge grades DIRECTNESS ("without hedging
+ * or padding"), and the eval reader's default notes protocol makes the whole
+ * notes-plus-reasoning text the hypothesis, so healthy answers failed
+ * directness. The probe asks for the direct reader; the shared reader prompts
+ * (pinned by READER_PROMPT_SHA in benchmark receipts) stay unchanged.
+ */
+import { describe, expect, test } from 'bun:test';
+import { buildLongMemEvalProbeCall, PROBE_QA_DIMENSIONS } from '../src/core/cycle/nightly-probe-adapters.ts';
+import { READER_MAX_TOKENS, READER_SYSTEM_TEXT, resolveReaderConfig } from '../src/eval/longmemeval/reader.ts';
+
+const flagValue = (argv: string[], flag: string) => {
+ const at = argv.indexOf(flag);
+ return at >= 0 ? argv[at + 1] : undefined;
+};
+
+describe('#6627 nightly probe reader mode', () => {
+ test('the probe passes --reader-mode direct, with and without brain-resolved model routes', () => {
+ const base = { fixturePath: '/f.jsonl', outputPath: '/o.jsonl' };
+ const routes = { reader: { model: 'anthropic:claude-x' }, extractor: { model: 'anthropic:claude-y' } } as never;
+ for (const args of [base, { ...base, modelRoutes: routes }]) {
+ const { argv } = buildLongMemEvalProbeCall(args);
+ expect(flagValue(argv, '--reader-mode')).toBe('direct');
+ expect(argv.filter(a => a === '--reader-mode')).toHaveLength(1);
+ expect(argv[0]).toBe('/f.jsonl');
+ }
+ });
+
+ test('direct mode is the original terse reader prompt and budget, so the directness rubric can pass it', () => {
+ const { argv } = buildLongMemEvalProbeCall({ fixturePath: '/f.jsonl', outputPath: '/o.jsonl' });
+ const config = resolveReaderConfig({ mode: flagValue(argv, '--reader-mode') });
+ expect(config.system).toBe(READER_SYSTEM_TEXT);
+ expect(config.system).not.toContain('First extract all the relevant information');
+ expect(config.maxTokens).toBe(READER_MAX_TOKENS);
+ expect(PROBE_QA_DIMENSIONS.some(d => d.startsWith('DIRECTNESS'))).toBe(true);
+ });
+});