Repository navigation
fix(ui): keep composer textarea native undo and redo working - #131750
Patrick-Erichsen merged 9 commits into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 28, 2026, 9:58 PM ET / August 29, 2026, 01:58 UTC. ClawSweeper reviewWhat this changesThe PR changes the Control UI chat composer to avoid rewriting an unchanged textarea value during renders, with a real-browser regression test for native undo and redo. Merge readinessKeep open for normal maintainer review: current main still performs the unconditional textarea value assignment, while this PR replaces it with a focused native-edit-safe binding and retains state-driven draft updates. No blocking defect was found in the introduced change. Priority: P2 Review scores
Verification
How this fits togetherThe Control UI chat composer renders the current draft into a native textarea and sends native edits back to the chat draft owner. The composer must preserve native browser editing history while still reflecting genuine external draft changes such as sends, history recall, and dictation. flowchart LR
A[Chat draft owner] --> B[Composer renderer]
B --> C[Guarded live textarea binding]
C --> D[Native keyboard editing]
D --> E[Input handler]
E --> A
A --> F[External draft changes]
F --> B
Before merge
Agent review detailsSecurityNone. PR surfaceSource +2, Tests +118. Total +120 across 3 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: Retain the guarded live binding and its browser regression coverage, then merge once exact-head checks complete and the Lit directive contract is available for final maintainer verification. Do we have a high-confidence way to reproduce the issue? Yes—current main’s unconditional textarea assignment is directly identified, and the supplied real-browser sequence exercises typing, deletion, undo, and redo through the production composer path. The reviewer did not execute contributor code locally because this is an external PR. Is this the best way to solve the issue? Yes—the binding change repairs the render-time owner boundary without introducing an app-level undo stack, while AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against feb1161a1e64. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (6 earlier review cycles)
|
038725e to
055cd3a
Compare
|
@clawsweeper re-review — PR body Evidence now links inspectable sanitized browser captures (before/after screenshots and screen recordings of the undo/redo key sequence with a programmatic-value-write HUD: 20 writes unpatched → 0 writes patched), and the branch is rebased onto latest main with all checks green. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Patrick-Erichsen
left a comment
There was a problem hiding this comment.
Verified at exact head f2112c7: the composed Lit guard()+live() binding preserves stale local DOM edits, applies genuine owner changes, and retains native Chromium undo/redo. Exact-head CI and fresh ClawSweeper are clean.
|
Merged via squash.
|
…w#131750) * fix(ui): keep composer textarea native undo and redo working * fix(ui): preserve repeated composer host writes * style(ui): normalize composer directive imports * fix(ui): use Lit live binding for composer draft * fix(ui): preserve uncommitted composer drafts --------- Co-authored-by: Patrick Erichsen <[email protected]>
Closes #131708
What Problem This Solves
Why This Change Was Made
User Impact
ui/src/pages/chat/components/chat-composer-draft-value.ts(the binding directive) and its write conditions; regression coverage inui/src/pages/chat/components/chat-composer-draft-value.test.tsandui/src/pages/chat/chat-composer-undo-redo.browser.test.ts.Evidence
startControlUiE2eServer) in real Google Chrome 151 (Linux, headless via Playwright) with the mock gateway fromui/src/test-helpers/control-ui-e2e.ts; real keyboard events (typing, Ctrl+A, Backspace, Ctrl+Z, Ctrl+Shift+Z) against the composer textarea.Tests 2 passed (2): "keeps native redo working after undo in the composer textarea" (type "hello world test" → Ctrl+A/Backspace → "" → Ctrl+Z → "hello world test" → Ctrl+Shift+Z → "") and "does not re-apply the textarea value after native input" (0 programmatic textarea value writes across the typing and undo/redo key sequences). Directive unit suiteTests 4 passed (4); composer regression suiteTests 1088 passed (1088).expected 16 to be +0— 16 programmatic textarea value writes while typing a 16-character draft (one per keystroke, plus one after each native undo/redo), matching the per-input re-apply the issue describes. On the reporter's macOS Chrome that re-apply is what kills the redo chain; Chrome 151 tolerates equal-value writes, which is why the behavioral failure is asserted alongside the deterministic write-count root cause.