Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix(atoms): extract_atoms honors models.tier.utility; claude-cli lists Haiku 5.5 (#6675)
time-attack9d54de6708cc
diff --git a/docs/architecture/key-files/commands-4.md b/docs/architecture/key-files/commands-4.mdindex ea6c868c47..500a100895 100644--- a/docs/architecture/key-files/commands-4.md+++ b/docs/architecture/key-files/commands-4.md@@ -31,7 +31,7 @@ Current behavior and load-bearing invariants; history belongs in Git and CHANGEL- `src/commands/migrations/v0_46_3.ts` — idempotent no-op for a retired notification. Returns a complete migration with a skipped notice phase; performs no database, config, provider, vector or pending-work writes. Its feature pitch points to read-only status and explicit-target migration previews.- `src/commands/migrations/v0_60_31.ts` — the security fix wave orchestrated migration (ledger `0.60.31`), two phases. `credential_projection`: runs `runMigrateOnlyCore` first (schema v189 marks the pages; PGLite skips the runner's schema pre-flight), then `resealCredentialProjections`, provider-free and never embedding; a dry run reports the count; any failed page makes the run `partial`, so `gbrain apply-migrations --yes --no-autopilot-install` retries it, and re-sealed pages are no longer pending, so a rerun resumes. `google_file_modes_notice`: `googleFileModesNoticePhase` from `v0_60_31-google-file-modes.ts`. A brain without config completes with the phase skipped. Agent instructions: `skills/migrations/v0.60.31.0.md`.-- `src/commands/models.ts` — `gbrain models [--json]` read-only routing dashboard: prints tier defaults (`utility`/`reasoning`/`deep`/`subagent`), the resolved value for each (re-walking the resolution chain), every per-task override (14 `PER_TASK_KEYS`, including provider-neutral `models.contextual_synopsis` with legacy-key/env attribution and `models.dream.extract_atoms` which reports via its own caller-specific resolver — `resolveExtractAtomsModel()` in `extract-atoms.ts` — rather than the generic chain, so the report can't diverge from what the phase actually calls), the alias map, and a source-of-truth column (`default` / `config: <key>` / `env: <VAR>`) derived from `resolveModelDetailed`, so a tier key is attributed before `models.default`. A `Nightly quality probe` block (JSON `nightly_probe`; `schema_version` stays 1) shows the probe's routes from `resolveNightlyProbeModelRoutes`: reader and extractor with their source, and each judge slot labelled `config: models.eval.cross_modal.slot_<x>`, `panel default` or `substitute for <default> (no usable provider)` — the #4636 substitution run with a silent log against this process's gateway. Its `environment_note` says availability, substitutes and key-aware defaults are judged from this process's environment, so a key only in the daemon's `~/.gbrain/env` reads as unavailable. A resolved Anthropic haiku/sonnet/opus id older (by major, minor) than the anthropic recipe's newest priced same-family id gets an advisory `[newer <family> available: <id>] (gbrain config set ...)` hint (JSON: `newer_available`); version parsing lives in `src/core/ai/anthropic-model-ids.ts` (8-digit segment is a date, so dated and undated forms compare equal; fable, non-Anthropic, newer-than-recipe and unparseable ids get no hint). The hint never changes a default. `gbrain models doctor [--skip=<provider>] [--json]` fires a 1-token `gateway.chat()` probe against each configured chat + expansion model and classifies failures into `{model_not_found, auth, rate_limit, network, unknown}`. The probe timeout resolves per model via `resolveChatProbeTimeoutMs` — the recipe touchpoint's `default_timeout_ms` when declared, else the flat 5000ms default (mirrors the reranker probe's recipe-default fallback; `claude-cli` declares 30s because its `claude -p` subprocess cold start routinely outruns 5s and would false-fail every run as `unknown`). The reranker reachability probe sends one question with a relevant and an unrelated passage and reports `ok` only when the relevant one scores higher by more than 0.1; equal, inverted or missing scores are `config` with a fix naming `docs/ai-providers/llama-server-reranker.md` step 2 (a broken GGUF conversion answers but ranks at random). Wired into `cli.ts` dispatch + `CLI_ONLY` set. A zero-token `embedding_config` probe runs FIRST, before any chat/expansion probes spend money: `probeEmbeddingConfig()` reads `getEmbeddingModel()` + `getEmbeddingDimensions()` and (for Voyage flexible-dim models) checks `isValidVoyageOutputDim(dims)` against `VOYAGE_VALID_OUTPUT_DIMS`. `ProbeStatus` variant `'config'` + optional `fix?: string` on `ProbeResult` surface a paste-ready `gbrain config set ...` line in human + JSON output; touchpoint label `'embedding_config'` joins `'chat'` and `'expansion'`.+- `src/commands/models.ts` — `gbrain models [--json]` read-only routing dashboard: prints tier defaults (`utility`/`reasoning`/`deep`/`subagent`), the resolved value for each (re-walking the resolution chain), every per-task override (14 `PER_TASK_KEYS`, including provider-neutral `models.contextual_synopsis` with legacy-key/env attribution and `models.dream.extract_atoms` which reports via its own caller-specific resolver — `resolveExtractAtomsModelWithSource()` in `extract-atoms.ts`: its own key, then `models.tier.utility`, then the key-aware utility default, never `models.default` or `GBRAIN_MODEL` (#6675) — rather than the generic chain, so the report can't diverge from what the phase actually calls), the alias map, and a source-of-truth column (`default` / `config: <key>` / `env: <VAR>`) derived from `resolveModelDetailed`, so a tier key is attributed before `models.default`. A `Nightly quality probe` block (JSON `nightly_probe`; `schema_version` stays 1) shows the probe's routes from `resolveNightlyProbeModelRoutes`: reader and extractor with their source, and each judge slot labelled `config: models.eval.cross_modal.slot_<x>`, `panel default` or `substitute for <default> (no usable provider)` — the #4636 substitution run with a silent log against this process's gateway. Its `environment_note` says availability, substitutes and key-aware defaults are judged from this process's environment, so a key only in the daemon's `~/.gbrain/env` reads as unavailable. A resolved Anthropic haiku/sonnet/opus id older (by major, minor) than the anthropic recipe's newest priced same-family id gets an advisory `[newer <family> available: <id>] (gbrain config set ...)` hint (JSON: `newer_available`); version parsing lives in `src/core/ai/anthropic-model-ids.ts` (8-digit segment is a date, so dated and undated forms compare equal; fable, non-Anthropic, newer-than-recipe and unparseable ids get no hint). The hint never changes a default. `gbrain models doctor [--skip=<provider>] [--json]` fires a 1-token `gateway.chat()` probe against each configured chat + expansion model and classifies failures into `{model_not_found, auth, rate_limit, network, unknown}`. The probe timeout resolves per model via `resolveChatProbeTimeoutMs` — the recipe touchpoint's `default_timeout_ms` when declared, else the flat 5000ms default (mirrors the reranker probe's recipe-default fallback; `claude-cli` declares 30s because its `claude -p` subprocess cold start routinely outruns 5s and would false-fail every run as `unknown`). The reranker reachability probe sends one question with a relevant and an unrelated passage and reports `ok` only when the relevant one scores higher by more than 0.1; equal, inverted or missing scores are `config` with a fix naming `docs/ai-providers/llama-server-reranker.md` step 2 (a broken GGUF conversion answers but ranks at random). Wired into `cli.ts` dispatch + `CLI_ONLY` set. A zero-token `embedding_config` probe runs FIRST, before any chat/expansion probes spend money: `probeEmbeddingConfig()` reads `getEmbeddingModel()` + `getEmbeddingDimensions()` and (for Voyage flexible-dim models) checks `isValidVoyageOutputDim(dims)` against `VOYAGE_VALID_OUTPUT_DIMS`. `ProbeStatus` variant `'config'` + optional `fix?: string` on `ProbeResult` surface a paste-ready `gbrain config set ...` line in human + JSON output; touchpoint label `'embedding_config'` joins `'chat'` and `'expansion'`.- `src/commands/pricing.ts` — `gbrain pricing set <model> --input <usd/1M> --output <usd/1M> | --rate <usd/1M> [--source <url>]`, `pricing list [--json]`, `pricing unset <model>`. Each write reads `pricing.overrides`, changes one entry (keyed by the lowercased model; case variants replaced) and writes it back, so other entries survive; an unreadable stored value is refused, never overwritten. Rates must be non-negative finite numbers; $0 is accepted with a stderr warning. Entries keep the parser schema (`{input, output}` or `pricePerMTok`) with `source` and `set_at` beside them. Trust boundary: CLI-only (never an operation, so MCP cannot reach it) and `thinClient: 'refuse'` in the command table. Pinned by `test/budget/no-pricing-registration.test.ts`.- `src/commands/orphans.ts` — `gbrain orphans` and MCP `find_orphans` share islanded (no live inbound or outbound links) and legacy inbound-only modes. Read policy scopes candidates and excludes private candidates, endpoints and independent origin pages before counting. Cross-source public links still establish reachability by the documented orphan definition. Reporting exclusions (`shouldExcludeFromOrphanReporting`) stay centralized; the scoped live-page denominator excludes the same private/reporting rows. `--source` remains explicit; no new remote privacy parameter. Connector renders (an `email`/`meeting` page whose source `config.kind` is a connector kind) are islanded by construction, so they leave both totals and are reported as `connector_renders_excluded` (`--include-pseudo` keeps them); doctor `orphan_ratio` carries that count in `details` and prints `gbrain extract links --by-mention --source db` (plus `--source-id` when scoped). Pinned by `test/orphan-ratio-connector-renders.test.ts`.diff --git a/docs/operations/spend-controls.md b/docs/operations/spend-controls.mdindex a4b380ecdf..1eacfc7c37 100644--- a/docs/operations/spend-controls.md+++ b/docs/operations/spend-controls.md@@ -317,8 +317,8 @@ gbrain config set autopilot.auto_drain.enabled false # stop all automatWhat leaves the machine while it is on: the page text of each extracted emailthread or calendar event (message bodies, subjects, participants as rendered onthe page, up to `cycle.extract_atoms.max_input_chars`) is sent to the-configured `extract_atoms` chat model (`models.dream.extract_atoms`, a-utility-tier model by default), under the caps above. Atoms already extracted+configured `extract_atoms` chat model (`models.dream.extract_atoms`, else+`models.tier.utility`, else the built-in utility-tier default), under the caps above. Atoms already extractedstay; opting out only stops new extraction. A page longer than that cap is readonce up to the cap: its head atoms are kept, the phase reports it under`input_truncated` with a stderr line, and the page is not marked complete; itdiff --git a/src/commands/models.ts b/src/commands/models.tsindex 66fdd2ec94..2b6a7273c3 100644--- a/src/commands/models.ts+++ b/src/commands/models.ts@@ -83,7 +83,7 @@ interface PerTaskModelRoute {* chain visible rather than implying full resolveModel() coverage — can* never disagree with the resolved value.*/- narrowResolver?: (engine: BrainEngine) => Promise<{ model: string; source: 'config' | 'tier_default' | 'measured'; label?: string }>;+ narrowResolver?: (engine: BrainEngine) => Promise<{ model: string; source: 'config' | 'tier_config' | 'tier_default' | 'measured'; label?: string }>;}const PER_TASK_KEYS: PerTaskModelRoute[] = [diff --git a/src/core/ai/recipes/claude-cli.ts b/src/core/ai/recipes/claude-cli.tsindex b30f562673..0dec127ac0 100644--- a/src/core/ai/recipes/claude-cli.ts+++ b/src/core/ai/recipes/claude-cli.ts@@ -56,6 +56,7 @@ export const claudeCli: Recipe = {// Cheap model first: `providers explain` / init auto-pick advertise// models[0] for this touchpoint (same convention as the openai recipe).models: [+ 'claude-haiku-5-5','claude-haiku-4-5-20251001','claude-fable-5','claude-fable-5-1',@@ -87,6 +88,7 @@ export const claudeCli: Recipe = {'claude-sonnet-5-5','claude-sonnet-5','claude-sonnet-4-6',+ 'claude-haiku-5-5','claude-haiku-4-5-20251001',],supports_tools: true,diff --git a/src/core/behavior-change-notice.ts b/src/core/behavior-change-notice.tsindex 5b52a20d76..45a0295048 100644--- a/src/core/behavior-change-notice.ts+++ b/src/core/behavior-change-notice.ts@@ -627,6 +627,8 @@ export const BEHAVIOR_CHANGES: ReadonlyArray<{ since: string; text: ChangeText }// Large pages A3/T44, A4/T32 (Lane 3a).{ since: '0.60.242.0', text: 'Replacing a page\'s chunks now writes them in bounded batches (at most 500 rows and 16 MiB of encoded rows per statement) after one prune, all in the same transaction, instead of one statement carrying every chunk. A page with thousands of chunks no longer builds one giant statement, and a failure in any batch still rolls the whole replacement back.' },{ since: '0.60.242.0', text: 'A chunk vector is now tied to the chunk\'s text and its full embedding input rather than its position. When an edit inserts or removes chunks above it, a projection rebuild moves the unchanged chunk to its new index with its vector instead of dropping it, so only new or changed chunks wait for embedding. An embed that finishes after the page changed now commits the vectors of the chunks that are still the same (same text, source and embedding input) and leaves the rest for the next run, instead of discarding the whole run; the page\'s embedding signature is stamped only when every chunk got its vector. A vector built under an old title or synopsis is still dropped.' },+ // Wave 17 lane 3 item 3.4 (#6675, decision D3 option B). `since` is a placeholder until the merge-slot stamp.+ { since: '0.0.0-wave17', text: 'The extract_atoms phase now honors `models.tier.utility`: its model is `models.dream.extract_atoms`, then `models.tier.utility`, then the key-aware utility default. A brain that routed its utility tier to another model without setting `models.dream.extract_atoms` extracts atoms on that model from now on (it used the built-in utility default before); `models.default` and `GBRAIN_MODEL` alone still do not change this phase. `gbrain models` shows the row and its source. Set `models.dream.extract_atoms` to keep a different model for this phase.' },];/** The newest disclosed change's release: the notice id moves only when a release adds rows. */diff --git a/src/core/cycle/extract-atoms.ts b/src/core/cycle/extract-atoms.tsindex fb55978328..65bc902066 100644--- a/src/core/cycle/extract-atoms.ts+++ b/src/core/cycle/extract-atoms.ts@@ -82,7 +82,7 @@ import { abortableSleep } from '../retry.ts';import { throwIfAborted } from '../abort-check.ts';import { createHash } from 'crypto';import { slugifySegment } from '../sync.ts';-import { resolveTierDefault } from '../model-config.ts';+import { resolveAlias, resolveTierDefault } from '../model-config.ts';import { isUndefinedTableError, warnOncePerProcess } from '../utils.ts';import { utcDate } from './cycle-date.ts';import { normalizeForGrounding } from './synthesize-verify.ts';@@ -648,33 +648,31 @@ export async function tombstonedTranscriptsForHashes(}}+export const EXTRACT_ATOMS_MODEL_KEY = 'models.dream.extract_atoms';+/**- * The exact two-step model resolution `runPhaseExtractAtoms` uses:- * `models.dream.extract_atoms` DB config wins if set (same plain-`||`- * truthiness as always — a whitespace-only value IS "configured"), else the- * key-aware `resolveTierDefault('utility')`. Deliberately NOT- * `resolveModel()`'s fuller chain (which also honors `models.tier.utility`,- * `models.default`, and an env var) — extract_atoms has never read those, and- * unifying the two behaviors is a separate, larger change. Exported so- * `gbrain models` can report the actual routing instead of a generic chain- * that can diverge from it in partially-configured installs; `source` comes- * from the SAME call as `model` so the report's attribution can never- * disagree with the resolved value. Fail-soft: a throwing config read routes- * to the tier default (the same end state runPhaseExtractAtoms's config-read- * try/catch has always produced).+ * The model resolution `runPhaseExtractAtoms` uses, shared with the+ * `gbrain models` row so the two cannot diverge (`source` and `label` come+ * from the SAME call as `model`). Chain (#6675, decision D3 option B):+ * `models.dream.extract_atoms` > `models.tier.utility` > the key-aware+ * `resolveTierDefault('utility')`. `models.default` and `GBRAIN_MODEL` are+ * deliberately skipped: a frontier generic default must not become the model+ * of the highest-volume dream phase (its cost cap prices the utility tier).+ * Values are trimmed and alias-resolved like `resolveModelDetailed`'s steps.+ * Fail-soft: a throwing config read routes to the tier default.*/export async function resolveExtractAtomsModelWithSource(engine: BrainEngine,-): Promise<{ model: string; source: 'config' | 'tier_default' }> {- let configuredModel: string | null = null;+): Promise<{ model: string; source: 'config' | 'tier_config' | 'tier_default'; label?: string }> {try {- configuredModel = await engine.getConfig('models.dream.extract_atoms');+ const own = (await engine.getConfig(EXTRACT_ATOMS_MODEL_KEY))?.trim();+ if (own) return { model: await resolveAlias(engine, own), source: 'config', label: `config: ${EXTRACT_ATOMS_MODEL_KEY}` };+ const tier = (await engine.getConfig('models.tier.utility'))?.trim();+ if (tier) return { model: await resolveAlias(engine, tier), source: 'tier_config', label: 'config: models.tier.utility' };} catch {// Fail-soft — fall through to the tier default.}- return configuredModel- ? { model: configuredModel, source: 'config' }- : { model: resolveTierDefault('utility'), source: 'tier_default' };+ return { model: resolveTierDefault('utility'), source: 'tier_default' };}/** String-returning wrapper for runtime callers (`runPhaseExtractAtoms`). */diff --git a/test/claude-cli-recipe.test.ts b/test/claude-cli-recipe.test.tsindex 4ddb39d6ce..cb13a08554 100644--- a/test/claude-cli-recipe.test.ts+++ b/test/claude-cli-recipe.test.ts@@ -94,6 +94,9 @@ describe('claude-cli recipe registration', () => {expect(recipe!.touchpoints.chat!.models).toContain('claude-opus-5');expect(recipe!.touchpoints.chat!.models).toContain('claude-opus-4-8');expect(recipe!.touchpoints.chat!.models).toContain('claude-sonnet-5');+ // #6675: the CLI serves Haiku 5.5 (the anthropic recipe lists it), so both lists carry it.+ expect(recipe!.touchpoints.chat!.models).toContain('claude-haiku-5-5');+ expect(recipe!.touchpoints.expansion!.models).toContain('claude-haiku-5-5');expect(recipe!.touchpoints.embedding).toBeUndefined();// Expansion IS declared. Without it `isAvailable('expansion')` is false// for every claude-cli model, so expandQuery() returns [query] before anydiff --git a/test/models-per-task-extract-atoms.serial.test.ts b/test/models-per-task-extract-atoms.serial.test.tsindex 821b39fe17..c7a8825208 100644--- a/test/models-per-task-extract-atoms.serial.test.ts+++ b/test/models-per-task-extract-atoms.serial.test.ts@@ -1,30 +1,38 @@/**- * `gbrain models` per-task routing report omitted `models.dream.extract_atoms`- * from PER_TASK_KEYS even though `runPhaseExtractAtoms()` (src/core/cycle/- * extract-atoms.ts) reads that config key directly as a real, separately- * priced routing decision. Operators had no way to see or verify extract_atoms- * routing via the standard `gbrain models` diagnostic — the routing itself- * worked, only the report was missing an entry.+ * `gbrain models` per-task routing report: the `models.dream.extract_atoms`+ * row, and the resolver it shares with `runPhaseExtractAtoms()`.*- * The report entry calls `resolveExtractAtomsModel()` — the SAME function- * `runPhaseExtractAtoms` calls — rather than the generic `resolveModel()`- * chain, because extract_atoms's actual runtime resolution is narrower (DB- * config -> `resolveTierDefault('utility')` only; it does NOT honor- * `models.tier.utility` / `models.default` / an env var the way the generic- * chain does). Reporting via the generic chain would show a resolved value- * that can diverge from what extraction actually uses whenever one of those- * intermediate overrides is set without `models.dream.extract_atoms` itself- * being set — this is pinned by the second test below.+ * The row calls `resolveExtractAtomsModelWithSource()`, the SAME function the+ * phase calls, so the report can never diverge from what extraction runs.+ * #6675 (decision D3, option B): the chain is `models.dream.extract_atoms` >+ * `models.tier.utility` > the key-aware utility default. `models.default` and+ * `GBRAIN_MODEL` alone do NOT move this phase: a frontier `models.default`+ * must not become the model of the highest-volume dream phase.*- * Follows the same StubConfigEngine + runModels(['--json']) pattern as- * test/contextual-synopsis-model.serial.test.ts's "reports the ... route in- * gbrain models JSON" case.+ * Follows the StubConfigEngine + runModels(['--json']) pattern of+ * test/contextual-synopsis-model.serial.test.ts. Env is pinned keyless so the+ * built-in default resolves the same way on every machine.*/-import { describe, test, expect } from 'bun:test';+import { afterEach, beforeEach, describe, test, expect } from 'bun:test';+import { join } from 'node:path';+import { tmpdir } from 'node:os';import { runModels } from '../src/commands/models.ts';-import { resolveExtractAtomsModel } from '../src/core/cycle/extract-atoms.ts';+import { resolveExtractAtomsModel, resolveExtractAtomsModelWithSource } from '../src/core/cycle/extract-atoms.ts';import { resolveTierDefault } from '../src/core/model-config.ts';+const PINNED = ['ANTHROPIC_API_KEY', 'OPENAI_API_KEY', 'GBRAIN_HOME', 'GBRAIN_MODEL'] as const;+let saved: Record<string, string | undefined>;+beforeEach(() => {+ saved = {};+ for (const k of PINNED) { saved[k] = process.env[k]; delete process.env[k]; }+ process.env.GBRAIN_HOME = join(tmpdir(), `gbrain-extract-atoms-row-missing-${process.pid}`);+});+afterEach(() => {+ for (const k of PINNED) {+ if (saved[k] === undefined) delete process.env[k]; else process.env[k] = saved[k];+ }+});+class StubConfigEngine {private readonly config = new Map<string, string>();@@ -42,7 +50,7 @@ class StubConfigEngine {}async function captureModelsJson(engine: StubConfigEngine): Promise<{- per_task: Array<{ key: string; tier: string; resolved: string; source: string; description: string }>;+ per_task: Array<{ key: string; tier: string; resolved: string; source: string; description: string; newer_available?: { command: string } }>;}> {let stdout = '';const originalWrite = process.stdout.write;@@ -74,20 +82,58 @@ describe('gbrain models per-task report — extract_atoms entry', () => {});});- test('ignores models.tier.utility (extract_atoms does not honor it) — pins the narrow-resolver divergence this report exists to avoid hiding', async () => {+ test('honors models.tier.utility when its own key is unset, and the runtime resolver agrees (#6675)', async () => {const engine = new StubConfigEngine();- engine.set('models.tier.utility', 'codex-proxy:should-be-ignored-by-extract-atoms');+ engine.set('models.tier.utility', 'openai:gpt-6-luna');- const report = await captureModelsJson(engine);-- const entry = report.per_task.find((r) => r.key === 'models.dream.extract_atoms');+ const entry = (await captureModelsJson(engine)).per_task.find((r) => r.key === 'models.dream.extract_atoms');expect(entry).toBeDefined();- // The generic resolveModel() chain WOULD have picked up models.tier.utility- // here; extract_atoms's actual runtime does not, so the report must not- // claim it does.+ expect(entry!.resolved).toBe('openai:gpt-6-luna');+ expect(entry!.source).toBe('config: models.tier.utility');+ expect(await resolveExtractAtomsModel(engine as never)).toBe('openai:gpt-6-luna');+ });++ test('models.default alone does not change the model (D3)', async () => {+ const engine = new StubConfigEngine();+ engine.set('models.default', 'openai:gpt-6-sol');+ const entry = (await captureModelsJson(engine)).per_task.find((r) => r.key === 'models.dream.extract_atoms');expect(entry!.resolved).toBe(resolveTierDefault('utility'));- expect(entry!.resolved).not.toBe('codex-proxy:should-be-ignored-by-extract-atoms');expect(entry!.source).toBe('tier.utility (caller-specific)');+ expect(await resolveExtractAtomsModel(engine as never)).toBe(resolveTierDefault('utility'));+ });++ test('GBRAIN_MODEL alone does not change the model (D3)', async () => {+ process.env.GBRAIN_MODEL = 'openai:gpt-6-sol';+ expect(await resolveExtractAtomsModel(new StubConfigEngine() as never)).toBe(resolveTierDefault('utility'));+ });++ test('models.dream.extract_atoms wins over the tier', async () => {+ const engine = new StubConfigEngine();+ engine.set('models.tier.utility', 'claude-cli:claude-haiku-5-5');+ engine.set('models.dream.extract_atoms', 'openai:gpt-5.6-luna');+ const entry = (await captureModelsJson(engine)).per_task.find((r) => r.key === 'models.dream.extract_atoms');+ expect(entry).toMatchObject({ resolved: 'openai:gpt-5.6-luna', source: 'config: models.dream.extract_atoms' });+ expect(await resolveExtractAtomsModel(engine as never)).toBe('openai:gpt-5.6-luna');+ });++ test('an inherited tier route does not emit a row-key newer_available hint; the row key does', async () => {+ const engine = new StubConfigEngine();+ engine.set('models.tier.utility', 'anthropic:claude-haiku-4-5');+ let entry = (await captureModelsJson(engine)).per_task.find((r) => r.key === 'models.dream.extract_atoms');+ expect(entry!.source).toBe('config: models.tier.utility');+ expect(entry!.newer_available).toBeUndefined();++ engine.set('models.dream.extract_atoms', 'anthropic:claude-haiku-4-5');+ entry = (await captureModelsJson(engine)).per_task.find((r) => r.key === 'models.dream.extract_atoms');+ expect(entry!.newer_available?.command).toBe('gbrain config set models.dream.extract_atoms anthropic:claude-haiku-5-5');+ });++ test('resolver source is config only for its own key', async () => {+ const engine = new StubConfigEngine();+ engine.set('models.tier.utility', 'claude-cli:claude-haiku-5-5');+ expect(await resolveExtractAtomsModelWithSource(engine as never)).toMatchObject({ source: 'tier_config', label: 'config: models.tier.utility' });+ engine.set('models.dream.extract_atoms', 'openai:gpt-5.6-luna');+ expect(await resolveExtractAtomsModelWithSource(engine as never)).toMatchObject({ source: 'config', label: 'config: models.dream.extract_atoms' });});test('falls back to the same tier default when fully unconfigured, matching the runtime resolver directly', async () => {@@ -97,5 +143,6 @@ describe('gbrain models per-task report — extract_atoms entry', () => {const entry = report.per_task.find((r) => r.key === 'models.dream.extract_atoms');expect(entry).toBeDefined();expect(entry!.resolved).toBe(await resolveExtractAtomsModel(engine as never));+ expect(entry!.resolved).toBe(resolveTierDefault('utility'));});});