Skip to content

fix: sync is suspended when call ends in foreground - WPB-25064 🍒#4638

Merged
johnxnguyen merged 2 commits into
developfrom
fix/sync-wpb-25064-cherry-pick
May 4, 2026
Merged

fix: sync is suspended when call ends in foreground - WPB-25064 🍒#4638
johnxnguyen merged 2 commits into
developfrom
fix/sync-wpb-25064-cherry-pick

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

This PR was automatically cherry-picked based on the following PR:

Original PR description:


BugWPB-25064 [iOS] [Sync] Push channel is closed when ending a call and does not restart

Issue

When participating in a call while in the foreground and then leaving that call, the app no longer receives and processes update events. When the app is brought to the background and then foreground, the problem is resolved.

This bug is a combination of a few issues that only first surfaced with #4477 which introduced new task cancellation checks in the sync.

The cause of the bug begins with code introduced in December last year (#4000) which solved a problem of the web socket closing during an ongoing call when bring the call to the background, by not suspending the sync during an ongoing call but only when all calls had finished. However, it suspended the sync at the end of calls regardless of whether the app was in the foreground or background. The sequence of events is thus:

  • Call is ongoing in the foreground
  • Call ends in the foreground
  • CallKit informs its delegate that the call ends, this triggers a new sync to start (not clear why, this is another issue)
  • The sync restarts
  • The call is successfully ended, all syncs are not suspended (erroneously in the foreground)
  • Now that there is additional task cancellation checks, this suspension actually cancels the newly started sync
  • The code responsible for restarting syncs while in the foreground doesn't run because the cancelled sync never reached completion
  • The app is now idle

This PR proposes a very small and simple fix which is intended to resolve the immediate problem of suspending the sync at the end of the call while in the foreground. The change is to only perform this suspension when the app is in the background, so that the websocket is closed correctly in the BG and not incorrectly while in the FG.

A more robust and general solution is needed to improve sync management and stability which will be addressed separately.

Testing

  1. Open the app and be synced
  2. Start a call and connect
  3. While in the foreground, leave the call and stay in the foreground
  4. Assert you still receive messages and other update events
  5. Start a new call, assert it works fine.
  6. Move call to background, then end the call
  7. Receive messages, assert you see notifications for these messages without delay.

Checklist

  • Title contains a reference JIRA issue number like [WPB-XXX].
  • Description is filled and free of optional paragraphs.
  • Adds/updates automated tests.

UI accessibility checklist

If your PR includes UI changes, please utilize this checklist:

  • Make sure you use the API for UI elements that support large fonts.
  • All colors are taken from WireDesign.ColorTheme or constructed using WireDesign.BaseColorPalette.
  • New UI elements have Accessibility strings for VoiceOver.

@johnxnguyen johnxnguyen marked this pull request as draft April 27, 2026 09:30
@johnxnguyen johnxnguyen marked this pull request as ready for review April 27, 2026 09:30
@johnxnguyen johnxnguyen enabled auto-merge April 27, 2026 09:30
@github-actions

github-actions Bot commented Apr 27, 2026

Copy link
Copy Markdown
Contributor Author

Test Results

    1 files    133 suites   1m 23s ⏱️
1 097 tests 1 096 ✅ 0 💤 1 ❌
1 097 runs  1 097 ✅ 0 💤 0 ❌

For more details on these failures, see this check.

Results for commit c4a52e0.

♻️ This comment has been updated with latest results.

Summary: workflow run #25304664384
Allure report (download zip): html-report-29637-fix_sync-wpb-25064-cherry-pick

@zenkins zenkins left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

✅ Auto-approved cherry-pick PR 🍒.

@sonarqubecloud

sonarqubecloud Bot commented May 4, 2026

Copy link
Copy Markdown

@johnxnguyen johnxnguyen added this pull request to the merge queue May 4, 2026
Merged via the queue into develop with commit 9de61e5 May 4, 2026
13 checks passed
@johnxnguyen johnxnguyen deleted the fix/sync-wpb-25064-cherry-pick branch May 4, 2026 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants