AGE-1957: Update PreparedTurn for create-turn JSON vs SSE split - #16
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. Walkthrough
ChangesTurn execution transport
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This PR separates prepared-turn startup between JSON and SSE APIs for synchronous and asynchronous paths; no actionable merge-blocking risk remains beyond normal checks. Sequence Diagram(s)sequenceDiagram
participant PreparedTurn
participant AsyncPreparedTurn
participant GatewayAPI
participant TurnPolling
alt Synchronous non-streaming
PreparedTurn->>GatewayAPI: create_turn
GatewayAPI-->>PreparedTurn: JSON turn
PreparedTurn->>TurnPolling: poll adopted turn
else Asynchronous non-streaming
AsyncPreparedTurn->>GatewayAPI: await create_turn
GatewayAPI-->>AsyncPreparedTurn: JSON turn
AsyncPreparedTurn->>TurnPolling: poll adopted turn
else Streaming
PreparedTurn->>GatewayAPI: create_turn_stream
GatewayAPI-->>PreparedTurn: turn.created SSE event
PreparedTurn->>PreparedTurn: adopt event turn
end
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
AGE-1957: Update PreparedTurn for create-turn JSON vs SSE split
Note
Medium Risk
Changes how all prepared turns are started (streaming and non-streaming) in sync and async paths, which could affect runtime behavior if the JSON and SSE endpoints diverge.
Overview
PreparedTurn and AsyncPreparedTurn now match the gateway’s split between JSON turn creation and SSE streaming.
When
execute(stream=True), turn start goes throughcreate_turn_streaminstead of treatingcreate_turnas the SSE entrypoint. Whenexecute(stream=False), the client callscreate_turnonce, builds the inner turn from the JSON response via_adopt_turn_from_api, then polls to completion—replacing the old behavior that opened SSE only untilturn.created.The SSE adoption path is renamed to
_adopt_turn_from_created_event;_create_turn_if_not_existis removed. Docs and docstrings are updated to describe the two APIs explicitly.Reviewed by Cursor Bugbot for commit ae0a4c9. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit