fix(cli): warn when squad watch receives unused message args (#703)#704
fix(cli): warn when squad watch receives unused message args (#703)#704tamirdresher wants to merge 1 commit intodevfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a UX warning to the Squad CLI so that when users pass extra positional args to squad watch (commonly a quoted “agent message”), the CLI warns that watch mode does not route messages instead of silently ignoring them.
Changes:
- Detects unused extra args for
triage/watchexecution incli-entry.ts - Prints a warning explaining that watch mode ignores message-like positional args
- Continues running
runWatch()unchanged after warning
packages/squad-cli/src/cli-entry.ts
Outdated
| if (extraArgs.length > 0) { | ||
| const message = extraArgs.join(' '); | ||
| console.warn(`\n⚠️ Watch mode does not route messages to agents. Ignoring: "${message}"`); | ||
| console.warn(` To address an agent directly, use an interactive session instead.\n`); | ||
| } |
There was a problem hiding this comment.
This introduces new user-facing CLI behavior (warning emission) without an automated assertion. There are existing CLI/e2e tests that execute dist/cli-entry.js; adding a small test that runs watch with extra args and asserts the warning appears on stderr would help prevent regressions in argument parsing and messaging.
packages/squad-cli/src/cli-entry.ts
Outdated
| const knownFlags = new Set(['triage', 'watch', '--interval', String(intervalMinutes)]); | ||
| const extraArgs = args.filter(a => !knownFlags.has(a)); |
There was a problem hiding this comment.
extraArgs detection is value-based (knownFlags Set) rather than position-based, so it can silently drop/mangle real extra positional args when they coincidentally equal tokens like "watch", "triage", "--interval", or the interval value (and it also mismatches if the user passes --interval 05, since String(intervalMinutes) becomes "5"). Consider deriving extraArgs by slicing off the command (args.slice(1)) and then removing the parsed --interval and its following value by index, leaving the true remaining positional args intact.
| const knownFlags = new Set(['triage', 'watch', '--interval', String(intervalMinutes)]); | |
| const extraArgs = args.filter(a => !knownFlags.has(a)); | |
| // Derive extra args positionally: | |
| // - Drop the command token (triage/watch) | |
| // - Remove any --interval flag and its following value | |
| const argsAfterCommand = args.slice(1); | |
| const extraArgs = [...argsAfterCommand]; | |
| const intervalInExtraIdx = extraArgs.indexOf('--interval'); | |
| if (intervalInExtraIdx !== -1) { | |
| // Remove the --interval flag | |
| extraArgs.splice(intervalInExtraIdx, 1); | |
| // And its value, if present | |
| if (intervalInExtraIdx < extraArgs.length) { | |
| extraArgs.splice(intervalInExtraIdx, 1); | |
| } | |
| } |
| const extraArgs = args.filter(a => !knownFlags.has(a)); | ||
| if (extraArgs.length > 0) { | ||
| const message = extraArgs.join(' '); | ||
| console.warn(`\n⚠️ Watch mode does not route messages to agents. Ignoring: "${message}"`); |
There was a problem hiding this comment.
This block runs for both cmd === 'triage' and cmd === 'watch', but the warning text always says "Watch mode". If the user runs squad triage ... they'll see an inaccurate message; either tailor the wording based on cmd (e.g. "triage/watch mode") or split the handling so each command prints the correct message.
| console.warn(`\n⚠️ Watch mode does not route messages to agents. Ignoring: "${message}"`); | |
| const modeLabel = cmd === 'triage' ? 'Triage' : 'Watch'; | |
| console.warn(`\n⚠️ ${modeLabel} mode does not route messages to agents. Ignoring: "${message}"`); |
|
🔄 Ralph PR status
Small, focused fix (warning for unused watch message args). Needs rebase onto current dev before merge. |
4ea388c to
0cf7adf
Compare
Add warning when squad watch receives message arguments it cannot route. Update docs and changelog. Co-authored-by: tamirdresher <tamirdresher@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🚀 Full Squad Review — fix(cli): warn on unused squad watch argsDomain: cli/watch
All 21 squad members reviewed and approved. |
0cf7adf to
dbd8179
Compare
🚀 Squad Team Review — PR #704Warns when \squad watch\ receives unused positional args instead of silently ignoring. 4 files, +41/-1. |
|
📋 PR Lifecycle: Team review complete. Labeled \squad:pr-reviewed. Waiting for Dina's review. Add \squad:pr-dina-approved\ when ready to proceed. |
What
Detects extra positional args passed to
squad watchand prints a clear warning instead of silently ignoring them.Why
Users expect
squad watch --interval 5 "Nick, Run scheduled tasks"to route the message to agent Nick on each poll cycle. But watch mode only runs Ralph polling loop — the quoted message is silently dropped. This caused confusion (reported by community user).How
After parsing
--interval, check for remaining args. If found, print:1 file changed:
packages/squad-cli/src/cli-entry.ts(10 lines added)Closes #703
Testing
Docs
N/A
Exports
N/A
Breaking Changes
None
Waivers
None