Repository navigation
perf(ui): show saved conversations before reconnecting - #182863
Conversation
Use the admitted route for snapshot prewarming and paint saved rows without waiting for connect. Keep live history independent of IndexedDB and retire late snapshots before applying authoritative history. Gate remote transcript media and active embeds until connection and route admission, while keeping saved text accessible.\n\nWarm remote transcript median improves from 509.3 ms to 304.7 ms; local median improves from 212.5 ms to 203.7 ms. Startup grows 88 B gzip, with seven JS requests and one CSS request.
|
🦞👀 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 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. |
Keep the saved-conversation preview passive while disconnected or resolving its route. Cover connection, pending admission, and disconnect in the warm-startup regression suite.
|
Codex review: needs changes before merge. What this changesThis PR displays saved conversations before reconnecting, starts live history independently of browser storage, and defers remote transcript resources until admission. Example: Reload a saved 240-message conversation under the measured 100 ms HTTP latency profile.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 3 items remain Keep this PR open: earlier saved-text display is useful and demonstrated, but the passive widget placeholder loses saved geometry and two affected CI assertions need updating. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherControl UI bootstrap selects a scoped browser snapshot; the existing pane renders its saved messages while Gateway routing and live history revalidate them. flowchart LR
A[Browser route] --> B[Warm boot admission]
B --> C[Scoped snapshot store]
C --> D[Chat pane renderer]
E[Gateway connection] --> F[Authoritative history]
F --> D
E --> G[Resource admission]
G --> D
Technical reviewBest possible solution: Keep earlier saved-text rendering while preserving the existing widget height and host contracts and updating the affected timing assertions. Do we have a high-confidence way to reproduce the issue? Current-main source contains the connection and storage waits, and the inspected before/after captures demonstrate earlier saved-text display; this read-only review ran no application code. Is this the best way to solve the issue? Removing the waits through existing snapshot and history owners is appropriate, but the passive widget must retain its existing measured layout rather than substitute a generic height. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 721cdadccb93. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +46, Tests +153, Docs +63, Other +52. Total +314 across 44 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 24, 2026, 4:53 PM ET / 20:53 UTC. |
Keep widget shells and learned geometry visible while remote content waits for admission. Preserve simultaneous dashboard board/transcript restoration and avoid reading transcript history for established live headers. Fix the CI fixture type and timer lint errors.
Treat an ambiguous dashboard name as a bounded same-agent last-viewed candidate until the route owner resolves its exact key. Preserve forced literals and other-agent isolation without delaying connection or history.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3d268f3fc8
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| <Show | ||
| when={props.preview.mcpApp} | ||
| fallback={ | ||
| <Show | ||
| when={managed()} | ||
| fallback={ | ||
| <PreviewFrame | ||
| onExportSource={props.onExportSource} | ||
| params={{ | ||
| title: props.preview.title?.trim() || t("chat.toolCards.canvas"), | ||
| src: resolveCanvasIframeUrl( | ||
| props.preview.url, | ||
| props.options?.canvasPluginSurfaceUrl, | ||
| props.options?.allowExternalEmbedUrls ?? false, | ||
| ), | ||
| frameKey: props.preview.url?.trim() || props.preview.viewId?.trim(), | ||
| height: | ||
| props.options?.widgetLayout?.read( | ||
| `frame:${props.preview.url?.trim() || props.preview.viewId?.trim()}`, | ||
| ) ?? props.preview.preferredHeight, | ||
| onHeightChange: (height) => | ||
| props.options?.widgetLayout?.write( | ||
| `frame:${props.preview.url?.trim() || props.preview.viewId?.trim()}`, | ||
| height, | ||
| when={props.options?.mediaReadAllowed !== false} | ||
| fallback={<div style={{ display: "block", "min-height": `${height()}px` }} />} |
There was a problem hiding this comment.
Preserve already-mounted widget documents during reconnects
When an established chat temporarily disconnects, chatPaneResourceProps() sets mediaReadAllowed to false, so this Show disposes the entire widget subtree—including already-loaded PreviewFrame iframes—and reconnect creates fresh documents. This loses unsaved form values and other local widget state, violating the existing visualization-retention contract in docs/web/control-ui/offline-and-reconnect.md. The existing createCanvasFramePresentation() owner already preserves initialized documents while disabling live actions; the new gate should defer initial resource admission without unmounting an already-admitted document. The widget blip test misses this regression because it never supplies the production mediaReadAllowed value.
Useful? React with 👍 / 👎.
|
Merged via squash.
|
* perf(ui): show saved conversations before reconnecting Use the admitted route for snapshot prewarming and paint saved rows without waiting for connect. Keep live history independent of IndexedDB and retire late snapshots before applying authoritative history. Gate remote transcript media and active embeds until connection and route admission, while keeping saved text accessible.\n\nWarm remote transcript median improves from 509.3 ms to 304.7 ms; local median improves from 212.5 ms to 203.7 ms. Startup grows 88 B gzip, with seven JS requests and one CSS request. * fix(ui): defer workspace icons until route admission Keep the saved-conversation preview passive while disconnected or resolving its route. Cover connection, pending admission, and disconnect in the warm-startup regression suite. * docs(ui): record final warm transcript bundle measurements * fix(ui): preserve saved widget and dashboard layout during admission Keep widget shells and learned geometry visible while remote content waits for admission. Preserve simultaneous dashboard board/transcript restoration and avoid reading transcript history for established live headers. Fix the CI fixture type and timer lint errors. * fix(ui): prewarm the saved dashboard behind name aliases Treat an ambiguous dashboard name as a bounded same-agent last-viewed candidate until the route owner resolves its exact key. Preserve forced literals and other-agent isolation without delaying connection or history.
Related: #182825
What Problem This Solves
Warm reloads could leave a saved conversation blank until the connection request was sent, even though its scoped snapshot had already arrived. A slow IndexedDB read could also hold the first history request for two seconds.
User Impact
Saved conversations become readable earlier and are marked Saved conversation · reconnecting. Drafts keep their existing behavior; remote media, embeds, and plugins wait for connection and route admission. Workspace icons also wait for connection and route admission, including after disconnect. Saved text remains accessible to screen readers and can be selected/copied.
Why This Change Was Made
Prewarming now follows the current route rather than blindly reading the last selected session, and skips unrelated pages. The normal pane renderer paints saved rows after yielding for the initial composer, without waiting for connect. Live history uses an already-restored cursor when available, starts independently of browser storage otherwise, and retires pending snapshot publication before applying its result.
The existing identity, invalidation, retention, and reconciliation owners remain in charge. The connect-before-transcript flag and two-second snapshot wait are removed; cached board startup keeps its separate timing. The design note is updated at
docs/reference/control-ui-warm-transcript-design.md.Evidence
Production bundles on the same shared Mac; synthetic 240-message / 390-session workload, 20 interleaved base/head pairs per profile. Remote means the existing
live-fastRPC profile plus 100 ms HTTP latency and 10 Mbps, not an Internet deployment.The shared-host A/A control had noisy tails: identical-code scripting CPU p95 moved +7.8% and task CPU p95 +16.2%. The 20-pair CPU comparison is inside that noise. Connection dispatch remains at the profile's approximately 449 ms boundary; no extra history request is needed in the warm fixture.
The remote median misses the 300 ms goal by 4.7 ms. Diagnostic filmstrips show zero duplicate row keys, visible-anchor movement below 0.04 px, and zero CLS during live adoption. Whole-page CLS remains approximately 0.112, including earlier virtualizer/sidebar/details updates; this PR does not establish zero whole-page CLS.
bootstrap.tsmax-lines finding (its line count is unchanged)The final media-admission follow-up passes all 24 warm-startup cases and UI typecheck; its new workspace-icon test fails on the prior head. Timing values above precede that small request-gating follow-up. The production byte counts in the table include it.
The startup baseline is ratcheted to the measured 281,367 B. The base already exceeds the total CSS ceilings by 155 B gzip / 1 B raw; this change leaves those bytes unchanged.
Touched production UI LOC against the integrated main: 12,868 → 12,911 (+43). Touched tests: 4,077 → 4,263 (+186). Growth is the route-aware selection, explicit passive-media propagation, and coverage; there is no second cache, renderer, storage identity, or new dependency.
ci:fullrequests the complete UI and Gateway selection.Reproduce the remote timing comparison (use
--latency-ms 0 --frame-gap-ms 0for local):Inspected synthetic-only frames: before is the last unchanged frame before 425 ms (307.9 ms; no new frame until 526.9 ms), after is 422.4 ms. The after transcript first painted at 356 ms in this diagnostic run.
CI repair
Run 40130583989 exposed five PR regressions; the matching jobs passed in scheduled main run 40125377367. All are treated as ours: header subagent rendering read transcript history, the new workspace fixture omitted its required kind, two timer executors returned timer IDs, passive widgets lost their saved shell/height, and the new composer yield split dashboard board/transcript first paint.
The repair short-circuits the saved label for established live headers, fixes the fixture and executors, preserves the normal passive widget shell/learned height, and keeps the dashboard restore atomic. The three focused unit files pass 35 cases; both UI and UI-chat test typechecks pass. Full E2E proof belongs to the replacement CI run. Timing measurements predate these bounded repairs; the final byte counts above include their production changes.
The replacement run 40132282378 passed 48 jobs, including the widget E2E and both real-Gateway shards, but still exposed one empty first frame in the dashboard name-alias case. Bootstrap had treated the ambiguous name as an exact literal cache key. The final repair warms one same-agent last-viewed dashboard candidate; exact route/cache-key consumption remains authoritative, with one unused scoped read accepted if the alias resolves elsewhere. Forced literals, other agents, and chat routes remain unchanged. All 15 prewarm cases and the exact unchanged dashboard E2E (
restores /dashboard/main/mission-control before hello) pass locally; UI types, leaf lint, and final bundle comparison pass.Final run 40133980199 exposed an unrelated timing race in
returns Escape to its trigger after pointer and keyboard reopening with title tooltips(chat-effort-picker.browser.test.tsx). The test queries the lazily mounted range once before polling focus; CI capturednulleven though the failure DOM contains the range. That test and its production owners are unchanged here, and the previous two PR runs and latest completed scheduled main run passed it. The exact case passed in a focused local diagnostic. This is a diagnosed flake, not an inherited-failure claim or a repaired test; The final run completed with 48 jobs passing, including dashboard E2E and both real-Gateway shards. The single diagnosed-flake rerun passed. Final run 40133980199, attempt 2, completed successfully with all 50 jobs that ran passing (non-applicable jobs skipped). No source changes were made for this flake.Final main integration
Native recovery found a startup-budget conflict after the green run. Merged current main (0bba2a4) without replaying commits; only the budget record conflicted. The combined build measures startup 281,702 B, chat boot 1,271,675 B, and New Session 767,609 B; request counts remain unchanged. Startup is +403 B against incoming main’s recorded 281,299 B, within the approved sub-0.5 KB allowance for measured latency/CPU wins. The baseline is ratcheted to the measured combined artifact. UI typecheck and the strict comparison against the original built base pass. The timing table predates this integration. Current-head CI 40137609860, attempt 1, completed successfully: all 49 jobs that ran passed; non-applicable jobs skipped. The final head required no rerun.