fix(signal): classify inbound document attachments#20347
Open
bricolage wants to merge 3 commits into
Open
Conversation
This was referenced May 5, 2026
|
I’m hit by the exact issue this PR fixes. Can we get it across the finish line, @alt-glitch? |
Author
|
I just updated it again to be even more robust for other attachments, and to align more closely with existing patterns. |
1 task
|
@alt-glitch, would love to get this pushed through. Big lift for privacy-focused users, thanks! |
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.
What does this PR do?
Fixes Signal inbound attachment handling so PDFs and other non-image/non-audio/non-video files arrive as
MessageType.DOCUMENTinstead ofMessageType.TEXT. That restores the document branch ingateway/run.py, so Hermes can surface the saved file path to the agent instead of silently dropping the attachment context.This also preserves inbound document filenames and extensions when caching Signal attachments. If Signal does not provide a filename, the adapter falls back to Hermes' shared
SUPPORTED_DOCUMENT_TYPESmapping before using generic MIME guessing.video/*attachments still remainMessageType.VIDEO.This supersedes #12851 by centralizing the classification logic, adding regression coverage for mixed media and OOXML attachments, and preserving
video/*asMessageType.VIDEOinstead of leaving it as plain text.Related Issue
Fixes #12845
Type of Change
Changes Made
_detect_inbound_message_type()ingateway/platforms/signal.pyto classify inbound Signal attachments from MIME type.MessageType.DOCUMENTso document context injection runs.video/*attachments toMessageType.VIDEOso broader document handling does not regress video behavior._fetch_attachment()so Signal document caching can preserve the user-visible filename when available.SUPPORTED_DOCUMENT_TYPESmapping when Signal omits the filename.image,video,application/pdf, mixed media).MessageType.DOCUMENTare preserved.How to Test
python -m pytest tests/gateway/test_signal.py -qin a normal repo dev environment.MessageType.DOCUMENTinstead ofMessageType.TEXT..docxsuffix instead of degrading to.zip.gateway/run.pyand injects the saved file path into agent context.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AScreenshots / Logs