← Back to PRs

#20479: fix(slack): keep replies flowing for oversized file uploads

by olyashok open 2026-02-19 00:36 View on GitHub →
channel: slack size: L
## Summary - **Problem:** Large file uploads could stall the Slack message pipeline — `resolveSlackMedia` would hang during the prepare phase, so dispatch never happened and the bot went silent. - **Why it matters:** Users uploading large files to a Slack channel with OpenClaw would get no response at all, with no error or indication of failure. - **What changed:** Added `file_shared` event handling, `app_mention` hydration from Slack history, adjusted dedup flow for fallback processing, and added diagnostics module for Slack monitor stages. - **What did NOT change:** No changes to media resolution itself, no changes to non-Slack channels, no config schema changes. ## Change Type (select all) - [x] Bug fix ## Scope (select all touched areas) - [x] Integrations ## User-visible / Behavior Changes Slack channels now continue responding when users upload large files. Previously, conversations could stall indefinitely after a large file upload. ## Security Impact (required) - New permissions/capabilities? `No` - Secrets/tokens handling changed? `No` - New/changed network calls? `No` (uses existing Slack API calls for history hydration) - Command/tool execution surface changed? `No` - Data access scope changed? `No` ## Repro + Verification ### Environment - OS: Linux (Docker gateway) - Runtime/container: Node 22 - Integration/channel: Slack ### Steps 1. Connect OpenClaw to a Slack workspace 2. Upload a large file (>10MB) in a channel where the bot is active 3. Include a message/mention with the file ### Expected - Bot processes the message and responds normally ### Actual (before fix) - Bot goes silent, no response, no error in user-facing channel ## Evidence - [x] Trace/log snippets — diagnostics module (`diag.ts`) confirms pipeline stages complete after fix - [x] Tested with large file uploads in production Slack workspace ## Human Verification (required) - Verified scenarios: Large file upload with mention, file_shared fallback path, app_mention with file metadata - Edge cases checked: Multiple files in one message, file upload without mention text - What I did **not** verify: Files at exact Slack size limits ## Compatibility / Migration - Backward compatible? `Yes` - Config/env changes? `No` - Migration needed? `No` ## Failure Recovery (if this breaks) - Revert this commit; the previous behavior (stalling) returns but nothing else breaks - Known bad symptoms: duplicate message processing if dedup logic regresses ## Risks and Mitigations - Risk: Dedup adjustment could cause duplicate responses in edge cases - Mitigation: `file_shared` fallback only fires when the initial event didn't complete processing 🤖 AI-assisted (Claude Opus 4.6). Fully tested on local Slack integration with large file uploads. <!-- greptile_comment --> <h3>Greptile Summary</h3> Adds `file_shared` event handling to fix stalled Slack conversations when users upload large files. The implementation fetches message history from Slack when large file uploads bypass the normal `message` event, adds deduplication logic to prevent duplicate processing, and hydrates `app_mention` events with file metadata from history. **Critical issues found:** - Type mismatches in `prepare.ts:58` and `thread-resolution.ts:78` - both functions reject the new `"file_shared"` source type that the PR introduces, which will cause TypeScript compilation errors - Behavior change in `stripSlackMentionsForCommandDetection` that could affect command detection when mentions appear adjacent to text **Code quality notes:** - Duplicated diagnostic logging implementation in `file-shared.ts` instead of reusing the imported `writeSlackDiag` function from `diag.ts` <h3>Confidence Score: 2/5</h3> - This PR has critical type safety issues that will prevent TypeScript compilation, making it unsafe to merge without fixes - Two critical TypeScript type mismatches will cause compilation errors - `prepareSlackMessage` and `threadTsResolver.resolve` both reject the new `"file_shared"` source value introduced by this PR. Additionally, the refactored `stripSlackMentionsForCommandDetection` changes behavior in a way that could affect command detection edge cases. - Pay close attention to `src/slack/monitor/message-handler/prepare.ts` and `src/slack/monitor/thread-resolution.ts` - both require type signature updates to accept `"file_shared"` as a valid source value <sub>Last reviewed commit: 20bce81</sub> <!-- greptile_other_comments_section --> <sub>(5/5) You can turn off certain types of comments like style [here](https://app.greptile.com/review/github)!</sub> <!-- /greptile_comment -->

Most Similar PRs