Bug Description
When a sub-agent is spawned via sessions_spawn from a channel session (e.g. Discord), the completion announcement (containing task summary, token stats, session key, transcript path) is delivered to the channel session as a regular message. The LLM in that session then posts it to the channel — leaking internal processing details to external users.
Reproduction
- Configure a Discord channel with a system prompt that spawns sub-agents for incoming bot messages
- Have another bot send a message to the channel
- The channel session spawns a sub-agent via
sessions_spawn
- When the sub-agent completes, the completion report appears as a message in the channel session
- The LLM posts it to Discord, exposing:
- Internal reasoning chain
- Token usage stats
- Session keys and transcript paths
- What was shared vs withheld
Expected Behavior
Sub-agent completion announcements should not route to the originating channel session. They should either:
- Route only to the parent session (main session that spawned the channel session), or
- Be suppressed entirely when
sessions_spawn is called from a channel session, or
- Be tagged as
[internal] so the channel session can reliably detect and suppress them
Current Workaround
Added a system prompt rule: "When you receive a [System Message] about a subagent completing, reply with ONLY: NO_REPLY". This works ~80% of the time but is not reliable — the LLM sometimes still posts the completion report.
Impact
- Security: Exposes internal processing chain to external/untrusted users (other bots, guest humans)
- Privacy: Leaks token stats, session keys, transcript paths
- Trust: In an A2A (agent-to-agent) context, the visiting agent sees exactly what was shared and what was withheld, undermining the sandboxing model
Environment
- OpenClaw version: latest
- Channel: Discord
- Context: Agent-to-agent sandbox with sub-agent isolation
Suggested Fix
The gateway should filter completion announcements at the routing layer, before they reach the channel session's LLM. A channel session spawning a sub-agent should never see the raw completion report in its message stream.
Bug Description
When a sub-agent is spawned via
sessions_spawnfrom a channel session (e.g. Discord), the completion announcement (containing task summary, token stats, session key, transcript path) is delivered to the channel session as a regular message. The LLM in that session then posts it to the channel — leaking internal processing details to external users.Reproduction
sessions_spawnExpected Behavior
Sub-agent completion announcements should not route to the originating channel session. They should either:
sessions_spawnis called from a channel session, or[internal]so the channel session can reliably detect and suppress themCurrent Workaround
Added a system prompt rule: "When you receive a [System Message] about a subagent completing, reply with ONLY: NO_REPLY". This works ~80% of the time but is not reliable — the LLM sometimes still posts the completion report.
Impact
Environment
Suggested Fix
The gateway should filter completion announcements at the routing layer, before they reach the channel session's LLM. A channel session spawning a sub-agent should never see the raw completion report in its message stream.