Skip to content

fix: Slack message truncation and image attachment handling#43

Open
electronicBlacksmith wants to merge 1 commit intoghostwright:mainfrom
electronicBlacksmith:upstream/fix/slack-truncation-and-attachments
Open

fix: Slack message truncation and image attachment handling#43
electronicBlacksmith wants to merge 1 commit intoghostwright:mainfrom
electronicBlacksmith:upstream/fix/slack-truncation-and-attachments

Conversation

@electronicBlacksmith
Copy link
Copy Markdown

What Changed

Message truncation fix:

  • When responses exceed Slack's 3000-char block limit, messages are now split into threaded overflow messages with feedback buttons attached to the final chunk
  • updateWithFeedback() refactored for multi-chunk thread replies
  • postToChannel() accepts optional threadTs for threading

Image attachment processing:

  • New slack-files.ts: downloadSlackFiles(), ensureUploadsDir(), cleanupOldUploads()
  • PNG/JPEG/GIF/WebP files shared in Slack are downloaded, validated (path traversal + SSRF checks), and passed to the agent as file paths via the Read tool
  • Unsupported file types get a friendly skip message
  • Old uploads are cleaned up after 24 hours
  • Added files:read scope to slack-app-manifest.yaml

Integration:

  • Attachment file paths injected into prompt so the agent can read them
  • Skipped file reasons surfaced to user in message

Why

Long agent responses were silently truncated at Slack's block character limit, losing content. Image attachments shared in Slack threads were silently dropped with no feedback to the user.

How I Tested

  • bun test src/channels/__tests__/slack-files.test.ts - 27 pass (download, validation, cleanup, SSRF, path traversal)
  • bun test src/channels/__tests__/slack-formatter.test.ts - 20 pass (split, truncation)
  • bun test src/channels/__tests__/slack.test.ts - 38 pass (threading, attachments, feedback)
  • bun run lint - clean
  • bun run typecheck - clean
  • Full suite: 976 pass

Checklist

  • Tests pass (bun test)
  • Lint passes (bun run lint)
  • Typecheck passes (bun run typecheck)
  • No secrets or .env files included
  • Files stay under 300 lines
  • No Cardinal Rule violations
  • No default exports or barrel files added

When responses exceed Slack's 3000-char block limit, messages were
silently truncated. Now splits into threaded overflow messages with
feedback buttons attached to the final chunk.

Also adds image attachment processing: PNG/JPEG/GIF/WebP files shared
in Slack are downloaded, validated (path traversal + SSRF checks), and
passed to the agent as file paths. Unsupported file types get a
friendly skip message. Old uploads are cleaned up after 24 hours.

- updateWithFeedback() refactored for multi-chunk thread replies
- postToChannel() accepts optional threadTs for threading
- New slack-files.ts: downloadSlackFiles(), ensureUploadsDir(), cleanupOldUploads()
- Added files:read scope to slack-app-manifest.yaml
- Attachment paths injected into prompt for agent Read tool access
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant