Skip to content

Fix terminal approval UI missing backslashes on Windows paths#309797

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/fix-terminal-approval-ui-slashes
Draft

Fix terminal approval UI missing backslashes on Windows paths#309797
Copilot wants to merge 2 commits intomainfrom
copilot/fix-terminal-approval-ui-slashes

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 14, 2026

Terminal confirmation dialog renders Windows paths without separators (e.g. D:devmicrosoftvscode-packagesvscode-settings-history instead of D:\dev\microsoft\vscode-packages\vscode-settings-history).

BaseChatConfirmationWidget was embedding plain string titles directly into new MarkdownString(rawValue), causing backslashes to be interpreted as markdown escape characters. In particular, \: is a valid markdown escape that strips the preceding backslash.

Fix: Compose the MarkdownString properly based on the title type:

  • String titlesappendText() (escapes markdown syntax including backslashes)
  • IMarkdownString titlesappendMarkdown() (preserves existing markdown)
  • Icon → always appendMarkdown() (theme icon syntax)
// Before: raw markdown embedding — backslashes treated as escape chars
new MarkdownString(icon ? `$(${icon.id}) ${typeof title === 'string' ? title : title.value}` : ...)

// After: proper composition
const titleMd = new MarkdownString('', { supportThemeIcons: true });
if (icon) {
    titleMd.appendMarkdown(`$(${icon.id}) `);
}
if (typeof title === 'string') {
    titleMd.appendText(title);
} else {
    titleMd.appendMarkdown(title.value);
}

Note: BaseSimpleChatConfirmationWidget already passes title directly to ChatQueryTitlePart, which handles string vs IMarkdownString correctly via toMdString(). Only BaseChatConfirmationWidget had the problematic raw embedding.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • redirector.gvt1.com
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --no-sandbox --crashpad-handler-pid=8131 --enable-crash-reporter=6010be29-e499-4311-bbe3-c34ba17fa46a,no_channel --user-data-dir=/tmp/vscode-tests-1776163004380 --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,11577962897854271121,13545931210410912147,262144 --enable-features=PdfUseShowSaveFilePicker --disable-features=LocalNetworkAccessChecks,ScreenAIOCREnabled,SpareRendererForSitePerProcess,TraceSiteInstanceGetProcessCreation --variations-seed-version --trace-process-track-uuid=3190708989122997041 tnet/tools/git (dns block)
    • Triggering command: .build/electron/code-oss .build/electron/code-oss test/unit/electron/index.js --crash-reporter-directory=/home/REDACTED/work/vscode/vscode/.build/crashes --run src/vs/base/test/common/htmlContent.test.ts --timeout 30000 (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested review from Copilot and removed request for Copilot April 14, 2026 09:46
Copilot AI linked an issue Apr 14, 2026 that may be closed by this pull request
… backslashes

The BaseChatConfirmationWidget was embedding plain string titles directly
as raw markdown via `new MarkdownString(rawValue)`. This caused backslashes
in Windows paths to be interpreted as markdown escape characters (e.g.,
`\:` becomes `:`), stripping path separators from the display.

Fix: use `appendText()` for string titles (which escapes markdown syntax
characters) and `appendMarkdown()` for IMarkdownString titles (preserving
existing markdown). The icon is always added via `appendMarkdown()`.

Fixes #252657

Agent-Logs-Url: https://github.com/microsoft/vscode/sessions/fcbf82c6-2113-4f78-832d-830ce949d7c0

Co-authored-by: hediet <2931520+hediet@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot April 14, 2026 10:41
Copilot AI changed the title [WIP] Fix terminal approval UI missing slashes on Windows Fix terminal approval UI missing backslashes on Windows paths Apr 14, 2026
Copilot AI requested a review from hediet April 14, 2026 10:46
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.

Terminal approval UI is missing slashes (on windows)

2 participants