Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix(eval): run-all runs only wired suites and fails honestly
garrytan17b909f98301
diff --git a/docs/eval/SEARCH_MODE_METHODOLOGY.md b/docs/eval/SEARCH_MODE_METHODOLOGY.mdindex d18557b787..6a88c596f9 100644--- a/docs/eval/SEARCH_MODE_METHODOLOGY.md+++ b/docs/eval/SEARCH_MODE_METHODOLOGY.md@@ -25,7 +25,7 @@ No private brain content is used in any reported result. The NDJSON run records## 3. Sample selection-- **Random seed:** `42` throughout. Set via `--seed N` on `gbrain eval run-all`; recorded in every per-run record.+- **Random seed:** `42` throughout. LongMemEval's dev slice and splits are sampled with seed 42 (`evals/longmemeval/`); `gbrain eval run-all --seed N` records the seed in every per-run record.- **No per-question curation.** Splits are taken whole; no question is filtered for reporting.- **No mode-specific tuning.** The same dataset + same seed feeds every mode. The mode bundle is the only independent variable. A mode Δ therefore measures the joint effect of every knob the bundles differ on — today that's `tokenBudget`, `expansion`, `relationalRetrieval` (the typed-edge fourth recall arm, ON for balanced/tokenmax, OFF for conservative), and `searchLimit`; the canonical diff is `MODE_BUNDLES` in `src/core/search/mode.ts`.- **Cache comparability across upgrades.** Semantic result-cache reads and writes are temporarily disabled in every mode, regardless of configuration. Every query uses fresh retrieval. The retained storage machinery still keys rows on `KNOBS_HASH_VERSION` and the active knobs + embedding column/provider; historical runs with result caching enabled are not directly comparable to current runs for latency or provider spend.@@ -34,28 +34,35 @@ No private brain content is used in any reported result. The NDJSON run records## 4. Run procedure-The command is the doc. Anyone can reproduce.+Each suite runs through its own command, once per mode. `gbrain eval run-all`+runs only the suites wired into it (BrainBench, which is search-mode+independent and runs once per sweep); naming `longmemeval` or `replay` in its+`--suites` exits 1 with `eval_suite_unwired` and these per-suite commands as+the fix.```bash# Setup: in your gbrain working tree, with OPENAI_API_KEY + ANTHROPIC_API_KEY exported.git rev-parse HEAD # record the commit for the methodology footer-# Sweep all 3 modes × 2 retrieval-focused suites with seed 42.-gbrain eval run-all \- --modes conservative,balanced,tokenmax \- --suites longmemeval,replay \- --seed 42 \- --limit 500 \- --budget-usd-retrieval 5 \- --budget-usd-answer 20 \- --output docs/eval/results/<version>/+# LongMemEval, all 3 modes; --record appends each run to the ledger.+for mode in conservative balanced tokenmax; do+ gbrain eval longmemeval <dataset.jsonl> --mode "$mode" --limit 500 --record+done++# Replay captured production queries against each mode (needs a brain with captured queries).+for mode in conservative balanced tokenmax; do+ gbrain eval replay --mode "$mode"+done++# BrainBench (hermetic, mode-independent), recorded once per sweep.+gbrain eval run-all --seed 42# Render the comparison.gbrain eval compare --md > docs/eval/results/<version>/README.mdgbrain eval compare --json > docs/eval/results/<version>/comparison.json```-The orchestrator writes per-run records to `<repo>/.gbrain-evals/eval-results.jsonl`. Every record carries: `run_id`, `ran_at`, `suite`, `mode`, `commit`, `seed`, `limit`, `params`, `status`, `duration_ms`. When a release publishes eval numbers, the `--output` dumps under `docs/eval/results/<version>/` carry the raw question-level outputs so a reviewer can re-score with their own metric implementation. **No dumps are committed in the repo right now** — reproduce by running the commands above; determinism (§3) means your re-run matches the reported orderings.+`gbrain eval longmemeval --record` and `gbrain eval run-all` write per-run records to `<repo>/.gbrain-evals/eval-results.jsonl`. Every record carries: `run_id`, `ran_at`, `suite`, `mode`, `commit`, `seed`, `limit`, `params`, `status`, `duration_ms`. `gbrain eval run-all` exits 1 when a suite's record says `failed`; the record is kept. When a release publishes eval numbers, the dumps under `docs/eval/results/<version>/` carry the raw question-level outputs so a reviewer can re-score with their own metric implementation. **No dumps are committed in the repo right now** — reproduce by running the commands above; determinism (§3) means your re-run matches the reported orderings.## 5. Threats to validity@@ -305,7 +312,7 @@ no improvement.- The 88% cache hit rate is the high end of what's achievable. Half that is closer to a default agent without cache-aware prompt layout.- The "Δ vs tokenmax" math assumes the OTHER cost components (system, tools, history, reasoning) stay constant. In practice, conservative's smaller per-turn payload also leaves more room in the context window for history → which can change agent behavior in either direction.-This anchor + the per-query math both live in this doc on purpose. The per-query framing is what an isolated benchmark would measure (and what `gbrain eval run-all` will produce). The realistic-scale anchor is what an operator actually pays. Both are honest; neither is the whole truth.+This anchor + the per-query math both live in this doc on purpose. The per-query framing is what an isolated benchmark would measure (and what the per-mode `gbrain eval longmemeval` runs produce). The realistic-scale anchor is what an operator actually pays. Both are honest; neither is the whole truth.## Reproducibility footerdiff --git a/docs/guides/error-codes.md b/docs/guides/error-codes.mdindex 2aa476eb62..19fafb7be4 100644--- a/docs/guides/error-codes.md+++ b/docs/guides/error-codes.md@@ -685,6 +685,14 @@ More: [docs/guides/write-refusals.md#embedding_auth_failed](../../docs/guides/wr|---|---|---|---|---|---|---|| The embedding model cannot produce the width of the brain's vector column; nothing was changed. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |+### eval_suite_unwired++<a id="eval_suite_unwired"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| `gbrain eval run-all` was asked for a suite it does not run in-process (longmemeval or replay); nothing ran. | run-all runs only wired suites (brainbench). Recording a skipped run and exiting 0 would read as a completed sweep with no numbers behind it. | Run each requested suite with its own command (`gbrain eval longmemeval <dataset.jsonl> --mode <mode> --record`, `gbrain eval replay --mode <mode>`), once per mode, or drop it from --suites. | agent | `repeat the read that failed` | 1 | no |+### export_limit<a id="export_limit"></a>diff --git a/llms-full.txt b/llms-full.txtindex 57bab91e74..b2f1f77f00 100644--- a/llms-full.txt+++ b/llms-full.txt@@ -4189,7 +4189,7 @@ off until the user opts in, and paid enrichment is a separate choice.| "validate frontmatter", "check frontmatter", "fix frontmatter", "frontmatter audit", "brain lint" | `skills/frontmatter-guard/SKILL.md` || "what search mode", "is my cache hot", "tune my retrieval", "compare search modes", "clear search overrides" | `gbrain search modes/stats/tune` directly. See `skills/conventions/search-modes.md` || "turn on System One", "enable Jev", "TypeSafe decide", "why is the evidence gate inactive", "turn System One off" | `gbrain decide probe/status/enable/disable` directly (brain host only). See `docs/guides/system-one.md` |-| "eval results", "search benchmark", "haters-immune methodology", "regression check on retrieval" | `gbrain eval run-all` / `gbrain eval compare`. See `docs/eval/SEARCH_MODE_METHODOLOGY.md` |+| "eval results", "search benchmark", "haters-immune methodology", "regression check on retrieval" | `gbrain eval longmemeval <dataset.jsonl> --mode <mode> --record` per mode, `gbrain eval run-all` (BrainBench), then `gbrain eval compare`. See `docs/eval/SEARCH_MODE_METHODOLOGY.md` || "bulk delete", "wipe the", "rm -rf", "purge the", "bulk forget" | `skills/data-loss-gate/SKILL.md` || "fact check", "fact-check", "verify the facts", "check the claims" | `skills/fact-check/SKILL.md` || "resolve before asking", "before asking the user", "unidentified contact", "unknown relationship" | `skills/resolve-before-asking/SKILL.md` |diff --git a/skills/RESOLVER.md b/skills/RESOLVER.mdindex 651b7ccacc..afb1cbaebc 100644--- a/skills/RESOLVER.md+++ b/skills/RESOLVER.md@@ -44,7 +44,7 @@ off until the user opts in, and paid enrichment is a separate choice.| "validate frontmatter", "check frontmatter", "fix frontmatter", "frontmatter audit", "brain lint" | `skills/frontmatter-guard/SKILL.md` || "what search mode", "is my cache hot", "tune my retrieval", "compare search modes", "clear search overrides" | `gbrain search modes/stats/tune` directly. See `skills/conventions/search-modes.md` || "turn on System One", "enable Jev", "TypeSafe decide", "why is the evidence gate inactive", "turn System One off" | `gbrain decide probe/status/enable/disable` directly (brain host only). See `docs/guides/system-one.md` |-| "eval results", "search benchmark", "haters-immune methodology", "regression check on retrieval" | `gbrain eval run-all` / `gbrain eval compare`. See `docs/eval/SEARCH_MODE_METHODOLOGY.md` |+| "eval results", "search benchmark", "haters-immune methodology", "regression check on retrieval" | `gbrain eval longmemeval <dataset.jsonl> --mode <mode> --record` per mode, `gbrain eval run-all` (BrainBench), then `gbrain eval compare`. See `docs/eval/SEARCH_MODE_METHODOLOGY.md` || "bulk delete", "wipe the", "rm -rf", "purge the", "bulk forget" | `skills/data-loss-gate/SKILL.md` || "fact check", "fact-check", "verify the facts", "check the claims" | `skills/fact-check/SKILL.md` || "resolve before asking", "before asking the user", "unidentified contact", "unknown relationship" | `skills/resolve-before-asking/SKILL.md` |diff --git a/src/cli.ts b/src/cli.tsindex 3446092a7a..db4020150d 100755--- a/src/cli.ts+++ b/src/cli.ts@@ -2110,14 +2110,13 @@ async function routeEngineFreeSubcommands(command: string, args: string[]): Prom}// `eval run-all` is a pure orchestrator — its engine arg is unused- // (`_engine`), the brainbench suite it runs in-process is hermetic (brings- // its own PGLite via createBenchmarkBrain), and the remaining suites write- // stub records. Bypass connectEngine so run-all works with no brain- // configured — e.g. in CI, where `--suites brainbench` otherwise died with- // "No brain configured" before reaching the hermetic run.+ // (`_engine`) and the brainbench suite it runs in-process is hermetic (brings+ // its own PGLite via createBenchmarkBrain). Bypass connectEngine so run-all+ // works with no brain configured — e.g. in CI. It returns its exit code+ // (1 when a suite failed).if (command === 'eval' && args[0] === 'run-all') {const { runEvalRunAll } = await import('./commands/eval-run-all.ts');- await runEvalRunAll(null, args.slice(1));+ setCliExitVerdict(await runEvalRunAll(null, args.slice(1)));return true;}diff --git a/src/commands/eval-compare.ts b/src/commands/eval-compare.tsindex 7cf917c006..4f66bee212 100644--- a/src/commands/eval-compare.ts+++ b/src/commands/eval-compare.ts@@ -435,7 +435,7 @@ export async function runEvalCompare(args: string[]): Promise<void> {if (records.length === 0) {process.stdout.write(`_No eval-results.jsonl found at <repo>/.gbrain-evals/eval-results.jsonl._\n`);- process.stdout.write(`_Run: gbrain eval run-all --modes conservative,balanced,tokenmax --suites longmemeval,replay --seed 42_\n`);+ process.stdout.write(`_Run, once per mode (conservative, balanced, tokenmax): gbrain eval longmemeval <dataset.jsonl> --mode <mode> --record_\n`);return;}diff --git a/src/commands/eval-run-all.ts b/src/commands/eval-run-all.tsindex 78af3bbeb3..c72bba7429 100644--- a/src/commands/eval-run-all.ts+++ b/src/commands/eval-run-all.ts@@ -17,6 +17,12 @@* above cap with override hint; non-TTY needs --yes AND explicit* --budget-usd-* flags.*+ * Wired suites (brainbench) run in-process; longmemeval and replay run only+ * through their own commands. A bare run sweeps the wired suites and names+ * the per-suite commands; an explicit `--suites` naming an unwired suite+ * refuses with `eval_suite_unwired` (exit 1). Any wired suite whose record+ * says `failed` makes the run exit 1, with the record already persisted.+ ** Per-suite implementations are documented in src/commands/eval-*.ts.* This file is the dispatcher + bookkeeper.*/@@ -26,7 +32,8 @@ import { dirname, join } from 'path';import type { BrainEngine } from '../core/engine.ts';import { SEARCH_MODES, type SearchMode } from '../core/search/mode.ts';import { redactSecrets } from '../eval/longmemeval/run-config.ts';-import { OperationError } from '../core/ops/contract.ts';+import { OperationError, opError } from '../core/ops/contract.ts';+import type { Action } from '../core/agent-output.ts';import { usageError } from '../cli/cli-error.ts';import { intFlagValue, numberFlagValue } from '../cli/flag-values.ts';@@ -34,6 +41,8 @@ export interface RunAllOpts {help: boolean;modes: SearchMode[];suites: string[];+ /** True when `--suites` named the suites; a bare run sweeps the wired ones. */+ suitesExplicit: boolean;limit?: number;seed: number;parallel: number;@@ -46,6 +55,13 @@ export interface RunAllOpts {const VALID_SUITES = ['longmemeval', 'replay', 'brainbench'] as const;type ValidSuite = (typeof VALID_SUITES)[number];+const WIRED_SUITES = ['brainbench'] as const;+type UnwiredSuite = Exclude<ValidSuite, (typeof WIRED_SUITES)[number]>;+/** The per-suite command for each suite run-all does not execute in-process. */+const UNWIRED_SUITE_ARGV: Record<UnwiredSuite, string[]> = {+ longmemeval: ['gbrain', 'eval', 'longmemeval', '<dataset.jsonl>', '--mode', '<mode>', '--record'],+ replay: ['gbrain', 'eval', 'replay', '--mode', '<mode>'],+};const DEFAULT_BUDGET_USD_RETRIEVAL = 5;const DEFAULT_BUDGET_USD_ANSWER = 20;@@ -56,7 +72,8 @@ export function parseRunAllArgs(args: string[]): RunAllOpts {const opts: RunAllOpts = {help: false,modes: [...SEARCH_MODES],- suites: ['longmemeval', 'replay'],+ suites: [...WIRED_SUITES],+ suitesExplicit: false,seed: DEFAULT_SEED,parallel: DEFAULT_PARALLEL,budgetUsdRetrieval: DEFAULT_BUDGET_USD_RETRIEVAL,@@ -89,6 +106,7 @@ export function parseRunAllArgs(args: string[]): RunAllOpts {}}opts.suites = list;+ opts.suitesExplicit = true;continue;}// #5933 (D4): NaN/out-of-range values would bypass the cost guard; reject them (usage error, exit 2).@@ -115,12 +133,17 @@ export function parseRunAllArgs(args: string[]): RunAllOpts {function printHelp(): void {process.stderr.write(`gbrain eval run-all [flags]\n\n` +- `Sweeps every requested search-lite mode × eval suite. Writes per-run results to\n` +- `<repo>/.gbrain-evals/eval-results.jsonl. Personal brain is never touched.\n\n` ++ `Runs the eval suites wired into the orchestrator (brainbench, once per sweep)\n` ++ `and writes per-run results to <repo>/.gbrain-evals/eval-results.jsonl. Exits 1\n` ++ `when a suite fails (its record is kept). Personal brain is never touched.\n\n` +`Flags:\n` +` --modes M1,M2,M3 Modes to evaluate (default: conservative,balanced,tokenmax).\n` +- ` --suites S1,S2 Suites to run (default: longmemeval,replay).\n` +- ` Valid: longmemeval, replay, brainbench.\n` ++ ` --suites S1,S2 Suites to run (default: brainbench).\n` ++ ` run-all runs brainbench in-process. longmemeval and\n` ++ ` replay run through their own commands, once per mode:\n` ++ ` ${UNWIRED_SUITE_ARGV.longmemeval.join(' ')}\n` ++ ` ${UNWIRED_SUITE_ARGV.replay.join(' ')}\n` ++ ` Naming them here exits 1 (eval_suite_unwired).\n` +` --limit N Limit each suite to N questions (default: full split).\n` +` --seed N Random seed (default: 42).\n` +` --parallel N Run N modes in parallel (default: 1; max ${SEARCH_MODES.length}).\n` +@@ -135,6 +158,36 @@ function printHelp(): void {);}+function unwiredSuiteFix(suites: UnwiredSuite[], modes: SearchMode[]): Action {+ const [suite, ...rest] = suites;+ return {+ argv: UNWIRED_SUITE_ARGV[suite],+ consent: ['paid'],+ actor: 'agent',+ why: `run-all does not run ${suite} in-process; its own command runs it, once per mode.`,+ inputs: [+ ...(suite === 'longmemeval' ? [{ name: 'dataset.jsonl', how: 'The LongMemEval dataset file (https://huggingface.co/datasets/xiaowu0162/longmemeval).' }] : []),+ { name: 'mode', how: `Each requested mode in turn: ${modes.join(', ')}.` },+ ],+ docs: 'docs/eval/SEARCH_MODE_METHODOLOGY.md#4-run-procedure',+ requires_exclusive: false,+ ...(rest.length ? { then: unwiredSuiteFix(rest, modes) } : {}),+ };+}++/** The refusal for an explicit `--suites` that names a suite run-all does not run. */+export function unwiredSuiteError(suites: string[], modes: SearchMode[]): OperationError | null {+ const unwired = suites.filter((s): s is UnwiredSuite => s in UNWIRED_SUITE_ARGV);+ if (unwired.length === 0) return null;+ const commands = unwired.map(s => UNWIRED_SUITE_ARGV[s].join(' ')).join('; ');+ return opError(+ 'eval_suite_unwired',+ `gbrain eval run-all does not run ${unwired.join(' or ')}; nothing ran.`,+ `Run ${unwired.length > 1 ? 'each suite' : 'it'} with its own command, once per mode: ${commands}. Or drop ${unwired.join(', ')} from --suites.`,+ { fix: unwiredSuiteFix(unwired, modes) },+ );+}+export interface EvalRunRecord {/*** v3 (BrainBench wave, decision 16): `mode` widened to `SearchMode | 'n/a'`@@ -285,7 +338,8 @@ export function evaluateCostGuard(return { proceed: true, reason: 'over cap but --yes acknowledged' };}-export async function runEvalRunAll(_engine: BrainEngine | null, args: string[]): Promise<void> {+/** Runs the sweep; returns the exit code (0 all wired suites completed, 1 one failed). */+export async function runEvalRunAll(_engine: BrainEngine | null, args: string[]): Promise<number> {let opts: RunAllOpts;try {opts = parseRunAllArgs(args);@@ -294,8 +348,10 @@ export async function runEvalRunAll(_engine: BrainEngine | null, args: string[])}if (opts.help) {printHelp();- return;+ return 0;}+ const unwired = unwiredSuiteError(opts.suites, opts.modes);+ if (unwired) throw unwired;const repoRoot = getRepoRoot();const commit = getCommitSha();@@ -318,6 +374,12 @@ export async function runEvalRunAll(_engine: BrainEngine | null, args: string[])process.stderr.write(`[eval run-all] cost estimate: retrieval=$${estimate.retrieval_usd.toFixed(2)} answer=$${estimate.answer_usd.toFixed(2)} total=$${estimate.total_usd.toFixed(2)}\n`);process.stderr.write(`[eval run-all] budget caps: retrieval=$${opts.budgetUsdRetrieval} answer=$${opts.budgetUsdAnswer}\n`);}+ if (!opts.suitesExplicit) {+ process.stderr.write(+ `[eval run-all] running the wired suites (${WIRED_SUITES.join(', ')}). longmemeval and replay run through their own commands, once per mode:\n` ++ Object.values(UNWIRED_SUITE_ARGV).map(argv => `[eval run-all] ${argv.join(' ')}\n`).join(''),+ );+ }const guard = evaluateCostGuard(estimate, {budgetUsdRetrieval: opts.budgetUsdRetrieval,@@ -333,31 +395,11 @@ export async function runEvalRunAll(_engine: BrainEngine | null, args: string[])process.stderr.write(`[eval run-all] ${guard.reason}, proceeding.\n`);}- // v0.32.3 Implementation note: per-suite execution is the operator's- // responsibility today — `gbrain eval run-all` is the orchestrator's- // shape + cost guard + audit trail. The per-suite per-mode calls land- // as a follow-up: each suite's CLI is already exposed (gbrain eval- // longmemeval --mode X, gbrain eval replay --mode X), so wiring them- // into a sequential or parallel sweep is mechanical glue once the- // benchmarking environment + dataset paths are configured.- //- // What ships in v0.32.3:- // - Argv parser + budget guard + persist hook (audit trail)- // - --json estimate-only mode (CI integration without spending)- // - Per-suite hook surface (persistRunRecord)- //- // What's a v0.32.4 follow-up:- // - In-process invocation of the longmemeval / replay / brainbench- // runners with a streaming-progress aggregator- // - --parallel N semaphore for the multi-mode sweep- //- // For v0.32.3 release-time, the operator runs the per-suite commands- // manually with the documented --mode flags and uses persistRunRecord- // to log each completion. The methodology doc names this explicitly.+ const failed: EvalRunRecord[] = [];for (const suite of opts.suites) {// BrainBench is search-mode-independent (decision 16): run ONCE per// sweep, in-process, recorded under mode 'n/a' — never multiplied by- // modes. The other suites keep the documented operator-runs-CLI stub.+ // modes. Unwired suites never reach this loop (unwiredSuiteError).if (suite === 'brainbench') {const startedAt = Date.now();const runId = `${commit}-brainbench-na-${opts.seed}`;@@ -384,35 +426,9 @@ export async function runEvalRunAll(_engine: BrainEngine | null, args: string[])};if (core.error) record.error = core.error;persistRunRecord(repoRoot, record, opts.outputDir);+ if (record.status === 'failed') failed.push(record);if (!opts.jsonOutput) {- process.stderr.write(`[eval run-all] ${runId}: ${record.status}\n`);- }- continue;- }- for (const mode of opts.modes) {- const startedAt = Date.now();- const runId = `${commit}-${suite}-${mode}-${opts.seed}`;- const record: EvalRunRecord = {- schema_version: 3,- run_id: runId,- ran_at: new Date().toISOString(),- suite: suite as ValidSuite,- mode,- commit,- seed: opts.seed,- limit: opts.limit,- params: {- budget_usd_retrieval: opts.budgetUsdRetrieval,- budget_usd_answer: opts.budgetUsdAnswer,- parallel: opts.parallel,- },- status: 'skipped',- duration_ms: Date.now() - startedAt,- };- record.error = 'orchestrator stub — invoke per-suite CLI manually for now (v0.32.4 wires the sweep)';- persistRunRecord(repoRoot, record, opts.outputDir);- if (!opts.jsonOutput) {- process.stderr.write(`[eval run-all] ${runId}: ${record.status}\n`);+ process.stderr.write(`[eval run-all] ${runId}: ${record.status}${record.error ? ` (${redactSecrets(record.error)})` : ''}\n`);}}}@@ -423,9 +439,13 @@ export async function runEvalRunAll(_engine: BrainEngine | null, args: string[])commit,modes: opts.modes,suites: opts.suites,+ failed_runs: failed.map(r => r.run_id),output_path: evalResultsPath(repoRoot, opts.outputDir),}) + '\n');+ } else if (failed.length > 0) {+ process.stderr.write(`[eval run-all] FAILED: ${failed.map(r => r.run_id).join(', ')}. Records kept in ${evalResultsPath(repoRoot, opts.outputDir)}\n`);} else {process.stderr.write(`[eval run-all] complete. Audit trail: ${evalResultsPath(repoRoot, opts.outputDir)}\n`);}+ return failed.length > 0 ? 1 : 0;}diff --git a/src/commands/eval.ts b/src/commands/eval.tsindex 4ede4b40c0..8c7eaf2df7 100644--- a/src/commands/eval.ts+++ b/src/commands/eval.ts@@ -114,7 +114,9 @@ export async function runEvalCommand(engine: BrainEngine, args: string[]): Promi// v0.32.3 search-lite — per-mode orchestrator + comparison report.if (sub === 'run-all') {const { runEvalRunAll } = await import('./eval-run-all.ts');- return runEvalRunAll(engine, args.slice(1));+ const { setCliExitVerdict } = await import('../core/cli-force-exit.ts');+ setCliExitVerdict(await runEvalRunAll(engine, args.slice(1)));+ return;}if (sub === 'compare') {const { runEvalCompare } = await import('./eval-compare.ts');@@ -422,7 +424,7 @@ SUBCOMMANDS (#3686 — each has its own flag surface)retrieval-quality Retrieval-quality suite over the calibration corpusgate CI pass/fail gate over a saved baselinecompare Compare two saved eval runs- run-all Orchestrate every suite (works with no brain configured)+ run-all Run the wired suites (brainbench); names the per-suite commands for the restbrainbench Cross-harness memory conformance suite (hermetic)longmemeval LongMemEval benchmark (brings its own in-memory brain)cross-modal Cross-modal quality gate (pure API calls, no DB)diff --git a/src/core/error-registry.ts b/src/core/error-registry.tsindex 2a789918c2..15a2bca391 100644--- a/src/core/error-registry.ts+++ b/src/core/error-registry.ts@@ -124,6 +124,7 @@ export const CODES = {embedding_unavailable: { class: 'unavailable', summary: "The provider returned an incomplete embedding batch." },embedding_unconfigured: { class: 'host_only', summary: "The selected brain has no verifiable text embedding model and dimensions." },embedding_width_mismatch: { class: 'caller', summary: "The embedding model cannot produce the width of the brain's vector column; nothing was changed." },+ eval_suite_unwired: { class: 'caller', summary: "`gbrain eval run-all` was asked for a suite it does not run in-process (longmemeval or replay); nothing ran.", why: "run-all runs only wired suites (brainbench). Recording a skipped run and exiting 0 would read as a completed sweep with no numbers behind it.", suggestion: 'Run each requested suite with its own command (`gbrain eval longmemeval <dataset.jsonl> --mode <mode> --record`, `gbrain eval replay --mode <mode>`), once per mode, or drop it from --suites.' },export_limit: { class: 'caller', summary: "This migration is bounded to 5,000 active pages per source; split or use a reviewed bulk export." },extraction_failed: { class: 'server', summary: "The accepted atom extraction produced malformed output." },extractor_identity_mismatch: { class: 'server', summary: "The approved extractor differs from the installed extractor; this receipt cannot resume or admit another revision." },diff --git a/test/eval-compare.test.ts b/test/eval-compare.test.tsindex 1a0d6c8b27..01ceeb2ba2 100644--- a/test/eval-compare.test.ts+++ b/test/eval-compare.test.ts@@ -116,7 +116,7 @@ describe('runEvalCompare', () => {const path = join(tmp, 'does-not-exist.jsonl');const out = await captureRun(() => runEvalCompare(['--md', '--input', path]));expect(out).toContain('No eval-results.jsonl found');- expect(out).toContain('gbrain eval run-all');+ expect(out).toContain('gbrain eval longmemeval <dataset.jsonl> --mode <mode> --record');});test('--modes filter narrows the table', async () => {diff --git a/test/eval-run-all-outcome.serial.test.ts b/test/eval-run-all-outcome.serial.test.tsnew file mode 100644index 0000000000..9457366987--- /dev/null+++ b/test/eval-run-all-outcome.serial.test.ts@@ -0,0 +1,61 @@+/**+ * `gbrain eval run-all` outcomes for the wired suite (brainbench).+ *+ * Protects: a bare run sweeps only the wired suites, names the per-suite+ * commands for longmemeval and replay, writes no `skipped` record and returns+ * 0; a brainbench run whose record says `failed` makes run-all return 1 with+ * that record persisted. Regressions it catches: the old stub sweep (skipped+ * records, exit 0), a failed suite reported as success. The CLI refusal for an+ * explicit unwired suite lives in test/eval-run-all.test.ts.+ * Seam: mock.module replaces runBrainBenchCore (the real suite takes ~20 s and+ * cannot be made to fail on demand), hence the serial file.+ */+import { afterAll, beforeEach, describe, expect, mock, spyOn, test } from 'bun:test';+import { mkdtempSync, readFileSync, rmSync } from 'node:fs';+import { tmpdir } from 'node:os';+import { join } from 'node:path';++let core: { status: 'completed' | 'failed'; fixtures_hash?: string; error?: string } = { status: 'completed' };+mock.module('../src/commands/eval-brainbench.ts', () => ({+ runBrainBenchCore: async () => core,+}));+const { runEvalRunAll } = await import('../src/commands/eval-run-all.ts');++const tmp = mkdtempSync(join(tmpdir(), 'gbrain-runall-outcome-'));+afterAll(() => rmSync(tmp, { recursive: true, force: true }));++async function run(args: string[]): Promise<{ code: number; stderr: string; records: Array<{ suite: string; status: string; error?: string }> }> {+ const out = join(tmp, String(Math.random()).slice(2));+ const chunks: string[] = [];+ const spy = spyOn(process.stderr, 'write').mockImplementation((c: string | Uint8Array) => { chunks.push(String(c)); return true; });+ let code: number;+ try {+ code = await runEvalRunAll(null, [...args, '--output', out]);+ } finally {+ spy.mockRestore();+ }+ const records = readFileSync(join(out, 'eval-results.jsonl'), 'utf8').trim().split('\n').map(l => JSON.parse(l));+ return { code, stderr: chunks.join(''), records };+}++beforeEach(() => { core = { status: 'completed', fixtures_hash: 'abc' }; });++describe('eval run-all wired-suite outcomes', () => {+ test('bare run: brainbench only, a notice naming the per-suite commands, exit 0', async () => {+ const r = await run([]);+ expect(r.code).toBe(0);+ expect(r.records.map(x => [x.suite, x.status])).toEqual([['brainbench', 'completed']]);+ expect(r.stderr).toContain('gbrain eval longmemeval <dataset.jsonl> --mode <mode> --record');+ expect(r.stderr).toContain('gbrain eval replay --mode <mode>');+ });++ test('a failed brainbench record makes run-all exit 1 and keeps the record', async () => {+ core = { status: 'failed', error: 'seed failures: fixture-a' };+ const r = await run(['--suites', 'brainbench']);+ expect(r.code).toBe(1);+ expect(r.records).toHaveLength(1);+ expect(r.records[0]).toMatchObject({ suite: 'brainbench', status: 'failed', error: 'seed failures: fixture-a' });+ expect(r.stderr).toContain('FAILED');+ expect(r.stderr).not.toContain('gbrain eval replay --mode');+ });+});diff --git a/test/eval-run-all.test.ts b/test/eval-run-all.test.tsindex ce3449f3a2..62d1dbf20e 100644--- a/test/eval-run-all.test.ts+++ b/test/eval-run-all.test.ts@@ -6,6 +6,7 @@ import { afterAll, beforeAll, beforeEach, describe, expect, test } from 'bun:tesimport { mkdtempSync, rmSync, readFileSync, existsSync } from 'fs';import { tmpdir } from 'os';import { join } from 'path';+import { runCli } from './helpers/cli-spawn.ts';import {parseRunAllArgs,estimateRunCost,@@ -25,10 +26,11 @@ afterAll(() => {});describe('parseRunAllArgs', () => {- test('defaults: all modes, longmemeval+replay suites, seed=42', () => {+ test('defaults: all modes, the wired suites (brainbench), seed=42', () => {const opts = parseRunAllArgs([]);expect(opts.modes).toEqual(['conservative', 'balanced', 'tokenmax']);- expect(opts.suites).toEqual(['longmemeval', 'replay']);+ expect(opts.suites).toEqual(['brainbench']);+ expect(opts.suitesExplicit).toBe(false);expect(opts.seed).toBe(42);expect(opts.parallel).toBe(1);expect(opts.budgetUsdRetrieval).toBe(5);@@ -48,6 +50,7 @@ describe('parseRunAllArgs', () => {test('--suites filters; rejects unknown', () => {const opts = parseRunAllArgs(['--suites', 'longmemeval']);expect(opts.suites).toEqual(['longmemeval']);+ expect(opts.suitesExplicit).toBe(true);expect(() => parseRunAllArgs(['--suites', 'foo'])).toThrow(/not a recognized suite/);});@@ -280,3 +283,25 @@ describe('persistRunRecord audit trail', () => {expect(parsed.params.mode_independent).toBeUndefined();});});++describe('eval run-all with a suite it does not run (CLI)', () => {+ test('explicit --suites longmemeval,replay exits 1 with eval_suite_unwired, the per-suite commands as fix, and no record', async () => {+ const out = join(tmp, 'unwired');+ const r = await runCli(['eval', 'run-all', '--suites', 'longmemeval,replay', '--modes', 'balanced', '--yes', '--json', '--output', out]);+ expect(r.exitCode).toBe(1);+ const env = JSON.parse(r.stdout);+ expect(env.code).toBe('eval_suite_unwired');+ expect(env.fix.argv.slice(0, 7)).toEqual(['gbrain', 'eval', 'longmemeval', '<dataset.jsonl>', '--mode', '<mode>', '--record']);+ expect(env.fix.next).toBe('ask_user');+ expect(env.fix.then.argv.slice(0, 5)).toEqual(['gbrain', 'eval', 'replay', '--mode', '<mode>']);+ expect(r.stderr).toContain('Error [eval_suite_unwired]');+ expect(existsSync(join(out, 'eval-results.jsonl'))).toBe(false);+ });++ test('gbrain errors eval_suite_unwired explains the code', async () => {+ const r = await runCli(['errors', 'eval_suite_unwired']);+ expect(r.exitCode).toBe(0);+ expect(r.stdout).toContain('eval_suite_unwired (caller, exit 1)');+ expect(r.stdout).toContain('does not run in-process');+ });+});