The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(gateway): launchd loader logs the label it resolves
kshitijk4poor2e63bf9ca8c5
diff --git a/gateway/run_config_loaders.py b/gateway/run_config_loaders.pyindex 9c7a4e74b71..9cf2d9b8f1f 100644--- a/gateway/run_config_loaders.py+++ b/gateway/run_config_loaders.py@@ -21,7 +21,7 @@ from gateway.restart import (DEFAULT_GATEWAY_RESTART_AFTER_TURN_TIMEOUT, DEFAULT_GATEWAY_RESTART_DRAIN_TIMEOUT,DEFAULT_GATEWAY_SIGNAL_INTERRUPT_GRACE_TIMEOUT, parse_cron_drain_timeout,parse_restart_after_turn_timeout, parse_restart_drain_timeout,- parse_signal_interrupt_grace_timeout, read_launchd_exit_timeout_s,+ launchd_service_label, parse_signal_interrupt_grace_timeout, read_launchd_exit_timeout_s,resolve_launchd_capped_drain,)from gateway.session import SessionSource@@ -337,8 +337,11 @@ class GatewayConfigLoadersMixin:when ``launchctl print`` is unavailable. Logs a WARNING when the configured drain exceedsthe live budget so the misconfiguration is visible at boot, not at the next SIGKILL."""+ label = launchd_service_label()+ if label is None:+ return None# read_launchd_exit_timeout_s is already fail-open (returns None on any probe failure).- exit_timeout = read_launchd_exit_timeout_s()+ exit_timeout = read_launchd_exit_timeout_s(label)if exit_timeout is None:return Noneeffective = resolve_launchd_capped_drain(drain_timeout, exit_timeout)@@ -347,12 +350,12 @@ class GatewayConfigLoadersMixin:"restart_drain_timeout=%.0fs exceeds the live launchd exit timeout (%.0fs) for %s; ""signal-driven stops will drain at most %.0fs so teardown finishes before launchd ""SIGKILLs (launchd clamps ExitTimeOut in the per-user domain).",- drain_timeout, exit_timeout, os.environ.get("XPC_SERVICE_NAME", "this job"), effective,+ drain_timeout, exit_timeout, label, effective,)else:logger.info("launchd exit timeout for %s is %.0fs (drain %.0fs fits)",- os.environ.get("XPC_SERVICE_NAME", "this job"), exit_timeout, drain_timeout,+ label, exit_timeout, drain_timeout,)return exit_timeoutdiff --git a/gateway/run_shutdown.py b/gateway/run_shutdown.pyindex 0668949a3ef..2a20a5fc472 100644--- a/gateway/run_shutdown.py+++ b/gateway/run_shutdown.py@@ -2072,8 +2072,7 @@ class GatewayShutdownMixin:logger.warning("Shutdown drain capped to %.0fs (configured %.0fs) to fit the live launchd exit ""timeout of %.0fs — launchd SIGKILLs past it",- timeout, self._restart_drain_timeout,- getattr(self, "_launchd_exit_timeout_s", None) or 0.0,+ timeout, self._restart_drain_timeout, self._launchd_exit_timeout_s,)await GatewayRunner._stop_drain_active_work(self, timeout, ctx)if ctx.timed_out: