fix: add output-denied to sendAutomaticallyWhen approval check#13672
Open
guoyangzhen wants to merge 1 commit intovercel:mainfrom
Open
fix: add output-denied to sendAutomaticallyWhen approval check#13672guoyangzhen wants to merge 1 commit intovercel:mainfrom
guoyangzhen wants to merge 1 commit intovercel:mainfrom
Conversation
Fixes vercel#13670 The predicate was missing from its terminal state check. When a tool call was denied via , the state became which was not recognized as terminal, causing to never fire and the chat to permanently stall. Added to the condition to properly recognize denied tool invocations as terminal states.
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.
Summary
Fixes #13670
The
lastAssistantMessageIsCompleteWithApprovalResponsespredicate was missingoutput-deniedfrom its terminal state check. When a tool call was denied viaaddToolApprovalResponse({ approved: false }), the state becameoutput-deniedwhich was not recognized as terminal, causingsendAutomaticallyWhento never fire and the chat to permanently stall.Changes
Added
part.state === 'output-denied'to the.every()condition inpackages/ai/src/ui/last-assistant-message-is-complete-with-approval-responses.tsto properly recognize denied tool invocations as terminal states.Root Cause
The
.every()check only listed three terminal states:output-available— tool completed successfullyoutput-error— tool erroredapproval-responded— tool was approvedBut
output-denied(emitted whenapproved: falseis passed toaddToolApprovalResponse) was missing. This caused denied tool invocations to be treated as still-pending, making the predicate always returnfalse.Related
A similar partial fix was applied for
createAgentUIStreamin #12209, but this predicate was not updated.