Fix agent host SDK terminal tool rendering; disable custom terminal tool by default#318257
Merged
roblourens merged 3 commits intoMay 26, 2026
Merged
Conversation
The detached xterm used to render terminal tool output treats input as a raw TTY stream where a lone \n is just LF (cursor moves down without column reset), producing a staircase rendering. The custom terminal tool's output goes through xterm's serialize addon which emits proper VT with \r\n line endings. The agent host SDK path, however, was passing the SDK's plain text through unchanged, so multi-line output rendered with each line starting at the column where the previous one ended. Normalize \n to \r\n in getTerminalOutput, the adapter boundary where SDK content is shaped into terminalCommandOutput. The replace is idempotent on already-CRLF input. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes staircase rendering of multi-line terminal tool output for agent-host SDK terminal tools by normalizing \n to \r\n in the adapter that produces terminalCommandOutput.text, so the detached xterm (which treats input as raw TTY) advances both row and column.
Changes:
- Normalize lone LF to CRLF in
getTerminalOutputat the SDK-to-protocol adapter boundary. - Add a regression test covering mixed
\n/\r\ninputs.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/stateToProgressAdapter.ts | Replace \r?\n with \r\n in getTerminalOutput, with explanatory comment. |
| src/vs/workbench/contrib/chat/test/browser/agentSessions/stateToProgressAdapter.test.ts | New test asserting CRLF normalization in finalized terminal tool output. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 1
Two assertions checked the previous raw \n output from getTerminalOutput; update them to expect the normalized \r\n. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Change the default of chat.agentHost.customTerminalTool.enabled from true to false so Copilot SDK sessions use the SDK's default terminal behavior out of the box. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
DonJayamanne
approved these changes
May 26, 2026
anthonykim1
added a commit
that referenced
this pull request
May 26, 2026
Squashed cherry-pick of 10 commits from main that are included in the Insiders build (183159e) people are verifying: - agentHost: show fetched URL for web_fetch (#318240) - Fix SSH remote agent host passphrase auth (#318244) - agentHost: add setting to disable worktreeCreated task auto-dispatch (#318243) - Agent host: clearer worktree git timeout errors and 60s budget (#318242) - Normalize LF to CRLF in agent host terminal tool output (#318257) - sessions: restore X-button removal of SSH remote agent host entries (#318262) - chat: fix duplicate command registration for agent-host-copilotcli (#318273) - launch: build copilot in compile; wait for CDP in launch.sh (#318272) - Preserve unread state across remote host disconnect (#318267) - Add more codenotify for terminal (#318285)
dileepyavan
pushed a commit
that referenced
this pull request
May 27, 2026
Squashed cherry-pick of 10 commits from main that are included in the Insiders build (183159e) people are verifying: - agentHost: show fetched URL for web_fetch (#318240) - Fix SSH remote agent host passphrase auth (#318244) - agentHost: add setting to disable worktreeCreated task auto-dispatch (#318243) - Agent host: clearer worktree git timeout errors and 60s budget (#318242) - Normalize LF to CRLF in agent host terminal tool output (#318257) - sessions: restore X-button removal of SSH remote agent host entries (#318262) - chat: fix duplicate command registration for agent-host-copilotcli (#318273) - launch: build copilot in compile; wait for CDP in launch.sh (#318272) - Preserve unread state across remote host disconnect (#318267) - Add more codenotify for terminal (#318285)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two related changes for the agent host SDK terminal tool experience.
1. Normalize LF to CRLF in agent host terminal tool output
The detached xterm used to render terminal tool output (
DetachedTerminalSnapshotMirror.render()inchatTerminalCommandMirror.ts) callsterminal.xterm.write(text), which treats input as a raw TTY stream. A lone\nis just LF (cursor moves down, column unchanged), so subsequent lines start at whatever column the previous line ended producing a staircase.onExample SDK output:
Rendered as:
Why the custom terminal tool didn't hit this
xterm's serialize addon, which emits proper VT with
\r\n. The agent host SDK path instateToProgressAdapter.getTerminalOutput()just passed the SDK's plain text through unchanged.Fix
\r\ninthe adapter boundary where SDK content is shaped intoterminalCommandOutput. This:getTerminalOutput()Added a regression test covering mixed
\n/\r\ninput and updated two existing assertions inagentHostChatContribution.test.tsthat exercised the same path.2. Disable agent host custom terminal tool by default
Changed the default of
chat.agentHost.customTerminalTool.enabledfromtruetofalse, so Copilot SDK sessions use the SDK's default terminal behavior out of the box. Users who want the Agent Host terminal tool override can still opt in.(Written by Copilot)