Repository navigation
fix(ui): admit chat transcripts after the first paint - #196198
Conversation
Replace the second animation-frame gate with the existing cancellable task timer. Preserve hidden-pane cancellation, restored transcript readiness, and revealed DOM identity while removing an extra frame from initial transcript admission. Extend synchronous transcript test mounting to settle newly scheduled zero-delay tasks without draining caller work. The admission assertion fails with the original two-frame gate; all five targeted tests and the UI typecheck pass.
|
🦞👀 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 Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs changes before merge. What this changesThis PR replaces the second animation-frame wait with an existing cancellable timer before mounting chat transcripts. Example: Opening a large transcript in Firefox mobile in the supplied browser cohort.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Regression provenanceRegression provenance — verified: source commit Merge readiness⛔ Needs changes before merge - 1 item remains Keep this PR open: the focused scheduling change has clear user value, but its added tests cause the test-line budget check to fail. Priority: P2 Before merge
Findings
Agent review detailsHow this fits togetherChatThread receives pane presentation and transcript props, schedules initial admission, and renders loading content or retained transcript rows. flowchart TD
A[Pane props and presentation] --> B[ChatThread admission]
B --> C[Layout frame scheduler]
C --> D[Cancellable task timer]
D --> E[Presentation check]
E --> F[Transcript content]
A --> G[Hide or disposal]
G --> D
Technical reviewBest possible solution: Keep the existing admission owner and cancellable timer change, and allocate the justified regression-test growth without raising the shared baseline. Do we have a high-confidence way to reproduce the issue? Current main visibly waits for two scheduled frames, and the supplied pinned browser comparisons measure the resulting readiness delay; this review did not execute the product. Is this the best way to solve the issue? The change is the smallest complete production repair: replace the second wait at ChatThread, retain presentation checks and cleanup, and adapt the existing mounting helper rather than introduce another owner. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 56617cd00086. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +7, Tests +109. Total +116 across 4 files. Added test files: 1. View PR surface stats
Preflight sourceSource 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
LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 9, 2026, 1:59 PM ET / 18:59 UTC. |
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
* fix(ui): admit chat transcripts after the first paint Replace the second animation-frame gate with the existing cancellable task timer. Preserve hidden-pane cancellation, restored transcript readiness, and revealed DOM identity while removing an extra frame from initial transcript admission. Extend synchronous transcript test mounting to settle newly scheduled zero-delay tasks without draining caller work. The admission assertion fails with the original two-frame gate; all five targeted tests and the UI typecheck pass. * test(ui): allocate transcript admission regression coverage
What Problem This Solves
Initial chat transcript admission waits for two animation-frame callbacks. The second frame delays the useful transcript after the composer is already available, especially in Firefox. Keep the first frame boundary, then admit the transcript through the existing cancellable task timer. The timer rechecks presentation before revealing, and cleanup cancels both the pending layout and task. Restored panes keep their immediate-ready path and revealed panes retain DOM/focus.
ChatThreadremains the admission owner; no new state owner, option or lazy import is introduced.The test mounting helper now drains only zero-delay tasks scheduled by the captured frames, preserving caller timers and restoring scheduling globals even on throw. The existing transcript test covers first-frame loading, task admission without a second frame, hidden/closed cancellation, latest props, restored readiness and retained DOM/focus. Two helper tests protect timer isolation/restoration.
Historical attribution, separate from fix timing
An exact #194200 parent/merge comparison (
650091daacdc10aa374e82a6327e8beffe136072→cddc5ee4baa2e466a27ff76d5243d6a7372b1ced) reproduced the earlier-composer/readiness tradeoff in Firefox mobile cold/large flows: 20 rotated triplets per flow, 120 observations. Matched readiness became +61.75 ms/+15.02% cold and +56.75 ms/+12.17% large, while the composer became 68/101.25 ms earlier. The post-history delay increased 65/53.5 ms; transport and CSS matched changes were negligible. This localizes the regression to admission scheduling. Those historical medians are not subtracted from the following independent fix cohorts to claim a recovered percentage.The separate exact historical Firefox desktop cold cohort also validates 60/60 observations (20 rotated triplets): parent/merge/control readiness is 413.5/446 → 456.5/522 → 410.5/428 ms (median/p95). Its paired readiness cost is +46.25 ms/+11.124%, versus 3.298% median absolute A/A, while composer readiness improves by 77.5 ms. The post-history interval adds 49.25 ms. This confirms the same admission tradeoff on desktop; it is not repair timing and is not pooled with the mobile history.
Frozen candidate proof
Base
dfc053fd4c6e831cc27f6722eace4ab6f16b96c7, candidate70a705da4b3809b40c578fea10edfda56677b1aa, harness267255ff19fa4a1bfc7de9901fd5eb7d56124f13. All arms use fresh headless browsers, localhost, default configuration and 1× CPU. Each triplet rotates base/candidate/identical base; B and A below are those two controls. All values are milliseconds, median/p95. With n10, nearest-rank p95 is the maximum. Firefox native-input frame p95 and max coincide per observation; they are not a page-wide rAF distribution.The original cohort is 300/300 valid observations: Firefox mobile cold/large at 20 triplets each (120), plus Chromium/Firefox desktop fork, split and session-open at ten triplets each (180). Both terminal receipts exit 0, full grid and inventories are intact; 158 populated metric arrays were independently recomputed. No failed or high-load samples were filtered.
Matched mobile readiness improves 28.25 ms/5.88% cold and 29.5 ms/5.62% large. The candidate is lower than both controls in 14/20 cold and 18/20 large triplets and never greater than both. Cold is not uniformly >5% faster against both control arms. Composer medians remain within about 1%; their tails improve. Post-history delay improves 27.75/29.25 ms; matched history and CSS changes are under 1 ms. The six desktop action cells stay within 5% in median and 2.42% in adverse p95 against both controls.
CPU and secondary-frame disclosure
Chromium CPU results below show no demonstrated broad task/script CPU regression; no CPU-win claim is made. The positive session-open task median is +3.55% against B but −2.19% against A, alongside +5.86% task and +6.21% script A/A median drift. Fork style median is +3.44/+2.93%; session-open style is +4.28/+1.44%. Split has exactly one extra layout in every candidate sample (39/40/39), but its measured task/script/style medians and tails are lower. Firefox CPU and long-task metrics are unavailable, never zero-filled.
Original desktop native-frame cohort:
A separate, unpooled 60-observation Firefox follow-up covers fork and split at ten rotated triplets each on the same pinned builds/harness. It also exits 0, validates 60/60 and retains intact inventories. Twelve populated metric arrays were independently recomputed.
Coordinator-accepted tradeoff: native fork frame medians improve 9.26–9.82% against the controls in the original cohort and 12.28–12.79% in the separate follow-up, while the follow-up fork maximum remains +2/+5 ms against the two arms. Fork is faster than both controls in 9/10 triplets and no triplet exceeds both by >5%. Its maximum triplet is B93/candidate95/A85 ms, a +6 ms candidate difference from the paired control mean within an 8 ms A/A spread. The follow-up fork application matched median is +13 ms/+2.85%, explicitly retained. Split's follow-up frame p95 is lower than B and equal to A. These facts justify the measured mobile readiness gain; they do not establish that every tail is flat. The tradeoff was accepted by the coordinator.
Chromium CLS is zero throughout the action observations. Split's user-initiated all-shift-sum median/p95 is identical at 0.0986106 across arms and is distinct from CLS. Firefox CLS is unavailable. WebKit is unavailable on this host after launch timeouts; there is no WebKit timing claim. Re-run WebKit cold/large mobile readiness and desktop fork/split/session-open after the host recovers.
The original action stage overlapped coordinator-observed native review dependency materialization from 18:20:50–18:22:00Z; all observations are retained. The separate follow-up host one-minute load rose from 6.29 to 12.47, with application A/A p95 movement −5.28% fork and −5.53% split. Arms stayed interleaved.
Separate desktop cold and large qualification
Two additional, separately validated 20-triplet Firefox desktop cohorts use the same frozen
dfc053fd4c6e/70a705da4b38runtime pair and harness. Each completes 60/60 with intact inventories and no excluded observations. The original base source checkout had advanced; a clean relocated source checkout and the retained exact 4,871-file base bundle were verified before either cohort. This was a source-address handoff, not a rebuild or a replacement of any prior observation.Large readiness is faster than its paired control mean in 19/20 triplets and faster than both controls in 16/20; readiness and composer p95 improve against both controls. A/A variation is nearly as large as the paired 7.361% estimate, so this supports the direction and the no-regression band, not a precise recovered fraction. Cold primary readiness stays within the band and has lower p95; its wide A/A does not resolve a median win.
Cold composer tails remain a caveat: repair p95 is +2/+5 ms against the two arms, and three observations exceed both controls by 5%. Their paired composer changes are +36/+20/+31.5 ms; some excess precedes history arrival and some follows it. These are retained secondary tail signals, not silently dismissed as host noise or described as unqualified all-metric cold acceptance. No Firefox CPU, Long Task, or CLS values are available.
Evidence
chat-pane-transcript-mount.test.tsx:134; production candidate restored byte-for-bytepnpm tsgo:uipassesd53921ac1424/85378d692d72: each run once; both exit 1 with byte-identical existing export/type findings; no ignores addedci:fullrun completed: units, real-Gateway, bytes, types and ratchet pass; all remaining E2E/lint failures match scheduled main as detailed belowNormalized startup JS is unchanged at 91,695 B gzip / 3 requests, startup CSS 38,669 B / 1 request. Chat JS drops 1,298,171 → 1,297,958 B (−213 B) with 20 requests; chat CSS is unchanged at 133,182 B / 3 requests. New-view JS stays 803,742 B / 15 requests and CSS 98,868 B / 3 requests. No lazy boundary changes.
Production LOC 486 → 493 (+7); tests/helper 192 → 301 (+109); runtime/test total 678 → 794 (+116 net; +124/−8 diff). The allocation record adds two configuration lines, giving +126/−8 overall. The seven production lines use the existing timer owner to remove the second-frame delay while preserving cancellation. No dependencies added; no leases used. Scoped Solid checklist counts are unchanged: zero rendering controllers, effects/render effects, untrack, direct listeners, DOM queries, flush, owner APIs and component cleanup; the same two manual imports remain.
Before and after
The four inspected screenshots are 390×844 synthetic mobile ready states, proving stable final rendering. They do not prove intermediate frame/compositor behavior. The matching before/after pairs are embedded below.
Final production Knip findings are unchanged between integrated base/head in
src/daemon/launchd.ts,src/gateway/server-methods/config-write-flow.ts,src/plugins/provider-external-auth.ts,src/plugins/provider-runtime.ts,ui/src/pages/dashboards/dashboard-tools.tsxand exported types insrc/plugins/types.ts. Output SHA-256 on both exact commits:6052ae3938519fd323be1c02a88e44dce31ab8a4d3e975051c74619416e5263e. The extra config-write export arrived on main; old Knip output is not relabeled as a current-head run.Test-line allocation
CI identified that this change needs its own exact regression-test allocation: 109 lines for task admission, cancellation, and isolated mount-helper timers. The follow-up
964614e381caddsconfig/test-lines-allocations/196198-transcript-task-admission.txt; the shared scalar is unchanged. The scoped ratchet and independent allocation review pass. Runtime, tests, and build inputs are unchanged by the allocation commit, so the earlier pinned proof remains applicable to those inputs.Current CI qualification
Run 42697480882 at integration head
85378d692d725ca9acb1df0c5c1b6afd815971eecompleted. The inspected tested merge is4443e1bad8c0f6cca10d8e5dfaa701ced7f70748, with ordered parentsd53921ac1424and85378d692d72; its tree equals this PR head. UI unit, real-Gateway, performance, types and test-ratchet jobs pass. The remaining failures are identical to latest completed scheduled main run 42692902936, ate64c3514e419:[ui-e2e-bundled] ui/src/e2e/session-ownership.e2e.test.ts > Control UI session ownership > aligns Person left status at 390 px[ui-e2e-bundled] ui/src/e2e/session-ownership.e2e.test.ts > Control UI session ownership > aligns Person left status at 1200 px[ui-e2e-bundled] ui/src/e2e/native-conversation.e2e.test.ts > Control UI mocked Gateway E2E > keeps a single web conversation with in-page native navigation and Dashboard handoff[ui-e2e-bundled] ui/src/e2e/chat-flow.sidebar-presentation.e2e.test.ts > Control UI mocked Gateway E2E > keeps session titles on the first line and collapses rows that have no second lineeslint(no-shadow): row,sidebar-rail-alignment.e2e.test.ts:201shadowing line 80core:stripe:4:ui; PR groups stripes 3/4/5 under outer job core-2All four failed input files are byte-identical at scheduled main, the actual CI baseline, PR head and tested merge. Full Vitest names, every repeated annotation, exact messages and source objects were compared; matching shard labels alone were not treated as evidence. No test rerun was used to obtain attribution. Native recovery retains the red CI result and uses the documented inherited-failure route.
The earlier allocation run's 342-line deficit was inherited from exact CI base
e2320c33ac8a: 6,604,592 test LF against a 6,604,250 ceiling. This PR adds and allocates exactly 109 LF. Main repaired the old debt in #196234; final exact-base ratchet on85378d692d72passes 6,606,437 LF / 6,606,437 ceiling, with no extra grant or padding. The main merge is conflict-free and preserves the entire reviewed five-file patch. Historical runtime/build/timing results above keep their original pins; current integrated-head results are separately identified. The confirmed-cancelled auto request is completed through native replacement recovery, not re-armed.