#7046: feat(telegram): add placeholder message while processing
channel: telegram
agents
Cluster:
Tool Execution and Error Handling
## Summary
- Shows a "?? Thinking..." message when processing starts
- Updates to display current tool usage (e.g., "?? Searching the web...")
- Deletes placeholder when actual response is ready
- Fully configurable via `channels.telegram.placeholder`
This is a clean re-implementation of #5213 by @6rok - we've tested it in production and it works great!
## Configuration Example
```json
{
"channels": {
"telegram": {
"placeholder": {
"enabled": true,
"messages": ["?? Thinking...", "?? Processing..."],
"deleteOnResponse": true,
"toolDisplay": {
"web_search": {"emoji": "??", "label": "Searching the web"},
"browser": {"emoji": "??", "label": "Using browser"}
}
}
}
}
}
```
## Test plan
- [x] Tested in production Telegram bot
- [x] Placeholder appears immediately on message
- [x] Updates when tools are used
- [x] Deletes before final response
- [x] Build passes
?? Generated with [Claude Code](https://claude.com/claude-code)
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR adds a Telegram “placeholder” message while an agent run is processing, with optional per-tool display overrides. It threads tool-start events from the embedded Pi agent (`onAgentEvent` → `GetReplyOptions.onToolStart`) into Telegram dispatch, where the placeholder message is sent immediately, updated when tools start, and cleaned up before the final reply is delivered.
Configuration is wired through `channels.telegram.placeholder` (types + zod schema), and tool-start events now optionally include tool args in the emitted event payloads.
<h3>Confidence Score: 3/5</h3>
- Mostly safe to merge, but there are a couple of runtime/cleanup edge cases that should be addressed.
- Core behavior is localized and configuration is validated, but (1) unsafe casting of `args` can throw at runtime, and (2) placeholder cleanup is not guaranteed on non-final/error paths, which can leave orphan messages in Telegram chats.
- src/agents/pi-embedded-subscribe.handlers.tools.ts, src/telegram/bot-message-dispatch.ts
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
**Context used:**
- Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8))
- Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13))
<!-- /greptile_comment -->
Most Similar PRs
#15864: feat: add deliverOnlyToolMessages config for clean messaging channe...
by gandalf-the-engineer · 2026-02-14
78.9%
#8753: fix(telegram): add config option to disable acknowledgments
by revenuestack · 2026-02-04
76.3%
#2805: fix: wire onToolResult to dispatcher for verbose tool summaries
by LinghaoZhuang · 2026-01-27
75.9%
#7058: feat(telegram): add channel_post handler for broadcast channels
by waifu7498173 · 2026-02-02
75.3%
#2917: Slack: fix thread context + prevent reply spillover
by SocialNerd42069 · 2026-01-27
75.3%
#14367: feat(telegram): add message read via inbound message store
by michaelquinlan88 · 2026-02-12
75.2%
#11920: Telegram: create forum topics via message tool (thread-create)
by larsderidder · 2026-02-08
75.0%
#18678: fix(telegram): preserve draft message when all final payloads are e...
by julianubico · 2026-02-16
74.3%
#7218: fix(telegram): skip empty text messages in threaded mode
by ArsalanShakil · 2026-02-02
73.9%
#7980: feat(telegram): multi-stage reaction system for message pipeline vi...
by macmimi23 · 2026-02-03
73.9%