← Back to PRs

#7980: feat(telegram): multi-stage reaction system for message pipeline visibility

by macmimi23 open 2026-02-03 12:12 View on GitHub β†’
channel: telegram stale
## Summary Adds a configurable multi-stage emoji reaction system that gives users real-time visibility into the message processing pipeline via Telegram reactions. ## Motivation When a message takes time to process (LLM thinking, tool calls, etc.), users have no visual feedback. This feature transitions the message reaction through stages so users can see exactly what's happening: ``` πŸ‘€ received β†’ πŸ”₯ LLM processing β†’ ⚑ tool use β†’ πŸ‘ delivered / πŸ’” error ``` If a reaction stays on πŸ‘€ or πŸ”₯ for too long, users immediately know something is stuck β€” no more guessing. ## Configuration Disabled by default. Opt-in via config: ```json { "messages": { "reactionStages": { "enabled": true, "emoji": { "received": "πŸ‘€", "llmProcessing": "πŸ”₯", "toolUse": "⚑", "delivered": "πŸ‘", "error": "πŸ’”" } } } } ``` Emoji are customizable per stage for different platform compatibility. ## Design Decisions - **Best-effort**: Reaction API failures are caught and logged, never block message processing - **Backward compatible**: No behavior change when `reactionStages.enabled` is false (default) - **Telegram-safe defaults**: Only uses emoji verified to work with Telegram's `setMessageReaction` API (πŸ§ πŸ”§βœ…βš οΈβ³ all return `REACTION_INVALID`) - **Deduplication**: Skips API call if same stage is already set - **Fire-and-forget**: Stage transitions are non-blocking ## Files Changed - **New**: `src/telegram/reaction-stages.ts` β€” Tracker module with types and factory - **Modified**: `src/telegram/bot-message-context.ts` β€” Creates tracker on message receive - **Modified**: `src/telegram/bot-message-dispatch.ts` β€” Wires stages to pipeline events - **Modified**: Config schema files β€” Adds `messages.reactionStages` config ## Testing Tested in production on a live Telegram bot. Build passes with `pnpm build`. <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR adds an opt-in, multi-stage Telegram reaction tracker to visualize message pipeline progress (received β†’ LLM processing β†’ tool use β†’ delivered/error). It introduces a new `reaction-stages.ts` module, wires a `reactionTracker` into the Telegram message context on receipt, and drives stage transitions from dispatch events (reply start, tool-call detection, delivery success, and error/no-response conditions). Config schema/types are extended under `messages.reactionStages` with per-stage emoji overrides. Overall the approach is clean and best-effort (reaction failures don’t block processing), but there are a couple of behavior edge cases around how β€œstages enabled” is gated and inferred that could lead to reactions being unexpectedly absent or legacy ack removal running in the wrong cases. <h3>Confidence Score: 3/5</h3> - Mostly safe to merge, but a few gating/inference edge cases can cause surprising reaction behavior. - Core logic is additive and best-effort, and the tracker is isolated; however, the current implementation ties stage reactions to ack gating and uses `currentStage` as an activation proxy, which can lead to missing reactions or inconsistent cleanup depending on runtime conditions. - src/telegram/bot-message-context.ts, src/telegram/bot-message-dispatch.ts, src/telegram/reaction-stages.ts <!-- greptile_other_comments_section --> <sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub> <!-- /greptile_comment -->

Most Similar PRs