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
- Send a message to an OpenClaw agent via Telegram
- Wait for the agent to process the request
- Agent completes the task (visible in logs and session files)
- Response is generated but never sent to Telegram
- 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.
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
Steps to Reproduce
Observed Behavior
Checking the logs reveals:
Affected Run (missing "run done"):
Normal Run (with "run done"):
Evidence
sendMessagecalls in logs for affected runsLog Analysis:
Impact
Workaround
openclaw gateway restartAdditional Context
e666aaf5-a17b-4505-8ca2-eb744a7e7413was for agent16 (writing assistant, @HeavenseaClerkBot)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.jsonlExpected 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.