Repository navigation
fix(control-ui): retain bounded full replies during reload - #189918
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: blocked before merge. What this changesThis PR retains bounded, recovered assistant replies in existing browser snapshots so warm reloads can restore complete rows. Example: Reload after displaying a 14,000-character assistant reply whose serialized recovery object fits within 64 KiB.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 2 items remain Keep this maintainer-authored experiment open and paused as requested; its production approach is coherent, with one small defect in the proof tooling. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe Control UI receives truncated history and full-message recovery responses from the Gateway, retains scoped display snapshots in browser storage, and renders those snapshots during reload and reconnect. flowchart LR
A[Gateway history preview] --> B[Transcript recovery owner]
C[Full message response] --> B
B --> D[Scoped row display facts]
D --> E[Browser snapshot storage]
E --> F[Chat row renderer]
A --> F
Technical reviewBest possible solution: Keep bounded recovery retention in the existing snapshot owner, correct the proof timestamps, and finish the experiment’s declared validation before marking it ready. Do we have a high-confidence way to reproduce the issue? Current-main recovery retains the full reply only in its expansion map, while persisted snapshots retain the preview; source inspection establishes the reload path, but no target code was executed. Is this the best way to solve the issue? The smallest complete production repair records accepted recovery at its existing owner and restores it through existing scoped facts, preserving live revalidation and oversized-reply fallback. Full review comments:
Overall correctness: patch is correct AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 84b914ad7d8d. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +53, Tests +196, Docs +4, Other +128. Total +381 across 20 files. Added test files: 1. View PR surface stats
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 31, 2026, 9:28 PM ET / November 1, 2026, 01:28 UTC. |
596deb5 to
868405a
Compare
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. |
868405a to
9dbc39e
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9dbc39e9cd
ℹ️ 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".
| const retained: AssistantMessageExpansionState | undefined = | ||
| cached && cached.source === extractTextCached(message) | ||
| ? { | ||
| status: "loaded", | ||
| markdown: extractTextCached(cached.message) ?? "", |
There was a problem hiding this comment.
Include retained full replies in transcript search
After a warm reload while disconnected, the bubble displays the retained full reply, but searching for text beyond its truncated preview hides the message. The retained expansion is resolved only here; chat-transcript-projection.ts still supplies search with expandedAssistantMessages, and messageMatchesSearchQuery in chat-thread-items.ts only checks that map before falling back to the preview. Until a live full-message fetch succeeds, visibly displayed cached text is therefore unsearchable. Have rendering and search consume the same retained recovery state.
Useful? React with 👍 / 👎.
9dbc39e to
4ef4516
Compare
4ef4516 to
38d997c
Compare
38d997c to
ea19d12
Compare
Request the existing full-message display budget for the retained history window, keeping the response and tool-result bounds. Refill disposable snapshots produced with the shorter history projection. Add projection/disk and native reload regressions, plus opt-in real-Gateway text fidelity evidence.
ea19d12 to
df013b1
Compare
…189918) A warm reload no longer restores a previously expanded long assistant reply as its 8,000-character history preview and then grows it by about 280 px when live recovery finishes. The transcript recovery owner now retains the accepted full display response in the existing scoped row-display facts; the renderer shows it while reconnecting or offline, a changed source preview rejects the stale fact, and normal live revalidation still runs. Server replay and pairing QR data are stripped before retention, and the single facts writer admits a recovered object only up to 64 KiB serialized (larger replies keep today's preview then live recovery). Transcript search keeps main's createChatSearchMatcher factory and prose fast path, with retained/live recovery selection inside the closure. Snapshot projection 13 -> 14 drops old disposable cache records: expect one cold reload after deployment. Existing row pruning, 12 MiB per-record, 24 MiB total and 20-session bounds are unchanged. No server schema, protocol, config or history-request change. Proof: 11 interleaved AWS pairs per route plus A/A: complete cached text 11/11, expansion 280 -> 0 px, final rows earlier by 409 ms (chat) and 620 ms (dashboard); dashboard FCP/first rows +54/+56 ms within the accepted +60 ms complete-first-paint tradeoff; no LoAF/CLS regression. Runtime +67 LOC vs main. The only red PR check is check-lint-core-2 on src/skills/workshop/experience-review.test.ts (untouched here), reproduced byte-identically on main.
Rebase Validation
Current head:
df013b1b0da25e3be8d057c3d8fb9a7dd512a403, rebased on main5342923d897ad8a8021bdf586753f8cd38cd3094. GitHub reports MERGEABLE; the PR remains ready and unmerged.Kept #190238's
createChatSearchMatcher(query, recovery)factory: query normalization and the phrase matcher are prepared once, while the shared retained/live full-message selector runs inside the returned message closure. Main's plain-prose fast path remains unchanged, and the old per-message matcher API is not restored. The auto-merge audit preserves projection v14 versus main's v13, the single-writer 64 KiB bound, the 80-row display window and main's shared-envelope optimization, and the existing probe sampling lifecycle.Fresh full-branch autoreview of the resolution is clean through P2. Reviewed files and context inputs are byte-identical after the final locale-only rebase. The only additional commit formats the resolved closure. Runtime delta versus pinned main: +67 LOC; requested production-stat filter: 267 additions / 99 deletions = +168.
AWS validation:
cbx_2bcbddd3efba, c7a.8xlarge (32 CPUs / 61 GiB observed). This larger validation profile avoids the kernel OOM seen on both prior 32 GiB source arms; no performance comparison was run on it. Changed e2e costs below usepnpm test <file> --maxWorkers=1.pnpm tsgo:uipnpm tsgo:test:uinode scripts/check-changed.mjscheck-lint-core-2red and its aggregateopenclaw/ci-gatered. UI e2e and typecheck jobs passed.Red classification against pinned main:
src/skills/workshop/experience-review.test.ts:167–168,typescript(no-unnecessary-type-arguments)on two default<void>arguments. The file is unchanged by this PR. The failed job log was fetched once. Running targeted lint locally on the PR sources and the exact pinned-main source tree produces byte-identical diagnostics at those two locations; the file's 19 runtime tests also pass locally on both source trees. The PR sources were restored and verified clean. The aggregate gate fails because of this lint job; no CI retry or unrelated source repair was used.check-changedadditionally flags unusedsrc/infra/sqlite-native-runtime.ts: assertSafeSqliteRuntime. An isolated scan on exact pinned main, AWScbx_69861e8f82a2(c7a.4xlarge), reports the identical export in both production and full-tree scans: exit 1, 134.32 s. No SQLite implementation, schema, or visibility was changed. This is a reproduced inherited failure.Both validation leases are released with cleanup complete and no host remaining. The candidate's final loopback-listener check is empty.
The lead waived a new benchmark because the manual runtime resolution is confined to the search closure. Performance tables, screenshots, the full-suite list, and old baseline controls below remain explicitly pre-rebase evidence on
ea19d12c9081; they are not new-head results. The requested focused/browser/e2e and typecheck/check-changed validation above is from the new exact head.What Problem This Solves
A warm reload loses the full assistant reply already displayed by live recovery: the browser snapshot contains the 8,000-character history preview, so the first restored row is truncated and later expands by about 280 px.
Why This Change Was Made
The producer is
DEFAULT_CHAT_HISTORY_TEXT_MAX_CHARS = 8_000in chat-display-projection.helpers.ts, line 24; the truncation marker is appended at line 156. History (git log -p -S) traces the 12,000 → 8,000 reduction to 4f00b769251d, which tightened context limits and bounded excerpts. That request-size cap remains useful; the missing piece was retaining the full display response already accepted by automatic recovery.Retain the accepted full display response at the transcript recovery owner in existing scoped row-display facts. The renderer can show it while offline or reconnecting; changed source previews reject stale facts, and normal live revalidation remains. Server replay and pairing QR data are removed before retention. The single facts write owner admits a recovered object only when its serialized UTF-8 size is at most 64 KiB, including its exact source. Larger replies retain today's preview then automatic live recovery behavior.
Projection 13 → 14 drops old disposable cache records: expect one cold reload after deployment, then complete cached rows on subsequent reloads. Existing row pruning, 12 MiB record, 24 MiB total, and 20-session limits remain. No server schema, protocol, runtime configuration, or history-request changes.
User Impact
Loaded replies within the bound return with their complete text/media and final row height. Rendering and transcript search use one recovery-selection owner, so the cached tail remains searchable offline; loaded live recovery takes priority and exact-source matching rejects stale cached text. Release-note context: preserve previously displayed complete assistant replies during warm reloads.
Accepted Paint Tradeoff
The accepted product tradeoff permits paired FCP and first-painted-row increases up to +90 ms on chat / +60 ms on dashboard when the first restored row is complete, rather than painting a shorter preview that then expands. Chromium retains the old compositor surface until the new paint. Complete text 11/11, zero expansion, final geometry earlier 11/11, existing cache bounds, and no LoAF/CLS regression beyond A/A remain required.
The final unprofiled run below passes those gates. Chat paired FCP/first rows are −7.27/−4.12 ms with mixed signs, so no paint-speed improvement is claimed. Dashboard paired FCP/first rows are +53.60/+56.02 ms, within the accepted +60 ms bound. Complete cached content and final-row geometry arrive 409 ms earlier on chat / 620 ms earlier on dashboard, in 11/11 pairs on each route, without the 280 px expansion.
Bounded Attribution
Assessment: class (a), normal complete-row Markdown/DOM rendering and paint scheduling; no actionable class (b) hotspot found. This is a bounded assessment from exactly one profiled A/B warm pair per route, not an exact causal allocation of every millisecond in the prior unprofiled FCP rise. No further optimization or trace run is proposed.
Head
596deb526d8e104d1f8f1846f7abb6300ad1f504, base04d6904c734a, AWScbx_534db4f28027, c7a.4xlarge. Same real-Gateway long-Markdown fixture and signed-in admission. Four warm profiles/timelines total. Profiled reports are marked and excluded from timing comparisons; profiler startup, module-cache generation and scheduling materially perturb the wall timings.To isolate initial cache rendering, source-mapped V8 samples were clipped to the common interval before either arm's first full-message response (about 880 ms chat, 945 ms dashboard under instrumentation). Candidate cached text is already complete in this interval. Inclusive function times overlap; the grouped snapshot/Markdown figures below use exclusive samples.
readinclusive samplesThe dashboard pair shows about 12 ms extra ordinary Markdown samples and 6 ms extra layout; the chat pair does not reproduce an additional Markdown/layout CPU cost under instrumentation. The measured cache paths are far too small to explain the earlier +85/+54 ms unprofiled wall rise. Source inspection confirms
json.unknownis an identity reader (ui/src/lib/snapshot-json.ts:29), facts reads are synchronous, andextractTextCachedis memoized. There is no sampled extraction hotspot. These observations support normal render/paint scheduling rather than a new heavyweight cache validation or admission wait. Single-pair sample differences are not performance gains or regression estimates.Both candidates record exactly one text/height state: complete 7,439-character rendered text at 3,718.5 px. Both baselines record a 6,728-character preview at 3,438.546875 px and then the complete state. No visible cached-preview-to-full replacement appears in either candidate. Source-mapped stacks and raw traces are preserved for independent inspection; no claim is made that a MutationObserver proves absence of every invisible intermediate DOM operation.
Review separately found a diagnostic observer that could start redundant sampling loops; the final probe reuses the existing frame loop. The one-pair profiles remain exploratory, with profiler/probe scheduling limits; they do not allocate the earlier wall-time rise precisely. All final A/A and A/B measurements below use the corrected probe. No further runtime optimization or trace attempt was made.
Evidence
Performance head:
ea19d12c9081091e4b37b78fe4f2b9607579b0b2. AWS Crabboxcbx_d49c37fec9aa, c7a.4xlarge, 16 CPUs / 30 GiB. One fixed instance for 11 interleaved pairs plus A/A, both routes, both harnesses. Real-Gateway RTT shaping: 80 ms; native Team-scale: live-fast, untraced. A/B quiet-host CPU idle: 92.42%.The real rig uses production HTTP/WebSocket and synthetic long Markdown. The native Team-scale bench cross-checks the UI with synthetic WebSocket fixtures. Measurements exclude builds/tests; no local-Mac timings are performance evidence.
Independent cross-arm equality: all 22 candidate first cached states exactly match baseline settled live text hash, character count (7,439), row height, and width. The 64 KiB bound preserves this fixture on all reloads.
Connect-first with exactly one connect: 176/176 warm reloads across both harnesses and A/A + A/B. Real-Gateway warm reloads with one main document: 88/88; browser errors: 0.
Snapshot growth exceeds the 5% preference. The additional full display and exact source cost about 18 KiB per measured snapshot, below 0.08% of the existing 24 MiB total budget. This removes the visible missing final list items/links and row-height settlement. Canonical history stays unchanged; the existing row pruning, 12 MiB per-record, 24 MiB total and 20-session bounds remain. JSON bytes exclude Blob payloads.
Median [Q1, Q3]; paired deltas are candidate minus baseline. CLS is unitless; other values are milliseconds. Real first rows uses the paint milestone; final rows is DOM geometry. Compositor frames are inspected separately.
Native dashboard first-row Element Timing is unavailable in both arms (all 44 A/A+A/B samples). It is shown as unmeasured, without replacing it with a DOM milestone. Real-Gateway dashboard painted-row measurement owns this gate. Native hello is response receipt; the real-Gateway table owns hello-handled.
Admission flags (accepted +90/+60 ms paint bounds applied): []. Chat FCP/first rows accept up to +90 ms paired median; dashboard up to +60 ms. All deltas remain visible. Other overlapping-IQR mixed-sign rises are noise, not harm.
All real-Gateway A/A and A/B paired deltas
AA / chat
AA / dashboard
AB / chat
AB / dashboard
All native A/A and A/B paired deltas
AA / chat
AA / dashboard
AB / chat
AB / dashboard
Pre-rebase Proof (ea19d12)
AWS Crabbox
cbx_d49c37fec9aa, c7a.4xlarge, exact headea19d12c9081; pinned main091884c4c789. Both Chromium and WebKit are installed. These are validation wall times, not performance measurements. Changed-file costs usepnpm test <file> --maxWorkers=1.check-changedAll three touched e2e files also pass in the full-suite context: native cached-text/offline-search fidelity, warm boot (10 cases), and completed assistant real-Gateway history. The history-capture test waits for the existing authoritative
transcriptReadysignal before recording/flushing its snapshot; “not loading” also admits an idle pane. Content, order, draft, empty-bubble, and delta-cursor assertions remain unchanged.Pinned-main classification: AWS
cbx_22d2c8eeaa60, c7a.4xlarge, checked out exact main091884c4c7895512ad700f27b96a5065207c2b25before installation. Only the failed components/files were run, with each e2e file usingnode scripts/run-vitest.mjs <file> --maxWorkers=1and both browser engines installed. Every red result reproduces independently on this baseline.PendingContextEngineTurn,allowProviderModels,materializeSessionRepositoryWorkspaceOnGateway; all outside changed pathsui/src/e2e/chat-outbox-migration.e2e.test.ts:71Control UI initial roster did not finish loading and renderingerror and 10 s wait; 1 failed / 1 passed; 43.45 sextensions/qa-lab/src/control-ui-automation-management.real-gateway.e2e.test.ts:315Private mutation boundary is writable by another POSIX principalerror; 1 failed / 1 passed; 260.28 s including runtime preparationThese are inherited/environment failures, not passing replays. No permission guard or baseline was weakened. Both AWS leases are released with cleanup complete and no host remaining; the candidate's final loopback-listener check was empty. No local Gateway was started.
The oversized regression is red on the unbounded implementation and green with the 64 KiB write bound: an 80,000-byte UTF-8 reply (under 64 Ki UTF-16 code units) is not retained, while both mounts show its preview then automatically recover the full live reply. The persistence/privacy and native held-connect equality regressions fail on the original runtime. The extended offline-tail search test is red on the prior retained-recovery implementation and green here; it also protects operator-scope invalidation. No test-only production seam is added.
Complete full UI e2e file results
Under each project/directory below, names omit the common .e2e.test.ts suffix; .tsx filenames are shown in full. Each entry is one file result.
Counts: pass=886, fail=2, skip=3.
Size and Ownership
Scope: 24 files: 11 UI runtime owners, eight test files and the test-host adapter, three existing-rig files, and one exact test-line allocation.
UI runtime on the current rebased head: +67 lines; diagnostics in the existing rig: +66 lines. Requested production-stat filter: 267 additions / 99 deletions = +168 (also includes
.test.tsx+28, allocation +2, proof documentation +5). Exact test growth/allocation: +226 for persistence/privacy, bounded UTF-8 fallback, offline search, and native cache/live fidelity, after consolidating existing media/source cases.Growth serves the retained-display/source contract, offline full-media ordering, privacy exclusions, and the 64 KiB admission bound. Superseded live-loader-only render guards and the renderer-local recovery selection are removed; rendering and search consume the same existing recovery owner. Accepted transcript recovery produces display facts; the API read-through loader remains unchanged. The existing scoped snapshot is the sole cache owner. The rig adopts main’s canonical long-Markdown fixture rather than retaining a second fixture flag/path.
Synthetic Visual Evidence
Final-head warm pair 1, first cached compositor frame (
frame-00001.png) on each route; pre-navigation frame 0 is excluded. Baseline ends at item 19 with the truncation marker; candidate already includes item 24 and the review links. The settled baseline/candidate PNGs are byte-identical for each route in this pair. All four captures were inspected in full and contain only synthetic fixture data. Other sidebar, styling, Details, and dashboard settlement remains outside this row-fidelity change. DOM settlement is measured independently from compositor paint; earlier DOM does not imply earlier paint.