Skip to content

fix(cli): unsuccessful message sends report success - #129202

Merged
steipete merged 3 commits into
mainfrom
codex/message-outcome-qa-20260825
Aug 25, 2026
Merged

steipete merged 3 commits into
mainfrom
codex/message-outcome-qa-20260825

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where operators running openclaw message send would see a green success message and exit code zero even when a message hook suppressed delivery. Structured failed and partially failed send results also lost their failure details at the same CLI boundary, making automation treat unsuccessful delivery as successful.

Why This Change Was Made

The durable send owner already records truthful suppressed, failed, and partial_failed outcomes, but the earlier broadcast repair in #125915 classified those outcomes only for broadcast targets. Move that existing classifier into the shared message-action contract and reuse it for single-send presentation, the documented JSON failure envelope, exit status, and unchanged broadcast behavior. Preserve the shipped successful JSON shape, legacy plugin/gateway results without delivery status, dry runs, stop-hook ordering, and platform message IDs for partial delivery.

User Impact

Intentionally suppressed sends now explain why nothing was delivered and exit nonzero. Failed and partially delivered sends surface the real reason, retain confirmed message IDs, and emit a machine-readable ok: false error envelope in JSON mode. Successful sends and existing broadcast results keep their established output.

Evidence

  • Fresh-main pre-fix real Commander parser: suppressed, failed, and partially failed delivery each exited 0 instead of 1.
  • Fresh-main pre-fix formatter and JSON: all three outcomes claimed ✅ Sent or omitted their failure envelope; six focused regressions failed.
  • Final focused owner, broadcast sibling, real parser, formatter, and JSON proof: node scripts/run-vitest.mjs src/commands/message-format.test.ts src/commands/message.test.ts src/cli/program/message/helpers.test.ts src/infra/outbound/message-action-runner.plugin-dispatch.test.ts src/infra/outbound/message.test.ts — 120 tests passed across five files and three shards.
  • Formatting, focused lint, git diff --check, independent owner-boundary review, and structured Codex autoreview all passed.
  • Shipped v2026.7.1 successful JSON output was inspected and preserved exactly; the failure envelope follows docs/cli/index.md.
  • Production: +67/-43, net +24; tests: +173/-0; docs: +5/-0; changelog: +1/-0. The production increase provides the documented failure envelope, partial-delivery evidence, and one shared classification owner while deleting the old broadcast-only classifier.
  • No authenticated provider request was sent: the bug is deterministic CLI interpretation of an already-recorded delivery outcome, proven through real command parsing and the existing delivery-producer and broadcast-sibling tests.

@clawsweeper

clawsweeper Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation cli CLI command changes commands Command implementations size: M maintainer Maintainer-authored PR labels Aug 25, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 25, 2026
@clawsweeper

clawsweeper Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed August 25, 2026, 5:57 AM ET / 09:57 UTC.

ClawSweeper review

What this changes

This PR makes openclaw message send report suppressed, failed, and partial-delivery outcomes in terminal output, JSON, and exit status.

Merge readiness

⚠️ Ready for maintainer review - 6 items remain

Keep open: the updated branch still bypasses its new formatter and JSON envelope for normal core failed and partial_failed sends, and it retains a release-owned changelog edit. The prior P1 blocker remains unresolved.

Priority: P1
Reviewed head: a0160557c34c5914f471d71bd47265c6a34f8135

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch has a coherent shared-classifier direction, but a central default-send path and a release-policy edit still block merge readiness.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its focused test claims remain supplemental and do not cover the unresolved default durable failure path.
Patch quality 🦐 gold shrimp (3/6) 2 actionable review findings remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its focused test claims remain supplemental and do not cover the unresolved default durable failure path.
Evidence reviewed 7 items Default failure bypasses the new renderer: Current main throws failed and partial-failed durable sends before constructing the structured result; the PR’s JSON formatter only runs after a result is returned.
PR JSON path requires an unavailable result: The new failure envelope derives from result.sendResult, which is unavailable on the default durable failure path because that path rejects first.
New tests mock past the owner boundary: The JSON regression injects a resolved runMessageAction result, so it cannot observe the durable sender throwing before the result exists.
Findings 2 actionable findings [P1] Preserve default core-send failure outcomes
[P2] Remove the release-owned changelog entry
Security None None.

Live Verification

Command: pnpm openclaw message send --help

Result: PASS (completed)

pnpm openclaw message send --help
runner@runnervm76f27:/tmp/clawsweeper-live-proof-129202-kNvByu/target$ pnpm openclaw message send --help
$ node scripts/run-node.mjs message send --help
pnpm openclaw message send --help
[openclaw] Building TypeScript (dist is stale: missing_build_stamp - build stamp missing).
[openclaw] Building bundled plugin assets.
[canvas] build: node scripts/bundle-a2ui.mjs
[log] ‹DIR›/a2ui.bundle.js  chunk │ size: 399.96 kB
[log] ‹DIR›/a2ui-v0.9.bundle.js  chunk │ size: 615.66 kB
[log]
[success] rolldown v1.2.0 Finished in 78.95 ms
[diffs] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts curated
[diffs-language-pack] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts full
[discord] build: node --import tsx ../../scripts/build-discord-activity-sdk.mts
[tsdown-build] invocation 1/2 finished in 0.5s
node_modules/playwright-core/lib/coreBundle.js (65821:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65821:29 ]
       │
 65821 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/playwright-core/lib/coreBundle.js (65828:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65828:29 ]
       │
 65828 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2343:30) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2343:31 ]
      │
 2343 │           ASM_CONSTS[start] = eval(func);
      │                               ──┬─
      │                                 ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2366:32) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2366:33 ]
      │
 2366 │           moduleExports[name] = eval(func);
      │                                 ──┬─
      │                                   ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

[tsdown-build] invocation 2/2 finished in 11.1s
[plugin-control-plane-loads] verified 35 built modules with native require and checked doctor closures
runtime-postbuild: 11 phases completed in 3660ms (slowest: built plugin control-plane loads 2665ms)
│
◇

OpenClaw 2026.8.1 (a016055) — All your chats, one OpenClaw.

Usage: openclaw message send [options]

Send a message

Options:
  --account ‹id›         Channel account id (accountId)
  --channel ‹channel›    Channel:
  --delivery ‹json›      Shared delivery preferences as JSON
  --dry-run              Print payload and skip sending (default: false)
  --force-document       Preserve original image bytes on Slack, or send images, G
… output truncated …

Assertions:

  • PASS expect_output: --json

How this fits together

The message CLI invokes the outbound send owner, then renders its delivery result for operators and automation. The structured delivery status determines text, JSON fields, and the process exit code.

flowchart LR
  A[Operator message send] --> B[CLI command parser]
  B --> C[Message action runner]
  C --> D[Durable outbound sender]
  D --> E[Structured delivery outcome]
  E --> F[Text and JSON output]
  F --> G[Exit status and automation]
Loading

Before merge

  • Preserve default core-send failure outcomes (P1) - The new JSON path only sees a returned sendResult, but the ordinary CLI leaves bestEffort unset and the durable sender throws for failed and partial_failed before this function runs. Those sends still use the generic error path, losing deliveryStatus and any partial message ID; carry the structured terminal outcome across that boundary and cover the unmocked core path.
  • Remove the release-owned changelog entry (P2) - CHANGELOG.md is release-owned under the applicable repository policy, so this normal bug-fix PR must keep its release context in the PR body or commit message rather than edit the generated release notes.
  • Resolve merge risk (P1) - Default failed and partial sends still fall into the generic error path, so automation loses the documented deliveryStatus and any confirmed partial message ID.
  • Resolve merge risk (P1) - The PR changes an established CLI/JSON failure contract; successful JSON compatibility and the new default-failure envelope need owner-boundary proof before merge.
  • Resolve merge risk (P1) - Production code is net +24 lines for a bug fix; the added shared classification is justified only if it is reached from the default durable failure path.
  • Complete next step (P2) - A focused repair can preserve the durable owner’s structured failed outcome through the single-send CLI boundary and remove the release-only file edit.

Findings

  • [P1] Preserve default core-send failure outcomes — src/commands/message.ts:55-65
  • [P2] Remove the release-owned changelog entry — CHANGELOG.md:72
Agent review details

Security

None.

PR surface

Source +24, Tests +173, Docs +6. Total +203 across 10 files.

View PR surface stats
Area Files Added Removed Net
Source 5 67 43 +24
Tests 3 173 0 +173
Docs 2 6 0 +6
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 10 246 43 +203

Review metrics

Metric Value Why it matters
Production vs regression tests production +67/-43 (net +24); tests +173/-0; docs +5/-0 The positive production delta is acceptable only once the shared classification handles the default durable failure boundary it was introduced to fix.

Stored data model

Persistent data-model change detected: serialized state: src/commands/message.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Preserve structured default-send failures (recommended)
    Carry failed and partial-failed terminal outcomes to the CLI renderer, add an unmocked default core-send regression, and remove the release-owned changelog edit before merge.
  2. Pause the branch
    Pause this PR if preserving the required-delivery throw contract and exposing structured CLI failure results requires a broader public outcome-contract decision.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Carry structured failed and partial-failed outcomes through the default durable send path without weakening required-delivery/recovery semantics; add unmocked CLI JSON and partial-ID regression coverage; remove the CHANGELOG.md entry.

Technical review

Best possible solution:

Carry the durable owner’s terminal failed and partial-failed outcome through the default single-send path without weakening required-delivery or recovery semantics, prove it through the real CLI boundary, and remove the release-owned changelog entry.

Do we have a high-confidence way to reproduce the issue?

Yes—source establishes that omitted bestEffort reaches the durable sender, which throws failed and partial-failed results before the new CLI formatter can observe them.

Is this the best way to solve the issue?

No—the shared classifier is the right presentation abstraction, but it must receive the durable owner’s default failure outcome rather than only mocked or explicit best-effort results.

Full review comments:

  • [P1] Preserve default core-send failure outcomes — src/commands/message.ts:55-65
    The new JSON path only sees a returned sendResult, but the ordinary CLI leaves bestEffort unset and the durable sender throws for failed and partial_failed before this function runs. Those sends still use the generic error path, losing deliveryStatus and any partial message ID; carry the structured terminal outcome across that boundary and cover the unmocked core path.
    Confidence: 0.99
  • [P2] Remove the release-owned changelog entry — CHANGELOG.md:72
    CHANGELOG.md is release-owned under the applicable repository policy, so this normal bug-fix PR must keep its release context in the PR body or commit message rather than edit the generated release notes.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.99

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 79722d2353cd.

Labels

Label justifications:

  • P1: Default CLI sends can still lose failure details despite the PR’s central operator-facing correctness claim.
  • merge-risk: 🚨 compatibility: The PR changes CLI exit and JSON failure behavior that existing automation may consume, while its default durable-failure path remains unproven.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its focused test claims remain supplemental and do not cover the unresolved default durable failure path.

Evidence

Acceptance criteria:

  • [P1] node scripts/run-vitest.mjs src/commands/message-format.test.ts src/commands/message.test.ts src/cli/program/message/helpers.test.ts src/infra/outbound/message-action-send.core.test.ts src/infra/outbound/message.test.ts.
  • [P1] node scripts/check-changed.mjs -- src/commands/message.ts src/commands/message.test.ts src/cli/program/message/helpers.ts src/infra/outbound/message.ts src/infra/outbound/outbound-send-service.ts.
  • [P1] git diff --check.

What I checked:

  • Default failure bypasses the new renderer: Current main throws failed and partial-failed durable sends before constructing the structured result; the PR’s JSON formatter only runs after a result is returned. (src/infra/outbound/message.ts:479, 79722d2353cd)
  • PR JSON path requires an unavailable result: The new failure envelope derives from result.sendResult, which is unavailable on the default durable failure path because that path rejects first. (src/commands/message.ts:55, a0160557c34c)
  • New tests mock past the owner boundary: The JSON regression injects a resolved runMessageAction result, so it cannot observe the durable sender throwing before the result exists. (src/commands/message.test.ts:641, a0160557c34c)
  • Existing owner tests cover only explicit best effort: The existing failed and partial-failure assertions pass bestEffort: true; the CLI leaves it absent, while the service forwards that absence to the sender. (src/infra/outbound/message.test.ts:625, 79722d2353cd)
  • Release-owned file remains changed: The PR still adds a release note even though repository policy reserves CHANGELOG.md for release generation. (CHANGELOG.md:72, a0160557c34c)
  • Related feature provenance: The earlier merged broadcast repair introduced the adjacent broadcast outcome handling; this PR extends the idea to the distinct single-send path. (src/infra/outbound/message-action-contracts.ts:181, 91cc7d512b0a)

Likely related people:

  • steipete: Authored the current outcome-classification commit and the merged broadcast delivery-outcome repair. (role: feature owner and recent area contributor; confidence: high; commits: a0160557c34c, 91cc7d512b0a; files: src/infra/outbound/message-action-contracts.ts, src/infra/outbound/message-action-runner.ts, src/commands/message.ts)
  • Josh Avant: Recent history shows related ownership and route work in the durable outbound path. (role: adjacent outbound-route contributor; confidence: medium; commits: 0b8596607208; files: src/infra/outbound/message.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Carry required-delivery failed and partial-failed outcomes to the CLI result boundary without weakening durability or recovery.
  • Add an unmocked default core-send CLI regression covering JSON failure fields and a retained partial message ID.
  • Remove the CHANGELOG.md entry.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-25T09:36:12.575Z sha 2b844a8 :: needs changes before merge. :: [P1] Preserve default-send terminal outcomes for CLI rendering | [P2] Remove the release-owned changelog entry

@steipete
steipete merged commit 452e734 into main Aug 25, 2026
227 checks passed
@steipete
steipete deleted the codex/message-outcome-qa-20260825 branch August 25, 2026 10:27
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 26, 2026
* fix(cli): report unsuccessful message sends accurately

* fix(cli): preserve narrowed send result for failure JSON

* chore(pr): leave release-owned changelog unchanged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes commands Command implementations docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant