fix(weixin): add missing iLink headers to QR code login flow#3044
Merged
Conversation
…error output PR #2943 fixed headers in buildHeaders() but the login flow in waitForLogin() still used a hardcoded incomplete header object. Reuse the shared buildHeaders() so all endpoints send consistent iLink-App-Id and iLink-App-ClientVersion headers. Also wrap channel.connect() in startSingle() with a try/catch so configuration errors print a clean message instead of dumping the yargs help text and a stack trace.
Contributor
📋 Review SummaryThis PR addresses two related issues in the WeChat channel implementation: (1) fixes missing 🔍 General Feedback
🎯 Specific Feedback🔵 Low
/**
* Builds standard headers for iLink Bot API requests.
* Includes Content-Type, X-WECHAT-UIN, iLink-App-Id, and iLink-App-ClientVersion.
* Optionally includes Authorization headers when token is provided.
*/
export function buildHeaders(token?: string): Record<string, string> {
try {
await channel.connect();
} catch (err) {
writeStderrLine(
`Error: ${err instanceof Error ? err.message : String(err)}`,
);
bridge.stop();
router.clearAll(); // Consider adding
removeServiceInfo(); // Consider adding
process.exit(1);
}This ensures consistent cleanup whether the channel fails to connect or is shut down gracefully. ✅ Highlights
|
Contributor
Code Coverage Summary
CLI Package - Full Text ReportCore Package - Full Text ReportFor detailed HTML reports, please see the 'coverage-reports-22.x-ubuntu-latest' artifact from the main CI run. |
wenshao
approved these changes
Apr 9, 2026
wenshao
left a comment
Collaborator
There was a problem hiding this comment.
No issues found. LGTM! ✅ — gpt-5.4 via Qwen Code /review
euxaristia
pushed a commit
to euxaristia/qwen-code
that referenced
this pull request
Apr 10, 2026
…error output (QwenLM#3044) PR QwenLM#2943 fixed headers in buildHeaders() but the login flow in waitForLogin() still used a hardcoded incomplete header object. Reuse the shared buildHeaders() so all endpoints send consistent iLink-App-Id and iLink-App-ClientVersion headers. Also wrap channel.connect() in startSingle() with a try/catch so configuration errors print a clean message instead of dumping the yargs help text and a stack trace.
xaelistic
pushed a commit
to xaelistic/qwen-code
that referenced
this pull request
Jun 7, 2026
…error output (QwenLM#3044) PR QwenLM#2943 fixed headers in buildHeaders() but the login flow in waitForLogin() still used a hardcoded incomplete header object. Reuse the shared buildHeaders() so all endpoints send consistent iLink-App-Id and iLink-App-ClientVersion headers. Also wrap channel.connect() in startSingle() with a try/catch so configuration errors print a clean message instead of dumping the yargs help text and a stack trace.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TLDR
PR #2943 fixed the missing
iLink-App-IdandiLink-App-ClientVersionheaders inbuildHeaders()(api.ts), but the QR code login flow inwaitForLogin()(login.ts) still had a hardcoded incomplete header object. This PR reuses the sharedbuildHeaders()so all endpoints send consistent headers.Also fixes noisy error output when running
qwen channel startwith unconfigured WeChat — previously it dumped the full yargs help text and a stack trace.Screenshots / Video Demo
Before (error output):
After:
Dive Deeper
Two changes:
login.ts— replaced hardcoded{ 'iLink-App-ClientVersion': '1' }withbuildHeaders()from api.ts, which includes bothiLink-App-Id: 'bot'and the properly encodediLink-App-ClientVersion. ExportedbuildHeaders()from api.ts to make this possible.start.ts— wrappedchannel.connect()instartSingle()with a try/catch (matching howstartAll()already handles it) so configuration errors produce a clean one-line message instead of yargs help + stack trace.Reviewer Test Plan
rm ~/.qwen/channels/weixin/account.jsonqwen channel start my-weixin— verify clean error message, no help text or stack traceqwen channel configure-weixin— scan QR code with WeChat, confirm loginaccount.jsonis created and "Connected to WeChat successfully!" is printedqwen channel start my-weixin— verify channel connects and runs normallyTesting Matrix
Linked issues / bugs
Fixes #3036