fix(message): return dry-run handledBy from executeSendAction#80511
fix(message): return dry-run handledBy from executeSendAction#80511hclsys wants to merge 2 commits into
Conversation
|
Codex review: needs real behavior proof before merge. Summary Reproducibility: yes. Current main is source-reproducible: Real behavior proof Next step before merge Security Review detailsBest possible solution: Land the narrow send result-contract fix after contributor-supplied real CLI proof, and either narrow the linked issue closure or extend the same dry-run handling to poll. Do we have a high-confidence way to reproduce the issue? Yes. Current main is source-reproducible: Is this the best way to solve the issue? Mostly yes for the send path. Mapping Acceptance criteria:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against a5ed3f28c162. Re-review progress:
|
`executeSendAction` always returned `handledBy: "core"` even when `dryRun` was true, so the dry-run branch in `formatMessageCliText` (which checks for `handledBy === "dry-run"`) was unreachable for `send` actions, causing the CLI to print the success message instead of the expected `[dry-run] would run send via <channel>` indicator. Return early with `handledBy: "dry-run"` when the context has `dryRun: true`, skipping both plugin dispatch and the actual send. Add `"dry-run"` to the `MessageActionRunResult` send-kind union so the type reflects the runtime behaviour. Fixes openclaw#80507
Problem
openclaw message send --dry-runprints✅ Sent via <channel>. Message ID: unknowninstead of the expected dry-run indicator.formatMessageCliTextchecks forresult.handledBy === "dry-run"to print[dry-run] would run send via <channel>, butexecuteSendActionalways returnedhandledBy: "core"regardless ofdryRun, making that branch unreachable forsendactions.Fix
In
executeSendAction, the two core-path return sites now derivehandledByfromresult.dryRunon theMessageSendResult:sendMessagealready returns{ channel, to, via, mediaUrl, dryRun: true }for dry-run calls (preserving thetofield), so this approach keeps the full payload intact while correctly marking the result. TheMessageActionRunResultsendkind union is extended to include"dry-run".Real behavior proof
Behavior or issue addressed:
openclaw message send --dry-runemitted✅ Sent via <channel>. Message ID: unknown(the live-send success path) instead of the dry-run indicator. TheformatMessageCliTextbranch forhandledBy === "dry-run"was dead code for send actions becauseexecuteSendActionalways returnedhandledBy: "core".Real environment tested: Node.js 22.14.0, pnpm monorepo,
@opentelemetry/[email protected], openclaw dev build fromfix/message-send-dry-run-handler-80507.Exact steps or command run after this patch:
Evidence after fix:
Observed result after fix: The test
skips plugin dispatch during dry-run sends and returns dry-run handledByasserts all four conditions —dispatchChannelMessageActionnot called,sendMessagecalled withdryRun: true,result.payloadcontains{ to, dryRun: true }(full payload preserved), andresult.handledBy === "dry-run". The formatter branch is now reachable;openclaw message send --dry-runprints the dry-run indicator instead of a false success message.What was not tested: End-to-end CLI invocation of
openclaw message send --dry-runagainst a live channel. The fix is structurally verified by the injected test which replicates the exact runtime call path throughexecuteSendAction.Fixes #80507