Skip to content

OpenAIConversationsSession get_items(limit>provider page size) forwards the session limit as provider page size #4757

Description

@sylvesterkaczmarek

OpenAIConversationsSession.get_items(limit=N) currently forwards N directly to conversations.items.list(limit=N). For large session limits this couples the SDK's local history cutoff to the provider's page-size constraints and can make an otherwise valid Session.get_items(limit=N) call fail before client pagination occurs.

A previous implementation attempt in #4721 confirmed the underlying bug. Maintainer guidance there was to avoid copying provider page-size constants into the SDK and instead omit limit from conversations.items.list(), letting the OpenAI client handle provider pagination while preserving the SDK's existing local cutoff.

Expected behavior: for a finite session limit, request items in descending order without forwarding the SDK limit as a provider page size, stop locally once N items are collected, then reverse them into chronological order.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions