Skip to content

fix: HERMES_PORTAL_BASE_URL env var ignored during Nous login - #5745

Merged
benbarclay merged 1 commit into
mainfrom
fix/portal-env-var-ignored-during-login
Apr 7, 2026
Merged

fix: HERMES_PORTAL_BASE_URL env var ignored during Nous login#5745
benbarclay merged 1 commit into
mainfrom
fix/portal-env-var-ignored-during-login

Conversation

@benbarclay

Copy link
Copy Markdown
Collaborator

Problem

Setting HERMES_PORTAL_BASE_URL (or NOUS_PORTAL_BASE_URL) in ~/.hermes/.env to point at a staging portal had no effect — hermes model always logged in against production.

Root Cause

_login_nous() (line 2580) was doing:

portal_base_url=getattr(args, "portal_url", None) or pconfig.portal_base_url

When no --portal-url CLI flag was given, this fell through to pconfig.portal_base_url (hardcoded https://portal.nousresearch.com). Since a truthy value was passed to _nous_device_code_login(), its env var fallback chain was dead on arrival:

portal_base_url = (
    portal_base_url                          # already "https://portal.nousresearch.com"
    or os.getenv("HERMES_PORTAL_BASE_URL")   # NEVER REACHED
    or os.getenv("NOUS_PORTAL_BASE_URL")
    or pconfig.portal_base_url
)

Fix

Pass None when no CLI flag is provided, so _nous_device_code_login() properly checks:

  1. --portal-url CLI arg
  2. HERMES_PORTAL_BASE_URL env var
  3. NOUS_PORTAL_BASE_URL env var
  4. DEFAULT_NOUS_PORTAL_URL (production default)

Same fix applied to inference_base_url for consistency.

Testing

  • All 234 auth-related tests pass
  • Manually verified env var loading resolves correctly

_login_nous() was passing pconfig.portal_base_url (hardcoded production
URL) as a fallback when no --portal-url CLI flag was given. This meant
_nous_device_code_login() received a truthy portal_base_url argument
and never reached the env var fallback chain.

Users setting HERMES_PORTAL_BASE_URL or NOUS_PORTAL_BASE_URL in .env
to point at a staging portal were silently ignored — login always went
to production.

Fix: pass None when no CLI flag is provided, letting the downstream
function properly check env vars before falling back to the default.

Fallback chain is now:
1. --portal-url CLI arg
2. HERMES_PORTAL_BASE_URL env var
3. NOUS_PORTAL_BASE_URL env var
4. DEFAULT_NOUS_PORTAL_URL (production)

Same fix applied to inference_base_url for consistency.
@github-actions

github-actions Bot commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

⚠️ Supply Chain Risk Detected

This PR contains patterns commonly associated with supply chain attacks. This does not mean the PR is malicious — but these patterns require careful human review before merging.

⚠️ WARNING: Install hook files modified

These files can execute code during package installation or interpreter startup.

Files:

hermes_cli/memory_setup.py
hermes_cli/setup.py
skills/productivity/google-workspace/scripts/setup.py

Automated scan triggered by supply-chain-audit. If this is a false positive, a maintainer can approve after manual review.

@benbarclay
benbarclay merged commit 302240d into main Apr 7, 2026
5 of 6 checks passed
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
…-var-ignored-during-login

fix: HERMES_PORTAL_BASE_URL env var ignored during Nous login
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
…-var-ignored-during-login

fix: HERMES_PORTAL_BASE_URL env var ignored during Nous login
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
…-var-ignored-during-login

fix: HERMES_PORTAL_BASE_URL env var ignored during Nous login
waefrebeorn pushed a commit to waefrebeorn/slermes that referenced this pull request Jul 2, 2026
…-var-ignored-during-login

fix: HERMES_PORTAL_BASE_URL env var ignored during Nous login
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant