Skip to content

fix(browser): accept common keyboard aliases - #130401

Merged
steipete merged 3 commits into
mainfrom
codex/issue-130208
Aug 26, 2026
Merged

steipete merged 3 commits into
mainfrom
codex/issue-130208

Conversation

@steipete

@steipete steipete commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #130208. Thanks @geekforlife for the reproduction.

What Problem This Solves

Fixes an issue where browser automation using common keyboard names such as Esc fails instead of dispatching a key, while the tool schema gives the model no accepted-name guidance. The same request fails from the CLI, independently of the model.

Why This Change Was Made

Normalize the five documented aliases (Esc, Return, Del, Ctrl, Cmd) once at the shared browser action boundary, before Playwright or Chrome MCP dispatch. Nested batches use the same normalizer. Preserve printable-key case, literal + chords, unknown names, and backend-specific keys such as Playwright's ControlOrMeta.

Backend-only changes would duplicate policy; schema-only guidance would leave CLI aliases broken.

Describe the contract in both nested and flattened tool arguments and the CLI docs. Shorten existing tab-reference prose without removing accepted references: after the actual OpenAI normalization and JSON projection, schemas remain 4,995 bytes (default) and 4,915 bytes (tab-bound). Codex strips parameter descriptions above 5,000 bytes, so the regression test checks the real projection rather than the smaller raw schema.

Maintainer authorization explicitly permits this focused repair despite the issue's automated triage hold; its labels are unchanged. AI-assisted implementation and review.

User Impact

Common keyboard aliases work through browser tool, CLI, and supported batch paths. Canonical names and existing key semantics remain unchanged. No configuration, dependencies, protocol, authentication, or persistent state changes.

Evidence

Verified head: 1dd4dbd22865a5096d535f3d853b4af7146da9e4 (SSH-signed). Exact-head full CI and Workflow Sanity passed, including production types, test types, and openclaw/ci-gate. The normal merge of main de790ddc87e6e65688d2883f8674099fd665ac90 preserves #130410's exact select-option values and inlined action-kind validation while retaining the shared keyboard aliases. Both conflicting files were resolved and the combined behavior was reverified.

  • Real isolated Chrome 151.0.7922.174 through authenticated production HTTP /act: before the fix, Esc returns 500 with no DOM key event while Escape returns 200 with an Escape keydown. Afterward both produce the same successful event.
  • Playwright 1.62.1: 15 observed cases cover every alias, modifier chords, case-sensitive letters, literal +, ControlOrMeta, nested batches, and unknown-key failure without an event.
  • Chrome MCP 1.8.0: 13 observed cases exercise its real subprocess/backend and the same key/modifier outcomes. This isolated explicit-loopback-CDP profile uses the documented trusted-private-network opt-in; production policy and the operator's browser/config were not changed. Owned browser processes, listeners, and temporary profiles were cleaned up.
  • Original four-suite reproduction: 11 failures with the unchanged baseline normalizer, then 102 passing tests with the repair. After merging the select-value fix, all six keyboard/select suites pass (166 tests), including empty and whitespace-preserving select values on both backends and nested batches. The actual projected-schema regression separately fails at 5,037 bytes before prose compression and passes at 4,995/4,915 afterward.
  • Direct dependency inspection: Playwright's keyboard parser, Chrome MCP's parseKey and press_key, the OpenClaw Codex schema projection, and Codex's json_schema.rs description-compaction contract.
  • The original repair passed extension production/test types, scoped lint, formatting, and changed-file checks. Fresh combined scoped lint passes. Broad combined types failed locally because shared dependencies lack main's newly added IMAP packages (mailauth, mailparser, imapflow), with derivative IMAP typing errors and no browser diagnostics. IMAP sources are unchanged from main and outside this diff; shared dependencies were not modified or errors hidden. Both complete hosted typechecks now pass on this exact head, closing that environmental gap. Earlier local validation caught and corrected a test descriptor typing error and an over-limit test file; the two press requests share the full dispatch assertion without dropping coverage.
  • Two independent source/live reviews, mandatory Codex autoreview, and a separate fresh Codex challenge review completed with no remaining actionable findings. The CLI reviewers did not run tests; executed evidence is recorded above.

Focused command:

node scripts/run-vitest.mjs extensions/browser/src/browser/routes/agent.act.normalize.test.ts extensions/browser/src/browser-tool.schema.test.ts extensions/browser/src/browser/routes/agent.act.existing-session-navigation-guard.test.ts extensions/browser/src/browser/server.agent-contract-core.test.ts extensions/browser/src/browser/routes/agent.existing-session.test.ts extensions/browser/src/browser/server.agent-contract-form-layout-act-commands.test.ts

Production LOC: +19/-3 (net +16); tests: +107/-15 (net +92, including reused dispatch assertions); docs/changelog: +3/-0. The finite alias table adds one shared conversion, with no duplicated backend policy or new production helper/export.

The maintainer-authorized one-line Unreleased changelog entry credits the reporter. This closeout uses the repository's supported per-PR changelog allowance; no release version, tag, or publication changes are included.

Latest ClawSweeper review disposition (reviewed 9eabdaf): changelog removal is intentionally skipped under the explicit maintainer closeout authorization above. The requested current-main and Codex checks were completed directly: main's normalizer remains alias-pass-through, its select-value repair is preserved by the merge, and Codex's codex-rs/tools/src/json_schema.rs:196-253,473-600 confirms normalization before the 5,000-byte description-compaction threshold. The actual pipeline regression and fresh six-suite/browser evidence above close that source-access gap. The production increase is accepted for the finite alias capability: existing string coercion does not implement key aliases, no redundant key-normalization path exists to absorb it, and deleting independent action validation would lose behavior. One table plus the existing owner's inline conversion is smaller and clearer than backend duplication or a general key validator; main's unrelated obsolete action-kind helper stays deleted.

Review suggestion intentionally not implemented: exhaustive unknown-key validation or a shared accepted-name rejection hint. The backends accept different key sets, so imposing one validator would reject existing valid inputs or duplicate dependency policy. The schema now supplies corrective guidance; existing backend errors and broader error-redaction behavior remain unchanged.

Broader error handling/redaction in #130209 remains deferred and is not part of this repair.

Follow-up identified during dependency inspection: Playwright's existing invalid modifier-chord error path lacks the cleanup used by Chrome MCP. This patch does not claim to repair that separate dependency behavior.

@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 docs Improvements or additions to documentation extensions: browser size: S maintainer Maintainer-authored PR labels Aug 26, 2026
@steipete
steipete marked this pull request as ready for review August 26, 2026 20:52
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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 26, 2026
@clawsweeper

clawsweeper Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed August 26, 2026, 6:00 PM ET / 22:00 UTC.

ClawSweeper review

What this changes

The PR normalizes five common keyboard aliases before browser dispatch, documents the accepted names, and adds regression coverage for both browser backends.

Regression provenance

Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep open. The shared-boundary alias repair is coherent, but the prior blocker remains: this normal PR still edits release-owned CHANGELOG.md. Current-main and direct Codex-source comparison were unavailable in this read-only checkout.

Priority: P2
Reviewed head: 1dd4dbd22865a5096d535f3d853b4af7146da9e4

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Reported runtime evidence supports a focused repair, but the release-owned changelog edit remains a blocking patch defect.
Proof confidence 🦞 diamond lobster (5/6) Not applicable: The PR is maintainer-authored and exempt from the external-contributor proof gate; its body nevertheless reports isolated Chrome, Playwright, and Chrome-MCP after-fix evidence.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The PR is maintainer-authored and exempt from the external-contributor proof gate; its body nevertheless reports isolated Chrome, Playwright, and Chrome-MCP after-fix evidence.
Evidence reviewed 7 items Persisting prior blocker: The previous completed ClawSweeper review requested removal of the release-owned changelog entry; the current head still contains it.
Repository policy: Root policy reserves CHANGELOG.md for release generation and requires normal PRs to carry user-visible release context in the PR body or squash message.
Owner-boundary implementation: The alias table is applied by normalizeActRequest before route dispatch; nested batch actions re-enter the same normalizer.
Findings 1 actionable finding [P2] Remove the release-owned changelog entry
Security None None.

How this fits together

Browser tool and CLI actions enter the browser plugin's shared request normalizer before dispatch to Playwright or Chrome MCP. The backend then performs the browser operation and returns its result to the caller.

flowchart LR
  A[Tool or CLI request] --> B[Browser action route]
  B --> C[Shared request normalizer]
  C --> D{Keyboard press}
  D -->|Alias| E[Canonical key name]
  D -->|Other action| F[Existing action]
  E --> G[Playwright or Chrome MCP]
  F --> G
  G --> H[Browser result]
Loading

Before merge

  • Remove the release-owned changelog entry (P2) - CHANGELOG.md is reserved for release generation, while this PR already supplies the required user-visible release context in its body. This repeats the previous review finding and should be removed before merge.
  • Resolve merge risk (P1) - The release-owned changelog entry conflicts with the repository release workflow.
  • Resolve merge risk (P1) - Exact current-main and direct Codex dependency-source verification remain unavailable until repository access is restored.
  • Complete next step (P2) - A maintainer-labeled, maintainer-authored PR needs human handling; the concrete required correction is removal of the release-owned changelog entry.

Findings

  • [P2] Remove the release-owned changelog entry — CHANGELOG.md:409
Agent review details

Security

None.

PR surface

Source +16, Tests +92, Docs +3. Total +111 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 2 19 3 +16
Tests 4 107 15 +92
Docs 2 3 0 +3
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 129 18 +111

Review metrics

Metric Value Why it matters
Production versus test delta production +16 net; tests +92 net; docs/changelog +3 The implementation growth is concentrated in the shared alias conversion; the changelog addition is the blocking non-runtime change.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #130208
Summary: This PR is the candidate repair for the keyboard-alias and schema-guidance report; the redaction report is separate.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Restore release ownership (recommended)
    Remove the normal-PR CHANGELOG.md entry while preserving the existing PR-body release context, then let exact-head CI complete.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Remove CHANGELOG.md from this normal PR; preserve the PR-body release context.

Technical review

Best possible solution:

Remove the changelog entry, retain the browser repair and PR-body release context, then recheck the exact head against current main and green CI.

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

No high-confidence current-main execution was available in this checkout; the route-to-normalizer-to-backend path is source-reproducible and the PR body reports isolated after-fix runs.

Is this the best way to solve the issue?

Yes for the keyboard behavior: normalizing at the shared action boundary covers both supported backends and nested batches without duplicating backend policy. The changelog edit is not part of that solution.

Full review comments:

  • [P2] Remove the release-owned changelog entry — CHANGELOG.md:409
    CHANGELOG.md is reserved for release generation, while this PR already supplies the required user-visible release context in its body. This repeats the previous review finding and should be removed before merge.
    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 99a2434f7b89.

Labels

Label changes:

  • add merge-risk: 🚨 other: Merging a normal-PR edit to the release-owned changelog bypasses the repository's release-generation ownership.

Label justifications:

  • P2: The PR repairs a bounded browser automation defect but needs one concrete pre-merge correction.
  • merge-risk: 🚨 other: Merging a normal-PR edit to the release-owned changelog bypasses the repository's release-generation ownership.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: The PR is maintainer-authored and exempt from the external-contributor proof gate; its body nevertheless reports isolated Chrome, Playwright, and Chrome-MCP after-fix evidence.

Evidence

What I checked:

Likely related people:

  • steipete: Authored the current alias-map lines and multiple preceding normalizer changes. (role: recent area contributor; confidence: high; commits: 1dd4dbd22865, 915f88a0a3ed, cec50aa047ac; files: extensions/browser/src/browser/routes/agent.act.normalize.ts)
  • wanyongstar: Introduced the batch-depth normalizer contract traversed by nested alias requests. (role: adjacent feature contributor; confidence: medium; commits: 9c3e4ce43143; files: extensions/browser/src/browser/routes/agent.act.normalize.ts)

Rank-up moves

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

  • Remove the CHANGELOG.md entry and confirm exact-head CI plus current-main/Codex contract checks when access is available.

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-26T21:18:20.400Z sha 9eabdaf :: found issues before merge. :: [P2] Remove the release-owned changelog entry

@steipete

Copy link
Copy Markdown
Contributor Author

Disposition of the latest substantive review:

The changelog-removal recommendation is intentionally skipped: explicit maintainer direction requires this PR's one-line user-facing changelog closeout, using the repository's supported allowance. No version, tag, release, or publication is changed.

The production increase (+19/-3, net +16) implements the finite five-alias capability and model guidance at the shared owner. Existing string coercion has no alias policy or redundant helper to absorb it. One Map and inline conversion serve both backends and nested batches; the map also avoids prototype-property lookup corruption. Backend-specific copies duplicate policy, frontend-only guidance leaves CLI calls broken, and removing aliases leaves the reported bug. No unrelated validation was deleted to offset the count.

I personally rechecked the combined normalizer: main's exact select values, inlined kind validation, and removed obsolete helper remain intact. I also directly inspected the installed Playwright 1.62.1 and Chrome MCP 1.8.0 keyboard parsers/dispatch contracts, plus Codex's codex-rs/tools/src/json_schema.rs (196–253 and 473–600) and dynamic_tool.rs (5–12), rather than inferring its behavior from OpenClaw's schema. The actual normalization/projection regression fails at 5,037 bytes before compression and passes at 4,995/4,915 with both descriptions retained.

The refreshed combined proof passes 166 tests across six keyboard/select suites, 15 real Playwright cases, and 13 real Chrome MCP cases through authenticated production HTTP /act, with observed key/modifier events and owned-resource cleanup. Both independent source/live reviews and the two fresh Codex review passes are clean. Scoped lint passes. Broad local types still report missing main-only IMAP dependencies; new-head hosted CI, including full types, is pending and must pass before landing. Earlier-head green is not a substitute.

@clawsweeper clawsweeper Bot added the merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. label Aug 26, 2026
@steipete
steipete merged commit 0e05d82 into main Aug 26, 2026
140 checks passed
@steipete
steipete deleted the codex/issue-130208 branch August 26, 2026 22:12
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Aug 26, 2026
* origin/main: (275 commits)
  fix(ai): require explicit compatible-provider endpoints (#130453)
  test(control-ui): guard the hand-mirrored theme --bg copies (#130444)
  fix(onboard): preserve the saved skills package manager (#130438)
  improve(worker): diagnose admission-deadline failures and widen daemon revalidation budget (#130435)
  fix(plugins): align diffs external install metadata (#130362)
  refactor(models): consolidate config normalization (#130439)
  fix(browser): accept common keyboard aliases (#130401)
  fix(release): refresh IMAP plugin baselines (#130351)
  fix(tests): type sticky model agent fixtures (#130441)
  fix(qa): track current Slack progress cards (#130354)
  feat(ui): refine the mobile composer (#130308)
  fix(ui): clarify gateway disconnect status in tab title (#130364)
  test(qa): await gateway startup before network probes (#130353)
  fix(qa): run Buzz profile scenarios with pooled credentials (#130316)
  fix(crabbox): keep the setup failure reason and name its phase (#130425)
  fix: dashboard tools target the wrong Gateway after admission (#130112)
  fix(ui): distinguish inherited model defaults from session pins (#120805)
  feat(feishu): let agents resend received stickers (#130374)
  refactor(models): prepare selection policy once (#130413)
  fix(ui): make dashboard side panels enter split view (#130426)
  ...

# Conflicts:
#	test/scripts/docker-build-helper.test.ts
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 27, 2026
* fix(browser): accept common keyboard aliases

* docs(browser): note keyboard alias repair
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation extensions: browser maintainer Maintainer-authored PR merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S 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.

browser act press: key has no schema description and common aliases (e.g. "Esc") fail with a raw Playwright error — normalize aliases

1 participant