Skip to content

The agent that grows with you

fix(gateway): surface missing enabled adapters in status

Charan Rathored45080157eb5
diff --git a/gateway/run_startup.py b/gateway/run_startup.py
index c38fe1c7dbc..41c8c4e0c5c 100644
--- a/gateway/run_startup.py
+++ b/gateway/run_startup.py
@@ -1196,6 +1196,18 @@ class GatewayStartupMixin:
"No adapter for '%s' -- is the plugin installed? "
"(platform is enabled in config.yaml but no plugin registered it)", platform.value,
)
+ # No adapter exists to reconnect, so do not put this in the reconnect queue. Keep
+ # the gateway alive for siblings/cron, but make the unserved enabled platform
+ # visible to gateway status and the normal health transition observers.
+ self._startup_parked_platforms = True
+ self._update_platform_runtime_status(
+ platform.value, platform_state="fatal", error_code="adapter_unavailable",
+ error_message=(
+ f"No adapter available for enabled {platform.value}; check the plugin, "
+ "dependencies, and credentials, then restart the gateway."
+ ),
+ needs_attention=True,
+ )
continue
# Under multiplexing the default profile needs the same whole-handler runtime scope as a
# secondary (authorization and prompt rendering run before the agent-turn scope).
diff --git a/tests/gateway/test_runner_startup_failures.py b/tests/gateway/test_runner_startup_failures.py
index cab556b9075..2cf0295c40b 100644
--- a/tests/gateway/test_runner_startup_failures.py
+++ b/tests/gateway/test_runner_startup_failures.py
@@ -383,9 +383,13 @@ async def test_runner_degrades_gracefully_when_all_adapters_missing(monkeypatch,
assert ok is True
assert runner.should_exit_cleanly is False
assert runner.adapters == {}
- # Runtime state must remain "running", not "startup_failed".
+ # Cron still runs, but missing enabled platforms must not look healthy.
state = read_runtime_status()
- assert state["gateway_state"] == "running"
+ assert state["gateway_state"] == "degraded"
+ for platform in ("telegram", "discord"):
+ assert state["platforms"][platform]["state"] == "fatal"
+ assert state["platforms"][platform]["error_code"] == "adapter_unavailable"
+ assert state["platforms"][platform]["needs_attention"] is True
# A warning must be emitted explaining why no platforms connected.
assert any(
"No adapter could be created" in record.message
diff --git a/tests/gateway/test_startup_failed_platform_reports_degraded.py b/tests/gateway/test_startup_failed_platform_reports_degraded.py
index 5c6fcbe540f..30e3b4dc3f6 100644
--- a/tests/gateway/test_startup_failed_platform_reports_degraded.py
+++ b/tests/gateway/test_startup_failed_platform_reports_degraded.py
@@ -137,3 +137,40 @@ async def test_every_platform_connected_still_reports_a_normal_run(monkeypatch,
)
finally:
await runner.stop()
+
+
+async def test_missing_adapter_degrades_only_the_unserved_enabled_platform(monkeypatch, tmp_path):
+ """An enabled missing plugin must appear in status even when a sibling connects."""
+ monkeypatch.setenv("HERMES_HOME", str(tmp_path))
+ config = GatewayConfig(
+ platforms={
+ Platform.TELEGRAM: PlatformConfig(enabled=True, token="***"),
+ Platform.DISCORD: PlatformConfig(enabled=True, token="***"),
+ Platform.SLACK: PlatformConfig(enabled=False, token="***"),
+ },
+ sessions_dir=tmp_path / "sessions",
+ )
+ runner = GatewayRunner(config)
+ monkeypatch.setattr(
+ runner, "_create_adapter",
+ lambda platform, platform_config: _HealthyAdapter() if platform is Platform.TELEGRAM else None,
+ )
+
+ async def _no_secondary_profiles():
+ return 0
+
+ monkeypatch.setattr(runner, "_start_secondary_profile_adapters", _no_secondary_profiles)
+ try:
+ assert await runner.start() is True
+ state = read_runtime_status()
+ assert state["gateway_state"] == "degraded"
+ assert state["platforms"]["telegram"]["state"] == "connected"
+ assert state["platforms"]["discord"]["state"] == "fatal"
+ assert state["platforms"]["discord"]["error_code"] == "adapter_unavailable"
+ assert state["platforms"]["discord"]["needs_attention"] is True
+ assert "restart" in state["platforms"]["discord"]["error_message"]
+ assert "slack" not in state["platforms"]
+ assert runner._failed_platforms == {} # No adapter exists to reconnect.
+ finally:
+ await runner.stop()