From 571248348725b840acf0bcde43ffbecbba56fe2d Mon Sep 17 00:00:00 2001 From: kshitijk4poor <82637225+kshitijk4poor@users.noreply.github.com> Date: Mon, 11 May 2026 18:44:15 +0530 Subject: [PATCH] fix: guard resolve_profile_env against missing profile dirs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- hermes_cli/kanban_db.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hermes_cli/kanban_db.py b/hermes_cli/kanban_db.py index 43dbce0ab6f..4746c85518a 100644 --- a/hermes_cli/kanban_db.py +++ b/hermes_cli/kanban_db.py @@ -3941,7 +3941,14 @@ def _default_spawn( # 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) + try: + env["HERMES_HOME"] = resolve_profile_env(profile_arg) + except FileNotFoundError: + # Profile dir doesn't exist — defer resolution to the CLI's + # _apply_profile_override() via HERMES_PROFILE (set below). + # This only happens in test fixtures where the isolated + # HERMES_HOME never had profiles created. + pass if task.tenant: env["HERMES_TENANT"] = task.tenant env["HERMES_KANBAN_TASK"] = task.id