Skip to content

fix: add output-denied to sendAutomaticallyWhen approval check#13672

Open
guoyangzhen wants to merge 1 commit intovercel:mainfrom
guoyangzhen:fix/sendAutomaticallyWhen-output-denied
Open

fix: add output-denied to sendAutomaticallyWhen approval check#13672
guoyangzhen wants to merge 1 commit intovercel:mainfrom
guoyangzhen:fix/sendAutomaticallyWhen-output-denied

Conversation

@guoyangzhen
Copy link

Summary

Fixes #13670

The lastAssistantMessageIsCompleteWithApprovalResponses predicate was missing output-denied from its terminal state check. When a tool call was denied via addToolApprovalResponse({ approved: false }), the state became output-denied which was not recognized as terminal, causing sendAutomaticallyWhen to never fire and the chat to permanently stall.

Changes

Added part.state === 'output-denied' to the .every() condition in packages/ai/src/ui/last-assistant-message-is-complete-with-approval-responses.ts to properly recognize denied tool invocations as terminal states.

Root Cause

The .every() check only listed three terminal states:

  • output-available — tool completed successfully
  • output-error — tool errored
  • approval-responded — tool was approved

But output-denied (emitted when approved: false is passed to addToolApprovalResponse) was missing. This caused denied tool invocations to be treated as still-pending, making the predicate always return false.

Related

A similar partial fix was applied for createAgentUIStream in #12209, but this predicate was not updated.

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.
@tigent tigent bot added ai/ui anything UI related bug Something isn't working as documented labels Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai/ui anything UI related bug Something isn't working as documented

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: sendAutomaticallyWhen never fires when any tool approval is denied

1 participant