From 7b03a605031f686915b9e03e55d5a6969352a702 Mon Sep 17 00:00:00 2001 From: Affaan Mustafa Date: Thu, 30 Apr 2026 10:06:53 -0400 Subject: [PATCH] fix: require bounded loop-status exit-code watch --- commands/loop-status.md | 2 ++ scripts/loop-status.js | 4 ++++ tests/scripts/loop-status.test.js | 7 +++++++ 3 files changed, 13 insertions(+) diff --git a/commands/loop-status.md b/commands/loop-status.md index 0d0e9945..03987cd2 100644 --- a/commands/loop-status.md +++ b/commands/loop-status.md @@ -43,6 +43,8 @@ tool calls that have no matching `tool_result`. - `ecc loop-status --exit-code` exits `2` when stale loop or tool signals are found, or `1` when transcripts cannot be scanned. - `ecc loop-status --watch` refreshes status until interrupted. +- `ecc loop-status --watch --watch-count 3 --exit-code` refreshes a bounded + number of times, then exits with the highest status seen. - `ecc loop-status --watch --watch-count 3` emits a bounded watch stream for scripts and handoffs. diff --git a/scripts/loop-status.js b/scripts/loop-status.js index a21e708a..a52dc0ff 100644 --- a/scripts/loop-status.js +++ b/scripts/loop-status.js @@ -116,6 +116,10 @@ function parseArgs(argv) { } } + if (options.exitCode && options.watch && options.watchCount === null) { + throw new Error('--exit-code with --watch requires --watch-count so the process can exit'); + } + return options; } diff --git a/tests/scripts/loop-status.test.js b/tests/scripts/loop-status.test.js index f3eab5fa..e91de7db 100644 --- a/tests/scripts/loop-status.test.js +++ b/tests/scripts/loop-status.test.js @@ -444,6 +444,13 @@ function runTests() { assert.strictEqual(payload.errors.length, 1); })) passed++; else failed++; + if (test('exit-code mode rejects unbounded watch mode', () => { + const result = run(['--watch', '--exit-code']); + + assert.strictEqual(result.code, 1); + assert.match(result.stderr, /--exit-code with --watch requires --watch-count/); + })) passed++; else failed++; + if (test('getStatusExitCode prioritizes attention signals over scan errors', () => { const payload = { errors: [{ message: 'unreadable' }],