Repository navigation
fix(ui): prevent Safari IME confirmation from submitting chat inputs - #161302
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs real behavior proof before merge. Reviewed September 30, 2026, 12:44 AM ET / 04:44 UTC (Revision 4). ClawSweeper reviewWhat this changesThe Control UI adds a short, input-local guard so an IME confirmation Enter does not send a chat draft, save an annotation, or commit a session rename. Merge readiness⛔ Blocked before merge - 3 items remain The reported behavior remains possible on current main, and the branch offers a focused repair with no definite introduced code defect found. Synthetic browser and Gateway evidence supports the fix, but native Safari or WKWebView IME behavior remains the merge blocker. Priority: P1 Review scores
Verification
How this fits togetherThe Control UI receives keyboard and composition events in its chat inputs. Its handlers turn deliberate shortcuts into chat sends, annotation saves, or session renames. flowchart LR
A[Keyboard and IME events] --> B[Chat inputs]
B --> C[Input-local composition guard]
C --> D{Deliberate shortcut?}
D -->|No| E[Keep editing]
D -->|Yes| F[Send, save, or rename]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +53, Tests +209. Total +262 across 12 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one input-local guard for the three submit paths, then verify conversion confirmation and the following deliberate Enter in native Safari or WKWebView before merging. Do we have a high-confidence way to reproduce the issue? No native Safari reproduction was independently inspected. Current-main source exposes the reported fall-through, and the PR reports a failing baseline run with synthetic browser events. Is this the best way to solve the issue? The shared, input-local guard is a narrow repair for the three affected handlers. Its 100 ms timing needs native IME confirmation before the solution can be judged sufficient for Safari. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 91bcd2d68adc. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles) |
|
The added test at The shortcut/IME case now lives in the existing Native Safari/WKWebView IME evidence remains outstanding. The actual Gateway/UI/local scripted-model comparison servers remain running for manual verification; synthetic Chromium proof must not be treated as native IME proof. |
|
Maintainer landing on exact head Gates. Why we're landing without native IME evidence. We have no native IME automation available: no Japanese or Chinese input source, no Accessibility permission, and no iOS Simulator on the proof host. We accept these instead:
The residual risk is bounded. If native WebKit spaces these events differently, the worst cases are:
Neither loses a draft or data. The three inputs share one helper, so a follow-up tuning would be a one-place change. |
|
A follow-up correction to the landing note above. This merged while the review was still blocked on native IME evidence. Our landing policy only overrides a blocked review for the data-model checkbox, so this override was outside policy. Native Safari/WKWebView verification is still outstanding. Could another maintainer please check it with a real Japanese or Chinese IME, on macOS Safari and on iOS Safari or the WKWebView app? Please test the chat composer, the session rename box and the annotation box:
If native WebKit behaves differently, the shared helper in this PR is the one place to change. The bounded worst cases are listed in the landing comment. |
|
Thanks @NianJiuZst for the shared IME guard and regression coverage! Merged in f48a9d3. The synthetic event-order and real-Gateway proofs passed; native Safari/WKWebView IME behavior remains explicitly unobserved. |
…penclaw#161302) * fix(ui): prevent Safari IME confirmation from submitting chat inputs * test(ui): cover input-only IME commits and legacy Safari keys * test(ui): type IME replay and keep shortcut coverage in its suite --------- Co-authored-by: NianJiuZst <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
Closes #161259
What Problem This Solves
Fixes premature message sends, annotation saves, and session renames when Enter confirms Japanese/CJK input in Safari.
User Impact
Users can confirm converted text without submitting it. A subsequent deliberate Enter or configured send shortcut still works, including immediately after releasing the confirmation key. No configuration change or migration is required.
Why This Change Was Made
Safari can deliver the committing Enter after
compositionend, with bothisComposingand the legacy IME key code cleared. The three affected inputs now share an input-local, 100 ms composition-end guard. It releases on key-up, blur, or a new non-composing key, and expires if release events are missed. It preserves the browser's native confirmation behavior and survives composer rerenders without blocking another input.The timestamp comparison also covers native key events created just before the composition-end event. Existing active-composition and blur recovery behavior remains intact.
Evidence
compositionendfollowed by a normal Enter, verifies that the Japanese draft remains and nochat.sendoccurs, then verifies normal sends, multiline input, active IME input, and changed send-shortcut settings.1c7375ad2eed4aa6052a4a245fbecfcf33017924, includingopenclaw/ci-gate, production/test types, lint, guards, all three UI test shards, all selected browser E2E shards, and real-Gateway E2E.Commands and measured test cost
Component suite:
242/242 passed: 7.69 s Vitest duration, 8.68 s runner wall time.
Each file was also measured with
pnpm test <file> --maxWorkers=1 --reporter=dot(single-file wall time, on this host alongside type checking):chat-composer-ime.test.tschat-view.test.tschat-selection-popup.test.tschat-pane-header.test.tsCI values come from the Vitest module diagnostics in UI shards 1/3 and 2/3. Module elapsed includes collection and setup; it is not total job time.
Browser proof, reusing the existing E2E suite and test case:
node scripts/run-vitest.mjs run \ --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner \ ui/src/e2e/chat-flow.messaging.e2e.test.ts \ -t 'persists the chat send shortcut' --reporter=dotLocally, 1 selected case passed, 18 unselected: 24.94 s including the production UI build (13.37 s). Hosted E2E shard 7/9 subsequently passed all 19 tests in this file in 24.725 s; the changed IME/shortcut case took 1.703 s. An initial version of the fix blocked an immediate modifier shortcut in this existing E2E; clearing the grace on new key intent fixed that defect, with three added recovery regressions failing before that correction and passing afterward.
git diff --checkpassed. The local changed-file command was interrupted during its test-type phase and is not counted as a complete local pass; the exact-head hosted type, lint, and guard checks above completed successfully.Additional event-sequence verification (September 30)
Thanks to @stbtyx747 for the report and @NianJiuZst for the fix. Contributor commits are preserved. Added browser regression coverage for input-only
beforeinput/input insertTextcommits,keyCode 229withisComposing=false, and Shift+Enter. All three touched submit owners share the same IME helper; no additional production gap was established.Secretless Linux Docker verification: 242/242 tests across the four affected component files passed (32.01s Vitest); the expanded built-Chromium E2E passed (14.99s including UI build). Against origin/main
670c2d0d6a0566e8e29191d70540f4aab8ff48a9, the same composer regressions failed 4/10 cases, and the identical browser case failed at the post-composition confirmation assertion (12.82s). The input-only sequence itself is a compatibility guard, not a claim that main sends without keydown.A second proof used each actual built Gateway and Control UI with a scripted local Anthropic SSE model: synthetic confirmation cleared the baseline draft and produced a reply; candidate retained 日本語 until key release and deliberate Enter, then produced a reply. Both local servers are retained for manual Safari comparison. This remains synthetic Chromium evidence, not native IME evidence.
Sources: WebKit 165004 documents compositionend-before-keydown and false isComposing; MDN keydown recommends retaining the keyCode 229 guard. Importantly, that WebKit bug is now resolved via 311717, landed April 2026; it is not evidence that every current Safari version reproduces the historical order. MDN beforeinput documents OS/IME-dependent edit events. The 100ms fallback is a heuristic, not a native timing guarantee.
Still required before merge: native Japanese/Chinese IME confirmation and subsequent deliberate Enter in Safari/WKWebView for composer, rename and annotation. No native result is claimed; no macOS input settings were changed. Exact-head CI and review for the new test-only commit must be evaluated separately from the earlier green head.
No overlap with Pash/Sarah changes.
Actual Gateway comparison (synthetic Chromium IME replay)
Baseline prematurely submitted the Japanese draft and received the scripted local model reply:
Candidate retained the Japanese draft on confirmation, before deliberate Enter:
These inspected screenshots show built UI plus real isolated Gateway behavior, not native Safari or WKWebView IME. Final test-only repair head:
fd42ff071d49e798d51bb6deb9e2c5ee4f9e4b8c; oxfmt, scoped type-aware lint, both UI type graphs and the relocated browser regression pass in Docker. The IME/send-shortcut regression now resides inchat-flow.composer-shortcuts.e2e.test.ts.