fix: queue messages when approval buttons are shown (tool/command/mcp) #10717
+200
−2
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: #10675
Roo Code Task Context (Optional)
This PR was created by Roo Code to address the follow-up comment from @johnameyer regarding the same issue happening when the "Roo wants to edit this file" prompt appears with "Save"/"Reject" options.
Description
This PR extends the fix for #10675 to handle all ask types where approval buttons are shown. Previously, messages sent during these states were lost because they were sent as
askResponsebut the backend expected button clicks.Affected Ask Types:
tool- File edits: Save/Reject buttons (the case reported by @johnameyer)command- Command execution: Run Command/Reject buttonsbrowser_action_launch- Browser actions: Approve/Reject buttonsuse_mcp_server- MCP server usage: Approve/Reject buttonscommand_output- Command running: Proceed While Running/Kill Command buttonsRoot Cause:
When approval buttons are shown (
enableButtons = true), the UI allows user input (sendingDisabled = false). Previously, messages were sent directly asaskResponse: "messageResponse", but the backend was waiting for button clicks (yes/no), causing messages to be lost.The Fix:
Added a check for
isWaitingForButtonApprovalinhandleSendMessage. When buttons are enabled and the current ask type requires button-based approval, messages are now queued instead of sent directly. This ensures they are processed after the approval interaction completes.Test Procedure
Unit Tests: Added test cases for:
queues messages when tool approval buttons are shown (tool state) - Issue #10675queues messages when command approval buttons are shown (command state)queues messages when command is running (command_output state) - Issue #10675Manual Testing:
toolask with Save/Reject buttons)Run the tests:
Pre-Submission Checklist
Screenshots / Videos
N/A - This is a behavioral fix with no UI changes.
Documentation Updates
Additional Notes
This PR attempts to address the follow-up comment on Issue #10675 regarding messages disappearing when the "Save"/"Reject" prompt is shown. This is a more comprehensive fix that covers all button-based approval scenarios, not just
command_output.Note: This PR supersedes the approach in PR #10677 which only addressed the
command_outputcase. This fix is more general and handles all ask types where buttons are shown.Feedback and guidance are welcome!
Get in Touch
@roomote
Important
Fixes message loss by queuing messages during approval button states in
ChatView.tsx, with tests added inChatView.spec.tsx.ChatView.tsx.tool,command,browser_action_launch,use_mcp_server, andcommand_outputask types.isWaitingForButtonApprovalcheck inhandleSendMessageto queue messages.ChatView.spec.tsxfor queuing messages duringtool,command, andcommand_outputstates.askResponseduring approval button states.This description was created by
for ec5cf17. You can customize this summary. It will automatically update as commits are pushed.