Skip to content

fix(kanban): inject HERMES_HOME into worker subprocess env#23356

Closed
TurgutKural wants to merge 1 commit into
NousResearch:mainfrom
TurgutKural:fix/kanban-worker-hermes-home-injection
Closed

fix(kanban): inject HERMES_HOME into worker subprocess env#23356
TurgutKural wants to merge 1 commit into
NousResearch:mainfrom
TurgutKural:fix/kanban-worker-hermes-home-injection

Conversation

@TurgutKural

Copy link
Copy Markdown
Contributor

Bug

Kanban workers spawned via _default_spawn() do not read their profile-scoped config.yaml.

When a worker is forked, its environment is copied via dict(os.environ). This copy does not contain HERMES_HOME. When the child then starts hermes -p <profile>, the CLI's _apply_profile_override() runs before hermes_constants is imported. Since HERMES_HOME is absent, get_hermes_home() falls back to ~/.hermes (the default profile root) instead of ~/.hermes/profiles/<profile>.

The practical effect: any profile-scoped setting in ~/.hermes/profiles/<profile>/config.yaml is invisible to kanban workers. Most critically, fallback_providers is ignored — workers only see the root config where fallback_providers: [].

Fix

Inject HERMES_HOME into the worker's env using resolve_profile_env(profile_arg):

from hermes_cli.profiles import resolve_profile_env
env["HERMES_HOME"] = resolve_profile_env(profile_arg)

Added immediately after env = dict(os.environ) in _default_spawn().

Testing

  1. Configure fallback_providers in ~/.hermes/profiles/<profile>/config.yaml
  2. Start a kanban task assigned to that profile
  3. Confirm the worker logs show the fallback chain (🔄 Fallback chain) on startup
  4. Watch hermes logs | grep fallback to verify the chain is populated

Related

Default spawn did not propagate HERMES_HOME when forking kanban workers.
The worker's env is copied from the parent via dict(os.environ), so
HERMES_HOME is absent. When the child then starts hermes -p <profile>,
the CLI's _apply_profile_override() runs before hermes_constants is
imported and get_hermes_home() falls back to ~/.hermes (the default
profile root), silently ignoring the profile's config.yaml.  Profile-
scoped fallback_providers, toolsets, and agent settings are therefore
never applied to kanban workers.

The fix injects HERMES_HOME into the worker's env using
resolve_profile_env(profile_arg) so the child reads the correct profile
directory instead of the default root.
Copilot AI review requested due to automatic review settings May 10, 2026 18:31
@alt-glitch alt-glitch added type/bug Something isn't working comp/cron Cron scheduler and job management P3 Low — cosmetic, nice to have labels May 10, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

kshitijk4poor added a commit that referenced this pull request May 11, 2026
For PRs #23206 (Frowtek), #23252 (Sylw3ster), #23358 (dmnkhorvath),
#23659 (smwbev), and #23356 (TurgutKural) — all part of the kanban
bug-fix batch salvage.
kshitijk4poor added a commit that referenced this pull request May 11, 2026
The _default_spawn HERMES_HOME injection (PR #23356) calls
resolve_profile_env which raises FileNotFoundError when the profile
dir doesn't exist. In production the profile always exists (workers are
only dispatched for live profiles), but tests with isolated HERMES_HOME
never create profile dirs. Catch FileNotFoundError and fall through —
HERMES_PROFILE is still set below, so the worker CLI resolves the
profile at startup.
@kshitijk4poor

Copy link
Copy Markdown
Collaborator

Merged via salvage PR #23791. Your commits were cherry-picked onto current main with your authorship preserved in git log. Thanks for the fix!

rmulligan pushed a commit to rmulligan/hermes-agent that referenced this pull request May 11, 2026
For PRs NousResearch#23206 (Frowtek), NousResearch#23252 (Sylw3ster), NousResearch#23358 (dmnkhorvath),
NousResearch#23659 (smwbev), and NousResearch#23356 (TurgutKural) — all part of the kanban
bug-fix batch salvage.
rmulligan pushed a commit to rmulligan/hermes-agent that referenced this pull request May 11, 2026
The _default_spawn HERMES_HOME injection (PR NousResearch#23356) calls
resolve_profile_env which raises FileNotFoundError when the profile
dir doesn't exist. In production the profile always exists (workers are
only dispatched for live profiles), but tests with isolated HERMES_HOME
never create profile dirs. Catch FileNotFoundError and fall through —
HERMES_PROFILE is still set below, so the worker CLI resolves the
profile at startup.
JinyuID pushed a commit to JinyuID/hermes-agent that referenced this pull request May 11, 2026
For PRs NousResearch#23206 (Frowtek), NousResearch#23252 (Sylw3ster), NousResearch#23358 (dmnkhorvath),
NousResearch#23659 (smwbev), and NousResearch#23356 (TurgutKural) — all part of the kanban
bug-fix batch salvage.
JinyuID pushed a commit to JinyuID/hermes-agent that referenced this pull request May 11, 2026
The _default_spawn HERMES_HOME injection (PR NousResearch#23356) calls
resolve_profile_env which raises FileNotFoundError when the profile
dir doesn't exist. In production the profile always exists (workers are
only dispatched for live profiles), but tests with isolated HERMES_HOME
never create profile dirs. Catch FileNotFoundError and fall through —
HERMES_PROFILE is still set below, so the worker CLI resolves the
profile at startup.
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
For PRs NousResearch#23206 (Frowtek), NousResearch#23252 (Sylw3ster), NousResearch#23358 (dmnkhorvath),
NousResearch#23659 (smwbev), and NousResearch#23356 (TurgutKural) — all part of the kanban
bug-fix batch salvage.
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
The _default_spawn HERMES_HOME injection (PR NousResearch#23356) calls
resolve_profile_env which raises FileNotFoundError when the profile
dir doesn't exist. In production the profile always exists (workers are
only dispatched for live profiles), but tests with isolated HERMES_HOME
never create profile dirs. Catch FileNotFoundError and fall through —
HERMES_PROFILE is still set below, so the worker CLI resolves the
profile at startup.
jsboige pushed a commit to jsboige/hermes-agent that referenced this pull request May 14, 2026
For PRs NousResearch#23206 (Frowtek), NousResearch#23252 (Sylw3ster), NousResearch#23358 (dmnkhorvath),
NousResearch#23659 (smwbev), and NousResearch#23356 (TurgutKural) — all part of the kanban
bug-fix batch salvage.
jsboige pushed a commit to jsboige/hermes-agent that referenced this pull request May 14, 2026
The _default_spawn HERMES_HOME injection (PR NousResearch#23356) calls
resolve_profile_env which raises FileNotFoundError when the profile
dir doesn't exist. In production the profile always exists (workers are
only dispatched for live profiles), but tests with isolated HERMES_HOME
never create profile dirs. Catch FileNotFoundError and fall through —
HERMES_PROFILE is still set below, so the worker CLI resolves the
profile at startup.
AlexFoxD pushed a commit to AlexFoxD/hermes-agent that referenced this pull request May 21, 2026
For PRs NousResearch#23206 (Frowtek), NousResearch#23252 (Sylw3ster), NousResearch#23358 (dmnkhorvath),
NousResearch#23659 (smwbev), and NousResearch#23356 (TurgutKural) — all part of the kanban
bug-fix batch salvage.
AlexFoxD pushed a commit to AlexFoxD/hermes-agent that referenced this pull request May 21, 2026
The _default_spawn HERMES_HOME injection (PR NousResearch#23356) calls
resolve_profile_env which raises FileNotFoundError when the profile
dir doesn't exist. In production the profile always exists (workers are
only dispatched for live profiles), but tests with isolated HERMES_HOME
never create profile dirs. Catch FileNotFoundError and fall through —
HERMES_PROFILE is still set below, so the worker CLI resolves the
profile at startup.
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
For PRs NousResearch#23206 (Frowtek), NousResearch#23252 (Sylw3ster), NousResearch#23358 (dmnkhorvath),
NousResearch#23659 (smwbev), and NousResearch#23356 (TurgutKural) — all part of the kanban
bug-fix batch salvage.
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
The _default_spawn HERMES_HOME injection (PR NousResearch#23356) calls
resolve_profile_env which raises FileNotFoundError when the profile
dir doesn't exist. In production the profile always exists (workers are
only dispatched for live profiles), but tests with isolated HERMES_HOME
never create profile dirs. Catch FileNotFoundError and fall through —
HERMES_PROFILE is still set below, so the worker CLI resolves the
profile at startup.
Seven74AI pushed a commit to Seven74AI/hermes-agent that referenced this pull request Jun 13, 2026
For PRs NousResearch#23206 (Frowtek), NousResearch#23252 (Sylw3ster), NousResearch#23358 (dmnkhorvath),
NousResearch#23659 (smwbev), and NousResearch#23356 (TurgutKural) — all part of the kanban
bug-fix batch salvage.
Seven74AI pushed a commit to Seven74AI/hermes-agent that referenced this pull request Jun 13, 2026
The _default_spawn HERMES_HOME injection (PR NousResearch#23356) calls
resolve_profile_env which raises FileNotFoundError when the profile
dir doesn't exist. In production the profile always exists (workers are
only dispatched for live profiles), but tests with isolated HERMES_HOME
never create profile dirs. Catch FileNotFoundError and fall through —
HERMES_PROFILE is still set below, so the worker CLI resolves the
profile at startup.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cron Cron scheduler and job management P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants