#20479: fix(slack): keep replies flowing for oversized file uploads
channel: slack
size: L
Cluster:
Slack Integration Improvements
## 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
#8684: fix(slack): add title param and channel resolution for file upload
by shuans · 2026-02-04
85.0%
#15879: Support for forwarded messages and file_shared messages in slack
by olyashok · 2026-02-14
84.7%
#17558: fix(slack): replace files.uploadV2 with 3-step upload flow to fix m...
by fif911 · 2026-02-15
82.8%
#20480: feat(slack): extract and surface attachment notes in messages
by olyashok · 2026-02-19
82.7%
#7719: fix(slack): thread replies with @mentions dropped in requireMention...
by SocialNerd42069 · 2026-02-03
82.7%
#22942: fix(slack): parse generic attachment text for inbound events
by danielalkurdi · 2026-02-21
81.6%
#9166: Fix: Use userToken for Slack file downloads
by vishaltandale00 · 2026-02-04
81.4%
#15095: fix(slack): process all file attachments instead of only the first
by Lar000ki · 2026-02-13
81.1%
#19430: Slack: infer bare user targets before media upload
by gg2uah · 2026-02-17
81.0%
#14847: fix(slack): preserve auth across Slack-hosted file redirects
by natashache · 2026-02-12
80.6%