Conversation
KoNit-K
force-pushed
the
fix/weixin-ilink-prepare-failed
branch
from
September 17, 2026 04:48
0eff425 to
8168bf1
Compare
This was referenced Sep 18, 2026
Closed
This branch was successfully deployed
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.
What does this PR do?
Weixin iLink can return
ret=-2orerrcode=-2witherrmsg="prepare failed"after a peer context token has become stale. The adapter previously classified that response as a frequency limit, which opened its rate-limit circuit and prevented cron and notification delivery. This change recognizesprepare failedas the same stale-session response class as the existingunknown errorvariant, so the established tokenless retry path can deliver the message.The narrow match still requires iLink's
-2code and the exact stale-session error text. Other-2responses, including genuine frequency limits, retain the existing backoff and circuit-breaker behavior.Related Issue
Fixes #112709
Type of Change
Changes Made
gateway/platforms/weixin.py— classify iLinkretorerrcode-2responses witherrmsg="prepare failed"as stale sessions rather than rate limits.tests/gateway/test_weixin.py— parameterize the delivery regression across both response fields and assert that the retry drops the stored context token.tests/gateway/test_weixin.py— assert that the retry completes successfully without opening the rate-limit cooldown circuit.How to Test
scripts/run_tests.sh tests/gateway/test_weixin.py— 34 passed.ruff check gateway/platforms/weixin.py tests/gateway/test_weixin.py— all checks passed.test_repeated_rate_limits_open_circuit_for_followup_sendscontrol runs in the 34-test focused suite and confirms real frequency limits still open the circuit.Evidence
scripts/run_tests.sh tests/gateway/test_weixin.py -k prepare_failed_retries_without_context_tokenproduced 2 failed cases on the pre-fix code, one forretand one forerrcode; each was reported as a rate-limit cooldown.scripts/run_tests.sh tests/gateway/test_weixin.pycompleted with 34 passed and 0 failed after adding the stale-session variant.-2response witherrmsg="frequency limit"remains outside the stale-session matcher, and the existing circuit-breaker regression remains green in the focused suite.Checklist
ret=-2anderrcode=-2.