Skip to content

fix(teams): cache document attachments and classify as DOCUMENT#44778

Merged
teknium1 merged 1 commit into
mainfrom
fix/teams-document-attachments
Jun 12, 2026
Merged

fix(teams): cache document attachments and classify as DOCUMENT#44778
teknium1 merged 1 commit into
mainfrom
fix/teams-document-attachments

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

Teams document attachments now reach the agent: the adapter previously cached only image/* attachments, so documents never entered media_urls and run.py's document-context injection (gated on MessageType.DOCUMENT) had nothing to surface. Completes the class-wide sweep from PR #44695 (Signal/Email/SimpleX).

Changes

  • plugins/platforms/teams/adapter.py: handle application/vnd.microsoft.teams.file.download.info attachments (fetch the pre-authed SharePoint downloadUrl, SSRF-guarded via the same is_safe_url + _ssrf_redirect_guard chain as base.py's cache_*_from_url) and direct-URL non-image attachments, routing both through cache_media_bytes; skip Teams' text/html body-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

Scenario Before After
PDF via file.download.info not cached, TEXT cached, DOCUMENT
Image + PDF PHOTO, PDF dropped DOCUMENT, both cached
Image only PHOTO PHOTO (unchanged)

scripts/run_tests.sh tests/gateway/test_teams.py — 51/51 pass.

Infographic

teams-document-attachments

…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
@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 Jun 12, 2026
@teknium1 teknium1 merged commit 0fd34e8 into main Jun 12, 2026
28 checks passed
@teknium1 teknium1 deleted the fix/teams-document-attachments branch June 12, 2026 09:05
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).
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