Loading
Fix Duo chat queued prompts overriding approvals and leaking between chats
What does this MR do and why?
Fixes two noted regressions with the queued chat feature
- Message during tool approvals: previously sending a message while a tool approval was pending would deny the approval and steer the agent. With queued messages this message would instead become queued. This MR returns to the prior behavior, immediately firing the message and denying the approval. If a message is queued before the approval it remains queued.
- New chat: when a message was queued in one chat and the user switched to a different chat (e.g. queue "say hi" in chat A, then go to New > Planner, the message "say hi" fires in Planner chat), this is unintended. This MR prevents queued messages from crossing over betewen chats.
Full details 🤖
Duo Agentic Chat can queue a prompt submitted while an agent turn is running, a feature that shipped in !248098 (merged) and introduced two regressions fixed here: queuing swallowed the user's escape hatch out of a pending tool-call approval, and switching agents or chat threads let a queued prompt fire into the wrong conversation.
- Split
canSendPromptinto a narrower gate covering only hydration, reconnects, and the workflow lock, so the composer sends a prompt immediately even while a tool-call approval is pending. - Added
canDrainQueue, which restores the pending-approval condition for the queue only, so a prompt queued before an approval appears keeps waiting instead of auto-answering it. onNewChatnow clears the queue when the panel starts a new chat, except when the triggering prompt was a base command (/new, /reset, /clear), since prompts queued behind those are still meant to run.- Queue entries now record their owning workflow in sessionStorage, and the queue discards anything owned by a different workflow on load, since switching threads remounts the state manager without calling
onNewChat. - Bumped the sessionStorage queue key from v2 to v3 for the shape change.
References
How to set up and validate locally
- Open the Duo Chat panel and send a prompt that makes the agent ask for a tool call approval.
- While the approve and deny buttons are showing, type another message and submit it. It should send immediately rather than appearing as a queued bubble, and the pending tool call should be dropped.
- Send a prompt, and while the turn is still running submit a second one so it queues. Wait for the approval prompt to appear. The queued bubble should stay put and must not answer the approval.
- With a message still queued, pick a different agent from the new chat button in the navigation rail. The queue should be discarded rather than firing at the new chat.
- With a message still queued, open the chat history list and pick a different thread. The queue should be discarded there too.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Nick Leonard