microsoft/vscode PR #320782 — Fix empty terminal pills during streaming — PR #320782
microsoft/vscode · pull request #320782 ·
Transcript
PlainEnglish
Welcome! We're looking at pull request 320782 from the VS Code repo — a focused bug fix that stops empty terminal pills from showing up in the chat UI while commands are still streaming in from the model.
PlainEnglish
The PR has one primary goal: make sure terminal pills only render when the command is actually available. It also adds a regression test to catch this in the future, and importantly, it preserves the existing rendering logic for terminal calls that already have their input.
PlainEnglish
So here's what happened. An earlier PR added support for rendering bash and powershell tools as terminal pills in the chat UI. These tools advertise themselves via a metadata flag that fires right away, before the actual command has streamed in from the model. That timing mismatch left users staring at empty terminal windows during the streaming phase, which looked broken. This PR fixes that by waiting for the command input before switching to the terminal pill.
Architecture
The fix touches two files — both in the chat agent sessions area. The production change lives in stateToProgressAdapter dot t s, which handles the rendering decision, and we've added a test case in the companion test file to make sure this doesn't regress.
Architecture
Here's the core change. The isTerminalToolCall function decides whether a tool should render as a terminal pill. It checks three signals: an existing kind annotation, the tool's metadata kind, and whether there's terminal content in the state. The fix adds an extra condition to the second branch — now, when a tool advertises itself as terminal via metadata, we also check that getTerminalInput returns something other than undefined. If the command isn't available yet, we skip the terminal pill and fall back to the generic tool widget. The JSDoc comment explains why: empty terminal pills look broken during streaming.
Architecture
And here's the regression test. We create a bash tool call with no input yet, streaming state, and a terminal toolKind in the metadata. When we run it through the rendering logic, the test asserts that toolSpecificData comes back undefined — meaning no terminal pill — and instead we see the generic invocationMessage saying Running bash. That confirms the fallback behavior works as expected.
PlainEnglish
After this PR lands, terminal tools that declare themselves via metadata will no longer flash empty pills during the streaming phase. They'll show a clean generic tool widget with their invocation message until the command is ready, then seamlessly switch to the terminal pill once the input arrives. No more broken-looking blank windows.
CodeQuality
The agent looked at the conditional branches in isTerminalToolCall, the getTerminalInput function's handling of missing data, the invocation rendering path, the test factory setup, and confirmed no public API changes. All clean — no concerns raised.
PlainEnglish
And that's the pull request. A small timing fix that makes sure terminal pills only appear once their commands are ready to show. The guard sits at line 454 in stateToProgressAdapter, the regression test is at line 716 in the test file, and the existing rendering paths for other terminal signals remain untouched. Thanks for watching!
How this was made
Lenzon read microsoft/vscode at pull request #320782 and generated this walkthrough automatically. The narration above is the transcript of what it says.
Explain a pull request from your own repo
Point Lenzon at a repo or a pull request and get a narrated walkthrough like this one.
Try it