diff --git a/hermes_cli/gateway.py b/hermes_cli/gateway.py index 4313f6c2541..3af87830cf3 100644 --- a/hermes_cli/gateway.py +++ b/hermes_cli/gateway.py @@ -3737,7 +3737,12 @@ def _platform_status(platform: dict) -> str: configured = bool(entry.is_connected(synthetic)) except Exception: configured = False - if not configured: + else: + # No is_connected hook — fall back to check_fn as a coarse + # "are deps present" gate. Don't fall back when is_connected + # is defined and returned False; that would let "SDK is + # installed" override "no token configured" and incorrectly + # report the platform as ready. try: configured = bool(entry.check_fn()) except Exception: diff --git a/plugins/platforms/discord/adapter.py b/plugins/platforms/discord/adapter.py index 30eee2b3da6..efe0b5d1de7 100644 --- a/plugins/platforms/discord/adapter.py +++ b/plugins/platforms/discord/adapter.py @@ -6137,9 +6137,16 @@ def _apply_yaml_config(yaml_cfg: dict, discord_cfg: dict) -> dict | None: def _is_connected(config) -> bool: - """Discord is considered connected when DISCORD_BOT_TOKEN is set.""" - import os - return bool(os.getenv("DISCORD_BOT_TOKEN", "").strip()) + """Discord is considered connected when DISCORD_BOT_TOKEN is set. + + Looks up via ``hermes_cli.gateway.get_env_value`` at call time (not via + the plugin's own bound import) so tests that patch ``gateway_mod.get_env_value`` + — including ``test_setup_openclaw_migration`` — can suppress ambient + ``DISCORD_BOT_TOKEN`` env vars. Matches what the legacy + ``_PLATFORMS["discord"]`` dispatch did before this migration. + """ + import hermes_cli.gateway as gateway_mod + return bool((gateway_mod.get_env_value("DISCORD_BOT_TOKEN") or "").strip()) def _build_adapter(config):