hermes - ✅(Solved) Fix [Bug]: Connecting to Wexin(WeChat) requires entering numbers [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#17706Fetched 2026-05-01 05:56:19
View on GitHub
Comments
0
Participants
1
Timeline
6
Reactions
0
Author
Participants
Timeline (top)
labeled ×4cross-referenced ×1referenced ×1

Error Message

Additional Logs / Traceback (optional)

Root Cause

Root Cause Analysis (optional)

Fix Action

Fixed

PR fix notes

PR #17768: fix(weixin): prompt for and replay the 6-digit pairing code in QR login

Description (problem / solution / changelog)

Summary

Closes #17706.

After scanning the iLink QR shown by hermes gateway setup → Weixin (WeChat), the WeChat mobile app prompts with a 6-digit confirmation number. The current poll loop has no UI for entering this number, so login stalls at 已扫码,请在微信里确认... and never reaches confirmed.

The protocol does not require a new HTTP endpoint — the existing ilink/bot/get_qrcode_status GET simply needs a verify_code=<digits> query parameter on the next poll. The reference implementation in @tencent-weixin/[email protected] (src/auth/login-qr.ts) confirms this and was used as the model for the state machine.

What changed

gateway/platforms/weixin.py::qr_login now handles three iLink statuses it was previously ignoring:

StatusBehavior
need_verifycodePrompt via asyncio.to_thread(input, ...), store pending code, skip the 1s sleep, replay it as verify_code= on the next poll. If the server returns need_verifycode again, reprompt with an error.
verify_code_blockedPrint warning, refresh QR (counts toward the existing 3-refresh budget).
binded_redirectBot is already paired with this Hermes — exit gracefully.

The QR-fetch+display block, previously duplicated 3 times, is now a small local _refresh_qr() async helper. No public API or env-var surface changed.

Test plan

  • tests/gateway/test_weixin.py — 53 passed (49 existing + 4 new)
  • TestWeixinQrLoginVerifyCode::test_need_verifycode_prompts_and_replays_code — happy path: prompt fires once, next poll URL contains verify_code=123456, login confirms.
  • test_wrong_code_is_reprompted_then_accepted — server rejects first code, second prompt is accepted.
  • test_verify_code_blocked_refreshes_qr — block triggers a second get_bot_qrcode call.
  • test_binded_redirect_short_circuits — returns None immediately.
  • End-to-end on macOS: hermes gateway setup → Weixin → scan QR → enter the 6-digit code → ~/.hermes/.env populated with WEIXIN_*, gateway picks up the platform after restart, messages flow.

Notes for reviewers

  • I deliberately scoped this to the QR-login bug only. get_bot_qrcode is still a GET in this codebase (the reference implementation POSTs with a local_token_list body); leaving that for a separate change since the GET path works for fresh installs and the bug under #17706 doesn't depend on it.
  • asyncio.to_thread(input, ...) is used so the prompt doesn't block the event loop, while still letting the existing EOFError / KeyboardInterrupt handling in the CLI's parent flow work (Ctrl-C / piped stdin both result in a graceful "微信登录已取消" exit).

Changed files

  • gateway/platforms/weixin.py (modified, +68/-24)
  • tests/gateway/test_weixin.py (modified, +105/-0)

Code Example

1

---
RAW_BUFFERClick to expand / collapse

Bug Description

When connecting to the WeChat platform via Hermes Gateway setup, after scanning the QR code, the mobile app displays a 6-digit number but there is no field in Hermes to input this number for confirmation.

<img width="828" height="1526" alt="Image" src="https://github.com/user-attachments/assets/9fcb2890-1d8a-4f1f-bbfe-7fde6688113f" />

Steps to Reproduce

Hermes Gateway setup Select Weixin (WeChat) Scan QrCode

Expected Behavior

Ability to enter numbers

Actual Behavior

WeChat can't confirm authorization

Affected Component

Gateway (Telegram/Discord/Slack/WhatsApp)

Messaging Platform (if gateway-related)

No response

Debug Report

1

Operating System

docker

Python Version

No response

Hermes Version

No response

Additional Logs / Traceback (optional)

Root Cause Analysis (optional)

No response

Proposed Fix (optional)

No response

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

extent analysis

TL;DR

The issue can be resolved by adding a field in the Hermes Gateway setup to input the 6-digit confirmation number received from WeChat after scanning the QR code.

Guidance

  • Review the Hermes Gateway setup UI to identify where the 6-digit confirmation number field can be added.
  • Check the WeChat API documentation to confirm the expected behavior and required fields for authorization.
  • Investigate the Hermes Gateway code to determine how to handle the 6-digit confirmation number input and verify it with WeChat.
  • Consider adding a temporary workaround to manually enter the confirmation number until a permanent fix is implemented.

Example

No code example is provided as the issue lacks specific technical details about the Hermes Gateway implementation.

Notes

The solution may require modifications to the Hermes Gateway UI and backend code to handle the 6-digit confirmation number. Additional testing may be necessary to ensure the fix works correctly with WeChat.

Recommendation

Apply workaround: Add a field to input the 6-digit confirmation number in the Hermes Gateway setup until a permanent fix is implemented, as this will allow users to complete the authorization process with WeChat.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - ✅(Solved) Fix [Bug]: Connecting to Wexin(WeChat) requires entering numbers [1 pull requests, 1 participants]