Skip to content

fix(ui): keep IME composition Enter from applying the usage query - #195087

Merged
obviyus merged 2 commits into
openclaw:mainfrom
shuisadev:fix/bug-372-usage-query-ime-enter
Nov 8, 2026
Merged

obviyus merged 2 commits into
openclaw:mainfrom
shuisadev:fix/bug-372-usage-query-ime-enter

Conversation

@shuisadev

@shuisadev shuisadev commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The Usage query input handled every Enter as an explicit Apply action, including the Enter used to confirm an IME composition. That prevented native confirmation and could immediately refresh analytics with the composing draft.

Preserve SunnyShu's fix by wiring the input to the existing input-local IME owner, including composition-end, key-up and blur lifecycle handling. Enter belonging to composition is left to the browser; a plain deliberate Enter still applies the query.

This changes only Enter handling. The existing onInput draft update and 250 ms automatic-apply debounce are unchanged. Composition or its cancellation does not promise to pause draft filtering or prevent a later debounced refresh. No API, configuration, or storage changes.

Evidence

Exact-head runtime evidence: main twice and candidate twice, six scenes per run, with the built Control UI served by an isolated built Gateway and real Chromium CDP Input.imeSetComposition, Input.insertText, and trusted key events—not synthetic DOM composition events. Composition Enter, keyCode 229, and post-composition-end Enter no longer prevent default or trigger immediate analytics. Plain Enter and key-up/blur reset controls still apply once. Later automatic draft requests remain. This is browser-protocol composition proof, not a native operating-system IME certification.

Actual served gzip growth: startup 0 B, chat boot +1 B, combined +1 B; official performance report has no violations.

Before: composition Enter immediately applies the query.

Before: main applies the composing Usage query

After: composition Enter stays with the browser; the draft debounce is unchanged.

After: candidate does not immediately apply the composing Usage query

The 42-line test allocation is removed entirely. Existing reactive Usage fixtures are shared across three query tests while retaining their assertions and the IME regression: test delta 0, production +11/-0. The rendered-view regression fails on main (defaultPrevented unexpectedly true; 15 pass, 1 fail) and passes on the candidate (16 pass; 4.74 s wrapper wall time). Targeted formatting and lint pass. No shared ceiling or inherited-debt grant changes.

Two-way door: reverting restores the previous key handler, with no persisted-state migration. Blast radius is the Usage query input's Enter handling; the existing draft debounce and other inputs are untouched.

@clawsweeper

clawsweeper Bot commented Nov 8, 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.

@shuisadev
shuisadev force-pushed the fix/bug-372-usage-query-ime-enter branch from 300b11e to a1ced5a Compare November 8, 2026 07:08
Pressing Enter to confirm a Japanese or Chinese candidate applied the
half-composed draft as the usage filter and refreshed the overview. The
query input now uses the local IME owner: active composition, the keyCode
229 shim, and the WebKit compositionend grace all leave Enter to the
composer, while a deliberate Enter applies the filter as before.
@shuisadev
shuisadev force-pushed the fix/bug-372-usage-query-ime-enter branch from a1ced5a to 6e5dc8b Compare November 8, 2026 07:18
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. 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. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 8, 2026
@clawsweeper

clawsweeper Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

The Usage query input reuses the shared IME lifecycle guard so composition-confirming Enter does not explicitly apply the query.

Example: Confirm the Japanese draft 日本 with Enter in the Usage query input.

  • Before: Enter prevents native confirmation and immediately requests updated analytics.
  • After: Composition Enter remains with the browser; deliberate Enter still applies, and the existing 250 ms draft debounce remains active.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Focused, useful, and demonstrated through the shipped UI; no open findings or low-value added tests.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): Exact-head evidence exercises the built Gateway-served Usage UI in isolated Linux Chromium with trusted browser-protocol composition input, records immediate analytics requests, and verifies ordinary Enter plus key-up/blur recovery; inspected before/after screenshots corroborate the scenario, with native OS IME certification explicitly excluded.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Enter used to confirm composed text also applies the Usage query and prevents normal browser confirmation.
Reason: A narrow input fix restores native composition behavior using the established shared contract without changing query defaults or adding settings.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR fixes a current Usage input bug with no actionable findings. The earlier description finding is resolved; exact-head CI is still running.

Priority: P2
Reviewed head: 9166db8437832a8599224027b9ef12618135deed

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Control UI Usage input sends draft edits and explicit application actions to the Usage page state owner, which requests analytics from the Gateway.

flowchart LR
  A[Browser IME events] --> B[Usage query input]
  B --> C[Shared IME guard]
  C --> D[Explicit query application]
  B --> E[Draft debounce]
  D --> F[Usage page state]
  E --> F
  F --> G[Gateway analytics]
Loading

Technical review

Best possible solution:

Retain this focused integration of the shared IME owner and complete the existing exact-head CI gates.

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

Supplied repeated Chromium runs through a real Gateway reproduce the failure on main, and fetched-main source retains the responsible unconditional Enter handler; no target code was executed during this review.

Is this the best way to solve the issue?

This is the smallest complete fix: leave composition Enter to the browser by consuming the existing input-local guard and its retirement lifecycle, while preserving ordinary application and automatic draft filtering.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 60b66097c5a6.

Provenance checked

  • Usage query Enter handling changes intended behavior with a stated reason (11d0746: The mobile-controls refactor preserved explicit Enter application while sharing the query input between desktop and phone layouts; it does not establish the handler's original introduction.)
  • Shared composition lifecycle keeps the original intent (f48a9d3: Prevent composition-confirming keys from submitting inputs, including cleared WebKit composition flags, with bounded input-local state and key-up/blur retirement.)
  • Usage regression fixtures keeps the original intent (9ee09db: Consolidate repeated test setup while retaining distinct behavior assertions; this patch extends that fixture and preserves the affected assertions.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Vyctor H. Brzezowski: Raw commit 11d0746 adds ui/src/pages/usage/view-controls.tsx:232 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 11d0746f524a; files: ui/src/pages/usage/view-controls.tsx)
  • Peter Steinberger: Raw commit 9ee09db adds ui/src/pages/usage/view.test.ts:32 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 9ee09dbaba4a; files: ui/src/pages/usage/view.test.ts)
  • NianJiu: Raw commit f48a9d3 adds ui/src/lib/ime.ts:15 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: f48a9d33104d; files: ui/src/lib/ime.ts)

PR surface

Source +11, Tests 0. Total +11 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 11 0 +11
Tests 1 42 42 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 53 42 +11

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Production versus test LOC Production +11/-0; tests +42/-42 The necessary lifecycle bindings reuse an existing owner; shared fixtures accommodate the regression without net test growth.

Labels

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: A bounded Usage input defect interrupts IME confirmation and causes unintended immediate analytics refreshes.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-11-08T07:34:53.968Z sha 6e5dc8b :: blocked before merge. :: [P3] Limit the cancellation guarantee to the behavior this patch changes

Reviewed November 8, 2026, 3:11 AM ET / 08:11 UTC (Revision 2).

@obviyus

obviyus commented Nov 8, 2026

Copy link
Copy Markdown
Collaborator

Exact-head Usage IME proof

Candidate: 9166db8437832a8599224027b9ef12618135deed; main: 86509d34366e6581c4add299feffda8c3d46aa3c. SunnyShu's contributor commit is preserved.

Built both the Gateway and Control UI separately in secretless Node 24.22.1 Docker. The real Gateway served its matching built UI to real Linux Chromium. Each run used its own profile, home, configuration, and state. No mocked WebSocket, injected key handler, fake timer, or synthetic DOM composition event was used. Browser input came through CDP Input.imeSetComposition, Input.insertText, and Input.dispatchKeyEvent; recorded Enter events were trusted.

Main twice and candidate twice, six scenes per run. The table separates Enter's immediate effect from the unchanged automatic draft application:

Ref/run Scene isComposing / keyCode defaultPrevented Immediate sessions.usage requests
base 1 composing true / 13 true 1
base 1 229 true / 229 true 1
base 1 post-end false / 13 true 1
base 1 reset-keyup false / 13 true 1
base 1 reset-blur false / 13 true 1
base 1 plain false / 13 true 1
base 2 composing true / 13 true 1
base 2 229 true / 229 true 1
base 2 post-end false / 13 true 1
base 2 reset-keyup false / 13 true 1
base 2 reset-blur false / 13 true 1
base 2 plain false / 13 true 1
candidate 1 composing true / 13 false 0
candidate 1 229 true / 229 false 0
candidate 1 post-end false / 13 false 0
candidate 1 reset-keyup false / 13 true 1
candidate 1 reset-blur false / 13 true 1
candidate 1 plain false / 13 true 1
candidate 2 composing true / 13 false 0
candidate 2 229 true / 229 false 0
candidate 2 post-end false / 13 false 0
candidate 2 reset-keyup false / 13 true 1
candidate 2 reset-blur false / 13 true 1
candidate 2 plain false / 13 true 1

The active-composition and keyCode 229 Enter cases, and Enter immediately following compositionend with cleared composition flags, were intercepted and applied analytics on main. The candidate left them to the browser and sent no immediate analytics request. Plain Enter, key-up retirement, and blur retirement still applied exactly once on both refs. After the observation window, the candidate still issued the later automatic draft request: the existing 250 ms debounce is unchanged, not paused or disabled by this fix. No cancellation-safe filtering guarantee is claimed.

Real gzip sizes from the official performance report over those exact dist trees:

Graph Main Candidate Delta
Startup JS 91494 B 91494 B 0 B
Chat boot JS 1304533 B 1304534 B 1 B

Combined actual served gzip delta: 1 B, within 600 B. Generated-hash-normalized limits are recorded separately in the retained official report.

The 42-line allocation was removed entirely. Test delta is 0 (+42/-42), production +11/-0. Shared the existing reactive Usage fixture across query tests without removing their assertions. The retained IME regression fails on main at composed.defaultPrevented (15 pass, 1 fail) and passes on the candidate (16 pass, 4.74 s wrapper wall time). Targeted formatting and lint of both changed UI files passed (0 warnings, 0 errors). No shared test ceiling change.

The attached screenshots are from this Usage proof, replacing the unrelated toolbar imagery previously referenced. Raw before: usage-ime-base-1-N2ldYq/composing.png; raw after: usage-ime-candidate-1-CL8Uus/composing.png. Inspected for the real Usage query, native composition highlight, and absence of private content. The count label and request trace—not a fabricated visual indicator—distinguish immediate query application.

Proof limits: browser-protocol IME lifecycle, not a native OS IME certification; fresh empty analytics data from the real isolated Gateway, not a live-account data claim. No Telegram or provider behavior claims.

Retained local evidence: ~/Developer/.agents/handoffs/openclaw-bugloop/proofs/195087/ (prove.mjs, four successful result directories, summary.json, performance.json, main-regression-linked.log, focused check logs). Replay by extracting the two pinned refs into the task Docker image, installing/building each there with matching Gateway/UI build IDs, and invoking node --import /<ref>/scripts/tsx.mjs /proof/prove.mjs <base|candidate> <1|2>.

Before: main intercepts trusted composition Enter and immediately applies the Usage query

After: candidate leaves trusted composition Enter to the browser without immediate query application

@obviyus

obviyus commented Nov 8, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 8, 2026
@obviyus
obviyus merged commit 517dfd4 into openclaw:main Nov 8, 2026
106 of 110 checks passed
@obviyus

obviyus commented Nov 8, 2026

Copy link
Copy Markdown
Collaborator

Landed in 517dfd4. Thanks @shuisadev. IME composition Enter no longer applies the Usage query early.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 9, 2026
…enclaw#195087)

fix(ui): let IME composition Enter through in the Usage query field

The Usage query field caught every Enter key and applied the query at once, including the Enter that confirms IME composition (isComposing, keyCode 229, and the Enter right after compositionend). CJK input therefore applied an unfinished query. Those composition Enters now go to the browser. A plain Enter, and the key-up and blur paths, still apply the query once, and the existing 250 ms draft debounce is unchanged.

Evidence: built Gateway and Control UI in real Linux Chromium, with input sent through CDP Input.imeSetComposition, insertText and dispatchKeyEvent (trusted events, no synthetic DOM composition). Run twice on main and twice with this change, six scenes per run. Main sent an immediate sessions.usage request for each composition Enter; this change sends none for them. Plain Enter, key-up and blur each send exactly one request on both versions. Gzip growth: startup +0 B, chat boot +1 B. Before and after screenshots and the full table: openclaw#195087 (comment).

![Before](https://github.com/user-attachments/assets/c90a39e4-7d77-4c3d-9fe9-ed819015eab0)
![After](https://github.com/user-attachments/assets/1390b11a-a8f3-4a43-b6f4-85d7cec069ea)

Thanks @shuisadev.

Co-authored-by: SunnyShu <[email protected]>
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

app: web-ui App: web-ui P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: S 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.

3 participants