The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(hermes_cli): _reset_aux_to_auto — one clearing predicate for aux tasks and delegation
Teknium24c4f93a011e
diff --git a/hermes_cli/main_provider_setup.py b/hermes_cli/main_provider_setup.pyindex 632377dde83..76f35da38e7 100644--- a/hermes_cli/main_provider_setup.py+++ b/hermes_cli/main_provider_setup.py@@ -150,32 +150,26 @@ def _save_aux_choice(task: str, *, provider: str, model: str = "", base_url: strdef _reset_aux_to_auto() -> int:"""Reset every known aux task (built-in + plugin) back to auto/empty. Returns number reset."""from hermes_cli.config import load_config, save_config- cfg = load_config()- aux = _ensure_dict_section(cfg, "auxiliary")- count = 0- for task, _name, _desc in _all_aux_tasks():- entry = _ensure_dict_section(aux, task)+ def _clear(entry: dict, auto: str) -> bool:+ # Only the routing fields; timeout/download_timeout (aux) and max_concurrent_children+ # etc. (delegation) are user-tuned and preserved. *auto* is the reset provider value+ # ("auto" for aux tasks, "" for delegation); anything else counts as a change.changed = False- if entry.get("provider") not in {None, "", "auto"}:- entry["provider"] = "auto"+ if entry.get("provider") not in {None, "", auto}:+ entry["provider"] = autochanged = Truefor field in ("model", "base_url", "api_key"):if entry.get(field):entry[field] = ""changed = True- # Preserve timeout/download_timeout — those are user-tuned, not routing- if changed:- count += 1- # Delegation: clear only the routing fields; max_concurrent_children etc. are preserved.+ return changed++ cfg = load_config()+ aux = _ensure_dict_section(cfg, "auxiliary")+ count = sum(_clear(_ensure_dict_section(aux, task), "auto") for task, _name, _desc in _all_aux_tasks())dele = cfg.get("delegation")if isinstance(dele, dict):- changed = False- for field in ("provider", "model", "base_url", "api_key"):- if dele.get(field):- dele[field] = ""- changed = True- if changed:- count += 1+ count += _clear(dele, "")save_config(cfg)return count