From b43524ecabc387703276b9f810b07bb3ee5fa1a5 Mon Sep 17 00:00:00 2001 From: Teknium Date: Wed, 22 Apr 2026 03:35:51 -0700 Subject: [PATCH] fix(wecom): visible poll progress + clearer no-bot-info failure + docstring note Follow-ups on top of salvaged #13923 (@keifergu): - Print QR poll dot every 3s instead of every 18s so "Fetching configuration results..." doesn't look hung. - On "status=success but no bot_info" from the WeCom query endpoint, log the full payload at WARNING and tell the user we're falling back to manual entry (was previously a single opaque line). - Document in the qr_scan_for_bot_info() docstring that the work.weixin.qq.com/ai/qc/* endpoints are the admin-console web-UI flow, not the public developer API, and may change without notice. Also add keifergu@tencent.com to scripts/release.py AUTHOR_MAP so release notes attribute the feature correctly. --- gateway/platforms/wecom.py | 20 ++++++++++++++++---- scripts/release.py | 1 + 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/gateway/platforms/wecom.py b/gateway/platforms/wecom.py index aced2bb1..a6506d18 100644 --- a/gateway/platforms/wecom.py +++ b/gateway/platforms/wecom.py @@ -1488,6 +1488,11 @@ def qr_scan_for_bot_info( Returns ``{"bot_id": ..., "secret": ...}`` on success, ``None`` on failure or timeout. + + Note: the ``work.weixin.qq.com/ai/qc/{generate,query_result}`` endpoints + used here are not part of WeCom's public developer API — they back the + admin-console web UI's bot-creation flow and may change without notice. + The same pattern is used by the feishu/dingtalk QR setup wizards. """ try: import urllib.request @@ -1561,8 +1566,8 @@ def qr_scan_for_bot_info( continue poll_count += 1 - if poll_count % 6 == 0: - print(".", end="", flush=True) + # Print a dot on every poll so progress is visible within 3s. + print(".", end="", flush=True) result_data = result.get("data") or {} status = str(result_data.get("status") or "").lower() @@ -1574,8 +1579,15 @@ def qr_scan_for_bot_info( secret = str(bot_info.get("secret") or "").strip() if bot_id and secret: return {"bot_id": bot_id, "secret": secret} - logger.warning("WeCom QR: success but missing bot_info: %s", result_data) - print(" QR scan succeeded but bot info was not returned") + logger.warning( + "WeCom QR: scan reported success but bot_info missing or incomplete: %s", + result_data, + ) + print( + " QR scan reported success but no bot credentials were returned.\n" + " This usually means the bot was not actually created on the WeCom side.\n" + " Falling back to manual credential entry." + ) return None time.sleep(_QR_POLL_INTERVAL) diff --git a/scripts/release.py b/scripts/release.py index 0a6f7b88..b67d469c 100755 --- a/scripts/release.py +++ b/scripts/release.py @@ -50,6 +50,7 @@ AUTHOR_MAP = { "71184274+MassiveMassimo@users.noreply.github.com": "MassiveMassimo", "massivemassimo@users.noreply.github.com": "MassiveMassimo", "82637225+kshitijk4poor@users.noreply.github.com": "kshitijk4poor", + "keifergu@tencent.com": "keifergu", "kshitijk4poor@users.noreply.github.com": "kshitijk4poor", "kshitijk4poor@gmail.com": "kshitijk4poor", "16443023+stablegenius49@users.noreply.github.com": "stablegenius49",