Skip to content

fix(ui): keep Custodian drafts when Enter confirms IME input - #199638

Merged
obviyus merged 2 commits into
openclaw:mainfrom
zhangguiping-xydt:fix/custodian-ime-nov15
Nov 15, 2026
Merged

obviyus merged 2 commits into
openclaw:mainfrom
zhangguiping-xydt:fix/custodian-ime-nov15

Conversation

@zhangguiping-xydt

@zhangguiping-xydt zhangguiping-xydt commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Confirming CJK IME input in Ask OpenClaw can submit an unfinished instruction and clear the draft. The composer checked only event.isComposing, missing keyCode 229 and an Enter delivered immediately after compositionend with composition flags cleared.

User Impact

IME confirmation keeps the instruction editable. A following ordinary Enter sends it once; Shift+Enter still inserts a newline. No input text, copy, provider selection, auth or setup behavior changes.

Why This Change Was Made

Reuse isComposingKeyboardEvent, recordCompositionEnd and clearCompositionEnd from the shared IME owner, as in #195983 and #196151. Composition tracking stays input-local and uses the existing timing policy; key-up and blur clear it. No new state, renderer, listener convention or timing policy.

Sensitive composer boundary: the current wizard always sends a step, so that composer has no live route; its unit case covers only the UI contract. The contributor's harmless shared-helper wiring to that field is retained; no sensitive-field runtime claim is made.

Evidence

Validated head: d99b4c9f39b3bb0c6ce3cc87df13d5e4019b472b.

Real-Gateway before/after receipts and four inspected screenshots.

  • Chromium: two baseline and two candidate rounds through the complete application on an isolated loopback Gateway running from source via ocx. CJK composition/commit used CDP; confirming keydowns were trusted and had isComposing=false, as keyCode 229 or Enter immediately after compositionend. Baseline sent one acknowledged user request and cleared the draft; candidate sent zero and retained it. After key-up, ordinary Enter sent exactly once. Ordinary Enter and native Shift+Enter controls matched both sides.
  • Real transport: counts correlate outgoing openclaw.chat request ids with successful responses from the actual Gateway, excluding welcome requests. A local OpenAI-compatible fixture provided immediate valid model responses; no Gateway response or component state was mocked, and no real provider/account credentials were used.
  • WebKit 27.2: one baseline and one candidate round passed the same live-Gateway draft/request/control checks with scripted composition metadata. The proof driver used Page.overrideSetting PushAPIEnabled=false; production settings are unchanged. No physical OS IME or native Safari claim.
  • Regression: the same consolidated custodian-page.test.ts produced three intended baseline failures and 27 passes; candidate passed 30/30. Sensitive input is contract-only coverage, not live setup proof. Matching test typecheck, production UI typecheck and focused formatting passed.
  • Full/package: ocx build --dts and offline packed CLI/version/help plus candidate Control UI index smoke passed. The package smoke reused installed dependencies; no fresh dependency-install claim.

All final execution was on the host through ocx. The diff touches only the surface and its existing page test, with no package, lockfile, workspace, npmrc, scripts, patches or Git-hook changes.

Control UI Gzip

Official hash-normalized production metrics on the same host/toolchain: startup JS +0 B, chat boot JS +137 B, startup/chat CSS +0 B. Summed growth: +137 B, below the assigned 600 B ceiling. No budget baseline was changed and no timing/performance-win claim is made.

Scope and Credit

Production +15/-2; tests +30/-30 (net 0), no allocation record. The new standalone composer fixture was removed; distinct regressions now extend existing send/context cases. Three repeated rich-wizard headers reuse the existing reply constructor without changing fields or assertions.

The original human commit by zhangguiping-xydt is retained. The follow-up only consolidates tests.

Merge Risk

Two-way door: reverting restores prior keyboard handling. No configuration, schema, persistent-state or Gateway-contract change. Blast radius is the Custodian composer's Enter/IME handling; ordinary Enter and Shift+Enter controls were exercised on both revisions.

@clawsweeper

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

@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 15, 2026
@clawsweeper

clawsweeper Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

The Custodian composer reuses shared IME handling so Enter can confirm composed text without submitting the draft.

Example: Compose 检查配置 in Ask OpenClaw and press Enter to confirm it.

  • Before: Confirmation can submit the instruction and clear the composer.
  • After: Confirmation retains the draft; releasing the key and pressing ordinary Enter sends it once.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused shared-owner repair with inspected real-entry-point evidence, reported red/green regressions, and no actionable findings.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): Exact-head receipts and four inspected screenshots cover built /custodian UI against an isolated real Gateway: both IME-confirmation paths retain 检查配置 without sending, then key release and ordinary Enter send once; ordinary Enter and Shift+Enter controls also pass. Chromium composition uses CDP, WebKit uses scripted metadata, and sensitive-input coverage remains contract-only; no physical IME or native Safari result is claimed.
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 composed CJK text can send an unfinished instruction and clear the Ask OpenClaw draft.
Reason: The change restores deliberate submission using an established repository pattern without changing configuration, defaults, or Gateway contracts.

Merge readiness

✅ Ready for maintainer review

This PR fixes a current Custodian input bug with a focused change and no actionable findings; required checks were still running at the last successful GitHub read.

Priority: P2
Reviewed head: d99b4c9f39b3bb0c6ce3cc87df13d5e4019b472b

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Custodian surface translates browser input into session actions, which submit drafts through the existing session store to the Gateway's openclaw.chat method.

flowchart LR
  A[Browser composition events] --> B[Custodian composer]
  B --> C[Shared IME helper]
  C --> D[Retained draft]
  B --> E[Session send action]
  E --> F[Gateway openclaw.chat]
Loading

Technical review

Best possible solution:

Merge the existing shared-helper wiring once required checks complete successfully.

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

Current-main source exposes both reported event paths, and supplied baseline/candidate Gateway receipts demonstrate the failure and repair; no target code was executed during this read-only review.

Is this the best way to solve the issue?

This is the smallest complete repair using the existing IME owner, with no competing state or timing policy and preserved send admission.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

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

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

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 changes Production +15/-2; tests +30/-30 Production growth wires the existing helper into both inputs; regression coverage extends existing cases without net test growth.

Labels

Label changes:

  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.
  • 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 maintainer: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: IME confirmation can prematurely submit a Custodian instruction, with a bounded composer-specific fix.
  • 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.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

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 (2 earlier review cycles)
  • reviewed 2026-11-15T15:01:08.279Z sha d9a0914 :: needs real behavior proof before merge. :: none
  • reviewed 2026-11-15T17:05:20.301Z sha d9a0914 :: blocked before merge. :: none

Reviewed November 15, 2026, 1:37 PM ET / 18:37 UTC (Revision 3).

@zhangguiping-xydt

Copy link
Copy Markdown
Contributor Author

Added the requested launched-Control-UI proof to the PR body for unchanged head d9a09148ad4af26145c2cc34bedb880215aea09f. Both ordinary and sensitive inputs now have successful full-application /custodian traces: IME confirmation retains the draft without a send; key-up followed by ordinary Enter sends exactly once. The body includes the actual request log and standalone reproduction driver, with synthetic Gateway/source-mode/native-IME limits and failed baseline startup attempts explicitly disclosed. CI still awaits maintainer workflow approval.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 15, 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: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked. 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 15, 2026
@obviyus

obviyus commented Nov 15, 2026

Copy link
Copy Markdown
Collaborator

Validated head d99b4c9f39b3bb0c6ce3cc87df13d5e4019b472b, retaining zhangguiping-xydt's original human commit.

Real entry-point before / after

All proof ran on the host through ocx, with a task-owned loopback Gateway, isolated HOME/state/workspace/profile, production Control UI assets built from each revision, and Playwright. The Gateway ran from TypeScript through ocx src -- ... gateway run. A local OpenAI-compatible HTTP fixture returned immediate valid responses; no real provider/account credentials, vendor API or operator Gateway were used. Gateway responses acknowledge every counted user request; no Gateway response or component state was mocked.

Baseline: 2e1b61901c5d139dd4b40e00eb3ca326a0ef9b89; its Custodian surface matched sampled main 8a8d8249b5ba5783e92e5e2549675e79f892aa05.

Chromium 156: two independent runs on baseline and two on candidate. Each run used the full /custodian application and separate browser contexts for the two IME cases and ordinary-key controls. CJK draft: 检查配置.

Composition used CDP Input.imeSetComposition and Input.insertText. The confirming Input.dispatchKeyEvent was a trusted keydown with isComposing=false, as keyCode 229 or Enter/13 immediately following compositionend. Recorded event order is compositionend before keydown; the key's native timestamp can precede the end timestamp by fractions of a millisecond, exercising the existing shared helper's bounded handling.

Action Baseline, both runs Candidate, both runs
IME-confirming Enter, keyCode 229 1 user request acknowledged by Gateway; draft cleared 0 user requests; CJK draft retained
Enter immediately after compositionend, flags cleared 1 acknowledged user request; draft cleared 0 user requests; CJK draft retained
Key-up, then ordinary Enter after confirmation Already sent by confirmation Exactly 1 acknowledged user request; draft cleared
Ordinary Enter control Exactly 1 acknowledged send Exactly 1 acknowledged send
Shift+Enter control Newline inserted; 0 sends Same newline and 0 sends

Counts exclude the initial no-message welcome request. Every user-request payload retained the exact CJK text, and its matching real Gateway response had ok=true. No duplicate sends occurred.

The attached inspected screenshots are same-frame crops of the actual application: baseline shows the instruction already in the transcript and an empty composer; candidate shows the CJK text still in the composer. Only synthetic data is visible.

Additional engine and contract boundaries

WebKit 27.2: one complete baseline and candidate run passed the same request/draft/control assertions against the real Gateway. This is a scripted composition-metadata supplement, not physical-IME evidence. It used the harness-only Page.overrideSetting PushAPIEnabled=false preference reused from #196151; production browser settings are unchanged. Without that harness preference, the first WebKit attempt disconnected before welcome and produced no IME verdict.

Sensitive composer: the current wizard always sends a step, so that composer has no live route; its unit case covers only the UI contract. No sensitive-field runtime, credential or setup-flow claim is made.

No physical OS IME or native Safari claim is made. Failed screenshot-helper attempts are retained separately; they are not counted as successful rounds. Standalone capture used the supplied driver's Playwright screenshot path because the repository helper requires Vitest worker state. Fonts/layout were settled, capture was bounded, and the viewport/crops came from one frame.

Regression, types and packaging

  • vitest-source: consolidated custodian-page.test.ts: baseline 3 intended failures / 27 passes (premature submit count 2 instead of 1); candidate 30/30 passed. Existing context-presence/value, wizard, privacy and lifecycle assertions remain. Cold wrappers: about 7s baseline / 8s candidate.
  • Matching test typecheck (test/tsconfig/tsconfig.core.test.ui-pages.json), production UI typecheck and focused format check passed.
  • full: ocx build --dts passed. Offline packed CLI version/help and byte-identical candidate Control UI index smoke passed using the existing ocx dependency closure, not a fresh dependency installation. Version: OpenClaw 2026.11.3 (d99b4c9). Tarball SHA-256: 65e48441d5ddf140d17e7aa4ddc323abd0fbc49dcd5ab3975f9f3f150845224e.

Control UI gzip

Official collectControlUiPerformanceMetrics, hash-normalized production gzip, same host/toolchain (Node 24.22.1, Vite 8.3.5):

Surface Baseline Candidate Growth
Startup JS 91,088 B 91,088 B 0 B
Chat boot JS 1,311,806 B 1,311,943 B +137 B
Startup + chat CSS 180,116 B 180,116 B 0 B
Startup + chat boot, summed growth +137 B

This is below the assigned 600 B ceiling; no budget baseline was changed. Served gzip can vary with generated asset hashes; no timing/performance-win claim is made.

Scope and credit

Host-execution check: the PR diff contains only the Custodian surface and its existing page test; no manifest, lockfile, workspace, npmrc, scripts, patches or hooks changed. The fix reuses shared IME helpers, with no new state, timing policy, copy, auth or setup behavior. Production +15/-2; tests +30/-30 (net 0), no allocation file. The new 44-line standalone fixture was removed; its distinct input regressions were folded into existing send/context cases, and repeated rich-wizard headers now use the existing reply constructor without changing their fields or assertions.

Worktrunk and commit hooks were disabled; packing skipped lifecycle scripts. A proof-driver-only module loader hook applied the WebKit preference above. No Docker resources were used. Reverting this change restores the prior keyboard handling; it does not migrate state or alter Gateway contracts.

Before: IME keyCode 229 sends the draft and clears the composer

After: IME keyCode 229 keeps the draft in the composer

Before: Enter after compositionend sends the draft

After: Enter after compositionend retains the draft

@obviyus

obviyus commented Nov 15, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 15, 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. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. 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. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 15, 2026
@clawsweeper clawsweeper Bot removed clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked. labels Nov 15, 2026
@obviyus

obviyus commented Nov 15, 2026

Copy link
Copy Markdown
Collaborator

Maintainer override: Control UI gzip growth within the bug-loop allowance.

The only red job is control-ui-performance (and the dependent ci-gate): https://github.com/openclaw/openclaw/actions/runs/43747252480/job/132914313136. Main is already above its largest-chunk cap, so the job allows only base + 64 B. This fix adds the shared IME composition guard to the Ask OpenClaw composer.

CI hash-normalized gzip, base -> this head:

  • Startup JS 91,028 -> 91,028 (+0)
  • Chat boot JS 1,311,874 -> 1,312,290 (+416)
  • Largest JS chunk 570,896 -> 571,098 (+202)
  • Summed startup + chat boot: +416 B (served gzip +450 B)

The maintainer rule for bug fixes allows up to 600 B of real Control UI gzip growth (chat boot plus startup, summed) with this override comment. All other CI jobs passed with no cancellations; exact-head review is ready (5/6). Behavior proof, inspected before/after screenshots and Gateway request counts: #199638 (comment).

@obviyus
obviyus merged commit 7acc315 into openclaw:main Nov 15, 2026
105 of 108 checks passed
@obviyus

obviyus commented Nov 15, 2026

Copy link
Copy Markdown
Collaborator

Landed in 7acc315. Thanks @zhangguiping-xydt.

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: 📸 screenshot Contributor real behavior proof includes screenshot evidence. 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.

2 participants