Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

test: watch the ledger path configDir() resolves, not raw GBRAIN_HOME

garrytand00da5c842b9
diff --git a/test/helpers/inherited-ledger-guard.ts b/test/helpers/inherited-ledger-guard.ts
index a9dfb8e05e..7373fc63ec 100644
--- a/test/helpers/inherited-ledger-guard.ts
+++ b/test/helpers/inherited-ledger-guard.ts
@@ -1,6 +1,6 @@
import { afterAll, expect } from 'bun:test';
import { readFileSync } from 'node:fs';
-import { join } from 'node:path';
+import { brainFirstLedgerPath } from '../../src/core/setup/brain-first.ts';
const read = (path: string): string | null => { try { return readFileSync(path, 'utf8'); } catch { return null; } };
@@ -10,9 +10,7 @@ const read = (path: string): string | null => { try { return readFileSync(path,
* each install its own GBRAIN_HOME with withEnv (#8434).
*/
export function guardInheritedInstructionLedger(): void {
- const home = process.env.GBRAIN_HOME;
- if (!home) return;
- const ledger = join(home, '.gbrain', 'agent-instructions.json');
+ const ledger = brainFirstLedgerPath();
const before = read(ledger);
afterAll(() => expect(read(ledger), `${ledger} changed during this file`).toBe(before));
}