Repository navigation
fix(iOS): performance - reduce chat streaming and transcript update work - #168919
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. What this changesThis PR batches displayed streaming text and prevents token-only updates and unchanged history from rebuilding the native chat transcript. Example: A native chat displays 60 history rows while receiving 128 assistant text events.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it addresses a remaining native chat performance defect, resolves the earlier findings, and introduces no actionable bug found in this review. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe shared Apple chat view model receives Gateway history and run events, reconciles transcript state, and supplies SwiftUI views used by iOS and macOS. flowchart LR
A[Gateway history and run events] --> B[Shared chat view model]
B --> C[Transcript and narration projection]
B --> D[Paced display text]
B --> E[Run telemetry]
C --> F[Native transcript view]
D --> G[Live reply bubble]
E --> H[Working indicator]
Technical reviewBest possible solution: Retain this focused shared Apple observation repair with authoritative stream state, completion handling, and reader-controlled scrolling preserved. Do we have a high-confidence way to reproduce the issue? Current main exposes both reported observation paths, and supplied regressions cover token-only updates and identical history; this read-only review did not execute target code. Is this the best way to solve the issue? The change repairs the existing shared observation owner, isolates frequent display updates, and preserves sequence ordering, duplicate suppression, narration settlement, and terminal cleanup. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 5dd456acfa35. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +139, Tests +147. Total +286 across 7 files. Added test files: 0. View PR surface stats
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 HistoryReview history (6 earlier review cycles)
Reviewed October 13, 2026, 10:12 PM ET / October 14, 2026, 02:12 UTC (Revision 7). |
0976e15 to
14452ca
Compare
|
Merged via squash.
|
…ork (openclaw#168919) Reduce redundant Apple chat observation and transcript updates while keeping authoritative stream state immediate. Native synthetic A/B validation reduced median transcript evaluations from 182 to 43. Preserve the disclosed batching-delay and completion-observation tradeoffs accepted for landing by Colin; focused Mac and real-client follow-up lanes remain unexecuted as recorded in the PR. Co-authored-by: Marvinthebored <[email protected]> Co-authored-by: Solvely-Colin <[email protected]>
Closes #168918
What Problem This Solves
Fixes unnecessary native chat transcript work while replies stream, active-run counters advance, or unchanged history arrives.
User Impact
Live replies update in short batches while token counters, completion and settled narration continue to update. Scrolling no longer competes with a transcript scroll command for every word.
Why This Change Was Made
Keep authoritative stream state current, pace its displayed text in the default run-loop mode, and observe that text inside the live bubble. Separate telemetry from lifecycle observation and ignore unchanged narration reconciliation. Native size-change anchoring follows the growing reply at the live edge.
Evidence
ChatStreamReplayTestspass with that settlement. The unusedliveAssistantTextprojection is removed, and its comparison tests now call the retainedliveTextcomparison.Native app run
The app ran the native UI test
testPerformanceReviewProofon the iPhone 17 simulator: a 60-row transcript, a streamed reply, token-only updates, identical history refreshes and completion. It passed, with the 19ChatStreamReplayTests, in the same run. Evidence summary · runtime log · recording · diagnostic harnessPaced reply at the live edge, then a reader paused on rows 48 to 51 during streaming, after completion, and the settled transcript:
AI-assisted. Validation output and sanitized work record.
Existing physical-device recording
Native iPhone working-indicator recording shows tokens advancing from 1,233 to 2,210 while elapsed time and activity text update.
Maintainer validation and accepted tradeoff (2026-10-22)
Validation supplied by @Solvely-Colin on a task-owned iPhone 17e simulator (iOS 27.0), using baseline main
297f3d8cf2e6ec27201df0eab2bab0d371514438and its uncommitted composition with PR head14452ca3b2b75724682e8c6dd3fc593df46142fc(source tree5a4a2baa34b7c29c2f876ee5a01f016a2845c8c0). This is synthetic-transport native UI proof, not a new published candidate SHA or a physical-device/live-Gateway result.The 26 received payload hashes matched their manifest; both diagnostic overlays reconstructed their exact reported source trees. Aggregate calculations and supplied timestamp/coordinate records were independently checked. Source/overlay and summary inspection is not independent execution of the native runs; raw private xcresults, app logs and executable bytes were not rerun or republished.
Known validation limits: the follow-up six-suite macOS filter and matched negative control were not executed because no safe AppKit environment was available; the six-case real-client lane was not executed because no current task-owned Gateway/session plus approved model route was established. Historical contributor test results and CI above retain their original source bindings. The native workload does not independently establish replacement-run callback retirement, all reasoning/Markdown variants, real transport recovery or a full transcript duplicate-count oracle. Static review covers those owners; the existing required GitHub gates remain authoritative.
Landing direction: @Solvely-Colin accepted the disclosed batching tradeoff and instructed landing on 2026-10-22 after reviewing these results and limitations. No production repair was added for the measurements. A fresh isolated P0–P2 pre-landing source review found no actionable introduced defect.