Skip to content

fix(iOS): performance - reduce chat streaming and transcript update work - #168919

Merged
roboclaw-bot merged 3 commits into
openclaw:mainfrom
Marvinthebored:fix/apple-chat-redundant-updates
Oct 22, 2026
Merged

roboclaw-bot merged 3 commits into
openclaw:mainfrom
Marvinthebored:fix/apple-chat-redundant-updates

Conversation

@Marvinthebored

@Marvinthebored Marvinthebored commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

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

  • 353 shared tests in 5 suites passed, including coalescing, no transcript invalidation for new words, retired callbacks, history duplicate suppression, lifecycle and narration boundaries.
  • 60 native simulator tests passed in RootTabsPresentationTests; the simulator app built successfully.
  • The original telemetry/history regression tests fail on stock code and pass with the observation fixes.
  • The hosted replay rendering tests settle the paced display before each rendering assertion; all 19 ChatStreamReplayTests pass with that settlement. The unused liveAssistantText projection is removed, and its comparison tests now call the retained liveText comparison.
  • SwiftFormat, changed-source strict SwiftLint and diff checks pass.

Native app run

The app ran the native UI test testPerformanceReviewProof on the iPhone 17 simulator: a 60-row transcript, a streamed reply, token-only updates, identical history refreshes and completion. It passed, with the 19 ChatStreamReplayTests, in the same run. Evidence summary · runtime log · recording · diagnostic harness

Input to the app Count View work logged
Streamed assistant text events 128 34 paced flushes, 25 transcript body evaluations
Token-only updates 12 13 token-indicator body evaluations, 1 transcript body evaluation
History refreshes 20 16 reported unchanged, 4 changed
Terminal event 1 reply settles into history

Paced 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.

Working indicator from native recording

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 297f3d8cf2e6ec27201df0eab2bab0d371514438 and its uncommitted composition with PR head 14452ca3b2b75724682e8c6dd3fc593df46142fc (source tree 5a4a2baa34b7c29c2f876ee5a01f016a2845c8c0). This is synthetic-transport native UI proof, not a new published candidate SHA or a physical-device/live-Gateway result.

  • Twelve supplied finalized test summaries report 12 passed / 0 failed / 0 skipped: one excluded warmup per side, then five interleaved A/B pairs. The same 60-row, 12-token-event, 128-assistant-event, three-history-replay workload and UI assertions ran on both builds.
  • Median transcript body evaluations: 182 → 43 (−76.4%). Median display-owner publications: 136 → 53 (−61.0%). These are work-count improvements, not frame-rate or latency-speedup claims.
  • The reader anchor remained at the same coordinate during growth and after completion in every supplied sample; the actual jump-to-latest button revealed the settled answer.
  • Median owner publication delay increased 1.70ms → 52.18ms; the maximum among measured B samples was 129.80ms (the excluded B warmup reached 157.62ms). This measures publication at the display owner, not rendered pixels, and is not a hard 150ms deadline.
  • XCTest-observed first output was 5.412s → 5.377s; completion was 18.239s → 18.919s (+3.7%). These include fixture delay and UI-automation observation overhead. Sampled whole-process CPU span fell approximately 8.8%; RSS was essentially unchanged. Main-thread CPU and frame/hitch metrics were unavailable and are not inferred.

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.

@clawsweeper

clawsweeper Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 11, 2026
@clawsweeper

clawsweeper Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This 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.

  • Before: Each text update can invalidate the enclosing transcript and issue another scroll command.
  • After: Growing text updates in short batches inside the live bubble, while readers can remain on rows 48–51 through completion.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Focused owner-level repair with inspected native app evidence, meaningful observation regressions, and no open correctness or security finding.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (logs): The iPhone 17 simulator app exercises the production chat view and view model with a 60-row transcript, streamed text, token-only events, unchanged history, and completion; inspected screenshots and runtime logs demonstrate paced rendering and preserved reading position, and the relevant mechanisms remain unchanged from the tested revision.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Native chat performs avoidable transcript work while replies stream, token counters advance, or unchanged history arrives.
Reason: The source-supported defect has clear responsiveness value, and the repair stays within the shared native presentation owner without adding settings or persistent state.

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
Reviewed head: 14452ca3b2b75724682e8c6dd3fc593df46142fc

Before merge

None.

Findings

None.

Agent review details

How this fits together

The 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]
Loading

Technical review

Best 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

  • Run telemetry observation keeps the original intent (df9a940: Live run telemetry keeps elapsed time and token usage visible across clients while preserving run ownership.)
  • Narration reconciliation keeps the original intent (b5f3444: Transient run-owned narration remains visible until canonical history adopts it or a settled snapshot retires it.)
  • Live-text duplicate suppression keeps the original intent (fa8fc42: Prefer an exactly matching saved or sealed assistant row over a second streaming copy without clearing authoritative stream state.)
  • Streaming timeline notifications changes intended behavior with a stated reason (ab2761f: Timeline revisions supported reader-managed scrolling; this PR explains replacing per-word notifications with structural updates and native size-change anchoring.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 17803f3 adds apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatViewModel+SessionKeys.swift:139 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 17803f368538; files: apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatViewModel+SessionKeys.swift)
  • Marvinthebored: Raw commit fa8fc42 adds apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatViewModel+TranscriptCache.swift:29 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: fa8fc4242707; files: apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatViewModel+TranscriptCache.swift)
  • christopheraaronhogg: Raw commit ab2761f adds apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatViewModel.swift:356 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: ab2761f3a59a; files: apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatViewModel.swift)

PR surface

Source +139, Tests +147. Total +286 across 7 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 5 163 24 +139
Tests 2 179 32 +147
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 342 56 +286

Labels

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P2: Redundant native transcript rendering affects responsiveness during active chats without evidence of message loss or runtime unavailability.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (6 earlier review cycles)
  • reviewed 2026-10-11T05:53:04.221Z sha 20aa74cc3e1d8afe30072a21501d55107b1f1757 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-11T09:27:09.473Z sha 20aa74cc3e1d8afe30072a21501d55107b1f1757 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-11T15:03:19.859Z sha 20aa74cc3e1d8afe30072a21501d55107b1f1757 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-11T15:42:14.908Z sha 14c43c56462d70ca1802480173aa9a9019f4bfab :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-12T04:05:04.845Z sha 14c43c56462d70ca1802480173aa9a9019f4bfab :: needs changes before merge. :: [P2] Remove the retired liveAssistantText projection | [P2] Settle paced display before hosted rendering assertions
  • reviewed 2026-10-12T04:25:29.235Z sha 0976e152041d3ca19803d8ef4138b09725010795 :: needs maintainer review before merge. :: none

Reviewed October 13, 2026, 10:12 PM ET / October 14, 2026, 02:12 UTC (Revision 7).

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Oct 11, 2026
@Marvinthebored Marvinthebored changed the title fix: avoid redundant native chat updates during active runs fix(iOS): performance - avoid unnecessary chat transcript updates Oct 11, 2026
@clawsweeper clawsweeper Bot added the proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. label Oct 11, 2026
@Marvinthebored Marvinthebored changed the title fix(iOS): performance - avoid unnecessary chat transcript updates fix(iOS): performance - reduce chat streaming and transcript update work Oct 11, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 12, 2026
@Marvinthebored
Marvinthebored force-pushed the fix/apple-chat-redundant-updates branch from 0976e15 to 14452ca Compare October 14, 2026 02:00
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Oct 14, 2026
@roboclaw-bot roboclaw-bot added the clawtributor-review Clawtributor pull request awaiting prioritized maintainer review label Oct 22, 2026
@roboclaw-bot
roboclaw-bot merged commit dde2941 into openclaw:main Oct 22, 2026
94 checks passed
@roboclaw-bot

Copy link
Copy Markdown
Collaborator

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 23, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawtributor-review Clawtributor pull request awaiting prioritized maintainer review P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Native chat performs redundant transcript updates during active runs

4 participants