fix: use OutputChannel for build logs instead of pseudoterminal#897
Merged
fix: use OutputChannel for build logs instead of pseudoterminal#897
Conversation
Replace TerminalSession with TerminalOutputChannel backed by a VS Code OutputChannel. CliContext now takes a plain write callback instead of an EventEmitter.
OutputChannels render ANSI codes as raw text. Use strip-ansi (already a project dependency) to clean the output.
Add a fully-implemented MockOutputChannel to testHelpers, add LogLevel to the vscode mock runtime, and use a setup function in the TerminalOutputChannel tests for black-box input/output assertions.
f4aed13 to
7db73e9
Compare
code-asher
approved these changes
Apr 17, 2026
Member
code-asher
left a comment
There was a problem hiding this comment.
It does seem unfortunate to lose any potential coloring (not sure if we did color anything though) but what can ya do if VS Code is being buggy.
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.
Summary
TerminalSession(pseudoterminal) withTerminalOutputChannel(OutputChannel wrapper) for streaming build and agent logs during connectionstrip-ansisince OutputChannels render them as raw textCliContextnow takes a plainwritecallback instead of avscode.EventEmitterWhy OutputChannel instead of a pseudoterminal?
VS Code never fires the pseudoterminal
open()callback for terminals created during the remote connection resolve flow. Withoutopen(), VS Code hasn't subscribed toonDidWrite, so allwriteEmitter.fire()calls are silently dropped — the "Workspace Build" terminal appears but remains empty.This affects any pseudoterminal created inside the remote resolver's
resolve()method. Terminals created during normal operation (e.g. "Coder: Ping Workspace") work fine because VS Code has fully initialized the terminal renderer by then.OutputChannels don't depend on a rendering lifecycle callback, so they work reliably in any context.This now looks like this and the output channel is disposed (and removed) after this is done, the only downside is that we also ANSI formatting but the terminal was always readonly so this works: