Repository navigation
fix(ios): finished replies stay in view instead of leaving the chat blank - #198994
Conversation
…lank With the keyboard up, the lazy transcript measured the finished turn near zero for one layout pass, then overshot its estimate; the follow pin landed past every row and the chat stayed blank until the reader scrolled. The latest turn is now laid out eagerly as one lazy child, run ends keep the live words until the reply arrives, and a clear no longer empties the streaming bubble in its own scope.
|
🦞👀 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 measures the latest chat turn together and retains streaming words through the transition to the saved reply. Example: A 300-delta reply finishes in the iPhone simulator with the keyboard open.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR provides a focused repair for the blank finished-reply viewport. No actionable introduced defect was found; exact-head native CI remains pending. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe shared Apple chat UI consumes Gateway stream events and canonical history, reconciles their presentation in the view model, and renders the transcript for iOS and native macOS chat. flowchart TD
A[Gateway stream events] --> C[Chat view model]
B[Canonical history] --> C
C --> D[Transcript and live text]
D --> E[Run groups]
E --> F[Lazy history and measured latest turn]
F --> G[Apple chat viewport]
Technical reviewBest possible solution: Keep the latest turn measured within the existing transcript renderer and preserve live words until the history handoff completes. Do we have a high-confidence way to reproduce the issue? The supplied simulator comparison reproduces the blank finished-reply viewport on main using a 300-delta reply with the keyboard open; this review inspected that evidence without running target code. Is this the best way to solve the issue? The patch addresses measured-height instability and premature stream clearing through existing owners, preserves reader policies, and strengthens finish-state checks without introducing another renderer or state store. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 1ac07b333581. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +48, Tests +51, Docs 0, Other +10. Total +109 across 11 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 Reviewed November 14, 2026, 11:28 AM ET / 16:28 UTC. |
|
Maintainer note: the one red job, |
|
Landed as f091e80. With the keyboard up, a finished reply now stays in view instead of leaving the chat blank above the recap: the latest turn is laid out as one eager piece, run ends keep the live words until the saved reply arrives, and a clear no longer empties the streaming bubble on its own. Proof: |
…lank (openclaw#198994) ## What Problem This Solves Fixes: with the keyboard up, when a long reply finishes the chat flashes to the top and, in about half the runs, ends blank above the composer until the user scrolls. ## User Impact User impact: a finished reply stays in view where it streamed. The transcript no longer flashes to the top or goes blank when the saved reply replaces the streaming one. ## Why This Change Was Made - **Latest turn laid out as one piece.** `LazyVStack` estimates the heights of rows it has not measured. When the saved reply replaced the streaming bubble, the stack measured the turn near zero for one layout pass (the scroll offset clamped to the top), then overshot its estimate by ~1,450 pt; the follow-the-end pin landed past every row, the rows unmounted, and nothing on screen corrected the estimate. The latest turn (from the user's message to the end) is now a single lazy child holding a plain `VStack`, so the part the reader follows always has measured heights. A run's rows were already laid out together inside one lazy item, so this adds only the user message and trailing rows to that item; a latest turn without run metadata is now laid out together too. Keeping the lazy stack as the scroll view's direct child matters: a `VStack` wrapping it made the history stack rebuild off-screen rows during sizing passes. - **Run end keeps the words until the reply exists.** The agent lifecycle end, and a chat `final` without a message, cleared the streaming words before the saved reply was in the transcript, so the turn showed neither for a history round trip. Recorded words still clear at once; unrecorded ones clear after the history read that brings the reply. - **The streaming bubble never empties itself.** A clear now hides the bubble through the transcript only; emptying the bubble in its own observation scope laid it out at zero a pass before the transcript changed. - The `stream-follow` behavior case gates on the end staying in view and no remounts again; teleports stay reported, not gated, because about one run in ten still flashes to the top for ~80 ms as the final row replaces the bubble. The grader ignores rows that stay off screen in both frames: rows of the eager tail stay mounted above the fold and shift when a height below them changes. - The reader scroll-policy helpers moved from `ChatView.swift` to `ChatScrollCommand.swift` unchanged, to keep `ChatView.swift` under the SwiftLint file length. Accepted edge: a `sessions.changed` end for the selected run still clears unrecorded words; it was not seen ahead of the chat `final` on a real Gateway. ## Evidence - iOS simulator, `pnpm ios:behavior` `stream-follow` (300-delta reply, keyboard up), end of reply, `main` → this PR:   - `stream-follow` on `main`: the reply ended out of view in about half the samples (2/4 in the run above; 8/17 earlier). With this PR: end in view and 0 remounts in 13/13 samples; a ~80 ms flash to top in 1/13. - Full `pnpm ios:behavior` suite on this head (all five cases, 3 samples each): every gate passes; also 5/5 on an earlier run of the same layout. - New tests red on `main`, green here: a run end without its reply keeps the live words until history brings it (lifecycle end and message-less `final`); a clear never empties the streaming bubble; the grader ignores rows off screen in both frames. OpenClawKit package tests: 2,630/2,632 pass; the two `ChatMediaVideoPlayerTests` audio-load tests fail only under full-suite load and pass alone. No overlap with Pash/Sarah changes. **Merge danger:** two-way door; a revert restores the previous layout and clear timing. No state, config or protocol change. Blast radius: the shared chat view on iOS and macOS (transcript layout and run-end clearing). Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Fixes: with the keyboard up, when a long reply finishes the chat flashes to the top and, in about half the runs, ends blank above the composer until the user scrolls.
User Impact
User impact: a finished reply stays in view where it streamed. The transcript no longer flashes to the top or goes blank when the saved reply replaces the streaming one.
Why This Change Was Made
LazyVStackestimates the heights of rows it has not measured. When the saved reply replaced the streaming bubble, the stack measured the turn near zero for one layout pass (the scroll offset clamped to the top), then overshot its estimate by ~1,450 pt; the follow-the-end pin landed past every row, the rows unmounted, and nothing on screen corrected the estimate. The latest turn (from the user's message to the end) is now a single lazy child holding a plainVStack, so the part the reader follows always has measured heights. A run's rows were already laid out together inside one lazy item, so this adds only the user message and trailing rows to that item; a latest turn without run metadata is now laid out together too. Keeping the lazy stack as the scroll view's direct child matters: aVStackwrapping it made the history stack rebuild off-screen rows during sizing passes.finalwithout a message, cleared the streaming words before the saved reply was in the transcript, so the turn showed neither for a history round trip. Recorded words still clear at once; unrecorded ones clear after the history read that brings the reply.stream-followbehavior case gates on the end staying in view and no remounts again; teleports stay reported, not gated, because about one run in ten still flashes to the top for ~80 ms as the final row replaces the bubble. The grader ignores rows that stay off screen in both frames: rows of the eager tail stay mounted above the fold and shift when a height below them changes.ChatView.swifttoChatScrollCommand.swiftunchanged, to keepChatView.swiftunder the SwiftLint file length.Accepted edge: a
sessions.changedend for the selected run still clears unrecorded words; it was not seen ahead of the chatfinalon a real Gateway.Evidence
iOS simulator,
pnpm ios:behaviorstream-follow(300-delta reply, keyboard up), end of reply,main→ this PR:stream-followonmain: the reply ended out of view in about half the samples (2/4 in the run above; 8/17 earlier). With this PR: end in view and 0 remounts in 13/13 samples; a ~80 ms flash to top in 1/13.Full
pnpm ios:behaviorsuite on this head (all five cases, 3 samples each): every gate passes; also 5/5 on an earlier run of the same layout.New tests red on
main, green here: a run end without its reply keeps the live words until history brings it (lifecycle end and message-lessfinal); a clear never empties the streaming bubble; the grader ignores rows off screen in both frames. OpenClawKit package tests: 2,630/2,632 pass; the twoChatMediaVideoPlayerTestsaudio-load tests fail only under full-suite load and pass alone.No overlap with Pash/Sarah changes.
Merge danger: two-way door; a revert restores the previous layout and clear timing. No state, config or protocol change. Blast radius: the shared chat view on iOS and macOS (transcript layout and run-end clearing).