Repository navigation
fix(ios): eliminate one source of chat scroll jitter and freezes (every message rebuilt on each scroll tick) - #165948
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 isolates native chat scroll-follow observation from transcript rendering. Example: Swipe 16 times through a native chat containing 60 question-and-answer pairs.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it removes unnecessary native transcript rebuilding without changing reader policy, and no actionable introduced defect was found; exact-head CI remains pending. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe shared SwiftUI chat serves iOS and macOS; scroll geometry and gesture phases update reader state, which controls the size-change anchor and Jump to latest affordance. flowchart TD
A[Native scroll gestures] --> B[Geometry and phase callbacks]
B --> C[Observable follow state]
C --> D[Size change anchor]
C --> E[Jump control]
F[Chat view model] --> G[Transcript rendering]
E --> H[Existing scroll command]
Technical reviewBest possible solution: Retain the narrow observation isolation while preserving the existing reader policy, transcript grouping, and one-shot scroll-command owner. Do we have a high-confidence way to reproduce the issue? Current main reads scroll-follow State during transcript construction, and the supplied baseline native trace independently shows repeated preparation at gesture transitions; no target code was executed during this review. Is this the best way to solve the issue? The patch addresses the observation boundary directly using one reference-held state owner and two narrow rendering consumers, without adding a cache, alternate renderer, or competing reader policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 35b1636f135b. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +30. Total +30 across 2 files. Added test files: 0. View PR surface stats
Review metrics
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 (7 earlier review cycles)
Reviewed November 2, 2026, 11:01 AM ET / 16:01 UTC (Revision 8). |
e3639b8 to
f6205a7
Compare
f6205a7 to
e6de8f6
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
The follow flags flip when a swipe starts and ends. They were @State read by the chat view's body, so each flip re-evaluated the view and rebuilt every transcript row. Hold that state in an observable object that only the follow anchor and the jump-to-latest slot read. Scroll handling is unchanged.
cde4f19 to
5b531a0
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
Related: #163153
What Problem This Solves
Fixes unnecessary transcript rebuilding when users start and end swipes through long native chats.
Why This Change Was Made
Follow state lives in a reference-held observable owner. Small views observe the size-change anchor and jump-button visibility without subscribing the transcript to those updates. Reader policy, message grouping, and scroll-position storage stay unchanged.
User Impact
Starting and ending a swipe does less transcript work, leaving more capacity for scrolling. Jump to latest retains its existing behavior.
Evidence
Focused shared-kit Swift validation: 17 tests in 2 suites passed (
ChatReaderScrollStateTestsandChatScrollCommandTests), using Xcode 27.1 and two build workers after preparing the Mermaid resources.Matched native swipe proof on an Xcode 27.1 simulator: 60 question-and-answer pairs created through the unchanged local demo chat UI, followed by 16 native swipes on each side. Transcript body, preparation, and row-builder evaluations fell from 33/33/33 to 0/0/0. Both sides observed 16 interacting/decelerating/idle transitions and passed the native test. Jump to latest appeared away from the tail and returned to reply 59 when tapped; screenshots were inspected.
This measures simulator transcript work reduction, not device frame rate or latency. Identical scratch-only instrumentation was applied to both sides and was not included in the patch.
Raw traces, counts, test markers, and instrumentation.
The separate keyboard-after-send test failed on both the clean baseline and candidate while waiting for the sent prompt; it does not establish a keyboard-follow improvement or regression from this change.
AI-assisted.