feat(app-server, threadstore): Thread pagination APIs and ThreadStore contract#21566
Merged
feat(app-server, threadstore): Thread pagination APIs and ThreadStore contract#21566
Conversation
fdcc5bd to
e27bd0a
Compare
wiltzius-openai
approved these changes
May 7, 2026
Contributor
wiltzius-openai
left a comment
There was a problem hiding this comment.
the threadstore API change looks right to me
for the local store implementation it will definitely be easier to do this if we move the rollout history into sqlite because you can get indexes more or less for free
the remote store this is going to be challenging to implement but I don't think that's the fault of the contract
| /// Turn id. | ||
| pub turn_id: String, | ||
| /// Persisted rollout items associated with this turn, according to `items_view`. | ||
| pub items: Vec<RolloutItem>, |
Contributor
There was a problem hiding this comment.
what does the Vec look like if the request items_view is Summary or NotLoaded? In the NotLoaded case I guess it can be an empty vector, but for Summary what's the return type?
Collaborator
Author
There was a problem hiding this comment.
good question!
- for
items_view: summarywe will have pretty much always have a vector of two items:[<InitialUserMessage item>, <FinalAssistantMessageItem>](for a successfully completed turn) - for
items_view: not_loadedwe will just haveitems: []
I'll make sure it's documented clearly once I have this implemented more
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The goal of this PR is to align on app-server and
ThreadStoreAPI updates for paginating through large threads.app-server
thread/turns/listthread/turns/listto supportitemsView?: "notLoaded" | "summary" | "full" | null, defaulting tosummary.thread/turns/listbehavior over the existing persisted rollout-history fallback:notLoadedreturns turn envelopes with emptyitems.summaryreturns the first user message and final assistant message when available.fullpreserves the existing full item behavior.Note that this method still uses the naive approach of loading the entire rollout file, and returns just the filtered slice of the data. Real pagination will come later by leveraging SQLite.
thread/turns/items/listthread/turns/items/listprotocol, schema, dispatcher, and processor stub. The app-server currently returns JSON-RPC-32601withthread/turns/items/list is not supported yet.ThreadStore
thread/turns/items/listprotocol, schema, dispatcher, and processor stub. The app-server currently returns JSON-RPC-32601withthread/turns/items/list is not supported yet.ThreadStorecontract types and stubbed methods for listing thread turns and listing items within a turn.StoredTurnStatusandStoredTurnErrorto avoid baking app-server API enums or lossy string status values into the store-facing turn contract.StoredTurnStatusandStoredTurnErrorto avoid baking app-server API enums or lossy string status values into the store-facing turn contract.This also sketches the storage abstraction we expect to need once turns are indexed/stored. In particular,
notLoadedis useful only if ThreadStore can eventually list turn metadata without loading every persisted item for each turn.Validation
thread/turns/listdefault summary behavior and all threeitemsViewmodes.thread/turns/items/listreturns the expected unsupported JSON-RPC error when experimental APIs are enabled.ThreadStoreError::Unsupported.No developers.openai.com documentation update is needed for this internal experimental app-server API surface.