Repository navigation
fix(mobile): Load earlier messages always ends, and says when it can't, in every phone chat - #29137
Closed
brennanb2025 wants to merge 14 commits into
Closed
brennanb2025 wants to merge 14 commits into
brennanb2025 wants to merge 14 commits into
Conversation
…ked for A replayed snapshot cancelled any in-flight "Load earlier messages" page, even when the replay merged onto the same window and cursor, and every other lost page (host refusal, error reply, transport drop) was swallowed, so the control went back to its label as if nothing had been tried. A page now lands unless its window was replaced or the cursor it was sent from changed. A page that is lost shows one line under the control, "Couldn't load earlier messages. Tap to try again.", cleared by the next tap or a page that lands.
6 of 9 tasks
brennanb2025
added a commit
that referenced
this pull request
Oct 15, 2026
brennanb2025
added a commit
that referenced
this pull request
Oct 15, 2026
…d-on change # Conflicts: # mobile/src/session/MobileNativeChatOverlay.tsx # mobile/src/session/use-mobile-native-chat-session.ts
6 of 9 tasks
…d loader, bounded to one tap's budget
…loader A failed page now shows the retry line instead of an invisible chat error, history that can never be read ends paging, and one tap shares one budget.
…r both chat types A retryable failure keeps the button with the retry line; history that can never be read swaps the button for one line saying so; scrolling at the top no longer re-fires a failed read.
…le, retries on a tap, and ends at unreadable history
…he page goldens Hand-updated: only the nativeChat.readSession options change (absent -> 15 s budget spanning connect); every value is re-hashed and re-keyed as the recorder does.
…s the subscription's reload replaces the window Only a final read refusal (damaged history, or saved by a newer Orca) ends a tap at 'Earlier messages can't be loaded.'; the test now drives that reachable path.
brennanb2025
added a commit
that referenced
this pull request
Oct 15, 2026
# Conflicts: # mobile/src/session/MobileNativeChatView.tsx
brennanb2025
added a commit
that referenced
this pull request
Oct 15, 2026
…ge change # Conflicts: # mobile/src/session/MobileNativeChatOverlay.tsx # mobile/src/session/use-mobile-native-chat-session.ts
brennanb2025
added a commit
that referenced
this pull request
Oct 15, 2026
This was referenced Oct 16, 2026
Closed
Contributor
Author
|
Superseded by #29271, which carries this change together with the rest of the phone chat scroll work in one PR against main. |
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 (the app and the over-the-air web page), tapping Load earlier messages in a chat could do nothing at all, could show a spinner for minutes, or could fail without any sign. That happened in both kinds of phone chat: chats that read the agent's transcript file (most agents) and agent-session chats (Claude and Codex chats run through Orca's own session). Now, in every phone chat, one tap either brings in older messages or ends within about 15 seconds. If it failed, it says so, and the button still works for a retry. When older history can never be loaded from there (the chat's saved history is damaged, or a newer Orca saved it), the button is replaced by one short line saying so.
What Changed
What the reader saw before.
What the reader sees now (both chat types).
Mechanism. A new hook,
use-mobile-older-page-loader.ts, owns the older-page read for both chat types:supersede()(the window it was for is gone), and both clear the spinner in the loader, so no path can leave the spinner on. A superseded read's late reply finds a different token and changes nothing. A second trigger in the same moment (tap, scroll, automatic read-back) can't start a second read.Each chat type supplies only its own rules: how to ask for the next page, whether the reply still lands (transcript chats: the same window and the same history byte position; agent-session chats: the same epoch and a window head this tap produced, re-reading from the new head if live output trimmed it), and whether the page drew a row. Agent-session older-page failures no longer touch the chat's read status; only a final read refusal (damaged history, or saved by a newer Orca) gives the no-retry outcome, which stays until the chat's window is replaced (new messages arriving don't bring the spinner back), and every history reset ends the tap quietly.
No wire, host, protocol or saved-data change. The transcript page read now passes the same request budget the agent-session reads already used.
This bounds the Load earlier spinner on both chat types. It does not claim to fix the hang seen in iOS QA. QA's long-running spinner was the Load earlier spinner on a terminal-backed chat (the transcript lane, whose page request had no time limit while the phone waited to reconnect). With this PR it ends within about 16 seconds (the 15-second budget plus settling) and shows the retry line; why it ran past a minute on main is still being traced.
Why
Both chat types had their own copy of one decision (may a page start, does its reply still count, what ends the spinner, what does a failure show), and every bug above was one copy drifting from the other. The common pattern keeps one owner for the older-page request whose settlement and supersession both clear the loading state, decides whether a reply lands by checking that the position it was sent from is still current, shows a short line under the button on failure with the button still usable, and stops automatic re-tries after a failure until the reader asks again. This PR adopts that shape in one loader instead of patching each copy.
Alternatives considered:
Differences from the common pattern, labelled:
Merge this before #29043. Without it, #29043 makes the button the only way to page, so a lost page becomes a dead button.
Linked Issue
N/A (maintainer). Found while diagnosing why "Load earlier messages" seemed to stop working on #29043, and from iOS QA's long-running spinner on a terminal-backed chat.
Visual Proof
The phone chat page in Orca's Electron build on Windows, terminal-backed chat, this PR (left) vs
main(right). A QA overlay pins the list header into view for the shot.The desktop returns an error for the page: the retry line appears, vs nothing on

main.The page request is never answered: the spinner ends with the retry line at 15 s, vs

mainstill spinning at 25 s.A tap made while the phone is reconnecting: the page lands, vs nothing loading on

main.Not shown yet: an iOS screenshot of the retry line, and agent-session (Claude/Codex) chats, which neither QA rig can open without a real agent sign-in.
Testing
New: an agent-session chat whose older page fails keeps its status and rows, shows the retry outcome, lands the page on the next tap, and ends in the no-retry outcome when the host refuses the read because the history is damaged.
Kept: the transcript tests for a page landing across a same-position reconnect, a refused page flagged until the next tap, and a page dropped when the history position moved; the four agent-session older-history tests (read-on past subagent-only pages, automatic read-back).
The page-read assertions and the
session.native-chat-pagerecording goldens now include the read's budget options (goldens hand-updated: only those options change; values re-hashed as the recorder does).CI runs lint, typecheck and the mobile tests.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Review
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)