fix(weixin): add retry mechanism for sendMessage ret=-2 errors#371
Open
fix(weixin): add retry mechanism for sendMessage ret=-2 errors#371
Conversation
When ilink API returns ret=-2, it typically indicates: - context_token expired or invalid - temporary rate limiting This fix adds: - Retry mechanism (3 attempts) for sendMessage when ret=-2 is returned - context_token refresh between retries - Delay between message chunks (100ms) to avoid rate limiting - Delay between retries (500ms) for temporary failures - More detailed logging including content_len for debugging Fixes #365 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Owner
Author
|
✅ QA review: Ready to merge Well-structured retry mechanism for weixin API failures. Review summary:
Minor observation: Retry logic duplicates between Good fix for a real production issue. |
Owner
Author
|
LGTM! Solid retry mechanism for weixin sendMessage failures. ✅ Implementation:
✅ Root cause handling: ✅ Logging: Added ✅ CI: All checks pass. Ready for merge. |
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.
Summary
Root Cause
When ilink API returns ret=-2, it typically indicates:
Previously, cc-connect would immediately fail without retry, causing partial message delivery.
Changes
weixin.go: AddsendChunkWithRetrywith retry logic and chunk delaymedia_outbound.go: AddsendSingleItemWithRetryfor media messagesclient.go: Add content_len to error logging for better debuggingTest plan
go build ./...passesgo vet ./...passesgo test ./platform/weixin/...passes🤖 Generated with Claude Code
Fixes #365