Repository navigation
perf(ui): shorten cold chat tasks while preserving restored frames - #196482
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 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 separates cold chat preparation and rendering into browser tasks while preserving restored-page scheduling. Example: Open a 2,000-message conversation in mobile Chromium at 1× CPU.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 3 items remain Keep open: this maintainer-authored PR provides measured responsiveness improvements, but its transcript test consumers and enforced growth checks need repair before merge. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe Control UI receives session history and pane presentation state, prepares transcript projections, and mounts the composer and conversation through existing retained Solid owners. flowchart LR
A[Session history] --> B[Retained pane owner]
B --> C[Pane preparation]
C --> D[Browser task continuation]
D --> E[Pane and composer]
E --> F[Transcript preparation]
F --> G[Conditional task continuation]
G --> H[Conversation rows]
Technical reviewBest possible solution: Keep task splitting in the existing pane and transcript owners, with completion-aware consumer tests and growth checks satisfied. Do we have a high-confidence way to reproduce the issue? Base source combines the relevant preparation and construction work, and the supplied matched browser comparisons demonstrate long tasks; this read-only review ran no reproduction. Is this the best way to solve the issue? The focused task boundaries reuse the existing owners and preserve warm scheduling without introducing a cache or parallel renderer; consumer completion and enforced growth failures remain actionable. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against a65cb61a7d14. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +58, Tests +32. Total +90 across 4 files. Added test files: 0. 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 10, 2026, 1:33 AM ET / 06:33 UTC. |
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…penclaw#196482) * perf(chat): separate pane and transcript construction tasks * perf(chat): retain Firefox task timing for fine splits * perf(chat): skip fine construction yields on Firefox * perf(ui): limit chat construction yields to cold frames * fix(ui): retain warm scheduling when snapshots are unavailable * fix(ui): settle cold transcript position after row admission * test(ui): await initial cold transcript content * test(ui): keep preamble fixture names distinct * test(ui): await cold transcript admission and allocate exact budgets * test(ui): settle cold rows before visibility and activity assertions * test(ui): await cold viewport and native scroll observations * test(ui): allocate only cold construction test growth * test(ui): await cold pane and restored transcript content
Verdict
All six cold-path performance gates and all 14 first-frame filmstrips pass. Final CI 42783988615 passes every unit, real-Gateway, strict size and test-budget job. Its only failed root is the three thinking-completion E2E cases (desktop/mobile/tablet), matching latest completed scheduled main 42775238950 by exact name and assertion; native inherited-failure recovery is being used for those cases only.
The Chat cap adds the coordinator-accepted 336 B over current main; original CI measured +336 B and local builds +508 B. Final CI on the newer base measures +323 B (1,299,496→1,299,819 B), with startup JS/CSS and all request counts unchanged. The allocation covers only this PR's final 125 net test lines: the previous 114 plus 11 for two final readiness-test repairs. It covers none of main's earlier 293-line debt (223 from #188748 plus 70); #196173's main allocation already covers that debt. Final CI test budget passes with 70 lines of slack. No shared scalar changed.
What Problem This Solves
Cold chat opens combine pane setup, transcript preparation and DOM construction into long main-thread tasks. This change reuses the native task continuation to separate cold pane preparation from construction, and first transcript preparation from row rendering when preparation exceeds 15 ms.
Warm-started documents keep #196385 scheduling throughout their lifetime, including later navigation, expired holds and unavailable snapshots. The eligibility decision is captured before a pane can clear the warm marker. Firefox keeps its existing scheduling. No geometry measurement or reset was removed.
Delayed rows also need delayed layout readiness: configuring a nonempty transcript must not let an empty viewport overwrite saved reader state. The existing layout owner becomes ready when rows are admitted. A deterministic saved-reader regression fails before that repair and passes after it.
Evidence
Frozen base
082c3791791b18b9f14c104a83322297f45499e7; measured runtime head1320cf89a3835105fdd7783a02f0c1e0c3c055dc(now merged with main at6449c34257b40dec4df1a9048bc76745d6d6d34e). All four production sources match the measured candidate's source maps exactly; later commits only repair tests.Acceptance: 20 rotated base/head/base triplets per changed Chromium cell, desktop/mobile at 1×/4×; longest Long Task API task must improve at least 5% beyond A/A, readiness must remain within the band. Ten extra desktop-large 4× triplets resolve its initial readiness tail. First-frame sequence must match base; settled content and geometry must be identical. Desktop cold shell construction is outside scope.
Production bundles, fresh browser per observation, synthetic Gateway, 400/2,000 messages. Chromium uses the headless shell. These measure renderer behavior, not live provider or network latency.
Chromium
510 observations, zero behavior failures. All six targeted cells pass the task and readiness rules. Desktop cold boot remains the unchanged shell floor. The pooled desktop-large 4× readiness p95 is 1,762.5 → 1,753.6 ms (control 1,721.5 ms), with paired median +0.21%; its longest-task paired median improves 11.69% against A/A 3.89%.
Total renderer task CPU paired medians are flat/slightly lower (about −0.44% to −2.05%). Script-only time rises 7–14% as work is partitioned. This is a responsiveness trade, not a claim that transcript work disappeared. Host-load medians: 1× 6.71 (4.35–8.84), original 4× 4.33 (3.50–8.31), extra tail 8.29 (6.95–9.90).
Firefox
Ten triplets per cell, 180 observations, zero behavior failures. All paired readiness medians remain within 5%; tail differences are within the band or A/A. Host load median 6.11, range 4.27–10.15. Long Task API and CPU measurements are unavailable in Firefox, not zero.
First-frame and content proof
All 12 required native filmstrips were recaptured on the final runtime, plus desktop/mobile warm reload with unavailable snapshots at 4×. Inspected, synthetic-only captures preserve the base's visible state sequence: cold loading frame → existing pane placeholder → transcript; warm held/restored frame → existing blank/fallback phase → restored transcript. No new warm skeleton appears. Native filmstrips are the gate: rAF state samples miss brief phases in opposite arms at 4× and are not substituted for actual captured frames.
All 14 settled Chromium screenshots have zero changed pixels. Full message digests, row text/geometry, composer state/geometry, and 400/2,000-message counts match. The screenshot gallery below shows base above and final head below.
Checks and CI
Final
pnpm tsgo:ui, focused lint and controller guard pass. The canonical forced-yield verification covered 205 tests: 203 passed in the six-file run (20.15 s), then the two remaining initial-readiness assumptions were repaired and passed in a targeted rerun (2.91 s). All original assertions remain; the permission-picker test passes unchanged. The line-cap hook required moving the two pagination tests intact to a focused sibling; both pass under forced yield in 1.65 s. The extraction adds 20 setup/import lines, included in the exact allocation. Pre-commit formatting and line-cap checks pass. The directly affected suite groups passed 150 tests in 8.12 s and 169 tests in 7.38 s; these groups overlap and are not 319 unique tests. The delayed path was forced to reproduce the original failures, then verified after repair. The announcement test now waits for initial history before adding a live preamble; its original announcement assertions remain. Three independent runtime reviews found no actionable P0–P2 finding. The incremental test/config review was clean; the extraction review identified an unstaged allocation update, which was staged before the successful commit. No review finding remains open.CI run 42771446552 exposed PR-only synchronous initial-content assumptions; those names passed on scheduled main run 42762110071, so they were repaired rather than called inherited. That CI run measured canonical Chat growth of +336 B. The exact final test allocation is 114 lines, covering only this PR's 114 net regression lines. It covers no main debt and changes no shared scalar. Run 42773495948 passed both strict size and exact test-budget checks. It exposed two further initial-readiness assumptions: inline-view row identity and run-activity controls. Both were reproduced with forced cold yield (2 and 9 failures), repaired without changing runtime code, and verified (2 and 11 passes). Pending-input viewport and cold tool-disclosure readiness were also repaired (7 and 1 forced-yield passes). The browser clamp case passed in isolated base and head replays, so it is not classified as inherited: its existing raw-scroll setup now waits for the native offset observation before resizing, preserving every expected value. All seven clamp variants pass. These repairs are test-only; the production threshold remains 15 ms. Before the conflict merge, full CI run 42778941369 completed: strict size, all UI unit and real-Gateway shards pass. The only failing roots are
test-lineswith the same 293-line inherited overrun and the three thinking-completion E2E cases (desktop/mobile/tablet), whose names and/think ultraassertion match latest completed scheduled main 42775238950. The aggregate CI gate is red because of those two roots. That attempt required inherited-failure recovery; fresh CI on the conflict-resolved head will decide the remaining exceptions. This is not an all-green CI claim.The budget overrun belongs to main: scheduled-main revision
261b24e6bc8contains 6,618,989 test lines against a 6,618,696 ceiling, over by 293. This is the earlier 70-line debt plus #188748's 223 lines. Running the checker on that revision against the same prior basebaccc7e1529fails with the 293-line overrun; a zero-delta invocation prints the same overrun but exits successfully. That earlier CI merge has 6,619,103 lines against a 6,618,810 ceiling, also over by 293: both totals and ceiling rise by exactly 114. The allocation offsets only our 114 added lines, preserving the full inherited debt at that time. Main subsequently covered it in #196173; the current merged head passes the budget check. The coordinator directed native inherited-failure recovery if still needed; no padding, shared scalar change, or allocation of other PRs' lines.Production Knip reports exactly the same three unlisted binaries as the frozen base (
taskkill.exeand twobtrfsreferences); no new ignore or unused export. The closeout WebKit smoke again times out at launch after 15 seconds, matching the start-of-task host limitation; no WebKit correctness claim.Coordinator-accepted bytes
Same-machine Node 26.12.1 builds. Startup retains three JS requests and one CSS request; all route request counts are unchanged. CI's same-run Node 24.22.1 comparison is Chat 1,298,806 → 1,299,142 B (+336 B), startup JS 91,819 B unchanged and CSS 38,647 B unchanged. Report both measurements; do not mix their absolute sizes.
CI is the checker of record: its +336 B Chat growth (1,298,806 → 1,299,142 B) is coordinator-accepted for the measured cold-path wins. The local +508 B comparison is disclosed as a build-environment difference, not used to set the cap. After merging main, only
chatBootJsGzipByteschanges, from main's 1,300,795 B to 1,301,131 B (+336 B), with no additional headroom; all other caps and shared scalars stay unchanged. The local strict rerun retains its expected environment-specific failure; fresh CI must pass the canonical strict check before landing.Scope and task breakdown
Production LOC 1,709 → 1,771 (+62); final directly changed tests 11,110 → 11,235 (+125). The patch reuses the native continuation and the existing layout-ready owner. Solid counts: effects 1→1, memos 20→20, signals 4→6, onSettled 10→12, cleanup 1→1; no added listeners, DOM queries or ownership APIs.
Source-mapped diagnostic traces identify the remaining largest task as shell/startup construction: desktop cold about 95.1/395.2 ms and mobile 85.5/357.7 ms at 1×/4×. At 4×, cold preparation is separate at 219.7/251.8 ms desktop/mobile, pane/composer DOM 152.5/172.5 ms. Large-transcript preparation is separate at 183.1/185.4 ms and pane DOM 155.1/165.3 ms. These are one-observation attribution traces, not acceptance timing, and inclusive source unions are not summed. Desktop cold shell has five Layout events (5.3 ms) and 17 UpdateLayoutTree events (23.3 ms); mobile has six (14.0 ms) and 18 (24.0 ms). No geometry call was proved redundant or deleted. Further shell splitting is outside this PR.
Filmstrips
Conflict repair after the 114-line correction
Merged
e7bbd05236e46dd56728a69d75b95a6d56619450after GitHub reported a conflict in the Chat budget. Preserved all main changes and budgets; only the Chat cap adds the accepted 336 B. No runtime conflict occurred. Freshpnpm tsgo:uipasses.pnpm check:test-lines-ratchet --base origin/main --no-merge-basereports 6,620,164 test lines, ceiling 6,620,234, slack 70. This PR still adds exactly 114 test lines and 114 allocation; #196173's separate allocation on main absorbs the prior 293-line debt. The old exact-main reproductions remain above for the history of the earlier failed CI attempt; they do not describe the current merged base.Final unit readiness repairs
Conflict-resolved CI run42782373267 passed strict size and the exact test budget. Chat was1,299,496→1,299,819B (+323B), startup JS91,819B and startup CSS38,827B unchanged; the accepted cap increment remains336B. Two unit cases exposed immediate post-mount assertions:
chat pane assistant identity snapshots > keeps an unknown transcript loading before hello and reconciles cached or live historyandchat pane warm reload > restores current nonempty through its admitted projection and cursor. Forced cold yielding reproduced both plus the prior-reply variant. Awaiting their existing observable rendering assertions makes all25 tests in those two files pass; no runtime behavior or assertion value changed. The11 added test lines are this PR's own growth: final exact allocation125, with zero inherited debt. Fresh typecheck and budget pass (6,620,175 lines, ceiling6,620,245, slack70). Replacement full CI will validate the final test-only head.Exact final CI and recovery evidence
Head
d9671e3db36f24a4014a043e60c87fa6720c1ac5, run42783988615 attempt1: 68 terminal jobs, 42 passed, 24 skipped, one failed E2E root and its aggregate. The three failing names areControl UI thinking argument completion > opens the active model's thinking levels above the composer (desktop),(mobile), and(tablet); every case expects/think ultraand receives/thinkon both this PR and scheduled main. The actual CI mergeaab33c85c0511f5d84ca5fb5a14b63f519eb6c25has ordered parents19aa98b9258b8b7066de53a8c97c96834f42fec3and this head; its tree was independently reconstructed and the thinking test source is unchanged. Test budget:6,621,673 lines, ceiling6,621,743, slack70. No budget failure is waived.