Repository navigation
Description
What happened
Editing an Azure DevOps pull request description in the T3 Code pull request screen on Windows silently dropped everything after the first line. A multi-line Markdown description was saved with only its first heading; the rest was gone, no error was shown, and the update reported success.
The same text is stored correctly when the pull request is created from T3 Code, so only the edit path is affected.
Diagnosis
updatePullRequest passes the description as one inline argv entry:
packages/source-control-azure-devops/src/server/AzureDevOpsPullRequestCli.ts:683
...(input.body === undefined ? [] : [`--description=${input.body}`]),
On Windows, az resolves to az.cmd, so packages/shared/src/shell.ts:871-885 spawns it with shell: true and a single escaped command line. The escaper, escapeWindowsShellArg (shell.ts:50-59), escapes the characters in
const WINDOWS_SHELL_META_CHARS = /([()\][%!^"`<>&|;, *?])/g;
but not \r or \n. A newline therefore terminates the command in cmd.exe: az receives only the first line, and the remainder is discarded without an error.
createPullRequest already avoids this by passing a file (AzureDevOpsCli.ts:534-535, --description @<bodyFile>), which is why creation keeps its full text and only updates truncate.
Still present on main (checked 2026-10-30).
Steps to reproduce
- Windows with the Azure CLI MSI install, signed in, and an Azure DevOps repository linked in T3 Code.
- Open a pull request in T3 Code and edit its description.
- Enter three or more lines, save, and let the update settle.
- Reload the pull request in the Azure DevOps web UI: only the first line is stored.
Minimal reproduction of the underlying spawn, without Azure, using the same escape function and spawn options:
// probe.cmd forwards %* to python, exactly like az.cmd does
spawn([cmd, "--description=" + body].map(escapeWindowsShellArg).join(" "), { shell: true })
// -> ["--description=## Summary"]
spawn(python, ["--description=" + body], { shell: false })
// -> ["--description=## Summary\n\nline two\nline three"]
Version
0.1.5 (desktop app and local server); unfixed on main as of 2026-10-30.
Environment
Windows 11 (10.0.26300) x64, Node 24.22.1, T3 Code Desktop 0.1.5 with its local server, Azure CLI installed via the MSI.
Evidence
packages/shared/src/shell.ts:50
const WINDOWS_SHELL_META_CHARS = /([()\][%!^"`<>&|;, *?])/g; // no \r or \n
server trace, three in-app edits, all reported success:
AzureDevOpsPullRequestCli.updatePullRequest durationMs 1409.9 exit Success
AzureDevOpsPullRequestCli.updatePullRequest durationMs 4155.7 exit Success
AzureDevOpsPullRequestCli.updatePullRequest durationMs 1798.3 exit Success
reproduction through a .cmd hop versus a direct executable, same body, same escaping:
.cmd -> ["--description=## Summary"]
.exe -> ["--description=## Summary\n\nline two\nline three"]
Related issues
#25488 is the same Windows az wrapper surface but a different defect: output decoding (ANSI bytes rendered as U+FFFD), not argument passing.
#25801 (fix(server): run the Azure CLI in UTF-8 on Windows, open) is not the cause of this. It does not touch AzureDevOpsPullRequestCli.ts, and this reproduction is against stock 0.1.5, which does not contain its code. It would incidentally fix this on Windows, because it runs the install's python.exe directly with shell: false instead of going through az.cmd. One caveat observed on this machine: azureCliLauncher.ts infers the install from the launcher's parent directory name (bin or wbin), so a user az.cmd shim living in a directory named bin early on PATH makes azureCliInstall() return undefined, and T3 falls back to the az.cmd hop that truncates. Worth a comment on that pull request; it is independent of the fix proposed below.
#19017 (merge drops the PR title and description) is unrelated: that was a merge-commit message problem.
Fix applied or workaround
No fix applied. The description was restored manually with az repos pr update --description @file, which keeps multi-line text because the body never crosses the command line.
Suggested fix: pass the update body the same way creation already does, as --description @<file>. The general hazard stays for any .cmd-resolved CLI that receives a newline in an argument, since escapeWindowsShellArg cannot represent a newline to cmd.exe.
Filed by
deepseek-v4.1-flash (OpenCode harness) via t3 triage
Activity
juliusmarminge commentedon Nov 22, 2026
A fix for this was proposed in #40847, but when the reported steps were run in the real app the problem did not appear.
What was run on
5799b8af59, the commit before this change:On each commit, open the synthetic PR and refresh it from Azure DevOps. Edit its description to '# Multiline heading\n\nSecond line remains.\nThird line remains.' and click Save. Record either success or the save-error toast. Reload, explicitly refresh from Azure DevOps, and reopen the description editor. Base displayed 'Could not save the description' and retained 'Initial description'; head saved every line. An independent Azure CLI readback confirmed the complete head body. The test PR was abandoned, test branches deleted, servers stopped, Windows lease released, and local scratch/worktree removed.
How: Manual comparison using real T3 web dev servers on leased Windows Server 2025, headless Chromium, 1440x1000 viewport, dark theme, separate fresh T3 homes, and one synthetic Azure DevOps PR. An unrecognized forwarding az.cmd was first on each server's PATH. Captures show the PR panel with account details masked. Both final stills were identical across screenshots taken 500 ms apart. Recordings and stills were visually inspected.
Could you share the exact steps, what you see, and the version and platform you are on? The pull request is closed for now; the fix is picked up again once the problem can be shown.