Repository navigation
fix(mobile): phone page keeps the message you were reading when older messages load - #29065
Closed
brennanb2025 wants to merge 11 commits into
Closed
brennanb2025 wants to merge 11 commits into
brennanb2025 wants to merge 11 commits into
Conversation
…eading When rows change above the reader on the phone page (a page of older history landing), the place-hold put the lowest thing on screen back where it was. That could be the live status line, which moves when output lands in the same update, so the reader was pushed past their message. The hold now anchors the first message on screen, found by the data-testid every message row carries (set as testID), so the Load earlier control and the live status line are never the anchor, and the row is found again by its id after the update.
Closed
1 of 2 tasks
… regroup it A page that starts inside a run of tool calls drew rows the older page's assistant row later took over, so their ids vanished on Load earlier: the place-hold lost the message it held and the page history reset its split. Until the older page loads, the page starts at the first message the tool fold draws the same whatever comes before it.
Closed
6 of 9 tasks
… the overlay now reads
This was referenced Oct 15, 2026
… a row A page counts raw messages, but the page draws folded rows and hides a run's start until older history loads, so a tap over a tool run with no words longer than a page drew nothing. The tap now reads on within its own request chain, spinner up, until the first drawn row changes or history, the 2,000 limit, a failed page, a chat switch or unmount ends it.
… the update kept The hold put back only the first message on screen, so when the update dropped that message (the 2,000 cap trims the oldest) or no message was on screen (only the live status line), the view moved by the dropped rows' height. It now records the messages on screen, or the nearest one when none is, and puts back the first one the update kept.
…d-on change # Conflicts: # mobile/src/session/MobileNativeChatOverlay.tsx # mobile/src/session/use-mobile-native-chat-session.ts
…, and the next tap reads on
…ge change # Conflicts: # mobile/src/session/MobileNativeChatOverlay.tsx # mobile/src/session/use-mobile-native-chat-session.ts
Closed
7 of 9 tasks
Contributor
Author
|
Closing: replaced by #29170, which keeps the reader's place when older messages load on the phone chat page. Branch kept. |
brennanb2025
deleted the
brennanb2025/mobile-page-hold-reading-message
branch
October 19, 2026 20:54
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
On the phone's chat page (the over-the-air version of the phone app that runs as a web page), when older messages load above you, Orca moves the list so you stay where you were. It did that by holding the lowest thing on screen, which is often the agent's live status line at the bottom. If the agent's reply grew in the same moment, that line moved further than the messages did, and you ended up past the message you were reading. Now Orca holds the first message you can see, so you stay on it.
Holding a message only works if that message is still there after the load. When the oldest loaded messages were the middle of a run of tool calls, loading the older page merged them into the agent's message above, so they disappeared and you jumped a page. Now the page doesn't show that leftover piece of a run until the older page brings the rest of it. If that piece is a long run of tool calls with no words, longer than one page of history, a single tap on Load earlier keeps loading until something new appears, instead of leaving you tapping pages that show nothing.
The same hold covers the 2,000-message limit: when the oldest message is dropped and it was the one you were reading, or only the live status line is on screen, Orca holds the nearest message that's still there instead of letting the view move.
Stacked on #29043 (older history loads only from the Load earlier button). Review that one first.
What Changed
The problem. On the phone page the web list doesn't keep the reader's place when rows are added above them, so Orca corrects the scroll position itself, once, in the update where the first row changes (a page of older history landing). On
mainthe correction anchors the lowest element on screen: the list's own rows are scanned from the bottom, and the footer (the live status line and any messages waiting behind the running turn) counts too.Before (on
main), on the phone page: tap Load earlier while the agent is replying, or just as it finishes, and the view can land below the message you were reading, or a whole page away from it.After: the message at the top of your screen stays exactly where it was when the page lands, whatever happens to the live status line or the Load earlier button in the same update, and wherever the page boundary fell in the agent's tool calls. While older history is still available, the page starts at the first message the grouping can't merge backwards: typically the agent's next message with words, or your next prompt. The leftover tool calls before it (one or two rows, an orphan result and the rest of a run without its message, though those rows can carry dozens of calls) show up when you tap Load earlier, inside the message they belong to. If one page of older history doesn't reach the start of that run (a run of calls with no words longer than a page), the same tap keeps loading, with its spinner up, until a new row appears above, or the history, the 2,000-message limit, a failed page, switching chats or leaving the chat ends it. One tap reads at most 8 pages within about 15 seconds (#29137's limits for every Load earlier tap); a run longer than that stops quietly with what it loaded, and the next tap reads on. A failed page (refused, an error, or no answer) ends the tap and shows the retry line under Load earlier ("Couldn't load earlier messages. Tap to try again.", from #29137, which this stack sits on); the next tap clears it and reads on. A page overtaken by a fresh window from the host ends the tap quietly, with no line. Once the whole history is loaded, nothing is held back.
At the 2,000-message limit, if the message you were reading is the one dropped, the next message on screen stays where it was; if only the live status line is on screen, the last message above it does.
Mechanism.
MobileNativeChatMessage.tsx: every message row carriestestID="chat-row:<message id>", which React Native Web draws asdata-testidon the page. (On native it is an accessibility identifier and nothing reads it.)MobileNativeChatScrollHold.tsx: before the update, it finds the message rows by that attribute (querySelectorAll('[data-testid^="chat-row:"]')), so the Load earlier button and the live status line are never candidates without the hold knowing how the list's header and footer are built. It finds the first message on screen with a binary search over the rows' bottoms (rows are in normal flow, so their bottoms are ordered; up to 2,000 rows), and records the id and position of it and of the messages after it on screen (or, when no message is on screen, of the nearest one). After the update it puts back the first of those that's still there, found by id, so one rule covers the reader's own message, a message the 2,000-message trim dropped, and the live-status-line-only case, and it still works when the update redraws that row in a different place. Timing, trigger and the iOS bounce guard are unchanged from fix(mobile): phone page loads older messages only from the Load earlier button, so the chat no longer freezes at the top #29043.native-chat-tool-fold.ts:firstToolFoldBoundarynames the first drawn message the tool grouping places the same whatever comes before it (it can't join an earlier run, and it starts or ends one itself). It reads the grouping's own rule: the "ends the run" condition is moved intoendsToolRun, used by both, so they can't drift. The grouping's output is unchanged.mobile-native-chat-render-data.ts/MobileNativeChatOverlay.tsx: on the page, while an older page can still load, the list is grouped from that message on. Every row the page draws then keeps its id when older rows arrive, so both the scroll correction and the history split find their row.use-mobile-native-chat-session.ts: a page is counted in raw messages, but the reader sees grouped rows. Reading on is already built into fix(mobile): Load earlier messages always ends, and says when it can't, in every phone chat #29137's one older-page loader, which both chat types use: it reads the next page in the same tap whenever a page answers "drew nothing", with one spinner, one retry line and one limit for the whole tap (8 pages, about 15 seconds), and it ends the tap on the existing stops (no more history, the 2,000-message limit, a failed or refused page, a chat switch, a fresh window from the host, unmount). This PR supplies only that answer for the transcript chat:loadEarliertakes an optional reader of the list's first drawn row (the page passes it; native doesn't), and a page that lands without changing that row answers "drew nothing". Structured chats ignore the argument; they already answer it from their own pages. No effect watches the list. Nothing changes in the paging request or the wire.Lands and reverts on its own. Reverting this commit brings back
main's lowest-element anchor; nothing else depends on it. The next PR in the stack (how the page follows new output) builds on it.Why
The first visible message is what the reader is reading, and it's the anchor the common pattern uses (lists that hold place keep the first visible item where it was). Holding by a height difference instead (move by however much the content grew) would count the new output below the reader too, the same bug in another form.
The page boundary is made stable rather than teaching each reader of row ids to survive a vanished row. The common pattern never splits a group of tool calls across history pages (pages end on whole turns, or grouped rows keep one id across pages), so the rows a client draws never change identity when older rows arrive. Orca's pages are cut by the host by count and bytes, so the phone starts its list where the grouping can't reach back instead; changing the host's page bounds would touch the paging request and older hosts. Fixing each reader instead (hold the next surviving row, re-split history on the next surviving row) leaves every future id-keyed reader to rediscover the same case, and still fails when the merged rows fill the screen.
Rows are identified by an attribute rather than by their position in the list's markup, so the hold doesn't need to be told whether the list currently has a header, a Load earlier button or a footer. That avoids classifying the old layout with the new props, which was a review finding on #28807.
Differences from the common pattern.
mainheld the line, which moves as output arrives).Linked Issue
None. Follow-up to #28413; part of the split of draft #28807.
Visual Proof
Pending: iPhone over-the-air page QA (tap Load earlier while the agent is replying, and as the turn ends) will be attached by the review loop.
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
MobileNativeChatScrollHold.test.tsx: holds the first message on screen (with a message scrolled past above it, and the untagged Load earlier control, a turn status row and the live line around it; the fake list answers only the selector the hold uses) and not output landing below it; finds it again although the update redrew it; at the 2,000-message limit holds the next kept message when the one on screen is dropped, and the last message above when only the live line is on screen; no write when every recorded message is gone, while bounced, on the same first row, or on native.use-mobile-native-chat-page-history.test.tsx: one end-to-end case through the real session, grouping and history split: the window starts in the middle of a run of calls with no words that is longer than a page. One tap reads a page that draws nothing, keeps its spinner up and reads the next; that page fails, so the tap ends with the retry line; the next tap clears the line, its page lands, and the run's start appears. Every row the list drew keeps its id and index (what the scroll correction and the history split rely on), and the older rows go above it. It fails if the "drew nothing" answer is removed (checked).CI runs lint, typecheck and tests. No local runs (shared-machine limits).
AI Disclosure
Review
Agent skill upstream boundary
Notes
Phone page only (over-the-air build on iOS and Android web views); native builds, desktop, SSH and remote hosts are unaffected. The shared tool grouping only gains a reader of its rule; desktop's output is unchanged. No wire or settings changes.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)