From 2ba63ddec5e4e2a790a9e18a48c2f1b5573920e7 Mon Sep 17 00:00:00 2001 From: Garry Tan Date: Wed, 22 Jul 2026 12:16:01 -0700 Subject: [PATCH] fix(cycle): honor DB-plane config for incremental_extract_include_frontmatter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The gate read loadConfig() (file/env plane) only, but the documented enable command — gbrain config set autopilot.incremental_extract_include_frontmatter true — writes the DB plane via engine.setConfig, so the feature could never be turned on the documented way (silent no-op, #2120 class). Now the file plane wins when the key is present there; otherwise the DB plane is consulted, matching the autopilot.auto_drain.* read pattern. Co-Authored-By: Claude Fable 5 --- src/core/cycle.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/core/cycle.ts b/src/core/cycle.ts index 5d38e6cc1..2441bc72d 100644 --- a/src/core/cycle.ts +++ b/src/core/cycle.ts @@ -999,7 +999,18 @@ async function runPhaseExtract( const { loadConfig } = await import('./config.ts'); // Default off: the incremental cycle extracts body links only unless the // operator opts in to keeping externally-edited frontmatter links fresh too. - const includeFrontmatter = loadConfig()?.autopilot?.incremental_extract_include_frontmatter === true; + // Both planes, file wins (env > file > DB precedence, per loadConfigWithEngine): + // `gbrain config set autopilot.incremental_extract_include_frontmatter true` + // writes the DB plane (engine.setConfig), so a file-plane-only read here + // would make the documented enable command a silent no-op (#2120 class). + const fileVal = loadConfig()?.autopilot?.incremental_extract_include_frontmatter; + let includeFrontmatter = fileVal === true; + if (fileVal === undefined) { + try { + includeFrontmatter = + (await engine.getConfig('autopilot.incremental_extract_include_frontmatter')) === 'true'; + } catch { /* config table unreadable → default off */ } + } // Extract is read-mostly against the filesystem + write to links table. // Honor dryRun by skipping with a 'skipped' entry: extract doesn't have // a clean dry-run mode today and runCycle should be honest about it.