Skip to content

The agent that grows with you

fix(desktop): keep gateway reconnect available on open transports

Teknium2bd6fe0dde0c
diff --git a/apps/desktop/src/app/shell/gateway-menu-panel.test.tsx b/apps/desktop/src/app/shell/gateway-menu-panel.test.tsx
index b33e6291f9e..f0241883ac3 100644
--- a/apps/desktop/src/app/shell/gateway-menu-panel.test.tsx
+++ b/apps/desktop/src/app/shell/gateway-menu-panel.test.tsx
@@ -71,7 +71,7 @@ describe('GatewayMenuPanel reconnect action', () => {
afterEach(() => cleanup())
- it('shows reconnect only while disconnected and disables it in flight', async () => {
+ it('shows reconnect while disconnected and disables it in flight', async () => {
let finish: (() => void) | undefined
mocks.reconnectGateway.mockImplementation(
() =>
@@ -92,10 +92,12 @@ describe('GatewayMenuPanel reconnect action', () => {
await act(async () => finish?.())
})
- it('hides reconnect while the socket is open', async () => {
+ it('allows recovery when an open socket stops delivering', async () => {
renderPanel('open')
await act(async () => undefined)
- expect(screen.queryByRole('button', { name: 'Reconnect gateway' })).toBeNull()
+ const reconnect = screen.getByRole('button', { name: 'Reconnect gateway' })
+ await act(async () => fireEvent.click(reconnect))
+ expect(mocks.reconnectGateway).toHaveBeenCalledOnce()
})
})
diff --git a/apps/desktop/src/app/shell/gateway-menu-panel.tsx b/apps/desktop/src/app/shell/gateway-menu-panel.tsx
index ff61fe6c267..e7367c560ea 100644
--- a/apps/desktop/src/app/shell/gateway-menu-panel.tsx
+++ b/apps/desktop/src/app/shell/gateway-menu-panel.tsx
@@ -171,20 +171,19 @@ export function GatewayMenuPanel({
</span>
</div>
<div className="flex shrink-0 items-center gap-0.5">
- {!gatewayOpen && (
- <Tip label={copy.reconnectGateway}>
- <Button
- aria-label={copy.reconnectGateway}
- className="text-muted-foreground hover:text-foreground"
- disabled={reconnecting}
- onClick={reconnect}
- size="icon-xs"
- variant="ghost"
- >
- <RefreshCw className={cn(reconnecting && 'animate-spin')} />
- </Button>
- </Tip>
- )}
+ {/* An open transport can still be wedged; recovery must remain reachable. */}
+ <Tip label={copy.reconnectGateway}>
+ <Button
+ aria-label={copy.reconnectGateway}
+ className="text-muted-foreground hover:text-foreground"
+ disabled={reconnecting}
+ onClick={reconnect}
+ size="icon-xs"
+ variant="ghost"
+ >
+ <RefreshCw className={cn(reconnecting && 'animate-spin')} />
+ </Button>
+ </Tip>
<Tip label={copy.openSystem}>
<Button
aria-label={copy.openSystem}