Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix: wakeshift watch text output names the cron and says an already-settled write wakes now
garrytanc4df35b2f94d
diff --git a/src/commands/wakeshift-watch.ts b/src/commands/wakeshift-watch.tsindex 56fd629b8c..8540b3a390 100644--- a/src/commands/wakeshift-watch.ts+++ b/src/commands/wakeshift-watch.ts@@ -76,10 +76,10 @@ export function printWatchResult(result: unknown, tail: string | undefined, jsonconsole.log(JSON.stringify(result));} else {const r = (result ?? {}) as Record<string, unknown>;- const target = r.job ?? r.request_id ?? r.name ?? r.target;+ const target = r.job ?? r.request_id ?? r.cron ?? r.target;if (r.watching === true) {console.log(`Watching ${String(r.event ?? 'it')}${target !== undefined ? ` for ${String(target)}` : ''}: this conversation wakes when it finishes${r.expires_in ? ` (watch ${String(r.watch)}, lasts ${String(r.expires_in)})` : ''}.`);- if (r.already_finished === true) console.log('It has already finished, so the wake goes out now.');+ if (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 {diff --git a/test/wakeshift-watch.test.ts b/test/wakeshift-watch.test.tsindex df01947036..6c4a552f19 100644--- a/test/wakeshift-watch.test.ts+++ b/test/wakeshift-watch.test.ts@@ -10,7 +10,7 @@ import { tmpdir } from 'node:os';import { join } from 'node:path';import { PGLiteEngine } from '../src/core/pglite-engine.ts';import { runWakeshift } from '../src/commands/wakeshift.ts';-import { parseWatchArgs } from '../src/commands/wakeshift-watch.ts';+import { parseWatchArgs, printWatchResult } from '../src/commands/wakeshift-watch.ts';import { currentExitCode, _resetCliExitVerdictForTests } from '../src/core/cli-force-exit.ts';import { withEnv } from './helpers/with-env.ts';@@ -69,4 +69,11 @@ describe('gbrain wakeshift watch on the brain host', () => {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');});++ test('text output names the cron and says an already-settled write wakes now, from the ops\' real result shapes', () => {+ printWatchResult({ watching: true, watch: 4, cron: 'nightly-digest', event: 'gbrain.cron.finished', expires_in: '7d' }, undefined, false);+ printWatchResult({ watching: true, watch: 5, request_id: 'req-1', event: 'gbrain.write.settled', already_settled: true, expires_in: '7d' }, undefined, false);+ expect(out).toContain('Watching gbrain.cron.finished for nightly-digest:');+ expect(out).toContain('It has already finished, so the wake goes out now.');+ });});