openclaw - 💡(How to fix) Fix ACP streamTo:parent announcements ignore Telegram topic context [1 comments, 2 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#52750Fetched 2026-04-08 01:19:52
View on GitHub
Comments
1
Participants
2
Timeline
1
Reactions
0
Author
Timeline (top)
commented ×1

Root Cause

The enqueueSystemEvent delivery path doesn't extract and use the session's stored deliveryContext.threadId when routing to Telegram. Session entries have the correct threadId in deliveryContext and lastThreadId, but the system event sender doesn't respect it.

RAW_BUFFERClick to expand / collapse

Problem

When spawning ACP sessions with streamTo: "parent" from a Telegram forum topic, completion announcements land in #general (topic 1) instead of the originating topic.

Expected Behavior

System events emitted to a parent session with key agent:main:telegram:group:-1003846610749:topic:1070 should deliver to topic 1070.

Current Behavior

System events always land in topic 1 (general), ignoring the :topic:X suffix in the parent session key.

Root Cause

The enqueueSystemEvent delivery path doesn't extract and use the session's stored deliveryContext.threadId when routing to Telegram. Session entries have the correct threadId in deliveryContext and lastThreadId, but the system event sender doesn't respect it.

Technical Details

  • Session keys include topic marker: :topic:1070
  • Session entries store correct deliveryContext.threadId
  • Code exists to parse :topic: marker (parseSessionThreadInfo)
  • System event delivery needs to use this info when sending to Telegram

Fix Required

When delivering system events to a session:

  1. Look up session's deliveryContext
  2. Extract threadId
  3. Pass to Telegram adapter as message_thread_id

Impact

All ACP spawn announcements, progress updates, and completions go to wrong topic in forum groups.

extent analysis

Fix Plan

To fix the issue, we need to modify the enqueueSystemEvent delivery path to extract and use the session's stored deliveryContext.threadId when routing to Telegram. Here are the steps:

  • Modify the enqueueSystemEvent function to look up the session's deliveryContext and extract the threadId.
  • Pass the extracted threadId to the Telegram adapter as message_thread_id.

Example code:

const enqueueSystemEvent = async (sessionKey, event) => {
  // Look up session's deliveryContext
  const sessionEntry = await getSessionEntry(sessionKey);
  const deliveryContext = sessionEntry.deliveryContext;
  
  // Extract threadId from deliveryContext
  const threadId = deliveryContext.threadId;
  
  // Pass threadId to Telegram adapter
  const telegramAdapter = getTelegramAdapter();
  await telegramAdapter.sendSystemEvent(event, { message_thread_id: threadId });
};

Alternatively, you can also use the existing parseSessionThreadInfo function to extract the threadId from the session key:

const enqueueSystemEvent = async (sessionKey, event) => {
  // Extract threadId from session key
  const { threadId } = parseSessionThreadInfo(sessionKey);
  
  // Pass threadId to Telegram adapter
  const telegramAdapter = getTelegramAdapter();
  await telegramAdapter.sendSystemEvent(event, { message_thread_id: threadId });
};

Verification

To verify that the fix worked, you can test the enqueueSystemEvent function by sending a system event to a session with a specific threadId and checking that it is delivered to the correct topic in the Telegram forum.

Extra Tips

Make sure to update the enqueueSystemEvent function to handle cases where the threadId is not present in the session's deliveryContext or the session key. Additionally, consider adding logging or monitoring to track the delivery of system events to ensure that the fix is working as expected.

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 ACP streamTo:parent announcements ignore Telegram topic context [1 comments, 2 participants]