---
type: email
from: "chatgpt-codex-connector[bot]" <notifications@github.com>
subject: Re: [openai/openai-agents-python] Fix extended thinking bug by

 reordering tool messages (PR #1798)
received: 2026-03-06 07:43:08
date_header: Wed, 24 Sep 2025 08:45:47 -0700
priority: normal
status: awaiting_approval
uid: 31239
---

## Email Content

**From:** "chatgpt-codex-connector[bot]" <notifications@github.com>
**Subject:** Re: [openai/openai-agents-python] Fix extended thinking bug by

 reordering tool messages (PR #1798)
**Date:** Wed, 24 Sep 2025 08:45:47 -0700

### Body (preview)

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





### 💡 Codex Review



Here are some automated review suggestions for this pull request.

    



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

<br/>



Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

- Open a pull request for review

- Mark a draft as ready

- Comment "@codex review".



If Codex has suggestions, it will comment; otherwise it will react with 👍.





</details>



> +            elif role == "tool":

+                # Skip - these will be handled as part of tool pairs above

+                used_indices.add(i)

+



**<sub><sub>![P1 Badge](https://img.shields.io/badge/P1-orange?style=flat)</sub></sub>  Preserve unmatched tool_result messages**



In `_fix_tool_message_ordering()` the `role == "tool"` branch simply marks the index as used and skips emitting the message. When a tool message has no matching `tool_call_id` or the corresponding tool call is absent from the trimmed history, this logic drops the tool result entirely. Previously those messages were forwarded to the provider; now they silently disappear, which removes tool outputs from the conversation and can change agent behaviour. Consider emitting unmatched tool messages (or raising) rather than discarding them.



Useful? React with 👍 / 👎.



-- 

Reply to this email directly or view it on GitHub:

https://github.com/openai/openai-agents-python/pull/1798#pullrequestreview-3263560840

You are receiving this because you are subscribed to this thread.



Message ID: <openai/openai-agents-python/pull/1798/review/3263560840@github.com>

---

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