From 43e075e3c807b6944ae8c81e598f1f9e0087d6eb Mon Sep 17 00:00:00 2001 From: Harshil Vasoya Date: Mon, 16 Nov 2026 17:35:12 +0530 Subject: [PATCH 1/2] fix : Approve once now triggers approval on click, with a chevron for additional options --- .changeset/approve-once-direct-click.md | 5 + .../src/atoms/ToolApprovalBar.tsx | 104 ++++++++++-------- .../test/atoms/ToolApprovalBar.test.tsx | 9 +- 3 files changed, 70 insertions(+), 48 deletions(-) create mode 100644 .changeset/approve-once-direct-click.md diff --git a/.changeset/approve-once-direct-click.md b/.changeset/approve-once-direct-click.md new file mode 100644 index 000000000..b8131decb --- /dev/null +++ b/.changeset/approve-once-direct-click.md @@ -0,0 +1,5 @@ +--- +'@truefoundry/trueforge-ui': patch +--- + +Approve once now approves on click; the chevron beside it opens the menu for other approval options and Deny. diff --git a/packages/trueforge-ui/src/atoms/ToolApprovalBar.tsx b/packages/trueforge-ui/src/atoms/ToolApprovalBar.tsx index 053d17f8d..9867ee13f 100644 --- a/packages/trueforge-ui/src/atoms/ToolApprovalBar.tsx +++ b/packages/trueforge-ui/src/atoms/ToolApprovalBar.tsx @@ -122,51 +122,65 @@ export function ToolApprovalBar({ )} {!isDecided && !readOnly && !selectedDenyOption && ( - - - {defaultApproval?.label ?? 'Approve'} - - - } - className="w-max min-w-[16.25rem]" - > - {approveOptions.map((option, index) => ( - onSelect(option.id)} - className="whitespace-nowrap" - > - {index === 0 ? : null} - {option.label} - - ))} - {approveOptions.length > 0 && denyOptions.length > 0 ? : null} - {denyOptions.map(option => ( - { - if (option.requiresReason) { - onDenyOptionChange?.(option.id); - } else { - onSelect(option.id); - } - }} - className="whitespace-nowrap" - > - - {option.label} - - ))} - +
+ + + + + } + className="w-max min-w-[16.25rem]" + > + {approveOptions.map((option, index) => ( + onSelect(option.id)} + className="whitespace-nowrap" + > + {index === 0 ? : null} + {option.label} + + ))} + {approveOptions.length > 0 && denyOptions.length > 0 ? : null} + {denyOptions.map(option => ( + { + if (option.requiresReason) { + onDenyOptionChange?.(option.id); + } else { + onSelect(option.id); + } + }} + className="whitespace-nowrap" + > + + {option.label} + + ))} + +
)} diff --git a/packages/trueforge-ui/test/atoms/ToolApprovalBar.test.tsx b/packages/trueforge-ui/test/atoms/ToolApprovalBar.test.tsx index 908be339b..c2f8af711 100644 --- a/packages/trueforge-ui/test/atoms/ToolApprovalBar.test.tsx +++ b/packages/trueforge-ui/test/atoms/ToolApprovalBar.test.tsx @@ -28,12 +28,15 @@ describe('ToolApprovalBar', () => { ); fireEvent.click(screen.getByRole('button', { name: 'Allow once' })); + expect(screen.queryByRole('menu')).not.toBeInTheDocument(); + fireEvent.click(screen.getByRole('button', { name: 'More approval options' })); expect(screen.getByRole('menuitem', { name: 'Allow once' })).not.toHaveAttribute('aria-selected'); fireEvent.click(screen.getByRole('menuitem', { name: 'Allow once' })); - fireEvent.click(screen.getByRole('button', { name: 'Allow once' })); + fireEvent.click(screen.getByRole('button', { name: 'More approval options' })); fireEvent.click(screen.getByRole('menuitem', { name: 'Reject' })); expect(onSelect).toHaveBeenNthCalledWith(1, 'allow-once'); - expect(onSelect).toHaveBeenNthCalledWith(2, 'reject'); + expect(onSelect).toHaveBeenNthCalledWith(2, 'allow-once'); + expect(onSelect).toHaveBeenNthCalledWith(3, 'reject'); }); it('drives the controlled denial-reason workflow and error state', () => { @@ -49,7 +52,7 @@ describe('ToolApprovalBar', () => { />, ); - fireEvent.click(screen.getByRole('button', { name: 'Approve once' })); + fireEvent.click(screen.getByRole('button', { name: 'More approval options' })); fireEvent.click(screen.getByRole('menuitem', { name: 'Deny' })); expect(onDenyOptionChange).toHaveBeenCalledWith('deny-with-reason'); From 82702676b812afc6ad8f303b40dd557886703a87 Mon Sep 17 00:00:00 2001 From: Harshil Vasoya Date: Mon, 16 Nov 2026 17:47:10 +0530 Subject: [PATCH 2/2] fix: fix: update ToolApprovalBar button label and styling for consistency --- packages/trueforge-ui/src/atoms/ToolApprovalBar.tsx | 2 +- .../trueforge-ui/test/containers/ToolCallContainer.test.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/trueforge-ui/src/atoms/ToolApprovalBar.tsx b/packages/trueforge-ui/src/atoms/ToolApprovalBar.tsx index 9867ee13f..cacc536d9 100644 --- a/packages/trueforge-ui/src/atoms/ToolApprovalBar.tsx +++ b/packages/trueforge-ui/src/atoms/ToolApprovalBar.tsx @@ -143,7 +143,7 @@ export function ToolApprovalBar({ variant={defaultApproval == null ? 'secondary' : optionVariant(defaultApproval)} disabled={interactionsLocked || defaultApproval == null} aria-label="More approval options" - className="rounded-l-none border-l border-l-white/30 px-1.5" + className="rounded-l-none border-l border-l-current/30 px-1.5" > diff --git a/packages/trueforge-ui/test/containers/ToolCallContainer.test.tsx b/packages/trueforge-ui/test/containers/ToolCallContainer.test.tsx index 42a9d465a..1ac12099c 100644 --- a/packages/trueforge-ui/test/containers/ToolCallContainer.test.tsx +++ b/packages/trueforge-ui/test/containers/ToolCallContainer.test.tsx @@ -25,7 +25,7 @@ vi.mock('@truefoundry/trueforge-assistant-ui-runtime', async importOriginal => { }); function openApprovalMenu() { - fireEvent.click(screen.getByRole('button', { name: 'Approve once' })); + fireEvent.click(screen.getByRole('button', { name: 'More approval options' })); } function renderToolCallMessage(content: ThreadMessageLike['content'], overrides?: SlotOverrides) {