Skip to content

fix(ui): guard personal session group search Enter submit during IME composition - #195983

Merged
obviyus merged 5 commits into
openclaw:mainfrom
SunnyShu0925:fix/session-group-search-ime-guard-341
Nov 9, 2026
Merged

obviyus merged 5 commits into
openclaw:mainfrom
SunnyShu0925:fix/session-group-search-ime-guard-341

Conversation

@SunnyShu0925

@SunnyShu0925 SunnyShu0925 commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

In the personal section editor's Search sessions box, pressing Enter while an IME composition was pending submitted the enclosing <form>: the dialog closed mid-composition and the typed query was lost instead of filtering the list.

The search input's keydown handler returned early on event.isComposing before the Enter → preventDefault() guard ran, so a committing Enter reached <form onSubmit> → props.options.submit({ label, sessionKeys }) in ui/src/components/personal-session-group-dialog-view.tsx.

The fix reuses the repository's shared guard, isComposingKeyboardEvent (ui/src/lib/ime.ts), which a dozen sibling components already own:

  • Enter: preventDefault() unconditionally, so a committing Enter never submits; the input method receives the key.
  • Escape: composing Escape returns to the input method; settled Escape keeps the clear-then-close contract.

Review follow-ups folded in: unused composition-tracking hooks (recordCompositionEnd/clearCompositionEnd) removed, and the Escape test now settles the query so it exercises the real two-step contract.

User Impact

CJK and other IME users can pick a candidate or confirm a search term with Enter without the section editor collapsing under them, and without losing their query. Escape during composition is left to the input method; after composition ends the first Escape clears search and the second closes it.

No change outside the IME path: search Enter still never submits, settled Escape still clears-then-closes, and the form's save-on-submit contract is untouched.

Why This Change Was Made

  • Root cause: the search input sits inside a <form> whose onSubmit calls the save path. The old if (event.isComposing) return; skipped the protective preventDefault(), so the invariant "Enter only filters" did not hold on the IME path.
  • Reuse over invention: isComposingKeyboardEvent is the existing owner for this guard (also covers keyCode === 229 and a WebKit composition-end grace window); no new helper, no new state.
  • P2: the removed hooks were wired to the input but never consulted — Enter called preventDefault() without reading them, and the only helper call was Escape, which ignores timestamps.
  • P3: Solid 2 batches the query write, so the old test dispatched input and Escape synchronously, observed the stale empty query, and never covered clear-then-close.

Evidence

Browser proof on a real Chromium (Chrome 138), through the repo's own Control UI e2e server with a mocked Gateway. Composition comes from CDP Input.imeSetComposition (f → fa → fabu → 发布), so the browser itself emits compositionstart, compositionupdate, beforeinput/input with isComposing: true, then the committing Enter.

Step (trace fact) Base 518e8a7 Head ce802c7d
Committing keydown Enter isComposing=true, keyCode=13, defaultPrevented=false isComposing=true, keyCode=13, defaultPrevented=true
Native submit events 1 0
sessions.groups.* requests 0 0
Dialog after Enter closed, search gone open, query 发布 committed
sessions.list(search=发布) 1 1, one matching row
Composing Escape not reached (dialog already closed) defaultPrevented=false, search open, query cleared by the IME
Settled Escapes — 1st clears query and keeps search, 2nd closes
Base: dialog and search gone Head: dialog kept, query committed
base head

Recordings: head 17s · base 14s — traces: head · base — driver, artifacts.

Regression test (ui/src/components/personal-session-group-dialog.test.ts, 2 cases) is red on base (expected false to be true for defaultPrevented) and green on head; sibling session-group-defaults-dialog.test.ts still passes. All 84 PR checks are green on ce802c7d.

Gaps

  • Composition is synthesized by the browser via CDP, not typed on physical CJK hardware; the trace shows genuine compositionstart/compositionupdate/input events from Chrome's composition pipeline.
  • This Chrome commit path delivers the commit as a keydown with isComposing: true and emits no compositionend, so the WebKit composition-end grace branch of the shared helper is not exercised here.

Maintainer proof (built Control UI, real Gateway, real IME composition)

Details: #195983 (comment)

Before (main): Enter during composition saved the section and closed the editor.

Before: main saves and closes the dialog on a composing Enter

After: the dialog stays open and filters by the committed word.

After: the dialog stays open and filters to Release checklist

…composition

The search box keydown handler early-returned on event.isComposing before
the Enter preventDefault, so a committing Enter during IME composition could
submit (save) the enclosing form. Only the Escape clear/close path is gated by
isComposingKeyboardEvent; Enter's preventDefault is now always applied, which
is safe during composition since candidate selection is handled by the input
method. Wire recordCompositionEnd/clearCompositionEnd per lib/ime.ts for the
WebKit composition-end grace window. Add regression tests covering composition
Enter, the WebKit grace window, and composition Escape.

Fixes BUG-341
@clawsweeper

clawsweeper Bot commented Nov 9, 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 app: web-ui App: web-ui size: S triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Nov 9, 2026
@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. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. 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 9, 2026
@clawsweeper

clawsweeper Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Prevent composing Enter from submitting the section editor while preserving composition-aware Escape handling.

Example: Confirm the search term 发布 with Enter in the personal section editor.

  • Before: The form submits, closing the editor and losing the search.
  • After: The editor stays open and displays matching sessions.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused repair with directly inspected browser evidence and a regression integrated into the existing user-flow test.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (logs): Inspected before/after screenshots, browser event traces, and the proof driver exercise the actual Control UI in Chromium with a mocked Gateway and CDP composition: composing Enter changes from one native submit and a closed dialog to zero submits and retained search results, while composing and settled Escape behave correctly; later handler edits are equivalent.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Confirming an IME search term unexpectedly closes the section editor and loses the query.
Reason: The patch restores the existing documented Enter-never-submits contract rather than changing the editor’s intended behavior.

Regression provenance

Regression provenance — verified: source commit faaec72371e3 by RoboClaw; canonical PR #186229 (blame-to-merge-commit).

Merge readiness

✅ Ready for maintainer review

This PR fixes a concrete IME submission bug still present on main; no actionable patch defects were found.

Priority: P2
Reviewed head: fa9407c2c611c9c47ae131eb5d2fb7ee526d0957

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Control UI section editor receives browser keyboard events, filters sessions through its existing loader, and submits section changes through the enclosing form.

flowchart TD
  A[Browser IME input] --> B[Section search handler]
  B --> C[Prevent Enter submission]
  B --> D[Shared composition guard]
  D --> E[Escape clear or close]
  B --> F[Session search loader]
Loading

Technical review

Best possible solution:

Land the existing focused handler fix and consolidated browser regression once current-head CI passes.

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

Current-main source exposes the exact submit path, and the contributor’s inspected Chromium traces demonstrate the base failure and fixed behavior; this review ran no target code.

Is this the best way to solve the issue?

The smallest complete repair prevents every search Enter from submitting and delegates composing Escape detection to the existing helper, without adding state or another owner.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 3e4e201e11ae.

Provenance checked

  • Section search keyboard behavior keeps the original intent (faaec72: The two-step editor added search with an explicit Enter-never-submits and Escape-clears-then-closes contract.)
  • Existing browser selection scenarios keeps the original intent (c8f87b2: The prior test-speed change preserved selection scenarios; this patch reuses the already-defined equivalent ordinary locator without weakening assertions.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • RoboClaw: Raw commit faaec72 adds ui/src/components/personal-session-group-dialog-view.tsx:350 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: faaec72371e3; files: ui/src/components/personal-session-group-dialog-view.tsx)
  • 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 -2, Tests -4. Total -6 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 3 5 -2
Tests 1 14 18 -4
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 17 23 -6

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.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: IME confirmation unexpectedly closes a specific editor and loses its search, with limited scope.
  • 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 (3 earlier review cycles)
  • reviewed 2026-11-09T13:13:12.820Z sha c8975a8 :: needs real behavior proof before merge. :: [P2] Remove composition tracking that this handler never consumes | [P3] Settle the populated query before testing Escape
  • reviewed 2026-11-09T13:57:28.441Z sha ce802c7 :: needs real behavior proof before merge. :: none
  • reviewed 2026-11-09T14:53:40.278Z sha ce802c7 :: needs maintainer review before merge. :: none

Reviewed November 9, 2026, 10:59 AM ET / 15:59 UTC (Revision 4).

@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Nov 9, 2026
@clawsweeper

clawsweeper Bot commented Nov 9, 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. 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 9, 2026
@SunnyShu0925

Copy link
Copy Markdown
Contributor Author

Browser IME proof is now in the PR body and at https://github.com/SunnyShu0925/oc-ime-proof/tree/main/pr-195983.

  • Real Chromium (Chrome 138) driving the source Control UI; composition via CDP Input.imeSetComposition, so the browser emits compositionstart, compositionupdate, beforeinput/input with isComposing: true, then the committing keydown Enter with isComposing: true, keyCode: 13.
  • head ce802c7d: defaultPrevented=true, 0 native submit events, 0 sessions.groups.* requests, dialog stays open, query 发布 committed and the list filtered.
  • base 518e8a7: defaultPrevented=false, 1 native submit event, dialog and search closed, query lost.
  • Composing Escape on head: defaultPrevented=false, search stays open, IME clears the preedit; first settled Escape clears, second closes.
  • Recordings (17s head / 14s base), traces, captioned frames, and the driver script are in that directory.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Nov 9, 2026
@obviyus

obviyus commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 9, 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. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 9, 2026
@obviyus

obviyus commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

Proof on a real Gateway (secretless Docker, node 24.22.1, built Control UI, Chromium driven by Playwright with real IME composition through CDP Input.imeSetComposition / Input.insertText). Path: New section > Choose sessions (Roadmap review checked) > Search sessions. Sessions are synthetic (sessions.create). main a4c7c63 (two runs), candidate fa9407c (two runs). Saves are read from the users.prefs.set frame for ui.personalSessionGroups.

  • Enter while composing se of Release: main fires submit, sends users.prefs.set with the half-chosen section (Focus with only agent:main:roadmap), closes the editor and loses the search. Candidate prevents the default, sends nothing, keeps the editor open; after the word commits the list filters to Release checklist, still with no save.
  • Enter right after compositionend with composition flags cleared (the WebKit order, emulated in Chromium): both keep the editor open and filter, no save. main already handles this order, so only the composing Enter is the bug.
  • Controls, same on both: plain Enter filters without saving; the Save button saves once and closes; Escape outside composition first clears the query, then closes search, with no save; Escape during composition does not close search.
  • Control UI gzip: chat boot +0 B, startup +0 B.

Changes on top of the contributor's fix: shorter comments and the composing check folded into the Escape condition (production +3/-5). I removed the new unit test file and its test-lines allocation and added one IME step to the existing section-editor e2e test, which fails on main (the editor closes on the composing Enter) and passes on this head. Test lines net -4.

Screenshots: main right after the composing Enter (editor gone, Focus saved with only Roadmap review), and candidate after the word commits (editor open, filtered).

main: composing Enter saved and closed the section editor

candidate: editor stays open and filters after the IME word commits

@obviyus
obviyus merged commit 3f805fa into openclaw:main Nov 9, 2026
90 of 91 checks passed
@obviyus

obviyus commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

Landed in 3f805fa. Thanks @SunnyShu0925. Enter during IME composition no longer saves the session-group dialog.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 10, 2026
…composition (openclaw#195983)

fix(ui): guard personal session group search Enter submit during IME composition

In the Control UI personal session-group dialog, the Search sessions box returned early while an IME was composing, before it blocked Enter. Pressing Enter to confirm an IME word submitted the form: the half-built section was saved, the editor closed and the search text was lost. The search box now blocks Enter in every state and leaves Escape to the IME while it is composing, using the existing isComposingKeyboardEvent.

Evidence: a built Control UI with a real Gateway in secretless Docker on node 24.22.1, driven in Chromium with real IME composition over CDP, two runs on main and two on this head. On main, Enter while composing "Relea|se" saved a "Focus" section with only Roadmap review and closed the editor. With this change the dialog stays open, nothing is saved, and the list filters to "Release checklist" when the word commits. Plain Enter, the Save button and Escape outside composition behave the same on both. Control UI gzip: +0 B. Details: openclaw#195983 (comment).

Before (main): Enter during composition saved the section and closed the editor.

![Before: main saves and closes the dialog on a composing Enter](https://github.com/user-attachments/assets/a85def9f-951a-47de-ac1b-6727de3d7a9d)

After: the dialog stays open and filters by the committed word.

![After: the dialog stays open and filters to Release checklist](https://github.com/user-attachments/assets/6b15e170-d32b-4bb1-ad2f-c69ec891ddb6)

Thanks @SunnyShu0925.

Co-authored-by: Ayaan Zaidi <[email protected]>
obviyus added a commit that referenced this pull request Nov 15, 2026
fix(ui): keep Ask OpenClaw drafts when Enter confirms IME input

In Ask OpenClaw (the Custodian), the composer checked only `event.isComposing`, so an Enter that confirms Chinese or Japanese IME input and arrives as keyCode 229 or right after `compositionend` (the Safari/WebKit order) submitted the unfinished instruction and cleared the draft. The composer now uses the shared `ui/src/lib/ime.ts` guard, as the chat composer and the earlier fixes #195983 and #196151 do. The setup screen's sensitive composer gets the same guard; the current wizard always sends a step there, so that path has no live route and only its unit contract is covered. No new text. Control UI gzip grows by +416 B (startup + chat boot), within the bug-fix allowance; override receipt on the PR.

Evidence: Control UI served from source by an isolated loopback Gateway; Playwright Chromium composing CJK text through CDP, twice per side, plus one WebKit 27.2 run per side (harness-only PushAPIEnabled=false). Base: the confirming Enter (keyCode 229, and Enter right after compositionend) sends the unfinished text and clears the draft; this change keeps the draft, and a following plain Enter sends it once. Gateway request counts confirm both. Plain Enter and Shift+Enter behave the same on both. Unit: three cases fail on base, 30 pass here. Screenshots and receipts: #199638 (comment).

Thanks @zhangguiping-xydt.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 16, 2026
…w#199638)

fix(ui): keep Ask OpenClaw drafts when Enter confirms IME input

In Ask OpenClaw (the Custodian), the composer checked only `event.isComposing`, so an Enter that confirms Chinese or Japanese IME input and arrives as keyCode 229 or right after `compositionend` (the Safari/WebKit order) submitted the unfinished instruction and cleared the draft. The composer now uses the shared `ui/src/lib/ime.ts` guard, as the chat composer and the earlier fixes openclaw#195983 and openclaw#196151 do. The setup screen's sensitive composer gets the same guard; the current wizard always sends a step there, so that path has no live route and only its unit contract is covered. No new text. Control UI gzip grows by +416 B (startup + chat boot), within the bug-fix allowance; override receipt on the PR.

Evidence: Control UI served from source by an isolated loopback Gateway; Playwright Chromium composing CJK text through CDP, twice per side, plus one WebKit 27.2 run per side (harness-only PushAPIEnabled=false). Base: the confirming Enter (keyCode 229, and Enter right after compositionend) sends the unfinished text and clears the draft; this change keeps the draft, and a following plain Enter sends it once. Gateway request counts confirm both. Plain Enter and Shift+Enter behave the same on both. Unit: three cases fail on base, 30 pass here. Screenshots and receipts: openclaw#199638 (comment).

Thanks @zhangguiping-xydt.

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: 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.

2 participants