Repository navigation
improve(android): reuse chat history during live updates - #147940
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: needs maintainer review before merge. Reviewed September 14, 2026, 1:39 AM ET / 05:39 UTC. ClawSweeper reviewWhat this changesAndroid chat reuses prepared transcript rows and completed-work metadata during live updates, with preservation tests for content replacement, disclosure, and session changes. Merge readiness✅ Ready for maintainer review This remains a useful, focused optimization: current main still repeats history preparation during live updates. No actionable correctness or security defect was found, and the maintainer-authored PR remains paired with its open issue. Priority: P2 Review scores
Verification
How this fits togetherAndroid chat combines published message history with streaming text, pending tools, and queued messages. Its timeline supplies the visible conversation, completed-work disclosures, and scroll anchors. flowchart TD
A[Published history and session] --> B[Prepare transcript rows and work spans]
B --> C[Reuse prepared history]
D[Live text and tool updates] --> E[Assemble timeline]
C --> E
F[Disclosure state] --> E
E --> G[Chat rows and scroll anchors]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +147, Other +43. Total +190 across 12 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep transcript preparation within the chat-screen lifecycle, invalidated by complete history and session changes, while preserving the existing rendering and scroll contracts. Do we have a high-confidence way to reproduce the issue? Yes, for repeated preparation: current-main ChatMessageList rebuilds history when live text or tools change. Source establishes that mechanism; no phone-performance regression was reproduced. Is this the best way to solve the issue? Yes. Reusing existing projection and grouping logic at the screen's history/session boundary avoids a competing cache owner, and all former callers migrate together. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ad157baa20b1. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
Port upstream 5e26a66: split buildChatTimeline into prepareChatHistory + buildTimeline, add expandedWorkKeys, and reuse chat history across live updates. This is the prerequisite refactor for openclaw#148050 (collapse completed work), which assumes prepareChatHistory/buildTimeline/expandedWorkKeys already exist. Fork customizations (iOS-aligned timestamp placement in ChatScreen, composer squircle/104dp) are preserved.
Port upstream 5e26a66: split buildChatTimeline into prepareChatHistory + buildTimeline, add expandedWorkKeys, and reuse chat history across live updates. Prerequisite refactor for openclaw#148050 (collapse completed work). Fork customizations (iOS-aligned timestamp placement in ChatScreen, composer squircle/104dp) preserved. Version reset to 2026.9.17.1 (new day).
) Port upstream b4c6e36: add ChatMessage.phase/isError, ChatTimelineItem.hasUnresolvedTools, and collapse completed work in default chats. Builds on openclaw#147940 (prepareChatHistory/buildTimeline/expandedWorkKeys). Version 2026.9.17.2.
…48904) Port upstream 03c158f: render cited source previews (favicon + source list) in chat. Adds 4 new files (ChatSourceTools, GatewaySourcePreviews, ChatSourcePreviewViews, ChatSourcePreviews), wires AndroidScreenshotFixture.sourcePreviewConfig/loadSourceFavicon into NodeRuntime, and updates native-source.json (+7 strings). Depends on openclaw#148050 (phase/isError/hasUnresolvedTools) which depends on openclaw#147940 (prepareChatHistory/buildTimeline/expandedWorkKeys). Fork customizations preserved. Version 2026.9.17.3.
Closes #147937
What Problem This Solves
Android chat repeats unchanged history preparation when streaming text or pending tools update.
User Impact
No intended visual or behavioral change. This reduces repeated internal preparation work while preserving chat content, disclosure, message identity, and scroll ownership. No configuration or migration is required.
This is not a claim about overall Android speed, phone frame time, retained heap, RSS, or APK size. The candidate retains flat metadata and can retain an additional history-sized reference container in non-dashboard cases.
Why This Change Was Made
ChatScreenremembers prepared history by the complete message list and session. The preparation reuses the existing projection and completed-work analysis, retaining canonical rows and flat spans rather than temporary turn graphs. Live updates emit one final timeline directly; final row materialization remains linear.The internal raw-history builder and second grouping pass are removed, with all existing callers migrated together. Tests preserve live suppression, early content/tool-result replacement with stable IDs and an unchanged tail, disclosure during later streaming, and disclosure reset on session changes.
Evidence
ChatCompletedWorkLayoutTestbaseline 5/5 and candidate 5/5; nine parity cells and all 45 pairs completed. All 23 input pins were restored, the archive and unique artifact marker were verified, and the owned lease completed. "Completed campaign" refers to these verified source-bound retained results and cleanup, not a successful GitHub workflow conclusion: this Actions lifecycle is terminalCANCELLED.ChatScreen, including disclosure, replacement, hidden turns, and session reset.The timing matrix used 200/1,000/5,000 synthetic messages, collapsed/expanded/non-dashboard modes, and 100 live updates per batch. Each cell had three warmup batches per arm and five alternating pairs. Candidate preparation is included inside every batch; typed parity, hashing, and verification are outside timing, with a bounded last-result sink.
Runtime: Linux x64, Eclipse Adoptium JVM 21.0.10; Gradle 9.7.1 used the repository's Java 21 daemon policy with a Java 17 launcher. These are JVM helper measurements, not Android ART measurements.
Paired reductions are medians of
100 * (A - B) / Afor the five pairs, not ratios of the separate arm medians. The 5,000-message collapsed median difference is about 0.398 ms per update. These synthetic history sizes are not established production limits; five favorable pairs do not establish a statistical confidence bound.Process-CPU samples were coarse, including zero-denominator pairs, so wall time is the primary result. Separate JFR profiles locate allocation activity but do not provide exact allocation totals or retained-memory measurements. Raw recordings and the full archive are not published because they can include environment and process metadata.
Proof base:
a43ed90d0e9f22d929c86b3a850ae51209006656. Measured unformatted patch SHA-256:6d74a8649aa673791f46ae42e22220c37ca0d18ef060ceb5f8c7903dec0f41cc. Verified formatter-only patch SHA-256:43003aeef066ea629f2a4c80078b65ecccb0a8419fb53780dbf7c769eb28017e.The separate exact-head hosted CI run 34809774031 is
SUCCESS. Native review, prepare, and squash merge completed on September 14, 2026 at 06:06:40 UTC as5e26a6646663a7d960378f8afe3947ba11a59dcc. All twelve landed files match the prepared head, and native cleanup is complete. Native admitted an advisory mainline-infrastructure drift warning under its existing policy; no enforced gate was bypassed or guard flag changed. The proof scope and historical limitations above are unchanged.Before and after
Expanded completed work is intentionally unchanged.