Skip to content

fix(gateway): mark WeCom and QQBot missing-credential errors as non-retryable - #19891

Open
nftpoetrist wants to merge 1 commit into
NousResearch:mainfrom
nftpoetrist:fix/gateway-missing-credentials-non-retryable
Open

nftpoetrist wants to merge 1 commit into
NousResearch:mainfrom
nftpoetrist:fix/gateway-missing-credentials-non-retryable

Conversation

@nftpoetrist

Copy link
Copy Markdown
Contributor

What does this PR do?

WeComAdapter.connect() and QQAdapter.connect() call _set_fatal_error() with retryable=True when WECOM_BOT_ID/WECOM_SECRET or QQ_APP_ID/QQ_CLIENT_SECRET are not configured. gateway/run.py queues adapters with fatal_error_retryable=True for 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) and gateway/platforms/weixin.py already mark the same class of config error as retryable=False. This PR brings WeCom and QQBot into parity.

Root cause: wecom.py line 205 and qqbot/adapter.py line 237 pass retryable=True to _set_fatal_error() for credential-missing checks.

Fix: flip retryable=False on 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

  • 🐛 Bug fix
  • ✨ New feature
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests
  • ♻️ Refactor
  • 🎯 New skill

Changes Made

  • gateway/platforms/wecom.py: retryable=Trueretryable=False for wecom_missing_credentials (+1/-1)
  • gateway/platforms/qqbot/adapter.py: retryable=Trueretryable=False for qq_missing_credentials (+1/-1)
  • tests/gateway/test_wecom.py: add assert adapter.fatal_error_retryable is False to existing missing-credentials test
  • tests/gateway/test_qqbot.py: add TestQQConnect.test_missing_credentials_is_non_retryable

How to Test

python3.11 -m pytest tests/gateway/test_wecom.py::TestWeComConnect::test_connect_records_missing_credentials tests/gateway/test_qqbot.py::TestQQConnect::test_missing_credentials_is_non_retryable -v

Checklist

Code

  • Contributing Guide okundu
  • Conventional Commits
  • Duplicate PR yok
  • Sadece bu fix
  • pytest çalıştırıldı
  • Test eklendi
  • Platform: macOS

Documentation & Housekeeping

  • Docs güncellendi — N/A
  • cli-config.yaml.example — N/A
  • CONTRIBUTING.md/AGENTS.md — N/A
  • Cross-platform impact — N/A
  • Tool descriptions — N/A

…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.
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery platform/wecom WeCom / WeChat Work adapter platform/qqbot QQ Bot adapter labels May 4, 2026
@alt-glitch

Copy link
Copy Markdown
Contributor

Fixes #19890 — same root cause: WeCom and QQBot credential-missing errors marked retryable=True.

@alt-glitch

Copy link
Copy Markdown
Contributor

Fixes #19890

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 to plugins/platforms/wecom/adapter.py by 560010547. 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=False change at plugins/platforms/wecom/adapter.py:215; the existing test already imports that plugin adapter at tests/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)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@teknium1 teknium1 added sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists platform/qqbot QQ Bot adapter platform/wecom WeCom / WeChat Work adapter sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(gateway): WeCom and QQBot mark missing-credential errors as non-retryable

3 participants