You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(sessions): cap Conversations item pagination at the API limit - #4721
Cap the Conversations items provider page size at 100 while preserving the caller's larger get_items(limit=N) cutoff. This lets session callers retrieve more than 100 recent items without sending an invalid page-size value to the API, while retaining chronological output ordering.
Test plan
uv run pytest -q tests/memory/test_openai_conversations_session.py — 39 passed
uv run ruff format --check — 921 files already formatted
uv run ruff check — passed
uv run python .github/scripts/check_optional_truthiness.py src/agents — passed
uv run mypy src — passed (307 source files)
uv run pyright --project pyrightconfig.json --threads "${PYRIGHT_THREADS:-4}" — passed
make tests-serial — 77 passed, 4 skipped, 55 deselected
make tests-parallel — 9234 passed, 28 skipped; one unrelated failure in tests/sandbox/test_run_cwd.py::test_python_skill_uses_absolute_root_from_nested_workdir, reproduced unchanged on upstream/main
Issue number
None.
Checks
I've added new tests, if relevant
I've run .agents/skills/code-change-verification/scripts/run.sh
I've confirmed all verification steps pass
If using Codex, I've run /review before submitting this PR
seratch
changed the title
Cap Conversations item pagination at the API limit
fix(sessions): cap Conversations item pagination at the API limit
Aug 27, 2026
Thanks for investigating and fixing the large-limit failure. The underlying bug is real, but I do not think we should copy the Conversations API's current page-size maximum into the Agents SDK. _MAX_ITEMS_PAGE_SIZE = 100 creates a second source of truth for provider-owned behavior, and the added test makes that duplicated constraint part of this repository's implementation.
The simpler fix is to omit limit from conversations.items.list() and let the OpenAI Python client handle provider pagination, while the existing local cutoff continues to enforce the Session.get_items(limit=N) contract.
Since that replaces the central implementation and test in this PR rather than refining them, I am going to close this PR and pursue the narrower approach separately. Thank you for identifying the original issue.
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
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.
Summary
Cap the Conversations items provider page size at 100 while preserving the caller's larger
get_items(limit=N)cutoff. This lets session callers retrieve more than 100 recent items without sending an invalid page-size value to the API, while retaining chronological output ordering.Test plan
uv run pytest -q tests/memory/test_openai_conversations_session.py— 39 passeduv run ruff format --check— 921 files already formatteduv run ruff check— passeduv run python .github/scripts/check_optional_truthiness.py src/agents— passeduv run mypy src— passed (307 source files)uv run pyright --project pyrightconfig.json --threads "${PYRIGHT_THREADS:-4}"— passedmake tests-serial— 77 passed, 4 skipped, 55 deselectedmake tests-parallel— 9234 passed, 28 skipped; one unrelated failure intests/sandbox/test_run_cwd.py::test_python_skill_uses_absolute_root_from_nested_workdir, reproduced unchanged onupstream/mainIssue number
None.
Checks
.agents/skills/code-change-verification/scripts/run.sh/reviewbefore submitting this PR