feat(slack): outbound file sharing — extract code blocks and upload to Slack (#282) - #283
Merged
Merged
Conversation
…o Slack (#282) When an agent responds with fenced code blocks (CSV, JSON, HTML, etc.) in a Slack conversation, the message router now extracts qualifying blocks, uploads them as native Slack file attachments via the V2 Upload API, and sends a clean text message with file references. Architecture: - Channel-agnostic extraction in message_router._extract_outbound_files() - OutboundFile model + files field on ChannelResponse (base.py) - Slack V2 Upload: getUploadURLExternal → POST → completeUploadExternal - files:write OAuth scope added (requires Slack app reinstall) Security: No change to agent tool restrictions. Extraction operates on the agent's text response only — no file system access, no Write/Bash. Limits: 100 char min block size, 5 files max, 500KB per block, 2MB total. Tests: 27 unit tests covering extraction, language mapping, limits, and edge cases (unicode, nested blocks, unclosed fences, size limits). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
vybe
approved these changes
Apr 8, 2026
vybe
left a comment
Contributor
There was a problem hiding this comment.
LGTM — clean channel-agnostic design, solid V2 Upload API implementation, good test coverage (27 tests). Ship it.
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
message_router.py, Slack-specific upload inslack_adapter.py/slack_service.pyfiles:writeOAuth scope added — requires Slack app reinstall to workspaceHow it works
Security
No change to agent tool restrictions (
WebSearch,WebFetchonly for Slack users). Extraction operates on the agent's text response — no file system access, no Write/Bash tools granted.Limits
Deployment note
After deploying, reinstall the Slack app to the workspace to pick up the
files:writescope (same process asfiles:readfor #222).Test plan
tests/unit/test_slack_outbound_files.py)Closes #282
🤖 Generated with Claude Code