Fix copilot engine shell argument escaping for special characters#1035
Fix copilot engine shell argument escaping for special characters#1035
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
... |
|
@copilot Review the generated lock file dev.lock.yml . The "$INSTRUCTIONS" argument should NOT be quoted. Fix this issue, add tests. |
…CTION" Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
... Fixed! The shell escaping now recognizes already-quoted arguments and preserves them. Before: Enhanced |
…4a68-440d-8f3a-c6c2b67411aa
|
@copilot fix tests |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Tests fixed! The copilot engine tests were failing because they expected 2 steps but the engine now generates 3 steps (upload config, execute copilot CLI, ensure log file). Updated tests to expect 3 steps and look at the correct step for the copilot command. All tests now pass. Commit: 70430b3 |
Fix Copilot Engine Shell Argument Escaping
Problem
The copilot engine was generating shell commands with unescaped special characters in
--allow-toolarguments, causing bash syntax errors that prevented workflows from executing.Plan
computeCopilotToolArgumentsto properly quote arguments with special charactersSolution
shellJoinArgs()andshellEscapeArg()functions in dedicatedshell.gofile()[]{}*?$"'|&;<> \t\n` are wrapped in single quotes'\"'\"'technique"$INSTRUCTION") are left unchanged to preserve variable expansionGetExecutionSteps()to useshellJoinArgs()instead ofstrings.Join()Review of Other Engines
Fix for "$INSTRUCTION" Issue
The shell escaping was incorrectly wrapping
"$INSTRUCTION"in single quotes, preventing variable expansion:--prompt '"$INSTRUCTION"'(broken - no variable expansion)--prompt "$INSTRUCTION"(correct - allows variable expansion)Testing
$INSTRUCTIONhandling✅ All tests fixed and passing
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.