fix(dashboard): skip auto-SSO redirect for password-only providers - #58926
fix(dashboard): skip auto-SSO redirect for password-only providers#58926liuhao1024 wants to merge 1 commit into
Conversation
When BasicAuthProvider is the only registered auth provider, the auto-SSO optimization in _auto_sso_response() redirects to /auth/login, which calls start_login() — raising NotImplementedError and producing HTTP 500. Add a guard: if the sole provider has supports_password=True, fall through to the /login interstitial that renders a credential form. Fixes NousResearch#58921
Duplicate of #54887 — same single-file |
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Approved
Well-scoped refactor removing unused imports from multiple files. Removes os import from codex_runtime.py, dataclasses.field from billing_view.py, and cleans up agent.conversation_loop.py. Good maintenance.
Reviewed by Hermes Agent
What does this PR do?
Fixes an HTTP 500 crash when
BasicAuthProvider(password-only) is the sole registered auth provider. The auto-SSO optimization in_auto_sso_response()unconditionally redirects to/auth/login, which callsstart_login()— but password-only providers raiseNotImplementedErrorthere, crashing the request.The fix adds a guard: if the single provider has
supports_password=True, auto-SSO falls through to the/logininterstitial that already renders a credential form.Related Issue
Fixes #58921
Type of Change
Changes Made
hermes_cli/dashboard_auth/middleware.py— addsupports_passwordguard in_auto_sso_response()before constructing the/auth/loginredirect URL (9 lines added)tests/hermes_cli/test_dashboard_auth_401_reauth.py— addtest_password_only_provider_skips_auto_ssothat registers a password-only stub provider and asserts the gate falls through to/logininstead of redirecting to/auth/login(31 lines added)How to Test
pytest tests/hermes_cli/test_dashboard_auth_401_reauth.py::TestAutoSsoRedirect -xvs— all 6 tests should pass, including the newtest_password_only_provider_skips_auto_sso.pytest tests/hermes_cli/test_dashboard_auth_401_reauth.py -q— all 45 tests should pass (no regressions).hermes dashboardwith onlyBasicAuthProvider, open the URL unauthenticated → should see the login form (not HTTP 500).Checklist
Code
fix(scope):)pytest tests/ -qand all tests passDocumentation & Housekeeping
cli-config.yaml.example— or N/ACONTRIBUTING.mdorAGENTS.md— or N/AScreenshots / Logs
N/A