fix(teams): cache document attachments and classify as DOCUMENT#44778
Merged
Conversation
…CUMENT The Teams adapter only handled image/* attachments — documents (the application/vnd.microsoft.teams.file.download.info consent-free download payload and any direct-URL non-image attachment) never reached media_urls at all, so run.py's document-context injection had nothing to surface. Completes the class-wide sweep from PR #44695 (Signal/Email/SimpleX). - download.info attachments: fetch the pre-authed SharePoint downloadUrl (SSRF-guarded, same guard chain as base.py cache_*_from_url) and route through cache_media_bytes - direct-URL non-image attachments: same fetch + classify path - skip Teams' text/html message-body mirror and adaptive-card attachments - DOCUMENT > PHOTO > VIDEO > AUDIO precedence for mixed attachments, matching the Email precedence rationale from #44695
AIalliAI
added a commit
to AIalliAI/Hermes
that referenced
this pull request
Jun 12, 2026
Brings in NousResearch#44776 (/credits command), NousResearch#44778 (Teams DOCUMENT attachments), NousResearch#43508 (Yuanbao wechat forward msg), NousResearch#44792 (profile-scope Channels endpoints + per-profile .env seeding).
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.
Summary
Teams document attachments now reach the agent: the adapter previously cached only
image/*attachments, so documents never enteredmedia_urlsand run.py's document-context injection (gated onMessageType.DOCUMENT) had nothing to surface. Completes the class-wide sweep from PR #44695 (Signal/Email/SimpleX).Changes
plugins/platforms/teams/adapter.py: handleapplication/vnd.microsoft.teams.file.download.infoattachments (fetch the pre-authed SharePointdownloadUrl, SSRF-guarded via the sameis_safe_url+_ssrf_redirect_guardchain as base.py'scache_*_from_url) and direct-URL non-image attachments, routing both throughcache_media_bytes; skip Teams'text/htmlbody-mirror and adaptive-card attachments; DOCUMENT > PHOTO > VIDEO > AUDIO precedence for mixed attachments (same rationale as the Email fix in fix(gateway): classify document attachments as DOCUMENT on Signal, Email, and SimpleX #44695)tests/gateway/test_teams.py: 5 classification tests (document, mixed image+document precedence, html body-mirror stays TEXT, image-only stays PHOTO, download failure degrades to TEXT)Validation
scripts/run_tests.sh tests/gateway/test_teams.py— 51/51 pass.Infographic