Skip to content

fix(browser): reject unsupported buttons in click commands - #140976

Merged
obviyus merged 1 commit into
openclaw:mainfrom
WOLIKIMCHENG:fix/browser-cli-button-validation
Sep 8, 2026
Merged

obviyus merged 1 commit into
openclaw:mainfrom
WOLIKIMCHENG:fix/browser-cli-button-validation

Conversation

@WOLIKIMCHENG

@WOLIKIMCHENG WOLIKIMCHENG commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where openclaw browser click and click-coords send unsupported --button values to the Browser service instead of reporting an argument error immediately.

Why This Change Was Made

Both commands validate the existing option during Commander parsing. Valid values and omitted options keep their existing request bodies. Server validation remains in place for other clients.

User Impact

Unsupported buttons produce an immediate error that names left, right, and middle, with exit code 1 and no Browser request. Supported clicks continue to work.

Evidence

Tested the compiled CLI in an isolated Linux environment with a request recorder and a real Gateway, Chrome, and synthetic page.

Case Before After
Invalid button, both commands Browser request sent; server rejects it Exit 1 during option parsing; zero Browser requests
Empty, whitespace, mixed-case, near-match values Forwarded or normalized Rejected without dispatch
left, right, middle, omitted Existing request body and page events Same request body and page events
Target, ref, coordinates, double click, modifiers, delay, profile, timeout, output Existing behavior Preserved
Direct API request with invalid button Server rejects it Server still rejects it

Example after-fix output:

openclaw browser click e1 --button auxiliary
OpenClaw could not parse this command: option '--button <left|right|middle>' argument 'auxiliary' is invalid. --button must be left, right, or middle.
Try: openclaw browser click --help
exit: 1
Browser requests: 0

openclaw browser click-coords 30 40 --button auxiliary
OpenClaw could not parse this command: option '--button <left|right|middle>' argument 'auxiliary' is invalid. --button must be left, right, or middle.
Try: openclaw browser click-coords --help
exit: 1
Browser requests: 0

Baseline: 252158295ee487c4145404367fa15e3db588989b. Candidate: c3fb332dff1cd0b3ebf721b1bcc3971dd3ce8d91, using its CI test-merge artifact from 19e6a765d94182b6e2e8e7746523f1d1c841464a.

  • Focused tests: 16 passed, including both invalid-button cases and omitted-value controls.
  • Formatting and lint: passed for both changed files.
  • Exact-head CI: passed.
  • Regression check on current main: the two new invalid-button tests fail for the intended missing rejection; 14 controls pass.
  • Independent behavior validation: all 11 observable acceptance clauses pass, including varied inputs and real page events. Source-only absence claims remain covered by code review; fixture cleanup follows landing.

Validate --button during Commander parsing for click and click-coords.

Raise a recognized commander.invalidArgument error before dispatch while
preserving valid and omitted request bodies and server-side validation.
@clawsweeper

clawsweeper Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review in progress

ClawSweeper is reviewing this revision. This supersedes any previous blocked status.

View the workflow run.

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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 7, 2026
@clawsweeper

clawsweeper Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed September 7, 2026, 3:42 AM ET / 07:42 UTC.

ClawSweeper review

What this changes

The Browser CLI rejects unsupported mouse buttons locally for click and coordinate-click commands, with regression coverage for invalid and omitted values.

Merge readiness

⛔ Blocked before merge - 2 items remain

This remains a useful, focused improvement absent from current main and the latest release. No blocking correctness defect was found, but real CLI behavior proof is still required before merge.

Priority: P3
Reviewed head: c3fb332dff1cd0b3ebf721b1bcc3971dd3ce8d91

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The patch is focused and source-supported, but its evidence remains limited to mocked tests and static checks.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The changed Browser CLI parser is covered through mocked request-dispatch tests, but the supplied evidence does not show actual CLI error output and exit status after the fix for either command. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The changed Browser CLI parser is covered through mocked request-dispatch tests, but the supplied evidence does not show actual CLI error output and exit status after the fix for either command. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 7 items Verified introduced change: The merge-base-to-head diff adds one parser used by both click commands and focused tests; the host-verified test merge retains the same two-file scope.
Current-main necessity: Both commands still declare --button without a parser and forward its normalized string to the browser request. Server validation does not provide the proposed pre-dispatch CLI feedback.
Latest-release comparison: The supplied latest release, v2026.9.2, likewise has no button option parser on either command.
Findings None None.
Security None None.

How this fits together

The Browser CLI converts terminal commands into requests to OpenClaw’s browser service. Valid click requests reach browser automation; invalid button arguments now stop during command parsing.

flowchart TD
 A[Terminal click command] --> B[Parse button option]
 B --> C{Supported or omitted?}
 C -->|No| D[Argument error and exit]
 C -->|Yes| E[Browser service request]
 E --> F[Server validation]
 F --> G[Browser click]
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The changed Browser CLI parser is covered through mocked request-dispatch tests, but the supplied evidence does not show actual CLI error output and exit status after the fix for either command. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Complete next step (P2) - Add after-fix real CLI proof for both invalid-button paths and supported or omitted values. Terminal screenshots or a short recording are welcome; copied output and logs also count. Redact IP addresses, keys, phone numbers, private endpoints, and other private details. Updating the PR body should trigger review automatically; otherwise ask a maintainer to comment @clawsweeper re-review.
Agent review details

Security

None.

PR surface

Source +11, Tests +32. Total +43 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 13 2 +11
Tests 1 32 0 +32
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 45 2 +43

Review metrics

None.

Technical review

Best possible solution:

Keep validation at the CLI parsing boundary while preserving supported button values, omission semantics, and server-side validation for other clients.

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

Yes, from source: both current-main commands accept an arbitrary --button string and dispatch it before server rejection. No target code or tests were executed during this read-only review.

Is this the best way to solve the issue?

Yes, parsing the existing option before dispatch is a narrow repair, and the error shape matches Commander's implementation; no new API or configuration surface is needed.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 86a3c7267be4.

Labels

Label changes:

  • add P3: This improves CLI argument feedback for values already rejected by the browser service, with limited user impact.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The changed Browser CLI parser is covered through mocked request-dispatch tests, but the supplied evidence does not show actual CLI error output and exit status after the fix for either command. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Label justifications:

  • P3: This improves CLI argument feedback for values already rejected by the browser service, with limited user impact.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The changed Browser CLI parser is covered through mocked request-dispatch tests, but the supplied evidence does not show actual CLI error output and exit status after the fix for either command. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

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

  • Add a redacted real CLI transcript showing both invalid-button commands returning the normal argument error and exit code 1, plus successful supported or omitted-button behavior.

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.

@obviyus obviyus self-assigned this Sep 8, 2026
@obviyus
obviyus merged commit ef2a259 into openclaw:main Sep 8, 2026
105 checks passed
@obviyus

obviyus commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

Thanks @WOLIKIMCHENG!

Proof: The compiled Browser CLI was checked with a request recorder and a real isolated Gateway, Chrome, and synthetic page. Independent behavior validation passed all 11 observable clauses. All 16 focused tests, formatting, lint, and exact-head CI passed.

  • Bug: Unsupported mouse buttons reached the Browser service before rejection.
  • Fix: Both click commands reject invalid buttons during option parsing, before dispatch. Supported and omitted values retain their request bodies and real click behavior. Direct API validation remains effective.
Before After
Invalid click and click-coords send Browser requests and receive server errors Exit 1 with the allowed-button message and zero Browser requests
Supported and omitted values perform clicks Same page events, modifiers, coordinates, double-click behavior, and output

The original contributor commit was preserved. Full before/after command output and build identities are recorded in the PR description.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 8, 2026
…140976)

Reject unsupported mouse buttons during CLI option parsing for click and click-coords. Preserve supported and omitted request bodies and server-side validation.

Co-authored-by: WOLIKIMCHENG <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
vincentkoc added a commit to LiuwqGit/openclaw that referenced this pull request Sep 8, 2026
…1-prep

* commit 'da37d47920d102044a4cb33f8cd688b4abc3c2a6': (460 commits)
  refactor(memory): simplify built-in runtime delegation (openclaw#141847)
  refactor(comfy): remove unused cloud fixture input (openclaw#141844)
  fix(agents): keep canonical target casing for session-bound replies (openclaw#140418)
  fix(ci): hydrate release source ancestry through branch (openclaw#141840)
  fix(telemetry): include mixed-case configured providers (openclaw#141134)
  fix(qa): retain Slack presentation history (openclaw#127300)
  test(cli): compact argv case matrices (openclaw#141832)
  test(agents): compact code mode case matrices (openclaw#141831)
  test(gateway): compact control ui routing cases (openclaw#141834)
  test(reasoning): compact reasoning tag cases (openclaw#141833)
  fix(cli): keep progress spinners within terminal width (openclaw#141401)
  fix(release): provision native live harness dependencies (openclaw#141829)
  fix(cron): preserve prepared runtime and error ownership (openclaw#140941)
  fix(npm): recognize companion-owned runtime imports (openclaw#141647)
  fix(browser): reject unsupported buttons in click commands (openclaw#140976)
  refactor(gateway): keep cached turn replay with dedupe (openclaw#141824)
  fix(release): preserve frozen gateway package resolution (openclaw#141827)
  refactor: keep live image probe matching private (openclaw#141823)
  fix(browser): recover stale panel after stream disconnects (openclaw#141576)
  feat(cron): explain slow automation list requests (openclaw#141805)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: browser P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: XS status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants