fix(gateway/line): correct message_type mapping and source factory method - #23867
Closed
irandoku wants to merge 0 commit into
Closed
fix(gateway/line): correct message_type mapping and source factory method#23867irandoku wants to merge 0 commit into
irandoku wants to merge 0 commit into
Conversation
Collaborator
wuwushi4
pushed a commit
to wuwushi4/hermes-agent
that referenced
this pull request
May 20, 2026
Two AttributeError crashes prevented inbound LINE messages from reaching the agent: - `self.create_source` does not exist on `BasePlatformAdapter`; the factory is `self.build_source` (used by IRC, Teams, etc.). - `MessageType.IMAGE` is not a member of the enum — `PHOTO` is. The ternary fallback also mis-classified audio, video, file, sticker, and location messages as images. Mirrors PR NousResearch#23867. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
19 tasks
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 two
AttributeErrorcrashes in the LINE adapter that prevent inbound messages from ever reaching the agent.Bug 1: Missing
build_sourcemethod (fixes #23728)self.create_source()is not a method onBasePlatformAdapter. The correct factory method isself.build_source(), used by all other platform adapters (IRC, Teams, etc.).Before this fix, every inbound LINE message crashed with:
Bug 2: Non-existent
MessageType.IMAGEmembergateway/platforms/base.pydefinesMessageTypewithPHOTO(notIMAGE) as the member for image/photo messages. The fallback expression:throws
AttributeError: IMAGEon every non-text inbound message. It also incorrectly classifies audio, video, file, sticker, and location messages as images.Fix: Replace with an explicit mapping using the correct enum members:
image→MessageType.PHOTOaudio→MessageType.AUDIOvideo→MessageType.VIDEOfile→MessageType.DOCUMENTsticker→MessageType.STICKERlocation→MessageType.LOCATIONTesting
python -m py_compile plugins/platforms/line/adapter.pypasses.Related