Skip to content

fix: honor zero history limits in the FileSession example - #4979

Open
JiangLLM wants to merge 1 commit into
openai:mainfrom
JiangLLM:fix/file-session-zero-limit
Open

fix: honor zero history limits in the FileSession example#4979
JiangLLM wants to merge 1 commit into
openai:mainfrom
JiangLLM:fix/file-session-zero-limit

Conversation

@JiangLLM

@JiangLLM JiangLLM commented Sep 12, 2026

Copy link
Copy Markdown

Summary

This PR fixes a bug in the FileSession example.

When a caller asks for zero messages, get_items(limit=0) returns all saved messages. It should return an empty list.

The cause is items[-limit:]. When limit is zero, Python reads this as items[0:].

The fix returns an empty list for zero. Other limit values work as before. The saved messages stay unchanged.

Test plan

  • Added five test cases for zero, positive values, a value above the history size, and None.
  • The zero-limit test failed before the fix and passed after it.
  • All 58 related tests passed.
  • Format, lint, and type checks passed.
  • A separate Codex agent reviewed the change and found no issues.

The full local test run had 9,577 passes, 56 skips, and 11 failures. All 11 failures occurred because the local sandbox blocked a test server from opening a port. The serial tests did not run.

Full verification is still incomplete.

Issue number

No issue is linked to this PR.

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

A separate Codex agent reviewed the full diff. The /review command was not run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant