Problem
Chats stop auto-scrolling to new messages once they hold 1,000 messages. Busy geohash chats are the most likely to get there. After about three new messages, the list stops following and the scroll-down button appears. Tapping it only helps until the next message arrives.
Cause
MessagesList only auto-scrolled when messages.size changed. Since the timeline retention cap (MAX_PUBLIC_TIMELINE_MESSAGES, introduced in "Bound chat workloads under heavy activity"), a full timeline evicts its oldest message for every arrival. The size therefore stays at 1,000 and the effect never runs. Meanwhile the LazyColumn stays anchored to the previously newest item, so new messages land below the viewport.
Fix
Key the follow effect on the newest message id and the conversation as well as the size. This matches how the arrival tracker is already keyed.
Tests
- New
MessagesListFollowTest(Robolectric + Compose UI test, synthetic messages only):- A full timeline that rotates (drop oldest, append newest) keeps following. Fails without the fix.
- A reader who scrolled away is not pulled back down while the timeline rotates.
./gradlew :app:testDebugUnitTest :app:lintDebugpasses: 651 tests, 0 failures. Lint reports nothing new in the changed files.
To run Compose UI tests under unit tests, this adds ui-test-junit4 (already locked and verified for androidTest) to testImplementation. The lockfile and verification metadata were regenerated with --write-locks --write-verification-metadata sha256. The resulting diff only adds the debugUnitTest* configurations and one kotlinx-coroutines-bom 1.8.1 pom checksum.
Risk
Low. This is a UI-only change to when the list scrolls itself. Following still turns off as soon as the reader scrolls away, and the second test covers that. Messaging, transport and protocol code are unchanged, so Mesh Lab validation doesn't apply. There are no screenshots because nothing looks different; the change is to scrolling behavior. I haven't checked it by hand on a device.
Codex Review Summary
This comment shows the latest Codex review activity on this pull request.
0451f99ℹ️ About Codex in GitHub
Your 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.