Session_runner cleanup and webrtc refresh fix - #495
Conversation
Greptile SummaryThis PR refactors session execution into
Confidence Score: 4/5The PR is not yet safe to merge because a reconnect near the grace-period deadline can still close the recovered session. Disconnect cleanup can wake during the replacement offer's awaited SDP negotiation, observe no installed peer, and enqueue a session-closing event before the reconnect cancels the timer. Files Needing Attention: flashdreams/flashdreams/runtime_v2/serving/webrtc_server.py Important Files Changed
Sequence DiagramsequenceDiagram
participant Browser
participant Offer as WebRTC offer handler
participant Timer as Disconnect timer
participant Session
Browser--xOffer: Existing peer disconnects
Offer->>Timer: Start 5-second grace period
Browser->>Offer: Submit replacement offer
Offer->>Offer: Await SDP negotiation
Timer->>Timer: Grace period expires
Timer->>Session: CloseUserInputEventData
Offer->>Timer: Cancel timer too late
Offer->>Offer: Install replacement peer
Reviews (2): Last reviewed commit: "Address greptile comments" | Re-trigger Greptile |
| @dataclass | ||
| class SessionRunner: |
There was a problem hiding this comment.
Red screen example uses removed API
The red_screen README still tells users to import and call the removed module-level run_session function, so copying the integration example now raises ImportError; update it to construct SessionRunner and call run_session() instead.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
/ok to test ba01d36 |
| self._cancel_disconnect_timer() | ||
| self._peer_connection = peer_connection |
There was a problem hiding this comment.
Reconnect races disconnect timer
When a browser starts reconnecting shortly before the five-second grace period expires, SDP negotiation can cross the deadline before _cancel_disconnect_timer() runs. The timer then observes that no replacement peer has been installed and enqueues CloseUserInputEventData, causing the session to shut down even though the replacement connection succeeds.
No description provided.