Skip to content

fix(macos): advance sidebar pagination by DB offset, not accumulated count (address Codex review on #31924)#32103

Merged
siddseethepalli merged 1 commit into
mainfrom
swarm/f3a9/task-11
May 26, 2026
Merged

fix(macos): advance sidebar pagination by DB offset, not accumulated count (address Codex review on #31924)#32103
siddseethepalli merged 1 commit into
mainfrom
swarm/f3a9/task-11

Conversation

@siddseethepalli
Copy link
Copy Markdown
Contributor

Summary

After the cold-start drain loop, ConversationRestorer set serverOffset = foreground.conversations.count. But the conversations endpoint appends injected pinned rows on page 1 (offset 0, server-side), so the accumulated count overshoots the server's DB cursor — the next incremental loadMoreConversations() (which calls fetchConversationList(offset: serverOffset, ...)) then skips that many conversations.

This carries the server-provided nextOffset (DB pagination cursor) through the synthesized fetchAllConversationPages response and uses foreground.nextOffset ?? foreground.conversations.count for serverOffset, mirroring the already-fixed appendConversations path in ConversationListStore so behavior is consistent.

Notes

  • Fallback (offset + pageSize == pagesFetched * pageSize) only engages for daemons that omit nextOffset; it is exercised only when hasMore is false (pagination disabled), so it introduces no regression.
  • Existing test fetchConversationListPaginatesUntilHasMoreIsFalse still asserts serverOffset == 450 (mock has no pinned-row injection, so count == nextOffset).

Addresses Codex review on #31924.

…count

After the cold-start drain loop, ConversationRestorer set serverOffset to
foreground.conversations.count. The conversations endpoint appends injected
pinned rows on page 1 (offset 0), so the accumulated count overshoots the
server's DB cursor and the next loadMoreConversations() skips that many rows.
Carry the server-provided nextOffset (DB pagination cursor) through the
synthesized fetchAllConversationPages response and use it for serverOffset,
mirroring the appendConversations pagination path.

Addresses Codex review on #31924.
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8755666912

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

// server-provided nextOffset so incremental "load more" resumes at
// the right cursor instead of skipping rows. Fall back to advancing
// by one full page when the daemon omits nextOffset.
nextOffset = response.nextOffset ?? (offset + pageSize)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Derive fallback cursor from returned row count

When response.nextOffset is absent, this fallback advances by a full page (offset + pageSize) instead of by the rows actually returned. On older daemons that omit nextOffset, the terminal page is often partial, so nextOffset becomes too large (e.g., 450 rows drained with page size 200 yields 600). That inflated value is then assigned to serverOffset and the next pagination request can start past unseen rows, skipping conversations. The fallback should use offset + response.conversations.count (or equivalent accumulated count) to represent the true DB cursor reached.

Useful? React with 👍 / 👎.

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.

1 participant