Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions hermes_cli/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4273,7 +4273,7 @@ def migrate_config(interactive: bool = True, quiet: bool = False) -> Dict[str, A

# ── Version 3 → 4: migrate tool progress from .env to config.yaml ──
if current_ver < 4:
config = load_config()
config = read_raw_config()
display = config.get("display", {})
if not isinstance(display, dict):
display = {}
Expand All @@ -4296,7 +4296,7 @@ def migrate_config(interactive: bool = True, quiet: bool = False) -> Dict[str, A

# ── Version 4 → 5: add timezone field ──
if current_ver < 5:
config = load_config()
config = read_raw_config()
if "timezone" not in config:
old_tz = os.getenv("HERMES_TIMEZONE", "")
if old_tz and old_tz.strip():
Expand Down Expand Up @@ -4324,7 +4324,7 @@ def migrate_config(interactive: bool = True, quiet: bool = False) -> Dict[str, A

# ── Version 11 → 12: migrate custom_providers list → providers dict ──
if current_ver < 12:
config = load_config()
config = read_raw_config()
custom_list = config.get("custom_providers")
if isinstance(custom_list, list) and custom_list:
providers_dict = config.get("providers", {})
Expand Down Expand Up @@ -4415,7 +4415,7 @@ def migrate_config(interactive: bool = True, quiet: bool = False) -> Dict[str, A
if isinstance(raw_stt, dict) and "model" in raw_stt:
legacy_model = raw_stt["model"]
provider = raw_stt.get("provider", "local")
config = load_config()
config = read_raw_config()
stt = config.get("stt", {})
# Remove the legacy flat key
stt.pop("model", None)
Expand Down Expand Up @@ -4777,7 +4777,7 @@ def migrate_config(interactive: bool = True, quiet: bool = False) -> Dict[str, A
missing_config = get_missing_config_fields()

if missing_config:
config = load_config()
config = read_raw_config()

for field in missing_config:
key = field["key"]
Expand All @@ -4793,7 +4793,7 @@ def migrate_config(interactive: bool = True, quiet: bool = False) -> Dict[str, A
save_config(config)
elif current_ver < latest_ver:
# Just update version
config = load_config()
config = read_raw_config()
config["_config_version"] = latest_ver
save_config(config)

Expand All @@ -4815,7 +4815,7 @@ def migrate_config(interactive: bool = True, quiet: bool = False) -> Dict[str, A

if answer in {"y", "yes"}:
print()
config = load_config()
config = read_raw_config()
try:
from agent.skill_utils import SKILL_CONFIG_PREFIX
except Exception:
Expand Down
5 changes: 4 additions & 1 deletion tests/hermes_cli/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,10 @@ def test_migrate_adds_discord_channel_prompts_default(self, tmp_path):
from hermes_cli.config import DEFAULT_CONFIG
assert raw["_config_version"] == DEFAULT_CONFIG["_config_version"]
assert raw["discord"]["auto_thread"] is True
assert raw["discord"]["channel_prompts"] == {}
# channel_prompts is a DEFAULT_CONFIG value that should NOT be expanded
# into the user's file — read_raw_config() preserves only what the user
# explicitly wrote (fixes #40821: config migration expanding defaults).
assert "channel_prompts" not in raw.get("discord", {})


class TestUserMessagePreviewConfig:
Expand Down
Loading