fix(weixin): add per-chunk retry with backoff for text delivery - #7932
Merged
Conversation
When sending multi-chunk responses, individual chunks can fail due to transient iLink API errors. Previously a single failure would abort the entire message. Now each chunk is retried with linear backoff before giving up, and the same client_id is reused across retries for server-side deduplication. Configurable via config.yaml (platforms.weixin.extra) or env vars: - send_chunk_delay_seconds (default 0.35s) — pacing between chunks - send_chunk_retries (default 2) — max retry attempts per chunk - send_chunk_retry_delay_seconds (default 1.0s) — base retry delay Replaces the hardcoded 0.3s inter-chunk delay from #7903. Salvaged from PR #7899 by @corazzione. Fixes #7836.
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
When sending multi-chunk Weixin responses, individual chunks can fail due to transient iLink API errors. Previously a single failure aborted the entire message. Now each chunk retries with linear backoff before giving up, and the same
client_idis reused across retries for server-side deduplication.What changed
_send_text_chunk()— new retry wrapper around_send_message()with configurable attempts and backoffsend_chunk_delay_seconds(default 0.35s)send_chunk_delay_seconds,send_chunk_retries(default 2),send_chunk_retry_delay_seconds(default 1.0s)Files changed (+105/-8)
gateway/platforms/weixin.py— config properties,_send_text_chunk()retry wrapper, updatedsend()tests/gateway/test_weixin.py— 2 new tests (TestWeixinChunkDelivery)Test results
20/20 weixin tests pass
Salvaged from PR #7899 by @corazzione. Contributor authorship preserved. Fixes #7836.