Skip to content

Add sorting/backwardsCursor to thread/list and new thread/turns/list api#17305

Merged
ddr-oai merged 9 commits intomainfrom
ddr/thread-sort-asc
Apr 17, 2026
Merged

Add sorting/backwardsCursor to thread/list and new thread/turns/list api#17305
ddr-oai merged 9 commits intomainfrom
ddr/thread-sort-asc

Conversation

@ddr-oai
Copy link
Copy Markdown
Contributor

@ddr-oai ddr-oai commented Apr 10, 2026

To improve performance of UI loads from the app, add two main improvements:

  1. The thread/list api now gets a sortDirection request field and a backwardsCursor to the response, which lets you paginate forwards and backwards from a window. This lets you fetch the first few items to display immediately while you paginate to fill in history, then can paginate "backwards" on future loads to catch up with any changes since the last UI load without a full reload of the entire data set.
  2. Added a new thread/turns/list api which also has sortDirection and backwardsCursor for the same behavior as thread/list, allowing you the same small-fetch for immediate display followed by background fill-in and resync catchup.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 10, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

Copy link
Copy Markdown
Contributor

@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: 22eb1fd251

ℹ️ 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".

Comment thread codex-rs/rollout/src/recorder.rs Outdated
Comment thread codex-rs/app-server/src/codex_message_processor.rs Outdated
Comment thread codex-rs/app-server/src/codex_message_processor.rs Outdated
Comment thread codex-rs/app-server/src/codex_message_processor.rs
Comment thread codex-rs/app-server/src/codex_message_processor.rs Outdated
Comment thread codex-rs/app-server/src/codex_message_processor.rs Outdated
Comment thread codex-rs/app-server/src/codex_message_processor.rs Outdated
Comment thread codex-rs/app-server-protocol/src/protocol/v2.rs
Comment thread codex-rs/rollout/src/recorder.rs
Comment thread codex-rs/rollout/src/recorder.rs Outdated
Comment thread codex-rs/rollout/src/recorder.rs Outdated
Comment thread codex-rs/app-server-protocol/src/protocol/v2.rs
@ddr-oai ddr-oai force-pushed the ddr/thread-sort-asc branch from c6506c2 to a7337fe Compare April 11, 2026 18:55
@etraut-openai etraut-openai added the oai PRs contributed by OpenAI employees label Apr 11, 2026
@ddr-oai ddr-oai force-pushed the ddr/thread-sort-asc branch 2 times, most recently from baf57e4 to 1d907c9 Compare April 15, 2026 01:01
@ddr-oai ddr-oai force-pushed the ddr/thread-sort-asc branch 3 times, most recently from 414ada9 to 85f967f Compare April 16, 2026 06:19
@ddr-oai ddr-oai force-pushed the ddr/thread-sort-asc branch 2 times, most recently from a34e5cb to 37c621d Compare April 16, 2026 15:48
Copy link
Copy Markdown
Collaborator

@jif-oai jif-oai left a comment

Choose a reason for hiding this comment

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

This will break previously issued cursor but I don't think we care

The comments mentionned before on stability over same ms cursors is still valid but it's out of scope for this PR

Comment thread codex-rs/app-server/src/codex_message_processor.rs
@ddr-oai ddr-oai force-pushed the ddr/thread-sort-asc branch 2 times, most recently from 9e87242 to 510c3d3 Compare April 17, 2026 18:02
ddr-oai added 9 commits April 17, 2026 11:19
To improve performance on connection/reconnection to a remote appserver, we want to allow for delta syncs of the thread list, so that you only get what updated since you last connected (in short reconnections, expected to be zero items).  This requires adding an ascending sort option to the thread search (both the sqlite DB query and the filesystem-based query), and then adding a slightly different sortkey for the ascending sort to efficiently support these delta syncs.

Note: This was codexed up, though iterated on a few times to make the implementation as clean as made sense to my untrained eye (not used to this codebase).  There's still models at a few layers for the sortdirection that feel ugly but seems consistent with other search parameters so may be fine.  The biggest ugliness is in the non-sqlite filesystem-backed query mode, where the ascending sort is pretty gross, but I don't think there's a better answer there, and it seems like that path is an edge case.

added a backwards_cursor to let you sync forwards and backwards

add a thread/turns/list call to paginate through turn data

move completely from threadsortdirection to sortdirection, update readme

fix rebase-from-main issues

pr feedback/build issues

build fix
@ddr-oai ddr-oai force-pushed the ddr/thread-sort-asc branch from 510c3d3 to 9b23432 Compare April 17, 2026 18:19
@ddr-oai ddr-oai merged commit eaf78e4 into main Apr 17, 2026
34 of 36 checks passed
@ddr-oai ddr-oai deleted the ddr/thread-sort-asc branch April 17, 2026 18:49
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

oai PRs contributed by OpenAI employees

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants