Repository navigation
improve(ios): reduce repeated work while reading long chats - #198114
Closed
roboclaw-bot wants to merge 17 commits into
Closed
roboclaw-bot wants to merge 17 commits into
roboclaw-bot wants to merge 17 commits into
Conversation
Worked on by: - @mikengyn - @vyctorbrzezowski Co-authored-by: mikengyn <[email protected]> Co-authored-by: vyctorbrzezowski <[email protected]> OpenClaw-Publication: dc82630d-7e7f-438e-9099-0e75dafd6661
Contributor
|
🦞👀 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. |
Contributor
|
Codex review: stale review; fresh review needed. Summary Next step Review history (1 earlier review cycle)
|
Worked on by: - @mikengyn - @vyctorbrzezowski Co-authored-by: mikengyn <[email protected]> Co-authored-by: vyctorbrzezowski <[email protected]> OpenClaw-Publication: 41e88100-3e68-4533-a831-9105ead7b210
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related: #192232
What Problem This Solves
Reading long chats can repeatedly prepare the same transcript during unrelated view updates and scroll callbacks; an unfinished code fence inside a streamed list could also enable highlighting or Mermaid rendering before closure.
User Impact
Reduces redundant transcript preparation while preserving the current chat design, grouped replies, reader position, sidebar animation, and streaming word fade. Native build, device behavior, and measured performance are still pending; this is a draft for the Mac verification loop, not a ready-to-merge performance claim.
Stacked dependency: Vyctor accepted stacking this new PR on #192232 at
7618f4311be932aadf7a06d18e28fbfe806c407d. The inherited dependency changes shown against main are not this fix. The authored delta against that immutable head is seven files: the original five-file transcript preparation plus a two-file streamed-list fence repair requested during review. This PR does not modify #192232, does not duplicate #194235 composer isolation, and requests no merge.Why This Change Was Made
One mounted chat now retains one immutable prepared transcript for its actual message, narration, reader-history, display-policy, session/model, run, and tool inputs. Rendering and scroll callbacks share its rows, footer metadata, groups, iOS cells, and turn anchors; split-row actions reuse the already-projected full current message instead of projecting history again per part.
The existing rendering, grouping, visibility, and scroll policies remain the owners of behavior. The cache is bounded to one preparation per view, reads observed dependencies even on hits, and does not rely on timeline notifications alone. This does not implement changed-delta incremental Markdown or remove the existing live-text reconciliation work. Input comparison and retained preparation have a CPU/memory cost that still needs device measurement.
The review repair propagates message completion through every recursive list level and accepts fence closure only when the parser consumed a matching closer inside the list item. Shorter, mismatched, trailing-content, over-indented, and outside-list fence-looking lines remain incomplete. It is equivalent to the minimal fix in #198122 at
57ba92122c12c94f95504d51c4d9462ff66c7343, without importing that PR’s other changes.Simplification removed duplicate callback preparation and the forwarding grouping wrapper. Against the dependency head: production +236/-133 lines (net +103); tests +307 lines. The fence repair itself is +28/-1 production lines and +66 test lines. The retained growth supplies the one-entry owner and its invalidation/reuse proof; no durable state, schema, setting, or dependency change is authored here.
Evidence
833e8853e47b872c25376df602cc4631ebb5abeb. Remote GitHub commit/compare reads verify its sole parent is the original published headda48e3f1521eb2ddab73783fc529771c79b0c794. It is two commits ahead of7618f4311be932aadf7a06d18e28fbfe806c407d; all seven changed remote blobs match the inspected local files. The new commit changes onlyChatMarkdownBlockSegmenter.swiftandapps/ios/Tests/ChatStreamingCodeFenceTests.swift(+94/-1). Both required human coauthor trailers are present. GitHub currently reports conflicts against main (mergeState: dirty); the accepted dependency base is intentionally preserved for this draft build loop, not rebased.7618f4311be932aadf7a06d18e28fbfe806c407d; independent managed worktree was clean before applying the reviewed patch.e9f9836e42f54bc12f07b3018c3f4150e83a38788ac85fdd5bc331e8e40e8bb7. Verified checksum, five-file allowlist, clean exact base, forward apply check, reverse apply check, andgit diff --check. Inspected the complete patch, original ChatView, and grouping/footer/history owners. No overlay, docs, skills, or source-transition changes are included in the authored delta.7618f4311be932aadf7a06d18e28fbfe806c407d, OpenClaw engine /openai/gpt-6.1-sol, P0–P2: scoped-clean, no findings. Static review only; native Apple builds/tests were not run and unavailable unchanged context was not independently verified. The original five-file implementation also retains its earlier parent-reported review evidence.ChatTranscriptPresentationTestscover interleaved independent readers and unrelated updates, policy/run/tool changes without timeline notifications, narration/history deletion/outbox/content changes, and full-message actions from split parts. These tests have not run here. Baseline red/green, test wall time, and CI seconds remain unmeasured.ChatStreamingCodeFenceTestsat the real segmenter boundary for ordered/unordered/nested/tab/same-line list fences, valid closure or final-message completion, and invalid/outside closers. Current pre-repair source hardcodes these blocks complete; the new!isCompleteassertions target that defect directly. Executed native red/green proof and timing remain pending, not claimed.git diff --checkand final seven-file allowlist/original-five-blob preservation checks passed.Pending Mac verification
At
833e8853e47b872c25376df602cc4631ebb5abeb, with Xcode 27.1+ / Swift 6.3 and a task-owned simulator:For the red control, use a separate task-owned checkout at
da48e3f1521eb2ddab73783fc529771c79b0c794with only the newChatStreamingCodeFenceTests.swiftcopied from the candidate. Runpnpm ios:build, thenIOS_SIM="<task-owned simulator UDID>" pnpm ios:test ChatStreamingCodeFenceTests; the incomplete-fence assertions should fail there and pass on the candidate. A setup/build failure is not the red control. Also exercise an unfinished Mermaid and Swift fence inside a nested streamed list through the actual app, then close the fence and finish the message; attach sanitized before/after screenshots and video before marking ready.Also run the new package tests on an iOS simulator so the conditional List-cell assertions execute (a host-only SwiftPM run cannot cover them). Confirm the selected destination/scheme supports that package test target before claiming iOS test coverage.
Before timing, compare dependency base versus candidate on the same synthetic long chat and device: settled history, streaming while reading above the live edge, trace/search toggles, narration/tool handoff, outbox insertion/removal, history trimming/deletion, session replacement, and split-row copy/reply/select-text actions. Preserve grouped/disclosure identity, reader position, return-to-latest behavior, sidebar animation, and word fade. Capture before/after video with the exact head, device, OS, fixture, and build configuration recorded.
Acceptance rule: count actual preparation/group/cell builds first. After the initial preparation, unchanged relevant inputs must cause zero additional full preparations; a relevant input change must produce fresh correct rows. Compare baseline/candidate serially in ABAB order with at least five samples each, separating cold and warm results. Record main-thread/total CPU, frame latency/hitches, cold-open latency, and peak memory with median, p95, and spread. Require a measured reduction in repeated preparation and no correctness/UI regression; a 20% regression in any user-facing metric is a stop, not a pass. The owner test's reuse counts are not a substitute for device performance or UI proof.
Contributor credit: Vyctor Brzezowski and Mike Nguyen.
Work sessions
Linked for team reference; these sessions aren’t public.
Worked on by