Repository navigation
Conversation
A retryable failure used to wait for the next app launch, so a running activity could miss every update until then. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
One Line Summary
The Live Activities executor retries a failed token upload in the same run, instead of waiting for the next app launch.
Details
Motivation
After a retryable failure, the Live Activities executor kept the request in its cache and sent it again only on the next app launch. Until then the server did not have the activity's update token, so the activity could miss every update for the rest of the run. A same-token
entercall did not help, because the executor dropped it as a duplicate of the unsent cached request. A push subscription change also re-sent only start tokens, so update tokens kept the old subscription ID. Reported in #1769.#1775 fixed the same problem for the other executors. This change uses the same
OSRequestRetryBackoffandOSOperationRetryTrigger.Scope
OSRequestRetryBackoff(5 s doubling to 300 s, with jitter, andRetry-Afteras the minimum). Then the executor sends the request again. Non-retryable failures still remove the request, as before.OSOperationRetryTriggerends the wait early on foreground, and when the network returns while the app is in the foreground.Retry-Afteris still obeyed.OneSignalTrackerforwards focus and unfocus to the Live Activities module throughNSClassFromString, so apps without the module are not affected.enter) now sends that cached request, unless it is in flight or waiting out a backoff.OneSignalClientstill resends status 0 and 5xx on its own 5/15/45/135 s schedule before the executor sees the failure. The privacy consent check inexecuteRequestis unchanged.Testing
Unit testing
New tests in
OSLiveActivitiesExecutorTests:Retry-After.enterafter a relaunch sends the unsent cached request, and does not resend a request that is in flight.The full
UnitTestApp_TestPlan_Reducedplan passes locally (826 tests). Each new behavior was removed one at a time, and the matching test failed each time. Removing the in-flight check also fails 3 existing dedup tests.Manual testing
Not done yet. The unit tests mock the network. A device run of the #1769 repro is still needed: call
enterwith no network, restore the network, and check that the update token uploads without a relaunch.Affected code checklist
Checklist
Overview
Testing
Final pass