Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix(chronicle): advisor and doctor say auto_chronicle=true has no effect (#5876)
garrytane8e4f7a9005f
diff --git a/docs/architecture/key-files/core-services-1.md b/docs/architecture/key-files/core-services-1.mdindex 9e4555a5c7..f9066e086f 100644--- a/docs/architecture/key-files/core-services-1.md+++ b/docs/architecture/key-files/core-services-1.md@@ -25,7 +25,7 @@ Current behavior and load-bearing invariants; history belongs in Git and CHANGEL- `src/core/budget/budget-tracker.ts` — the keystone budget primitive. One typed error (`BudgetExhausted` with `reason: 'cost' | 'runtime' | 'no_pricing'`), one schema-stable audit JSONL at `~/.gbrain/audit/budget-YYYY-Www.jsonl`. Contracts: `record()` throws when cumulative spend exceeds cap (the cap is a real ceiling, not a suggestion); `reserve()` admission checks cumulative + OUTSTANDING spend — each admitted projection is held until its `record()` settles it, so N concurrent callers (skillopt's validation gate) can't all pass against the same cumulative and breach `--max-cost-usd` by (N-1)×per-call cost; `reserve()` hard-fails with `reason: 'no_pricing'` when `maxCostUsd` is set AND the model is missing from pricing maps (warn-once preserved when cap is unset); `lookupPricing` normalizes recipe aliases through `resolveRecipe` before consulting the pricing tables, so `claude-cli:haiku` prices exactly like `claude-cli:claude-haiku-4-5-20251001` at `reserve()`, `record()` and `isModelPriceable()` alike (the gateway reserves with the pre-resolution string the user configured); `extractUsageFromError(err, fallback)` returns `err.usage` when the SDK provides it, else the pessimistic fallback (caller passes `maxOutputTokens`, not the optimistic pre-call estimate). `onExhausted(cb)` fires once synchronously BEFORE the throw propagates so callers can persist checkpoints. Pricing math (`reservationCostUsd`, overrides, free local providers, unknown-price `null`) lives in the pure `src/core/budget/reservation-cost.ts`, shared with skillopt preflight's impossible-reservation check so the two cannot disagree. Every `record()` also feeds an in-memory model ledger keyed by (requested model, served model, touchpoint, purpose) — updated BEFORE the cap throw and before the unpriced early return — exposed as `snapshot().models`; `BudgetActualUsage` carries `requestedModelId`, `purpose`, `failed`, `countsAsCall` (default true) and `estimated`, and rows track `calls` (gateway operations), `attempts` (every record), `failed_calls`, tokens, `cost_usd` (`null` when unpriced) and `cost_basis` (`estimated` if any contributing record was). `src/core/budget/models-used.ts` maps labels to touchpoints (`gateway.chat`→chat, `gateway.expand*`→expansion, `gateway.embed*`→embedding, `gateway.rerank*`→rerank, `gateway.ocr*`→ocr, else other), builds receipt rows (`buildModelsUsed`), merges resumed segments and renders the "Models called" table. No DB change. Shared by brainstorm, cycle/budget-meter, and eval-contradictions; `BudgetMeter` keeps its public shape over it (`schema_version: 1` stamped on every dream-budget audit line). Pinned by 18 unit cases.-- `src/core/chronicle/{eligibility,config,backstop,extract-events,ontology,narrative}.ts` + `src/eval/chronicle/harness.ts` + `src/commands/eval-chronicle.ts` — Life Chronicle: the temporal spine. `eligibility.isChronicleEligible` decides which pages auto-emit events (meeting/conversation/calendar-event + directory rescue; diary and event pages NEVER eligible — privacy + anti-loop). `backstop.runChronicleBackstop` is the put_page hook body (fires ONLY on `status==='imported'` + the auto-link trust gate + the default-OFF `auto_chronicle` flag; enqueues a `chronicle_extract` minion job — LLM never runs on the write path). `extract-events.runChronicleExtract` is the job body: deterministic when/who, injectable judge (default = chat gateway; output cap 4000 tokens by default, operator override `chronicle.judge_max_tokens`), an ALL-or-nothing parse barrier (`isValidProposal` requires a real parseable date — a malformed batch writes NOTHING), then content-addressed `life/events/` pages + a `timeline_entries` projection via `engine.upsertEventProjection` (dedup `(event_page_id, date)`; idempotent re-runs). An unusable judge response is never recorded as `no_events`: a `stopReason: 'length'` truncation or a no-JSON-array response (`parseJudgeJson` returns `null` on parse failure; `[]` only for a legitimate empty array) surfaces as `status: 'skipped'` with reason `judge_truncated` / `judge_parse_failed`. `ontology.ts` carries the deterministic pieces of the bi-temporal per-entity ontology that RIDES THE `facts` TABLE (migration v122 adds `dimension`/`value`/`value_hash`/`dim_status`): `valueHash` (normalized, timestamp-free; the v188 dedup index adds the stint's `valid_from`, so a crash-retry conflicts while a same-provenance return to an earlier value records a new interval), `normalizeDimension` (seed alias lexicon), `isNovelDimension` (novel → quarantined, excluded from resolution/context until confirmed). The engine methods (`mergeOntologyFact` — corroborate on same value (noop when the same provenance already observed it during the current stint), forward-supersede via `valid_until`+`superseded_by` on a new value, backdated conflicts kept + flagged; `getOntology` with `--asof` valid-time travel; `discoverOntologyDimensions`; `findOntologyConflicts` — currently-open rows only) live in BOTH engines; both engines are on the R8 `valid_until` write allow-list (engine-layer, `dimension IS NOT NULL` rows only). Chronicle reads (`getTimelineForDate`/`getSince`/`getLastSeen`/`getOnThisDay`) JOIN the depth page (`deleted_at IS NULL`), hide soft-deleted event projections at READ time, and order by event `effective_date` for intra-day sequence. Ops: `chronicle_day`/`chronicle_since`/`chronicle_last_seen`/`chronicle_on_this_day`/`ontology_*`/`volunteer_chronicle` (agent orientation via `src/core/context/chronicle-context.ts`)/`chronicle_backfill` (admin, localOnly). Diary privacy: fail-closed for `ctx.remote !== false` callers — diary-sourced ontology + conflict values are redacted, the four timeline read ops (`chronicle_day`/`chronicle_since`/`chronicle_on_this_day` + `volunteer_chronicle`'s `recent_timeline`) drop rows whose depth page, event page, or `source` provenance lives under `life/diary/`, and `chronicle_last_seen` answers the never-seen shape (`last_date`/`last_event_slug`/`days_ago` all null) when the latest sighting is diary-sourced or a diary page is queried as the entity. Remote callers read only `visibility = 'world'` observations, like recall: `getOntology`/`findOntologyConflicts` take a `visibility` filter applied before resolution and the conflict HAVING. `ontology_propose` commits through `coordinatedDatabaseWrite` on a managed brain. Page visibility rides the same policy: `ontology_get`/`ontology_conflicts`/`volunteer_chronicle`'s ontologies resolve through `readPolicyOpts`, and both engines' `getOntology`/`findOntologyConflicts` apply `privateProvenanceFilterFragment` (an observation whose provenance page, looked up in the fact's own source, is `visibility: private` is dropped BEFORE per-dimension resolution and before the conflict HAVING, so an untrusted caller resolves the newest value they may see rather than a private value or a hole). The chronicle reads' event-page LEFT JOIN carries the caller's source scope in BOTH engines, so a scoped read can't surface another source's event pages through the join. Search: `applyChronicleTypeBoost` in `search/hybrid.ts` (bounded [1.0,1.25], fires only inside the `recency !== 'off'` post-fusion branch → non-temporal search bit-for-bit unchanged). Advisor collector `collect-chronicle.ts` (conflicts + coverage gap); doctor `chronicle_projection_health` (BRAIN category). Eval: `gbrain eval chronicle` — deterministic, own in-memory PGLite, 6 gold tasks (day order, last-seen, supersession, asof, conflict, isolation), exit 0 iff 6/6. Tests: `test/chronicle-*.test.ts`, `test/eval-chronicle.test.ts`.+- `src/core/chronicle/{eligibility,config,backstop,extract-events,ontology,narrative}.ts` + `src/eval/chronicle/harness.ts` + `src/commands/eval-chronicle.ts` — Life Chronicle: the temporal spine. `eligibility.isChronicleEligible` decides which pages auto-emit events (meeting/conversation/calendar-event + directory rescue; diary and event pages NEVER eligible — privacy + anti-loop). `backstop.runChronicleBackstop` is the former put_page hook body (fires ONLY on `status==='imported'` + the auto-link trust gate + the default-OFF `auto_chronicle` flag; enqueues a `chronicle_extract` minion job); it currently has no caller, so `auto_chronicle` has no effect and `chronicle_backfill` is the only producer of `chronicle_extract` jobs. `extract-events.runChronicleExtract` is the job body: deterministic when/who, injectable judge (default = chat gateway; output cap 4000 tokens by default, operator override `chronicle.judge_max_tokens`), an ALL-or-nothing parse barrier (`isValidProposal` requires a real parseable date — a malformed batch writes NOTHING), then content-addressed `life/events/` pages + a `timeline_entries` projection via `engine.upsertEventProjection` (dedup `(event_page_id, date)`; idempotent re-runs). An unusable judge response is never recorded as `no_events`: a `stopReason: 'length'` truncation or a no-JSON-array response (`parseJudgeJson` returns `null` on parse failure; `[]` only for a legitimate empty array) surfaces as `status: 'skipped'` with reason `judge_truncated` / `judge_parse_failed`. `ontology.ts` carries the deterministic pieces of the bi-temporal per-entity ontology that RIDES THE `facts` TABLE (migration v122 adds `dimension`/`value`/`value_hash`/`dim_status`): `valueHash` (normalized, timestamp-free; the v188 dedup index adds the stint's `valid_from`, so a crash-retry conflicts while a same-provenance return to an earlier value records a new interval), `normalizeDimension` (seed alias lexicon), `isNovelDimension` (novel → quarantined, excluded from resolution/context until confirmed). The engine methods (`mergeOntologyFact` — corroborate on same value (noop when the same provenance already observed it during the current stint), forward-supersede via `valid_until`+`superseded_by` on a new value, backdated conflicts kept + flagged; `getOntology` with `--asof` valid-time travel; `discoverOntologyDimensions`; `findOntologyConflicts` — currently-open rows only) live in BOTH engines; both engines are on the R8 `valid_until` write allow-list (engine-layer, `dimension IS NOT NULL` rows only). Chronicle reads (`getTimelineForDate`/`getSince`/`getLastSeen`/`getOnThisDay`) JOIN the depth page (`deleted_at IS NULL`), hide soft-deleted event projections at READ time, and order by event `effective_date` for intra-day sequence. Ops: `chronicle_day`/`chronicle_since`/`chronicle_last_seen`/`chronicle_on_this_day`/`ontology_*`/`volunteer_chronicle` (agent orientation via `src/core/context/chronicle-context.ts`)/`chronicle_backfill` (admin, localOnly). Diary privacy: fail-closed for `ctx.remote !== false` callers — diary-sourced ontology + conflict values are redacted, the four timeline read ops (`chronicle_day`/`chronicle_since`/`chronicle_on_this_day` + `volunteer_chronicle`'s `recent_timeline`) drop rows whose depth page, event page, or `source` provenance lives under `life/diary/`, and `chronicle_last_seen` answers the never-seen shape (`last_date`/`last_event_slug`/`days_ago` all null) when the latest sighting is diary-sourced or a diary page is queried as the entity. Remote callers read only `visibility = 'world'` observations, like recall: `getOntology`/`findOntologyConflicts` take a `visibility` filter applied before resolution and the conflict HAVING. `ontology_propose` commits through `coordinatedDatabaseWrite` on a managed brain. Page visibility rides the same policy: `ontology_get`/`ontology_conflicts`/`volunteer_chronicle`'s ontologies resolve through `readPolicyOpts`, and both engines' `getOntology`/`findOntologyConflicts` apply `privateProvenanceFilterFragment` (an observation whose provenance page, looked up in the fact's own source, is `visibility: private` is dropped BEFORE per-dimension resolution and before the conflict HAVING, so an untrusted caller resolves the newest value they may see rather than a private value or a hole). The chronicle reads' event-page LEFT JOIN carries the caller's source scope in BOTH engines, so a scoped read can't surface another source's event pages through the join. Search: `applyChronicleTypeBoost` in `search/hybrid.ts` (bounded [1.0,1.25], fires only inside the `recency !== 'off'` post-fusion branch → non-temporal search bit-for-bit unchanged). Advisor collector `collect-chronicle.ts` (conflicts + coverage gap + `auto_chronicle_no_effect` when the setting is on); doctor `chronicle_projection_health` and `auto_chronicle` (`checks/auto-chronicle.ts`, warns while `auto_chronicle=true`; BRAIN category). Eval: `gbrain eval chronicle` — deterministic, own in-memory PGLite, 6 gold tasks (day order, last-seen, supersession, asof, conflict, isolation), exit 0 iff 6/6. Tests: `test/chronicle-*.test.ts`, `test/eval-chronicle.test.ts`.- `src/core/chunkers/` — 3-tier chunking (recursive, semantic, LLM-guided). `code.ts` is a tree-sitter-based semantic chunker for 30 languages (plus SQL via DerekStride/tree-sitter-sql) with embedded-asset WASMs (`src/assets/wasm/`), `@dqbd/tiktoken` cl100k_base tokenizer, small-sibling merging. `CHUNKER_VERSION` is folded into `importCodeFile`'s `content_hash` so chunker shape changes force clean re-chunks across releases. `extractSymbolName` has an inline SQL branch (`extractSqlSymbolName`) diving through DerekStride's `statement` wrapper into the inner DDL child (`create_table`/`create_function`/`create_view`/`create_index`/`create_procedure`/`create_type`/`create_schema`/`create_database`/`create_trigger`/`alter_table`/`alter_view`) and extracting the target identifier via the `name` field with identifier-shaped fallback; DML kinds (`select`/`insert`/`update`/`delete`/`merge`/`with`) deliberately return null so chunks emit unnamed (code-def is a DDL signal). `normalizeSymbolType` has parallel SQL branches mapping `create_table → 'table'`, `create_view → 'view'`, etc. `DEF_TYPES` (owned by `src/core/chunkers/def-types.ts`, re-exported by `src/commands/code-def.ts` — see that entry) carries the SQL kinds (`'table' | 'view' | 'index' | 'procedure' | 'schema' | 'database' | 'trigger'`) so the new chunks surface in `gbrain code-def <name>` queries.diff --git a/docs/guides/troubleshooting.md b/docs/guides/troubleshooting.mdindex 5db0e92779..15288fe4d0 100644--- a/docs/guides/troubleshooting.md+++ b/docs/guides/troubleshooting.md@@ -182,3 +182,30 @@ previous statement while you report it:The guard is retired in the next release; that release prints a one-time noticewhen the inert setting is still present.++## auto_chronicle has no effect++**Say to your agent:** *"Why aren't my meetings showing up as timeline events?"*++`gbrain config set auto_chronicle true` is accepted, but in this version no+write or cycle step reads it: nothing enqueues chronicle extraction, so new+meetings and conversations are not swept into `life/events/` pages on their+own. `gbrain doctor` reports this as the `auto_chronicle` check (code+`auto_chronicle_no_effect`) and the advisor shows the same finding.++Sweep recent meetings by hand instead. Preview first, then run it:++```bash+gbrain chronicle-backfill --dry-run+gbrain chronicle-backfill+```++To clear the setting so the warning stops:++```bash+gbrain config unset auto_chronicle+```++The backfill is not yet idempotent, so run it when you want new events rather+than on a schedule. Restoring the automatic trigger is tracked for a later+release.diff --git a/src/commands/doctor/checks/auto-chronicle.ts b/src/commands/doctor/checks/auto-chronicle.tsnew file mode 100644index 0000000000..67bb3f1145--- /dev/null+++ b/src/commands/doctor/checks/auto-chronicle.ts@@ -0,0 +1,29 @@+/**+ * auto_chronicle (#5876): the `auto_chronicle` config key has no reader in this+ * version (the put_page chronicle backstop was dropped and nothing else enqueues+ * `chronicle_extract`), so a brain with it set to true silently gets no events.+ * Warns when the key is on, naming the manual sweep and the unset command.+ */+import { isAutoChronicleEnabled } from '../../../core/chronicle/config.ts';+import type { Check } from '../../doctor.ts';+import { connectedEngine, type DoctorContext, type DoctorEntry } from '../context.ts';++export const AUTO_CHRONICLE_DOCS = 'docs/guides/troubleshooting.md#auto_chronicle-has-no-effect';++async function runAutoChronicle(ctx: DoctorContext): Promise<Check[]> {+ const checks: Check[] = [];+ const enabled = await isAutoChronicleEnabled(connectedEngine(ctx));+ checks.push(enabled+ ? {+ name: 'auto_chronicle',+ status: 'warn',+ message: 'auto_chronicle=true currently has no effect: no write or cycle step enqueues chronicle extraction, so new meetings are not swept into events. ' ++ 'Fix: run `gbrain chronicle-backfill --dry-run`, then `gbrain chronicle-backfill`; `gbrain config unset auto_chronicle` clears the setting.',+ details: { code: 'auto_chronicle_no_effect', enabled: true, cause: 'auto_chronicle has no reader in this version',+ fix: 'gbrain chronicle-backfill --dry-run', docs: AUTO_CHRONICLE_DOCS },+ }+ : { name: 'auto_chronicle', status: 'ok', message: 'auto_chronicle is off.', details: { enabled: false } });+ return checks;+}++export const autoChronicleEntry: DoctorEntry = { name: 'auto_chronicle', emits: ['auto_chronicle'], run: runAutoChronicle };diff --git a/src/commands/doctor/registry.ts b/src/commands/doctor/registry.tsindex ee99f4414a..bea04c5a1f 100644--- a/src/commands/doctor/registry.ts+++ b/src/commands/doctor/registry.ts@@ -80,6 +80,7 @@ import {import { queueHealthEntry, indexAuditEntry, imageAssetsEntry } from './checks/queue-assets.ts';import { legacyJobAuthorityEntry } from './checks/legacy-job-authority.ts';import { syncFreshnessEntry, searchModeEntry } from './checks/sync-search.ts';+import { autoChronicleEntry } from './checks/auto-chronicle.ts';import { decideHealthEntry } from './checks/decide.ts';import { unlinkedFactsEntry } from './checks/unlinked-facts.ts';import { STOP_DOCTOR, type DoctorContext, type DoctorEntry } from './context.ts';@@ -139,6 +140,7 @@ export const DOCTOR_CHECK_REGISTRY: readonly DoctorEntry[] = [syncFreshnessEntry,decideHealthEntry,unlinkedFactsEntry,+ autoChronicleEntry,searchModeEntry,];diff --git a/src/core/advisor/collect-chronicle.ts b/src/core/advisor/collect-chronicle.tsindex 284da97d5b..ecf935a64c 100644--- a/src/core/advisor/collect-chronicle.ts+++ b/src/core/advisor/collect-chronicle.ts@@ -2,8 +2,10 @@// Brain-state (not workspace-dependent), so it runs over MCP too. Two signals:// - unresolved ontology conflicts (genuine disagreement, not supersession)// - recent meetings not yet swept into the timeline (coverage gap)+// - auto_chronicle=true, which has no effect in this version (#5876)// Advisory display only (no dispatch_id) — the user runs the shown command.import type { AdvisorCollector, AdvisorContext, AdvisorFinding } from './types.ts';+import { isAutoChronicleEnabled } from '../chronicle/config.ts';export const collectChronicle: AdvisorCollector = {id: 'chronicle',@@ -45,7 +47,7 @@ export const collectChronicle: AdvisorCollector = {id: 'chronicle_coverage_gap',severity: 'info',title: `${gap} recent meeting(s) aren't in the timeline yet`,- detail: 'Sweep them into events with `gbrain chronicle-backfill`, or enable auto_chronicle.',+ detail: 'Sweep them into events with `gbrain chronicle-backfill`.',fix: { command_argv: ['gbrain', 'chronicle-backfill'] },collector: 'chronicle',ask_user: true,@@ -55,6 +57,24 @@ export const collectChronicle: AdvisorCollector = {// timeline_entries.event_page_id may be absent pre-migration; ignore.}+ // 3. #5876: the setting is accepted but nothing reads it.+ try {+ if (await isAutoChronicleEnabled(ctx.engine)) {+ findings.push({+ id: 'auto_chronicle_no_effect',+ severity: 'warn',+ title: 'auto_chronicle=true currently has no effect',+ detail: 'No write or cycle step enqueues chronicle extraction in this version, so new meetings are not swept into events. ' ++ 'Run `gbrain chronicle-backfill` to sweep them; `gbrain config unset auto_chronicle` clears the setting.',+ fix: { command_argv: ['gbrain', 'chronicle-backfill', '--dry-run'] },+ collector: 'chronicle',+ ask_user: true,+ });+ }+ } catch {+ // Config read failures leave the other findings intact.+ }+return findings;},};diff --git a/src/core/chronicle/config.ts b/src/core/chronicle/config.tsindex ea28c0471f..1df538efa7 100644--- a/src/core/chronicle/config.ts+++ b/src/core/chronicle/config.ts@@ -3,8 +3,8 @@ import type { BrainEngine } from '../engine.ts';/*** Auto-emit is OFF by default (plan D5.5: spend posture — extraction spends LLM- * tokens per eligible write). Enable with `gbrain config set auto_chronicle true`.- * The eval-gated default-flip is the headline fast-follow (TODO T8).+ * tokens per eligible write). The only caller is the unwired backstop, so the+ * setting currently has no effect; advisor and doctor `auto_chronicle` say so (#5876).*/export async function isAutoChronicleEnabled(engine: BrainEngine): Promise<boolean> {const val = await engine.getConfig('auto_chronicle');diff --git a/src/core/doctor-categories.ts b/src/core/doctor-categories.tsindex 331e55f8ba..cc911defa4 100644--- a/src/core/doctor-categories.ts+++ b/src/core/doctor-categories.ts@@ -69,6 +69,7 @@ export const BRAIN_CHECK_NAMES: ReadonlySet<string> = new Set(['calibration_freshness','child_table_orphans','chronicle_projection_health',+ 'auto_chronicle','code_chunk_metadata','content_hash_duplicates','content_sanity_audit_recent',diff --git a/test/auto-chronicle-no-effect-5876.test.ts b/test/auto-chronicle-no-effect-5876.test.tsnew file mode 100644index 0000000000..a3c5203b4a--- /dev/null+++ b/test/auto-chronicle-no-effect-5876.test.ts@@ -0,0 +1,55 @@+/**+ * #5876 (honest half): `auto_chronicle=true` has no reader in this version.+ *+ * Protects: the chronicle advisor no longer tells users to enable+ * auto_chronicle, and both the advisor and doctor say plainly that+ * `auto_chronicle=true` currently has no effect, naming the manual sweep.+ * Fails when: the coverage-gap finding recommends enabling the dead setting,+ * or a brain with it on gets no advisor/doctor signal.+ * Seams: none; in-memory PGLite.+ */+import { afterAll, beforeAll, beforeEach, describe, expect, test } from 'bun:test';+import { PGLiteEngine } from '../src/core/pglite-engine.ts';+import { collectChronicle } from '../src/core/advisor/collect-chronicle.ts';+import type { AdvisorContext } from '../src/core/advisor/types.ts';+import { autoChronicleEntry } from '../src/commands/doctor/checks/auto-chronicle.ts';+import type { DoctorContext } from '../src/commands/doctor/context.ts';+import { categorizeCheck } from '../src/core/doctor-categories.ts';+import type { Check } from '../src/commands/doctor.ts';++let engine: PGLiteEngine;+const advisorCtx = () => ({ engine, remote: false } as unknown as AdvisorContext);+const doctorCtx = () => ({ engine, progress: { heartbeat() {} } } as unknown as DoctorContext);++beforeAll(async () => { engine = new PGLiteEngine(); await engine.connect({}); await engine.initSchema(); }, 120_000);+afterAll(async () => { await engine.disconnect(); });+beforeEach(async () => { await engine.unsetConfig('auto_chronicle'); });++describe('advisor', () => {+ test('the coverage gap names only the sweep, never the dead setting', async () => {+ await engine.putPage('meetings/2026-04-03', { type: 'meeting', title: 'Weekly sync', compiled_truth: 'x'.repeat(120) });+ const gap = (await collectChronicle.collect(advisorCtx())).find(f => f.id === 'chronicle_coverage_gap')!;+ expect(gap.detail).not.toContain('auto_chronicle');+ });++ test('auto_chronicle=true is reported as having no effect', async () => {+ expect((await collectChronicle.collect(advisorCtx())).some(f => f.id === 'auto_chronicle_no_effect')).toBe(false);+ await engine.setConfig('auto_chronicle', 'true');+ const finding = (await collectChronicle.collect(advisorCtx())).find(f => f.id === 'auto_chronicle_no_effect')!;+ expect(finding).toMatchObject({ severity: 'warn', title: 'auto_chronicle=true currently has no effect' });+ expect(finding.fix.command_argv).toEqual(['gbrain', 'chronicle-backfill', '--dry-run']);+ });+});++describe('doctor', () => {+ test('auto_chronicle check: ok when off, warn with code and fix when on', async () => {+ expect(categorizeCheck('auto_chronicle')).toBe('brain');+ const [off] = await autoChronicleEntry.run(doctorCtx()) as Check[];+ expect(off).toMatchObject({ name: 'auto_chronicle', status: 'ok' });+ await engine.setConfig('auto_chronicle', 'true');+ const [on] = await autoChronicleEntry.run(doctorCtx()) as Check[];+ expect(on).toMatchObject({ name: 'auto_chronicle', status: 'warn', details: { code: 'auto_chronicle_no_effect',+ fix: 'gbrain chronicle-backfill --dry-run', docs: 'docs/guides/troubleshooting.md#auto_chronicle-has-no-effect' } });+ expect(on.message).toContain('currently has no effect');+ });+});diff --git a/test/fixtures/goldens/doctor/json-pglite-degraded.json b/test/fixtures/goldens/doctor/json-pglite-degraded.jsonindex 95f3ecb7cd..3eb79122be 100644--- a/test/fixtures/goldens/doctor/json-pglite-degraded.json+++ b/test/fixtures/goldens/doctor/json-pglite-degraded.json@@ -1025,6 +1025,15 @@"name": "unlinked_facts","status": "ok"},+ {+ "category": "brain",+ "details": {+ "enabled": false+ },+ "message": "auto_chronicle is off.",+ "name": "auto_chronicle",+ "status": "ok"+ },{"category": "ops","message": "Mode: conservative (no per-key overrides — mode bundle is canonical).",diff --git a/test/fixtures/goldens/doctor/json-pglite-fresh.json b/test/fixtures/goldens/doctor/json-pglite-fresh.jsonindex 5e51eb5d56..a19a3ac751 100644--- a/test/fixtures/goldens/doctor/json-pglite-fresh.json+++ b/test/fixtures/goldens/doctor/json-pglite-fresh.json@@ -1025,6 +1025,15 @@"name": "unlinked_facts","status": "ok"},+ {+ "category": "brain",+ "details": {+ "enabled": false+ },+ "message": "auto_chronicle is off.",+ "name": "auto_chronicle",+ "status": "ok"+ },{"category": "ops","message": "Mode: conservative (no per-key overrides — mode bundle is canonical).",diff --git a/test/fixtures/goldens/doctor/registry-build-checks.json b/test/fixtures/goldens/doctor/registry-build-checks.jsonindex b40fae8128..39a18f2ddf 100644--- a/test/fixtures/goldens/doctor/registry-build-checks.json+++ b/test/fixtures/goldens/doctor/registry-build-checks.json@@ -553,6 +553,10 @@"category": "brain","name": "unlinked_facts"},+ {+ "category": "brain",+ "name": "auto_chronicle"+ },{"category": "ops","name": "chat_fallback_chain_inert"