From b79806250143350013f8a9c315890d92bfeba5cf Mon Sep 17 00:00:00 2001 From: teknium1 Date: Mon, 16 Mar 2026 23:17:29 -0700 Subject: [PATCH] fix: improve OAuth login UX for headless/SSH users Put the authorization URL front and center instead of treating it as a fallback. Most Hermes users run on remote servers via SSH where webbrowser.open() silently fails. --- agent/anthropic_adapter.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/agent/anthropic_adapter.py b/agent/anthropic_adapter.py index 7d43a24d..dea1e883 100644 --- a/agent/anthropic_adapter.py +++ b/agent/anthropic_adapter.py @@ -461,18 +461,23 @@ def run_hermes_oauth_login() -> Optional[str]: auth_url = f"https://claude.ai/oauth/authorize?{urlencode(params)}" print() - print("Opening browser for Claude Pro/Max authorization...") - print(f"If the browser doesn't open, visit this URL:") + print("Authorize Hermes with your Claude Pro/Max subscription.") + print() + print("Open this link in your browser:") + print() print(f" {auth_url}") print() + # Try to open browser automatically (works on desktop, silently fails on headless) try: webbrowser.open(auth_url) except Exception: - pass # URL printed above as fallback + pass + print("After authorizing, you'll see a code. Paste it below.") + print() try: - auth_code = input("Paste the authorization code here: ").strip() + auth_code = input("Authorization code: ").strip() except (KeyboardInterrupt, EOFError): return None