Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/agents/memory/openai_conversations_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ async def get_items(self, limit: int | None = None) -> list[TResponseInputItem]:
order="asc",
):
# calling model_dump() to make this serializable
all_items.append(item.model_dump())
all_items.append(item.model_dump(exclude_unset=True))
Comment on lines 52 to +53

Choose a reason for hiding this comment

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

P1 Badge status=None still serialized from conversation items

Switching to item.model_dump(exclude_unset=True) does not remove keys whose values are explicitly None. GPT‑5 reasoning items returned from the Conversations API include status set to null, so this call still emits {"status": None} and the Responses API continues to reject input[1].status. To avoid the error the code needs to exclude None values (e.g. exclude_none=True, optionally combined with exclude_unset). As written, the bug described in the commit message remains reproducible for second‑turn requests.

Useful? React with 👍 / 👎.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The status=None field comes from the ResponseReasoningItem model, it has a default value of None. So when we call model_dump(exclude_unset=True), it does remove this field as expected.

else:
async for item in self._openai_client.conversations.items.list(
conversation_id=session_id,
limit=limit,
order="desc",
):
# calling model_dump() to make this serializable
all_items.append(item.model_dump())
all_items.append(item.model_dump(exclude_unset=True))
if limit is not None and len(all_items) >= limit:
break
all_items.reverse()
Expand Down