Skip to content

fix: respond to file shares and attachment-only messages in code channels - #110

Merged
zimeg merged 2 commits into
mainfrom
fix-file-share-messages
Dec 1, 2026
Merged

zimeg merged 2 commits into
mainfrom
fix-file-share-messages

Conversation

@zimeg

@zimeg zimeg commented Dec 1, 2026

Copy link
Copy Markdown
Member

Summary

This pull request runs a turn for a file shared into a code channel, with or without text, instead of ignoring it unless the agent is mentioned.

  • Slack sends a shared file as a message with the file_share subtype, which the message listener skipped along with edits and joins. Other subtypes and bot posts are still ignored.
  • A message with only a file has empty text, which the listener also skipped. The turn now names the shared files, like (attachment: trace.png), after any text. A mention with a file reads the same way.
  • The agent sees file names, not file contents: the app has no files:read scope.
  • Direct messages with a file are answered now too, since they pass the same check.
  • This applies to every app: claude-agent-sdk, openai-agents-sdk and pydantic-ai.

Many thanks to @thatsamguy for finding this and drafting the fix in thatsamguy#1 🙏

Testing

  • Run slack run and mention the agent with a coding task so it opens a code channel.
  • In the code channel, without mentioning the agent, share a file with a message and confirm the agent starts a turn that knows about the file.
  • Share a file with no message and confirm the agent starts a turn naming it.
  • Edit a message in the code channel and confirm the agent ignores the edit.

🤖 Generated with Claude Code

…nels

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
@zimeg
zimeg requested a review from a team as a code owner December 1, 2026 00:16
@zimeg zimeg added bug M-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented semver:patch Use on pull requests to describe the release version increment labels Dec 1, 2026
@zimeg zimeg self-assigned this Dec 1, 2026

@mwbrooks mwbrooks left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

✅ Thanks @zimeg! Letting file_share through while edits and joins stay ignored is a tidy fix, and the attachment names give the agent something to work with.

@cchensh cchensh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nits (test-only, same in every sample dir):

  1. The main case isn't tested: no test sends a file_share with empty text through the message listener, which is the bug in the title. Something like send('', { subtype: 'file_share', files: [{ id: 'F123', name: 'trace.png' }] }) expecting '<@U123>: (attachment: trace.png)'.
  2. The narrowed subtype check has no negative case. One test each for message_changed and for a file_share with bot_id, both expecting no turn, would pin that only file shares get through.
  3. Optional: a file share whose text mentions the bot should still be skipped by the message listener (app_mention runs it), and a DM with a file should be answered.

Co-authored-by: Cheng Chen <35309699+cchensh@users.noreply.github.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
@zimeg

zimeg commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

🧪 Thanks for the review @cchensh! Added the empty text file_share case and both negative cases (message_changed and a file_share with bot_id) in 39cb8e0. The mention case is already covered by test_message_with_a_mention_is_left_to_app_mention, and a direct message with a file passes the same check, so I left 3 out to keep the tests lean.

@zimeg

zimeg commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

🌟 Thanks for the kind reviews @mwbrooks and @cchensh!

@zimeg
zimeg merged commit 8e7092e into main Dec 1, 2026
8 checks passed
@zimeg
zimeg deleted the fix-file-share-messages branch December 1, 2026 00:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug M-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented semver:patch Use on pull requests to describe the release version increment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants