Bug Description
When a sub-agent or cron job with `delivery.mode: "announce"` completes, the parent session receives an `inter_session` injection containing only the task result, without any of the parent session's conversation context. This causes the parent session to generate replies that are completely irrelevant to what the user was actually discussing.
Steps to Reproduce
- Have an active main session conversation (e.g., user is debugging a cron issue)
- Spawn a sub-agent with `delivery.mode: "announce"` to execute a task
- Sub-agent completes and triggers the announce mechanism
- Result: The parent session generates a reply based ONLY on the task result + system instruction, with no awareness of the ongoing conversation. The reply often makes no sense in context.
Evidence
In this case, the user was debugging why a cron task failed. The main session was actively investigating. When a sub-agent completed, the parent session was injected with:
"A completed subagent task is ready for user delivery. Convert the result above into your normal assistant voice and send that user-facing update now."
But it had NO visibility into:
- What the user was previously asking
- The current debugging context
- The conversation topic
So instead of acknowledging the cron investigation context, it generated: "你这cron是几分钟跑一次?感觉比我心跳还频繁 😅 要不要调低频率省点token?" — completely unrelated to what the user was actually doing.
Root Cause
File: `dist/subagent-announce-Dim2fAZI.js` (compiled, not TypeScript source)
In `buildAnnounceReplyInstruction()` (line 29-32), the injected instruction tells the parent session to "convert the result into your normal assistant voice" — but the injection message (`triggerMessage`) only contains:
- The task result/findings
- The system instruction
It does NOT include the parent session's recent conversation history.
The parent session then generates a reply with essentially zero context about what the user was doing.
Suggested Fix
When building the `triggerMessage` for the parent session, inject a summary of the parent session's recent conversation context (last N messages) so the parent session can generate contextually appropriate replies.
Specifically, modify `buildAnnounceReplyInstruction` or the `internalEvents` construction in `enqueueOrBypassSubagentAnnounce()` to include parent session conversation history in the trigger message.
Workaround
Set `delivery.mode: "none"` on cron jobs, so they only send messages via `message` tool internally without triggering the parent session announce reply mechanism.
- OpenClaw version: 2026.4.26 (be8c246)
- Channel: Feishu
- Session type: Cron job with sub-agent
Bug Description
When a sub-agent or cron job with `delivery.mode: "announce"` completes, the parent session receives an `inter_session` injection containing only the task result, without any of the parent session's conversation context. This causes the parent session to generate replies that are completely irrelevant to what the user was actually discussing.
Steps to Reproduce
Evidence
In this case, the user was debugging why a cron task failed. The main session was actively investigating. When a sub-agent completed, the parent session was injected with:
But it had NO visibility into:
So instead of acknowledging the cron investigation context, it generated: "你这cron是几分钟跑一次?感觉比我心跳还频繁 😅 要不要调低频率省点token?" — completely unrelated to what the user was actually doing.
Root Cause
File: `dist/subagent-announce-Dim2fAZI.js` (compiled, not TypeScript source)
In `buildAnnounceReplyInstruction()` (line 29-32), the injected instruction tells the parent session to "convert the result into your normal assistant voice" — but the injection message (`triggerMessage`) only contains:
It does NOT include the parent session's recent conversation history.
The parent session then generates a reply with essentially zero context about what the user was doing.
Suggested Fix
When building the `triggerMessage` for the parent session, inject a summary of the parent session's recent conversation context (last N messages) so the parent session can generate contextually appropriate replies.
Specifically, modify `buildAnnounceReplyInstruction` or the `internalEvents` construction in `enqueueOrBypassSubagentAnnounce()` to include parent session conversation history in the trigger message.
Workaround
Set `delivery.mode: "none"` on cron jobs, so they only send messages via `message` tool internally without triggering the parent session announce reply mechanism.