openclaw/src
Vincent Koc f59b2b1db3
fix(browser): normalize batch act dispatch for selector and batch support (#45457)
* feat(browser): add batch actions, CSS selector support, and click delayMs

Adds three improvements to the browser act tool:

1. CSS selector support: All element-targeting actions (click, type,
   hover, drag, scrollIntoView, select) now accept an optional
   'selector' parameter alongside 'ref'. When selector is provided,
   Playwright's page.locator() is used directly, skipping the need
   for a snapshot to obtain refs. This reduces roundtrips for agents
   that already know the DOM structure.

2. Click delay (delayMs): The click action now accepts an optional
   'delayMs' parameter. When set, the element is hovered first, then
   after the specified delay, clicked. This enables human-like
   hover-before-click in a single tool call instead of three
   (hover + wait + click).

3. Batch actions: New 'batch' action kind that accepts an array of
   actions to execute sequentially in a single tool call. Supports
   'stopOnError' (default true) to control whether execution halts
   on first failure. Results are returned as an array. This eliminates
   the AI inference roundtrip between each action, dramatically
   reducing latency and token cost for multi-step flows.

Addresses: #44431, #38844

* fix(browser): address security review — batch evaluateEnabled guard, input validation, recursion limit

Fixes all 4 issues raised by Greptile review:

1. Security: batch actions now respect evaluateEnabled flag.
   executeSingleAction and batchViaPlaywright accept evaluateEnabled
   param. evaluate and wait-with-fn inside batches are rejected
   when evaluateEnabled=false, matching the direct route guards.

2. Security: batch input validation. Each action in body.actions
   is validated as a plain object with a known kind string before
   dispatch. Applies same normalization as direct action handlers.

3. Perf: SELECTOR_ALLOWED_KINDS moved to module scope as a
   ReadonlySet<string> constant (was re-created on every request).

4. Security: max batch nesting depth of 5. Nested batch actions
   track depth and throw if MAX_BATCH_DEPTH exceeded, preventing
   call stack exhaustion from crafted payloads.

* fix(browser): normalize batch act dispatch

* fix(browser): tighten existing-session act typing

* fix(browser): preserve batch type text

* fix(browser): complete batch action execution

* test(browser): cover batch route normalization

* test(browser): cover batch interaction dispatch

* fix(browser): bound batch route action inputs

* fix(browser): harden batch interaction limits

* test(browser): cover batch security guardrails

---------

Co-authored-by: Diwakar <diwakarrankawat@gmail.com>
2026-03-13 15:10:55 -07:00
..
acp test: dedupe acp translator cancel scoping tests 2026-03-13 21:40:53 +00:00
agents refactor: share snake case param lookup 2026-03-13 21:40:53 +00:00
auto-reply refactor: share session conversation normalization 2026-03-13 21:40:53 +00:00
browser fix(browser): normalize batch act dispatch for selector and batch support (#45457) 2026-03-13 15:10:55 -07:00
canvas-host
channels Slack: add opt-in interactive reply directives (#44607) 2026-03-13 14:08:04 -07:00
cli Guard updater service refresh against missing invocation cwd (#45486) 2026-03-13 18:09:01 -04:00
commands fix: clear typecheck backlog 2026-03-13 22:09:06 +00:00
compat
config refactor: dedupe home relative path resolution 2026-03-13 21:40:53 +00:00
context-engine feat(context-engine): plumb sessionKey into all ContextEngine methods (#44157) 2026-03-12 12:43:36 -07:00
cron test: share cron run fallback helpers 2026-03-13 21:40:53 +00:00
daemon [codex] Polish sidebar status, agent skills, and chat rendering (#45451) 2026-03-13 16:53:40 -05:00
discord test: share discord auto presence assertions 2026-03-13 21:40:53 +00:00
docs
gateway test: dedupe cron config setup 2026-03-13 21:40:53 +00:00
hooks test: stabilize hooks loader log assertion on Windows 2026-03-13 02:17:00 +00:00
i18n
imessage refactor: share imessage inbound test fixtures 2026-03-13 16:51:59 +00:00
infra fix: tighten executable path coverage 2026-03-13 22:07:14 +00:00
line test: fix CI type regressions 2026-03-13 19:53:40 +00:00
link-understanding
logging refactor: share logging console spies 2026-03-13 20:19:39 +00:00
markdown
media refactor: share exec approval session target routing 2026-03-13 20:19:39 +00:00
media-understanding
memory test: share memory search manager fixtures 2026-03-13 21:40:54 +00:00
node-host fix: clear typecheck backlog 2026-03-13 22:09:06 +00:00
pairing refactor: clarify pairing setup auth labels 2026-03-12 22:46:28 +00:00
plugin-sdk test: cover plugin-sdk subpath imports 2026-03-13 22:09:06 +00:00
plugins refactor: share plugin temp dir helpers 2026-03-13 20:19:39 +00:00
process fix(windows): add windowsHide to detached spawn calls to suppress console windows (#44693) 2026-03-13 21:06:33 +00:00
providers
routing
scripts ci: speed up scoped workflow lanes 2026-03-13 19:53:40 +00:00
secrets refactor: share secrets audit model fixtures 2026-03-13 20:37:53 +00:00
security fix: harden external content marker sanitization 2026-03-13 20:28:45 +00:00
sessions Gateway: harden custom session-store discovery (#44176) 2026-03-12 16:44:46 +00:00
shared fix: tighten shared chat envelope coverage 2026-03-13 22:00:22 +00:00
signal
slack fix: clear typecheck backlog 2026-03-13 22:09:06 +00:00
telegram [codex] Polish sidebar status, agent skills, and chat rendering (#45451) 2026-03-13 16:53:40 -05:00
terminal fix(terminal): sanitize skills JSON and fallback on legacy Windows (#43520) 2026-03-11 19:53:07 -04:00
test-helpers refactor: share cron and ollama test helpers 2026-03-13 20:19:39 +00:00
test-utils test: fix CI type regressions 2026-03-13 19:53:40 +00:00
tts refactor: share migration and tts test helpers 2026-03-13 20:19:38 +00:00
tui test: resolve rebase conflicts in gateway coverage 2026-03-13 01:38:19 +00:00
types
utils
web fix(whatsapp): trim leading whitespace in direct outbound sends (#43539) 2026-03-12 11:32:04 +11:00
whatsapp
wizard fix: avoid ineffective dynamic imports 2026-03-13 01:33:37 +00:00
channel-web.ts
docker-build-cache.test.ts
docker-image-digests.test.ts
docker-setup.e2e.test.ts test: reduce docker setup e2e duplication 2026-03-13 21:40:53 +00:00
dockerfile.test.ts build: default to Node 24 and keep Node 22 compat 2026-03-12 20:07:44 +05:30
entry.ts
entry.version-fast-path.test.ts
extensionAPI.ts
globals.ts
index.ts
install-sh-version.test.ts chore: bump version to 2026.3.10 2026-03-11 23:29:53 +00:00
logger.test.ts
logger.ts
logging.ts
param-key.ts refactor: share snake case param lookup 2026-03-13 21:40:53 +00:00
poll-params.test.ts
poll-params.ts refactor: share snake case param lookup 2026-03-13 21:40:53 +00:00
polls.test.ts
polls.ts
runtime.ts
utils.test.ts test(utils): await temp dir cleanup in async tests 2026-03-13 04:38:46 +00:00
utils.ts refactor: dedupe home relative path resolution 2026-03-13 21:40:53 +00:00
version.test.ts
version.ts