refactor(config): collapse thin _load_config copies onto the canonical readers

doctor_live and kanban_decompose carried byte-identical
`try: load_config() or {}` wrappers; local_models wrapped load_config in
_quiet; each is now a direct load_config_readonly() call (read-only callers;
the canonical already fails open and returns a mapping). Tests that patched the
local wrappers patch hermes_cli.config.load_config_readonly instead.

tools/code_execution_tool._load_config read the RAW file, so a managed-pinned
`code_execution.mode` and the DEFAULT_CONFIG keys were invisible at tool
discovery — it now reads load_config_readonly() (behavior change: the managed
overlay applies to execute_code's mode/timeout). onboarding.mark_seen and
credential_lifecycle's config mirror scrub parsed config.yaml with a bare
safe_load; both are read→mutate→write round-trips and use read_user_config_raw,
the documented write-back primitive.
This commit is contained in:
teknium1
2026-09-12 20:28:17 -07:00
committed by Teknium
parent 93d0dba281
commit 469a87f7a5
9 changed files with 27 additions and 50 deletions
+3 -3
View File
@@ -758,11 +758,11 @@ def _kill_process_group(proc, escalate: bool = False):
def _load_config() -> dict:
"""``code_execution`` config section via the lightweight raw reader — runs while the
"""Effective ``code_execution`` section (defaults + user file + managed overlay) — runs while the
module-level schema is built at tool discovery, so it must not import ``cli``."""
try:
from hermes_cli.config import read_raw_config
cfg = read_raw_config().get("code_execution", {})
from hermes_cli.config import load_config_readonly
cfg = load_config_readonly().get("code_execution", {})
return cfg if isinstance(cfg, dict) else {}
except Exception:
return {}