fix(gateway): mark WeCom and QQBot missing-credential errors as non-retryable - #19891
nftpoetrist wants to merge 1 commit into
Conversation
…etryable
WeComAdapter._set_fatal_error("wecom_missing_credentials", ...) and
QQAdapter._set_fatal_error("qq_missing_credentials", ...) both passed
retryable=True. gateway/run.py queues adapters with retryable fatal errors
for background reconnection every 30 seconds. A missing WECOM_BOT_ID /
WECOM_SECRET or QQ_APP_ID / QQ_CLIENT_SECRET is a configuration error
that will never resolve on its own — retrying is wasteful and masks the
real problem in the gateway status output.
Fix: flip retryable=False on both credential checks, consistent with
sms.py (sms_missing_phone_number / sms_missing_webhook_url, merged in
NousResearch#19745) and weixin.py (weixin_missing_token / weixin_missing_account)
which already mark the same class of config error as non-retryable.
No behavior change when credentials are present.
|
Fixes #19890 — same root cause: WeCom and QQBot credential-missing errors marked retryable=True. |
|
Fixes #19890 |
teknium1
left a comment
There was a problem hiding this comment.
Thanks for isolating a real retry-classification issue. The current gateway startup path marks retryable fatal errors as retrying and queues them for reconnection (gateway/run.py:7088-7105), while both credential branches still pass retryable=True (plugins/platforms/wecom/adapter.py:215, gateway/platforms/qqbot/adapter.py:295).
Problems
- The WeCom production hunk targets
gateway/platforms/wecom.py, which was migrated toplugins/platforms/wecom/adapter.pyby560010547. The old path no longer exists on main, so that hunk must be relocated to change the active adapter.
Suggested changes
- Apply the same
retryable=Falsechange atplugins/platforms/wecom/adapter.py:215; the existing test already imports that plugin adapter attests/gateway/test_wecom.py:81-82. - The QQBot change remains directly applicable at
gateway/platforms/qqbot/adapter.py:295.
Automated hermes-sweeper review.
| if not self._bot_id or not self._secret: | ||
| message = "WeCom startup failed: WECOM_BOT_ID and WECOM_SECRET are required" | ||
| self._set_fatal_error("wecom_missing_credentials", message, retryable=True) | ||
| self._set_fatal_error("wecom_missing_credentials", message, retryable=False) |
There was a problem hiding this comment.
This adapter was migrated to plugins/platforms/wecom/adapter.py by 560010547; gateway/platforms/wecom.py no longer exists on current main. Please apply this same change at the live branch, currently plugins/platforms/wecom/adapter.py:215.
What does this PR do?
WeComAdapter.connect()andQQAdapter.connect()call_set_fatal_error()withretryable=TruewhenWECOM_BOT_ID/WECOM_SECRETorQQ_APP_ID/QQ_CLIENT_SECRETare not configured.gateway/run.pyqueues adapters withfatal_error_retryable=Truefor background reconnection every 30 seconds. A missing credential is a configuration error that will never resolve on its own — the reconnect watcher spins indefinitely while the gateway status shows"retrying"instead of"fatal", obscuring the real problem.gateway/platforms/sms.py(merged today in #19745) andgateway/platforms/weixin.pyalready mark the same class of config error asretryable=False. This PR brings WeCom and QQBot into parity.Root cause:
wecom.pyline 205 andqqbot/adapter.pyline 237 passretryable=Trueto_set_fatal_error()for credential-missing checks.Fix: flip
retryable=Falseon both credential checks. One-line change per adapter, symmetric across both platform branches. No behavior change when credentials are present.Related Issue
Fixes #19890
Type of Change
Changes Made
gateway/platforms/wecom.py:retryable=True→retryable=Falseforwecom_missing_credentials(+1/-1)gateway/platforms/qqbot/adapter.py:retryable=True→retryable=Falseforqq_missing_credentials(+1/-1)tests/gateway/test_wecom.py: addassert adapter.fatal_error_retryable is Falseto existing missing-credentials testtests/gateway/test_qqbot.py: addTestQQConnect.test_missing_credentials_is_non_retryableHow to Test
Checklist
Code
Documentation & Housekeeping