Repository navigation
Conversation
Batch connected pane DOM commits while preserving the synchronous end-anchor distinction between footer clamps and reader movement. Release pending frame waits when hidden or disconnected; preserve immediate initial renders and visibility catch-up.
|
🦞👀 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 maintainer review before merge. Reviewed September 26, 2026, 9:54 PM ET / September 27, 2026, 01:54 UTC (Revision 11). ClawSweeper reviewWhat this changesThe Control UI defers streamed chat transcript commits until after an input frame and updates focus, draft, scroll, and browser-test handoffs for the delayed commits. Merge readiness✅ Ready for maintainer review Current main still uses the earlier chat-pane update scheduler. This PR addresses a distinct Control UI latency problem, with convincing browser measurements and focused interaction coverage; the merged Gateway garbage-collection work does not replace it. Priority: P2 Review scores
Verification
How this fits togetherGateway reply chunks and user input update the Control UI chat pane. Its Lit scheduler commits the transcript and controls to the browser, affecting typing responsiveness, reading position, and focus. flowchart LR
A[Gateway reply chunks] --> C[Chat pane updates]
B[Composer input] --> C
C --> D{Pane visible?}
D -->|Yes| E[Input frame then DOM commit]
D -->|No| F[Wait for visibility]
E --> G[Transcript and controls]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +143, Tests +176, Other -1. Total +318 across 38 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep typing responsive during long streams while preserving per-pane reader position, drafts, menu state, and keyboard focus. Do we have a high-confidence way to reproduce the issue? Yes. The PR gives a specific Chromium A/B scenario with a fixed streamed reply and concurrent typing, and current main retains the earlier pane scheduler; this read-only review did not rerun the scenario. Is this the best way to solve the issue? Yes. The chat pane already owns DOM scheduling, and the branch updates the affected focus, draft, and scroll handoffs at their existing owners. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 2b4a2749587e. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (10 earlier review cycles; latest 8 shown)
|
Resume pane updates from a cancellable message task after the animation frame. Keep synchronous end-anchor ownership and release pending frame/task work when hidden or disconnected.
|
Closing for now (branch kept). The measured win is real — at 4× CPU throttle, p95 input-to-next-frame 45 → 12 ms and ~15% fewer long tasks while a reply streams — but six CI rounds each surfaced a different transcript behavior that changes when pane commits are batched behind the input frame: model/reasoning chat flow, menu visibility, history-anchor corrections, nested tool-activity collapse after history reload, and recovered-text transcript search. Those are user-visible transcript semantics, not incidental timing, so this needs a design pass over the transcript commit pipeline rather than more spec-by-spec repairs. If we revisit: keep synchronous commits for state that other transcript features read (menus, search index, history anchors, collapse state) and defer only the pure geometry/paint work behind the input frame, then re-measure input latency and long tasks with the same 4× throttle harness. |
What Problem This Solves
Long streamed replies interrupt typing and scrolling when pane commits force synchronous transcript layout inside animation-frame callbacks.
User Impact
Pane commits remain batched while input gets its rendering opportunity first. The measured comparison reduces p95 input-to-next-frame latency from 35.05 to 12.35 ms, renderer task time 10.8%, and long tasks 5.6%. Reader position, native footer clamps, prefills, voice controls, and responsive navigation retain their contracts.
Why This Change Was Made
The existing Lit scheduling boundary resumes connected pane commits through a MessageChannel task after the input frame. Cancellation closes both ports and releases the owned waiter; retired deliveries cannot release newer work. Initial rendering and visibility catch-up remain immediate. The transcript still observes geometry synchronously around each actual DOM commit, preserving native-clamp versus reader-motion authority.
The affected owners now preserve their asynchronous contracts:
Paused-clock E2E fixtures explicitly deliver one virtual render frame; the compaction test retains exactly 177 seconds total. Other affected fixtures wait for their visible row, retired marker, or detached rail before taking snapshots. Existing behavioral assertions remain; no production scheduler bypass, real sleep, timeout increase, or new polling was added. The stream-event scheduler remains because it also batches persistence and input-arrival work before Lit invalidation.
Evidence
Final candidate:
8e704b16db0674b83440a0d0685334561a3f0a0a, source treed6e1026699955830c2290ce79ecc117f897cc46d. Performance measurements below use scheduling-equivalent parent389a0f07c186; the final repairs only change submenu/comment focus and E2E synchronization, with no scheduling changes.Interleaved A/B/A/B on one Blacksmith Testbox, Chromium 144 at 4× CPU throttle, production bundles, unchanged l72 mock-Gateway harness. The control restores the unbatched pane owner from then-current main
c0e6951d6f02; all other controls match the candidate. Each trial renders the same 16,201-character reply in 676 chunks while typing.389a0f07c186)Tradeoff: p95 frame gap is 8.35 ms higher in this block. This improves input responsiveness without claiming uniformly smoother animation. The producer is browser-owned and slows under load; this is fixed-reply UI proof, not Gateway capacity. Input latency measures event-to-next-animation-frame delay rather than physical display latency.
A separate interleaved published-parent/
389a0f07c186comparison confirms the interaction repairs preserve the existing fast-input behavior:86302ff19d2a→389a0f07c186runtime 51.87 → 50.49 s; long tasks 347.5 → 329.5; worst task 163.5 → 179.5 ms; p95 frame gap 116.70 → 124.95 ms; p95 input 11.15 → 11.25 ms. Absolute timings vary between blocks; use their matched controls. All eight trials delivered 676 chunks and the final sentinel, had no page errors, and finished at zero bottom distance.Validation on the final source:
{}for the required membership response, causing the sharing header to throw before committing the transcript. It now supplies the required membership fields; no production avatar, geometry, or fallback change was added.pnpm check:import-cycles && pnpm check:madge-import-cycles: zero runtime and type cycles, 43.36 s.A separate cron fixture typecheck failure reproduced on main and was fixed upstream in
c0e6951d6f02, which this branch includes. No duplicate cron repair was added. The main-refresh commit published concurrently had exactly the same source tree as the locally tested merge; its work was preserved.Total PR delta: production +219/−76 (net +143), tests +329/−153 (net +176), including an intact scenario extraction required by the existing file-size cap. Necessary growth owns cancellation and draft/focus authority across deferred commits; superseded microtask cleanup, duplicate lookup logic, and a redundant navigation condition were removed. The assertion ratchet also shrank by one stale zero-count row after the old menu cast was deleted. No Gateway protocol, config options, or database changes.
Remote proof: provider
blacksmith-testbox; final leasetbx_01m3g4zves4x6ge7tppm5vk7bw(Testbox run). Earlier evidence usedtbx_01m3fysyga6305zgkb5etpm9gt,tbx_01m3frgf7e6xhc8n6qb869qs4m, andtbx_01m3fjgqkmch3mtrkqvhy7sfyq; replacements followed provider-ended leases. Commands: targetednode scripts/run-vitest.mjsinvocations, both cycle checks,node scripts/check-changed.mjs, production UI builds,pnpm ui:check-performance, and the l72 A/B harness.Inspected synthetic before/after captures
The capabilities action preserves the unbatched baseline appearance. Crops omit unrelated lower composer controls; the unchanged E2E assertions prove focus, insertion, and every-frame history anchoring. Captured on the initial repair before the behavior-preserving owner extraction.
Before (unbatched baseline):
After (deferred commits with lifecycle repair):