#7980: feat(telegram): multi-stage reaction system for message pipeline visibility
channel: telegram
stale
Cluster:
Reaction Event Handling Enhancements
## 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
#21346: [AI-assisted] Telegram: add reaction state machine with fallback an...
by Archie818 Β· 2026-02-19
84.8%
#20236: fix(telegram): make reaction handling soft-fail and message-id resi...
by PeterShanxin Β· 2026-02-18
80.8%
#20860: feat(reactions): add configurable immediate reaction dispatch system
by davidrudduck Β· 2026-02-19
79.9%
#16716: feat(feishu): add reaction event support (created/deleted)
by schumilin Β· 2026-02-15
77.1%
#19816: feat(slack): add typingReaction config for DM typing indicator fall...
by dalefrieswthat Β· 2026-02-18
76.9%
#17316: fix: ack reaction not removed when block streaming is enabled (Tele...
by czmathew Β· 2026-02-15
76.7%
#19917: feat(discord): allow disabling intermediate status reactions
by Gitjay11 Β· 2026-02-18
76.6%
#22331: Fix Telegram reaction emoji normalization
by AIflow-Labs Β· 2026-02-21
76.0%
#15768: feat(slack): Add queue position indicators for message queues
by haynzz Β· 2026-02-13
75.8%
#14367: feat(telegram): add message read via inbound message store
by michaelquinlan88 Β· 2026-02-12
75.7%