---
type: email
from: "chatgpt-codex-connector[bot]" <notifications@github.com>
subject: Re: [openai/openai-agents-python] Fix a bug where debug logging fails

 with Iterable objects (PR #1683)
received: 2026-03-06 07:24:32
date_header: Mon, 08 Sep 2025 00:46:19 -0700
priority: normal
status: awaiting_approval
uid: 29745
---

## Email Content

**From:** "chatgpt-codex-connector[bot]" <notifications@github.com>
**Subject:** Re: [openai/openai-agents-python] Fix a bug where debug logging fails

 with Iterable objects (PR #1683)
**Date:** Mon, 08 Sep 2025 00:46:19 -0700

### Body (preview)

@chatgpt-codex-connector[bot] commented on this pull request.



Codex Review: Here are some suggestions.



Reply with `@codex fix comments` to fix any unresolved comments.



<details> <summary>About Codex in GitHub</summary>



[Your team has set up Codex to review pull requests in this repo](http://chatgpt.com/codex/settings/general). Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.



Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".

</details>



>          if _debug.DONT_LOG_MODEL_DATA:

             logger.debug("Calling LLM")

         else:

+            messages_json = json.dumps(

+                _to_dump_compatible(converted_messages),

+                indent=2,

+                ensure_ascii=False,

+            )

+            tools_json = json.dumps(

+                _to_dump_compatible(converted_tools),

+                indent=2,

+                ensure_ascii=False,

+            )



**[P1] Avoid exhausting iterator inputs during debug logging**



The new `_to_dump_compatible` call builds JSON strings from `converted_messages` and `converted_tools` solely for logging, but the same objects are later sent to `litellm.acompletion`. When those structures contain generators or other one-shot iterables—the precise case this helper targets—the conversion step consumes them, so the subsequent API call receives empty content or tool definitions. Logging needs to operate on a copy and reuse that converted structure for the request, or otherwise clone the iterables before iterating.



Useful? React with 👍 / 👎.



>          if _debug.DONT_LOG_MODEL_DATA:

             logger.debug("Calling LLM")

         else:

+            messages_json = json.dumps(

+                _to_dump_compatible(converted_messages),

+                indent=2

---

## Suggested Actions
- [ ] Reply
- [ ] Archive
- [ ] Escalate
