fix(matrix): download non-image MXC files and recover text MIME type - #3495
Closed
dlkakbs wants to merge 1 commit into
Closed
fix(matrix): download non-image MXC files and recover text MIME type #3495dlkakbs wants to merge 1 commit into
dlkakbs wants to merge 1 commit into
Conversation
…allback - Add "matrix" entry to PLATFORMS dict (hermes_cli/tools_config.py) — missing key caused KeyError at runtime whenever the Matrix platform was referenced - Extend MXC download logic to cover all file types, not just images; non-image files are now cached via cache_document_from_bytes so the agent can read them (gateway/platforms/matrix.py) - Add extension/mimetypes fallback when media_type is empty or application/octet-stream so text files (.txt, .md, .csv …) are correctly injected into agent context instead of silently falling through to the generic "document saved at" branch (gateway/run.py) Fixes NousResearch#3487
dlkakbs
force-pushed
the
fix/matrix-gateway-runtime-issues
branch
from
March 28, 2026 06:45
050661d to
b56d27a
Compare
teknium1
pushed a commit
that referenced
this pull request
Apr 5, 2026
Cherry-picked run.py portion from PR #3495 by dlkakbs. When Matrix sends non-image files (text, YAML, JSON, etc.), the MIME type may be empty or application/octet-stream. Falls back to extension-based detection so text files are properly injected into agent context.
Contributor
teknium1
pushed a commit
that referenced
this pull request
Apr 5, 2026
Cherry-picked run.py portion from PR #3495 by dlkakbs. When Matrix sends non-image files (text, YAML, JSON, etc.), the MIME type may be empty or application/octet-stream. Falls back to extension-based detection so text files are properly injected into agent context.
Tommyeds
pushed a commit
to Tommyeds/hermes-agent
that referenced
this pull request
Apr 12, 2026
Cherry-picked run.py portion from PR NousResearch#3495 by dlkakbs. When Matrix sends non-image files (text, YAML, JSON, etc.), the MIME type may be empty or application/octet-stream. Falls back to extension-based detection so text files are properly injected into agent context.
angelburgosrosado
pushed a commit
to angelburgosrosado/hermes-agent
that referenced
this pull request
Apr 27, 2026
Cherry-picked run.py portion from PR NousResearch#3495 by dlkakbs. When Matrix sends non-image files (text, YAML, JSON, etc.), the MIME type may be empty or application/octet-stream. Falls back to extension-based detection so text files are properly injected into agent context.
02356abc
pushed a commit
to 02356abc/hermes-agent
that referenced
this pull request
May 14, 2026
Cherry-picked run.py portion from PR NousResearch#3495 by dlkakbs. When Matrix sends non-image files (text, YAML, JSON, etc.), the MIME type may be empty or application/octet-stream. Falls back to extension-based detection so text files are properly injected into agent context.
gweeteve
pushed a commit
to gweeteve/hermes-agent
that referenced
this pull request
Jun 2, 2026
Cherry-picked run.py portion from PR NousResearch#3495 by dlkakbs. When Matrix sends non-image files (text, YAML, JSON, etc.), the MIME type may be empty or application/octet-stream. Falls back to extension-based detection so text files are properly injected into agent context.
waefrebeorn
pushed a commit
to waefrebeorn/slermes
that referenced
this pull request
Jul 2, 2026
Cherry-picked run.py portion from PR NousResearch#3495 by dlkakbs. When Matrix sends non-image files (text, YAML, JSON, etc.), the MIME type may be empty or application/octet-stream. Falls back to extension-based detection so text files are properly injected into agent context.
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 two runtime bugs in the Matrix gateway that occur after a successful setup.
authenticated MXC HTTP URL that the agent cannot access. All file types are now downloaded via self._client.download() and cached locally.
uploads), the file fell through to the generic "document saved at" branch and its content was never injected. A fallback now uses file extension and mimetypes.guess_type to recover the correct type.
NOT: The third (missing "matrix" entry in PLATFORMS) was already resolved upstream.
Related Issue
Fixes #3487
Type of Change
Changes Made
Checklist