Skip to content

fix(cli): stop message send from hanging forever after delivery (#16460)#16491

Merged
gumadeiras merged 3 commits intoopenclaw:mainfrom
yinghaosang:fix/cli-message-send-hang
Feb 14, 2026
Merged

fix(cli): stop message send from hanging forever after delivery (#16460)#16491
gumadeiras merged 3 commits intoopenclaw:mainfrom
yinghaosang:fix/cli-message-send-hang

Conversation

@yinghaosang
Copy link
Copy Markdown
Contributor

@yinghaosang yinghaosang commented Feb 14, 2026

Summary

openclaw message send delivers the message fine but the process never exits — the plugin registry loads a Discord client with an open WebSocket, and nothing tears it down or calls exit() afterward. Scripts using execSync hit their timeout and retry, causing duplicate messages.

Closes #16460

lobster-biscuit

Root Cause

runMessageAction in helpers.ts calls ensurePluginRegistryLoaded() which opens persistent connections (Discord WebSocket, etc.), then awaits runCommandWithRuntime. On success, runCommandWithRuntime just returns — no process.exit(). The error path already calls exit(1), but the happy path was missing.

Changes

  • Before: process hangs indefinitely after "✅ Sent via Discord" prints
  • After: defaultRuntime.exit(0) fires right after the action completes, same pattern as the error handler

One line added in src/cli/program/message/helpers.ts.

Tests

  • src/cli/program/message/helpers.test.ts — 4 tests covering exit(0) on success, exit(1) on failure, no exit(0) on error path, and correct accountaccountId mapping. All fail before fix, pass after.
  • pnpm build && pnpm check pass (pre-existing format/TS issues in unrelated files)

Greptile Overview

Greptile Summary

Added defaultRuntime.exit(0) after successful message send to properly terminate the CLI process. Previously, the process would hang indefinitely after message delivery because the plugin registry loads persistent connections (Discord WebSocket, etc.) that keep the event loop alive.

  • Fixed process hang after openclaw message send completes successfully
  • Added comprehensive test coverage verifying exit behavior for success/failure paths
  • Error path already called exit(1); success path was missing exit(0)

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • Single-line fix with clear logic, comprehensive test coverage, and no risk of breaking existing behavior. The error path already exits properly, and the success path now exits as well, preventing the documented hang issue.
  • No files require special attention

Last reviewed commit: de3dc81

@yinghaosang yinghaosang changed the title fix(cli): exit after message send completes (#16460) fix(cli): stop message send from hanging forever after delivery (#16460) Feb 14, 2026
@openclaw-barnacle openclaw-barnacle bot added cli CLI command changes size: S labels Feb 14, 2026
@gumadeiras gumadeiras self-assigned this Feb 14, 2026
@gumadeiras gumadeiras force-pushed the fix/cli-message-send-hang branch from de3dc81 to fdcb1d4 Compare February 14, 2026 21:53
@gumadeiras gumadeiras force-pushed the fix/cli-message-send-hang branch from fdcb1d4 to 78dffc9 Compare February 14, 2026 21:53
@gumadeiras gumadeiras merged commit 8927c69 into openclaw:main Feb 14, 2026
9 checks passed
@gumadeiras
Copy link
Copy Markdown
Member

Merged via squash.

Thanks @yinghaosang!

akoscz pushed a commit to akoscz/openclaw that referenced this pull request Feb 15, 2026
…claw#16460) (openclaw#16491)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 78dffc9
Co-authored-by: yinghaosang <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
GwonHyeok pushed a commit to learners-superpumped/openclaw that referenced this pull request Feb 15, 2026
…claw#16460) (openclaw#16491)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 78dffc9
Co-authored-by: yinghaosang <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
vincentkoc pushed a commit to vincentkoc/openclaw that referenced this pull request Feb 15, 2026
…claw#16460) (openclaw#16491)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 78dffc9
Co-authored-by: yinghaosang <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
…claw#16460) (openclaw#16491)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 78dffc9
Co-authored-by: yinghaosang <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants