Repository navigation
improve(ui): open Activity images faster after idle - #184776
Conversation
Codex Review SummaryThis 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 maintainer review before merge. What this changesThis PR preloads Activity’s image viewer during idle time and extends the existing benchmark to measure image opening. Example: Open the first Activity gallery image after idle with 100 ms emulated HTTP latency.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR provides a focused Activity performance improvement using the existing preload owner; no actionable correctness or security defect was found, and required CI remains pending. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe build converts named UI module entries into a hashed asset descriptor, which the existing shell idle owner consumes to prepare browser assets before native image-viewer interaction. flowchart LR
A[Build module entries] --> B[Hashed preload descriptor]
B --> C[Shell idle owner]
C --> D[Browser asset preparation]
D --> E[Activity image click]
E --> F[Lazy image viewer]
Technical reviewBest possible solution: Retain the single Activity descriptor entry and focused benchmark coverage, then land through the existing required CI gates. Do we have a high-confidence way to reproduce the issue? Current main’s missing Activity next-interaction entry and the existing New Session fallback establish the source path; the PR supplies a reproducible production-browser comparison, which was inspected without executing target code. Is this the best way to solve the issue? The smallest complete runtime change is the added descriptor entry: it prepares the existing viewer through the existing idle owner while preserving lazy evaluation and stylesheet application. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 91fa755ffd6d. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +1, Other +376. Total +377 across 3 files. Added test files: 0. View PR surface stats
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 October 26, 2026, 12:08 PM ET / 16:08 UTC. |
|
Merged via squash.
|
* perf(ui): preload the next Activity image interaction * test(ui): measure Activity preload and first-open phases * test(ui): settle animation and lazy delivery before assertions
What Problem This Solves
Activity preloads New Session code while idle, leaving its image viewer to load only after the user clicks a gallery image.
User Impact
After Activity has been idle, its first image opens about 45% faster at 100 ms HTTP latency. Startup bytes and cold Activity payload are unchanged.
The measured tradeoff is an extra 0.116 ms of action layout work at the median (+8.81%; p95 +0.074 ms/+4.72%). The coordinator accepted that bounded cost: first-open wall time, action task CPU and script CPU improve, and total sampled layout stays neutral. This is not an all-metrics-clean result.
Why This Change Was Made
Add Activity's existing lazy image-viewer entry to the existing navigation preload descriptor. The existing idle owner downloads the viewer instead of falling back to New Session; module evaluation and styles still wait for the click. No new loader, cache, dependency or lifecycle owner.
The benchmark adds synthetic empty/gallery Activity states, native image/Escape checks, immediate and warmed first-open measurements, and separate idle/preload-verification CPU phases. The separation prevents descriptor polling from being counted as idle work.
Evidence
Frozen production comparison:
2988b14f22e6→bb013a233608. Original published source head:df6684f28b00; its later commit adds only the benchmark and fixture. Replacement head:71f6d6b18d36, merged with maincd3bcc017653and the two reviewed test corrections. The nine reviewed scheduling sources and package inputs are byte-identical to the validated correction; no new runtime measurement is claimed for the updated main context. Timing uses the identical reviewed Activity observer fromc71833910666, transplanted into the final benchmark with newer-main Apps/Dock handling preserved.Remote warmed image opening, pooled 30 interleaved A/A/B triplets (corrected 20 and one confirmation of 10 retained):
The phase sums cover cold, fixed idle, preload verification and click; they are not uninterrupted profiles. Remote HTTP is emulated at 100 ms / 10 Mbps; the synthetic WebSocket is unthrottled. Host load and A/A controls are retained. The corrected 20 and confirmation 10 independently show about 45% faster warm opening. Localhost warm opening improves 1.26% median / 13.46% p95 in the corrected 20-triplet run.
pnpm ui:build, strict performance check, base/head comparisonpnpm tsgo:scriptsand scoped format / diff checksThe original warm-idle CPU sample included descriptor polling and is not reused; corrected phase boundaries provide the warm CPU evidence above. All original raw results are retained.
Immediate-open adverse tails are retained: pooled 30 remote wall p95 is +61.62% and local p95 +9.19%. All 180 immediate actions ended before the earliest possible changed descriptor fetch (at least 62.44 ms before it), using the native idle-runtime completion + 500 ms bound and the gallery button's lack of a direct-intent preload selector. Those tails precede this change's execution; no immediate samples were discarded. Empty-state coverage proves post-idle transfer/non-evaluation and rendering, not that an empty RPC response had settled at the cold-ready cutoff.
The full integration review attempt timed out without a report and is recorded as unavailable, not clean. Review reuse is supported by six actual scoped-clean observer reviews plus the separate production review, exact hashes, and coordinator inspection of the small newer-main integration differences. CI remains the broad proof; request
ci:fullfor the shared preload/overlay path before landing.CI scheduling corrections
The original
df6684f28b00run (40353585617) failed two UI tests:follows outside layout shifts and a signaled ancestor animationandkeeps the preference visible while admitted events update execution metadata. Both exact tests passed in the then-latest completed scheduled main run (40347483110,496f32bef297). They are not classified as inherited.The same run also failed
persists visible selections and refreshes queued requests on desktop and mobile. It matched the older scheduled-main run40347483110, but the newer completed scheduled-main run observed at 16:58 UTC,40352459041(503bc1bd4499), passes all three exact test names. None is currently classified as inherited. All seven regular Control UI E2E shards, real-Gateway shard 1, security and performance checks passed. The two-file correction below addresses only the source-supported unit-test scheduling issues; it does not establish a fix for the real-Gateway failure. Replacement-head CI must be evaluated separately.A bounded two-file replay passed 34/34 tests on both the CI base (
6a1f6b0c7bc7) and its exact synthetic PR merge (15a91aab7f0d). The original failures did not reproduce; those passes do not establish a repaired root cause, and their durations are not performance evidence.The test-only correction samples overlay geometry after the animation-frame callback batch and settles Vitest-tracked dynamic imports before asserting queued chat delivery. It preserves the live animation, one-pixel threshold, cleanup checks, delivery payload, held acknowledgement and existing bounded assertion. No production behavior or timeout is changed. The corrected two-file run passed 34/34 once;
pnpm tsgo:ui, scoped format and diff checks passed. Independent P0–P2 review found no actionable defects in the two corrections and retained the non-reproduction caveat. Replacement-head full CI run 40368078178 passed on71f6d6b18d3613c21b004cc4afa7121f1e635e83: 44 successful checks and 25 expected skips, including all three UI unit shards, all seven UI E2E shards, both real-Gateway shards, andopenclaw/ci-gate. Observed complete at 2026-10-26 18:05:41 UTC.These corrections add one line to each existing test file: overlay 395→396 LOC, chat controls 772→773 LOC. The historical Activity performance table above remains pinned to its frozen production comparison; it is not a measurement of newly merged main.
Reproduction and change size
Use frozen base/head production bundles with the committed benchmark:
Separate coverage passes use
--mode coverage --screenshots; immediate opening uses--interactions activity-lightbox-immediate; empty idle uses--activity-media empty --interactions activity-idle. The confirmation uses 10 remote-only triplets.The full five-file count is verified against merge base
cd3bcc017653and replacement head71f6d6b18d36. The production change is one line. The benchmark growth supplies the requested reproducible route/interaction workload, raw network cutoffs, clock qualification, and failure evidence; it adds no production state or abstraction. Simplification review retained the existing preload owner and fixture contract and found no smaller complete runtime change.Before / after gallery readiness (synthetic data):
Before / after image opening (existing entry animation may be at different frames):