Skip to content

chore: make screen share not rely on bundles from previous negotiations - #41369

Merged
dionisio-bot[bot] merged 2 commits into
developfrom
fix/ice-untrickler-on-new-track
Jul 18, 2026
Merged

chore: make screen share not rely on bundles from previous negotiations#41369
dionisio-bot[bot] merged 2 commits into
developfrom
fix/ice-untrickler-on-new-track

Conversation

@pierre-lehnen-rc

@pierre-lehnen-rc pierre-lehnen-rc commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Proposed changes (including videos or screenshots)

When the rocket.chat client starts a WebRTC negotiation, it waits for the ICE Gathering process to complete before sending the offer to the remote peer.
When screen share is initiated, this waiting process gets skipped because the previous ICE Gathering has already completed but the new one has not yet started.
This PR changes the skip condition to ensure it waits for at least one macrotask whenever it gets called to ensure the current ice gathering state isn't just outdated.

Screen share works today because the ICE gathering isn't really needed on renegotiations within the same bundle - but we are not controlling the bundle explicitly so that could easily break at any time.

Issue(s)

Derived from DMV-44

Steps to test or reproduce

Further comments

Review in cubic

Summary by CodeRabbit

  • Bug Fixes
    • Improved WebRTC connection handling by refining detection of ICE gathering completion.
    • The call now stops immediately when a stop request is active.
    • When ICE reports “complete,” the system performs a brief re-check to avoid acting on short-lived or transient state.
    • Helps reduce occasional media call instability related to changing ICE status.

@dionisio-bot

dionisio-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

@changeset-bot

changeset-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: fe8125d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: dd9022c5-ddbc-4095-8938-6cc6f2f1ff46

📥 Commits

Reviewing files that changed from the base of the PR and between fe8125d and 6ba2f5b.

📒 Files selected for processing (1)
  • packages/media-signaling/src/lib/services/webrtc/Processor.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/media-signaling/src/lib/services/webrtc/Processor.ts
📜 Recent review details
⏰ Context from checks skipped due to timeout. (4)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build
  • GitHub Check: Hacktron Security Check

Walkthrough

waitForIceGathering now delays briefly before confirming that ICE gathering remains complete, while retaining immediate exit behavior when the processor is stopped.

Changes

WebRTC ICE gathering

Layer / File(s) Summary
Delayed ICE completion check
packages/media-signaling/src/lib/services/webrtc/Processor.ts
waitForIceGathering returns immediately when stopped and rechecks iceGatheringState after a short macrotask delay when gathering is complete.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested labels: type: bug

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main change: screen sharing negotiation no longer depends on prior bundle/ICE state reuse.
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.

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • DMV-44: Request failed with status code 401

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.

@pierre-lehnen-rc pierre-lehnen-rc added this to the 8.7.0 milestone Jul 14, 2026
@pierre-lehnen-rc pierre-lehnen-rc added the stat: QA assured Means it has been tested and approved by a company insider label Jul 14, 2026
@dionisio-bot dionisio-bot Bot added the stat: ready to merge PR tested and approved waiting for merge label Jul 14, 2026
@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.19%. Comparing base (460858e) to head (6ba2f5b).
⚠️ Report is 38 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #41369      +/-   ##
===========================================
- Coverage    69.12%   68.19%   -0.93%     
===========================================
  Files         3762     3968     +206     
  Lines       147936   154740    +6804     
  Branches     26428    27841    +1413     
===========================================
+ Hits        102261   105528    +3267     
- Misses       41185    44425    +3240     
- Partials      4490     4787     +297     
Flag Coverage Δ
e2e 59.23% <ø> (+0.02%) ⬆️
e2e-api 44.03% <ø> (-5.38%) ⬇️
unit 70.62% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pierre-lehnen-rc
pierre-lehnen-rc marked this pull request as ready for review July 14, 2026 16:30

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/media-signaling/src/lib/services/webrtc/Processor.ts`:
- Around line 279-288: Update the ICE gathering check in the relevant Processor
method by removing the inline comment and re-checking this.stopped immediately
after the macrotask await, returning when stopped before evaluating the
subsequent iceGatheringState condition. Preserve the existing behavior for
active peers and completed gathering.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: dd86e7ed-1e1d-4911-86b3-991bbb7a293a

📥 Commits

Reviewing files that changed from the base of the PR and between b634242 and 8c75e99.

📒 Files selected for processing (1)
  • packages/media-signaling/src/lib/services/webrtc/Processor.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (12)
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: Hacktron Security Check
  • GitHub Check: 🔨 Test UI (EE) / MongoDB 8.0 coverage (5/5)
  • GitHub Check: 🔨 Test UI (EE) / MongoDB 8.0 coverage (3/5)
  • GitHub Check: 🔨 Test UI (EE) / MongoDB 8.0 coverage (2/5)
  • GitHub Check: 🔨 Test UI (EE) / MongoDB 8.0 coverage (4/5)
  • GitHub Check: 🔨 Test UI (EE) / MongoDB 8.0 coverage (1/5)
  • GitHub Check: 🔨 Test UI (CE) / MongoDB 8.0 (3/4)
  • GitHub Check: 🔨 Test UI (CE) / MongoDB 8.0 (1/4)
  • GitHub Check: 🔨 Test UI (CE) / MongoDB 8.0 (4/4)
  • GitHub Check: 🔨 Test UI (CE) / MongoDB 8.0 (2/4)
  • GitHub Check: 🔨 Test API Livechat (EE) / MongoDB 8.0 coverage (1/1)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation

Files:

  • packages/media-signaling/src/lib/services/webrtc/Processor.ts
🧠 Learnings (3)
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.

Applied to files:

  • packages/media-signaling/src/lib/services/webrtc/Processor.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.

Applied to files:

  • packages/media-signaling/src/lib/services/webrtc/Processor.ts
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.

Applied to files:

  • packages/media-signaling/src/lib/services/webrtc/Processor.ts

Comment thread packages/media-signaling/src/lib/services/webrtc/Processor.ts

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 1 file

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread packages/media-signaling/src/lib/services/webrtc/Processor.ts
@pierre-lehnen-rc
pierre-lehnen-rc force-pushed the fix/ice-untrickler-on-new-track branch from fe8125d to 6ba2f5b Compare July 14, 2026 17:15
@gabriellsh gabriellsh removed the stat: QA assured Means it has been tested and approved by a company insider label Jul 17, 2026
@dionisio-bot dionisio-bot Bot removed the stat: ready to merge PR tested and approved waiting for merge label Jul 17, 2026
@gabriellsh gabriellsh added the stat: QA assured Means it has been tested and approved by a company insider label Jul 17, 2026
@dionisio-bot dionisio-bot Bot added the stat: ready to merge PR tested and approved waiting for merge label Jul 17, 2026
@dionisio-bot
dionisio-bot Bot added this pull request to the merge queue Jul 17, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 17, 2026
@dionisio-bot
dionisio-bot Bot added this pull request to the merge queue Jul 17, 2026
Merged via the queue into develop with commit c103cf5 Jul 18, 2026
82 of 85 checks passed
@dionisio-bot
dionisio-bot Bot deleted the fix/ice-untrickler-on-new-track branch July 18, 2026 05:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge type: bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants