Repository navigation
fix(wecom): extract inbound video/voice media instead of dropping them as empty messages - #123
Open
TaoMasterCoder wants to merge 1 commit into
Open
TaoMasterCoder wants to merge 1 commit into
TaoMasterCoder wants to merge 1 commit into
Conversation
…m as empty messages Port of hermes-agent core PR #142800 (closed when the WeCom platform moved out of core). msgtype=video / voice callbacks carried no extraction branch, so the message hit the adapter's empty-message drop path and the media never reached the agent. Now _extract_media refs video/voice (top level, mixed, quote), the inbound cap is the documented 100MB callback limit, A/V container magic is sniffed when the CDN labels bytes octet-stream, and voice STT transcripts short-circuit cleanly. _derive_message_type maps video -> VIDEO. Tests: TestWeComInboundVideoVoice in wecom/tests/test_wecom.py (6 new; all red without the fix, green with it; whole file 58 passed).
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
Port of hermes-agent core PR NousResearch/hermes-agent#142800, closed without merging when the WeCom platform tree was deleted from core. The fix never landed anywhere — with it removed, this plugin still drops every inbound video/voice message.
Scenario / bug
WeCom AI-bot callbacks for
msgtype=video/voicecarry a{\"video\": {...}}/{\"voice\": {...}}container._extract_mediahad no branch for them, somedia_urlsstayed empty and_on_messageskipped the payload as an "empty WeCom message" — users sending video or voice got no reply and no forensics. Quotes of video/voice and mixed items were equally ignored.Fix (ported hunk-for-hunk onto current
wecom/)_extract_media: video/voice refs at top level, inmixeditems, and inquote.INBOUND_MEDIA_MAX_BYTES) instead of the 20MB outbound file cap, so a 25MB phone video no longer trips the guard._detect_av_mimemagic-byte sniff (mp4/amr/silk/ogg/wav/webm) when WeCom's CDN labels A/V asapplication/octet-stream, for both base64 and URL paths._extract_text)._derive_message_type:video/*->MessageType.VIDEO(TEXT when captioned).Tests
TestWeComInboundVideoVoiceinwecom/tests/test_wecom.py(ported from the core PR): 6 new tests, red 6/6 without the fix, green with it; whole file 58 passed against current core. (test_wecom_image_link_fallback.pyfails identically on untouchedmainlocally — core-version drift, unrelated.)