Skip to content

fix(llc): safety nets and recovery during reconnect#1237

Merged
Brazol merged 3 commits into
mainfrom
chore/safty-nets-and-recovery-during-reconnect
May 29, 2026
Merged

fix(llc): safety nets and recovery during reconnect#1237
Brazol merged 3 commits into
mainfrom
chore/safty-nets-and-recovery-during-reconnect

Conversation

@Brazol
Copy link
Copy Markdown
Contributor

@Brazol Brazol commented May 28, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Added safety nets and recovery for publisher connection failures after reconnection (including lost SFU responses or prolonged ICE new state).
    • Triggers publisher connection health checks during join/fast-reconnect flows.
    • Improves websocket reconnection with explicit failure detection and handling.
  • Tests

    • New tests covering reconnection safety, publisher-check timer behavior, and peer-connection renegotiation/ICE handling.
  • Documentation

    • Updated changelog with the fix.
  • Chores

    • Added dev test utility dependency for deterministic async testing.

Review Change Stack

@Brazol Brazol requested a review from a team as a code owner May 28, 2026 14:10
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

Warning

Review limit reached

@Brazol, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 9 minutes and 23 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f377e0e7-c75f-4a56-98ef-5a4c90bf6525

📥 Commits

Reviewing files that changed from the base of the PR and between f35ff28 and 8f3ba1f.

📒 Files selected for processing (1)
  • packages/stream_video/test/src/call/session/call_session_reconnect_safety_test.dart
📝 Walkthrough

Walkthrough

Adds a one-shot publisher ICE health check after fast-reconnect, explicit SFU websocket recreate failure handling, suppression of renegotiation events during active reconnect, a changelog entry, dev test dependency, and tests covering reconnection safety and peer connection behaviors.

Changes

Publisher Connection Safety & Reconnection Recovery

Layer / File(s) Summary
Publisher Connection Check Infrastructure
packages/stream_video/lib/src/call/session/call_session.dart
Adds _publisherConnectionCheckDelay (15s), _publisherConnectionCheckTimer, and startPublisherConnectionCheck() which schedules a one-shot timer to inspect rtcManager?.publisher ICE state; triggers onReconnectionNeeded(..., rejoin) if ICE remains new. Cancels timer in close().
SFU Websocket Reconnection Safety
packages/stream_video/lib/src/call/session/call_session.dart
fastReconnect() now checks sfuWS.recreate() result and returns VideoError('SFU WS reconnect failed') on failure. _onRenegotiationNeeded() now returns early with a warning when !sfuWS.isConnected.
Renegotiation Event Suppression During Reconnect
packages/stream_video/lib/src/webrtc/peer_connection.dart
Renegotiation-needed handler now checks _isReconnecting and suppresses the event (logs and returns) while reconnect is active.
Call Join Integration & Documentation
packages/stream_video/lib/src/call/call.dart, packages/stream_video/CHANGELOG.md
Calls _session?.startPublisherConnectionCheck() at the end of the fast-reconnect path in _join. Adds changelog bullet describing enhanced recovery for publisher connection failures post-reconnect.
Tests & Dev Dependency
packages/stream_video/pubspec.yaml, packages/stream_video/test/src/call/session/call_session_reconnect_safety_test.dart, packages/stream_video/test/src/webrtc/peer_connection_renegotiation_test.dart
Adds fake_async dev dependency and comprehensive tests: CallSession publisher-check timer behaviors, getReconnectDetails/leave/close behaviors, StreamPeerConnection renegotiation suppression and ICE-restart/forwarding behaviors, plus mocks and test helpers.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I time the hops where ICE might stall,

A little timer listens for the call.
If publisher lingers in a newborn state,
We nudge a rejoin before it's too late.
Hops, fixes, tests — a safe reconnect ballet.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request has no description provided by the author, missing all required sections from the template including Goal, Implementation details, Testing, and Contributor Checklist. Add a comprehensive description covering the Goal (why this fix is needed), Implementation details (how the safety nets work), Testing explanation, and complete the Contributor Checklist.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix(llc): safety nets and recovery during reconnect' clearly describes the main change - adding safety mechanisms and recovery logic during reconnection scenarios.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/safty-nets-and-recovery-during-reconnect

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

Actionable comments posted: 0

@codecov
Copy link
Copy Markdown

codecov Bot commented May 28, 2026

Codecov Report

❌ Patch coverage is 63.33333% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 8.88%. Comparing base (2760e70) to head (8f3ba1f).

Files with missing lines Patch % Lines
...tream_video/lib/src/call/session/call_session.dart 62.50% 9 Missing ⚠️
...s/stream_video/lib/src/webrtc/peer_connection.dart 60.00% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##            main   #1237      +/-   ##
========================================
+ Coverage   8.34%   8.88%   +0.54%     
========================================
  Files        676     676              
  Lines      49546   49577      +31     
========================================
+ Hits        4135    4407     +272     
+ Misses     45411   45170     -241     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

Actionable comments posted: 0

@Brazol Brazol merged commit ae162f8 into main May 29, 2026
10 of 14 checks passed
@Brazol Brazol deleted the chore/safty-nets-and-recovery-during-reconnect branch May 29, 2026 06:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants