fix: prevent hang when sending message during command_output #10564
+38
−3
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.
Related GitHub Issue
Closes: #10329
Roo Code Task Context (Optional)
This PR was created with Roo Code assistance.
Description
This PR attempts to address Issue #10329 where the UI hangs when a user sends a message while a command is running (during
command_outputstate).Root Cause:
When a user sends a message during
command_output:handleSendMessage()sendsaskResponsewhich resolves the askrunInBackgroundbecomestrue, preventing newcommand_outputaskshandleChatReset()disables the UI (sendingDisabled: true, clineAsk: undefined, enableButtons: false)command_outputask is sent to re-enable the UI, causing the hangSolution:
Instead of sending
askResponseforcommand_outputmessages, we now:terminalOperation: "continue"with the user's text/images attachedhandleChatReset()to keep UI responsiveterminalOperationincludes text/images, resolve the pending ask viahandleWebviewAskResponse()so the loop can continue with the user's messageFiles Changed:
webview-ui/src/components/chat/ChatView.tsx: Special case forcommand_outputinhandleSendMessage()src/core/webview/webviewMessageHandler.ts: Pass text/images from terminalOperation to Tasksrc/core/task/Task.ts: ExtendedhandleTerminalOperation()to optionally resolve pending askTest Procedure
TypeScript compilation passes for both
src/andwebview-ui/.Pre-Submission Checklist
Screenshots / Videos
N/A - This is a behavior/timing fix, not a UI change.
Documentation Updates
Additional Notes
This is a draft PR. Feedback and guidance are welcome. The fix takes a different approach than the existing "Proceed While Running" button - it allows user messages to be captured and passed through while keeping the UI responsive.
Note: There is a separate PR #10563 that addresses a related but different issue (inline terminal shell configuration). This PR specifically fixes the original hang bug.
Get in Touch
N/A - Automated contribution
Important
Fix UI hang by sending
terminalOperationinstead ofaskResponseduringcommand_outputinChatView.tsxandwebviewMessageHandler.ts.ChatView.tsx,handleSendMessage()now sendsterminalOperation: "continue"forcommand_outputmessages, skippinghandleChatReset()to keep the UI responsive.webviewMessageHandler.ts,terminalOperationmessages pass text/images tohandleTerminalOperation().handleTerminalOperation()inTask.tsresolves pending asks with user messages ifterminalOperationincludes text/images.command_outputstate.This description was created by
for 2712853. You can customize this summary. It will automatically update as commits are pushed.