Skip to content

feat(app-server, threadstore): Thread pagination APIs and ThreadStore contract#21566

Merged
owenlin0 merged 1 commit intomainfrom
owen/paginated_thread_history_apis
May 7, 2026
Merged

feat(app-server, threadstore): Thread pagination APIs and ThreadStore contract#21566
owenlin0 merged 1 commit intomainfrom
owen/paginated_thread_history_apis

Conversation

@owenlin0
Copy link
Copy Markdown
Collaborator

@owenlin0 owenlin0 commented May 7, 2026

Why

The goal of this PR is to align on app-server and ThreadStore API updates for paginating through large threads.

app-server

thread/turns/list
  • Updates thread/turns/list to support itemsView?: "notLoaded" | "summary" | "full" | null, defaulting to summary.
  • Implements the current thread/turns/list behavior over the existing persisted rollout-history fallback:
    • notLoaded returns turn envelopes with empty items.
    • summary returns the first user message and final assistant message when available.
    • full preserves 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/list
  • Adds the experimental thread/turns/items/list protocol, schema, dispatcher, and processor stub. The app-server currently returns JSON-RPC -32601 with thread/turns/items/list is not supported yet.

ThreadStore

  • Adds the experimental thread/turns/items/list protocol, schema, dispatcher, and processor stub. The app-server currently returns JSON-RPC -32601 with thread/turns/items/list is not supported yet.
  • Adds ThreadStore contract types and stubbed methods for listing thread turns and listing items within a turn.
  • Adds a typed StoredTurnStatus and StoredTurnError to avoid baking app-server API enums or lossy string status values into the store-facing turn contract.
  • Adds a typed StoredTurnStatus and StoredTurnError to 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, notLoaded is useful only if ThreadStore can eventually list turn metadata without loading every persisted item for each turn.

Validation

  • Added/updated protocol serialization coverage for the new request and response shapes.
  • Added app-server integration coverage for thread/turns/list default summary behavior and all three itemsView modes.
  • Added app-server integration coverage that thread/turns/items/list returns the expected unsupported JSON-RPC error when experimental APIs are enabled.
  • Added thread-store coverage that the default trait methods return ThreadStoreError::Unsupported.

No developers.openai.com documentation update is needed for this internal experimental app-server API surface.

@owenlin0 owenlin0 changed the title wip paginated apis + thread store interface changes Thread pagination APIs and ThreadStore contract May 7, 2026
@owenlin0 owenlin0 changed the title Thread pagination APIs and ThreadStore contract feat(app-server, threadstore): Thread pagination APIs and ThreadStore contract May 7, 2026
@owenlin0 owenlin0 marked this pull request as ready for review May 7, 2026 20:30
@owenlin0 owenlin0 force-pushed the owen/paginated_thread_history_apis branch from fdcc5bd to e27bd0a Compare May 7, 2026 20:41
Copy link
Copy Markdown
Contributor

@wiltzius-openai wiltzius-openai left a comment

Choose a reason for hiding this comment

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

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>,
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.

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?

Copy link
Copy Markdown
Collaborator Author

@owenlin0 owenlin0 May 7, 2026

Choose a reason for hiding this comment

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

good question!

  • for items_view: summary we will have pretty much always have a vector of two items: [<InitialUserMessage item>, <FinalAssistantMessageItem>] (for a successfully completed turn)
  • for items_view: not_loaded we will just have items: []

I'll make sure it's documented clearly once I have this implemented more

@owenlin0 owenlin0 merged commit 0d0835d into main May 7, 2026
26 checks passed
@owenlin0 owenlin0 deleted the owen/paginated_thread_history_apis branch May 7, 2026 22:44
@github-actions github-actions Bot locked and limited conversation to collaborators May 7, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants