Copilot chat incorrectly interprets/adds extra backslashes in user prompts #160325
Replies: 2 comments 1 reply
-
Hello @craigphicks, Thank you for highlighting this issue with GitHub Copilot chat's handling of backslashes in text inputs. You've provided an excellent analysis and demonstration of the problem. What's happeningAs you've correctly identified, when text containing backslashes is pasted into GitHub Copilot chat, additional backslashes are being added during the input processing phase - before the text even reaches Copilot's model. This is particularly problematic for shell commands, escape sequences, and other code snippets where precise backslash handling is critical. Your verification using the hex encoding was a clever approach that confirms the issue is occurring during input processing rather than in Copilot's interpretation or response generation. Related resource: GitHub Copilot documentation - For general information about GitHub Copilot features and functionality. Potential workaroundsUntil this issue is addressed, here are some potential workarounds:
Your suggested solutionI agree with your suggestion of adding a raw input mode that preserves exact character sequences. This would be tremendously helpful not just for backslash handling but for any situation requiring precise character preservation. Resources to track this issue:
Next stepsI'll ensure your feedback is highlighted to the appropriate teams. This is an important issue for anyone working with shell scripts, escape sequences, or regular expressions in Copilot chat. Thank you for your thorough report and clever verification method. These kinds of detailed reports are incredibly valuable for improving the GitHub Copilot experience. |
Beta Was this translation helpful? Give feedback.
-
💬 Your Product Feedback Has Been Submitted 🎉 Thank you for taking the time to share your insights with us! Your feedback is invaluable as we build a better GitHub experience for all our users. Here's what you can expect moving forward ⏩
Where to look to see what's shipping 👀
What you can do in the meantime 💻
As a member of the GitHub community, your participation is essential. While we can't promise that every suggestion will be implemented, we want to emphasize that your feedback is instrumental in guiding our decisions and priorities. Thank you once again for your contribution to making GitHub even better! We're grateful for your ongoing support and collaboration in shaping the future of our platform. ⭐ |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Select Topic Area
Product Feedback
Copilot Feature Area
Copilot in GitHub
Body
Problem Description
When users paste text containing backslashes into the chat, Copilot appears to see additional backslashes that aren't actually present in the input. This makes it particularly difficult for Copilot to correctly handle shell commands or other text that requires precise backslash escaping.
Example
When a user pastes this command:
Copilot sees and tries to work with a different version that has additional backslashes. If asked to repeat that prompt it will add in extra backslashes that it sees in the input:
Verification
By passing the following literal hex encoding of the above example, copilot sees the exact input and can repeat back the original text version exactly.
This shows the extra backslashes are getting added in on the way to copilot, not on the way back, nor is it a problem with copilot logic.
Suggested Solutions
Beta Was this translation helpful? Give feedback.
All reactions