mirror of
https://github.com/openai/codex.git
synced 2026-09-11 20:36:49 +00:00
Start Python SDK turn subscriptions at their attachment point (#44400)
## What changed Make turn event delivery depend on when each consumer attaches: - Handles returned by `thread.turn(...)` receive events from when the request is sent, including events received before the response arrives. - Other handles and explicit low-level registrations receive only events from when they join. Remove replay of completed items, token usage, and terminal events; use `thread.read(include_turns=True)` for earlier history. - Retain unread events for active subscribers and pending starts, release unused turn state, and close the returned subscription when an async start is cancelled. Preserve the existing low-level subscription when repeated `turn_start(...)` calls return the same turn. ## Testing Update coverage for late joins, request-time buffering, completion or transport failure before a start returns, async cancellation cleanup, and repeated low-level starts. Adjust external-message integration tests to allow handles to collect different items while receiving the same final response. GitOrigin-RevId: 3b7f1268df1193dee88385006ae9510101086c24
This commit is contained in:
@@ -233,6 +233,9 @@ passed to `run(...)` or `turn(...)` applies to that turn and subsequent turns.
|
||||
|
||||
## TurnHandle / AsyncTurnHandle
|
||||
|
||||
A `thread.turn(...)` handle receives events from when the call sends its request.
|
||||
Other handles start when they join; use `thread.read(include_turns=True)` for earlier history.
|
||||
|
||||
### TurnHandle
|
||||
|
||||
- `steer(input: str | Input) -> TurnSteerResponse`
|
||||
|
||||
Reference in New Issue
Block a user