Skip to content

The agent that grows with you

refactor(gateway): filter LOCAL once in idle exit's messaging check

Teknium12f71f5d4f93
diff --git a/gateway/run_idle_exit.py b/gateway/run_idle_exit.py
index 7e5e941e4d8..12cce08a179 100644
--- a/gateway/run_idle_exit.py
+++ b/gateway/run_idle_exit.py
@@ -72,17 +72,17 @@ def attached_client(runner):
def _messaging_busy(runner) -> str | None:
from gateway.config import Platform
- local = {Platform.LOCAL}
- live = [p for p in (getattr(runner, "adapters", None) or {}) if p not in local]
+ live = list(getattr(runner, "adapters", None) or {})
for adapters in (getattr(runner, "_profile_adapters", None) or {}).values():
- live.extend(p for p in adapters if p not in local)
+ live.extend(adapters)
for pending in (getattr(runner, "_profile_failed_platforms", None) or {}).values():
- live.extend(p for p in (pending or {}) if p not in local)
- live.extend(p for p in (getattr(runner, "_failed_platforms", None) or {}) if p not in local)
+ live.extend(pending or {})
+ live.extend(getattr(runner, "_failed_platforms", None) or {})
config = getattr(runner, "config", None)
if config is not None:
- live.extend(p for p, cfg in config.platforms.items() if p not in local and getattr(cfg, "enabled", False))
- return f"messaging {sorted({getattr(p, 'value', str(p)) for p in live})}" if live else None
+ live.extend(p for p, cfg in config.platforms.items() if getattr(cfg, "enabled", False))
+ live = {getattr(p, 'value', str(p)) for p in live if p != Platform.LOCAL} # LOCAL never holds the gateway
+ return f"messaging {sorted(live)}" if live else None
def _served_homes(runner) -> list[Path]: