Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix: cycle reads cycle.lint_fix from its own module and tolerates a lint result without pending_issues; behavior notice states the measured transcript cost (x6.75 parts, +9% embed tokens, 45,000-byte target)
garrytana1fae0f8c8f5
diff --git a/src/commands/lint.ts b/src/commands/lint.tsindex c0ccc7d88e..a18e979352 100644--- a/src/commands/lint.ts+++ b/src/commands/lint.ts@@ -616,11 +616,6 @@ function changedWhileLinting(sourceId: string, slug: string): OperationError {{ fix: readFix(`Shows page ${slug} in source ${sourceId} as it is now, with its revision.`, { argv: ['gbrain', 'get', '--source', sourceId, '--', slug] }) });}-/** `cycle.lint_fix` (default on): only an explicit falsy value makes the cycle's lint phase report-only; a config read failure keeps the default. */-export async function cycleLintFixEnabled(engine?: BrainEngine | null): Promise<boolean> {- return !/^\s*(false|0|off|no)\s*$/i.test(await engine?.getConfig('cycle.lint_fix').catch(() => null) ?? '');-}-/*** #5180: publish one lint repair through the persistence coordinator, the* only writer a managed brain's worktree accepts. Resolves the page's slugdiff --git a/src/core/behavior-change-notice.ts b/src/core/behavior-change-notice.tsindex 165f1e4dca..56fa7d4aa5 100644--- a/src/core/behavior-change-notice.ts+++ b/src/core/behavior-change-notice.ts@@ -55,8 +55,8 @@ import { mergedProviderEnv } from './ai/provider-env.ts';/** The first release that carries this notice. Set once, here, at ship time. */export const BEHAVIOR_NOTICE_SINCE: string = VERSION;-/** The measured re-ingest multiplier for (c), as prose. */-export const TRANSCRIPT_REINGEST_MULTIPLIER = 'about 6x';+/** The measured re-ingest page multiplier for (c), as prose (scripts/measure-transcript-split-cost.ts: 4 → 27 pages on a 1 MB session). */+export const TRANSCRIPT_REINGEST_MULTIPLIER = 'about 6.75x';export const BEHAVIOR_NOTICE_CODE = 'behavior_changes';export const BEHAVIOR_NOTICE_ID = `${BEHAVIOR_NOTICE_CODE}@${BEHAVIOR_NOTICE_SINCE}`;/** A brain created this recently, with no recorded baseline, counts as a fresh install. */@@ -220,7 +220,7 @@ export function behaviorChangesNotice(chain: ChainDisclosure | null, opts: { rem' Removing the chain is optional; ask the user (gbrain doctor --only chat_fallback_chain has the per-plane steps).');}items.push('On a managed brain, autopilot\'s lint phase now writes its repairs instead of only reporting them; `gbrain config set cycle.lint_fix false` turns that off.');- items.push(`Transcript re-ingest now splits transcripts into smaller parts (46,080-byte target, previously about 300 KB), ${TRANSCRIPT_REINGEST_MULTIPLIER} as many parts, and re-embeds each re-ingested transcript once.`);+ items.push(`Transcript re-ingest now splits transcripts into smaller parts (45,000-byte target, previously 300,000 bytes): ${TRANSCRIPT_REINGEST_MULTIPLIER} as many part pages and about 9% more embedding tokens (measured on a 1 MB session), and each re-ingested transcript re-embeds once.`);items.push('The mention linker rebuilds its gazetteer resume state once, so the first mention-extraction run after upgrading rescans pages.');const why = `gbrain v${BEHAVIOR_NOTICE_SINCE} changed ${items.length} behaviors on this brain. All stay on; this is a one-time disclosure, not a request for consent. ` +items.map((t, i) => `(${i + 1}) ${t}`).join(' ') +diff --git a/src/core/cycle.ts b/src/core/cycle.tsindex c5ec9f0c25..7123d3f476 100644--- a/src/core/cycle.ts+++ b/src/core/cycle.ts@@ -1023,7 +1023,7 @@ function checkAborted(signal?: AbortSignal): void {// going through runCycle's full setup cost.export async function runPhaseLint(brainDir: string, dryRun: boolean, engine?: BrainEngine | null, signal?: AbortSignal, sourceId?: string): Promise<PhaseResult> {try {- const { runLintCore, cycleLintFixEnabled } = await import('../commands/lint.ts');+ const [{ runLintCore }, { cycleLintFixEnabled }] = await Promise.all([import('../commands/lint.ts'), import('./cycle/lint-fix-setting.ts')]);// issue #1678: pass the cycle's live engine so lint's content-sanity// DB-plane lift REUSES it instead of creating + disconnecting a// competing module-style engine that nulls the shared db singleton@@ -1046,7 +1046,7 @@ export async function runPhaseLint(brainDir: string, dryRun: boolean, engine?: Bsummary: dryRun? `${issues} issue(s) found (dry-run, no writes)`: lintFix ? `${fixed} fix(es) applied, ${remaining} remaining` : `${issues} issue(s) found (report-only: cycle.lint_fix=false)`,- details: { issues, fixed, pages_scanned: result.pages_scanned, dryRun, lint_fix: lintFix, write_path: result.write_path, fix_pending: result.fix_pending, ...(result.pending_issues.length ? { pending: result.pending_issues } : {}) },+ details: { issues, fixed, pages_scanned: result.pages_scanned, dryRun, lint_fix: lintFix, write_path: result.write_path, fix_pending: result.fix_pending, ...(result.pending_issues?.length ? { pending: result.pending_issues } : {}) },};} catch (e) {return {diff --git a/src/core/cycle/lint-fix-setting.ts b/src/core/cycle/lint-fix-setting.tsnew file mode 100644index 0000000000..863d17a5de--- /dev/null+++ b/src/core/cycle/lint-fix-setting.ts@@ -0,0 +1,11 @@+import type { BrainEngine } from '../engine.ts';++/**+ * `cycle.lint_fix` (default on): only an explicit falsy value makes the+ * cycle's lint phase report-only; a config read failure keeps the default.+ * `gbrain lint --fix` is unaffected. Its own module so the cycle reads the+ * setting without depending on the lint command's export surface.+ */+export async function cycleLintFixEnabled(engine?: BrainEngine | null): Promise<boolean> {+ return !/^\s*(false|0|off|no)\s*$/i.test(await engine?.getConfig('cycle.lint_fix').catch(() => null) ?? '');+}diff --git a/test/behavior-change-notice.test.ts b/test/behavior-change-notice.test.tsindex d73547860c..ee8f926c8d 100644--- a/test/behavior-change-notice.test.ts+++ b/test/behavior-change-notice.test.ts@@ -142,7 +142,7 @@ for (const backend of testBackends()) {const plain = (await takeLocalBehaviorNotice(engine, 'cli', { cfg: null, brainKey: 'no-chain' }))!;expect(plain.why).not.toContain('chat_fallback_chain is live');expect(plain.why).toContain('cycle.lint_fix false');- expect(plain.why).toContain('about 6x');+ expect(plain.why).toContain('about 6.75x');expect(plain.why).toContain('mention linker');expect(plain.why).toContain('not a request for consent');expect(plain.fix?.argv).toEqual(['gbrain', 'doctor', '--only', 'behavior_changes', '--json']);