microsoft / microsoft/vscode

Agent Host CLI output is garbled and shows the wrong management command on Windows

Open
#333,375 1 comment 0 reactions 1 assignee Claimed by @dmitrivMS View on GitHub
agent-host bug
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

Does this issue occur when all extensions are disabled?: Yes

- VS Code Version: 1.136.0-insider
- OS Version: Windows 11
- Shell: Command Prompt using a non-UTF-8 console output code page

## Steps to reproduce

1. Run `code-insiders agent host --tunnel`.
2. Observe the startup banner.
3. Run `code-insiders agent ps`.

## Actual behavior

Decorative UTF-8 characters are emitted as raw bytes and decoded using the active legacy Windows console code page, producing output such as:

```text
Γ₧£ Tunnel: https://insiders.vscode.dev/agents/tunnel/agent-host-1
ΓöÇΓöÇ standalone (pid 23484, 127.0.0.1:50151) [insider] ΓöÇΓöÇ
ΓÜá AHP initialize failed: ...
```

The startup banner also hardcodes the stable command name:

```text
Manage: code agent ps | code agent kill
```

This is incorrect when invoked through `code-insiders` (and potentially other product qualities).

## Expected behavior

- Detect whether the active Windows console output code page is UTF-8. Preserve Unicode decorations when supported and use readable ASCII equivalents otherwise. Redirected output should remain UTF-8.
- When a detached Agent Host supervisor produces the banner through a pipe, use the foreground CLI's terminal capability rather than the hidden supervisor process's console state.
- Build management command hints from the product's configured `applicationName`, such as `code-insiders`, instead of hardcoding `code`.
- Apply the encoding-safe decorations consistently to Agent Host banners, `agent ps`, `agent logs`, and pager status output.

Related: #332560 includes the same mojibake in its reproduction, although that issue tracks the separate AHP protocol-version mismatch.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.