Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(desktop): enable approval buttons for a later suspension in the same task
Alfredo Lopezc9cc0368e15d
diff --git a/desktop-app/ui/src/components/ProgressStepper.tsx b/desktop-app/ui/src/components/ProgressStepper.tsxindex aa92279aa..54b08a21b 100644--- a/desktop-app/ui/src/components/ProgressStepper.tsx+++ b/desktop-app/ui/src/components/ProgressStepper.tsx@@ -271,7 +271,10 @@ export function ProgressStepper({onConnect,}: ProgressStepperProps) {const [expanded, setExpanded] = useState(false)- const [approvalPending, setApprovalPending] = useState(false)+ // The request id of the suspension the user already decided. A later suspension in+ // the same task (another tool asking after an approval) has a new id, so its card+ // starts with enabled buttons instead of inheriting the previous decision.+ const [decidedRequestId, setDecidedRequestId] = useState<string | null>(null)const [connectPending, setConnectPending] = useState(false)const [isCancelling, setIsCancelling] = useState(false)@@ -428,6 +431,7 @@ export function ProgressStepper({const isConnect = info?.reason === 'connect_required'const connectServer = info?.mcpServerName || 'the connector'const canConnect = isConnect && !!onConnect+ const approvalPending = !!info && decidedRequestId === info.requestIdreturn (<div data-testid="progress-stepper" className="progress-stepper status-suspended"><div className="stepper-suspended-row">@@ -501,7 +505,7 @@ export function ProgressStepper({color="success"disabled={approvalPending}onClick={() => {- setApprovalPending(true)+ setDecidedRequestId(info.requestId)onApprove()}}size="sm"@@ -517,7 +521,7 @@ export function ProgressStepper({color="danger"disabled={approvalPending}onClick={() => {- setApprovalPending(true)+ setDecidedRequestId(info.requestId)onDeny()}}size="sm"diff --git a/desktop-app/ui/src/components/__tests__/ProgressStepper.test.tsx b/desktop-app/ui/src/components/__tests__/ProgressStepper.test.tsxindex f74e24f72..40de5c071 100644--- a/desktop-app/ui/src/components/__tests__/ProgressStepper.test.tsx+++ b/desktop-app/ui/src/components/__tests__/ProgressStepper.test.tsx@@ -481,6 +481,64 @@ describe('ProgressStepper — suspended status (approval flow)', () => {expect(denyBtn.hasAttribute('disabled')).toBe(true)})+ // A plain approval covers one tool for the task, so another tool in the same task+ // suspends again (shell_exec approved, then http_request). The stepper stays mounted.+ it.each([+ ['after the task resumed', true],+ ['directly from the previous suspension', false],+ ])('enables the buttons of a later suspension in the same task (%s)', (_label, resumed) => {+ const onApprove = vi.fn()+ const onDeny = vi.fn()+ const suspended = (requestId: string, displayName: string) =>+ makeProgress({ status: 'suspended', suspendedInfo: { requestId, displayName } })+ const { rerender } = render(+ <ProgressStepper+ progress={suspended('req-1', 'Shell')}+ onApprove={onApprove}+ onDeny={onDeny}+ />+ )++ fireEvent.click(screen.getByTestId('approval-approve-btn'))+ expect(onApprove).toHaveBeenCalledOnce()+ // Witness: the decided card is locked against a second submission.+ expect(screen.getByTestId('approval-approve-btn').hasAttribute('disabled')).toBe(true)+ rerender(+ <ProgressStepper+ progress={suspended('req-1', 'Shell')}+ onApprove={onApprove}+ onDeny={onDeny}+ />+ )+ expect(screen.getByTestId('approval-deny-btn').hasAttribute('disabled')).toBe(true)++ if (resumed) {+ rerender(+ <ProgressStepper+ progress={makeProgress({ status: 'active' })}+ onApprove={onApprove}+ onDeny={onDeny}+ />+ )+ }+ rerender(+ <ProgressStepper+ progress={suspended('req-2', 'HTTP')}+ onApprove={onApprove}+ onDeny={onDeny}+ />+ )++ expect(screen.getByText('HTTP requires approval')).toBeDefined()+ const approveBtn = screen.getByTestId('approval-approve-btn')+ const denyBtn = screen.getByTestId('approval-deny-btn')+ expect(approveBtn.hasAttribute('disabled')).toBe(false)+ expect(approveBtn.textContent).toBe('Approve')+ expect(denyBtn.hasAttribute('disabled')).toBe(false)+ fireEvent.click(denyBtn)+ expect(onDeny).toHaveBeenCalledOnce()+ })+it('renders step list when suspended with existing steps after expanding details', () => {const steps = [makeStep({ toolCallId: 'tc-1', state: 'completed', displayName: 'MongoDB' })]render(