(resolve => {
+ finish = resolve
+ })
+ )
+
+ renderPanel('closed')
+
+ const reconnect = screen.getByRole('button', { name: 'Reconnect gateway' })
+ fireEvent.click(reconnect)
+ fireEvent.click(reconnect)
+
+ expect(mocks.reconnectGateway).toHaveBeenCalledOnce()
+ expect((reconnect as HTMLButtonElement).disabled).toBe(true)
+
+ await act(async () => finish?.())
+ })
+
+ it('hides reconnect while the socket is open', async () => {
+ renderPanel('open')
+ await act(async () => undefined)
+
+ expect(screen.queryByRole('button', { name: 'Reconnect gateway' })).toBeNull()
+ })
+})
diff --git a/apps/desktop/src/app/shell/gateway-menu-panel.tsx b/apps/desktop/src/app/shell/gateway-menu-panel.tsx
index bb753670bb..8e1516b7bd 100644
--- a/apps/desktop/src/app/shell/gateway-menu-panel.tsx
+++ b/apps/desktop/src/app/shell/gateway-menu-panel.tsx
@@ -9,6 +9,8 @@ import { useI18n } from '@/i18n'
import { LayoutDashboard, RefreshCw } from '@/lib/icons'
import type { RuntimeReadinessResult } from '@/lib/runtime-readiness'
import { cn } from '@/lib/utils'
+import { reconnectGateway } from '@/store/gateway-reconnect'
+import { notifyError } from '@/store/notifications'
import { runGatewayRestart } from '@/store/system-actions'
import type { StatusResponse } from '@/types/hermes'
@@ -96,6 +98,7 @@ export function GatewayMenuPanel({
}: GatewayMenuPanelProps) {
const { t } = useI18n()
const copy = t.shell.gatewayMenu
+ const [reconnecting, setReconnecting] = useState(false)
// Both jumps open the system panel, which owns the full view — so dismiss the
// little status popover on the way out.
@@ -111,6 +114,17 @@ export function GatewayMenuPanel({
void runGatewayRestart()
}
+ const reconnect = () => {
+ if (reconnecting) {
+ return
+ }
+
+ setReconnecting(true)
+ void reconnectGateway()
+ .catch(err => notifyError(err, copy.reconnectGateway))
+ .finally(() => setReconnecting(false))
+ }
+
const gatewayOpen = gatewayState === 'open'
const gatewayConnecting = gatewayState === 'connecting'
const inferenceReady = gatewayOpen && inferenceStatus?.ready === true
@@ -157,6 +171,20 @@ export function GatewayMenuPanel({
+ {!gatewayOpen && (
+
+
+
+ )}