Repository navigation
fix(ios): switched chats open at their first message instead of the latest - #187124
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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Codex review: needs maintainer review before merge. What this changesPosition opened chats when transcript rows appear instead of waiting for background loading to finish. Example: Switch from Release checklist to Launch plan while the fixture holds the model catalog for six seconds.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this PR fixes a current iOS positioning bug with no actionable code findings; required CI remains unresolved. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe shared Apple chat view receives session transcript updates from its view model and issues session-scoped positioning commands to SwiftUI. flowchart TD
A[Sidebar session selection] --> B[Chat view model bootstrap]
B --> C[Transcript rows appear]
B --> D[Background requests finish]
C --> E[Initial position helper]
D --> E
E --> F[Session scoped scroll command]
F --> G[SwiftUI transcript viewport]
Technical reviewBest possible solution: Land the existing focused repair once required CI gates are satisfied. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the delayed-positioning path, and obviyus supplies current-head simulator/Gateway reproduction with inspected before/after captures; no target code was executed during this review. Is this the best way to solve the issue? The patch restores the existing initial-position invariant through its current owner, preserves platform-specific targets and post-load handling, and adds one meaningful UI regression with two fixture-only launch arguments. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 3a25991e37c4. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +68, Tests +23. Total +91 across 4 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 8, 2026, 4:50 AM ET / 09:50 UTC (Revision 2). |
# Conflicts: # apps/ios/Sources/Chat/AppleReviewDemoChatTransport.swift # apps/ios/UITests/OpenClawSnapshotUITests.swift
|
Maintainer end-to-end check. I merged current Setup: an iPhone 17 simulator on iOS 27, paired to an isolated Gateway running current
Root cause: the first scroll to the bottom waits for Tests
Thanks @jorge-monalee! |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…atest (openclaw#187124) * test(ios): cover landing at the latest message after switching chats * fix(ios): switched chats open at the top until the session finishes loading * chore(i18n): refresh native source inventory for the chat switch fixture


What Problem This Solves
Fixes: on iPhone, switching to another chat shows the start of that chat instead of its latest message while the rest of the chat's load is still running.
User Impact
User impact: a chat opened from the sidebar lands on its latest message as soon as the transcript appears, instead of sitting at the top until every background request for that chat (health check, session list, mark-read, model catalog) has finished.
Why This Change Was Made
OpenClawChatViewdid its one initial scroll-to-latest only whenisLoadingturned false. That flag covers the whole session bootstrap: history, then the health poll, the 50-row session list, mark-read and the model catalog. The transcript (cached or live) paints well before that, and.defaultScrollAnchor(.bottom, for: .sizeChanges)does not keep the bottom when a switched chat grows from empty, so the reader sat at the top for the remaining round trips.Transcript changes that arrive before the initial position is settled now re-apply that initial position; the end-of-load restore is unchanged. The initial-position helper only sets the follow target and enqueues a scroll command, and that command already drops requests from a previous session, so it is safe to re-run per change.
Accepted edge case: a reader who scrolls up during that loading window is pulled back to the initial position on the next transcript change, until the load settles. The window is short and the previous behavior was worse (no scroll at all).
The iOS screenshot fixture gains
--openclaw-chat-switch-fixture(two long fake chats) and--openclaw-slow-model-catalog-fixture(holds the model catalog for 6 s, standing in for a slow Gateway round trip). The newtestSwitchingChatsOpensAtLatestMessageUI test uses both. The regenerated native source inventory (apps/.i18n/native-source.json) records that fixture's new strings.Evidence
Simulator recording, iPhone 17 Pro on iOS 27.0, Xcode 27.1, fake fixture data only. The left side is
main(dadf912); the right side is the same build with this fix applied. The clip opens the sidebar and taps "Launch plan". Onmain, the chat stays on its first message until the held model catalog finishes, then jumps. With the fix, it opens on the latest message.chat-switch-before-after.mp4
OpenClawSnapshotUITests/testSwitchingChatsOpensAtLatestMessage. Onmainit fails withCHAT_SWITCH_LANDED_AWAY_FROM_LATEST(44.6 s). With the fix it passes (33.8 s). Both results come from the same job, with an incremental rebuild in between: fork run 40789182509. The snapshot UI tests are not part of PR CI; run it withxcodebuild test -project apps/ios/OpenClaw.xcodeproj -scheme OpenClawUITests -destination '<iPhone simulator>' -only-testing:OpenClawUITests/OpenClawSnapshotUITests/testSwitchingChatsOpensAtLatestMessage. No cheaper layer covers this: the defect is SwiftUI's runtime scroll behavior.main, the latest message first appears 4.0–4.7 s after each switch; until then the chat's first message is on screen. With the fix, the latest message is in place at the first sample of every switch.mainstill lands at the top for 264 ms in-process (an instrumented run logged rows painting at about 3,100 pt from the bottom). With a real Gateway, that window covers every remaining bootstrap round trip.--mode branch --base dadf9122058over this tree, P0–P2:scoped-clean, no findings. One flagged uncertainty — whetherrestoreInitialScrollPosition()has side effects — checked: it only sets the follow target and enqueues a scroll command.--lintreports 0 of 3 changed files needing formatting. Pinned SwiftLint 0.65.1--stricton the changed app sources reports only the existingfunction_body_lengthadvisory on the untouchedseedMessages(fork run 40793921673).Instrumented scroll log, first switch (evidence branch only, not in this PR)
Before (
main):After (this PR):