Skip to content

fix(gateway): map LINE media message types - #35681

Closed
aaronlin wants to merge 1 commit into
NousResearch:mainfrom
aaronlin:fix/line-media-message-type
Closed

fix(gateway): map LINE media message types#35681
aaronlin wants to merge 1 commit into
NousResearch:mainfrom
aaronlin:fix/line-media-message-type

Conversation

@aaronlin

@aaronlin aaronlin commented May 31, 2026

Copy link
Copy Markdown

What does this PR do?

Fixes LINE inbound media dispatch by mapping LINE webhook message types to Hermes gateway MessageType enum values before constructing MessageEvent.

The LINE adapter previously used MessageType.IMAGE for every non-text message, but the gateway enum defines images as MessageType.PHOTO. This could raise before image/media messages reached the gateway processing path. This PR keeps the change narrow by only adding a LINE-specific mapping helper and a focused regression test.

Related Issue

No issue filed.

Related prior PRs found during duplicate search:

This PR is intentionally narrower and based on current main: it only fixes the LINE webhook message-type enum mapping and adds regression coverage.

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • plugins/platforms/line/adapter.py
    • Added _line_message_type() to map LINE webhook message types to Hermes gateway enum values.
    • Changed inbound LINE MessageEvent.message_type construction to use that mapping.
  • tests/gateway/test_line_adapter.py
    • Added regression coverage for LINE text/image/audio/video/file/sticker/location mappings.

How to Test

  1. Run syntax checks:
    • python3 -m py_compile plugins/platforms/line/adapter.py tests/gateway/test_line_adapter.py
  2. Run diff hygiene:
    • git diff --check
  3. Run the targeted regression test:
    • scripts/run_tests.sh tests/gateway/test_line_adapter.py
  4. Optional broader gateway coverage:
    • scripts/run_tests.sh tests/gateway
  5. In CI or a complete local dev environment, run the full suite:
    • pytest tests/ -q

Note: Full pytest tests/ -q was not completed locally. Broader gateway coverage was attempted and has one unrelated local failure in tests/gateway/test_shutdown_forensics.py::TestSpawnAsyncDiagnostic::test_spawns_subprocess_and_writes_output.

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: macOS local checkout; targeted LINE test passed; gateway suite attempted with one unrelated shutdown-forensics failure

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A: N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A: N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A: N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A: pure Python enum mapping, no platform-specific behavior
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A: N/A

Screenshots / Logs

N/A. Local checks run on this branch:

python3 -m py_compile plugins/platforms/line/adapter.py tests/gateway/test_line_adapter.py: passed
git diff --check: passed
scripts/run_tests.sh tests/gateway/test_line_adapter.py: 1 passed
scripts/run_tests.sh tests/gateway: 6059 passed, 1 unrelated failure

Failure:
tests/gateway/test_shutdown_forensics.py::TestSpawnAsyncDiagnostic::test_spawns_subprocess_and_writes_output
assert pid is not None and pid > 0

@alt-glitch alt-glitch added type/bug Something isn't working comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have labels May 31, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #27142 — both fix LINE adapter referencing non-existent MessageType.IMAGE instead of MessageType.PHOTO. Also duplicates #34233.

@aaronlin aaronlin closed this May 31, 2026
@aaronlin
aaronlin deleted the fix/line-media-message-type branch June 1, 2026 19:59
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 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.

2 participants