fix(llc): call accept race fix#1258
Conversation
|
Warning Review limit reached
More reviews will be available in 9 minutes and 4 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough
Optimistic call acceptance
Sequence Diagram(s)sequenceDiagram
participant UI as UI
participant Call as Call.accept()
participant State as lifecycleCallAccepted
participant Coord as CoordinatorClient
participant WS as Coordinator event handling
UI->>Call: accept()
Call->>State: lifecycleCallAccepted()
Call->>Coord: acceptCall(cid)
Note over WS: call.accepted event may arrive while HTTP is in flight
WS->>State: read acceptedByMe=true
alt coordinator success
Coord-->>Call: Success
else coordinator failure
Coord-->>Call: Failure
Call->>State: lifecycleCallAccepted(accepted: false)
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/stream_video/lib/src/call/call.dart`:
- Around line 906-909: The unconditional rollback on any Failure at line 906 is
too broad and can cause false rejection states. When a transport-level failure
occurs after the server has accepted the call, reverting acceptedByMe to false
via _stateManager.lifecycleCallAccepted(accepted: false) at line 908 can cause
_handleCoordinatorCallAccepted to incorrectly trigger the "accepted on another
device" logic again. Instead of reverting on all Failure results, classify the
error to distinguish between definitive rejections from the server versus
transport-level failures, and only perform the rollback for specific error types
that represent clear non-acceptance outcomes. This ensures that optimistic
acceptance is only reverted when we have definitive evidence the server did not
accept the call.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 2769b017-d45a-48f6-a079-4198e58ef51b
📒 Files selected for processing (2)
packages/stream_video/lib/src/call/call.dartpackages/stream_video/lib/src/call/state/mixins/state_lifecycle_mixin.dart
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1258 +/- ##
=====================================
Coverage 9.71% 9.71%
=====================================
Files 676 676
Lines 49695 49696 +1
=====================================
+ Hits 4826 4828 +2
+ Misses 44869 44868 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| } | ||
| state = state.copyWith( | ||
| status: CallStatus.incoming(acceptedByMe: true), | ||
| status: CallStatus.incoming(acceptedByMe: accepted), |
There was a problem hiding this comment.
| status: CallStatus.incoming(acceptedByMe: accepted), | |
| status: CallStatus.incoming(acceptedByMe: true), |
There was a problem hiding this comment.
I think its always going to be true
Fixes #1254
Summary by CodeRabbit