Skip to content

fix(mobile): paginate agent sessions list and clear the tab bar overlay#4380

Merged
iscekic merged 2 commits into
mainfrom
mobile/agent-sessions-pagination
Jul 3, 2026
Merged

fix(mobile): paginate agent sessions list and clear the tab bar overlay#4380
iscekic merged 2 commits into
mainfrom
mobile/agent-sessions-pagination

Conversation

@iscekic

@iscekic iscekic commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Problem

Reported: "it won't let me scroll down to view past CLI sessions". Two separate causes:

  1. Last rows hidden under the tab bar. The tab bar is an absolutely-positioned translucent overlay, and the sessions SectionList had no bottom content padding — every other scrollable screen pads by getTabBarOverlayHeight, this one only did so for its empty state. Scrolling to the end left the final rows underneath the tab bar and the list bounced back.

  2. Sessions older than 5 days were never loaded. useStoredSessions hardcoded updatedSince to 5 days ago with no pagination, so older sessions weren't below the fold — they weren't fetched at all (the "Older" date bucket was unreachable).

Fix

  • Pad the SectionList content by the tab bar overlay height.
  • Switch stored sessions to cursor-based infinite pagination via useInfiniteQuery — the cliSessionsV2.list procedure already supports cursor/nextCursor, so no backend changes. 30 sessions per page, loaded on onEndReached with a footer spinner, deduped by session_id across pages (a session updated mid-paging can repeat since the cursor is updated_at).
  • Dropped the now-unused liveStoredSessions/offlineSessions fields from the hook (no consumers).

Testing

pnpm format && pnpm typecheck && pnpm lint && pnpm check:unused clean; pnpm test 360/360 passing.

The sessions SectionList had no bottom padding for the absolutely-positioned
tab bar, so the last rows were stuck underneath it and the list bounced back
when scrolling down. Content now pads by the tab bar overlay height.

Stored sessions were also fetched with a hardcoded 5-day updatedSince window,
so anything older was never loaded. The list now uses cursor-based infinite
pagination (the cliSessionsV2.list procedure already supported it), loading
30 sessions per page via onEndReached with a footer spinner.
@iscekic iscekic self-assigned this Jul 3, 2026
@iscekic iscekic requested a review from jeanduplessis July 3, 2026 11:50
Comment thread apps/mobile/src/lib/hooks/use-agent-sessions.ts
@kilo-code-bot

kilo-code-bot Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

The prior search-pagination gap was resolved by switching session search to the server-side cliSessionsV2.search endpoint, which covers full history independent of loaded pages; no new issues found in the incremental changes.

Files Reviewed (2 files)
  • apps/mobile/src/components/agents/session-list-screen.tsx
  • apps/mobile/src/lib/hooks/use-agent-sessions.ts
Previous Review Summary (commit 9df7c0d)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 9df7c0d)

Status: 1 Issue Found | Recommendation: Address before merge

Executive Summary

Switching stored-sessions to cursor pagination means client-side search only sees currently-loaded pages, with no mechanism to auto-fetch more while searching.

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
apps/mobile/src/lib/hooks/use-agent-sessions.ts 58 Search filters only already-loaded pages; nothing triggers fetchNextPage on search, and a sparse filtered list may never reach onEndReached
Files Reviewed (3 files)
  • apps/mobile/src/components/agents/session-list-content.tsx - 0 issues
  • apps/mobile/src/components/agents/session-list-screen.tsx - 0 issues
  • apps/mobile/src/lib/hooks/use-agent-sessions.ts - 1 issue

Fix these issues in Kilo Cloud


Reviewed by claude-sonnet-5-20260630 · Input: 42 · Output: 8.5K · Cached: 1.2M

Review guidance: REVIEW.md from base branch main

Client-side search only matched sessions from already-loaded pages now that
the list is cursor-paginated. Wire the debounced search query to the
cliSessionsV2.search endpoint instead, so search covers the full history.
Active (remote) sessions keep the client-side match since they're a small
in-memory list not covered by the search endpoint.
@iscekic iscekic merged commit 7ac5a4f into main Jul 3, 2026
19 checks passed
@iscekic iscekic deleted the mobile/agent-sessions-pagination branch July 3, 2026 12:08
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