Repository navigation
fix(ios): keep streaming replies in view and stop the jump when they finish - #198326
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 follows growing native chat replies, coordinates their replacement by saved messages, and moves the working indicator below streaming text. Example: An iPhone user sends UXSTREAM chunks=300 interval=40 with the software keyboard open.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Partial Merge readiness✅ Ready for maintainer review Keep this PR open: it provides a useful partial fix, resolves the previous grader finding, and introduces no confirmed blocking defect; intermittent finish-time blanking remains explicitly deferred. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe shared SwiftUI chat receives paced assistant text and canonical history from its view model, renders live and saved replies, and positions the transcript according to the reader's follow state. flowchart TD
Gateway[Gateway events and history] --> Model[Chat view model]
Model --> Pacing[Stream display pacing]
Model --> Transcript[Canonical transcript]
Pacing --> View[Shared SwiftUI chat]
Transcript --> View
Reader[Reader follow state] --> Anchor[Scroll follow modifier]
View --> Anchor
Technical reviewBest possible solution: Retain this focused repair in the existing scrolling and presentation owners, with intermittent finish-time blanking tracked as separate remaining work. Do we have a high-confidence way to reproduce the issue? The source explains the missing height-driven follow and split live-to-saved rendering updates, while supplied simulator A/B results demonstrate the failures; this read-only review ran no target code. Is this the best way to solve the issue? The patch uses the existing follow modifier, transcript visibility projection, and pacing owner without adding a competing renderer or policy owner, but deliberately leaves intermittent completion blanking unresolved. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 90c620b8e554. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +25, Tests +35, Docs +1, Other +36. Total +97 across 10 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. 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 (1 earlier review cycle)
Reviewed November 13, 2026, 12:53 PM ET / 17:53 UTC (Revision 2). |
accff63 to
8a3aaaf
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed as 97611bd. With the keyboard up, a streaming reply now stays in view, and the jump when a reply finishes (keyboard hidden) is gone. Proof: |
…finish (openclaw#198326) ## What Problem This Solves Fixes: with the keyboard up, a long reply streams below the composer and the reader never sees it; when it finishes, the view jumps to the end or, in about half the runs, stays blank above the "Done in" line until the user scrolls. With the keyboard hidden, every reply visibly jumps up 42 pt the moment it finishes. ## User Impact Replies stay in view while they stream with the keyboard up, and the finished reply no longer jumps. The "working" status line now sits below the streaming words (where the "Done in" recap appears) instead of above them. ## Why This Change Was Made - **Follow the reply (keyboard up).** The transcript relied on `defaultScrollAnchor(.bottom, for: .sizeChanges)`, which left the scroll offset at 0 while the reply grew thousands of points below the composer; streamed words change no timeline revision, so nothing re-scrolled. The follow modifier now also pins the bottom edge (`ScrollPosition.scrollTo(edge:)`) on every content-height change while following. Edge scrolling does not depend on estimated row heights, and it runs in the modifier, outside the transcript body. - **One update for the swap.** When the saved reply lands, two things used to happen in different layout passes: the bubble hid itself in its own observation scope, and the transcript added the row. Now the transcript decides whether the bubble shows (from the live-content shape it already reads), and `replaceMessages` shows any paced words still held back so the exact-match suppression sees the same text. Before, the saved row and the bubble were on screen together for a frame (11,600 pt of content), and the bottom anchor jumped into the doubled content, which is what left the transcript blank. - **No 42 pt jump.** The working indicator sat above the streaming words and vanished when the reply finished. It now sits below them, so the final row takes the bubble's exact position. - Behavior cases: `stream-turn` and `stream-follow` become guards. `stream-follow` gates on following the reply while it streams; when a row changes height, the grader now reads motion on an edge the reader can see, since a reply taller than the screen can change height above the fold without visible motion. A row that keeps its height still counts as a whole move, so a long reply spanning the screen is still measured (re-grading the last run: `scrolled-up` holds read 0 pt drift with a spanning row in every frame). Known remaining glitch, reported by the harness rather than gated: in about one run in three, as the final row replaces the bubble, the transcript flashes to the top for one or two frames (`LazyVStack` measures the run group at ~0 for one layout pass, and the bottom anchor follows that). In about one run in three the view also ends scrolled away from the reply until the reader scrolls (main: about half). The harness reports both; tracing the finish swap is the follow-up. UI change: cc @vyctorbrzezowski for the working-indicator position. ## Evidence Keyboard up, 6 s into a 12 s reply. Before: the view stays at the top while the reply grows out of sight. After: the newest words sit above the composer. | Before | After | | --- | --- | |  |  | Keyboard hidden. The working status now sits below the streaming words (it was above the first heading), so nothing shifts when the reply finishes. | Before | After | | --- | --- | |  |  | `pnpm ios:behavior`, iPhone 17 simulator, 3 samples per case: | Case | Kind | Gates (3 samples) | | --- | --- | --- | | `stream-turn` | guard | all 3/3 | | `stream-follow` | guard | all 3/3 (reply followed while streaming) | | `scrolled-up` | guard | all 3/3 | | `keyboard` | guard | all 3/3 | | `relaunch` | guard | all 3/3 | Exit 0 with this PR's grading. Reported, not gated: in 2 of 3 `stream-follow` samples the reply ended scrolled away from view after it finished (the known finish glitch below). On `main` (with openclaw#198293) the same `stream-follow` follow gate fails in every sample (p95 ~5,600 pt hidden) and `stream-turn` drifts 42 pt in every sample. - New regression test `a durable reply retires the live bubble while pacing holds its last words` fails on the base and passes here; `ChatStreamPresentationTests` and `ChatStreamReplayTests` pass. - `test/scripts/ios-behavior-grade.test.ts`: 6 passed. tsgo, oxlint, SwiftFormat, SwiftLint, native i18n inventory: clean. Merge danger: two-way door. Revert restores the previous scroll and indicator behavior; no state, config or protocol change. Blast radius: the shared chat transcript on iOS and macOS. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Fixes: with the keyboard up, a long reply streams below the composer and the reader never sees it; when it finishes, the view jumps to the end or, in about half the runs, stays blank above the "Done in" line until the user scrolls. With the keyboard hidden, every reply visibly jumps up 42 pt the moment it finishes.
User Impact
Replies stay in view while they stream with the keyboard up, and the finished reply no longer jumps. The "working" status line now sits below the streaming words (where the "Done in" recap appears) instead of above them.
Why This Change Was Made
defaultScrollAnchor(.bottom, for: .sizeChanges), which left the scroll offset at 0 while the reply grew thousands of points below the composer; streamed words change no timeline revision, so nothing re-scrolled. The follow modifier now also pins the bottom edge (ScrollPosition.scrollTo(edge:)) on every content-height change while following. Edge scrolling does not depend on estimated row heights, and it runs in the modifier, outside the transcript body.replaceMessagesshows any paced words still held back so the exact-match suppression sees the same text. Before, the saved row and the bubble were on screen together for a frame (11,600 pt of content), and the bottom anchor jumped into the doubled content, which is what left the transcript blank.stream-turnandstream-followbecome guards.stream-followgates on following the reply while it streams; when a row changes height, the grader now reads motion on an edge the reader can see, since a reply taller than the screen can change height above the fold without visible motion. A row that keeps its height still counts as a whole move, so a long reply spanning the screen is still measured (re-grading the last run:scrolled-upholds read 0 pt drift with a spanning row in every frame).Known remaining glitch, reported by the harness rather than gated: in about one run in three, as the final row replaces the bubble, the transcript flashes to the top for one or two frames (
LazyVStackmeasures the run group at ~0 for one layout pass, and the bottom anchor follows that). In about one run in three the view also ends scrolled away from the reply until the reader scrolls (main: about half). The harness reports both; tracing the finish swap is the follow-up.UI change: cc @vyctorbrzezowski for the working-indicator position.
Evidence
Keyboard up, 6 s into a 12 s reply. Before: the view stays at the top while the reply grows out of sight. After: the newest words sit above the composer.
Keyboard hidden. The working status now sits below the streaming words (it was above the first heading), so nothing shifts when the reply finishes.
pnpm ios:behavior, iPhone 17 simulator, 3 samples per case:stream-turnstream-followscrolled-upkeyboardrelaunchExit 0 with this PR's grading. Reported, not gated: in 2 of 3
stream-followsamples the reply ended scrolled away from view after it finished (the known finish glitch below).On
main(with #198293) the samestream-followfollow gate fails in every sample (p95 ~5,600 pt hidden) andstream-turndrifts 42 pt in every sample.a durable reply retires the live bubble while pacing holds its last wordsfails on the base and passes here;ChatStreamPresentationTestsandChatStreamReplayTestspass.test/scripts/ios-behavior-grade.test.ts: 6 passed. tsgo, oxlint, SwiftFormat, SwiftLint, native i18n inventory: clean.Merge danger: two-way door. Revert restores the previous scroll and indicator behavior; no state, config or protocol change. Blast radius: the shared chat transcript on iOS and macOS.