---
type: email
from: "chatgpt-codex-connector[bot]" <notifications@github.com>
subject: Re: [openai/openai-agents-python] docs: clarify cancel-after-turn streaming guidance (PR #2710)
received: 2026-03-20 07:05:40
date_header: Thu, 19 Mar 2026 19:02:01 -0700
priority: normal
status: pending
uid: 19d08fa66865303e
---

## Email Content

**From:** "chatgpt-codex-connector[bot]" <notifications@github.com>
**Subject:** Re: [openai/openai-agents-python] docs: clarify cancel-after-turn streaming guidance (PR #2710)
**Date:** Thu, 19 Mar 2026 19:02:01 -0700

### Body (preview)

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





### 💡 Codex Review



Here are some automated review suggestions for this pull request.



**Reviewed commit:** `d4cfc5ea24`

    



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

<br/>



Codex has been enabled to automatically 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 👍.









When you [sign up for Codex through ChatGPT](https://openai.com/codex), Codex can also answer questions or update the PR, like "@codex address that feedback".

            

</details>



> @@ -55,6 +55,17 @@ if result.interruptions:

 

 For a full pause/resume walkthrough, see the [human-in-the-loop guide](human_in_the_loop.md).

 

+## Cancel streaming after the current turn

+

+If you need to stop a streaming run in the middle, call [`result.cancel()`][agents.result.RunResultStreaming.cancel]. By default this stops the run immediately. To let the current turn finish cleanly before stopping, call `result.cancel(mode="after_turn")` instead.

+

+A streamed run is not complete until `result.stream_events()` finishes. The SDK may still be persisting session items, finalizing approval state, or compacting history after the last visible token.

+

+If you are manually continuing from [`result.to_input_list(mode="normalized")`][agents.result.RunResultBase.to_input_list], and `cancel(mode="after_turn")` stops after a tool turn, continue that unfinished turn by rerunning `result.last_agent` with that normalized input instead of appending a fresh user turn right away.

+-   If a streamed run stopped for tool approval, do not treat that as a new turn. Finish draining the stream, inspect `result.interruptions`, and resume from `result.to_state()` instead.

+-   If you are using an OpenAI Responses-based session and need to reduce long cli

---

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