hermes - ✅(Solved) Fix [Bug]: Document attachments from Signal not detected [4 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#12845Fetched 2026-04-20 12:16:41
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Author
Participants
Timeline (top)
cross-referenced ×2labeled ×1referenced ×1

Error Message

Send a PDF to your own Signal account (Note to Self). The agent receives the message and fetches the attachment successfully (no error), but responds as if no file was attached because [The user sent a document: '...'] context is never injected.

Additional Logs / Traceback (optional)

Root Cause

Send a PDF to your own Signal account (Note to Self). The agent receives the message and fetches the attachment successfully (no error), but responds as if no file was attached because [The user sent a document: '...'] context is never injected.

Fix Action

Fixed

PR fix notes

PR #12851: fix(gateway): add Signal message type classification for documents

Description (problem / solution / changelog)

What does this PR do?

Add missing Signal adapter DOCUMENT message type for non-image/non-audio attachments.

Related Issue

Fixes https://github.com/NousResearch/hermes-agent/issues/12845

Type of Change

<!-- Check the one that applies. -->
  • 🐛 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

  • Changed src/gateway/platforms/signal.py to include support for application/* and text/* MIME types.

How to Test

  1. Send a PDF via Note-to-Self
  2. Document context injection is triggered
  3. Agent correctly reads and summarizes the file

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: <!-- e.g. Ubuntu 24.04, macOS 15.2, Windows 11 -->

Documentation & Housekeeping

<!-- Check all that apply. It's OK to check "N/A" if a category doesn't apply to your change. -->
  • [N/A] 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
  • [N/A] I've updated tool descriptions/schemas if I changed tool behavior — or N/A

Screenshots / Logs

DEBUG gateway.platforms.signal: Signal: Note to Self attachments: [{'contentType': 'application/pdf', 'filename': '1-s2.0-S0090429520315314-main.pdf', 'id': '6zLO3b-6Yf3zVWeLDctA.pdf', 'size': 508237, ...}]
DEBUG gateway.platforms.signal: Signal: message from +1********** in +1**********: What's this?
INFO  gateway.run: inbound message: platform=signal user=####### chat=+1********** msg="What's this?"
DEBUG gateway.run: run_agent resolved: model=claude-sonnet-4.6 provider=copilot
DEBUG gateway.run: Created new agent for session agent:main:signal:dm:+1**********
DEBUG gateway.platforms.signal: Signal: message from +1********** in +1**********: /approve
INFO  gateway.run: User approved 1 dangerous command(s) via /approve
INFO  gateway.run: response ready: platform=signal chat=+1********** time=27.2s api_calls=3 response=234 chars
INFO  gateway.platforms.base: [Signal] Sending response (234 chars) to +1**********

Changed files

  • gateway/platforms/signal.py (modified, +2/-0)
  • tests/gateway/test_signal.py (modified, +73/-0)

PR #12859: fix(signal): classify document attachments as MessageType.DOCUMENT

Description (problem / solution / changelog)

Fixes #12845

Problem: Signal document attachments (PDF, text/plain, zip, etc.) are fetched successfully but never injected as [The user sent a document: '...'] context for the LLM. The attachment download works, but the message type stays TEXT instead of DOCUMENT, so the context injection in run.py is skipped.

Root cause: _handle_envelope in gateway/platforms/signal.py had branches for image (PHOTO) and audio (VOICE) MIME types, but documents (application/*, text/*) fell through to the default MessageType.TEXT.

Fix: Added an elif branch to detect document MIME types and set MessageType.DOCUMENT.

Tests: 5 new tests covering PDF, text/plain, zip → DOCUMENT, plus regression tests for image → PHOTO and audio → VOICE.

Changed files

  • gateway/platforms/signal.py (modified, +5/-0)
  • tests/gateway/test_signal.py (modified, +99/-0)

Code Example

Collecting debug report...
--- hermes dump ---
version:          0.10.0 (2026.4.16) [(unknown)]
os:               Linux 6.18.18-gentoo-dist aarch64
python:           3.13.11
openai_sdk:       2.24.0
profile:          default
hermes_home:      ~/.hermes
model:            claude-opus-4.6
provider:         copilot
terminal:         local

api_keys:
  openrouter           not set
  openai               not set
  anthropic            not set
  anthropic_token      not set
  nous                 not set
  glm/zai              not set
  zai                  not set
  kimi                 not set
  minimax              not set
  deepseek             not set
  dashscope            not set
  huggingface          not set
  ai_gateway           not set
  opencode_zen         not set
  opencode_go          not set
  kilocode             not set
  firecrawl            not set
  tavily               not set
  browserbase          not set
  fal                  not set
  elevenlabs           not set
  github               not set

features:
  toolsets:           hermes-cli
  mcp_servers:        0
  memory_provider:    built-in
  gateway:            unknown
  platforms:          signal
  cron_jobs:          0
  skills:             0
--- end dump ---


--- agent.log (last 200 lines) ---
(file not found)

--- errors.log (last 100 lines) ---
(file not found)

--- gateway.log (last 100 lines) ---
(file not found)

---



---

--- a/src/gateway/platforms/signal.py
+++ b/src/gateway/platforms/signal.py
@@ -486,6 +486,8 @@ async def _handle_envelope(self, envelope: dict) -> None:
             elif any(mt.startswith("image/") for mt in media_types):
                 msg_type = MessageType.PHOTO
+            elif any(mt.startswith("application/") or mt.startswith("text/") for mt in media_types):
+                msg_type = MessageType.DOCUMENT

         # Parse timestamp from envelope data (milliseconds since epoch)
RAW_BUFFERClick to expand / collapse

Bug Description

Document attachments (e.g. PDF) are not detected/handled correctly.

Steps to Reproduce

Send a PDF to your own Signal account (Note to Self). The agent receives the message and fetches the attachment successfully (no error), but responds as if no file was attached because [The user sent a document: '...'] context is never injected.

Expected Behavior

Document attachments (e.g. PDF) are correctly handled/passed to the LLM.

Actual Behavior

LLM is unable to "see" the document attachment.

Affected Component

Gateway (Telegram/Discord/Slack/WhatsApp)

Messaging Platform (if gateway-related)

No response

Debug Report

Collecting debug report...
--- hermes dump ---
version:          0.10.0 (2026.4.16) [(unknown)]
os:               Linux 6.18.18-gentoo-dist aarch64
python:           3.13.11
openai_sdk:       2.24.0
profile:          default
hermes_home:      ~/.hermes
model:            claude-opus-4.6
provider:         copilot
terminal:         local

api_keys:
  openrouter           not set
  openai               not set
  anthropic            not set
  anthropic_token      not set
  nous                 not set
  glm/zai              not set
  zai                  not set
  kimi                 not set
  minimax              not set
  deepseek             not set
  dashscope            not set
  huggingface          not set
  ai_gateway           not set
  opencode_zen         not set
  opencode_go          not set
  kilocode             not set
  firecrawl            not set
  tavily               not set
  browserbase          not set
  fal                  not set
  elevenlabs           not set
  github               not set

features:
  toolsets:           hermes-cli
  mcp_servers:        0
  memory_provider:    built-in
  gateway:            unknown
  platforms:          signal
  cron_jobs:          0
  skills:             0
--- end dump ---


--- agent.log (last 200 lines) ---
(file not found)

--- errors.log (last 100 lines) ---
(file not found)

--- gateway.log (last 100 lines) ---
(file not found)

Operating System

Gentoo Linux

Python Version

No response

Hermes Version

No response

Additional Logs / Traceback (optional)

Root Cause Analysis (optional)

When a Signal message arrives with a PDF (or other application/* / text/* attachment), the _handle_envelope method in signal.py leaves msg_type = MessageType.TEXT.

The document-injection code in run.py only fires when event.message_type == MessageType.DOCUMENT, so the file path is never injected into the agent context and the agent has no idea any attachment was sent.

Affects: Note to Self PDF/doc attachments, any non-image non-audio Signal attachment.

Proposed Fix (optional)

In src/gateway/platforms/signal.py, inside _handle_envelope, add an elif branch for application/* and text/* MIME types after the existing image/ and audio/ checks:

--- a/src/gateway/platforms/signal.py
+++ b/src/gateway/platforms/signal.py
@@ -486,6 +486,8 @@ async def _handle_envelope(self, envelope: dict) -> None:
             elif any(mt.startswith("image/") for mt in media_types):
                 msg_type = MessageType.PHOTO
+            elif any(mt.startswith("application/") or mt.startswith("text/") for mt in media_types):
+                msg_type = MessageType.DOCUMENT

         # Parse timestamp from envelope data (milliseconds since epoch)

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

extent analysis

TL;DR

The most likely fix is to update the _handle_envelope method in signal.py to correctly handle application/* and text/* MIME types by setting msg_type to MessageType.DOCUMENT.

Guidance

  • Verify that the issue is indeed caused by the _handle_envelope method not handling application/* and text/* MIME types correctly by checking the media_types variable in the signal.py file.
  • Apply the proposed fix by adding an elif branch for application/* and text/* MIME types in the _handle_envelope method.
  • Test the fix by sending a PDF to the Signal account and checking if the agent correctly handles the attachment.
  • If the issue persists, check the agent.log, errors.log, and gateway.log files for any error messages that may indicate the cause of the problem.

Example

The proposed fix can be applied by modifying the signal.py file as shown in the provided diff:

--- a/src/gateway/platforms/signal.py
+++ b/src/gateway/platforms/signal.py
@@ -486,6 +486,8 @@ async def _handle_envelope(self, envelope: dict) -> None:
             elif any(mt.startswith("image/") for mt in media_types):
                 msg_type = MessageType.PHOTO
+            elif any(mt.startswith("application/") or mt.startswith("text/") for mt in media_types):
+                msg_type = MessageType.DOCUMENT

Notes

The proposed fix assumes that the issue is caused by the _handle_envelope method not handling application/* and text/* MIME types correctly. If the issue is caused by something else, additional debugging may be necessary.

Recommendation

Apply the workaround by modifying the signal.py file as proposed, as it is a targeted fix for the identified issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - ✅(Solved) Fix [Bug]: Document attachments from Signal not detected [4 pull requests, 1 participants]