-
Notifications
You must be signed in to change notification settings - Fork 2.6k
fix: prevent queue from interfering with manual approval workflow (#6996) #6997
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Queue processing now pauses when approval buttons are showing (enableButtons is true) - Messages typed during approval requests are queued instead of being sent immediately - This prevents the unintended auto-rejection behavior when using QUEUE with manual approval Fixes #6996
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewing my own code is like debugging in a mirror - everything looks backwards but the bugs are still mine.
|
|
||
| if (text || images.length > 0) { | ||
| if (sendingDisabled && !fromQueue) { | ||
| // Queue messages when: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment block here is helpful but could be more concise. Consider consolidating it to something like: 'Queue messages when approval buttons are showing or sending is disabled to prevent auto-rejection during manual approval'
| // 1. sendingDisabled is true (existing behavior) | ||
| // 2. OR when approval buttons are showing (enableButtons is true) to prevent auto-rejection | ||
| // This ensures that pressing Enter during manual approval doesn't immediately reject the request | ||
| if ((sendingDisabled || enableButtons) && !fromQueue) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider extracting the condition (sendingDisabled || enableButtons) into a named variable or function like shouldQueueMessage for better readability and maintainability, since this logic appears in multiple places.
| isProcessingQueueRef.current || | ||
| clineAsk === "api_req_failed" | ||
| clineAsk === "api_req_failed" || | ||
| enableButtons // Don't process queue when approval buttons are shown |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this intentional? The isProcessingQueueRef.current flag is set after the async check. If multiple effects trigger simultaneously, there could be a brief window where two queue processors start. Consider moving line 653 before the return statement to ensure the flag is set synchronously.
| isProcessingQueueRef.current = false | ||
| } | ||
| }, [sendingDisabled, messageQueue, handleSendMessage, clineAsk]) | ||
| }, [sendingDisabled, messageQueue, handleSendMessage, clineAsk, enableButtons]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fix correctly prevents queue processing during approval states, but it would benefit from test coverage. Consider adding tests for the queue/manual approval interaction to prevent regression of this critical workflow.
|
Closing this PR. The fix creates a deadlock where queued messages can never be sent - they're blocked during approval (enableButtons=true) and after approval (sendingDisabled=true). The root issue is that #6996 lacks proper scoping. It needs clear requirements for:
The issue should be re-scoped before attempting another fix. |
|
Closing due to critical bug in implementation. Issue needs proper scoping before reattempting. |
This PR fixes the issue where the QUEUE feature with manual approval enabled causes unintended auto-rejections when a follow-up message is placed in the queue.
Problem
When using QUEUE with manual approval:
Solution
The fix involves two key changes:
Changes Made
Testing
Related Issue
Fixes #6996
Important
Fixes QUEUE feature interference with manual approval by pausing queue processing when approval buttons are visible in
ChatView.tsx.enableButtonsis true inChatView.tsx, preventing interference with manual approval.handleSendMessagequeues messages ifenableButtonsis true, avoiding immediate sending during approval requests.ChatView.tsxto includeenableButtonsin conditions.handleSendMessageto checkenableButtonsbefore sending messages.enableButtonsto dependency arrays in relevantuseEffecthooks.This description was created by
for 4a96aa2. You can customize this summary. It will automatically update as commits are pushed.