Skip to content

fix(slack): upload send_message media attachments - #51199

Closed
greptile wants to merge 1 commit into
NousResearch:mainfrom
greptile:fix/slack-send-message-media
Closed

greptile wants to merge 1 commit into
NousResearch:mainfrom
greptile:fix/slack-send-message-media

Conversation

@greptile

Copy link
Copy Markdown

Summary

  • routes Slack send_message/cron MEDIA:<path> attachments through the Slack plugin standalone sender instead of dropping them as unsupported media
  • adds native Slack files_upload_v2 handling for standalone Slack sends, including thread preservation, captions/initial comments, and 10-file upload chunking
  • adds regression coverage for both the generic send-message router and Slack standalone upload path

Closes #51198

Test Plan

  • uv run pytest tests/tools/test_send_message_tool.py::TestSendToPlatformChunking::test_slack_media_attaches_to_last_chunk tests/gateway/test_slack.py::TestSendDocument::test_standalone_send_uploads_media_files -q
  • uv run pytest tests/tools/test_send_message_tool.py tests/gateway/test_slack.py -q
  • uv run ruff check tools/send_message_tool.py plugins/platforms/slack/adapter.py tests/tools/test_send_message_tool.py tests/gateway/test_slack.py
  • uv run ruff check . --extend-exclude build

@alt-glitch alt-glitch added type/bug Something isn't working comp/plugins Plugin system and bundled plugins platform/slack Slack app adapter P2 Medium — degraded but workaround exists sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages labels Jun 23, 2026
@alt-glitch

Copy link
Copy Markdown
Contributor

This was generated by AI during triage.

Related: #17261 (root issue), #51198 (this PR's issue), #21800 and #23913 (earlier competing fixes). Note for reviewers: this PR targets the current Slack adapter location (plugins/platforms/slack/adapter.py), whereas #21800 edits gateway/platforms/slack.py, which no longer exists on main — so #21800 is stale against current architecture. Competing-fix cluster; a maintainer should pick the canonical one.

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary

Verdict: Approved

Overview

Fixes Slack platform adapter and send_message tool to properly upload media attachments (images, files) via the Slack files.upload API instead of failing or sending text-only messages.

Analysis

  • 4 files changed: adapter, send_message_tool, and 2 test files
  • Fixes a real gap where Slack file attachments were not being sent
  • No credentials, secrets, or security concerns in the diff
  • Tests cover the adapter changes

Looks Good

  • Clean fix targeting a specific platform integration gap
  • Good test coverage

Reviewed by Hermes Agent

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary

Verdict: Approved

Enables media attachment uploads in the Slack send_message tool by using the Slack Web API files.getUploadURL and files.completeUpload endpoints instead of chat.postMessage with file tokens.

Changes

  • tools/send_message_tool.py: +26/-15 to handle Slack media uploads
  • plugins/platforms/slack/adapter.py: +60/-0 for new helper
  • tests/gateway/test_slack.py, tests/tools/test_send_message_tool.py: +104 lines test coverage

Quality

  • 4 files, focused change
  • Good test coverage
  • No security concerns

Reviewed by Hermes Agent

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for targeting the current Slack plugin adapter; the underlying defect remains on current main. tools/send_message_tool.py:1034-1062 still treats Slack as non-media: media-only sends are rejected, and text-plus-media sends call Slack's standalone sender without media_files.

Problems

  • The change needs to update the newer expectations in tests/tools/test_signal_media.py:124-147 and :153-191. Those tests currently require media-only Slack sends to fail and text-plus-media sends to carry an omission warning; both contradict the proposed native-upload contract.

Suggested changes

  • During salvage, replace those expectations with assertions that Slack receives media_files and returns native-delivery success.
  • Keep the final-text-chunk attachment rule in the current dispatcher; it matches the existing Discord, Matrix, Signal, Feishu, and WhatsApp patterns in tools/send_message_tool.py:861-1032.

The adapter approach fits the existing Slack files_upload_v2 batching implementation at plugins/platforms/slack/adapter.py:1717-1819. This is an automated hermes-sweeper review.

# --- Slack: native media attachment support via the registry's
# standalone_sender_fn (plugins/platforms/slack/adapter.py::_standalone_send).
if platform == Platform.SLACK:
from gateway.platform_registry import platform_registry

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes media-only Slack delivery from an error to an upload, but the PR does not update tests/tools/test_signal_media.py:124-147, which currently asserts the old error contract. Update that test and its Slack omission-warning companion at lines 153-191 when salvaging this branch.

@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 15, 2026
@teknium1

Copy link
Copy Markdown
Collaborator

Closing as superseded by #69482 (merged): same target as the landed #67219 but hard-fails on any missing file and rejects empty text+media; #67219's per-file warning + caption fallback is more robust.

Thanks for the work — it's credited in #69482's summary.

@teknium1 teknium1 closed this Jul 23, 2026
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 P2 Medium — degraded but workaround exists platform/slack Slack app adapter sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Slack send_message omits MEDIA attachments

4 participants