Skip to content

fix(cli): prevent Windows cmd.exe multiline prompt truncation in watch --execute (#2070) - #2224

Merged
tamirdresher merged 1 commit into
github:devfrom
tamirdresher:fix/2070-windows-watch-multiline-prompt
Oct 14, 2026
Merged

tamirdresher merged 1 commit into
github:devfrom
tamirdresher:fix/2070-windows-watch-multiline-prompt

Conversation

@tamirdresher

Copy link
Copy Markdown
Collaborator

Summary

Fixes two issues in squad watch --execute / squad triage --execute on Windows (#2070):

  1. cmd.exe multiline & length truncation (�gent-spawn.ts):
    • On Windows (IS_WINDOWS), �xecFile(..., { shell: true }) invokes cmd.exe /d /s /c, which truncates double-quoted arguments at the first newline (\r or \n) and enforces an 8,191-character command-line limit.
    • Spill multiline or oversized (> 4,000 chars) prompt arguments to a temporary .md file under os.tmpdir()/squad-prompts, pass a single-line pointer prompt to cmd.exe, and clean up the temporary file when the child process exits.
  2. Round summary 🚀 Executed count (watch/index.ts, capabilities/execute.ts):
    • ExecuteCapability.execute() returned data: { dispatched, success }, while watch/index.ts read �xecResult.data['executed'].
    • Include �xecuted in ExecuteCapability.execute() result data and fall back to dispatched in watch/index.ts so the round summary accurately reflects dispatched issues.

Validation

  • Added unit tests in est/cli/watch-agent-spawn.test.ts and est/cli/watch-capabilities.test.ts.
  • Verified all 16 watch test files (219 tests) pass.

Closes #2070

Copilot AI balanced review requested due to automatic review settings October 14, 2026 14:40
@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

🛫 PR Readiness Check

ℹ️ This comment updates on each push. Last checked: commit cc813fa

PR Scope: 📦🔧 Mixed (product + infrastructure)

⚠️ 2 item(s) to address before review

Status Check Details
✅ Single commit 1 commit — clean history
✅ Not in draft Ready for review
✅ Branch up to date Up to date with dev
❌ Copilot review No Copilot review yet — it may still be processing
✅ Changeset present Changeset file found
✅ Scope clean No .squad/ or docs/proposals/ files
✅ No merge conflicts No merge conflicts
✅ Copilot threads resolved 0 active Copilot thread(s) resolved (2 outdated skipped)
❌ CI passing 9 check(s) still running

Files Changed (6 files, +168 −13)

File +/−
.changeset/windows-watch-multiline-prompt.md +5 −0
packages/squad-cli/src/cli/commands/watch/agent-spawn.ts +77 −6
packages/squad-cli/src/cli/commands/watch/capabilities/execute.ts +1 −0
packages/squad-cli/src/cli/commands/watch/index.ts +8 −2
test/cli/watch-agent-spawn.test.ts +63 −0
test/cli/watch-capabilities.test.ts +14 −5

Total: +168 −13


This check runs automatically on every push. Fix any ❌ items and push again.
See CONTRIBUTING.md and PR Requirements for details.

@github-actions

Copy link
Copy Markdown
Contributor

🟡 Impact Analysis — PR #2224

Risk tier: 🟡 MEDIUM

📊 Summary

Metric Count
Files changed 6
Files added 1
Files modified 5
Files deleted 0
Modules touched 3
Critical files 1

🎯 Risk Factors

  • 6 files changed (6-20 → MEDIUM)
  • 3 modules touched (2-4 → MEDIUM)
  • Critical files touched: packages/squad-cli/src/cli/commands/watch/index.ts

📦 Modules Affected

root (1 file)
  • .changeset/windows-watch-multiline-prompt.md
squad-cli (3 files)
  • packages/squad-cli/src/cli/commands/watch/agent-spawn.ts
  • packages/squad-cli/src/cli/commands/watch/capabilities/execute.ts
  • packages/squad-cli/src/cli/commands/watch/index.ts
tests (2 files)
  • test/cli/watch-agent-spawn.test.ts
  • test/cli/watch-capabilities.test.ts

⚠️ Critical Files

  • packages/squad-cli/src/cli/commands/watch/index.ts

This report is generated automatically for every PR. See #733 for details.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The fallback can still pass unsafe prompts inline, while escapeArgs can leak temporary prompt files.

2 open findings
What changed in this PR

Fixes Windows prompt truncation in watch execution and corrects executed-issue reporting.

Changes:

  • Spills multiline/oversized prompts to temporary files on Windows.
  • Reports executed counts with backward-compatible dispatch fallback.
  • Adds regression tests and a CLI changeset.
File Description
.changeset/​windows-watch-multiline-prompt.md Documents the patch release.
packages/​squad-cli/​src/​cli/​commands/​watch/​agent-spawn.ts Adds Windows prompt-file handling and cleanup.
packages/​squad-cli/​src/​cli/​commands/​watch/​capabilities/​execute.ts Returns the executed count.
packages/​squad-cli/​src/​cli/​commands/​watch/​index.ts Reads executed or dispatched counts.
test/​cli/​watch-agent-spawn.test.ts Tests Windows argument spilling.
test/​cli/​watch-capabilities.test.ts Tests execution reporting and Windows paths.

Review effort: Balanced

Comment on lines +149 to +152
} catch {
// If temp-file creation fails (e.g. read-only tmpdir), collapse newlines so cmd.exe does not truncate at line 1.
return arg.replace(/\r?\n+/g, ' ');
}
Comment on lines +186 to 189
export function escapeArgs(args: string[], isWindows: boolean = IS_WINDOWS): string[] {
if (!isWindows) return args;
return args.map(arg => spillPromptArgForCmd(arg)).map(escapeForCmd);
}
@tamirdresher
tamirdresher force-pushed the fix/2070-windows-watch-multiline-prompt branch from 4e113bd to 4fae6a3 Compare October 14, 2026 14:54
…h --execute (github#2070)

Closes github#2070

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 5cf0811c-a02a-41a7-ab00-904b6900db7b
@tamirdresher
tamirdresher force-pushed the fix/2070-windows-watch-multiline-prompt branch from 4fae6a3 to cc813fa Compare October 14, 2026 15:13
@tamirdresher
tamirdresher merged commit be74795 into github:dev Oct 14, 2026
17 checks passed
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.

watch --execute on Windows: cmd.exe truncates the agent prompt at its first newline, so no issue is ever worked

2 participants