Skip to content

feat(kiseno-slack-bot): pass Slack files to the agent - #256

Merged
felixboelter merged 2 commits into
aihpi-providerfrom
claude/slack-files
Nov 18, 2026
Merged

felixboelter merged 2 commits into
aihpi-providerfrom
claude/slack-files

Conversation

@felixboelter

Copy link
Copy Markdown
Member

Files attached in Slack never reached the agent: the bot sent only the message text. A question about an uploaded chart got an answer made up from the text alone, because the model did not even know a file existed. With this change the bot downloads attached files, images reach the model as images, and text files become part of the prompt.

What the agent gets

Kind Types How Limits
Images PNG, JPEG, GIF, WebP; other image types (HEIC) and larger images as Slack's thumbnail (up to 1024 px) A2A FilePart with inline bytes; the runner adds them to the user turn as image_url parts 4 newest, 5 MB each, 10 MB together
Text files text/* (plain text, CSV, Markdown, code), JSON, YAML, XML Text before the conversation, between [File name, attached by person] and [End of name] 30,000 characters each, 60,000 together; longer files are cut and marked
Everything else PDF, Office files, archives Only a note

Every file gets a note on its message's line, for example [image chart.png: attached after the conversation] or [file slides.pdf: PDF files cannot be read here], so the model can say it cannot open a file instead of guessing. Files from earlier messages in the thread (or the last 20 DM messages) count too, so follow-up questions about an image work; newer files win when a limit is reached.

qwen3-8-27b can see: it runs Qwen/Qwen3.8-27B-FP8, whose config has a vision encoder, and the vLLM deployment does not turn it off. This PR does not prove that end to end; the first image in Slack does.

Safety

  • The bot sends its token only to https://*.slack.com URLs; other URLs are refused before any request. httpx drops the header on redirects to another host.
  • Without files:read, Slack answers file URLs with its HTML sign-in page and status 200. The bot recognizes that, logs a warning that names the scope, and the file gets the note "could not be downloaded".
  • Deleted files and files shared from another organization are not downloaded.
  • Downloads stop at the size limit instead of reading the whole file.

Runner

input_images() takes PNG, JPEG, GIF and WebP file parts with bytes from the A2A message (at most 4) and run_agent puts them after the text, each after a text part Image <name>:. The agent card lists those types as input modes. A test sends exactly the v0.3 JSON the bot sends to the runner's compat endpoint, and another one goes through the a2a-sdk client LiteLLM uses. LiteLLM itself converts v0.3 file parts with the same SDK (to_core_part: bytes become raw with media_type and filename).

The first commit replaces the CRM tool names in the runner's README, docstrings and tests from #253 with neutral ones (crm-find_events).

Rollout

  1. In the Slack app settings, add the bot scope files:read under OAuth & Permissions and reinstall the app. Until then files get the note "could not be downloaded", nothing breaks.
  2. Pin the new runner and bot images in litellm-k8s together, or the runner first. A new bot with an old runner would tell the model an image is attached that the old runner drops.

Testing

python -m pytest -q passes on Python 3.11 and 3.12: kiseno-slack-bot 122 passed, kiseno-agent-runner 51 passed. New tests cover reading images and text files, the image limit, thumbnails for large and HEIC images, the sign-in page, deleted and external files, cut text, text decoding (UTF-8, Windows-1252, a character cut at the end), where the fetcher sends the token, the full DM with a CSV and an image, a mention whose files are only on the fetched message, and the runner's image handling.

Files attached in Slack never reached the agent: the bot sent only the
message text, so a question about an uploaded chart got an answer made
up from the text alone. The bot now downloads attached files (scope
files:read). Images go to the agent as A2A file parts and the runner
hands them to the model as image_url parts; text files such as CSV
become part of the prompt. Every file also gets a note on its
message's line, so the model knows about files it cannot read.
@coderabbitai

coderabbitai Bot commented Nov 18, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4d485ec4-edce-4e38-999c-bc28403184fc
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@felixboelter
felixboelter merged commit b906922 into aihpi-provider Nov 18, 2026
7 checks passed
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