← Back to PRs

#7046: feat(telegram): add placeholder message while processing

by shanemort1982 open 2026-02-02 10:15 View on GitHub →
channel: telegram agents
## 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