Skip to content

fix: replace obsolete --message flag with -p in watch and loop#988

Merged
tamirdresher merged 1 commit intodevfrom
fix/watch-execute-message-flag
Apr 17, 2026
Merged

fix: replace obsolete --message flag with -p in watch and loop#988
tamirdresher merged 1 commit intodevfrom
fix/watch-execute-message-flag

Conversation

@tamirdresher
Copy link
Copy Markdown
Collaborator

Summary

Replace obsolete --message flag with -p across all watch capabilities and loop command. Also switch default invocation from gh copilot to copilot directly to avoid Windows console window issues.

Root cause

The Copilot CLI uses -p for non-interactive prompts. --message was never a valid flag and causes immediate failure: error: unknown option '--message'.

Additionally, gh on Windows is a .cmd batch file that spawns a visible console window even with windowsHide: true. Using copilot directly avoids this.

Changes

8 source files fixed (same pattern in each buildAgentCommand / buildLoopAgentCommand):

  • packages/squad-cli/src/cli/commands/watch/capabilities/execute.ts
  • packages/squad-cli/src/cli/commands/watch/capabilities/decision-hygiene.ts
  • packages/squad-cli/src/cli/commands/watch/capabilities/monitor-email.ts
  • packages/squad-cli/src/cli/commands/watch/capabilities/monitor-teams.ts
  • packages/squad-cli/src/cli/commands/watch/capabilities/retro.ts
  • packages/squad-cli/src/cli/commands/watch/capabilities/wave-dispatch.ts
  • packages/squad-cli/src/cli/commands/watch/index.ts
  • packages/squad-cli/src/cli/commands/loop.ts

1 pre-existing fix (unblocks build):

1 test file updated:

  • test/cli/watch-execute.test.ts — assertions updated to expect copilot and -p

All 16 watch-execute tests pass.

Fixes #980
Closes #874

Copilot AI review requested due to automatic review settings April 16, 2026 14:49
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates Squad’s “watch” capabilities and “loop” command to stop passing the obsolete --message flag to Copilot, switching to -p, and changes the default runner from gh copilot … to invoking copilot directly (to avoid Windows console window spawning via gh.cmd).

Changes:

  • Replace --message with -p across all buildAgentCommand / buildLoopAgentCommand call sites.
  • Change default agent runner from cmd: 'gh', args: ['copilot', …] to cmd: 'copilot', args: ['-p', …].
  • Fix a token-path variable typo in the Teams comms adapter and update one watch-execute test file expectations.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/squad-cli/src/cli/commands/watch/capabilities/execute.ts Updates default Copilot invocation to copilot -p … and updates verbose logging default text
packages/squad-cli/src/cli/commands/watch/capabilities/decision-hygiene.ts Replaces --message with -p and switches default cmd to copilot
packages/squad-cli/src/cli/commands/watch/capabilities/monitor-email.ts Replaces --message with -p and switches default cmd to copilot
packages/squad-cli/src/cli/commands/watch/capabilities/monitor-teams.ts Replaces --message with -p and switches default cmd to copilot
packages/squad-cli/src/cli/commands/watch/capabilities/retro.ts Replaces --message with -p and switches default cmd to copilot
packages/squad-cli/src/cli/commands/watch/capabilities/wave-dispatch.ts Replaces --message with -p and switches default cmd to copilot
packages/squad-cli/src/cli/commands/watch/index.ts Updates shared watch helper buildAgentCommand to use copilot -p … by default
packages/squad-cli/src/cli/commands/loop.ts Updates loop agent command builder to use copilot -p … by default
packages/squad-sdk/src/platform/comms-teams.ts Fixes token path variable used in Windows icacls invocation
test/cli/watch-execute.test.ts Updates expectations to match cmd: 'copilot' and -p

Comment thread packages/squad-cli/src/cli/commands/watch/index.ts
Comment thread packages/squad-cli/src/cli/commands/loop.ts
Comment thread packages/squad-cli/src/cli/commands/watch/index.ts
Comment thread packages/squad-cli/src/cli/commands/watch/capabilities/execute.ts
The Copilot CLI uses -p for non-interactive prompts, not --message.
Switches default invocation from gh copilot to copilot directly
(the standalone binary available on all platforms).

Changes:
- 8 source files: --message to -p, cmd changed to copilot
- loop.ts: aligned preflight to check copilot --version
- comms-teams.ts: fix pre-existing TOKEN_PATH typo from #906
- 2 test files updated (watch-execute + watch-capabilities)
- Changeset added for squad-cli + squad-sdk patch bumps

Fixes #980
Closes #874

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@diberry
Copy link
Copy Markdown
Collaborator

diberry commented Apr 17, 2026

Hey @tamirdresher — nice fix. Here's a review:

PR #988 Review

1. Is this a fix for the issue?

Yes. The PR correctly updates --message to -p across all 8 files that build Copilot CLI commands, and fixes the TOKEN_PATH reference that would fail on Windows. Tests are updated. The immediate bugs are resolved.

2. Is this a fix for the class of issue?

Not yet. The underlying pattern — the same command-building logic living in 8 separate places — is still there. This PR applies the right value everywhere, which is the right first step. A follow-up that extracts a shared buildAgentCommand() would make this class of bug structurally harder to introduce.

3. Does this fix leave technical or structural debt?

Some, which is normal for a targeted bug fix:

  • Command-building logic is still spread across 8 files — a natural candidate for extraction when someone's already working in that area.

  • spawnWithTimeout() appears in 4 places with the same implementation — same consolidation opportunity.

  • Some docs and comments still reference gh copilot while the code now calls copilot directly. Not urgent, but worth a docs-cleanup pass at some point.

None of these are blockers for merging — the PR does what it sets out to do. They're just opportunities for the next pass.

@tamirdresher tamirdresher merged commit 21587fb into dev Apr 17, 2026
@tamirdresher tamirdresher deleted the fix/watch-execute-message-flag branch April 17, 2026 16:21
tamirdresher added a commit that referenced this pull request Apr 21, 2026
)

The Copilot CLI uses -p for non-interactive prompts, not --message.
Switches default invocation from gh copilot to copilot directly
(the standalone binary available on all platforms).

Changes:
- 8 source files: --message to -p, cmd changed to copilot
- loop.ts: aligned preflight to check copilot --version
- comms-teams.ts: fix pre-existing TOKEN_PATH typo from #906
- 2 test files updated (watch-execute + watch-capabilities)
- Changeset added for squad-cli + squad-sdk patch bumps

Fixes #980
Closes #874

Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: watch --execute fails — gh copilot --message is not a valid command loop uses obsolete gh copilot --message flag

3 participants