Skip to content

Telegram responses not sent - missing "run done" event #51659

@heavensea

Description

@heavensea

Bug Report: Telegram responses not sent - missing "run done" event

Summary

Embedded runs complete successfully (agent end, prompt end) but the "run done" event is not emitted in some cases, causing Telegram responses to not be sent to users. Users only see "typing" indicator but never receive the actual response.

Environment

  • OpenClaw Version: Latest (installed via Homebrew)
  • Platform: macOS (Darwin 25.3.0)
  • Node Version: 22.22.0
  • Telegram Channel: Using multiple bot accounts (agent4, agent16, etc.)

Steps to Reproduce

  1. Send a message to an OpenClaw agent via Telegram
  2. Wait for the agent to process the request
  3. Agent completes the task (visible in logs and session files)
  4. Response is generated but never sent to Telegram
  5. User only sees "typing" indicator that never resolves

Observed Behavior

Checking the logs reveals:

Affected Run (missing "run done"):

22:30:20 - embedded run start: runId=e666aaf5-a17b-4505-8ca2-eb744a7e7413 sessionId=de0764c7-b695-431f-a04b-1794fde5a51c provider=minimax model=MiniMax-M2.5 thinking=low messageChannel=telegram
22:30:20 - embedded run prompt start
22:30:20 - embedded run agent start
22:30:30 - embedded run tool start/end (exec completed)
22:30:43 - embedded run agent end: runId=e666aaf5-a17b-4505-8ca2-eb744a7e7413 isError=false
22:30:43 - embedded run prompt end: runId=e666aaf5-a17b-4505-8ca2-eb744a7e7413 sessionId=de0764c7-b695-431f-a04b-1794fde5a51c durationMs=22929
❌ NO "embedded run done" event

Normal Run (with "run done"):

22:28:47 - embedded run start: runId=cf0cffe8-bc2f-4039-994f-5b3a7e961498 sessionId=7c2ad2a8-9a9a-4aa3-8491-a31bb72f8f8f provider=minimax model=MiniMax-M2.5 thinking=low messageChannel=telegram
...
22:31:22 - embedded run done: runId=cf0cffe8-bc2f-4039-994f-5b3a7e961498 sessionId=7c2ad2a8-9a9a-4aa3-8491-a31bb72f8f8f durationMs=82947 aborted=false
✅ Has "run done" event

Evidence

  • Session files show assistant response was generated correctly
  • No Telegram sendMessage calls in logs for affected runs
  • No errors in gateway.err.log for affected runs
  • Multiple agents affected (agent4, agent16)
  • Issue occurs intermittently

Log Analysis:

tail -1000 /Users/xyz/.openclaw/logs/gateway.log | grep "embedded run agent end" | wc -l
# Returns: 6

tail -1000 /Users/xyz/.openclaw/logs/gateway.log | grep "embedded run done" | wc -l
# Returns: 5 (one run missing "done" event)

Impact

  • Users perceive bot as "dead" or unresponsive
  • Completed work is not communicated to users
  • Requires manual intervention or Gateway restart
  • Significantly affects user trust in the system

Workaround

  • Restart Gateway: openclaw gateway restart
  • Manually send response via Telegram Bot API

Additional Context

  • The affected runId e666aaf5-a17b-4505-8ca2-eb744a7e7413 was for agent16 (writing assistant, @HeavenseaClerkBot)
  • Message was about analyzing WeChat Official Account draft articles
  • Response was correctly generated in session file but never sent
  • Similar issue occurred with agent4 (data engineer) earlier

Affected Session Files:

  • /Users/xyz/.openclaw/agents/agent16/sessions/de0764c7-b695-431f-a04b-1794fde5a51c.jsonl
  • /Users/xyz/.openclaw/agents/agent4/sessions/7c2ad2a8-9a9a-4aa3-8491-a31bb72f8f8f.jsonl

Expected Behavior

When an embedded run completes (agent end, prompt end), the "run done" event should always be emitted, triggering the Telegram sendMessage call to deliver the response to the user.

Priority

High - Affects core functionality and user experience. Users cannot rely on the bot to deliver responses.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions