Summary
When a Slack thread contains a large file attachment (e.g., a video), the slack_thread_turn workflow fails with:
asyncpg.exceptions.ProgramLimitExceededError: string too long to represent as jsonb string
DETAIL: Due to an implementation restriction, jsonb strings cannot exceed 268435455 bytes.
Root Cause
services/slackbot/src/slack/normalize.ts — fetchSlackFilePart() downloads and base64-encodes Slack files of any size into the message parts. These parts flow into the slack_thread_turn workflow's input_json JSONB column via POST /workflows/runs, which crashes on INSERT for files larger than ~190MB (256MB JSONB limit minus overhead).
The centralized AttachmentProcessor (#383) exists but is not wired into the workflow run creation path — it only processes attachments after the workflow run is already stored.
Impact
- Bot silently fails to respond in any Slack thread with a large media attachment (video, large PDF, etc.)
- The
slack_thread_turn workflow returns 500, slackbot logs Centaur Slack handoff failed: 500
- No error is surfaced to the user in Slack
Suggested Fix
Add a file size check in fetchSlackFilePart() before downloading. For files exceeding a threshold (e.g., 25MB), return a text-only part with file metadata instead of inlining the binary content:
if (knownSize !== undefined && knownSize > MAX_INLINE_FILE_BYTES) {
return {
type: 'text' as const,
text: `[Attached file: ${fileName} (${mimeType}, ${sizeMB} MB) — too large to inline]`
}
}
A more complete fix would route large files through the AttachmentProcessor / attachments table before creating the workflow run, so the agent can still access the file content on demand.
Reproduction
- Upload a large video (>25MB) to a Slack channel where the bot is active
- Mention the bot in the thread containing the video
- Observe 500 error in API logs for
POST /workflows/runs
Environment
- Chart version: 0.1.49
- Commit: 89988b1
Summary
When a Slack thread contains a large file attachment (e.g., a video), the
slack_thread_turnworkflow fails with:Root Cause
services/slackbot/src/slack/normalize.ts—fetchSlackFilePart()downloads and base64-encodes Slack files of any size into the message parts. These parts flow into theslack_thread_turnworkflow'sinput_jsonJSONB column viaPOST /workflows/runs, which crashes on INSERT for files larger than ~190MB (256MB JSONB limit minus overhead).The centralized
AttachmentProcessor(#383) exists but is not wired into the workflow run creation path — it only processes attachments after the workflow run is already stored.Impact
slack_thread_turnworkflow returns 500, slackbot logsCentaur Slack handoff failed: 500Suggested Fix
Add a file size check in
fetchSlackFilePart()before downloading. For files exceeding a threshold (e.g., 25MB), return a text-only part with file metadata instead of inlining the binary content:A more complete fix would route large files through the
AttachmentProcessor/attachmentstable before creating the workflow run, so the agent can still access the file content on demand.Reproduction
POST /workflows/runsEnvironment