Skip to content

fix(cli): failed message actions report success - #130281

Merged
steipete merged 1 commit into
mainfrom
codex/message-action-soft-failure-outcomes-20260826
Aug 26, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/message-action-soft-failure-outcomes-20260826

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where operators running message actions would see a successful green checkmark and exit code zero even when a channel explicitly reported that the action failed. Disabled or rejected Telegram reactions could misleadingly print Reaction updated or Reaction added, failed message deletions looked successful, and plugin-handled sends or polls also hid their failures. JSON output kept the failure buried inside payload without the standard top-level failure envelope.

Why This Change Was Made

Reuse one canonical message-action outcome at all three CLI boundaries: process exit status, human-readable output, and machine-readable JSON. Only an authoritative top-level payload.ok === false is treated as a provider-reported failure; existing core delivery statuses and broadcast aggregation remain authoritative, and provider error, warning, or hint text is surfaced without modifying the original payload. Channel plugins continue returning their intentional soft failures to model tools, preventing duplicate-action retry loops.

User Impact

Failed reactions, deletions, edits, plugin-handled sends, and polls now explain the actual provider failure and exit nonzero; JSON callers receive the normal ok: false / cli_error envelope alongside the unchanged provider payload. Successful actions, legacy payloads without a boolean outcome, dry runs, broadcast results, and partially delivered messages retain their existing behavior.

Evidence

  • Authentic pre-fix RED: the real Commander message parser failed five new owner regressions because disabled reactions, rejected reactions carrying optimistic added metadata, deletes, plugin polls, and plugin sends all exited zero instead of one; 50 existing parser tests passed.
  • Authentic pre-fix RED: five human-output regressions printed false success, and five JSON regressions omitted the canonical failure envelope; 41 existing command and formatter tests passed.
  • GREEN: node scripts/run-vitest.mjs src/cli/program/message/helpers.test.ts src/commands/message-format.test.ts src/commands/message.test.ts src/infra/outbound/message-action-runner.plugin-dispatch.test.ts src/infra/outbound/message-action-runner.core-send.test.ts — 128 tests passed across three routed shards.
  • Targeted formatter check, typed owner-scope oxlint, git diff --check, independent source review, and configured Codex autoreview all passed.
  • No real messages were sent, no provider credentials were accessed, and no plugin or model-tool failure contract changed.

AI-assisted.

@clawsweeper

clawsweeper Bot commented Aug 26, 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 cli CLI command changes commands Command implementations size: M maintainer Maintainer-authored PR labels Aug 26, 2026
@steipete
steipete marked this pull request as ready for review August 26, 2026 18:14
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 26, 2026
@clawsweeper

clawsweeper Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 2:21 PM ET / 18:21 UTC.

ClawSweeper review

What this changes

The PR makes message CLI actions report top-level plugin payload failures consistently in terminal output, JSON, and process exit status.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open. Current main still converts plugin soft failures into CLI success; this PR repairs that shared outcome boundary across exit status, text, and JSON. The protected maintainer label routes landing through human handling.

Priority: P1
Reviewed head: 39f0e8a28b2557def9fcaed3c4644d1493486466

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused shared-boundary repair with concrete regression coverage and no identified correctness finding.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored PR is exempt from the external-contributor real-behavior-proof gate; its body supplies targeted regression-test evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored PR is exempt from the external-contributor real-behavior-proof gate; its body supplies targeted regression-test evidence.
Evidence reviewed 6 items Current-main defect: The current predicate treats every non-send, non-broadcast action as successful, so a plugin action payload of { ok: false } cannot affect CLI success.
Real producer contract: Plugin actions preserve the extracted tool payload, and Telegram deliberately returns soft { ok: false } results for rejected reactions and deletions.
Canonical repair: The proposed resolver preserves broadcast and core-delivery outcomes, ignores dry runs, and treats only a literal top-level payload.ok === false as a plugin-reported failure.
Findings None None.
Security None None.

Live Verification

Command: pnpm openclaw message --help

Result: PASS (completed)

$ node scripts/run-node.mjs message --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 104.28 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.7s
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 14.3s
[plugin-control-plane-loads] verified 36 built modules with native require and checked doctor closures
runtime-postbuild: 11 phases completed in 4294ms (slowest: built plugin control-plane loads 3555ms)
│
◇

OpenClaw 2026.8.1 (39f0e8a) — All your chats, one OpenClaw.

Usage: openclaw message [options] [command]

Send, read, and manage messages and channel actions

Options:
  -h, --help   Display help for command

Commands:
  ban          Ban a member
  broadcast    Broadcast a message to multiple targets
  channel      Channel actions
  delete       Delete a message
  edit         Edit a message
  emoji        Emoji actions
  event        Event actions
  kick         Kick a member
  member       Member actions
  permissions  Fetch channel permissions
  pin          Pin a message
  pins         List pinned 
… output truncated …

Assertions:

  • PASS expect_output: Usage: openclaw message

How this fits together

The message CLI dispatches sends, polls, and channel actions through the outbound action runner. Channel plugins return action payloads, which the CLI turns into human output, JSON, and an exit code for operators and scripts.

flowchart LR
A[CLI message action] --> B[Outbound action runner]
B --> C[Channel plugin result]
C --> D[Canonical outcome resolver]
D --> E[Terminal message]
D --> F[JSON envelope]
D --> G[Process exit status]
Loading

Before merge

  • Resolve merge risk (P1) - Production code is net +17 lines for a bug fix; the shared resolver is justified only if it remains the single place that combines core delivery status with the plugin payload contract.
  • Complete next step (P2) - No repair lane is needed: this is a coherent maintainer-owned fix; refresh the behind branch and use exact-head CI for the final merge gate.
Agent review details

Security

None.

PR surface

Source +17, Tests +139. Total +156 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 4 41 24 +17
Tests 3 139 0 +139
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 180 24 +156

Review metrics

Metric Value Why it matters
Production versus regression coverage production +17, tests +139 The added production normalization is shared by all three CLI result boundaries; the tests cover each boundary and the false-success shapes.

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. Decide the mitigation before merge
    Land one canonical outcome resolver after refreshing the branch and validating the exact head; keep core delivery statuses authoritative and preserve plugin payloads unchanged.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land one canonical outcome resolver after refreshing the branch and validating the exact head; keep core delivery statuses authoritative and preserve plugin payloads unchanged.

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

Yes—current main preserves plugin action payloads containing ok: false while its success predicate returns true for non-send actions; the supplied parser, formatter, and JSON regressions target that path.

Is this the best way to solve the issue?

Yes—the shared outcome resolver is the narrowest maintainable fix because the same result must govern CLI exit status, text output, and JSON output.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 1fec7b6ccd89.

Labels

Label changes:

  • add P1: A failed channel action can currently report success to operators and automation through the primary message CLI workflow.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR is exempt from the external-contributor real-behavior-proof gate; its body supplies targeted regression-test evidence.

Label justifications:

  • P1: A failed channel action can currently report success to operators and automation through the primary message CLI workflow.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR is exempt from the external-contributor real-behavior-proof gate; its body supplies targeted regression-test evidence.

Evidence

What I checked:

Likely related people:

  • Josh Avant: Introduced the current-main message-action result and success predicate in the originating shared surface. (role: introduced shared outcome behavior; confidence: high; commits: e6ed7e30cc5f; files: src/infra/outbound/message-action-contracts.ts, src/commands/message.ts, src/commands/message-format.ts)

Rank-up moves

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

  • Refresh onto current main and let exact-head CI validate the branch before landing.

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.

@steipete

Copy link
Copy Markdown
Contributor Author

Maintainer rank-up resolution: skipping the optional refresh onto current main because this branch remains mergeable, and its exact immutable head 39f0e8a28b2557def9fcaed3c4644d1493486466 already passed the complete required CI workflow (32998616042) and the repository-native preparation gates. Rebasing would discard verified exact-head evidence without fixing a conflict or actionable finding.

@steipete
steipete merged commit 061ac82 into main Aug 26, 2026
278 checks passed
@steipete
steipete deleted the codex/message-action-soft-failure-outcomes-20260826 branch August 26, 2026 18:55
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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 maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant