Skip to content

fix(line): use build_source not create_source so inbound messages dispatch - #23569

Closed
wuwushi4 wants to merge 1 commit into
NousResearch:mainfrom
wuwushi4:fix/line-build-source-typo
Closed

fix(line): use build_source not create_source so inbound messages dispatch#23569
wuwushi4 wants to merge 1 commit into
NousResearch:mainfrom
wuwushi4:fix/line-build-source-typo

Conversation

@wuwushi4

Copy link
Copy Markdown

Summary

The LINE Messaging API plugin added in #23197 has a typo that causes 100% of inbound text messages to crash before they reach the agent. _handle_message_event calls self.create_source(...) at plugins/platforms/line/adapter.py:962, but the base adapter's helper is named build_source — every other platform adapter (mattermost, matrix, whatsapp, msgraph_webhook, wecom, feishu, bluebubbles, qqbot) calls self.build_source(...).

Reproduces every time you send any text to a LINE bot configured via this plugin. The webhook is received, signature verified, event dispatched — then dies in _handle_message_event with:

ERROR hermes_plugins.line_platform.adapter: LINE: dispatch_event failed
  File ".../plugins/platforms/line/adapter.py", line 877, in _handle_webhook
  File ".../plugins/platforms/line/adapter.py", line 910, in _dispatch_event
  File ".../plugins/platforms/line/adapter.py", line 962, in _handle_message_event
AttributeError: 'LineAdapter' object has no attribute 'create_source'

The kwargs at the call site (chat_id, chat_type, user_id, user_name, chat_name) already match build_source's signature exactly — pure rename, zero behavior change. Verified locally: after the one-character fix, inbound messages dispatch normally, agent responds via the free reply token, and the postback fallback path also works.

Why the test suite didn't catch this

tests/gateway/test_line_plugin.py (644 lines) covers signature verification, parsing, the postback state machine, etc., but doesn't appear to exercise the full webhook → _handle_message_eventbuild_sourceMessageEvent path against a real LineAdapter instance — so the missing-attribute crash hides behind the unit-test boundary. Worth a follow-up to add an end-to-end smoke test that constructs a real adapter and feeds it a parsed message event.

Test plan

  • Inbound text DM dispatches to agent and gets a reply (verified locally on a real LINE OA + ngrok tunnel)
  • Reply token path is used (free; no Push API call)
  • Group / room dispatch (untested locally — same code path, same fix applies)

🤖 Generated with Claude Code

…patch

Inbound LINE webhook events crash on every message with
``AttributeError: 'LineAdapter' object has no attribute 'create_source'``.
The plugin calls ``self.create_source(...)`` at adapter.py:962 but the
base adapter exposes ``build_source(...)`` — the same method every other
platform uses (mattermost, matrix, whatsapp, msgraph_webhook, wecom,
feishu, bluebubbles, qqbot all call ``self.build_source``). Pure typo;
the kwargs already match ``build_source``'s signature exactly.

Repro: any text message sent to a LINE bot configured via this plugin
triggers the AttributeError in ``_handle_message_event``, so 100% of
inbound traffic dies silently before the agent ever sees it. The
existing test suite under tests/gateway/test_line_plugin.py covers
parsing/signing/etc. but does not appear to exercise the full
webhook→dispatch→Source-construction path, which is why this slipped
through PR NousResearch#23197.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@alt-glitch alt-glitch added type/bug Something isn't working P1 High — major feature broken, no workaround comp/plugins Plugin system and bundled plugins labels May 11, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #23305 — same one-line fix (create_source → build_source) in LINE adapter. Both address the AttributeError crash on inbound messages.

@wuwushi4

Copy link
Copy Markdown
Author

Thanks for the pointer to #23305 — happy to defer, that PR's session-source fix is more comprehensive than the bare typo correction here. Closing in favor of #23305.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/plugins Plugin system and bundled plugins duplicate This issue or pull request already exists P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants