The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(config): migrate the removed cron.bot_chat_delivery_timeout_seconds key
teknium10b170468adbe
diff --git a/cron/scheduler_delivery.py b/cron/scheduler_delivery.pyindex 472bce257a9..f9816fb2719 100644--- a/cron/scheduler_delivery.py+++ b/cron/scheduler_delivery.py@@ -698,69 +698,6 @@ def _deliver_to_bot_chat(job: dict, content: str, profile: str) -> Optional[str]except Exception as exc:return f"bot-chat delivery to profile '{profile_label}' unverified: {exc}"- hermes_bin = shutil.which("hermes")- if hermes_bin:- argv = [hermes_bin]- else:- try:- import importlib.util as _ilu- found = _ilu.find_spec("hermes_cli") is not None- except Exception:- found = False- if not found:- return "bot-chat delivery failed: hermes CLI not resolvable"- argv = [sys.executable, "-m", "hermes_cli.main"]-- def _fail(msg: str, **log_kwargs) -> str:- logger.warning("Job '%s': %s", job_id, msg, **log_kwargs)- return msg-- from agent.delegation_context import delegated_child_subprocess_env- from tools.environments.local import strip_launch_profile_env- env = strip_launch_profile_env(delegated_child_subprocess_env(os.environ))- if profile:- argv += ["-p", profile]- # -p owns profile resolution; this scheduler's HERMES_HOME must not shadow it.- env.pop("HERMES_HOME", None)- else:- # Multiplex workers carry the profile in a ContextVar, not os.environ.- env["HERMES_HOME"] = str(source_home)-- query_file = None- try:- with tempfile.NamedTemporaryFile(- "w", encoding="utf-8", suffix=".txt", prefix="hermes-cron-botchat-", delete=False,- ) as fh:- fh.write(message)- query_file = fh.name-- argv += [- "chat", "--in", "~", "-c", "Bot Chat", "--create-if-missing",- "-Q", "--query-file", query_file,- ]- result = subprocess.run(- argv, capture_output=True, text=True, timeout=_get_bot_chat_delivery_timeout(), env=env,- creationflags=windows_hide_flags())- if result.returncode != 0:- tail = (result.stderr or result.stdout or "").strip()[-500:]- return _fail(- f"bot-chat delivery to profile '{profile_label}' failed (exit {result.returncode})"- + (f": {tail}" if tail else ""))- logger.info("Job '%s': delivered to Bot Chat of profile '%s'", job_id, profile_label)- return None- except subprocess.TimeoutExpired:- return _fail(- f"bot-chat delivery to profile '{profile_label}' timed out "- f"after {_get_bot_chat_delivery_timeout()}s (the bot's turn may "- "still complete; raise cron.bot_chat_delivery_timeout_seconds if "- "this recurs)")- except Exception as e:- return _fail(f"bot-chat delivery failed: {str(e) or type(e).__name__}", exc_info=True)- finally:- if query_file:- with contextlib.suppress(OSError):- os.unlink(query_file)-def _normalize_deliver_value(deliver) -> str:"""Normalize ``deliver`` to its canonical comma-separated string; ``"local"`` when falsy.diff --git a/hermes_cli/config_defaults.py b/hermes_cli/config_defaults.pyindex 581a6e9f317..8b15bdb7de5 100644--- a/hermes_cli/config_defaults.py+++ b/hermes_cli/config_defaults.py@@ -2379,7 +2379,7 @@ DEFAULT_CONFIG = {# Extra ports detection probes for an external llama-server (besides 8080)."detect_ports": [],},- "_config_version": 43, # Config schema version - bump this when adding new required fields+ "_config_version": 44, # Config schema version - bump this when adding new required fields}diff --git a/hermes_cli/config_migrations.py b/hermes_cli/config_migrations.pyindex f4e86788c5a..caf8ddda6bd 100644--- a/hermes_cli/config_migrations.py+++ b/hermes_cli/config_migrations.py@@ -647,6 +647,18 @@ MIGRATIONS: Tuple[Tuple[int, Callable[[Dict[str, Any], bool], None]], ...] = (" ✓ Removed gateway.multiplex_profile_allowlist — the multiplexing gateway now serves ""every profile under profiles/. Delete or archive a profile you do not want served."),extra_guard=lambda raw: "multiplex_profile_allowlist" in raw)),+ # 43 → 44: cron.bot_chat_delivery_timeout_seconds is gone with the local `hermes chat`+ # fallback lane it bounded. Bot Chat deliveries are admitted to the running gateway and+ # settle on its durable receipt; there is no cron-side turn left to time out.+ (44, functools.partial(+ _rewrite_key, section="cron", key="bot_chat_delivery_timeout_seconds", new=None,+ match=lambda _cur: True,+ added="removed cron.bot_chat_delivery_timeout_seconds",+ message=(+ " ✓ Removed cron.bot_chat_delivery_timeout_seconds — bot-chat deliveries are now "+ "admitted to the target profile's running gateway and tracked by receipt, so cron no "+ "longer runs (or times out) a Bot Chat turn of its own."),+ extra_guard=lambda raw: "bot_chat_delivery_timeout_seconds" in raw)),)diff --git a/tests/hermes_cli/test_config.py b/tests/hermes_cli/test_config.pyindex 1dce2353341..f86ea1c0244 100644--- a/tests/hermes_cli/test_config.py+++ b/tests/hermes_cli/test_config.py@@ -1025,6 +1025,28 @@ class TestRetiredMultiplexAllowlist:assert "multiplex_profile_allowlist" not in DEFAULT_CONFIG["gateway"]+class TestRetiredBotChatDeliveryTimeout:+ def test_v44_drops_bot_chat_delivery_timeout_with_a_note(self, tmp_path, monkeypatch):+ """The removed cron knob is dropped from existing configs with a one-time note;+ sibling cron settings and the rest of the file survive untouched."""+ from hermes_cli.config import DEFAULT_CONFIG+ from hermes_cli.config_migrations import run_migrations++ config_path = tmp_path / "config.yaml"+ config_path.write_text(yaml.safe_dump({+ "_config_version": 43,+ "cron": {"bot_chat_delivery_timeout_seconds": 900, "max_parallel_jobs": 2},+ }), encoding="utf-8")+ monkeypatch.setenv("HERMES_HOME", str(tmp_path))+ results = {"env_added": [], "config_added": [], "warnings": []}+ run_migrations(43, results, quiet=True)+ raw = yaml.safe_load(config_path.read_text(encoding="utf-8"))+ assert "bot_chat_delivery_timeout_seconds" not in raw["cron"]+ assert raw["cron"]["max_parallel_jobs"] == 2+ assert any("bot_chat_delivery_timeout_seconds" in note for note in results["config_added"])+ assert "bot_chat_delivery_timeout_seconds" not in DEFAULT_CONFIG["cron"]++class TestCustomProviderCompatibility:"""Custom provider compatibility across legacy and v12+ config schemas.