diff --git a/gateway/config.py b/gateway/config.py index a29f7306924..d3c85e86818 100644 --- a/gateway/config.py +++ b/gateway/config.py @@ -1907,12 +1907,10 @@ def _apply_env_overrides(config: GatewayConfig) -> None: from gateway.platform_registry import platform_registry for entry in platform_registry.plugin_entries(): try: - if not entry.check_fn(): - continue + platform = Platform(entry.name) except Exception as e: - logger.debug("check_fn for %s raised: %s", entry.name, e) + logger.debug("unknown platform name %r: %s", entry.name, e) continue - platform = Platform(entry.name) existing_cfg = config.platforms.get(platform) # Respect an explicit ``enabled: false`` (YAML / gateway.json / # dashboard PUT). ``_enabled_explicit`` is set in @@ -1996,6 +1994,22 @@ def _apply_env_overrides(config: GatewayConfig) -> None: entry.name, ) continue + # Verify dependencies LAST — only for platforms that are already + # enabled or passed the credential gate above. For adapter plugins + # ``check_fn`` lazy-INSTALLS the platform SDK (pip) as a side + # effect, so running it as an unconditional sweep over every + # registered platform made ``load_gateway_config()`` pip-install + # Discord/Telegram/Slack/Feishu/Dingtalk on every call — including + # the desktop/dashboard readiness probe (``GET /api/status``, which + # awaits this synchronously) — even when the user configured none + # of them. That blocked startup until every install finished and + # caused the desktop app to time out and boot-loop (stuck at 94%). + try: + if not entry.check_fn(): + continue + except Exception as e: + logger.debug("check_fn for %s raised: %s", entry.name, e) + continue if platform not in config.platforms: config.platforms[platform] = PlatformConfig() config.platforms[platform].enabled = True