Skip to content

[Bug]: ACP terminal on Windows runs commands under cmd.exe — agent bash-syntax commands fail, non-ASCII I/O mojibake (CP936) #40395

Closed

Description

@xuli500177

Summary

On Windows, commands that ACP agents run through the host-provided terminal ("the client's integrated terminal" capability) execute under cmd.exe, while agents' tool contracts assume a POSIX shell. Devin's exec tool, for example, is documented as "written with bash syntax", so multi-part commands degrade or fail in confusing ways:

  • ; separators are passed to the binary as literal arguments (pwd; ls → pwd: ignoring non-option arguments)
  • POSIX quoting (\" inside double quotes) derails cmd's quote parser — the remainder of the line, including |, sort, head, &&, echo, gets swallowed into the target binary's argv (seen live: rg receiving |, sort, head as file arguments)
  • for/do/done loops → was unexpected at this time; $VAR, ~, which unsupported
  • Working directory does not reliably persist between exec calls

On a zh-CN host (ANSI codepage 936/GBK) this is amplified in both directions:

  • Non-ASCII characters inside the command string itself (e.g. user profile path C:\Users\<chinese-name>\...) get corrupted at the transport boundary → The system cannot find the path specified on perfectly valid paths
  • All console output from Windows tools (schtasks, powershell, dir) comes back GBK-encoded and displays as mojibake (��̫��)

Steps to reproduce

Windows 11, system locale zh-CN (ANSI CP936), T3 Code desktop 0.1.11 + local server 0.1.11. Any thread on an ACP provider (here: acpRegistry_devin, swe-2-high). From inside the agent's exec:

ver & echo COMSPEC=%COMSPEC%          -> COMSPEC=C:\WINDOWS\system32\cmd.exe
echo "0=$0 BASH=$BASH_VERSION"        -> prints literally, quotes retained, no expansion
pwd; ls                                -> pwd: ignoring non-option arguments
for f in a b; do echo $f; done        -> ... was unexpected at this time
cd "C:\Users\<non-ascii-profile>"     -> The system cannot find the path specified
rg -a -o "pat[\"']+x" f | sort | head -> rg: |: invalid file name; rg: sort: not found; ...

Simple commands appear to work only because MSYS userland binaries (ls, cat, head, rg, pwd) happen to be on PATH — masking that there is no POSIX shell underneath.

Expected behavior

One of:

  • Advertise the actual shell semantics to the agent (capability/metadata/system context) so it generates cmd-compatible commands; or
  • Spawn a POSIX shell when one is available on PATH (Git Bash / WSL bash both exist on this machine); or
  • At minimum, negotiate UTF-8 (chcp 65001 / UTF-8 stdio) so non-ASCII command text and output survive the boundary.

Actual behavior

cmd.exe semantics + GBK stdio. Agent commands written per the documented bash contract fail or silently corrupt arguments.

Impact

Every POSIX-leaning agent connected through ACP on Windows is affected, since the terminal executor lives on the client side — switching harness does not help. Failures are silent and hard to attribute (|/&& swallowed into argv looks like random flakiness). Same CP936 locale family as #38479.

Version / environment

  • T3 Code desktop (Beta) 0.1.11, local server 0.1.11 (service-managed)
  • Windows 11 Pro 26200.9974 x64, system locale zh-CN (ANSI CP936)
  • Agent: acpRegistry_devin / swe-2-high

Evidence

COMSPEC=C:\WINDOWS\system32\cmd.exe reported inside the agent's own exec session; echo "0=$0" prints the literal string including quotes (cmd semantics — no POSIX expansion).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions