fix(ui): add partial output to cancelled shell UI#21178
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses an issue where partial output from shell commands was lost upon cancellation. By modifying the state management, any live output generated before cancellation is now preserved and subsequently displayed in the user interface. This enhancement improves the user experience by providing more informative feedback when a long-running shell command is interrupted. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request aims to display partial output from a shell command if it's cancelled. The implementation correctly captures liveOutput from an executing tool and adds it to the final CancelledToolCall state. The changes include adding a test case to verify the UI behavior.
My review identifies one potential issue in state-manager.ts where partial output from a tool in the AwaitingApproval state (like a file diff from an edit tool) might be lost upon cancellation under certain conditions. I've suggested a fix to ensure consistent behavior and prevent this information loss.
|
Size Change: +387 B (0%) Total Size: 26 MB ℹ️ View Unchanged
|
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
| if (isToolCallResponseInfo(reason)) { | ||
| const finalResponse = { ...reason }; | ||
| if (!finalResponse.resultDisplay) { | ||
| finalResponse.resultDisplay = resultDisplay ?? existingOutput; |
There was a problem hiding this comment.
edge case to watch out for here is when the tool output is large and so we have added a message at the end indicating we have written the full output to a file. please test that case
There was a problem hiding this comment.
I'll address it in a follow-up PR
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

Summary
Added partial shell output to cancelled shell tool calls.
Details
Added the liveOutput from the shell tool call before its status is set to cancelled and the tool's result is discarded.
Related Issues
Fixes #20623
How to Validate
Ask Gemini CLI
Run npm test -w @google/gemini-cliand cancel before it finishes running. The partial output should show in the cancelled shell.Pre-Merge Checklist