mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-03 02:11:48 +00:00
fix(curator): seed defaults on update, create logs/curator dir, defer fire import (#17927)
Three fixes bundled for curator reliability on existing installs and broken/partial installs: 1. run_agent.py: defer `import fire` into the __main__ block. `fire` is only used by `fire.Fire(main)` when running run_agent.py directly as a CLI — it is NOT needed for library usage. Importing it at module top made `from run_agent import AIAgent` from a daemon thread (e.g. the curator's forked review agent) crash with ModuleNotFoundError on broken/partial installs where `fire` isn't present. 2. hermes_cli/config.py: add version 22 → 23 migration that writes the `curator` + `auxiliary.curator` sections to config.yaml with their defaults, only filling keys the user hasn't overridden. Existing configs from before PR #16049 / the April 2026 `auxiliary.curator` unification had neither section on disk, so users couldn't see or edit the settings in their config.yaml (runtime deep-merge papered over it at read time, but the file never reflected reality). 3. hermes_cli/config.py: `ensure_hermes_home()` now pre-creates `~/.hermes/logs/curator/` alongside cron/sessions/logs/memories on every CLI launch. Managed-mode (NixOS) variant mkdir's it defensively after the activation-script existence checks, since the activation script may not know about this subpath. 4. agent/curator.py: `_reports_root()` mkdir's the dir at call time as belt-and-suspenders for entry paths that bypass both ensure_hermes_home() and the v23 migration (gateway-only installs, bare library use). E2E validated in isolated HERMES_HOME: fresh install gets full defaults seeded; partial-override config keeps user's `enabled: false` and custom `interval_hours` while filling the missing keys; re-running the migration is a no-op.
This commit is contained in:
parent
d1d0ef6dbd
commit
e8e5985ce6
3 changed files with 109 additions and 4 deletions
|
|
@ -47,7 +47,12 @@ from urllib.parse import urlparse, parse_qs, urlunparse
|
|||
# (a) the single in-module `OpenAI(**client_kwargs)` call site at
|
||||
# _create_openai_client, and
|
||||
# (b) `patch("run_agent.OpenAI", ...)` test patterns used by ~28 test files.
|
||||
import fire
|
||||
#
|
||||
# NOTE: `fire` is ONLY used in the `__main__` block below (for running
|
||||
# run_agent.py directly as a CLI) — it is NOT needed for library usage.
|
||||
# It is imported there, not here, so that importing run_agent from a
|
||||
# daemon thread (e.g. curator's forked review agent) never fails with
|
||||
# ModuleNotFoundError on broken/partial installs where `fire` isn't present.
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
|
||||
|
|
@ -13844,4 +13849,5 @@ def main(
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import fire
|
||||
fire.Fire(main)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue