fix(gateway): mark unconfigured platforms as non-retryable to stop reconnect loop (#31049)#31057
fix(gateway): mark unconfigured platforms as non-retryable to stop reconnect loop (#31049)#31057dskwe wants to merge 2 commits into
Conversation
…connect loop (NousResearch#31049) When platform adapters (Discord, Telegram, Slack) have no credentials configured (missing token/dependency), their connect() returns False without setting a fatal error. The gateway treats this as a transient failure and queues the platform for background reconnection, causing infinite retry loops with growing backoff. Fix: call _set_fatal_error(retryable=False) before returning False in credential/dependency checks so the gateway recognizes these as permanent misconfigurations and skips them silently instead of retrying. Affected platforms: - Discord: missing discord.py or bot token - Telegram: missing python-telegram-bot or bot token - Slack: missing slack-bolt, SLACK_BOT_TOKEN, or SLACK_APP_TOKEN
…error (NousResearch#31049) 7 new tests across three platforms: - Discord (2): missing discord.py, missing bot token - Telegram (2): missing python-telegram-bot, missing bot token - Slack (3): missing slack-bolt, missing SLACK_BOT_TOKEN, missing SLACK_APP_TOKEN All verify that connect() sets has_fatal_error=True and fatal_error_retryable=False so the gateway skips reconnection.
PR Review - #31057SummaryThis PR fixes an infinite reconnect loop when a platform plugin is listed in AnalysisCorrectness: The pattern Edge cases verified:
Issues FoundWARNING (1)
INFO (2)
Points Positifs
CI Status (partial)
Recommendation
|
hal-blinc
left a comment
There was a problem hiding this comment.
Coach review: ready to merge. Verified clean merge state, no failing/pending checks, targeted review/tests passed or were confirmed by CI. Low-risk housekeeping fix.
Problem
When a platform plugin (e.g.
hermes-discord) is listed inconfig.yamlbut has no credentials configured (no bot token), the gateway enters an infinite reconnect loop instead of skipping the platform silently.Closes #31049
Root Cause
Platform adapters (Discord, Telegram, Slack) return
Falsefromconnect()when credentials are missing, but don't call_set_fatal_error(retryable=False). The gateway's startup code treats a bareFalsereturn (no fatal error set) as a transient failure and queues the platform for background reconnection with growing backoff — even though missing credentials will never self-resolve.Fix
Call
_set_fatal_error(retryable=False)before returningFalsein credential/dependency checks. The gateway already handles non-retryable fatal errors correctly — it logs the error and skips reconnection.Affected platforms:
discord.pyor bot tokenpython-telegram-botor bot tokenslack-bolt,SLACK_BOT_TOKEN, orSLACK_APP_TOKENNo behavioral change for platforms that have valid credentials or encounter transient network errors.
Changes
plugins/platforms/discord/adapter.py—_set_fatal_errorbeforereturn Falsefor missing dependency/tokengateway/platforms/telegram.py—_set_fatal_errorbeforereturn Falsefor missing dependency/tokengateway/platforms/slack.py—_set_fatal_errorbeforereturn Falsefor missing dependency/tokensHow to Test