openclaw - 💡(How to fix) Fix Subagent deliveryContext loses to/threadId/accountId when spawned from group topics [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#57999Fetched 2026-04-08 01:55:03
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Participants

Fix Action

Workaround

Setting a one-shot cron job after spawn to manually check subagent status and send the result via message tool.

Code Example

{"channel": "telegram", "to": "telegram:<GROUP_ID>", "accountId": "default", "threadId": <TOPIC_ID>}

---

{"channel": "telegram"}
RAW_BUFFERClick to expand / collapse

Bug Description

When a subagent is spawned via sessions_spawn from a group topic session (e.g. Telegram forum topic), the subagent's deliveryContext only inherits {"channel": "telegram"} — it loses the to, accountId, and threadId fields.

This means the completion announce has nowhere to be delivered, so the user never receives the subagent's result.

Expected Behavior

Subagent deliveryContext should inherit the full delivery context from the parent session, including to, accountId, and threadId.

Actual Behavior

Parent session (group topic):

{"channel": "telegram", "to": "telegram:<GROUP_ID>", "accountId": "default", "threadId": <TOPIC_ID>}

Subagent spawned from it:

{"channel": "telegram"}

Note: the subagent does have groupId set correctly with the full group+topic reference — only deliveryContext is incomplete.

Reproduction

  1. Have a Telegram group with forum topics enabled
  2. From a topic session, run sessions_spawn to create a subagent
  3. Wait for subagent to complete
  4. Observe: no announce is delivered to the topic

Environment

  • OpenClaw version: 2026.3.23-2
  • Channel: Telegram (group with forum/topics)
  • OS: macOS (Apple Silicon)

Workaround

Setting a one-shot cron job after spawn to manually check subagent status and send the result via message tool.

extent analysis

Fix Plan

To fix the issue, we need to modify the sessions_spawn function to inherit the full delivery context from the parent session.

Here are the steps:

  • Update the sessions_spawn function to include the to, accountId, and threadId fields in the subagent's deliveryContext.
  • Ensure that the deliveryContext is properly passed to the subagent.

Example code snippet:

def sessions_spawn(parent_session, subagent_config):
    # ...
    subagent_delivery_context = parent_session.deliveryContext.copy()
    subagent_delivery_context['channel'] = 'telegram'
    subagent_config['deliveryContext'] = subagent_delivery_context
    # ...

Alternatively, you can also use the following code snippet:

subagent_delivery_context = {**parent_session.deliveryContext, 'channel': 'telegram'}

This will create a new dictionary with all the key-value pairs from the parent session's deliveryContext and override the channel field with 'telegram'.

Verification

To verify that the fix worked, follow these steps:

  • Spawn a subagent from a group topic session using sessions_spawn.
  • Check the subagent's deliveryContext to ensure it includes the to, accountId, and threadId fields.
  • Wait for the subagent to complete and verify that the completion announce is delivered to the topic.

Extra Tips

  • Make sure to test the fix in different environments and scenarios to ensure it works as expected.
  • Consider adding logging or monitoring to track the deliveryContext of subagents and detect any potential issues.

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 Subagent deliveryContext loses to/threadId/accountId when spawned from group topics [1 participants]