mirror of
https://github.com/permissionlesstech/bitchat-android.git
synced 2026-08-08 06:46:11 +00:00
Codex is right about this one. Cancellation in Kotlin is cooperative, and everything from validateDownloadedApk() through saveMetadata() is plain blocking code with no suspension point. Stopping during the signature check was therefore not observed until after the temp file had been renamed and its metadata written, so the worker committed the APK while WorkManager reported the work cancelled. That also raced onCancelDownload(): its checkStatus() could read the cache before the commit and settle on NotDownloaded, after which the cancelled work maps to Idle and the observer ignores it. The row then advertised "Not ready" with a verified universal APK already in the cache, and tapping it downloaded the same bytes again. One checkpoint after validation, which is the slow step and so the most likely moment to press Stop. The verified temp file is left in place, so the next attempt resumes rather than starting over. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>