Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix: pre-landing review fixes
garrytan9cb022956199
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex dfd36ffae0..d495252e7f 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -16,9 +16,9 @@ identifiers and attribution are available in the pre-removal Git revision### Itemized changes-- Install pins move from `#latest-stable` to `#stable` in README, AGENTS.md, INSTALL_FOR_AGENTS.md, BOOTSTRAP_FOR_AGENTS.md, docs/INSTALL.md, the MCP, headless, in-agent and tutorial guides, the setup skills, the Codex plugin manifests and launcher, doctor's npm-squat fix, the bootstrap hints and the agent-workspace template. The bootstrap runbook fetch and the in-agent setup helper read the `stable` ref, and the in-agent helper pins the commit `refs/tags/stable` peels to.+- Install pins move from `#latest-stable` to `#stable` in README, AGENTS.md, INSTALL_FOR_AGENTS.md, BOOTSTRAP_FOR_AGENTS.md, docs/INSTALL.md, the MCP, headless, in-agent and tutorial guides, the setup skills, the Codex plugin manifests and launcher, doctor's npm-squat fix, the bootstrap hints and the agent-workspace template. The bootstrap runbook fetch and the in-agent setup helper read the `stable` ref, and the in-agent helper pins the commit `refs/tags/stable` peels to. Until a release containing this change is promoted to `stable`, the runbook and helper served from that ref are the previous stable release's copies.- `scripts/check-bootstrap-tag.sh` sanctions `stable` as the one distribution ref and now refuses `#latest-stable` in the entry docs.-- `src/commands/init.ts`: a fresh install (new content database, no prior config file) persists `self_upgrade.channel: stable` on PGLite and Postgres. A re-init keeps whatever the config says, including no channel. `test/init-stable-channel.test.ts` covers the fresh, re-init and explicit-channel cases.+- `src/commands/init.ts`: a fresh install (new content database, no prior config file) persists `self_upgrade.channel: stable` on PGLite and Postgres. A re-init keeps whatever the config says, including no channel. `test/init-stable-channel.test.ts` covers the fresh, re-init and explicit-channel cases, and `test/e2e/init-stable-channel-postgres.test.ts` the fresh and re-init cases on Postgres.- `docs/guides/upgrades-auto-update.md#stable-channel` describes stable as the default for new installs and `latest` as the alpha line.## [0.60.602.0] - 2026-11-07diff --git a/test/e2e/init-stable-channel-postgres.test.ts b/test/e2e/init-stable-channel-postgres.test.tsnew file mode 100644index 0000000000..25b0efafbb--- /dev/null+++ b/test/e2e/init-stable-channel-postgres.test.ts@@ -0,0 +1,75 @@+/**+ * GBRA-346, Postgres side of test/init-stable-channel.test.ts: a fresh+ * `gbrain init --url` on an empty content database persists+ * `self_upgrade.channel: stable`, and a re-init of a brain whose config never+ * chose a channel leaves it unset.+ *+ * Runs against a scratch database created from DATABASE_URL so the shared E2E+ * database's content cannot make the install look non-fresh.+ *+ * Run: DATABASE_URL=... bun test test/e2e/init-stable-channel-postgres.test.ts+ */++import { afterAll, beforeAll, describe, expect, test } from 'bun:test';+import { randomUUID } from 'node:crypto';+import { mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';+import { tmpdir } from 'node:os';+import { join } from 'node:path';+import postgres from '#postgres';+import { assertSafeE2eDatabaseUrl } from '../helpers/db-guard.ts';++const DATABASE_URL = process.env.DATABASE_URL;+const describeE2E = DATABASE_URL ? describe : describe.skip;+const REPO_ROOT = join(import.meta.dir, '..', '..');++function runInit(gbrainHome: string, url: string): { exitCode: number; stderr: string } {+ const r = Bun.spawnSync(['bun', 'run', join(REPO_ROOT, 'src', 'cli.ts'), 'init', '--url', url, '--non-interactive', '--no-embedding', '--json'], {+ env: { PATH: process.env.PATH, HOME: gbrainHome, GBRAIN_HOME: gbrainHome },+ cwd: gbrainHome,+ stdout: 'ignore',+ stderr: 'pipe',+ });+ return { exitCode: r.exitCode ?? -1, stderr: r.stderr.toString() };+}++describeE2E('init on Postgres: release channel for new installs (GBRA-346)', () => {+ let admin: ReturnType<typeof postgres> | undefined;+ let scratchName = '';+ let scratchUrl = '';+ let home = '';+ const configFile = () => join(home, '.gbrain', 'config.json');++ beforeAll(async () => {+ assertSafeE2eDatabaseUrl(DATABASE_URL!);+ scratchName = `gbrain_test_init_channel_${randomUUID().replaceAll('-', '')}`;+ admin = postgres(DATABASE_URL!, { max: 1, prepare: false });+ await admin.unsafe(`CREATE DATABASE ${scratchName}`);+ const url = new URL(DATABASE_URL!);+ url.pathname = `/${scratchName}`;+ scratchUrl = url.toString();+ home = mkdtempSync(join(tmpdir(), 'gbrain-init-channel-pg-'));+ }, 60_000);++ afterAll(async () => {+ if (admin) {+ await admin.unsafe(`DROP DATABASE IF EXISTS ${scratchName} WITH (FORCE)`);+ await admin.end();+ }+ if (home) rmSync(home, { recursive: true, force: true });+ });++ test('a fresh install persists self_upgrade.channel = stable', () => {+ const r = runInit(home, scratchUrl);+ expect(r.exitCode, r.stderr).toBe(0);+ expect(JSON.parse(readFileSync(configFile(), 'utf-8')).self_upgrade).toMatchObject({ mode: 'notify', mode_prompted: true, channel: 'stable' });+ }, 180_000);++ test('re-init of an existing brain that never chose a channel leaves the channel unset', () => {+ const cfg = JSON.parse(readFileSync(configFile(), 'utf-8'));+ delete cfg.self_upgrade.channel;+ writeFileSync(configFile(), JSON.stringify(cfg, null, 2));+ const r = runInit(home, scratchUrl);+ expect(r.exitCode, r.stderr).toBe(0);+ expect(JSON.parse(readFileSync(configFile(), 'utf-8')).self_upgrade.channel).toBeUndefined();+ }, 180_000);+});