Skip to content

CLI: openclaw message send hangs after successful delivery (never exits) #16460

@rnunley-nmg

Description

@rnunley-nmg

Summary

openclaw message send successfully delivers the message but the process never exits, keeping the Node.js event loop alive indefinitely.

Reproduction

time openclaw message send --channel discord --target <channel-id> -m 'test'
# Message delivers in ~2s, "✅ Sent via Discord" prints, but process hangs forever

Root Cause Analysis

Traced through the bundled dist:

  1. message send action calls runMessageActionmessageCommand() in program-DVsNBtwv.js:2812
  2. messageCommand calls ensurePluginRegistryLoaded() which loads the Discord plugin and opens a WebSocket/REST client
  3. After runMessageAction completes and output is printed, the function returns normally
  4. runCommandWithRuntime() in cli-utils-r6pQ5iCT.js:18 simply awaits the action — no cleanup or process.exit()
  5. The Discord client's open WebSocket/connection keeps the Node.js event loop alive
  6. The process never exits

Other CLI commands (e.g., status) explicitly call runtime.exit(0) after completion, but the message send path does not.

Impact

Any script using execSync('openclaw message send ...') with a timeout will:

  1. Successfully deliver the message
  2. Hit the timeout waiting for exit
  3. Throw an error
  4. Retry (if retry logic exists) → duplicate messages

This was discovered via the SDLC runner which uses execSync with a 30s timeout and 3 retries — resulting in 2-3x duplicate Discord messages per status update.

Suggested Fix

Either:

  • Add process.exit(0) after the message send action completes (like other commands do)
  • Or properly destroy/disconnect the plugin clients after one-shot CLI commands

Environment

  • OpenClaw 2026.2.13 (203b5bd)
  • Node v24.12.0
  • macOS (arm64)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions