Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(desktop-app): connect_required never falls back to Approve/Deny (R3-L2)

Diego Zacarias9dc9f9a0c86a
diff --git a/desktop-app/ui/src/components/ProgressStepper.tsx b/desktop-app/ui/src/components/ProgressStepper.tsx
index 9b356acb7..b1eae80a8 100644
--- a/desktop-app/ui/src/components/ProgressStepper.tsx
+++ b/desktop-app/ui/src/components/ProgressStepper.tsx
@@ -411,11 +411,13 @@ export function ProgressStepper({
if (status === 'suspended') {
const info = progress.suspendedInfo
// U5: a `connect_required` suspension renders a "Connect <server>" prompt and
- // a Connect button (opens the provider OAuth flow) instead of Approve/Deny.
+ // a Connect button (opens the provider OAuth flow) — NEVER Approve/Deny.
// `canConnect` requires BOTH the marker and a usable `onConnect` (which the
- // caller only wires when `mcpServerName` is present) — a connect_required
- // without an actionable connect falls back to the generic Approve/Deny prompt
- // rather than rendering a dead-end suspended block with no action.
+ // caller only wires when `mcpServerName` is present). If a connect_required
+ // ever arrives without an actionable connect (defensive — mcp-host always
+ // emits mcpServerName), it renders an explanatory suspended state with Cancel,
+ // NOT Approve/Deny: approving would resume with no grant → another 401 → a
+ // re-suspension loop (the loop sessionFsm.ts guards against).
const isConnect = info?.reason === 'connect_required'
const connectServer = info?.mcpServerName || 'the connector'
const canConnect = isConnect && !!onConnect
@@ -426,12 +428,14 @@ export function ProgressStepper({
<span className="stepper-suspended-label">
{canConnect
? `Connect ${connectServer} to continue`
- : info
- ? `${formatToolApprovalLabel({
- displayName: info.displayName,
- toolName: info.toolName,
- })} requires approval`
- : 'Waiting for approval...'}
+ : isConnect
+ ? 'A connector must be reconnected to continue. Cancel and retry if this persists.'
+ : info
+ ? `${formatToolApprovalLabel({
+ displayName: info.displayName,
+ toolName: info.toolName,
+ })} requires approval`
+ : 'Waiting for approval...'}
</span>
{onCancel && (
<IconButton
@@ -468,7 +472,7 @@ export function ProgressStepper({
</Button>
</div>
)}
- {info && !canConnect && (onApprove || onDeny) && (
+ {info && !canConnect && !isConnect && (onApprove || onDeny) && (
<div className="stepper-approval-actions">
{onApprove && (
<Button
diff --git a/desktop-app/ui/src/components/__tests__/ProgressStepper.test.tsx b/desktop-app/ui/src/components/__tests__/ProgressStepper.test.tsx
index 580fbd80a..178ffc090 100644
--- a/desktop-app/ui/src/components/__tests__/ProgressStepper.test.tsx
+++ b/desktop-app/ui/src/components/__tests__/ProgressStepper.test.tsx
@@ -471,9 +471,11 @@ describe('ProgressStepper — connect_required suspension (U5, T5 invariant c)',
expect(screen.queryByTestId('connect-mcp-btn')).toBeNull()
})
- it('FIX2: connect_required WITHOUT an actionable onConnect falls back to Approve/Deny (no dead-end)', () => {
+ it('connect_required WITHOUT an actionable onConnect never renders Approve/Deny (R3-L2)', () => {
// Defensive: if mcpServerName were ever empty the caller leaves onConnect
- // undefined — the block must still be actionable, never a suspended dead-end.
+ // undefined. This must NOT fall back to Approve/Deny — approving would resume
+ // with no grant → another 401 → a re-suspension loop. It renders an
+ // explanatory suspended state instead; Cancel remains available.
render(
<ProgressStepper
progress={makeProgress({
@@ -487,15 +489,17 @@ describe('ProgressStepper — connect_required suspension (U5, T5 invariant c)',
})}
onApprove={vi.fn()}
onDeny={vi.fn()}
+ onCancel={vi.fn()}
// onConnect intentionally omitted
/>
)
- // No Connect button (nothing to connect to), but Approve/Deny are present.
+ // Nothing to connect to, and — the fix — no Approve/Deny loop trap either.
expect(screen.queryByTestId('connect-mcp-btn')).toBeNull()
- expect(screen.getByTestId('approval-approve-btn')).toBeDefined()
- expect(screen.getByTestId('approval-deny-btn')).toBeDefined()
- // Falls back to the generic label, not a half-rendered connect prompt.
- expect(screen.queryByText(/to continue$/)).toBeNull()
+ expect(screen.queryByTestId('approval-approve-btn')).toBeNull()
+ expect(screen.queryByTestId('approval-deny-btn')).toBeNull()
+ // An explanatory suspended state, with Cancel still available.
+ expect(screen.getByText(/must be reconnected to continue/)).toBeDefined()
+ expect(screen.getByTestId('progress-cancel-btn')).toBeDefined()
})
})