Kiro icon indicating copy to clipboard operation
Kiro copied to clipboard

kiro-cli --v3: `execute_pwsh` escapes double quotes to `\"` on Windows, breaking every quoted command

Open gujunxiang opened this issue 4 months ago • 7 comments

Before opening, please confirm:

Operating System

Windows11

Kiro Version

2.13.0

Bug Description

This behavior does not occur in v2. Only after upgrading to v3 does the command become incorrectly escaped. On Windows, the execute_pwsh tool escapes any double quote (") in the command string into a literal \" before handing it to the shell. This corrupts both native cmd commands and any pwsh/powershell -Command "..." invocation, so no command containing double quotes can execute correctly.

Steps to Reproduce

  1. echo "hello with quotes"
  2. pwsh -NoProfile -Command "1+1"
  3. powershell -NoProfile -Command "Write-Output 'x'; (2+3)"

Expected Behavior

Expected result

  1. hello with quotes
  2. 2
  3. x then 5

Conversation ID

No response

Additional Context

This behavior does not occur in v2. The exact same agent instructions, prompts, and environment execute successfully in v2. Only after upgrading to v3 does the command become incorrectly escaped.

gujunxiang avatar Jul 22 '26 01:07 gujunxiang

🤖 Potential Duplicate Detected

This issue appears to be similar to:

What happens next?

  • ⏰ This issue will be automatically closed in 3 days
  • 🏷️ If this is not a duplicate, you can prevent automatic closure by adding a comment or reacting with 👎 to this message.
  • 💬 Comment on the original issue if you have additional information

Why is this marked as duplicate? Both issues report bugs with the 'execute_pwsh' tool on Windows that corrupt command strings - Issue #10006 reports consecutive spaces being collapsed, while the new issue reports double quotes being escaped to '"'. Same tool, same OS, same category of string-mangling bug in command execution.

github-actions[bot] avatar Jul 22 '26 01:07 github-actions[bot]

This does not appear to be a duplicate of #10006.

Issue #10006 is specifically about consecutive spaces being collapsed.

This issue is about double quotes being escaped as \", which causes PowerShell command parsing failures.

They may belong to the same general category (command string corruption), but they have different symptoms, different reproduction steps, and potentially different root causes.

More importantly, this issue is a regression introduced in V3:

  • V2 executes the same commands correctly
  • V3 rewrites quoted strings and breaks execution

Examples that fail due to quote escaping:

Write-Host "hello"
git commit -m "message"
python -c "print('hello')"

gujunxiang avatar Jul 22 '26 01:07 gujunxiang

Thank you for your feedback! 🙏

The duplicate label has been removed and this issue has been sent back for maintainer review.

A maintainer will review this issue shortly.

github-actions[bot] avatar Jul 22 '26 01:07 github-actions[bot]

Thanks for the clear report and the v2/v3 comparison.

This might be caused by Node.js's spawn() on Windows escaping arguments for the CreateProcess API. The v3 agent passes the command to spawn(shell, ['-Command', command]) without windowsVerbatimArguments: true — so Node.js applies its default Windows argument escaping, converting " to \" in the command-line string before PowerShell sees it.

v2 doesn't have this because it uses Rust's Command which handles Windows quoting differently.

#10173 is a duplicate of this issue. Marking as bug to investigate further.

AnilMaktala avatar Jul 23 '26 01:07 AnilMaktala

This appears to be a regression between v2 and v3 and currently blocks our use of the CLI on Windows because nearly all execute_pwsh commands containing quotes fail. Any status update would be appreciated.

gujunxiang avatar Jul 30 '26 02:07 gujunxiang

This was reported against CLI 2.13.0. Could you retest with the current version (CLI 2.19.x)? We made changes to the PowerShell command handling path in subsequent releases. To update: download from kiro.dev.

AnilMaktala avatar Aug 26 '26 15:08 AnilMaktala

This issue has been automatically closed due to inactivity. It has been 7 days since we requested additional information.

If you still need help with this issue, please feel free to reopen it or create a new issue with the requested details.

github-actions[bot] avatar Sep 03 '26 00:09 github-actions[bot]