Skip to content

fix(connectivity): stabilize Lockdown heartbeat and DDI readiness - #1

Closed
truebit wants to merge 1 commit into
LiveContainer:developfrom
truebit:fix-lockdown-heartbeat-ddi
Closed

fix(connectivity): stabilize Lockdown heartbeat and DDI readiness#1
truebit wants to merge 1 commit into
LiveContainer:developfrom
truebit:fix-lockdown-heartbeat-ddi

Conversation

@truebit

@truebit truebit commented Jul 31, 2026

Copy link
Copy Markdown

Summary

Stabilize the on-device connectivity lifecycle for Lockdown pairing while preserving the established Remote Pairing/RSD flow. This prevents transient DDI and profile-management failures caused by child-service work racing heartbeat readiness.

Root cause

  • Lockdown DDI and profile operations could begin before the first successful Marco/Polo exchange.
  • The device heartbeat interval was used directly as the receive timeout, leaving no scheduling margin and producing false disconnects.
  • Deferred startup DDI work could be lost when a tunnel endpoint replacement created a new connectivity generation.
  • Heartbeat clients were recreated instead of being owned persistently by the active Lockdown session.
  • Remote Pairing could be incorrectly coupled to Lockdown heartbeat readiness.
  • DDI detection did not consistently recognize legacy and personalized mount records.

Changes

  • Add protocol-aware, generation-scoped connectivity session state.
  • Use one persistent heartbeat client per Lockdown generation.
  • Mark the session Ready only after the first complete Marco/Polo exchange.
  • Gate Lockdown startup DDI work on Heartbeat Ready.
  • Use the device interval plus a five-second heartbeat receive margin.
  • Preserve deferred startup DDI intent across endpoint generation changes.
  • Revoke Lockdown child-service readiness after heartbeat loss and revalidate sessions after endpoint or foreground changes.
  • Keep Remote Pairing on its existing RSD path without a heartbeat gate.
  • Recognize legacy /Developer + DiskImageType=Developer and personalized /System/Developer DDI records.
  • Fail Lockdown DDI and profile writes fast while heartbeat is not ready; writes with indeterminate outcomes are not retried blindly.

Pairing behavior

Pairing mode Heartbeat Startup DDI
Lockdown One persistent session heartbeat; Ready after Marco/Polo Deferred until the current session is Ready
Remote Pairing No Lockdown heartbeat Existing RSD flow without a heartbeat gate

Validation

Manually passed on physical iPhone 13 devices:

  • iOS 16.0.2 using Lockdown
  • iOS 17.5.1 using Remote Pairing/RSD
  • Health Check remained stable during a 60-second observation
  • DDI recognition and application refresh/install completed successfully
  • No Heartbeat(Timeout), UnexpectedEof, ImageMountFailed, or transient dmg=false was observed during the final Lockdown validation

Automated validation: swift test passed 14 tests with 0 failures.

- Keep the persistent heartbeat lifecycle and child-service readiness gate scoped to Lockdown sessions while preserving the established Remote Pairing RSD flow.

- Add the reference client’s five-second receive margin so the device heartbeat cadence is not misclassified as a disconnect.

- Carry deferred startup DDI intent across endpoint generation replacement so mount work resumes on the current ready session.

- Revalidate connectivity generations across endpoint and foreground changes while rejecting stale readiness updates.

- Recognize legacy and personalized DDI mount schemas.
@hugeBlack

Copy link
Copy Markdown
Member

Sorry but we do not accept pull requests in this repo if it's not fixing an issue that only LC+SS build have. If you wish you can create a pr in the upstream SideStore repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants