Repository navigation
fix(events): jitter a Retry-After wait up, and pin a log's on-disk bytes - #426
abelonogov-ld wants to merge 7 commits into
Conversation
A Retry-After wait was jittered down by up to half, so an instance could post before the service asked. Jitter it up by up to half instead, stopping at the hour a server-directed wait is capped at. A wait asked for of an hour or more has no room above the cap, so it is still jittered down from the hour. Matches the iOS change. Co-authored-by: Cursor <cursoragent@cursor.com>
The format tests were structural round trips, so a drift in the header or the framing still passed. Assert the page-cache spec's Appendix A log as a hex literal: the header, what the store writes for its two events, what the reader makes of it, and that a next run delivers it. The iOS suite asserts the same bytes. Co-authored-by: Cursor <cursoragent@cursor.com>
…ey/retry-after-jitter-and-log-vector
…ey/retry-after-jitter-and-log-vector
There was a problem hiding this comment.
Risk: low.
Automated risk review (dry run): Low
This PR would be automatically approved.
Why: A small Retry-After jitter fix in DeliveryRetryState plus tests that pin event-log bytes; Bugbot passed with no findings, and this is not infra, schema, auth, or approval-policy.
If you disagree with this review, share this PR in #feedback-agent-approvals or submit a changes-requested review explaining why.
Sent by Cursor Approval Agent: Dry-Run PR Approver
…ey/retry-after-jitter-and-log-vector
There was a problem hiding this comment.
Stale comment
Risk: low. Rule 2 (approve only PRs opened by an SDK team member) decides this: the author is not on that list, so this is not approved. Cursor Bugbot completed with no findings; human review is needed and no reviewers were assigned.
Sent by Cursor Approval Agent: SDK - Pull Request Router and Approver
There was a problem hiding this comment.
Stale comment
Risk: low. Rule 2 (approve only PRs opened by an SDK team member) decides this: the author is not on that list, so this is not approved. Cursor Bugbot completed with no findings; human review is needed and no reviewers were assigned.
Sent by Cursor Approval Agent: SDK - Pull Request Router and Approver
…ey/retry-after-jitter-and-log-vector
There was a problem hiding this comment.
Stale comment
Risk: low. Rule 2 (approve only PRs opened by an SDK team member) decides this: the author is not on that list, so this is not approved. Cursor Bugbot completed with no findings; human review is needed and no reviewers were assigned.
Sent by Cursor Approval Agent: SDK - Pull Request Router and Approver
There was a problem hiding this comment.
Stale comment
Risk: low. Rule 2 (approve only PRs opened by an SDK team member) decides this: the author is not on that list, so this is not approved. Cursor Bugbot completed with no findings; human review is needed and no reviewers were assigned.
Sent by Cursor Approval Agent: SDK - Pull Request Router and Approver
…ey/retry-after-jitter-and-log-vector
There was a problem hiding this comment.
Risk: low. Rule 2 (approve only PRs opened by an SDK team member) decides this: the author is not on that list, so this is not approved. Cursor Bugbot completed with no findings; human review is needed and no reviewers were assigned.
Sent by Cursor Approval Agent: SDK - Pull Request Router and Approver


Two changes, stacked on #425 (the RETRY 1.5.6 extended initial delay), which is stacked on #408 (tier 3).
A
Retry-Afterwait is jittered up, never below what the service asked. It was jittered down by up to half, so an instance could post before the time the response asked for.DeliveryRetryState.directedWaitMillisnow waits between the asked duration and 1.5 times it, stopping at the one-hour cap on a server-directed wait (RETRY 1.11.4).recordFailureDuringWait), where aRetry-Aftercan still only lengthen the wait.Retry-Afterstays unjittered, as RETRY 1.4.3 allows.aRetryAfterSetsTheWaitBeforeTheNextPostasks for 3 s instead of 4, so the retry still lands well inside its timeout.The on-disk bytes of a log are pinned to the spec's worked example. The format tests were structural round trips, so a drift in the header or the framing still passed. The page-cache persistence spec's Appendix A log (two events, 108 bytes, checksums verified independently with zlib) is now a hex literal,
EventLogFormatTest.WORKED_EXAMPLE, asserted for:EventLogFormatand the store write for its two events;The iOS suite asserts the same bytes. Setting the format version to 2 fails all four new tests; the existing
EventStoreTesttests all still pass with it.Tested:
:launchdarkly-android-client-sdk:testDebugUnitTest, 1264 tests, 0 failures.Note
Overview
Retry-Afterwaits are jittered upward instead of down, so delivery never retries sooner than the server asked. The logic moves intodirectedWaitMillis: for values under the one-hour cap, wait is between the header value and up to 1.5× it; for an hour or more, jitter still spreads clients by ranging from 30–60 minutes at the cap.recordFailureDuringWaituses the same helper so a header can only lengthen an in-flight wait.Event log format tests now assert the page-cache persistence spec’s Appendix A byte sequence end-to-end—header, framed writes, read/assemble, and
EventStorepersistence/recovery—matching what the iOS SDK expects so framing drift fails in CI rather than in cross-platform logs.Reviewed by Cursor Bugbot for commit 5663def. Bugbot is set up for automated code reviews on this repo. Configure here.