From 5af315c4cc833e20d7306053cbee295b3f0639af Mon Sep 17 00:00:00 2001 From: TurgutKural <58116817+TurgutKural@users.noreply.github.com> Date: Sun, 10 May 2026 21:28:22 +0300 Subject: [PATCH] fix(kanban): inject HERMES_HOME into worker subprocess env 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 , 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. --- hermes_cli/kanban_db.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/hermes_cli/kanban_db.py b/hermes_cli/kanban_db.py index f414766ef5c..21b0e743259 100644 --- a/hermes_cli/kanban_db.py +++ b/hermes_cli/kanban_db.py @@ -3930,6 +3930,18 @@ def _default_spawn( prompt = f"work kanban task {task.id}" env = dict(os.environ) + + # Inject HERMES_HOME so the worker reads the profile-scoped config.yaml + # (fallback_providers, toolsets, agent settings, etc.) instead of the root + # config. Without this, `env = dict(os.environ)` copies only the parent's + # env, and when the child process starts `hermes -p ` the + # _apply_profile_override() runs *before* hermes_constants is imported. + # If HERMES_HOME is absent from the child's env, get_hermes_home() falls + # back to Path.home() / ".hermes" (the DEFAULT profile root), ignoring the + # profile-specific config entirely. Fixes profile-scoped fallback_providers + # being invisible to kanban workers. + from hermes_cli.profiles import resolve_profile_env + env["HERMES_HOME"] = resolve_profile_env(profile_arg) if task.tenant: env["HERMES_TENANT"] = task.tenant env["HERMES_KANBAN_TASK"] = task.id