Skip to content

fix: propagate requester channel in subagent announce flow#1773

Open
BingqingLyu wants to merge 3 commits into
mainfrom
fork-pr-58874-fix-subagent-source-channel-55931
Open

fix: propagate requester channel in subagent announce flow#1773
BingqingLyu wants to merge 3 commits into
mainfrom
fork-pr-58874-fix-subagent-source-channel-55931

Conversation

@BingqingLyu

@BingqingLyu BingqingLyu commented Apr 28, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes openclaw#55931

runSubagentAnnounceFlow() hardcodes sourceChannel: INTERNAL_MESSAGE_CHANNEL ("webchat") in both the descendant wake path (line 273) and the completion announce path (line 607). This causes all subagent completion events to report sourceChannel: "webchat" regardless of the actual originating channel, misrouting responses when the parent session came from Telegram, Feishu, WhatsApp, Slack, etc.

Changes

In src/agents/subagent-announce.ts:

  • Line 273 (wake flow): INTERNAL_MESSAGE_CHANNELparams.requesterOrigin?.channel ?? INTERNAL_MESSAGE_CHANNEL
  • Line 607 (completion flow): same change

Both call sites already receive params.requesterOrigin?: DeliveryContext which carries the original channel. The fix simply threads it through instead of discarding it. Falls back to INTERNAL_MESSAGE_CHANNEL when no requester origin is available (e.g., internally triggered subagents).

Test plan

  • Spawn a subagent from a non-webchat channel (e.g., Telegram)
  • Verify subagent completion event has sourceChannel: "telegram" instead of "webchat"
  • Verify webchat-originated subagents still work (fallback path)

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

…coding webchat (openclaw#55931)

Both wake and completion announce flows hardcode sourceChannel to
INTERNAL_MESSAGE_CHANNEL ("webchat"), causing subagent completion
events to always report webchat as origin regardless of actual channel.
This misroutes responses when the parent session originated from
Telegram, Feishu, WhatsApp, etc.

Fix: use params.requesterOrigin?.channel with INTERNAL_MESSAGE_CHANNEL
as fallback, preserving the actual delivery channel through the
subagent lifecycle.

Fixes openclaw#55931
… requesterOrigin

The wake function's params type does not include requesterOrigin
(it's an internal system-triggered flow). Only the completion
announce path in runSubagentAnnounceFlow should use the
requester's channel.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: sessions_spawn creates subagent with sourceChannel = "webchat" instead of original message channel

2 participants