fix(weixin): avoid double-splitting when delivering messages - #8069
Closed
xiaobitaozi wants to merge 1 commit into
Closed
fix(weixin): avoid double-splitting when delivering messages#8069xiaobitaozi wants to merge 1 commit into
xiaobitaozi wants to merge 1 commit into
Conversation
- Add send_chunks() to BasePlatformAdapter as a hook for platforms - WeixinAdapter.send_chunks() bypasses internal _split_text to prevent double-splitting - StreamConsumer uses send_chunks() for pre-chunked content instead of send() - Fixes Weixin messages arriving as multiple fragments
Contributor
|
Merged via PR #8665 which synthesizes the best fixes from ~25 community PRs into a single consolidated change. Your contribution (double-splitting prevention) was reviewed and informed the final implementation. Thank you @xiaobitaozi for your work on this! |
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.
Add send_chunks() to BasePlatformAdapter as a hook for platforms
What does this PR do?
WeixinAdapter internally calls
_split_textto split messages, but StreamConsumer already does streamingchunking. Both layers split independently, causing a single message to arrive as multiple fragments to users.
The fix adds a
send_chunks()hook toBasePlatformAdapter. StreamConsumer now passes pre-chunked contentdirectly through this hook, bypassing
_split_textin WeixinAdapter to eliminate the double-splitting issue.Related Issue
Fixes #
Type of Change
Changes Made
gateway/platforms/base.py: Addsend_chunks()hook toBasePlatformAdaptergateway/platforms/weixin.py: Implementsend_chunks()to bypass_split_textgateway/delivery.py:StreamConsumerusessend_chunks()for pre-chunked contentHow to Test
Checklist
Code
fix(scope):,feat(scope):, etc.)duplicate
pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/Aguide — or
N/A
For New Skills
Guide
format (frontmatter,
trigger conditions, steps, pitfalls)
hermes --toolsets skills -q "Use the X skill to do Y"Screenshots / Logs