From 40ad610968705e1e158383ade0e0ec99547c726c Mon Sep 17 00:00:00 2001 From: Brooklyn Nicholson Date: Fri, 15 May 2026 19:42:46 -0500 Subject: [PATCH] Clean up gateway status conditionals and logging bootstrap mode detection. Simplify nested dashboard gateway status branches for readability and use a concise first-subcommand check when selecting early GUI logging mode. --- .../src/app/shell/gateway-menu-panel.tsx | 17 +++++++++++------ .../src/app/shell/hooks/use-statusbar-items.tsx | 16 +++++++++------- hermes_cli/main.py | 17 ++++++++--------- 3 files changed, 28 insertions(+), 22 deletions(-) diff --git a/apps/desktop/src/app/shell/gateway-menu-panel.tsx b/apps/desktop/src/app/shell/gateway-menu-panel.tsx index e9f43a20f4..27008cc275 100644 --- a/apps/desktop/src/app/shell/gateway-menu-panel.tsx +++ b/apps/desktop/src/app/shell/gateway-menu-panel.tsx @@ -40,14 +40,19 @@ export function GatewayMenuPanel({ statusSnapshot }: GatewayMenuPanelProps) { const gatewayOpen = gatewayState === 'open' + const gatewayConnecting = gatewayState === 'connecting' const inferenceReady = gatewayOpen && inferenceStatus?.ready === true - const connectionLabel = gatewayOpen ? 'Connected' : prettyState(gatewayState || 'offline') + const connectionLabel = gatewayOpen + ? 'Connected' + : gatewayConnecting + ? 'Connecting' + : prettyState(gatewayState || 'offline') const inferenceLabel = gatewayOpen - ? inferenceStatus - ? inferenceReady - ? 'Inference ready' - : 'Inference not ready' - : 'Checking inference' + ? inferenceStatus?.ready + ? 'Inference ready' + : inferenceStatus + ? 'Inference not ready' + : 'Checking inference' : 'Disconnected' const platforms = Object.entries(statusSnapshot?.gateway_platforms || {}).sort(([l], [r]) => l.localeCompare(r)) const recentLogs = logLines.slice(-5) diff --git a/apps/desktop/src/app/shell/hooks/use-statusbar-items.tsx b/apps/desktop/src/app/shell/hooks/use-statusbar-items.tsx index 18ad18935f..8da8f5e802 100644 --- a/apps/desktop/src/app/shell/hooks/use-statusbar-items.tsx +++ b/apps/desktop/src/app/shell/hooks/use-statusbar-items.tsx @@ -105,19 +105,21 @@ export function useStatusbarItems({ }, [desktopActionTasks, previewServerRestartStatus, subagentsBySession, workingSessionIds]) const gatewayOpen = gatewayState === 'open' + const gatewayConnecting = gatewayState === 'connecting' const inferenceReady = gatewayOpen && inferenceStatus?.ready === true + const gatewayDegraded = gatewayOpen || gatewayConnecting const gatewayDetail = gatewayOpen - ? inferenceStatus - ? inferenceReady - ? 'ready' - : 'needs setup' - : 'checking' - : gatewayState === 'connecting' + ? inferenceStatus?.ready + ? 'ready' + : inferenceStatus + ? 'needs setup' + : 'checking' + : gatewayConnecting ? 'connecting' : 'offline' const gatewayClassName = inferenceReady ? undefined - : gatewayOpen || gatewayState === 'connecting' + : gatewayDegraded ? 'text-amber-600 hover:text-amber-600' : 'text-destructive hover:text-destructive' diff --git a/hermes_cli/main.py b/hermes_cli/main.py index 67e885d13e..1f818790d5 100644 --- a/hermes_cli/main.py +++ b/hermes_cli/main.py @@ -240,15 +240,14 @@ except Exception: try: from hermes_logging import setup_logging as _setup_logging - _early_mode = "cli" - for _arg in sys.argv[1:]: - if _arg.startswith("-"): - continue - if _arg == "dashboard": - _early_mode = "gui" - break - - _setup_logging(mode=_early_mode) + _setup_logging( + mode=( + "gui" + if next((arg for arg in sys.argv[1:] if not arg.startswith("-")), "") + == "dashboard" + else "cli" + ) + ) except Exception: pass # best-effort — don't crash the CLI if logging setup fails