Skip to content

feat(ios): paginate chat lists and complete history turns on scroll - #7363

Open
me2seeks wants to merge 1 commit into
mainfrom
feat/ios-auto-pagination-and-chat-history
Open

me2seeks wants to merge 1 commit into
mainfrom
feat/ios-auto-pagination-and-chat-history

Conversation

@me2seeks

Copy link
Copy Markdown
Contributor

Summary

Replaces manual pagination clicks with automatic scroll-triggered pagination in both Chats and Chat screens, switches iOS chat history reads to the Host's view: 'chat' projection so loading earlier history advances cleanly across full conversation turns, and migrates ChatScreen onto NSH List for native prepend scroll anchoring.

  • Automatic chat-list pagination (ChatListScreen + state/sessions.ts)
    • Automatically fetch the next page when scrolling near the bottom (including slightly overflowing lists after a viewport resize and single-wheel bottom reach), without triggering pagination from layout changes alone.
    • Evaluate pagination eligibility per Host in the All scope: a failed Host shows its error + Retry without blocking healthy Hosts from paging or getting implicitly retried by background catalog pushes / reconnect heads.
    • Keep a manual Load more chats button when the current list cannot scroll or search has no matches in loaded chats, and pause automatic retries after a failure until explicit Retry.
  • Full-turn view: 'chat' history loading & scroll-up auto-pagination (ChatScreen + state/chat.ts)
    • Switch agent history fetches from raw view: 'conversation' (where 8-chunk pages were consumed by collapsed thinking/tool rows) to view: 'chat' (Shape::Groups), lazily reading turn/steps details only when expanding an activity group (preserving live multi-page refresh without starving or flashing back to Loading…, and handling user-headed work groups cleanly).
    • Automatically load earlier history when scrolling near the top, advancing across pages to complete any partial top turn plus at least one full earlier prompt + reply turn (same turn-boundary logic for Bot raw rows; Rooms continue message paging), stopping active paging loops when leaving the screen.
    • Preserve full A\n\nB Copy / Quote contract on folded turns without requiring prior expansion, invalidate stale in-flight before reads and re-read boundary turns on completion, and rebuild non-overlapping windows instead of stitching gaps.
    • Keep TranscriptSkeleton in the List empty slot (from fix(ios): keep cached chats visible while reconnecting and add cold-load skeletons #7362) so cold-load handoff lands cleanly at the latest message without disturbing list anchoring.
  • NSH TextView sourceOffset anchoring (third-party/nsh)
    • Add sourceOffset prop to TextView so prepending earlier UTF-8 bytes of a long Markdown message preserves the reading anchor on the same passage, and fix provisional comparison against absolute byte ends so non-zero offsets settle and unpin normally.

Verification

  • CARGO=mbx node scripts/ci.mjs check ios (62 headless behavior tests + aarch64-apple-ios-sim target check)
  • mbx test --locked --manifest-path third-party/nsh/Cargo.toml -p nsh-base --lib text_view (191 passed, 5 ignored)
  • mbx test --locked --manifest-path third-party/nsh/Cargo.toml -p nsh-core --lib source (38 passed) + sourceOffset compat case
  • Strict TypeScript check across 71 TS/TSX files (0 diagnostics)
  • node scripts/ci.mjs check i18n (12 locales), Biome check, and git diff --check feat/ios-reconnect-and-skeletons...HEAD
  • Note: Verified via headless NSH tests and iOS simulator compilation; live iPhone/simulator gesture & keyboard walk-through has not been run yet.

Part 2 of a 2-PR native stack on top of #7362.

@me2seeks
me2seeks added this pull request to stack #7364 November 27, 2026 09:45

@Astro-Han Astro-Han 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.

LGTM.

Base automatically changed from feat/ios-reconnect-and-skeletons to main November 27, 2026 09:57
@me2seeks
me2seeks force-pushed the feat/ios-auto-pagination-and-chat-history branch from fcfad94 to 5e6484d Compare November 27, 2026 09:57

This branch has not been deployed

No deployments
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