fix: prevent queued messages from auto-approving unapproved commands#12303
Draft
roomote-v0[bot] wants to merge 1 commit intomainfrom
Draft
fix: prevent queued messages from auto-approving unapproved commands#12303roomote-v0[bot] wants to merge 1 commit intomainfrom
roomote-v0[bot] wants to merge 1 commit intomainfrom
Conversation
When a queued message was drained during a tool/command/mcp ask, the code unconditionally sent "yesButtonClicked", which approved the pending command regardless of auto-approval settings. This changes the response to "messageResponse" instead, matching the behavior when a user types a reply without clicking Approve (the command gets rejected). Fixes #12302
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.
Related GitHub Issue
Closes: #12302
Description
This PR attempts to address Issue #12302. Feedback and guidance are welcome.
Root cause: In
Task.ask(), when a queued message is drained during acommand,tool, oruse_mcp_serverask, the code unconditionally sent"yesButtonClicked", which approved the pending command regardless of auto-approval settings. This meant any queued message would silently approve commands the user never explicitly approved.Fix: Changed both queued-message drain locations (the immediate drain at line ~1437 and the
pWaitForpoll at line ~1462) to send"messageResponse"instead of"yesButtonClicked"for tool/command/mcp asks. This matches the existing behavior when a user types a reply without clicking the Approve button -- the command gets rejected and the message text is forwarded as a regular message.Commands that were already auto-approved (via
checkAutoApprovalreturningdecision: "approve") are resolved before reaching the drain code, so they are unaffected by this change.Test Procedure
src/core/task/__tests__/ask-queued-message-drain.spec.tscoveringcommand,tool, anduse_mcp_serverask types"messageResponse"(rejected) rather than"yesButtonClicked"(approved)followupandcommand_outputasks continue to passcd src && npx vitest run core/task/__tests__/ask-queued-message-drain.spec.tsPre-Submission Checklist
Documentation Updates
Additional Notes
Two files changed:
src/core/task/Task.ts-- changed"yesButtonClicked"to"messageResponse"in two locations within the queued message drain logicsrc/core/task/__tests__/ask-queued-message-drain.spec.ts-- added 3 new tests for command/tool/mcp ask typesInteractively review PR in Roo Code Cloud