Terminal Chat code-insert button sometimes inserts entirely commented-out code #22537

Open
opened 2026-01-31 08:16:06 +00:00 by claunia · 0 comments
Owner

Originally created by @lukejjh on GitHub (Nov 13, 2024).

Originally assigned to: @PankajBhojwani on GitHub.

Windows Terminal version

1.23.3171.0

Windows build number

10.0.26120.0

Other Software

  • OpenAI
  • PowerShell 7

Steps to reproduce

  1. Open Terminal Chat and provide a prompt which might result in multiple lines of code, such as "connect to Exchange Online and list all mailboxes".
  2. Ensure the code starts with a comment (#).
  3. Click the insert/copy icon next to the code block.

Expected Behavior

Possible options:

  • The insert button doesn't insert comments into the terminal; they are filtered out.
  • Line breaks are inserted so that single-line comments are "broken out of".
  • Comments aren't included in code blocks (i.e. the system prompt is modified to instruct the model not to include comments).

Actual Behavior

When there is multi-line code with a leading single-line comment inserted, the code (including comments) are inserted as all one line, meaning that the first comment comments out the entirety of the command, leaving no actual commands.

The code can be manually modified to remove comments, but this greatly takes away from the convenience of just being able to click the code-insert button and have working code just run.

Image
Image

Originally created by @lukejjh on GitHub (Nov 13, 2024). Originally assigned to: @PankajBhojwani on GitHub. ### Windows Terminal version 1.23.3171.0 ### Windows build number 10.0.26120.0 ### Other Software * OpenAI * PowerShell 7 ### Steps to reproduce 1. Open Terminal Chat and provide a prompt which might result in multiple lines of code, such as "_connect to Exchange Online and list all mailboxes_". 2. Ensure the code starts with a comment (`#`). 3. Click the insert/copy icon next to the code block. ### Expected Behavior Possible options: * The insert button doesn't insert comments into the terminal; they are filtered out. * Line breaks are inserted so that single-line comments are "broken out of". * Comments aren't included in code blocks (i.e. the system prompt is modified to instruct the model not to include comments). ### Actual Behavior When there is multi-line code with a leading single-line comment inserted, the code (including comments) are inserted as all one line, meaning that the first comment comments out the entirety of the command, leaving no actual commands. The code can be manually modified to remove comments, but this greatly takes away from the convenience of just being able to click the code-insert button and have working code just run. ![Image](https://github.com/user-attachments/assets/bb1285e6-33ea-454e-b8a7-8c10cc2f24e6) ![Image](https://github.com/user-attachments/assets/bad60746-ed1a-41bf-a8a9-9bdae85fe45d)
claunia added the Issue-BugNeeds-Tag-FixProduct-TerminalArea-Chat labels 2026-01-31 08:16:06 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#22537