Skip to content

perf(ui): avoid native scrollbar work for short chat drafts - #185199

Merged
steipete merged 8 commits into
mainfrom
solid2/w-perf-interaction-6-gutter
Oct 27, 2026
Merged

steipete merged 8 commits into
mainfrom
solid2/w-perf-interaction-6-gutter

Conversation

@steipete

@steipete steipete commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Typing into a short chat draft paid for native scrollbar-gutter layout even when the draft could not scroll. The interaction census traced a repeatable layout regression to #184759.

User Impact

Short drafts avoid the unused native gutter. Text alignment, long-draft scrolling, shrinking, and the composer design stay unchanged.

Why This Change Was Made

The existing textarea overflow owner now publishes its measured scrolling state. CSS uses equal padding for a short draft and exchanges that padding for the real gutter only when scrolling is needed. No new timer, cache, layout read, or Solid effect is introduced.

The benchmark also advances two native frames before waiting for optional navigation preloads. A diagnostic captured a ready shell with an idle callback that never ran in headless Chromium; slower polling still timed out. The frame preparation passed 18/18 base/head/base supplemental cells without changing the original completion predicate.

Evidence

Each CPU cell below is 20 counterbalanced base/head/base triplets on the same Mac, with thread CPU counters and no profiler. Workload: the existing 27-character chat-typing scenario, desktop and mobile, 1× and 4× CPU throttling. Values are median / p95 milliseconds. A/A retains the second unchanged base in every triplet.

Scale / viewport Metric Base Head A/A
1× desktop Total CPU 43.148 / 48.039 44.001 / 48.951 44.678 / 53.146
1× desktop Script CPU 18.410 / 20.399 19.601 / 21.344 19.310 / 22.627
1× desktop Layout CPU 5.201 / 5.697 3.963 / 4.237 5.293 / 5.989
1× mobile Total CPU 54.353 / 59.504 53.357 / 58.797 55.070 / 61.720
1× mobile Script CPU 24.829 / 26.928 24.961 / 27.125 24.983 / 26.971
1× mobile Layout CPU 6.082 / 6.764 4.355 / 4.713 6.124 / 6.709
4× desktop Total CPU 298.539 / 354.426 284.786 / 344.186 294.132 / 367.970
4× desktop Script CPU 113.171 / 131.873 113.263 / 130.704 116.300 / 140.445
4× desktop Layout CPU 30.580 / 35.548 21.454 / 25.265 30.804 / 33.942
4× mobile Total CPU 311.415 / 418.657 297.694 / 371.803 318.314 / 382.787
4× mobile Script CPU 137.657 / 180.778 136.827 / 165.953 139.046 / 169.228
4× mobile Layout CPU 32.523 / 42.446 23.504 / 28.378 33.659 / 38.178

The earlier traced census found the same 33 layout events and per-key dirty-object shape in all roles. The extra cost was inside native text-input layout. A five-triplet equal-geometry CSS bisect removed it before this production implementation. At 4×, layout CPU median falls 29.84% desktop and 27.73% mobile, while total CPU falls 4.61% and 4.41%, with improved p95s. At 1×, layout falls 23.8–28.4%; total CPU stays within the A/A variation. Desktop 1× script median rises 6.47% against the first base (A/A rises 4.89%), so this is not a universal scripting improvement. The tables above retain scripting and total CPU movements; layout savings are not described as equivalent end-to-end latency savings.

Validation: the new short-draft gutter assertions failed on base at both viewport sizes; all 11 composer browser tests and 5 sizing tests pass with the fix. UI types, targeted lint, style lint, controller guards, production Knip, and independent review passed. Eight inspected synthetic screenshots and geometry assertions cover short, overflowing, and shrinking drafts at desktop/mobile sizes.

The script-lint wrapper first stalled on its own nested artifact lock. After its owned processes were stopped and the retained lock was recovered according to the owner instructions, the supported existing-artifact lint mode passed. No lint rules were disabled.

Startup: 269,908 → 270,444 B gzip (+536 B), with 5 JS requests and 1 CSS request unchanged. The strict base/head performance check has zero violations. Final build metadata and independent Git checks both verify committed clean head 29ddc47b8316e8f56192853833e2695a94d1f013. The earlier timing artifact remains pinned to a369d51; its dirty:null metadata and independent clean-Git receipt are retained unchanged.

CI correction: the initial full run exposed an attribute-selector specificity regression in chat-composer-undo-redo. The baseline passed all nine tests across that file and warm-history-subscription; the original candidate passed eight and reproduced the scrollbar-shrink failure. The final :where(...) selector preserves the original override specificity, and the final artifact passes all nine. Two warm-history setup failures in the initial CI run did not reproduce on baseline, original candidate, or final candidate; no persistence change or claim of fixing those failures is included.

CI recovery and test repairs

This branch now incorporates main's shard diagnostics (8d50df8c269, 183e4943702). The original UI3 cancellation was rerun once with coordinator authorization: job121934221647 →121946502337 timed out at30:01 without a named case. It was not rerun again. Later diagnostic-base runs40435965201,40439033673,40441637082 and40443760537 all completed UI3 without a hang; it passed or reported the known rail assertions. No missing shard coverage is waived.

The full runs also found intermittent test observations that did not reproduce on their exact CI bases; none is labeled inherited:

  • Slash menu: observe each single ArrowDown's selected row before sending the next dependent input. All inputs, scrolling, Enter/Tab/pointer selection and final outcomes remain. Full file8/8 passed.
  • Sidebar metadata: poll the original overlap calculation after metadata expands, preserving the two-pixel tolerance and zero target. Full file11/11 passed.
  • Mobile identity: use the existing genuine-wheel scroll-to-top helper to prepare the first message, preserving the exact-zero/identity/geometry assertions and later End test. The earlier Home poll still failed intermittently; this layout setup change does not claim to diagnose or repair production Home behavior.
  • Comment recovery: saving schedules focus restoration without a tooltip. The test now observes focus on the actual nested trigger button and explicitly reopens the preview before reading the revised text. It retains reload, edit and deletion persistence assertions. A first local candidate mistakenly waited on the outer span and failed; the corrected candidate targets the actual button.

Last completed full run40443760537, head5574e62, had40success/24skipped and five assertion jobs plus the aggregate. Its actual checkoutf47305ae had parents45798e64 and5574e62 and reconstructed tree d889935e. Quota recovery and both rail assertions match exact names/signatures in scheduled main40439954043. Both Gateway100/140percent cases reproduce at the same connected-footer wait on exact base45798e64 (local10s, CI30s). The mobile profile:true and comment-draft cases passed both exact-base macOS and Linux replays, so they remain our unqualified failures until replacement CI proves the corrections. The Linux lease stopped and native cleanup reconciled.

The raw-CSS cap was explicitly raised from1597441 to the measured1597581 after a+156B cost for the measured composer win. Performance checker tests41/41 and independent review passed. No startup/gzip/request limit changed. Last completed performance job121990397132 measured startupJS270454→270532B gzip (+78B), startupCSS32180→32180B, totalCSS307666→307694B gzip (+28B), raw1597356→1597512B (+156B). Requests stayed5startupJS/1startupCSS. This small byte cost is accepted under the coordinator's measured-win rule, not called inherited or hidden as variance. Current exact-head job122001564477 passes the strict check: startupJS270522→270361B gzip (−161B), startupCSS32175→32175B, totalCSS307635→307665B gzip (+30B), rawCSS1596797→1596953B (+156B). Requests remain5startupJS/1startupCSS. Its checkout1969e331 has ordered parents7d87a633 andffcaaf43428; independently reconstructed treecda24f6804 matches. Original timing evidence keeps its revision identity.

Current replacement head: ffcaaf43428a8c490b1415a5cbd81a5d0ae555d3, containing the clean main merge and final test corrections. Identity10/10, comment2/2, UI types and fresh independent P0–P2 review pass. Full CI40447155687 completed:44successful jobs,24skipped, one failed UI assertion job and the aggregate. Shard3 and both real-Gateway shards passed; all repaired cases passed. ci:full was enabled for that run. Its three remaining failures in UI2 job122001564883 match the latest completed scheduled main40445322734, job121995418869:

Exact test Same signature on PR and main
Claude native session catalog > shows catalog header affordances only for hover or keyboard-visible focus line193: actionsVisible true instead of false, other9properties match
Gateway retry feedback > keeps automatic recovery stable at 100 percent text scale line123:30s wait for connected footer status to detach
Gateway retry feedback > keeps automatic recovery stable at 140 percent text scale line123:30s wait for connected footer status to detach

The two tests and named rendering/style owner blobs are identical between actual CI base7d87a633 and tested merge1969e331. The native evidence accounts for every job and retains failed CI; no new failure is waived. The original auto request is confirmed-cancelled; landing uses native replacement recovery with that exact-head inherited evidence.

The complete final screen passed 312/312 cells with certified single-task CPU maxima, across all 26 scenarios, two viewports, 1×/4× and base/head/base. Those timings remain pinned to the pre-correction a369d51 artifact. The final selector changes no declarations or normal fixture matches; refreshed final-head geometry and all eight inspected captures preserve those states. No final-head timing re-labeling is claimed.

Scope:9files,8523→8566lines (+43net; current candidate). UI production1978→1986 (+8). The imperative overflow owner and existing observer/listener lifetimes remain unchanged; no effect, subscription, owner API call or rendering controller was added.

node --import scripts/tsx.mjs scripts/bench-control-ui-interactions.ts \
  --bundle-dir "$BASE_UI" --compare-bundle-dir "$HEAD_UI" --control-bundle-dir "$BASE_UI" \
  --steps chat-typing --viewport both --pairs 20 --cpu-throttle 1 \
  --thread-cpu-time --counterbalance --first-pair-screenshots

# Repeat at --cpu-throttle 4.
State Before After
desktop, short Before desktop short After desktop short
desktop, overflow Before desktop overflow After desktop overflow
mobile, short Before mobile short After mobile short
mobile, overflow Before mobile overflow After mobile overflow

@steipete steipete added the ci:full Keep ordinary native-locale CI selection on the next PR run. label Oct 26, 2026
@clawsweeper

clawsweeper Bot commented Oct 26, 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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-27T03:58:48.780380Z ffcaaf4 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui scripts Repository scripts size: XS labels Oct 26, 2026
@steipete
steipete enabled auto-merge (squash) October 26, 2026 23:58
@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. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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 Oct 27, 2026
@clawsweeper

clawsweeper Bot commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR reserves the chat editor’s native scrollbar gutter only when its existing overflow owner detects scrolling.

Example: Type “Synthetic typing 0123456789” into a short desktop chat draft.

  • Before: The editor reserves an unused native scrollbar gutter during typing.
  • After: Padding preserves the text inset until the draft needs scrolling.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful and supported by browser evidence, with one confirmed regression-fixture failure to repair.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (screenshot): The built Control UI typing workload reports counterbalanced desktop/mobile CPU results, and inspected desktop before/after screenshots exercise short and overflowing drafts with preserved geometry; mobile-image retrieval limitations are reviewer-side.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Typing short chat drafts performs unnecessary native text-input layout work.
Reason: The maintainer-authored direction has measured renderer value and preserves the established composer design and ownership.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⛔ Needs changes before merge - 1 item remains

Keep open: this useful performance repair preserves the composer design, but its stronger CSS selector breaks the existing classic-scrollbar regression fixture.

Priority: P2
Reviewed head: a369d51d7cc4d11b4a974817dfd92f4f47000bad

Before merge

  • Preserve the classic-scrollbar fixture’s explicit gutter override (P2) - The new attribute selector outranks the injected .agent-chat__composer-combobox > textarea rule in the existing native shrink E2E test. Once the 150-character draft overflows, scrollbar-gutter: stable and the end padding remain active despite that fixture requesting an unreserved 30px scrollbar. Replacing it with 60 characters then retains a 170px content width and 75px height instead of shrinking to 200px and 60px. Current-head checks-ui-e2e (6/7) records this exact failure. Update the fixture selector to retain its explicit auto gutter and zero padding against the new production selector, preserving the original geometry assertions.

Findings

  • [P2] Preserve the classic-scrollbar fixture’s explicit gutter override — ui/src/styles/chat/composer-surface.css:449-452
Agent review details

How this fits together

The shared composer DOM owner measures textarea overflow and publishes presentation attributes; composer CSS translates those facts into padding, scrollbar gutters, and scroll fades.

flowchart TD
  A[Draft edits] --> B[Textarea overflow owner]
  C[Resize and scroll events] --> B
  B --> D[Scrollable attribute]
  D --> E[Composer surface CSS]
  E --> F[Padding or native gutter]
Loading

Technical review

Best possible solution:

Keep the owner-driven gutter exchange and strengthen the classic-scrollbar fixture’s explicit CSS override without weakening its shrink assertions.

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

Current main unconditionally reserves the gutter, the supplied benchmark isolates its layout cost, and current-head CI independently demonstrates the fixture break; no local execution was performed.

Is this the best way to solve the issue?

Publishing the existing owner’s measured overflow state is a small complete repair that preserves geometry without adding measurement, scheduling, or reactive ownership.

Full review comments:

  • [P2] Preserve the classic-scrollbar fixture’s explicit gutter override — ui/src/styles/chat/composer-surface.css:449-452
    The new attribute selector outranks the injected .agent-chat__composer-combobox > textarea rule in the existing native shrink E2E test. Once the 150-character draft overflows, scrollbar-gutter: stable and the end padding remain active despite that fixture requesting an unreserved 30px scrollbar. Replacing it with 60 characters then retains a 170px content width and 75px height instead of shrinking to 200px and 60px. Current-head checks-ui-e2e (6/7) records this exact failure. Update the fixture selector to retain its explicit auto gutter and zero padding against the new production selector, preserving the original geometry assertions.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.96

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Composer scrollbar gutter and text inset changes intended behavior with a stated reason (b22e014: Keep the scrollbar near the surface edge while counting its width inside the existing text inset.)
  • Native overflow and shrink lifecycle keeps the original intent (d51f360: Avoid input-time forced layout while releasing non-reserved classic gutters when deletion permits fewer wrapped lines.)
  • Benchmark navigation preload settlement keeps the original intent (f6ec9f8: Wait for expected navigation preload assets before measuring warm interactions; the added frames retain the existing completion predicate.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test:ui:e2e -- ui/src/e2e/chat-composer-undo-redo.e2e.test.ts
  • pnpm test:ui -- ui/src/pages/chat/chat-composer-overflow.browser.test.tsx
  • git diff --check

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 6457db9 adds ui/src/pages/chat/components/chat-composer-dom.ts:130 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 6457db975baf; files: ui/src/pages/chat/components/chat-composer-dom.ts)
  • Vyctor H. Brzezowski: Raw commit b22e014 adds ui/src/styles/chat/composer-surface.css:439 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: b22e014dfa7d; files: ui/src/styles/chat/composer-surface.css)
  • Marvinthebored: Raw commit d51f360 adds ui/src/pages/chat/components/chat-composer-dom.ts:173 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: d51f3607b978; files: ui/src/pages/chat/components/chat-composer-dom.ts)

PR surface

Source +8, Tests +21, Other +2. Total +31 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 11 3 +8
Tests 1 21 0 +21
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 0 +2
Total 4 34 3 +31

Labels

Label changes:

  • add P2: A bounded composer performance improvement needs a focused repair to an existing browser regression fixture.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: A bounded composer performance improvement needs a focused repair to an existing browser regression fixture.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.
  • 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.

Reviewed October 26, 2026, 8:08 PM ET / October 27, 2026, 00:08 UTC.

@steipete
steipete disabled auto-merge October 27, 2026 00:11
@steipete

steipete commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor Author

HF-UI-SHARD3-HANG: the diagnostics repairs are on main in 8d50df8c269 and 183e4943702.

The test step previously had no deadline below the job timeout, so cancellation prevented the failure upload. It now stops at 20 minutes inside the unchanged 25-minute job budget. The progress artifact records active fork-pool case IDs and source locations without test titles or values. Failure parsing also accepts Vitest's line/column suffixes, preserving exact test-name attribution.

The hang did not reproduce: current-main shard 3/6 passed locally (133 files, 517 tests, 598 seconds), and a Linux replay of the stream PR's main parent 9249a7f38928 passed (132 files, 510 tests, 705 seconds; run 40433713425). The Linux replay used Node 24.22.1, four CPUs and four workers, with the same real-Gateway/production-artifact skips; no OOM events occurred. The three common candidate files also passed separately.

Please merge current main before the next attempt. The original cancellation's cause remains unproven; these changes make another occurrence retain the file and case location instead of losing all timeout evidence. No assertions, test selection, or worker limits were weakened.

@steipete

steipete commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor Author

Cross-check update: #185130 and #185199’s original timed-out shard inventories share 74 of 133 files, including chat-outbox-capacity.e2e.test.ts. Exact local head/base replays completed all 133 files / 521 cases; neither hung, and both exposed the same two-large-PNG attachment ordering failure. The preview was reconciling read slots against stale rendered membership; the repair reads the synchronous attachment owner while retaining reactive membership notification.

Current #185130 head b5c695c9af68b35f826831af17396dd24cf36757 now passes UI shard 3/7 in 10m23s, run 40436094228. That settles the timeout gate on the repaired head. It does not prove the old timeout’s precise cause: direct formatting of the old 9.6 MB assertion diff took about 9 ms, and the local replays never hung. Main’s overlapping attachment repair (#185154) is incorporated. This finding and current CI result are shared here so the composer lane can reuse the evidence.

Other current failures are being attributed by exact test name against scheduled main or an actual merge-base replay; no shard-wide inherited claim.

Keep the text inset constant with padding for short drafts and exchange it for the native gutter only when the existing overflow owner detects scrolling. This removes per-keystroke native layout overhead introduced by #184759 while preserving long-draft scrolling and shrink behavior. Advance the benchmark renderer before waiting for optional idle preloads so headless Chrome does not strand the callback.
@steipete
steipete force-pushed the solid2/w-perf-interaction-6-gutter branch from 29ddc47 to b971041 Compare October 27, 2026 02:01
@steipete
steipete merged commit e5aa448 into main Oct 27, 2026
130 of 136 checks passed
@steipete
steipete deleted the solid2/w-perf-interaction-6-gutter branch October 27, 2026 04:29
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 28, 2026
…#185199)

* perf(ui): reserve composer scrollbar gutters only on overflow

Keep the text inset constant with padding for short drafts and exchange it for the native gutter only when the existing overflow owner detects scrolling. This removes per-keystroke native layout overhead introduced by openclaw#184759 while preserving long-draft scrolling and shrink behavior. Advance the benchmark renderer before waiting for optional idle preloads so headless Chrome does not strand the callback.

* fix(ui): retain composer gutter override specificity

* test(ui): await the Home scroll target before settling

* test(ui): observe each slash-menu keyboard selection

* perf(ui): account for measured composer CSS cost

* test(ui): await sidebar layout after metadata updates

* test(ui): synchronize comment preview and identity setup
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 ci:full Keep ordinary native-locale CI selection on the next PR run. 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: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: S status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant