openclaw - 💡(How to fix) Fix Exec approval completion events lose forum topic context in Telegram forum supergroups [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#53659Fetched 2026-04-08 01:25:11
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Participants

When exec approvals are configured for Telegram with target: "dm", the approval prompt itself routes correctly to the user's DM with the bot. However, the completion event (the command result/output) loses the originating forum topic context and routes to General (topic 1) instead of the topic where the original conversation happened.

Root Cause

When exec approvals are configured for Telegram with target: "dm", the approval prompt itself routes correctly to the user's DM with the bot. However, the completion event (the command result/output) loses the originating forum topic context and routes to General (topic 1) instead of the topic where the original conversation happened.

Fix Action

Workaround

None currently. Approving from the Control UI (http://localhost:18789) and checking results manually.

RAW_BUFFERClick to expand / collapse

Summary

When exec approvals are configured for Telegram with target: "dm", the approval prompt itself routes correctly to the user's DM with the bot. However, the completion event (the command result/output) loses the originating forum topic context and routes to General (topic 1) instead of the topic where the original conversation happened.

Steps to Reproduce

  1. Configure a Telegram bot on a forum supergroup (a group with Topics enabled)
  2. Set channels.telegram.execApprovals: { enabled: true, approvers: ["<user_id>"], target: "dm" }
  3. Start a conversation in a non-General forum topic (e.g., topic ID 2)
  4. Trigger an exec approval from that topic
  5. Approve via DM

Expected Behavior

  • Approval prompt → DM ✅
  • Completion event / command output → back to the originating forum topic (topic 2)

Actual Behavior

  • Approval prompt → DM ✅
  • Completion event / command output → General topic (topic 1) ❌

Additional Notes

  • Also tested with target: "channel" — same issue, completion routes to General instead of originating topic
  • The originating session's message_thread_id appears to be lost after the DM-based approval handoff
  • Tested on OpenClaw gateway on Linux (Raspberry Pi 4), Telegram channel

Workaround

None currently. Approving from the Control UI (http://localhost:18789) and checking results manually.

extent analysis

Fix Plan

To fix the issue of completion events losing the originating forum topic context, we need to modify the code to preserve the message_thread_id across the approval process. Here are the steps:

  • Modify the execApprovals handler to store the message_thread_id in the approval request object.
  • Update the approval completion event to retrieve the stored message_thread_id and use it to route the response to the correct topic.

Example code changes:

# Store message_thread_id in approval request object
def handle_exec_approval(approval_request):
    approval_request.message_thread_id = message_thread_id
    # ... rest of the code ...

# Retrieve stored message_thread_id and route response to correct topic
def handle_approval_completion(completion_event):
    message_thread_id = completion_event.approval_request.message_thread_id
    if message_thread_id:
        # Route response to correct topic using message_thread_id
        route_response_to_topic(message_thread_id, completion_event.response)
    else:
        # Fallback to General topic if message_thread_id is not found
        route_response_to_topic(1, completion_event.response)

Verification

To verify the fix, follow these steps:

  • Configure the Telegram bot with target: "dm" and trigger an exec approval from a non-General forum topic.
  • Approve the request via DM and check if the completion event is routed to the correct topic.
  • Test with different topics and approval scenarios to ensure the fix works consistently.

Extra Tips

  • Make sure to handle cases where message_thread_id is not found or is invalid to prevent routing errors.
  • Consider adding logging or debugging statements to track the message_thread_id and approval request objects to help with troubleshooting.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Exec approval completion events lose forum topic context in Telegram forum supergroups [1 participants]