The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(gateway): AST-neutral string-fragment rewrap to 110 cols
Tekniumfcb0ff29d6a7
diff --git a/gateway/run_notifications.py b/gateway/run_notifications.pyindex 23cd75ae65c..e57ec6d393c 100644--- a/gateway/run_notifications.py+++ b/gateway/run_notifications.py@@ -720,11 +720,10 @@ class GatewayNotificationsMixin:from hermes_state import classify_persistence_error, format_session_db_unavailableif classify_persistence_error(error) == "corrupt":message = (- "⚠️ Session database corruption detected. Messages may not be "- "persisted. Recovery options:\n1. Run `hermes doctor --fix`\n"- "2. Salvage with: sqlite3 ~/.hermes/state.db \".recover\" (then replace state.db)\n"- "3. Restore from a backup in ~/.hermes/backups/\n"- "Run `hermes doctor` for sanitized diagnostics."+ "⚠️ Session database corruption detected. Messages may not be persisted. Recovery "+ "options:\n1. Run `hermes doctor --fix`\n2. Salvage with: sqlite3 ~/.hermes/state.db "+ "\".recover\" (then replace state.db)\n3. Restore from a backup in ~/.hermes/backups/\nRun "+ "`hermes doctor` for sanitized diagnostics.")else:message = (diff --git a/gateway/run_shutdown.py b/gateway/run_shutdown.pyindex ec2a0d79aa4..824aebb3b9c 100644--- a/gateway/run_shutdown.py+++ b/gateway/run_shutdown.py@@ -322,9 +322,8 @@ class GatewayShutdownMixin:return # not opted in — normal, stay quietactive = [getattr(p, "value", p) for p in self._scale_to_zero_active_messaging_platforms()]logger.info(- "scale-to-zero: NOT armed despite opt-in — "- "relay_only_or_absent=%s (enabled platforms=%s), wake_url=%s. "- "Need relay-only messaging + a registered wake URL.",+ "scale-to-zero: NOT armed despite opt-in — relay_only_or_absent=%s (enabled platforms=%s), "+ "wake_url=%s. Need relay-only messaging + a registered wake URL.",messaging_is_relay_only_or_absent(active), active or "none","set" if self._relay_wake_url_or_none() else "MISSING",)@@ -1398,9 +1397,8 @@ class GatewayShutdownMixin:ctx.active_agents, ctx.timed_out = await self._drain_active_agents(timeout, _cron_timeout)ctx.drain_elapsed = time.monotonic() - _drain_started_atlogger.info(- "Shutdown phase: drain done at +%.2fs (drain took %.2fs, "- "timed_out=%s, active_at_start=%d, active_now=%d, cron_at_start=%d, cron_now=%d, "- "api_at_start=%d, api_now=%d, "+ "Shutdown phase: drain done at +%.2fs (drain took %.2fs, timed_out=%s, active_at_start=%d, "+ "active_now=%d, cron_at_start=%d, cron_now=%d, api_at_start=%d, api_now=%d, ""deferred_at_start=%d, deferred_now=%d)", ctx.elapsed(), ctx.drain_elapsed,ctx.timed_out, len(ctx.active_agents), self._running_agent_count(), _cron_at_start,self._active_cron_job_count(), _api_at_start, self._active_api_run_count(),@@ -1559,9 +1557,8 @@ class GatewayShutdownMixin:# so skip the close and let SQLite recover from its WAL on next open (a transient# "database is locked" on an immediate --replace at worst, not a corrupt file).logger.warning(- "Shutdown phase: %d executor worker(s) still running after "- "a %.2fs quiesce — skipping the SessionDB close/checkpoint "- "to avoid racing a live write (#101093); handles are left "+ "Shutdown phase: %d executor worker(s) still running after a %.2fs quiesce — skipping the "+ "SessionDB close/checkpoint to avoid racing a live write (#101093); handles are left ""open for SQLite to recover on next open", _exec_live, _exec_quiesce_budget,)returndiff --git a/gateway/run_startup.py b/gateway/run_startup.pyindex 4046e09e8b5..76e42961d9b 100644--- a/gateway/run_startup.py+++ b/gateway/run_startup.py@@ -222,9 +222,8 @@ class GatewayStartupMixin:returnawait self._wait_bounded_or_release({boot_task}, timeout,- "Boot-path sends still running after %.0fs; releasing inbound gate so other "- "platforms are not frozen. Restart notification / obligation redelivery continue "- "in the background.",+ "Boot-path sends still running after %.0fs; releasing inbound gate so other platforms are not "+ "frozen. Restart notification / obligation redelivery continue in the background.","background boot-path send failed after gate release: see traceback", track=True,)@@ -691,9 +690,8 @@ class GatewayStartupMixin:)else:logger.warning(- "Secret redaction: DISABLED (HERMES_REDACT_SECRETS=%s). "- "API keys and tokens may appear verbatim in chat output, "- "session JSONs, and logs. Set security.redact_secrets: true "+ "Secret redaction: DISABLED (HERMES_REDACT_SECRETS=%s). API keys and tokens may appear "+ "verbatim in chat output, session JSONs, and logs. Set security.redact_secrets: true ""in config.yaml to re-enable.", _redact_raw,)with suppress(Exception):@@ -728,11 +726,10 @@ class GatewayStartupMixin:)if _alignment is not None and _alignment.get("mismatch"):logger.warning(- "Stale systemd unit detected: %s has TimeoutStopSec=%.0fs but "- "drain_timeout=%.0fs cron_drain_timeout=%.0fs (expected >=%.0fs). "- "systemd may SIGKILL the gateway mid-drain. Run "- "`hermes gateway install --force` to regenerate the unit, or "- "shorten agent.restart_drain_timeout / agent.cron_drain_timeout.",+ "Stale systemd unit detected: %s has TimeoutStopSec=%.0fs but drain_timeout=%.0fs "+ "cron_drain_timeout=%.0fs (expected >=%.0fs). systemd may SIGKILL the gateway "+ "mid-drain. Run `hermes gateway install --force` to regenerate the unit, or shorten "+ "agent.restart_drain_timeout / agent.cron_drain_timeout.",_alignment.get("unit", "(unknown)"), _alignment["timeout_stop_sec"],_alignment["drain_timeout"],_alignment.get("cron_drain_timeout", DEFAULT_GATEWAY_CRON_DRAIN_TIMEOUT),@@ -1069,9 +1066,8 @@ class GatewayStartupMixin:for _skipped in _multiplex_skipped_platforms:if not any(_skipped in _profile_map for _profile_map in self._profile_adapters.values()):logger.warning(- "%s is enabled but no profile (default or secondary) "- "provided a bot credential for it — the platform is not "- "being served. Add its token to the profile that should "+ "%s is enabled but no profile (default or secondary) provided a bot credential for it — "+ "the platform is not being served. Add its token to the profile that should ""own it, or disable the platform.", _skipped.value,)return False, connected_count