← Back to PRs

#15768: feat(slack): Add queue position indicators for message queues

by haynzz open 2026-02-13 21:24 View on GitHub →
docs stale size: L
## Summary Implements Slack Queue Position Indicators for OpenClaw to provide visual feedback to users when their messages are queued for AI processing. ## Problem When multiple messages stack up waiting for the AI to respond, users have no visibility into queue position or whether their message is being processed. ## Solution Added emoji reactions showing queue position (1️⃣, 2️⃣, 3️⃣, etc.) to messages as they wait, with automatic updates as the queue drains. ## Features - **Position Reactions**: Messages receive number emoji reactions indicating their position in the queue - **Dynamic Updates**: Reactions update automatically as messages ahead complete processing - **Processing Indicator**: Position reaction is replaced with ⏳ when processing starts - **Automatic Cleanup**: Reactions are removed when processing completes or messages are removed from queue - **Multi-Account Support**: Works correctly with multiple Slack accounts/workspaces - **Configurable**: Position emojis, processing emoji, and max position can be customized ## Implementation Details ### Architecture - **QueuePositionTracker** class manages position reactions - Integrated into queue enqueue/drain/cleanup flows - Uses existing Slack API actions (reactSlackMessage, removeSlackReaction) ### Key Files Modified - src/auto-reply/reply/queue/position-tracker.ts - Core tracker implementation - src/auto-reply/reply/queue/enqueue.ts - Updates positions after enqueuing - src/auto-reply/reply/queue/drain.ts - Marks as processing and updates during drain - src/auto-reply/reply/queue/cleanup.ts - Clears reactions on queue clear - src/auto-reply/reply/queue/state.ts - Clears reactions on state reset ### Edge Cases Handled - Message deletion and queue clearing - Non-Slack messages (only tracks originatingChannel: "slack") - Missing metadata (channelId or messageId) - Slack API failures (logged but don't crash processing) - Collect mode (all items marked as processing when collected into one run) - Bot restart (reactions are stateless, new state tracked correctly) - Beyond max position (messages past limit don't get reactions) ## Testing Comprehensive test coverage in position-tracker.test.ts: - Position reaction addition and updates - Processing indicator management - Queue position changes - Custom configuration - Error handling - Edge cases ## Configuration The feature is enabled by default and can be configured. ## Documentation - Added comprehensive documentation in docs/queue-position-indicators.md - Updated CHANGELOG.md with feature description ## Checklist - [x] Working implementation - [x] Comprehensive tests added - [x] Edge cases handled - [x] Documentation added - [x] CHANGELOG.md updated 🤖 Generated with Claude Code <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR adds Slack “queue position” emoji reactions to queued follow-up messages, introducing a `QueuePositionTracker` and integrating it into enqueue/drain/cleanup flows so users see numeric position emojis while waiting and an hourglass while processing. Core logic lives in `src/auto-reply/reply/queue/position-tracker.ts`, with queue lifecycle hooks added to `enqueue.ts`, `drain.ts`, and queue-clear paths. Tests were added for tracker behavior. Key merge blockers are around cleanup correctness in multi-account Slack setups: reaction removal during cleanup often omits `accountId`, and queue-clear paths call `updateQueuePositions([])` in a way that is not scoped to the specific queue being cleared. <h3>Confidence Score: 3/5</h3> - This PR is not safe to merge until the reaction cleanup/account scoping issues are fixed. - The feature is well-scoped and tested, but cleanup/removal paths drop `accountId` and queue-clear logic uses a global tracker update that isn’t scoped to the specific queue, which can leave stale reactions or target the wrong Slack workspace in multi-account deployments. - src/auto-reply/reply/queue/position-tracker.ts, src/auto-reply/reply/queue/state.ts, src/auto-reply/reply/queue/cleanup.ts <sub>Last reviewed commit: 69be4da</sub> <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> <!-- /greptile_comment -->

Most Similar PRs