Skip to content

The agent that grows with you

perf(cli): check local auth.json/config before slow provider registry sweep

frohsinnllcdbafb59227ce
diff --git a/hermes_cli/main.py b/hermes_cli/main.py
index 28d3009325d..624d0f10109 100644
--- a/hermes_cli/main.py
+++ b/hermes_cli/main.py
@@ -1013,16 +1013,9 @@ def _has_any_provider_configured() -> bool:
except Exception:
pass
- # Check provider-specific auth fallbacks (for example, Copilot via gh auth).
- try:
- for provider_id, pconfig in PROVIDER_REGISTRY.items():
- if pconfig.auth_type != "api_key":
- continue
- status = get_auth_status(provider_id)
- if status.get("logged_in"):
- return True
- except Exception:
- pass
+ # Cheap local checks first: auth.json and config.yaml are on-disk lookups,
+ # while the PROVIDER_REGISTRY sweep below spawns subprocesses (gh) and can
+ # take 15-20s — long enough that desktop setup.status calls time out.
# Check for Nous Portal OAuth credentials
auth_file = get_hermes_home() / "auth.json"
@@ -1050,6 +1043,17 @@ def _has_any_provider_configured() -> bool:
if cfg_provider or cfg_base_url or cfg_api_key:
return True
+ # Check provider-specific auth fallbacks (for example, Copilot via gh auth).
+ try:
+ for provider_id, pconfig in PROVIDER_REGISTRY.items():
+ if pconfig.auth_type != "api_key":
+ continue
+ status = get_auth_status(provider_id)
+ if status.get("logged_in"):
+ return True
+ except Exception:
+ pass
+
# Check for Claude Code OAuth credentials (~/.claude/.credentials.json)
# Only count these if Hermes has been explicitly configured — Claude Code
# being installed doesn't mean the user wants Hermes to use their tokens.