Skip to content

Conversation

xinhyao
Copy link
Contributor

@xinhyao xinhyao commented Aug 12, 2025

COMPLETES

https://jira-eng-gpk2.cisco.com/jira/browse/SPARK-666148

This pull request addresses

When the host clicks to end breakout sessions and the countdown ends, the session cannot be successfully switched from BO to meeting. As a result, the Web client sometimes still tries to send messages to BO Locus instead of main session Locus.
image
When the host clicks to end BO and after the countdown ends, SDK will receive the LOCUSEVENT.LOCUS_MERCURY event. By parsing, the event belongs to LOCUS_URL_CHANGED case. According to the existing logic, it will call doLocusSync to do the sync with a new locus, but for this bug case, the entry value of the sequence in the new fetched locus is the same as the entry value of the sequence in the workingCopy. This will cause the lociComparison to be USE_CURRENT, for the USE_CURRENT case, SDK will do nothing, so the switch from BO to main session is not completed when the BO ends countdown.
Pasted Graphic 21

image

by making the following changes

This issue has a relatively high probability of reoccurring (I tested it 10 times and reoccurred 7 times). For those successful cases, I found that when the countdown ends, the SDK will additionally receive the LOCUSEVENT.LOCUS_MERCURY event, by parsing, the event belongs to USE_INCOMING case. According to the existing logic, it will call meeting.locusInfo.onDeltaLocus directly, so locus info can be updated to complete the switch from BO to main session, but this case is not very stable and does not depend on doLocusSync(), so my current modification is that when the received action is LOCUS_URL_CHANGED, call meeting.locusInfo.onDeltaLocus instead of doLocusSync directly. In this way, locus info can be updated to complete the switch from BO to main session.
Pasted Graphic 24
Failure log:
LOCUS_URL_CHANGED_ACTION===
Success log:
image
According to the log printed on the console, we can see that for successful cases, it is because the SDK received additional events, which triggered the meeting.locusInfo.onDeltaLocus, but this is unstable.

This PR is changed on this PR(#3239).

Change Type

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Tooling change
  • Internal code refactor

The following scenarios were tested

Added unit tests and manually tested.
I tested:

  1. Host starts a meeting and 2 others web clients join this meeting, test audio, video, share, chat, content, they work fine.
  2. Host enables breakouts sessions and joins BO session 1, client A joins BO session 1, client B joins BO session 2.
  3. Test audio, video, share, chat, they work fine.
  4. Host ends BO sessions and all clients join the main session at the same time.
  5. Test audio, video, share, chat, content, they work fine.

The GAI Coding Policy And Copyright Annotation Best Practices

  • GAI was not used (or, no additional notation is required)
  • Code was generated entirely by GAI
  • GAI was used to create a draft that was subsequently customized or modified
  • Coder created a draft manually that was non-substantively modified by GAI (e.g., refactoring was performed by GAI on manually written code)
  • Tool used for AI assistance (GitHub Copilot / Other - specify)
    • Github Copilot
    • Other - Please Specify
  • This PR is related to
    • Feature
    • Defect fix
    • Tech Debt
    • Automation

I certified that

  • I have read and followed contributing guidelines
  • I discussed changes with code owners prior to submitting this pull request
  • I have not skipped any automated checks
  • All existing and new tests passed
  • I have updated the documentation accordingly

Make sure to have followed the contributing guidelines before submitting.

Copy link
Contributor

coderabbitai bot commented Aug 12, 2025

📝 Walkthrough

Walkthrough

The LOCUS_URL_CHANGED action is rerouted from the DESYNC branch to the USE_INCOMING branch in applyLocusDeltaData, invoking onDeltaLocus(locus) instead of doLocusSync(meeting). Unit tests are updated to reflect this by calling meeting.locusInfo.onDeltaLocus(fakeLocus) directly, removing prior DTO fetches via meetingRequest.getLocusDTO and syncUrl logic. No exported/public signature changes are introduced.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ast-grep (0.38.6)
packages/@webex/plugin-meetings/test/unit/spec/locus-info/index.js
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-4432.d3m3l2kee0btzx.amplifyapp.com

@xinhyao xinhyao marked this pull request as ready for review August 13, 2025 06:39
@xinhyao xinhyao requested review from a team as code owners August 13, 2025 06:39
@xinhyao xinhyao changed the title fix: fails to end breakout sessions fix: failed to end breakout sessions Aug 13, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
packages/@webex/plugin-meetings/src/locus-info/index.ts (1)

223-225: Add lightweight logging for LOCUS_URL_CHANGED path

A one-line log here will greatly help field troubleshooting when session switches fail or look slow, without adding complexity.

       case USE_INCOMING:
-      case LOCUS_URL_CHANGED:
-        meeting.locusInfo.onDeltaLocus(locus);
+      case LOCUS_URL_CHANGED:
+        LoggerProxy.logger.info(
+          'Locus-info:index#applyLocusDeltaData --> LOCUS_URL_CHANGED: applying incoming delta via onDeltaLocus'
+        );
+        meeting.locusInfo.onDeltaLocus(locus);
         break;
packages/@webex/plugin-meetings/test/unit/spec/locus-info/index.js (1)

2352-2359: Strengthen the test by asserting the locusUrl actually updates

To ensure the regression is fully covered (messages switch to main locus), add an assertion that meeting.locusUrl is updated through the onDeltaLocus path.

Example test block you can add near this test:

it('applyLocusDeltaData(LOCUS_URL_CHANGED) updates meeting.locusUrl via onDeltaLocus path', () => {
  // reuse existing locusInfo/mocks from the suite
  const fakeLocusUrl = 'https://example.com/locus/main';
  const fakeLocus = {url: fakeLocusUrl};

  // Use the real locusInfo instance so updateLocusInfo -> updateLocusUrl -> updateMeeting runs
  const meeting = {locusInfo};

  // Sanity: meeting.locusUrl is not yet set
  assert.isUndefined(mockMeeting.locusUrl);

  locusInfo.applyLocusDeltaData(LocusDeltaParser.loci.LOCUS_URL_CHANGED, fakeLocus, meeting);

  // Assert that the meeting received the new locusUrl
  assert.equal(mockMeeting.locusUrl, fakeLocusUrl);
});
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d798015 and 68ed53c.

📒 Files selected for processing (2)
  • packages/@webex/plugin-meetings/src/locus-info/index.ts (1 hunks)
  • packages/@webex/plugin-meetings/test/unit/spec/locus-info/index.js (1 hunks)
🔇 Additional comments (2)
packages/@webex/plugin-meetings/src/locus-info/index.ts (1)

223-225: Rerouting LOCUS_URL_CHANGED to onDeltaLocus is the right fix

Handling LOCUS_URL_CHANGED under USE_INCOMING ensures updateLocusUrl runs immediately (via onDeltaLocus -> updateLocusInfo -> updateLocusUrl), which addresses the BO-to-main switch timing issue without depending on a potentially stale syncUrl. This aligns with the PR objective and avoids unnecessary syncs.

packages/@webex/plugin-meetings/test/unit/spec/locus-info/index.js (1)

2352-2359: Unit test correctly reflects new control flow

Good update to assert that LOCUS_URL_CHANGED now invokes onDeltaLocus directly instead of performing a sync. This mirrors the updated switch logic.

@xinhyao xinhyao changed the title fix: failed to end breakout sessions fix(breakouts): failed to end breakout sessions Aug 13, 2025
@mickelr mickelr added the validated If the pull request is validated for automation. label Aug 14, 2025
@@ -220,14 +220,14 @@ export default class LocusInfo extends EventsScope {

switch (action) {
case USE_INCOMING:
case LOCUS_URL_CHANGED:
Copy link
Collaborator

@marcin-bazyl marcin-bazyl Sep 4, 2025

Choose a reason for hiding this comment

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

I'm not convinced that this is the right approach. I think it would be better to keep doing the full sync when Locus URL changes. I think the problem is that in this line for the LOCUS_URL_CHANGED case we put the incoming locus that had url changed into the working copy, so then when we do a sync there is a big chance that the full locus in response will be on the same version as our working copy, so I think we need modify that line to either clear the working copy completely (because we want to do a full sync anyway) or at least just reset the sequence in workingCopy so that it's empty and then any sequence value from locus sync response will be always "newer" and will result in USE_INCOMING

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
validated If the pull request is validated for automation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants