Repository navigation
fix(feishu,dingtalk): upload local video replies instead of dropping them - #3299
Merged
Merged
Conversation
…them ChatChannel hands every channel an agent-produced video as Reply(ReplyType.VIDEO, "file://" + path). Neither channel dispatched that type: Feishu kept the default msg_type="text" and posted the raw server path, while DingTalk logged "Unsupported reply type: VIDEO" and sent nothing at all. Both channels already own the video send path -- _upload_video_url() with msg_type="media" in the Feishu FILE branch, upload_media(media_type="video") plus the sampleVideo key in the DingTalk one -- so route VIDEO into it. The video decision no longer depends on the file suffix, because the producer only guarantees the path exists.
Owner
|
Merged, thanks! With this, Feishu and DingTalk join Discord, Slack and Telegram in uploading local video replies, and the plain-file tests keep the existing path pinned. |
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.
Problem
ChatChanneldelivers an agent-produced local video to every channel asReply(ReplyType.VIDEO, "file://" + path)(channel/chat_channel.py:414-419). Feishuand DingTalk never dispatch that reply type, and the two symptoms differ:
msg_type = "text",content_key = "text",channel/feishu/feishu_channel.py:899-902), so the messagebody the user receives is the literal server path:
{"msg_type": "text", "content": "{\"text\": \"file:///tmp/clip.mp4\"}"}.logger.warning("[DingTalk] Unsupported reply type: VIDEO, not sent")(channel/dingtalk/dingtalk_channel.py:1079).send()is its only outboundpath, so the user receives nothing at all.
Fixes #3298
Change
Both channels already contain a working video send path — it is just not wired to the
reply type that says "this is a video":
_upload_video_url()(:1948) takes afile://path and returns thefile_key+durationpair, and theFILEbranch already uses it withmsg_type = "media"for.mp4(:941-948).upload_media(..., media_type="video")+_send_file_message(..., "sampleVideo", ...)are already the video half of itsFILEbranch (:942-957).So each channel needs its
FILEbranch to also acceptVIDEO, and the video decisionmust stop relying on the file name alone — the producer only guarantees the path
exists (
os.path.exists(url)), so a generated clip can well be/tmp/agent-output/4f2c…with no suffix, which today would be sent as a plain file:FILEreplies keep their existing extension sniffing, and a failed upload stillreturns before anything is posted, so the path can no longer leak as text either.
The tests go into
tests/test_local_video_reply.py, which is already the cross-channelcoverage file for this reply type (slack, telegram), plus one
FILEregression case perchannel to pin the existing sniffing.
Verification
Red, on
208db92fwithout the production change:The captured output is the reported defect itself: Feishu's POST body is
{"msg_type": "text", "content": "{\"text\": \"file:///srv/cow/tmp/clip\"}"}, and theDingTalk log line is
[DingTalk] Unsupported reply type: VIDEO, not sent. The twoFILEcases already passed before the change, which is why they show up in the 4.Green:
pytest tests/test_local_video_reply.py -q→6 passedpytest tests/test_feishu_file_upload_url.py tests/test_feishu_file_audio_download_bounds.py tests/test_dingtalk_file_receive.py tests/test_discord_video_reply.py -q→27 passedruff check channel/feishu/feishu_channel.py channel/dingtalk/dingtalk_channel.py tests/test_local_video_reply.py --select F --ignore F403,F405→All checks passedpytest tests/ -q: theFAILEDset is byte-for-byte identical to the oneon the
208db92fbaseline (32 pre-existing failures, unrelated modules), so noregression is introduced here.
Scope
Confined to the two channels named above. It touches no file that #3297 (wechat_kf) or
the other open PRs change. #3297 notes that Feishu and DingTalk "have no video upload
path at all" and leaves them out; the line references above are the plumbing that is
already there — only the dispatch was missing — so this closes out the remaining two
channels of the same class.