Skip to content

Sub-agent completion auto-announce silently fails in Discord group chats (source_reply_delivery_mode_mismatch) #86232

Description

@Josephur

Description

When a sub-agent completes its work and OpenClaw tries to auto-announce the completion back to the requester session in a Discord group chat (/channel), the delivery silently fails with source_reply_delivery_mode_mismatch.

This causes the main agent (and the user) to never receive sub-agent completion notifications. The user has to manually ask "did the sub-agent finish?" after every spawn.

Root Cause

In runs-DrbsiywK.js (~line 147):

if (options?.sourceReplyDeliveryMode === "message_tool_only" 
    && handle.sourceReplyDeliveryMode !== "message_tool_only") {
    diagnosticLogger.debug("queue message failed: ... reason=source_reply_delivery_mode_mismatch");
    return { kind: "complete", outcome: createQueueFailureOutcome(sessionId, "source_reply_delivery_mode_mismatch") };
}

Discord group chats use sourceReplyDeliveryMode: "message_tool_only" (see bot-D0mzNk0g.js:6915sourceReplyDeliveryMode: isRoomEvent ? "message_tool_only" : void 0). When the sub-agent completion event tries to deliver back to the parent session, the handle.sourceReplyDeliveryMode doesn't match "message_tool_only", and the delivery is quietly dropped.

Impact

This worked previously but broke at some point. The sessions_yield mechanism was a workaround (yield → wake on completion event), but even that has stopped working reliably in group chat contexts.

Each sub-agent spawn requires manual user check-in to verify completion. This defeats the purpose of automated multi-agent orchestration.

Steps to Reproduce

  1. Be in a Discord group chat (not DM)
  2. Spawn a sub-agent via sessions_spawn
  3. Use sessions_yield to wait
  4. Sub-agent completes
  5. Neither the completion announcement nor the yield wake arrives
  6. The sub-agent completion event is logged as source_reply_delivery_mode_mismatch

Suggested Fix

The delivery failure at line 147 should fall through to an alternative delivery path instead of failing silently. Options:

  1. When source_reply_delivery_mode_mismatch occurs, deliver the completion as an internal systemEvent instead of dropping it
  2. Allow the yield-wake path to work independently of the source reply delivery path
  3. Add message_tool_only support to the session handle for group chat contexts

Environment

  • OpenClaw gateway running on Linux
  • Discord channel (#dev in guild)
  • Multi-agent orchestration via sessions_spawn + sessions_yield

Found by: Josephur (user) & Brachyura McCrabface (main agent)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions