Skip to content

fix: resolve HERMES_HOME via hermes_constants for profile-scoped config - #14

Open
Acrazt05 wants to merge 1 commit into
PickNikRobotics:mainfrom
Acrazt05:fix/hermes-home-profile-scoped
Open

Acrazt05 wants to merge 1 commit into
PickNikRobotics:mainfrom
Acrazt05:fix/hermes-home-profile-scoped

Conversation

@Acrazt05

Copy link
Copy Markdown

Summary

Fixes config resolution so the plugin honors the profile-scoped Hermes home directory (as set by the multiplex gateway) rather than only the process-level HERMES_HOME env var.

Problem

config.py's hermes_home() returned os.environ.get("HERMES_HOME", ...). Under a Hermes gateway running multiplexed profiles, each profile is scoped through a context-local home override (hermes_constants.get_hermes_home()), not through os.environ["HERMES_HOME"]. Since that env var is not set per profile under multiplex, hermes_home() fell back to the platform default and config_path() read the root config.yaml — which has no github_app section. Every multiplexed agent then failed with:

ConfigurationError: missing GitHub App client ID: set GITHUB_APP_CLIENT_ID or github_app.client_id

even when each profile had a valid github_app block in its own config.yaml. This affects any value read from the home-scoped config.yaml, not just GitHub App credentials.

Solution

Use hermes_constants.get_hermes_home() when the module is importable (i.e. when the plugin runs inside a Hermes process / multiplex gateway). It resolves in the correct order: context override → HERMES_HOME env var → platform default. When the module is unavailable (e.g. the standalone CLI, launched outside the Hermes source tree), fall back to the previous env-var behavior so the CLI is unchanged.

The module is loaded via importlib and accessed through a typed cast, so no hard dependency on hermes_constants is introduced and the existing strict type-checking passes.

Why this is safe

  • Inside a Hermes process, hermes_constants is already on the import path and is what the rest of the codebase uses for home resolution, so this aligns with existing conventions.
  • Outside a Hermes process (standalone CLI), the module is not importable and behavior is unchanged.
  • No new dependencies.

Testing

  • hermes-github-app status still loads config correctly when HERMES_HOME is set (CLI behavior unchanged).
  • With a context-local home override set (the multiplex scoping mechanism), load_config() now resolves the correct profile's github_app section; previously it raised the missing-client-ID error.

Checks

  • ruff format --check
  • ruff check
  • mypy (strict)
  • pytest (17 passed)

When running under a Hermes multiplex gateway each profile is scoped via a
context-local home override (hermes_constants.get_hermes_home()), not via
os.environ["HERMES_HOME"]. The plugin read only the env var, so under
multiplex it fell back to the platform default and read the root config.yaml
(no github_app section), raising 'missing GitHub App client ID'.

Use hermes_constants.get_hermes_home() when available (in-process / multiplex
gateway) and fall back to the env var for the standalone CLI. The module is
imported via importlib so no hard dependency is introduced.
@JWhitleyWork
JWhitleyWork self-requested a review November 10, 2026 19:06
@JWhitleyWork JWhitleyWork self-assigned this Nov 10, 2026
@JWhitleyWork

Copy link
Copy Markdown
Member

Sorry I didn't see this until now. Thank you for the fix!

@JWhitleyWork

Copy link
Copy Markdown
Member

Non-blocking suggestion: please add regression tests in tests/test_config.py for the new home-resolution path. The existing 17 tests do not exercise the hermes_constants branch.

Useful cases:

  • A context-local home override takes precedence over the process-level HERMES_HOME, and load_config() reads that profile’s github_app section.
  • Switching and resetting overrides resolves the appropriate profile on each call, without leaking the previous profile’s configuration.
  • When hermes_constants is unavailable, resolution still falls back to HERMES_HOME or ~/.hermes.

The implementation looks correct; these tests would protect the multiplex-profile fix from regressions.

Written by AI.

This branch has not been deployed

No deployments
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.

2 participants