fix(feishu): preserve image/attachment context when replying to non-text messages - #26063
Closed
luyao618 wants to merge 1 commit into
Closed
fix(feishu): preserve image/attachment context when replying to non-text messages#26063luyao618 wants to merge 1 commit into
luyao618 wants to merge 1 commit into
Conversation
Collaborator
This was referenced May 15, 2026
…ext messages _extract_text_from_raw_content() returned None for image messages because normalize_feishu_message() sets text_content='' for images (when alt_text equals FALLBACK_IMAGE_TEXT). This caused reply-to-image messages to lose all parent context. Now returns a placeholder like '[Image: img_v3_xxx]' for image messages and '[Attachment: filename]' for file/audio/media messages, so the agent knows what the user is replying to and can use vision_analyze if needed. Fixes NousResearch#26037
luyao618
force-pushed
the
fix/feishu-reply-to-image-context
branch
from
May 18, 2026 05:00
a24b990 to
dc0c702
Compare
13 tasks
Contributor
Author
|
Closing — open too long, no longer relevant. |
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
Fixes #26037 — When a user replies to an image (or file/audio) message in Feishu,
_fetch_message_text()returnsNonebecause_extract_text_from_raw_content()only checkstext_contentandplaceholder_text, both of which are empty for image messages.Root Cause
normalize_feishu_message()correctly parses image messages and populatesimage_keys, but setstext_content=''when the alt text equalsFALLBACK_IMAGE_TEXT. The downstream_extract_text_from_raw_content()method never checksimage_keys, so the parent context is silently lost.Fix
In
_extract_text_from_raw_content(), after thetext_contentcheck, add fallback handlers:[Image: img_key_xxx]usingnormalized.image_keys[Attachment: filename]usingnormalized.media_refsThis gives the agent enough context to know what the user is replying to and potentially use
vision_analyzefor image content.Testing
407 Feishu tests passed, 0 failures.
Scope
1 file changed (
gateway/platforms/feishu.py), 10 lines added.