Native app OTA updates: why new users run old code, and how to fix it
Research and prototype, 1 Dec 2026. Sources: PostHog production data, the Capgo bundle list, the production bundle file, the app code on main, the Capgo plugin source (8.43.10), a local prototype server, an Android emulator and an iPhone simulator. Nothing was deployed and no production system was changed. This page is for team discussion. No decision is made here.
Short on time? Scroll to the six pictures at the bottom of this page. They show the first launch today and with delta on a phone, the download times, what a new install downloads, the stale-device problem, and the production data.
Human-friendly overview
The iPhone and Android apps get new code in two ways: a store release (slow, needs Apple and Google review) or an over-the-air (OTA) update through Capgo (fast, we publish one on every production deploy). A new user always starts on the code inside the store build. On the first launch we try to download the newest OTA bundle within 5 seconds. If it takes longer, the user continues on the old code.
Today most iPhone users do not get the new bundle in time. They sign up on old code and miss new screens. SOR-11635 is one example: the new "finish on a computer" signup screen did not show for 3 of 5 app signups.
There is a second problem. A downloaded bundle is not applied when the app is opened again. So some users stay on old code for a day or more, even after several opens.
The prototype shows that both problems can be fixed with the Capgo plugin we already use. Two changes do most of the work: delta updates (download only the files that changed) and applying a waiting update at app open. On the iPhone simulator, at the median iPhone network speed, the first download went from 9.8 seconds (timed out, old code) to 2.7 seconds (new code before any content). We also found 4 blockers that must be fixed first.
Key numbers
| What | Today | With delta + apply at open |
|---|---|---|
| First-launch download size | 15.5 MB zip | 2.0 MB (only changed files, compressed) |
| iPhone first launch, median network (simulator) | 9.8 s, timed out | 2.7 s, new code before content |
| iPhone first launch, 90% network (simulator) | 18.3 s, timed out | 4.0 s, new code before content |
| Device with a downloaded update, app opened again | Stays on old code | Switches before content, about 0.2 s extra |
| iPhone first launches that time out (PostHog) | 76% | not measured in production yet |
1. The case that started this (SOR-11635)
- PRD-142 added a new signup screen on 30 Nov 2026. The current store build is 1.2.16, so its built-in code does not have the screen.
- 30 Nov to 1 Dec: 5 app signups on a phone. 3 users were on the built-in 1.2.16 code and did not see the screen. 2 users were on the OTA bundle and saw it.
- One iPhone user opened the app 3 more times over about 20 hours. All 3 opens were still on the built-in code.
2. How it works today
First launch of a fresh install (useOtaUpdate.ts):
- The app shows the splash and starts a 5 second timer.
- It asks Capgo for the newest bundle and downloads the full zip, with a progress bar.
- If the download finishes within 5 seconds, the app switches to the new bundle before the user sees anything.
- If not, the splash closes at 5 seconds and the user continues on the built-in code. The bundle is queued as "next".
- The gate runs only once per device.
Every later launch:
- The app opens at once. Capgo's native auto update checks and downloads in the background.
- On every boot, the app sets a Capgo "background" delay of 5 minutes (otaUpdateDelay.ts, SOR-10193). This stops Capgo from reloading the app when the user switches apps for a few seconds.
When does a queued bundle actually apply? (Capgo plugin source, confirmed on the emulator and the simulator)
- A cold launch loads the current bundle only. It never switches to the queued "next" bundle.
- The switch happens only when the app goes to the background, and only if no delay condition is left.
- The 5 minute delay is removed only when the app comes back after more than 5 minutes away, and the app sets it again on every boot.
- So the user needs this order in one app session: background for more than 5 minutes, come back, background again. If iOS closes the app in the background (common), the next open sets the delay again and the user stays on old code.
History. SOR-9369 added the splash gate because new users saw old code and errors from removed APIs. SOR-9418 fixed a launch that could wait forever. SOR-10193 added the 5 minute delay after the app reloaded on every app switch. SOR-10392 split download and apply after a late download reloaded the app in the middle of signup. SOR-10954 stopped returning users from waiting. SOR-10971 added the PostHog events used here. The earlier "loading not smooth" problems were about the wait and the reload, not the download speed.
3. What the production data says
First-launch download time (PostHog ota_check_finished, gate launch; Android since 6 Oct, iPhone since 25 Nov):
| Platform | Downloads | Median | 90% | Done in 5 s | 10 s | 15 s |
|---|---|---|---|---|---|---|
| Android | 167 | 2.6 s | 11.2 s | 78% | 88% | 94% |
| iPhone | 29 | 6.4 s | 14.2 s | 28% | 69% | 90% |
App signups on the built-in code (6 Sep to 1 Dec 2026): iPhone 134 of 206 (65%), Android 21 of 88 (24%).
Devices that stay on old code (app opens, last 7 days):
| Store version | Devices | Only seen on built-in | 3+ opens, never on OTA | On built-in 24 h or more |
|---|---|---|---|---|
| iPhone 1.2.16 | 76 | 47 | 9 | 5 |
| iPhone 1.2.15 | 57 | 34 | 8 | 7 |
| Android 1.2.15 | 33 | 20 | 4 | 3 |
| Android 1.2.16 | 30 | 11 | 1 | 2 |
Bundle size and release rate:
- The production bundle is a 15.5 MB zip (26 MB unzipped, 578 files). Every update downloads the full zip.
- Content: JS 9.3 MB, PNG 9.2 MB, Lottie JSON 2.4 MB, SVG 2.0 MB. Some PNGs are in the bundle twice.
- 13 production bundles from 27 Nov to 1 Dec, so 2 to 3 per day.
4. How much actually changes between bundles
Built locally from git (578 files, same shape as the production bundle):
| From | To | Changed files | Changed size | Over the network (gzip) |
|---|---|---|---|---|
| Store build 1.2.16 (built-in) | Latest production | 154 of 578 | 6.0 MB | 1.8 MB |
| Previous production release | Latest production | 131 of 578 | 5.6 MB | 1.7 MB |
| Full zip today | 578 | 25.2 MB | 15.5 MB |
The real CI build differs from the local build because production env values change which code is kept. The difference comes from env, not from random per-build values. Two real CI bundles in a row have not been compared yet.
5. The prototype
- Update server on Cloudflare Worker + R2. It speaks Capgo's protocol, so the existing plugin works with it by changing three URLs in capacitor.config.ts. It stores each file once by its hash, so a release uploads only changed files (the second release uploaded 130 files, 5.6 MB). It returns a delta manifest. About 150 lines.
- Publish script. Uploads changed files, a full zip fallback, the manifest, then the channel pointer last.
- Throttling proxy. Adds a round trip per request, a shared speed limit and gzip for text files, like Cloudflare, so the real plugin downloads at phone-like speeds.
- App changes (prototype only): the first-launch gate waits for Capgo's own download instead of starting a second one, and at every app open a waiting bundle is applied before any content shows.
6. iPhone simulator results (real Capgo plugin)
First launch, fresh install, 5 second gate, server bundle differs from the built-in code in 158 of 578 files:
| Network | Full zip (today) | Delta |
|---|---|---|
| No limit | 3.3 s, switched | 1.2 s, switched |
| iPhone median (19.4 Mbps, 60 ms) | 9.8 s, timed out, old code | 2.7 s, switched |
| iPhone 90% (8.7 Mbps, 100 ms) | 18.3 s, timed out, old code | 4.0 s, switched |
- Bytes over the network: zip 15.5 MB, delta 2.0 MB.
- iOS reuses built-in files: 420 of 578 files were copied from the app's own built-in folder after a hash check. Only the changed files were downloaded.
- The zip results match the PostHog numbers above.
- The first run on a cold simulator took 4.0 s even with no limit (one-time warm-up). On a real iPhone, hashing about 420 built-in files is an extra cost we have not measured yet.
Stale device on iPhone: after an update was downloaded and the app was closed, Capgo loaded the old bundle again on the next open (today's behaviour). With the prototype change, the app switched to the new bundle before content. Extra time: about 0.17 s.
7. Android emulator results (real Capgo plugin)
- First launch: new bundle applied before content, about 2 s on the emulator network, no rollback.
- Stale device: confirmed. On going to the background Capgo logged "Update delayed until delay conditions met", and the next cold start loaded the old bundle.
- Apply at open: worked. Extra time about 0.25 s.
- Later releases: the device downloaded 1 file; the other 577 came from the plugin's cache.
- Android does not reuse built-in files on the first delta (see blocker 5), so the first Android delta downloads every file. Android first launches are already 78% within 5 s, so this matters less.
8. Blockers (must fix before turning on delta, with Capgo cloud or self-hosted)
- Blocker 1. Our gate drops the manifest. getLatestAvailableBundle() keeps only version and url, and downloadBundle() passes only those. Even with delta turned on in CI, the first launch would still download the full zip.
- Blocker 2. On Android, download() with a manifest returns at once with a temporary id. The real bundle arrives later in the downloadComplete event. Our code calls set() with the temporary id and it fails ("id does not exist").
- Blocker 3. Two downloads at once. With native auto update on, Capgo starts its own download at boot, and our gate starts a second one for the same version. They write the same cache files and the delta failed ("Failed to write file atomically"). Fix: when native auto update is on, the gate only waits for the native download.
- Blocker 4. Duplicate files break delta. Four files exist twice with the same content and file name in different folders: assets/lock.svg and assets/csv/lock.svg, and tim.png, phill.png and petra.png in both assets/rev and assets/icons. The plugin names cache files by hash plus file name, so both copies write to the same cache file at once and the checksum fails. This failed in every delta test until we made the copies different. Fix: remove the duplicates, and add a CI check. Worth reporting to Capgo.
- Blocker 5 (Android only). No reuse of built-in files. The Android plugin looks in filesDir/public, but the built-in code is inside the APK. iOS looks in the right place.
9. Other risks found
- Plugin version mismatch. We use @capgo/capacitor-updater 8.43.10, which declares a peer dependency on Capacitor 8. We are on Capacitor 7.6.10. Capgo maps Capacitor 7 to the @lts-v7 plugin line.
- App Store risk. 8.43.10 iOS has NSSelectorFromString with perform for the splash screen. Capgo issue 913 reports App Review rejections under guideline 2.5.2 for this code. It is fixed in 7.51.21 and 8.51.22 and later. Store build 1.2.16 passed review with it, so this is a risk, not a certain rejection.
- Capgo's own modes (directUpdate atInstall and onLaunch) exist, but every install path stops while any delay condition exists. Our app adds the 5 minute delay on every boot, so these modes would not help without changing that too.
10. Options
| Option | What it takes | Fixes first launch | Fixes stale devices | Cost | Main risk |
|---|---|---|---|---|---|
| A. Keep Capgo cloud, fix our side | Blockers 1-4, delta in CI, apply at open, plugin @lts-v7 | Yes on iPhone | Yes | Capgo plan (Solo $14 or Maker $39 per month by bandwidth; delta lowers bandwidth) | Plugin upgrade needs a store release |
| B. Self-host on Worker + R2 | Everything in A, plus the Worker, CI publish, rollback and channel tools, stats, a hold during store review | Same as A | Same as A | R2 storage only (egress is free) | We own uptime, rollback and review hold; no Capgo dashboard |
| C. Switch plugin (Capawesome Live Update) | Native migration and a new store build | Yes | Yes, by design | $9-29 per month or self-host | Migration work; v7 line is maintenance only |
| D. Write our own plugin | Native code on two platforms | In theory | In theory | Dev time | Rollback, integrity and review bugs |
The prototype shows that the app-side changes give the big gain. The server choice (A or B) is a separate decision.
A possible order for discussion:
- Step 1: fix blockers 1-4 and add apply-at-open, keeping Capgo cloud.
- Step 2: upgrade to the @lts-v7 plugin line, ship a store build, and turn on delta.
- Step 3: measure for 1-2 weeks with the existing PostHog events (ota_check_finished, app_opened).
- Step 4: decide on self-hosting with those numbers and the Capgo bill.
11. Edge cases of the current approach
- Signup on old code. When the first download times out, signup and onboarding run on the store build's code. If the backend removed an API that old code still calls, the user sees errors (SOR-9369).
- Queued bundle does not apply on the next open. Confirmed on both platforms.
- A store update starts everyone on old code again until an OTA bundle applies (Capgo default, setting not checked).
- Frequent releases. With 2 to 3 bundles a day, a slow device is often one or more bundles behind.
- Reload in the background. When a bundle finally applies, the WebView reloads and the user comes back on the start page.
- Rollback only covers a broken boot. A bundle that boots but breaks later is not rolled back.
- No minimum version. A backend feature flag can turn on a feature that old code has no screen for.
- We cannot link a launch to a signup. The first-launch event is sent before the user has an account.
12. Open questions for the team
- What is the longest first-launch wait we accept for a new user?
- Is a switch at app open acceptable if it happens before any content shows?
- Do we want a minimum supported bundle version for signup and onboarding?
- Capgo cloud or self-hosted, once the app-side fixes are in?
- Who owns a test on a real iPhone on a mobile network, which is the main open check?
13. Not verified yet
- A real iPhone on a real mobile network, including the time to hash about 420 built-in files.
- The delta size between two real CI bundles.
- Capgo cloud with delta on our bundle. Blocker 4 should also happen there, because it is in the plugin.
- The @lts-v7 plugin line: whether the same behaviour and fixes apply.
- That a broken or half-downloaded bundle is never applied by the apply-at-open change.
Where the material is
The prototype code (Worker, publish script, simulator, throttling proxy, app patch) and the raw logs are not in the repo yet. They can be pushed to a branch for whoever picks this up.
First launch today
iPhone, median network: the 15.5 MB download takes 9.8 s, the 5 s limit ends first, and the user signs up on the old code without the new PRD-142 screen.
?scenario=first-launch-today
First launch with delta
Same iPhone and network: only 2.0 MB of changed files, done in 2.7 s, and the user starts on the newest code.
?scenario=first-launch-delta
Download time: zip vs delta
Measured with the real Capgo plugin on the iPhone simulator at three network speeds.
?scenario=download-time
What a new install downloads
15.5 MB today vs 2.0 MB with delta; 420 of 578 files are copied from the app itself.
?scenario=what-downloads
Stale device
Today a downloaded update does not apply when the app is opened again. With apply-at-open it does, in about 0.2 s.
?scenario=stale-device
Production data (PostHog)
Share of first-launch downloads done within 5, 10 and 15 seconds, iPhone vs Android.
?scenario=production-data











