Skip to content

[Bug] Agent thinking messages persist in Telegram chat after final response #600

@graycyrus

Description

@graycyrus

Summary

When the agent processes a message on Telegram, its intermediate "thinking" messages remain visible in the chat even after the final response is sent. They should be removed/deleted once the final message arrives.

Problem

Steps to reproduce:

  1. Send a message to the agent via Telegram channel
  2. Observe the agent's thinking/reasoning messages appearing in the chat (e.g. tool calls, intermediate reasoning)
  3. Agent sends final response
  4. Thinking messages are still visible in the chat alongside the final response

Expected: Thinking/intermediate messages should be deleted or replaced when the final agent response is sent, so the user only sees the clean final message.

Platform: Telegram channel integration

Solution

When the final agent response is ready to be sent on Telegram:

  • Delete all intermediate thinking/tool-call messages that were sent during processing
  • Only the final response message should remain in the chat
  • This likely requires tracking message IDs of thinking messages so they can be deleted via Telegram Bot API (deleteMessage)

Acceptance criteria

  • Thinking cleared — All intermediate thinking/reasoning messages are deleted from Telegram chat when final response is sent
  • Final message clean — Only the final agent response remains visible to the user
  • Message tracking — Thinking message IDs are tracked so they can be reliably deleted
  • Error handling — If deletion fails (e.g. message already deleted, permissions), it degrades gracefully without breaking the response

Related

  • Telegram channel provider in src/openhuman/channels/providers/
  • Proactive/streaming message delivery logic

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions