Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix: pre-landing review fixes
garrytan677456b4d9cc
diff --git a/docs/guides/enforced-member.md b/docs/guides/enforced-member.mdindex 6510af036d..3d83c21d1a 100644--- a/docs/guides/enforced-member.md+++ b/docs/guides/enforced-member.md@@ -68,7 +68,7 @@ brain's config, from a direct session (one without `GBRAIN_ENFORCED_MEMBER`):gbrain config set access.enforced_member_writes refuse```-Then every write under the mode refuses: `put` (a new slug, a page the member+Then every page write under the mode refuses: `put` (a new slug, a page the memberreads and a page it can't read alike), `link`, `unlink`, `tag`, `untag`,`timeline-add`, `remember`, and `edit_page` and `append_page`. The refusalcomes before any page or source lookup, so it reads the same for every target@@ -76,7 +76,7 @@ and names none:```gbrain: refused under GBRAIN_ENFORCED_MEMBER=alice-example: writes are off for members on this brain; nothing was saved [GBRAIN_ENFORCED_REFUSED]-Why: This brain refuses every write under this mode: its config access.enforced_member_writes is not checked, or could not be read.+Why: This brain turned off page writes under this mode: its config access.enforced_member_writes is not checked, or could not be read.Fix: ask the brain owner to save it in a direct session (one without GBRAIN_ENFORCED_MEMBER).Recovery: nothing was saved; the same call refuses every time, so do not retry here.Docs: docs/guides/enforced-member.md#refuseddiff --git a/src/cli/enforced-member.ts b/src/cli/enforced-member.tsindex 7efca4dd4d..5fdc7a81b1 100644--- a/src/cli/enforced-member.ts+++ b/src/cli/enforced-member.ts@@ -30,7 +30,7 @@ const REASON_TEXT: Record<EnforcedReason, string> = {as_flag: '--as is refused under this mode.',arguments_not_allowed: 'These arguments are not allowed under this mode.',remember_needs_entity: 'remember needs --entity naming the exact slug of a page this member reads.',- writes_off: 'This brain refuses every write under this mode: its config access.enforced_member_writes is not checked, or could not be read.',+ writes_off: 'This brain turned off page writes under this mode: its config access.enforced_member_writes is not checked, or could not be read.',};/** The mode's member value, or undefined when the mode is off (the variable unset). */diff --git a/test/enforced-member.serial.test.ts b/test/enforced-member.serial.test.tsindex 9218e5d88b..b2c331e4ac 100644--- a/test/enforced-member.serial.test.ts+++ b/test/enforced-member.serial.test.ts@@ -670,6 +670,25 @@ for (const kind of testBackends()) {expect({ exit: pull.exitCode, out: pull.stdout, err: pull.stderr }).toEqual({ exit: 0, out: '', err: 'gbrain: git commit-push finished; its output is withheld under GBRAIN_ENFORCED_MEMBER\n' });}, 300_000);+ test('access.enforced_member_writes refuse leaves git commit-push and sync as they are', async () => {+ const set = await cli(['config', 'set', 'access.enforced_member_writes', 'refuse'], null);+ expect({ exit: set.exitCode, err: set.exitCode === 0 ? '' : set.stderr }).toEqual({ exit: 0, err: '' });+ try {+ writeFileSync(join(checkout, 'notes', 'alice-git-refuse.md'), note('Alice git refuse'));+ const r = await cli(['git', 'commit-push', '--path', checkout, '-m', 'alice note under refuse', '--', 'notes/alice-git-refuse.md']);+ expect({ exit: r.exitCode, out: r.stdout, err: r.stderr }).toEqual({ exit: 0, out: '', err: 'gbrain: git commit-push finished; its output is withheld under GBRAIN_ENFORCED_MEMBER\n' });+ expect(git('log', '--format=%s', '-1').trim()).toBe('alice note under refuse');+ const refused = await cli(['git', 'commit-push', '--path', checkout, '-m', 'x', '--', 'notes/bob-git.md']);+ expect({ exit: refused.exitCode, first: refused.stderr.split('\n')[0] }).toEqual({ exit: 3, first: FIRST(MEMBER, 'git commit-push') });+ const sync = await cli(['sync', '--source', 'repo-src', '--no-pull', '--no-embed']);+ expect({ exit: sync.exitCode, out: sync.stdout, err: sync.stderr }).toEqual({ exit: 0, out: '', err: 'gbrain: sync finished; its output is withheld under GBRAIN_ENFORCED_MEMBER\n' });+ } finally {+ const engine = await createEngine(config as never);+ await engine.connect(config as never);+ try { await engine.executeRaw("DELETE FROM config WHERE key = 'access.enforced_member_writes'"); } finally { await disposePersistenceConsumer(engine); await engine.disconnect(); }+ }+ }, 300_000);+test('sync runs with its output withheld; sync status is refused', async () => {const r = await cli(['sync', '--source', 'repo-src', '--no-pull', '--no-embed']);expect({ exit: r.exitCode, out: r.stdout, err: r.stderr }).toEqual({ exit: 0, out: '', err: 'gbrain: sync finished; its output is withheld under GBRAIN_ENFORCED_MEMBER\n' });