fix(plugins): silence raft check_fn log spam for users without raft CLI

The raft platform plugin's check_raft_requirements() logged a WARNING every
time it returned False. Since check_fn is called on every load_gateway_config()
(~every 10s during normal gateway operation), users who don't have the raft
CLI installed get their logs flooded with no way to suppress it — hermes plugins
disable doesn't work for bundled platform plugins, and platforms.raft.enabled:
false doesn't gate the check_fn call.

Fix: make check_raft_requirements() a silent predicate (return True/False
only, no logging), matching the convention documented and used by other
platform adapters (e.g. teams/adapter.py). The caller in
gateway/platform_registry.py create_adapter() already emits its own warning
when requirements aren't met and an adapter is actually requested — that's the
correct place for a user-facing warning (fires once per connect attempt, not
once per config load).

Fixes #49234
This commit is contained in:
ruangraung 2026-06-20 02:42:01 +07:00 committed by Teknium
parent 75ed07ace8
commit 8cf7df867e
2 changed files with 86 additions and 3 deletions

View file

@ -98,12 +98,20 @@ _RAFT_PROMPT_TURN_IDS: set[str] = set()
def check_raft_requirements() -> bool:
"""Check if Raft channel dependencies are available."""
"""Check if Raft channel dependencies are available.
Intentionally silent on failure this is a passive probe registered as
the platform's ``check_fn``. It is called on every
``load_gateway_config()`` (message handling, display lookups, agent
turns), so logging here floods the logs for every user without the
``raft`` CLI installed. The caller (``gateway/platform_registry.py``
``create_adapter()``) emits its own warning when requirements are not met
and an adapter is actually requested. This matches the convention used by
other platform adapters (e.g. ``teams/adapter.py``).
"""
if not AIOHTTP_AVAILABLE:
logger.warning("[raft] aiohttp is not installed — install with: pip install aiohttp")
return False
if not shutil.which("raft"):
logger.warning("[raft] raft CLI not found in PATH — install from https://raft.build")
return False
return True