Skip to content

fix(gateway): honor active_profile when HERMES_HOME is the default root#22506

Open
haimu0x wants to merge 4 commits into
NousResearch:mainfrom
haimu0x:fix/gateway-respect-active-profile
Open

fix(gateway): honor active_profile when HERMES_HOME is the default root#22506
haimu0x wants to merge 4 commits into
NousResearch:mainfrom
haimu0x:fix/gateway-respect-active-profile

Conversation

@haimu0x

@haimu0x haimu0x commented May 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Gateway entrypoints that import gateway/run.py (e.g. python -m gateway.run, systemd with HERMES_HOME set to the canonical default root) never applied the same early profile bootstrap as hermes_cli/main.py, so sticky active_profile was ignored while the CLI worked.

Changes

  • Extract shared apply_profile_env_override() into hermes_cli/profile_env_bootstrap.py (explicit -p / --profile first; if HERMES_HOME is already set to a path other than get_profile_dir("default"), keep it for subprocess inheritance; otherwise read active_profile and resolve).
  • Call the bootstrap from gateway/run.py before the first get_hermes_home() use.
  • Delegate hermes_cli/main.py to the same helper.
  • Add regression tests in tests/hermes_cli/test_profile_env_bootstrap.py.

Verification

  • python -m pytest tests/hermes_cli/test_profile_env_bootstrap.py -q -n 0

Fixes #22502

haimu0x added 4 commits May 9, 2026 19:11
Share CLI profile bootstrap with gateway/run.py so systemd and -m startup resolve sticky active_profile while non-default HERMES_HOME still inherits for subprocess relaunches.

Fixes NousResearch#22502.
…ytest

- Post / update PR comment: continue-on-error (fork tokens cannot write to base repo).
- apply_profile_env_override: skip implicit bootstrap when pytest already loaded; main forces skip off.
- Cover pytest/gateway split in test_profile_env_bootstrap.

Related to NousResearch#22502.
Use base _thread_metadata_for_source in _deliver_media_from_response so unit tests can pass a dummy self.

Prefer thin-table exact match over OpenRouter metadata for hy3-preview.

Align topic/session and streaming Telegram media tests with current thread metadata.

Assert restart drain reply via catalog; clear HERMES_LANGUAGE and reset i18n caches between tests.
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery comp/cli CLI entry point, hermes_cli/, setup wizard area/config Config system, migrations, profiles labels May 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Config system, migrations, profiles comp/cli CLI entry point, hermes_cli/, setup wizard comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Profile switching fully broken in Gateway/WebUI/Telegram - HERMES_HOME guard blocks active_profile

2 participants