Skip to content

fix(cli): reject blank message channel selectors - #144802

Merged
obviyus merged 2 commits into
openclaw:mainfrom
ly85206559:fix/message-cli-blank-channel
Sep 11, 2026
Merged

obviyus merged 2 commits into
openclaw:mainfrom
ly85206559:fix/message-cli-blank-channel

Conversation

@ly85206559

@ly85206559 ly85206559 commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Closes #144795

What Problem This Solves

An explicit empty or whitespace-only --channel value was treated as omission. A shell command such as openclaw message send --channel "$CHANNEL" ... could therefore select the sole configured channel when the variable was empty.

Why This Change Was Made

The shared message option rejects blanks during argument parsing, before message-specific plugin loading and action startup. Omitted and nonblank selectors keep their existing routing. Shared programmatic optional-channel semantics are unchanged. Generic CLI bootstrap can still read configuration.

User Impact

Explicit blanks now fail with --channel must not be blank. Scripts that want automatic selection must omit the option. Maintainer scope accepts this documented malformed-input correction and the omission migration; the earlier compatibility review is preserved as history.

Evidence

Real compiled CLI proof used isolated normal setup, synthetic Discord/Slack configuration, numeric targets, and --dry-run --json.

Input Baseline Candidate
--channel "" Exit 0; unintended Discord selection Exit 1; blank-selector diagnostic
--channel " " Exit 0; unintended Discord selection Exit 1; blank-selector diagnostic
Omitted selector, sole Discord Exit 0; intended Discord target Same
discord or surrounding whitespace Exit 0; intended Discord target Same
Omission with no channels Normal no-channel error Same
Omission with Discord and Slack Normal ambiguity error Same
Supported Discord user-prefixed target Inferred Discord dry-run Preserved; explicit blanks reject
  • Baseline: d9ad56cbe319ac6ba1c106a27ab547c4d50c7f05.
  • Candidate runtime: CI merge 8a9feadbfd230b706daf99318d5a67e8a551d9fb, containing reviewed contributor head fc9d2efaaf02a8eefa91907c2b94db239d0c23b6. Independent source/artifact review verified the exercised message behavior and dependency contracts; the merge build is not relabeled as a contributor-head build.
  • Fresh independent behavior validation retained full argv, exits, stdout and stderr. It covers fresh/configured blank rejection, routing controls, strict accounts, help/required errors, and edit/delete/react/poll/pin/broadcast/administrative sibling commands. All observable clauses pass.
  • Focused candidate tests: 200 passed across 3 files (helpers.test.ts, register.message.test.ts, account-selector-boundary.test.ts). The exact two new regression cases fail on baseline for the intended missing-parser reason, then pass on candidate.
  • Changed-file formatting, syntax lint, boundary guards, line/assertion ratchets, documentation syntax, conflict and whitespace checks pass. Exact-head CI is green; full type checks remain hosted.
  • Contributor proof is retained: run 34583269047, job 103211516544.

Dry-run proves routing and validation, not delivery. Send output does not echo message text; complete input preserves it. Broadcast retains an unrelated aggregate dryRun: false reporting inconsistency on both builds while child results are dry runs; the selector change does not alter that path. Earlier review judgments and the contributor’s report of a superseded non-required Auto response HTTP 500 failure remain preserved as history; the current exact-head CI result was independently verified.

Original implementation and tests by @ly85206559. Maintainer validation was AI-assisted.

@clawsweeper

clawsweeper Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation cli CLI command changes size: XS labels Sep 11, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 11, 2026
@clawsweeper

clawsweeper Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 11, 2026, 5:35 AM ET / 09:35 UTC (Revision 3).

ClawSweeper review

What this changes

Rejects explicitly blank message-channel arguments before command execution, adds parser regression coverage, and documents how omission preserves automatic channel selection.

Merge readiness

⛔ Blocked before merge - 3 items remain

The fix remains necessary on current main, and no actionable patch defect was found. Real CLI evidence satisfies the earlier proof request; accepting the intentional compatibility change remains a maintainer choice.

Priority: P2
Reviewed head: fc9d2efaaf02a8eefa91907c2b94db239d0c23b6
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, correct repair with useful real CLI proof and no actionable code findings; compatibility acceptance remains separate from patch quality.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The inspected fork workflow exercises the real message CLI parser on the reviewed production source; the captured terminal receipt shows blank rejection in fresh and configured states and successful omitted/named Discord dry runs. Live transport calls are unnecessary for this argument-validation change.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The inspected fork workflow exercises the real message CLI parser on the reviewed production source; the captured terminal receipt shows blank rejection in fresh and configured states and successful omitted/named Discord dry runs. Live transport calls are unnecessary for this argument-validation change.
Evidence reviewed 8 items Introduced parser change: The pinned merge-base-to-head diff adds a blank-only argument parser to the shared message option. Nonblank values are returned unchanged, and omission does not invoke this parser.
Current main still accepts blank input: Fetched main registers --channel without an argument parser. Its outbound selection owner still selects the sole configured plugin after an empty channel normalizes away; the central repair is therefore still missing.
Latest release retains the old parser: The supplied latest release, v2026.9.4, also registers --channel without blank-value validation.
Findings None None.
Security None None.

How this fits together

The message CLI translates operator arguments into outbound channel actions. Its shared argument parser runs before channel-plugin loading and dispatch, while the existing selection owner resolves omitted channels from targets or configuration.

flowchart TD
  A[Message CLI arguments] --> B{Explicit blank channel?}
  B -->|Yes| C[Reject with CLI error]
  B -->|No| D[Existing channel selection]
  E[Target and configured channels] --> D
  D --> F[Dry-run result or outbound action]
Loading

Decision needed

Question Recommendation
Should explicitly blank --channel values become immediate errors, requiring existing scripts using empty values for automatic selection to omit the option? Accept blank-value rejection: Accept the documented script adjustment because an explicit empty selector should not silently choose an outbound channel.

Why: Fresh and configured-state proof establishes the behavior, but cannot decide whether the intentional change to existing scripts is acceptable.

Before merge

  • Resolve merge risk (P1) - Scripts that intentionally pass --channel "" to request automatic selection will stop after upgrade; maintainers must accept requiring those callers to omit the option.
  • Complete next step (P2) - Accept the documented behavior change for scripts passing an explicit blank --channel value, or specify a compatibility transition before merge.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.
Agent review details

Security

None.

PR surface

Source +11, Tests +19, Docs +4. Total +34 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 12 1 +11
Tests 1 19 0 +19
Docs 1 4 0 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 35 1 +34

Review metrics

Metric Value Why it matters
CLI behavior proof 7 cases across 2 setup states The receipt covers blank rejection and preserved automatic or explicit selection in a configured installation.

Merge-risk options

Maintainer options:

  1. Accept the documented script adjustment (recommended)
    Approve rejection of explicit blanks with the supplied fresh/configured-state proof and omission guidance.
  2. Pause for a compatibility transition
    Hold the PR if scripts using empty selectors require continued fallback support.

Technical review

Best possible solution:

Keep validation at the shared CLI parser, preserve omitted and nonblank selection, and explicitly accept the documented empty-variable compatibility change.

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

Yes, from source: current main forwards a blank --channel value into normalization and sole-configured-channel selection. The reviewer did not execute a failing baseline; contributor evidence demonstrates the repaired CLI behavior.

Is this the best way to solve the issue?

Yes, technically: the shared argument parser is the narrowest boundary that rejects malformed CLI input without changing programmatic optional-channel semantics. The intentional script compatibility change still needs acceptance.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 0b52dc467b3e.

Labels

Label justifications:

  • P2: This is a bounded CLI correction for unintended channel selection caused by empty script variables.
  • merge-risk: 🚨 compatibility: Previously accepted explicit blank selectors now fail, requiring affected scripts to omit the option.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The inspected fork workflow exercises the real message CLI parser on the reviewed production source; the captured terminal receipt shows blank rejection in fresh and configured states and successful omitted/named Discord dry runs. Live transport calls are unnecessary for this argument-validation change.
  • proof: sufficient: Contributor real behavior proof is sufficient. The inspected fork workflow exercises the real message CLI parser on the reviewed production source; the captured terminal receipt shows blank rejection in fresh and configured states and successful omitted/named Discord dry runs. Live transport calls are unnecessary for this argument-validation change.

Evidence

What I checked:

  • Introduced parser change: The pinned merge-base-to-head diff adds a blank-only argument parser to the shared message option. Nonblank values are returned unchanged, and omission does not invoke this parser. (src/cli/program/message/helpers.ts:70, fc9d2efaaf02)
  • Current main still accepts blank input: Fetched main registers --channel without an argument parser. Its outbound selection owner still selects the sole configured plugin after an empty channel normalizes away; the central repair is therefore still missing. (src/cli/program/message/helpers.ts:153, 0b52dc467b3e)
  • Latest release retains the old parser: The supplied latest release, v2026.9.4, also registers --channel without blank-value validation. (src/cli/program/message/helpers.ts:153, 3a9d69db306c)
  • Meaningful registered-command regression coverage: The added cases parse empty and whitespace-only selectors through the actual send-command registration and assert rejection before registry loading or message dispatch. Existing tests cover explicit selection, omitted selection, and target-prefix scoping. Tests were inspected, not executed during this read-only review. (src/cli/program/message/helpers.test.ts:229, fc9d2efaaf02)
  • Real CLI proof identity and execution: GitHub identifies https://github.com/ly85206559/openclaw/actions/runs/34583269047 as successful at this proof commit. Its sole parent is the reviewed head, and its only change is the proof workflow. The inspected workflow invokes pnpm openclaw message send in isolated fresh and configured states. The captured PR body supplies seven terminal outcomes, including four blank rejections and successful omitted/named Discord dry runs. Raw job-log retrieval was blocked by the artifact-host allowlist; the supplied receipt and inspected workflow remain sufficient for this parser change. (.github/workflows/proof-message-blank-channel-cli-after.yml, b4ffbda0282f)
  • Compatibility contract is documented: The added documentation distinguishes explicit blanks from omission and gives omission or a supported channel-prefixed target as the automatic-selection path. Existing scripts passing an empty variable intentionally will receive a nonzero exit instead. Public docs: docs/cli/message.md. (docs/cli/message.md:76, fc9d2efaaf02)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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 (2 earlier review cycles)
  • reviewed 2026-09-11T09:07:56.982Z sha 4a2fa98 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-11T09:26:03.422Z sha fc9d2ef :: blocked before merge. :: none

@ly85206559

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Real CLI proof is now linked in the PR Evidence for exact head fc9d2efaaf02a8eefa91907c2b94db239d0c23b6. It covers fresh and existing setups, blank/whitespace rejection, omitted-channel behavior, and explicit nonblank selection.

@clawsweeper

clawsweeper Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 11, 2026
@ly85206559

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The PR Evidence now includes the redacted real-CLI terminal receipt directly, in addition to the successful fork run/job links. Please re-check exact head fc9d2efaaf02a8eefa91907c2b94db239d0c23b6.

@clawsweeper

clawsweeper Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@obviyus obviyus self-assigned this Sep 11, 2026
@obviyus

obviyus commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

Maintainer decision: accept rejection of explicitly empty or whitespace-only --channel values. Scripts that intentionally request automatic selection must omit the option. This resolves the documented compatibility question for head fc9d2efaaf02a8eefa91907c2b94db239d0c23b6; it does not waive code, behavior, review, or CI gates. The PR body now records independent baseline/candidate CLI proof and preserved routing controls.

@obviyus
obviyus merged commit 227e7ae into openclaw:main Sep 11, 2026
217 of 219 checks passed
@obviyus

obviyus commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

Thanks @ly85206559! Merged as 227e7ae26af4e4f3f8a256c4fa808c7b046f4c88; your author credit is preserved. #144795 is closed.

Proof: 88 complete real-CLI captures, 200 focused tests, clean independent source/behavior review, clean exact-head ClawSweeper gate, and green exact-head CI. The two new regression cases fail on baseline for the intended reason and pass on candidate.

Before After
Explicit empty/whitespace --channel silently selected Discord Exit 1 with --channel must not be blank
Omitted and nonblank selectors used existing routing Same routing preserved

The shared option now rejects blanks before message-specific startup. Scripts that want automatic selection must omit the option. Fresh-state, multi-channel, prefix, sibling-command, account, help, and required-argument controls pass. Dry-run proves routing and validation, not delivery.

Baseline proof used d9ad56cbe319; candidate proof used CI merge 8a9feadbfd23 containing exact reviewed head fc9d2efaaf02, with source/artifact equivalence verified. The three landed files match the reviewed head.

vincentkoc added a commit that referenced this pull request Sep 11, 2026
Preserve the reviewed harness while incorporating the landed benchmark prerequisite.

Punchcard-Session: coral-orchard-orchard-d4

* commit '4407ed19ac63b1c1c84a0cfe6eb4bbeca9c2322c': (1196 commits)
  fix(perf): isolate benchmark subprocess transport (#144159)
  refactor(auth): await Copilot cache persistence (#144810)
  refactor(web-fetch): exercise URL normalization through the public tool (#144887)
  fix(ollama): preserve hosted subdomain model context (#144891)
  fix(doctor): explain Codex plugin health failures (#144813)
  fix(channels): honor pinned accounts in Mattermost model menus (#144880)
  fix(update): failed-update records hide the triggering error behind the excerpt tail (#144729)
  fix(logging): preserve OpenClaw package references in diagnostics (#144808)
  fix: retain plugin detail tab selections while inspection loads (#144647)
  fix: keep discovered models when sign-in tokens renew (#144861)
  fix(update): preserve local package overrides (#89985)
  fix(update): resolve compatibility bridges within the runtime graph (#144831)
  chore(i18n): refresh native locales (#144856)
  fix: preserve child signal termination during CLI respawn (#144838)
  fix(text): hide encoded MiniMax tool envelopes (#126307)
  fix(subagents): deliver child replies that match the empty placeholder (#130647)
  fix(cli): reject blank message channel selectors (#144802)
  fix(telegram): preserve mixed text order and pending stop (#144839)
  fix(memory): restore FTS fallback for same-name view collisions (#144783)
  chore(release): close out 2026.9.4 on main (#144708)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 12, 2026
Reject explicit empty or whitespace-only --channel values in the shared message CLI option parser before message-specific startup. Preserve omitted and nonblank selection, and document omission as the automatic-selection path for scripts.

Closes openclaw#144795.

Co-authored-by: Ayaan Zaidi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes docs Improvements or additions to documentation merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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.

fix(cli): reject blank message channel selectors before outbound actions

2 participants