fix: reset OTA retry gate on cold restart#12564
Open
huhuanming wants to merge 2 commits into
Open
Conversation
huhuanming
force-pushed
the
codex/fix-ios-ota-recovery-v2
branch
from
July 21, 2026 05:21
52d0421 to
afcf07e
Compare
huhuanming
force-pushed
the
codex/fix-ios-ota-recovery-v2
branch
from
July 21, 2026 13:06
afcf07e to
0ba3bc5
Compare
huhuanming
marked this pull request as ready for review
July 21, 2026 13:38
huhuanming
enabled auto-merge (squash)
July 21, 2026 13:41
originalix
reviewed
Jul 21, 2026
| return appStorage.syncStorage.getObject<IDownloadAttemptBudgetRecord>( | ||
| this.downloadAttemptBudgetStorageKey, | ||
| ); | ||
| return this.downloadAttemptBudget; |
Collaborator
There was a problem hiding this comment.
当同一 OTA 目标持续下载失败并触发冷启动或 bg JS runtime 重建时,这里只从 ServiceAppUpdate 实例字段读取预算,原先 MMKV 中跨重启累计的次数会被完全忽略。ServiceAppUpdate 属于 bg runtime,因此重建会丢失这份 JS heap 状态,而原生 .resume/.partial 下载资源仍会保留;结果是同一永久失败目标每次重启都重新获得完整尝试预算,跨重启的 DownloadGaveUpError 终止保证失效,并可能反复消耗流量和启动时间。
请继续通过 syncStorage 持久化预算,并将记录绑定到稳定的 installed native runtime identity;仅在该 identity 确认变化时重置旧预算,这样既能恢复 iOS OTA,又能保留同一失败目标的跨重启收敛。
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.
Summary
ServiceAppUpdatebackground-service instance.Scope
The fix is intentionally limited to one production TypeScript file and one existing test file.
patch-packagechanges.Preserved safeguards
Validation
Runtime ownership
The counter lives only in the bg JS
ServiceAppUpdateinstance. Main calls it throughbackgroundApiProxy; native download resources remain unchanged. A new bg service instance has no counter, and “Clear update cache” explicitly clears the current instance’s counter.