Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(assistant-ui): disable automatic sending of follow-up suggestions

Steven Enamakel6a93df5b263b
diff --git a/app/src/components/assistant-ui/elements/__tests__/tool-fallback.approval.test.tsx b/app/src/components/assistant-ui/elements/__tests__/tool-fallback.approval.test.tsx
new file mode 100644
index 0000000000..b6e76d3505
--- /dev/null
+++ b/app/src/components/assistant-ui/elements/__tests__/tool-fallback.approval.test.tsx
@@ -0,0 +1,63 @@
+import { render, screen } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
+import { describe, expect, it, vi } from 'vitest';
+
+import { ToolFallbackApproval } from '../tool-fallback';
+
+vi.mock('@assistant-ui/react', async () => {
+ const actual = await vi.importActual<typeof import('@assistant-ui/react')>('@assistant-ui/react');
+ return { ...actual, useAuiState: () => false };
+});
+
+describe('ToolFallbackApproval — free-text answer path', () => {
+ it('renders the plain decision bar when the request has no options/display', async () => {
+ const respondToApproval = vi.fn().mockResolvedValue(undefined);
+ render(
+ <ToolFallbackApproval
+ approval={{ id: 'a-1' }}
+ respondToApproval={respondToApproval}
+ status={{ type: 'requires-action', reason: 'interrupt' }}
+ />
+ );
+ await userEvent.click(screen.getByText('Allow'));
+ expect(respondToApproval).toHaveBeenCalledWith({ approved: true });
+ });
+
+ it('renders a Textarea + Send for a question (display: "text") and answers with the typed text', async () => {
+ const respondToApproval = vi.fn().mockResolvedValue(undefined);
+ render(
+ <ToolFallbackApproval
+ approval={{ id: 'a-2', display: 'text', allowFreeform: true, prompt: 'What is the title?' }}
+ respondToApproval={respondToApproval}
+ status={{ type: 'requires-action', reason: 'interrupt' }}
+ />
+ );
+ expect(screen.getByText('What is the title?')).toBeInTheDocument();
+ const textarea = screen.getByRole('textbox');
+ await userEvent.type(textarea, 'Quarterly Deck');
+ await userEvent.click(screen.getByText('Send'));
+ expect(respondToApproval).toHaveBeenCalledWith({ text: 'Quarterly Deck' });
+ });
+
+ it('does not offer a bare Deny button for a question-mode request', () => {
+ render(
+ <ToolFallbackApproval
+ approval={{ id: 'a-3', display: 'select', options: [{ id: 'o1', kind: 'allow-once' }] }}
+ respondToApproval={vi.fn()}
+ status={{ type: 'requires-action', reason: 'interrupt' }}
+ />
+ );
+ expect(screen.queryByText('Deny')).toBeNull();
+ });
+
+ it('renders nothing once the approval is already resolved', () => {
+ const { container } = render(
+ <ToolFallbackApproval
+ approval={{ id: 'a-4', approved: true }}
+ respondToApproval={vi.fn()}
+ status={{ type: 'requires-action', reason: 'interrupt' }}
+ />
+ );
+ expect(container).toBeEmptyDOMElement();
+ });
+});
diff --git a/app/src/components/assistant-ui/follow-up-suggestions.tsx b/app/src/components/assistant-ui/follow-up-suggestions.tsx
index e89191f7df..ced10481ad 100644
--- a/app/src/components/assistant-ui/follow-up-suggestions.tsx
+++ b/app/src/components/assistant-ui/follow-up-suggestions.tsx
@@ -71,7 +71,7 @@ const FollowupSuggestionsRow: FC = () => {
key={idx}
className="aui-thread-followup-suggestion border-foreground/10 hover:bg-foreground/[0.03] hover:border-foreground/25 rounded-md border px-2.5 py-1 text-sm whitespace-nowrap transition-colors ease-in motion-reduce:transition-none"
prompt={suggestion.prompt}
- send>
+ send={false}>
{suggestion.title ?? suggestion.prompt}
{suggestion.label && (
<span className="aui-thread-followup-suggestion-label text-muted-foreground ms-1">