Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix: Wakeshift watches stay with their own member, removes retry the forget, and doctor survives a brain behind the migration
garrytane196021fe9e2
diff --git a/docs/guides/wakeshift.md b/docs/guides/wakeshift.mdindex 49893c9288..0e21c4cd45 100644--- a/docs/guides/wakeshift.md+++ b/docs/guides/wakeshift.md@@ -70,7 +70,7 @@ On a brain with live access members (`gbrain access member list`), you, the brai- **Controller and processor.** Under Wakeshift's [Data Processing Addendum](https://wakeshift.ai/dpa) you are the controller of your members' wake data and Wakeshift is your processor. You answer members' requests to access or delete their data; removing a member makes gbrain ask Wakeshift to forget them (below).- **Minimum age.** Wakeshift's terms make you set a minimum age for your members under the laws that apply to them, including laws on children's data. Say it in your terms.-Each person then sees one agreement step before their first watch: the first `watch_*` call returns `agreement_required` with what watching does, your two links, the Wakeshift disclosure and the Connector Terms and Privacy Policy links, and an instruction to ask the user. After the user agrees, the agent calls `accept_wakeshift_terms` with the step's `terms_version`, and gbrain records the acceptance (the person's member id or credential, the version and the time). The version is a hash of your two links, so changing either asks everyone again. A brain with no live members skips the step.+Each person then sees one agreement step before their first watch: the first `watch_*` call returns `agreement_required` with what watching does, your two links, the Wakeshift disclosure and the Connector Terms and Privacy Policy links, and an instruction to ask the user. After the user agrees, the agent calls `accept_wakeshift_terms` with the step's `terms_version` (from a thin client's shell, `gbrain wakeshift accept-terms <terms_version>`), and gbrain records the acceptance (the person's member id or credential, the version and the time). The version is a hash of your two links, so changing either asks everyone again. A brain with no live members skips the step.The drainer re-checks this before every wake: on a shared brain a watch whose person hasn't accepted the current terms ends with `last_error: terms_not_accepted` instead of waking. A member added after enable, on a brain whose links were never set, makes every watch refuse with `wakeshift_shared_brain` and `gbrain doctor` warn until you run `enable` with the links.@@ -107,6 +107,7 @@ Repo-less brains work the same way. Watches are operational database rows, not b- **`wakeshift_unavailable`.** Wakeshift was down, slow (10 s timeout) or rate limiting. Retry later, or use `wait_job`.- **`wakeshift_refused`.** Wakeshift refused the request, and the reason carries its code. `other_client` means the `session_key` belongs to another program's conversation: call again without it. For anything else, run `gbrain wakeshift test`.- **`agreement_required` instead of a watch.** The brain has members: show the user the step and call `accept_wakeshift_terms` after they agree. `wakeshift_shared_brain` means the owner hasn't set the terms links yet.+- **`gbrain doctor` warns about Wakeshift forgets.** A forget that failed for good (a final refusal or 5 failed attempts) left that user at Wakeshift: check the key and app with `gbrain wakeshift test`. Forgets queued while reporting back is off wait until `gbrain wakeshift enable`, then `gbrain serve` or the job worker sends them. Running `gbrain access member remove` again for an already-removed member queues its forget again.- **`watch_cron` says not_found.** The name isn't registered: the brain owner runs `gbrain wakeshift cron add <name>`.- **No wake arrived.** The result of `watch_job` says `wakeable: false` when Wakeshift didn't recognize the agent program: pass `harness`. `list_watches` shows each watch's state and last error. `gbrain doctor --only wakeshift` counts dead watches and any `id_reused` refusal (a gbrain bug: please report it).diff --git a/src/cli/main.ts b/src/cli/main.tsindex d164d8d085..48c19b8d9d 100755--- a/src/cli/main.ts+++ b/src/cli/main.ts@@ -1921,7 +1921,7 @@ const THIN_CLIENT_REFUSE_HINTS: Record<string, string> = {quarantine: '`quarantine list` routes to the brain host automatically (quarantine_list MCP op). scan/clear are host-bound (bulk re-import; the clear trust decision) — run those on the host.',advisor: 'advisor ranks next actions from the host brain. Use the `advisor` MCP tool from your agent (when the host publishes it), or run `gbrain advisor` on the host.',export: 'export dumps the host brain to disk and has no MCP equivalent. Run `gbrain export` on the host, or read pages with the `get_page` MCP tool.',- wakeshift: '`wakeshift watch job|write|cron` routes to the brain host automatically (watch_job / watch_write_request / watch_cron MCP tools). enable, disable, status and test read or change the brain host\'s Wakeshift key and settings: run those on the brain host.',+ wakeshift: '`wakeshift watch job|write|cron` and `wakeshift accept-terms` route to the brain host automatically (watch_job / watch_write_request / watch_cron / accept_wakeshift_terms MCP tools). enable, disable, status and test read or change the brain host\'s Wakeshift key and settings: run those on the brain host.',recall: '`recall --query`/`--budget-tokens` without `--budget-policy` runs the recall op locally. Add `--budget-policy facts_first` to send it to the brain host (`recall` MCP op).',};diff --git a/src/commands/doctor/checks/wakeshift.ts b/src/commands/doctor/checks/wakeshift.tsindex fb04e0fdf5..cb3db65ad3 100644--- a/src/commands/doctor/checks/wakeshift.ts+++ b/src/commands/doctor/checks/wakeshift.ts@@ -9,7 +9,8 @@* when a queued Wakeshift forget is older than a day or died in the last 30* days, when forgets are queued while reporting back is off (nothing sends* them then), and when the published- * manifest is older than this build. Shows the key's kid fingerprint only,+ * manifest is older than this build. A brain behind the Wakeshift migration+ * (doctor --no-migrate) reads as off when off, and warns when enabled. Shows the key's kid fingerprint only,* never the key. Guide: docs/guides/wakeshift.md.*/import { loadConfigFileOnly } from '../../../core/config.ts';@@ -24,6 +25,17 @@ import { connectedEngine, type DoctorContext, type DoctorEntry } from '../contexconst DOCS = 'docs/guides/wakeshift.md#troubleshooting';async function runWakeshiftCheck(ctx: DoctorContext): Promise<Check[]> {+ try {+ return await wakeshiftChecks(ctx);+ } catch (e) {+ if ((e as { code?: string } | null)?.code !== '42P01') throw e;+ return [wakeshiftFileConfig(loadConfigFileOnly()).enabled === true+ ? { name: 'wakeshift', status: 'warn', message: 'Wakeshift is enabled but this brain has no Wakeshift tables yet (migrations pending), so no watch can be recorded. Fix: gbrain apply-migrations --yes', details: { enabled: true, docs: DOCS } }+ : { name: 'wakeshift', status: 'ok', severity: 'info', readiness_state: 'disabled_by_choice', message: 'Reporting back through Wakeshift is off (gbrain wakeshift enable turns it on).', details: { enabled: false, docs: DOCS } }];+ }+}++async function wakeshiftChecks(ctx: DoctorContext): Promise<Check[]> {const checks: Check[] = [];const file = wakeshiftFileConfig(loadConfigFileOnly());const enabled = file.enabled === true;diff --git a/src/commands/thin-client-routing.ts b/src/commands/thin-client-routing.tsindex b7d72af531..6576b75809 100644--- a/src/commands/thin-client-routing.ts+++ b/src/commands/thin-client-routing.ts@@ -2,8 +2,9 @@* CLI→MCP gap-closure wave [OV6] — per-subcommand thin-client routing for the* commands whose reads/writes gained MCP ops: takes (list/search/scorecard/* calibration + the write verbs), search (modes/stats/tune, read-only forms),- * jobs stats, cache stats, quarantine list, and wakeshift watch (watch_job /- * watch_write_request / watch_cron). The salience/anomalies/+ * jobs stats, cache stats, quarantine list, wakeshift watch (watch_job /+ * watch_write_request / watch_cron) and wakeshift accept-terms+ * (accept_wakeshift_terms). The salience/anomalies/* graph-query precedent, engine-free: each routable subcommand maps onto its* op over callRemoteTool; everything else returns false so the caller falls* through to refuseThinClient's pinpoint hint.@@ -157,9 +158,9 @@ export async function routeThinClientCommand(return false; // modes --reset / modes --mode|--source (the reset dry-run) / tune --apply / diagnose — host-side config or live probe}- if (command === 'wakeshift' && sub === 'watch') {+ if (command === 'wakeshift' && (sub === 'watch' || sub === 'accept-terms')) {const { runWakeshiftWatchRemote } = await import('./wakeshift-watch.ts');- await runWakeshiftWatchRemote(cfg, rest);+ await runWakeshiftWatchRemote(cfg, sub === 'watch' ? rest : ['accept-terms', ...rest]);return true;}diff --git a/src/commands/wakeshift-watch.ts b/src/commands/wakeshift-watch.tsindex 8540b3a390..6217494a08 100644--- a/src/commands/wakeshift-watch.ts+++ b/src/commands/wakeshift-watch.ts@@ -1,6 +1,7 @@/*** `gbrain wakeshift watch job <id> | write <request_id> | cron <name>` (Wakeshift plan D8): have gbrain wake- * this conversation when a job, a pending write or a cron run finishes, from a shell. On a thin client+ * this conversation when a job, a pending write or a cron run finishes, from a shell. `gbrain wakeshift+ * accept-terms <terms_version>` records the user's agreement to a shared brain's agreement step (accept_wakeshift_terms). On a thin client* (`gbrain init --mcp-only`: Muse, Grok Bot) it calls the brain host's watch_job, watch_write_request or* watch_cron over MCP; on a brain host it calls the op with the trusted local context, whose refusal names the* local wait (gbrain jobs wait <id>), because a CLI run has no conversation to wake. The result prints as text or@@ -17,6 +18,9 @@ Usage:gbrain wakeshift watch job <id> a job (submit_job, submit_agent, gbrain jobs submit)gbrain wakeshift watch write <request_id> a pending write (exit 10, write_pending)gbrain wakeshift watch cron <name> a scheduled run registered with gbrain wakeshift cron add+ gbrain wakeshift accept-terms <terms_version>+ after the user agreed to the agreement step a watch returned+ (agreement_required), record it; then run the watch againFlags:--session-key K this conversation's session_key from an earlier result (a secret: never logged or saved)@@ -55,6 +59,11 @@ export function parseWatchArgs(args: readonly string[]): WatchCall | string {positionals.push(a);}const [kind, target, extra] = positionals;+ if (kind === 'accept-terms') {+ if (!target || extra !== undefined) return 'accept-terms takes exactly one terms_version (from the agreement step)';+ if (Object.keys(params).length > 0) return 'accept-terms takes no --session-key, --harness or --conversation-id';+ return { tool: 'accept_wakeshift_terms', params: { terms_version: target }, json: args.includes('--json') };+ }if (!kind || !(kind in TARGETS)) return 'name what to watch: job <id>, write <request_id> or cron <name>';if (!target || extra !== undefined) return `watch ${kind} takes exactly one ${TARGETS[kind as keyof typeof TARGETS].param}`;const spec = TARGETS[kind as keyof typeof TARGETS];@@ -82,6 +91,8 @@ export function printWatchResult(result: unknown, tail: string | undefined, jsonif (r.already_finished === true || r.already_settled === true) console.log('It has already finished, so the wake goes out now.');if (typeof r.note === 'string') console.log(r.note);if (typeof r.fallback === 'string') console.log(r.fallback);+ } else if (r.accepted === true) {+ console.log(`Recorded the user's agreement (terms version ${String(r.terms_version)}). Run the watch again.`);} else {console.log(JSON.stringify(result, null, 2));}diff --git a/src/commands/wakeshift.ts b/src/commands/wakeshift.tsindex be2aae4018..8ab45fbb5b 100644--- a/src/commands/wakeshift.ts+++ b/src/commands/wakeshift.ts@@ -45,6 +45,9 @@ Commands:watch job <id> | write <request_id> | cron <name>from a thin client or agent shell: wake this conversation when it finishes(gbrain wakeshift watch --help)+ accept-terms <terms_version>+ from a thin client or agent shell: record the user's agreement to a shared+ brain's agreement step (accept_wakeshift_terms), then run the watch againThe key is read from WAKESHIFT_API_KEY (e.g. in ~/.gbrain/.env) or ~/.gbrain/wakeshift.key.gbrain never creates a Wakeshift account or key. Guide: docs/guides/wakeshift.md`;@@ -303,7 +306,7 @@ export function printWakeshiftGate(): void {export async function runWakeshift(engine: BrainEngine, args: string[]): Promise<void> {const sub = args[0];const json = args.includes('--json');- if (sub === 'watch') return (await import('./wakeshift-watch.ts')).runWakeshiftWatch(engine, args.slice(1));+ if (sub === 'watch' || sub === 'accept-terms') return (await import('./wakeshift-watch.ts')).runWakeshiftWatch(engine, sub === 'watch' ? args.slice(1) : args);if (!sub || args.includes('--help') || args.includes('-h')) { console.log(HELP); return; }if (sub === 'status') return status(engine, json);if (sub === 'enable') return enable(engine, args.slice(1));diff --git a/src/core/access/members.ts b/src/core/access/members.tsindex b4461b6fa8..000cfb6f79 100644--- a/src/core/access/members.ts+++ b/src/core/access/members.ts@@ -326,7 +326,10 @@ export async function previewRemoveMember(engine: BrainEngine, rawId: unknown):export async function removeMember(engine: BrainEngine, rawId: unknown): Promise<MemberRemovalPreview> {const preview = await previewRemoveMember(engine, rawId);- if (preview.member.status === 'removed') return preview;+ if (preview.member.status === 'removed') {+ await forgetWakePrincipal(sqlQueryForEngine(engine), { member: preview.member.id });+ return preview;+ }await engine.transaction(async tx => {await tx.executeRaw('UPDATE access_members SET tombstoned_at = now(), disabled_at = COALESCE(disabled_at, now()), email = NULL, updated_at = now() WHERE id = $1', [preview.member.id]);await tx.executeRaw('DELETE FROM access_group_members WHERE member_id = $1', [preview.member.id]);diff --git a/src/core/ops/wakeshift.ts b/src/core/ops/wakeshift.tsindex 5ad4dd275e..98370a926c 100644--- a/src/core/ops/wakeshift.ts+++ b/src/core/ops/wakeshift.ts@@ -349,8 +349,8 @@ async function ownRows(ctx: OperationContext, extra: string, params: unknown[]):if (!principal) return [];return ctx.engine.executeRaw(`SELECT id, event, target, state, attempts, last_error, created_at, expires_at, wake_user, ws_subscription_id FROM wake_subscriptions- WHERE principal_kind = $1 AND principal_id = $2 ${extra} ORDER BY created_at DESC, id DESC LIMIT 50`,- [principal.kind, principal.id, ...params]);+ WHERE principal_kind = $1 AND principal_id = $2 AND member_id IS NOT DISTINCT FROM $3 ${extra} ORDER BY created_at DESC, id DESC LIMIT 50`,+ [principal.kind, principal.id, principal.member, ...params]);}const list_watches: Operation = {@@ -371,7 +371,7 @@ const list_watches: Operation = {},};-/** The one target an unwatch names, as a row filter. */+/** The one target an unwatch names, as a row filter after ownRows' three principal params. */function unwatchFilter(p: Record<string, unknown>): { key: Record<string, unknown>; extra: string; params: unknown[] } {const given = (['job', 'request_id', 'cron', 'watch'] as const).filter(k => p[k] !== undefined && p[k] !== null);const usage = () => opError('invalid_params', 'unwatch: pass exactly one of job, request_id, cron or watch.', 'Pass the id you watched; list_watches shows your watches and their ids.');@@ -381,17 +381,17 @@ function unwatchFilter(p: Record<string, unknown>): { key: Record<string, unknowconst n = p[k] as number;if (!Number.isSafeInteger(n) || n <= 0) throw usage();return k === 'job'- ? { key: { job: n }, extra: 'AND event = $3 AND target = $4', params: [JOB_FINISHED, String(n)] }- : { key: { watch: n }, extra: 'AND id = $3', params: [n] };+ ? { key: { job: n }, extra: 'AND event = $4 AND target = $5', params: [JOB_FINISHED, String(n)] }+ : { key: { watch: n }, extra: 'AND id = $4', params: [n] };}if (k === 'request_id') {const id = parseWriteRequestId(p.request_id);if (!id) throw usage();- return { key: { request_id: id }, extra: 'AND event = $3 AND target = $4', params: [WRITE_SETTLED, id] };+ return { key: { request_id: id }, extra: 'AND event = $4 AND target = $5', params: [WRITE_SETTLED, id] };}const name = cronName(p.cron);if (!name) throw usage();- return { key: { cron: name }, extra: 'AND event = $3 AND target = $4', params: [CRON_FINISHED, name] };+ return { key: { cron: name }, extra: 'AND event = $4 AND target = $5', params: [CRON_FINISHED, name] };}const unwatch: Operation = {diff --git a/test/fixtures/goldens/cli/dispatch-phase.json b/test/fixtures/goldens/cli/dispatch-phase.jsonindex 144ff661f3..9b3bd41e79 100644--- a/test/fixtures/goldens/cli/dispatch-phase.json+++ b/test/fixtures/goldens/cli/dispatch-phase.json@@ -2098,7 +2098,8 @@"preConnectRules": [],"thinClient": "route-then-refuse","thinClientRoutedSubcommands": [- "watch"+ "watch",+ "accept-terms"]},"watch": {@@ -2344,7 +2345,8 @@"supersede"],"wakeshift": [- "watch"+ "watch",+ "accept-terms"]}},diff --git a/test/fixtures/goldens/cli/thin-client-cases.json b/test/fixtures/goldens/cli/thin-client-cases.jsonindex 1bc0dde80d..0e4388c7d7 100644--- a/test/fixtures/goldens/cli/thin-client-cases.json+++ b/test/fixtures/goldens/cli/thin-client-cases.json@@ -766,7 +766,7 @@"stderr": ["Error [requires_local_engine]: `gbrain wakeshift` is not routable (thin-client of http://127.0.0.1:1/mcp); run it on the brain host.","Fix: gbrain wakeshift",- "Why: `wakeshift watch job|write|cron` routes to the brain host automatically (watch_job / watch_write_request / watch_cron MCP tools). enable, disable, status and test read or change the brain host's Wakeshift key and settings: run those on the brain host.",+ "Why: `wakeshift watch job|write|cron` and `wakeshift accept-terms` route to the brain host automatically (watch_job / watch_write_request / watch_cron / accept_wakeshift_terms MCP tools). enable, disable, status and test read or change the brain host's Wakeshift key and settings: run those on the brain host.","Docs: https://github.com/garrytan/gbrain/blob/master/docs/guides/error-codes.md#requires_local_engine"],"stdout": []diff --git a/test/fixtures/goldens/cli/thin-client-routing.json b/test/fixtures/goldens/cli/thin-client-routing.jsonindex 2f7f8b1b7b..dee1954c0b 100644--- a/test/fixtures/goldens/cli/thin-client-routing.json+++ b/test/fixtures/goldens/cli/thin-client-routing.json@@ -282,7 +282,7 @@"stderr": ["Error [requires_local_engine]: `gbrain wakeshift` is not routable (thin-client of http://127.0.0.1:1/mcp); run it on the brain host.","Fix: gbrain wakeshift status",- "Why: `wakeshift watch job|write|cron` routes to the brain host automatically (watch_job / watch_write_request / watch_cron MCP tools). enable, disable, status and test read or change the brain host's Wakeshift key and settings: run those on the brain host.",+ "Why: `wakeshift watch job|write|cron` and `wakeshift accept-terms` route to the brain host automatically (watch_job / watch_write_request / watch_cron / accept_wakeshift_terms MCP tools). enable, disable, status and test read or change the brain host's Wakeshift key and settings: run those on the brain host.","Docs: https://github.com/garrytan/gbrain/blob/master/docs/guides/error-codes.md#requires_local_engine"],"stdout": []diff --git a/test/thin-client-routing.test.ts b/test/thin-client-routing.test.tsindex d6cfabb935..337ef3513d 100644--- a/test/thin-client-routing.test.ts+++ b/test/thin-client-routing.test.ts@@ -352,6 +352,13 @@ describe('routeThinClientCommand — wakeshift watch (Wakeshift report-back overexpect(JSON.parse(logs[0]!)).toEqual(watching);});+ test('accept-terms routes to accept_wakeshift_terms with the terms_version and prints what to do next', async () => {+ respond({ accepted: true, terms_version: '0123456789abcdef', next: 'Call the watch tool again.' }, []);+ expect(await routeThinClientCommand(cfg, 'wakeshift', ['accept-terms', '0123456789abcdef'])).toBe(true);+ expect(soleCall()).toEqual({ tool: 'accept_wakeshift_terms', args: { terms_version: '0123456789abcdef' } });+ expect(logs.join('\n')).toContain('Run the watch again');+ });+test('only watch routes: every other wakeshift subcommand is host-bound', async () => {for (const sub of ['status', 'enable', 'disable', 'test']) {expect(await routeThinClientCommand(cfg, 'wakeshift', [sub])).toBe(false);diff --git a/test/wakeshift-pr2.serial.test.ts b/test/wakeshift-pr2.serial.test.tsindex 1780e3296d..f840c9dc66 100644--- a/test/wakeshift-pr2.serial.test.ts+++ b/test/wakeshift-pr2.serial.test.ts@@ -397,6 +397,20 @@ describe('forget on remove', () => {expect(new Set(paths('/users/forget').map(c => c.body.user)).size).toBe(2);});+ test('removing an already-removed member queues its forget again, so a forget lost after the tombstone is recovered', async () => {+ await addMember('alice-example');+ await addClient('client-r', 'alice-example');+ writeConfig({ enabled: true, url: fake.url, terms_url: TERMS, privacy_url: PRIVACY });+ const step = body(await call('watch_job', { id: await seedJob() }, client('client-r')));+ await call('accept_wakeshift_terms', { terms_version: step.terms_version }, client('client-r'));+ expect(body(await call('watch_job', { id: await seedJob() }, client('client-r')))).toMatchObject({ watching: true });+ await removeMember(engine, 'alice-example');+ await engine.executeRaw('DELETE FROM wake_forgets');+ expect((await removeMember(engine, 'alice-example')).member.status).toBe('removed');+ expect(await engine.executeRaw('SELECT state FROM wake_forgets')).toEqual([{ state: 'pending' }]);+ expect(await drain()).toMatchObject({ forgotten: 1 });+ });+test('a refused forget is retried on the schedule and then dies', async () => {await engine.executeRaw("INSERT INTO wake_forgets (wake_user) VALUES ('0123456789abcdef0123456789abcdef')");fake.respond.set('/users/forget', () => ({ status: 503, body: { error: { code: 'unavailable', message: 'down' } } }));@@ -410,7 +424,40 @@ describe('forget on remove', () => {});});+describe('watch ownership', () => {+ test('two --stdio-member servers share one principal but list and end only their own watches', async () => {+ await addMember('alice-example');+ await addMember('bob-example');+ writeConfig({ enabled: true, url: fake.url, terms_url: TERMS, privacy_url: PRIVACY });+ const as = (member: string) => ({ ...stdio, stdioMember: member });+ const ids: Record<string, number> = {};+ for (const m of ['alice-example', 'bob-example']) {+ const job = await seedJob();+ const step = body(await call('watch_job', { id: job }, as(m)));+ expect(body(await call('accept_wakeshift_terms', { terms_version: step.terms_version }, as(m)))).toMatchObject({ accepted: true });+ const watched = body(await call('watch_job', { id: job }, as(m)));+ expect(watched).toMatchObject({ watching: true });+ ids[m] = watched.watch;+ }+ expect(body(await call('list_watches', {}, as('alice-example'))).watches.map((w: { watch: number }) => w.watch)).toEqual([ids['alice-example']]);+ expect(body(await call('unwatch', { watch: ids['bob-example']! }, as('alice-example')))).toMatchObject({ ended: 0 });+ expect(body(await call('unwatch', { watch: ids['alice-example']! }, as('alice-example')))).toMatchObject({ ended: 1 });+ expect(await engine.executeRaw("SELECT member_id FROM wake_subscriptions WHERE state = 'open'")).toEqual([{ member_id: 'bob-example' }]);+ });+});+describe('status, doctor and the gate', () => {+ test('doctor on a brain behind the Wakeshift migration reads as off when off, and warns when enabled', async () => {+ const behind = { kind: 'pglite', executeRaw: async () => { throw Object.assign(new Error('relation "wake_forgets" does not exist'), { code: '42P01' }); } };+ const run = () => inHome(async () => wakeshiftEntry.run({ engine: behind, args: [], jsonOutput: true, fastMode: false, doFix: false, dryRun: false } as unknown as DoctorContext));+ writeConfig({ enabled: false, url: fake.url });+ expect(await run()).toEqual([expect.objectContaining({ status: 'ok', readiness_state: 'disabled_by_choice' })]);+ writeConfig({ enabled: true, url: fake.url, manifest_hash: wakeshiftManifestHash() });+ const on = await run() as Array<{ status: string; message: string }>;+ expect(on[0]).toMatchObject({ status: 'warn' });+ expect(on[0]!.message).toContain('gbrain apply-migrations --yes');+ });+test('status and doctor say when the published manifest is older than this build', async () => {writeConfig({ enabled: true, url: fake.url, manifest_hash: 'feedfacefeedface' });const st = JSON.parse((await cli(['status', '--json'])).out);diff --git a/test/wakeshift-watch.test.ts b/test/wakeshift-watch.test.tsindex 6c4a552f19..b1fc6207e4 100644--- a/test/wakeshift-watch.test.ts+++ b/test/wakeshift-watch.test.ts@@ -68,6 +68,9 @@ describe('gbrain wakeshift watch on the brain host', () => {expect(parseWatchArgs(['cron', 'nightly-digest', '--harness', 'openclaw', '--json'])).toEqual({ tool: 'watch_cron', params: { name: 'nightly-digest', harness: 'openclaw' }, json: true });expect(parseWatchArgs(['write', 'req-1', '--conversation-id', 'c-1'])).toEqual({ tool: 'watch_write_request', params: { request_id: 'req-1', conversation_id: 'c-1' }, json: false });expect(typeof parseWatchArgs(['job', '0'])).toBe('string');+ expect(parseWatchArgs(['accept-terms', '0123456789abcdef', '--json'])).toEqual({ tool: 'accept_wakeshift_terms', params: { terms_version: '0123456789abcdef' }, json: true });+ expect(typeof parseWatchArgs(['accept-terms'])).toBe('string');+ expect(typeof parseWatchArgs(['accept-terms', 'v', '--session-key', 'k'])).toBe('string');});test('text output names the cron and says an already-settled write wakes now, from the ops\' real result shapes', () => {