Skip to content

Keep phone chat history in one window while preserving reading position - #29271

Merged
brennanb2025 merged 91 commits into
mainfrom
brennanb2025/mobile-page-windowed-list
Oct 19, 2026
Merged

brennanb2025 merged 91 commits into
mainfrom
brennanb2025/mobile-page-windowed-list

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 13 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1384 $\color{#cf222e}{\Huge{\mathbf{−}}}$​282 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1102
Prod 47 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​3635 $\color{#cf222e}{\Huge{\mathbf{−}}}$​867 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2768

The problem

This is about the chat page the desktop app serves to a phone browser (iPhone Safari, Android Chrome), not the separate native phone app. On main today, which includes #28413, long chats on that page have four problems people can see:

  • The iPhone gets stuck. After older messages load at the top of a chat, flicking the chat on an iPhone often does nothing. The page stays frozen until you lift your finger and try again.
  • New replies run off the screen. Once a chat reaches the 2,000-message limit, the page stops keeping up with a reply as it streams in. Newer text appears below the screen and you have to scroll down by hand to read it.
  • You lose your place. When older messages arrive or you open Tools, the text you were reading jumps away. On an iPhone it moved 33 to 1,099 px on main, often off the screen.
  • Long chats are slow to open. The page draws every message up front, so opening a 2,000-message chat took about 6 seconds before you saw the newest message.

Why it happens: the page drew older history as a separate block stacked on top of the live list, and it drew every message whether or not it was on screen. It also tried to keep your place by moving the scroll position by hand.

  • On an iPhone, Safari doesn't keep your place on its own when content above you changes size, and moving the scroll position by hand during a flick stops the flick.
  • The joint between the two blocks is where flicks got stuck.
  • Drawing everything is what made opening slow.

Four earlier PRs (#29137, #29043, #29170, #29198) each fixed one of these symptoms on top of that design. Each fix exposed the next problem in the same place, which is why they are replaced here by one change to the design itself.

Why we want this

  • It fixes a freeze on iPhone. In a three-way iPhone test, the version with the separate history block stalled; the one-list version moved on 20 of 20 upward flicks.
  • It makes long chats much faster. Measured with 2,000 messages:
    • opening at the newest message took 150 ms vs 6,272 ms on main;
    • switching chats took 18 to 30 ms vs 184 to 251 ms;
    • each streamed update cost 15.9 ms vs 23.0 ms;
    • memory was slightly lower (15 MB vs 16.5 to 17.8 MB) and did not grow.
  • Live replies stay on screen. At the 2,000-message limit the page keeps up with a streaming reply, with 0 blank frames across about 10,000 recorded iPhone frames.
  • Your place holds. On iPhone, opening Tools moved the text you were reading by 2 to 7 px, where main moved it off the screen. Collapsing a section below you moved it 0 px vs 84 to 92 px on main, and a stopped flick didn't drift. In the desktop browser, nothing tested lost the place, and scroll distances matched main exactly.
  • Nothing compared with main got worse. That was the bar for this work, since fix(mobile): keep the chat where the reader scrolled to #28413 had already been pulled from a release once. Where this PR still misses a target (listed under Known gaps), main is worse or doesn't do the job at all.

How solid these numbers are:

  • The speed numbers were measured in a desktop browser slowed to a quarter of its speed, on a shared machine. Read them as large, consistent gaps rather than exact timings.
  • The iPhone freeze and blank-frame results come from earlier revisions of this PR. The later revisions changed scrolling rules, not how the list is drawn.

What changes for you

  • Long chats open at the newest message almost at once.
  • Older messages load when you tap Load earlier messages. Scrolling to the very top no longer loads them by itself, so the page can't fetch history in the middle of a flick.
  • Flicking on an iPhone never gets stuck after older messages load.
  • If you've scrolled up to read, you stay where you are while older messages arrive, Tools opens or closes, a section collapses, or new replies come in.
  • If you're at the bottom, the page keeps up with replies as they stream in, including at the 2,000-message limit.
  • Scrolling up stops the page from keeping up, even a slow drag. Scrolling back down to the end, tapping Scroll to latest or sending a message starts it again.
  • An open tool box (a command's output, a diff, reasoning) remembers where you were inside it.
  • A terminal opened on the same page no longer fails with "Terminal failed to load" when the chat list resizes.

How it works

  • One list instead of two. Older history and current messages live in one continuous list, so there is no joint for a flick to get stuck on.
  • Only nearby messages are drawn. The page draws the messages near the screen and leaves blank space of the right height for the rest. This is how long chat lists are usually built, and it is what makes long chats fast.
  • The blank space is always exact. The page measures a message's height before that message can come into view. It never guesses, because guessed space left large blank gaps in an earlier attempt (about 5,100 px above the first message).
  • Every message keeps a stable identity. Messages are tracked by who they are, not by their position in the list, so a message doesn't change identity when older history is added above it or the oldest messages are dropped at the limit. Your open/closed choices stay with the right message.
  • One owner for each scroll position. The outer page and each scrolling box inside it keep their own position. The page restores the inner boxes first, then the page around them, so they don't fight.
  • Keeping your place uses the browser where it can.
    • Desktop and Android browsers already keep your place when content above you changes, so the page lets them.
    • Safari on iPhone doesn't, so the page corrects the position itself, but only once the scroll has come to rest, because a correction during a flick would stop it.
  • Keeping up is decided by what you did, not by layout. Scrolling up stops the page from keeping up, and scrolling back down to the end starts it again. A section shrinking below you doesn't count as you moving, so it can't suddenly pull you to the bottom on the next reply.
  • Terminal fix. A terminal on the page used to treat any browser notice on the page as its own fatal error. Harmless resize notices from the list now pass it by.

Nothing changes for the desktop app or the paired servers: there is no new saved data and no change to what client and server send each other. Older paired servers keep working. The native iOS and Android app keeps its own list; only the shared message and tool-box changes reach it.

Why this PR is so big

It is about 2,800 production lines net, all on the phone page under mobile/. Roughly:

  • Drawing only nearby messages (the list, height measuring, which rows to draw): about 1,000 lines.
  • Keeping your place (the outer page, each inner scroll box, iPhone corrections): about 1,100 lines.
  • Stable message identities: about 380 lines.
  • Loading older messages: about 280 lines.
  • Keeping up with new replies: about 150 lines.
  • Tool boxes keeping their own position: about 200 lines.

Tests are about 1,100 lines net. Most of them cover reading place and scroll ownership, and some replace tests for code this PR deletes.

It is one PR because the pieces only work together:

  • Drawing only nearby rows without exact heights leaves blank gaps.
  • Exact heights without stable identities lose your place when old messages are dropped at the limit.
  • A single list without place-keeping jumps whenever history arrives.

The four earlier PRs tried to land these one at a time. Their Load earlier messages changes (#29137, #29043) are kept here. The separate history block (#29170) and the end-of-chat marker used to keep up with replies (#29198) are replaced by the one list, so landing those separately would have shipped code this PR deletes. All four are closed in favor of this one, which was reviewed and tested as a whole against main.

Details for reviewers

Differences from the common pattern:

  • Intended — measured-only top space and iOS windowing. Earlier tested estimated-space and library configurations produced blank regions, incorrect opening position and lost following. The phone page needs nearby-only rendering while streaming; drawing all history would give that up. These observations establish limits of the tested configurations, rather than a universal library comparison.
  • Intended — tap-only web history, placement at rest and fill yielding during streaming. This avoids the separate-list gesture seam and installing fetched history during an iPhone fling. The existing spinner also covers local measurement before fetched history becomes reachable.
  • Intended — browser-owned parked Chromium with exclusive semantic holds. Earlier page-owned correction lost an internal reading line that main preserved. The page owns correction at offset zero, reselects browser anchors after window commits and hands ownership back after a hold; there is no separate end sentinel or timed hold.
  • Intended — stay parked when content shrinks onto the end. The common pattern attaches when content shrinks onto the bottom. This branch follows main’s downward-approach rule instead, under Brennan’s October 16 ruling that no place-keeping loss against main is acceptable. A layout clamp, including one under a collapse tap, must not make the next reply pull a parked reader to the end. Upward reader movement away from the end detaches without a per-event distance threshold. A genuine positive reader arrival within one point of the end restores following, including one-point steps. The existing approach rule still requires more than one point of movement within 80 points; main applies that rule to throttled reports while this page classifies raw events, so identical physical gestures are not claimed to produce identical samples.
  • Intended — WebKit correction timing. Ordinary correction waits for rest because scroll writes can stop momentum. Explicit Tools/text-size regrouping corrects immediately. Following may interrupt a fling, as on main.
  • Intended — bounded disclosure memory and eager inner members. The existing store retains at most 512 overrides and 512 run positions per chat scope. Closing a run or line forgets the positions it owns, including nested command/output boxes. Outer rows are windowed; an opened tool box still draws all its members.
  • Intended — one shared nested restoration transaction. Independently owned boxes enroll with the page’s observer so inner and outer correction remain exclusive. Remembered positions initialize a new mounted owner; a surviving owner uses live state. A line inside one long text/code member retains a pixel position rather than a semantic text location.
  • Intended — cursorless-host fallback. Mixed client/server versions remain supported without a new saved field, stream operation or minimum paired-server version. A known inherited stale-response schedule is listed below.
  • Intended — terminal guest error boundary. On the phone page, a terminal shares the application window. Browser error notices with no underlying error are ignored by the terminal guest; reports with an error continue through the existing reporter. This prevents unrelated layout notices from becoming fatal before terminal readiness.

Linked Issue

Follows up #28413. Replaces #29137, #29043, #29170 and #29198, which are closed.

Visual Proof

Main-versus-branch screenshots, tested revisions and capture limits are in the review status comment. The latest comparisons use the iPhone simulator's Safari phone page against pinned main 407bf039c1c.

Testing

  • Full-path round 3 reviewed only the branch-owned delta from dde20a10b72 through 76a1fd75f54, after two whole-lane rounds. One fresh reviewer found a P2: returning to the end entirely in one-pixel steps could leave following disabled. The final panel retained the architecture and ruled a narrow repair. Round 4 reviewed only that repair at 721af63eacc25a6f1d36452dc0e180799de4f108, agreed it fixes the contract, and found no new proven issue.

  • The whole-diff eight-area readiness review and dedicated six-question performance scan completed, with amendments covering the following repair and owner close-position repair. Counsel was skipped as requested. No new saved field, protocol, dependency or native-list policy was added.

  • The added Safari regression failed before the repair. All 12 named history-paging tests passed afterward, including the existing slow-up, finger-down/up collapse and expired-fling cases. The normal commit hook passed; tested and committed source hashes match. The earlier whole-lane executable repair passed 108 tests across 13 named files.

  • Final-head 41ec1610cf0 Full PR Checks, including PR checks passed, have passed; Mobile Checks have passed. Skipped jobs are not represented as executed tests.

  • Historical paired iPhone Safari QA after the terminal repair passed cold-terminal-after-paging 5/5 on each arm. On 6f7e873a56b, slow parked reading stayed in place 3/3, normal parked reading 1/1, a long glide to the end followed the next append 3/3, and live following passed 3/3. These captures predate the final repair and are labelled in the status comment.

  • The earlier round-4 iPhone Safari recheck on 721af63eacc passed: slow return to the actual end followed the next reply 3/3; a slow return stopping 31 points short stayed parked with zero reading-line displacement 3/3 on both branch and main; collapse below a parked reader then append preserved the line 3/3 on the branch, matching earlier main 3/3. A long glide and live 24-chunk stream plus new tool each followed 1/1 on that branch revision, with earlier main comparisons. Main was freshly rerun for the stopped-short case; the actual-end slow-return case was branch-only. The earlier paired run also covered switching chats while history loads and open tool boxes; the branch retained the inner tool line where main collapsed the run. Reconnect remains unverified.

  • The exact-head phone smoke on 41ec1610cf05b664c0c62c3f35652ef3a4120259 passed after the owner repair. Fresh output-box comparisons reopened at the top 2/2 on each arm (scrollTop 560 → 0 points). Collapsing a line below an open output preserved the outer page, run position and painted reading line 1/1 (all displacement zero); a subsequent reader gesture moved the run normally. Slow one-point return to the actual end then append followed 2/2, with gap zero before and after. Main was freshly run for output reopen; collapse and actual-end smoke were branch-only. A separately overflowing command box was not tested.

Known gaps and limits:

  • Reconnect is unverified on both arms. The scratch shell has no reconnect path. Full snapshot retention and live SSH/mixed-version network failure round trips are not certified by these phone-page runs.
  • The 2,000-message cap remains, as on main. Loading history does not grow past it, and old messages trim as new ones arrive. In the earlier cap captures the branch painted the newest STREAM24 while main painted STREAM03 without a Scroll to latest control; main had not painted the later chunks, so that comparison does not show branch loss.
  • Performance targets were missed, although measured behavior improved over main. Historical fill took about 7 seconds, up to 8.6 while streaming; fill steps reached 15–19 ms against an 8 ms target and following reached 6.3 ms against 6 ms. These are measured limits, not a claim that every workload meets a frame budget. Open inner boxes remain eager, and measurements across all supported hosts are incomplete.
  • WebKit blank strips and the status-bar tap remain known limits. Historical iPhone blank-edge frames and status-bar top behavior are retained as gaps; the latest parked/following passes do not establish that those behaviors are fixed.
  • Actual disclosure restoration after row eviction, focus/selection across eviction, simultaneous nested motion, every long-text/diff viewport and every agent were not all exercised. Native iOS/Android uses FlatList; Safari evidence does not certify that native path.
  • Earlier whole-Electron captures were partly occluded by onboarding, and a corrected setup failed before core controls. Those frames remain historical page-render evidence. Earlier real-agent continuation needed explicit recovery on both versions and left stale error text; intermittent discovery also occurred on main. Shared-machine configuration hash drift had unknown writers. In the earlier round-4 recheck, real .claude.json and .codex/config.toml hashes changed; the final-head smoke saw .claude.json change; the writer is unattributed, and these changes are not attributed to this PR. No real config contents were displayed, copied or restored.
  • A synthetic cursorless-host schedule can replace completed live text when an update precedes a stale response’s arrival; main shares that behavior. The covered regression preserves updates arriving during the later placement wait.

A source-level sampling difference remains: main evaluates throttled scroll reports while this list classifies raw events. The earlier round-4 bounded iPhone comparison found equal parked behavior for a slow return stopping 31 points short, and branch traces confirmed actual-end attachment after one-point moves. This verifies those tested gestures, rather than every timing schedule. Movements below half a point remain physically unverified; no worse outcome is accepted.

Review

The source repair, narrow round 4, final source readiness and bounded Safari recheck are complete. The launcher then repaired an older nested-position review thread at 41ec1610cf05b664c0c62c3f35652ef3a4120259: closing a tool line clears its nested command/output positions so reopening starts fresh, as on main. A narrow source/readiness checkpoint agreed and resolved the thread; this is not a fifth broad source round. Exact-head full PR and Mobile CI are green; the short final-head phone smoke passed. Final disposition and the exact-head marker are maintained in the existing status comment. This description covers the whole lane against main.

Agent skill upstream boundary

  • Not applicable: no upstream skill-installer material is copied or translated.

Notes

Folder and SSH workspaces use the same client-side transcript path. The separate desktop renderer is unchanged by this lane. Author: @BrennanKB5.

Checklist

  • This PR is small and focused. It contains the whole lane.
  • Problem, user-facing change, mechanism, alternatives and differences explained.
  • Main-versus-branch visual evidence linked, with known gaps stated.
  • Cross-platform, remote and mixed-version effects considered, with runtime limits stated.
  • Exact-head full PR workflow and Mobile Checks passed, including the full PR aggregate.

…r tap

On the phone page a scroll near the top paged in older history, often while iOS
was still bouncing the list past the top. The place-hold then wrote scrollTop
while WebKit owned the scroll, and the list stopped scrolling until the reader
left the chat. The page now loads older history only from the existing Load
earlier control (the native app keeps its drag paging), and the place-hold
never writes while the list is bounced past either end.
…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.
…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.
# Conflicts:
#	mobile/src/session/MobileNativeChatView.tsx
A folded row's id is its first message's, so an older page that brings the
start of a tool run (or an older sibling of a roster) replaced the displayed
row: the list remounted it and the page's history split lost its first row.
Rows now carry a presentation key that stays while any of their messages
draw, handed on from the last committed render by the raw message ids each
row draws, and a vanished key resolves to the row that took its messages.
…ollowing one to the follow owner

The place-hold fired on the first drawn row's id, which a kept row key no
longer changes, and held the lowest row on screen even while the reader
followed the end, so at the 2,000 cap it wrote against the follow owner.
It now fires when the source window's first message changes (an older page,
a cap trim), only for a reader who is not following, and puts back the
first tagged row on screen, else the nearest row the update kept, through
the row keys. iOS bounce still gets no write.
…ls join it

With the run's row kept, older calls joining its front pushed the lines the
reader was on behind Show more. The reveal now counts the lines added above
its first line apart from what Show more asked for, so those lines stay
shown, each diff keeps its share, and Show less only undoes Show more. Lines
and the run are tagged, so the page's hold puts the line being read back
where it was. The flow test opens a chat inside a silent run, loads the rest
from an old host's cursorless reply, then lands a reply and a send.
…already drew

Pairing the run again for its first line on every render broke the bounded
pairing a 2,049-call run relies on (one pairing per reveal). The flow test's
icon mock names every icon the run reads.
Row-key hand-on walked the current rows oldest first, so when a trim left a
run's first result alone above it, that orphan took the run's key and the open
run remounted closed. Walk newest row first so the run keeps it.
…o the results it shows

A cap trim that split the top run gave the run's key to whichever split-off result row a
position-ordered scan met first: the result above it for calls made one at a time, the one
below it for parallel calls. The run then remounted closed and the reader's line went.

Each row is now identified by its own sources (a run by its assistant and call messages, a
roster by its group, a lone result row by its results) and keeps the key of the one previous
row it continues; results are content only. A key no row kept resolves to the row that took
in what it drew. If identity ever came from two rows, neither inherits.
…t is still the same part

The hold took a line only from the first row on screen and otherwise trusted
that row's container. A result row absorbed by its run, a roster the fold moved
to an older sibling, or a trimmed line then moved the reader. It now lists the
tool lines on screen across every row (a run header only when no line shows,
a row top only when neither), and puts back the first one still drawn: a run
header only in the row that kept its key, a row top only while the same
message places that row. One write, skipped under half a pixel.
… the hold's last cases into it

An open run whose header is above the screen holds nothing: with only its
Show more on screen, the rows after it keep their height when older calls
join. Removing the header-on-screen check moves them 840 px. The collapsed
case now checks the same rows. The iOS bounce and native cases move into
the flow test over its page model, so the hold's separate fake scroller
goes.
…t when the transcript grows

RN Web reports content size a task after layout, so with no browser scroll
anchoring a following reader saw one frame far above the end after Load earlier.
One ResizeObserver over the page scroller and its content, bound to the list's
mount, calls the same pin, which reads the live end and writes only when short of it.
…and layout to the live end

The page's follow tests fold into one flow so the view test stays within its
line limit; the place-hold reads the follow owner through one prop bag so the
view does too.
The native list never needs the resize observer, so it shouldn't reach for
the page-only node at attach.
…ser's scroll anchor

At the 2,000-message cap a trim plus an append of the same height changes no size, so the
follow owner hears nothing, and Chromium's scroll anchoring keeps a visible message still,
scrolling the reader one message off the end each time. While the reader follows, the page's
scroller now takes the transcript out of anchoring and leaves a 1 px end marker as the anchor.
Parked readers and native lists are unchanged.
…e the list still glides

The page's WebKit place-hold wrote its correction only at rest, so a regroup committed within
150 ms of a reader scroll (or mid-glide after a tap outside the list) skipped it, and nothing
redid it: the text the reader was on moved by the regrouped rows' change and stayed there.
Unlike a source change, whose new rows stay out of the spacer until measured at rest, a regroup
resizes drawn rows at once. It now corrects at once, as main's hold always did.
@brennanb2025
brennanb2025 marked this pull request as ready for review October 18, 2026 02:59
@brennanb2025
brennanb2025 changed the base branch from brennanb2025/mobile-page-follow-at-cap to main October 18, 2026 08:18
@brennanb2025
brennanb2025 marked this pull request as draft October 18, 2026 08:18
@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: de32387c-f70a-4eb7-bb69-20532ac794ba
📥 Commits

Reviewing files that changed from the base of the PR and between dde20a1 and c508986.

📒 Files selected for processing: 2
  • mobile/src/terminal/terminal-web-document-mount.test.ts
  • mobile/src/terminal/terminal-web-document-mount.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

📝 Walkthrough

The change adds a shared older-page loader and updates native-chat and structured-agent sessions to expose page phases and handle failures, retries, timeouts, and superseded reads. It adds stable row and tool-member identities, measured web transcript rendering, and scroll anchoring and motion tracking. The chat view now uses a dedicated web page list and retains a native FlatList path. Tests and RPC recordings cover paging outcomes, row identity, scroll behavior, and tool disclosure state. The terminal document mount listener also ignores browser error events without an associated Error object.

Priority: ➖ Normal

Merge Risk: 🔵 Low · up to c5089

Closing a nested tool-line or diff-card disclosure can retain its reading position, so reopening may restore a stale scroll offset. This is localized and recoverable; the PR is mergeable with owner awareness or a follow-up.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 59.22% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 103 functions across 54 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly summarizes the main change: keeping phone chat history in one window while preserving the reader's position.
Description check Passed The pull request description is complete and follows the repository template. It explains the problem, user-visible changes, implementation, rationale, linked issues, visual proof, testing evidence, k…
Full details: Description check

Explanation

The pull request description is complete and follows the repository template. It explains the problem, user-visible changes, implementation, rationale, linked issues, visual proof, testing evidence, known gaps, review status, compatibility considerations, and checklist. Some checkbox items remain unchecked, but the required information is provided in the detailed sections.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Resolve the phone chat lane against main's tool runs, timestamps and chat-switch follow
@brennanb2025
brennanb2025 marked this pull request as ready for review October 18, 2026 08:45
@brennanb2025 brennanb2025 changed the title fix(mobile): the phone page draws only the messages near the screen, in one list Keep phone chat history in one window while preserving reading position Oct 18, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

🟡 Minor · Filter nested-root input before updating page motion. · mobile-native-chat-page-motion.ts:57-149

mobile/src/session/mobile-native-chat-page-motion.ts:57-149
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Filter nested-root input before updating page motion.

motion.attach(s) receives bubbled touch, wheel, and key events from MobileNativeChatOwnedScrollView. The outer motion then records nested scrolling as outer touching, way, and recent input. During a concurrent outer layout shift, scrolled() can classify the shift as reader. The page then takes an anchor at the shifted position and skips the layout-only correction path, which can move the outer reading position.

Filter events whose target is inside a [data-chat-scroll-root] before updating the outer motion state. Apply the filter to touch, wheel, and key events.

Suggested fix
diff --git a/mobile/src/session/mobile-native-chat-page-motion.ts b/mobile/src/session/mobile-native-chat-page-motion.ts
@@
-  attach(scroller: Listened, acceptsKey: (event: unknown) => boolean = () => true): () => void {
+  attach(
+    scroller: Listened,
+    acceptsKey: (event: unknown) => boolean = () => true,
+    acceptsInput: (event: unknown) => boolean = () => true
+  ): () => void {
@@
-      if (way !== 0 && acceptsKey(event)) {
+      if (way !== 0 && acceptsKey(event) && acceptsInput(event)) {
         input(way)
       }
@@
     const start = (event: unknown) => {
+      if (!acceptsInput(event)) return
       this.lastTouchY = touchY(event)
       input(0)
       this.touch(true)
@@
-      [scroller, 'touchend', () => this.touch(false)],
-      [scroller, 'touchcancel', () => this.touch(false)],
-      [scroller, 'touchmove', move],
-      [scroller, 'wheel', (event) => input(wheelWay(event))],
+      [scroller, 'touchend', (event) => acceptsInput(event) && this.touch(false)],
+      [scroller, 'touchcancel', (event) => acceptsInput(event) && this.touch(false)],
+      [scroller, 'touchmove', (event) => acceptsInput(event) && move(event)],
+      [scroller, 'wheel', (event) => acceptsInput(event) && input(wheelWay(event))],
diff --git a/mobile/src/session/use-mobile-native-chat-page-window.ts b/mobile/src/session/use-mobile-native-chat-page-window.ts
@@
-    const detach = motion.attach(s)
+    const acceptsPageInput = (event: unknown) => {
+      const target =
+        typeof event === 'object' && event !== null && 'target' in event ? event.target : undefined
+      return !(
+        typeof Element !== 'undefined' &&
+        target instanceof Element &&
+        target.closest('[data-chat-scroll-root]')
+      )
+    }
+    const detach = motion.attach(s, acceptsPageInput, acceptsPageInput)

ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d1f6cc38-c62d-4e00-af70-84199c038e98
📥 Commits

Reviewing files that changed from the base of the PR and between d2c4dc6 and a8bcaac.

📒 Files selected for processing: 25
  • mobile/src/session/MobileNativeChatDiffCard.tsx
  • mobile/src/session/MobileNativeChatLiveLine.tsx
  • mobile/src/session/MobileNativeChatMessage.tsx
  • mobile/src/session/MobileNativeChatOwnedScrollView.tsx
  • mobile/src/session/MobileNativeChatPageList.tsx
  • mobile/src/session/MobileNativeChatReasoningRow.tsx
  • mobile/src/session/MobileNativeChatScrollHold.tsx
  • mobile/src/session/MobileNativeChatTaskList.tsx
  • mobile/src/session/MobileNativeChatToolLine.tsx
  • mobile/src/session/MobileNativeChatToolRun.tsx
  • mobile/src/session/MobileNativeChatView.tsx
  • mobile/src/session/mobile-native-chat-disclosure-store.ts
  • mobile/src/session/mobile-native-chat-page-heights.test.ts
  • mobile/src/session/mobile-native-chat-page-motion.ts
  • mobile/src/session/mobile-native-chat-page-rows.ts
  • mobile/src/session/mobile-native-chat-page-window-state.ts
  • mobile/src/session/mobile-native-chat-row-keys.ts
  • mobile/src/session/mobile-native-chat-run-descriptors.ts
  • mobile/src/session/mobile-native-chat-scroll-ownership.test.tsx
  • mobile/src/session/mobile-native-chat-scroll-root-handle.ts
  • mobile/src/session/mobile-native-chat-scroll-roots.ts
  • mobile/src/session/mobile-native-chat-tool-run-props.ts
  • mobile/src/session/use-mobile-native-chat-page-window.ts
  • mobile/src/session/use-mobile-native-chat-row-renderer.tsx
  • mobile/src/session/use-mobile-native-chat-turn-disclosure.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

brennanb2025 and others added 11 commits October 18, 2026 05:16
…ails a terminal that is still loading

On the page each terminal document listens for window errors, and before ready a reported error is
fatal ("Terminal failed to load"). The window is the whole app's, so the browser's ResizeObserver
loop notice, which the chat list's resize work can raise and which carries no error, reached a
terminal mounted in the background and failed it. The guest reporter now forwards only events with
an error behind them.
…clamps the phone page to its end

After every resize the page attached following whenever the scroll sat within 1 px of the end,
whatever put it there. A collapse below a reader parked near the end makes WebKit clamp onto the
shorter end, so the next reply pulled them down. Following now comes only from classified motion
(the reader's own move, or a move toward the end), as on main; the resize callback only pins.
…, is its own component

Main's composer and tab changes took MobileNativeChatView past its line cap once merged; the
platform choice of list and its wiring move out unchanged.
…der follow

A clamp onto a shorter end that lands while the reader's finger is still down from tapping a
collapse below them is classified as the reader's move, and any reader move ending at the end
attached following. Following now attaches only on a move down toward the end, as on main; the
test covers the clamp with and without a finger down.
Detach needed a single scroll event moving up more than 1px, so a slow drag that reports many 1px
moves never detached, and the next reply pulled the reader back to the end. Any upward move of the
reader's that leaves the end now detaches. Found by tracing the remaining iPhone jump.
…t scroll positions

A nested box's address is the run's key, then the line's key:command, so the
old prefix match on the closed key never reached it and a reopened line
restored a stale scroll position.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants