[PR #7215] [MERGED] fix(termux): update in-app without downloading every platform's binaries #7626

Closed
opened 2026-10-24 04:05:58 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7215
Author: @SpicyMarinara
Created: 10/7/2026
Status: ✅ Merged
Merged: 10/7/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/termux-updater-no-force-7214


📝 Commits (3)

  • 599c40e fix(termux): update in-app without downloading every platform's binaries
  • c8880cf Merge remote-tracking branch 'origin/staging' into fix/termux-updater-no-force-7214
  • bacd062 Merge remote-tracking branch 'origin/staging' into fix/termux-updater-no-force-7214

📊 Changes

3 files changed (+74 additions, -5 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 packages/server/src/routes/updates.routes.ts (+20 -4)
📝 scripts/regressions/update-apply-hardening.regression.ts (+53 -1)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #7214

Why this change

  • On Termux, every in-app update (Settings → Advanced → Updates) ran pnpm install --force --frozen-lockfile. --force turns off pnpm's platform filter, so the phone downloaded and linked builds for every other platform: all eight @anthropic-ai/claude-agent-sdk builds (about 1.7 GB on their own), 25 rollup, 26 sharp and 26 esbuild platform packages. None of them can run on Android, and phones often run out of storage during updates.
  • start-termux.sh already avoids --force on Android for this reason. The updater was the odd one out.
  • --force was what healed the stale pnpm "skipped" state behind #7173. Since #7179 made @emnapi/runtime a direct server dependency, a plain frozen install repairs that state too (re-checked below), so Android no longer needs --force.

What changed

  • getUpdateInstallStep(platform) in packages/server/src/routes/updates.routes.ts now returns the install command and its environment. On Android it is the same as start-termux.sh's install_workspace_dependencies: SHARP_IGNORE_GLOBAL_LIBVIPS=1 … install --frozen-lockfile --prefer-offline. Windows, macOS, Linux and unknown platforms keep install --force --frozen-lockfile exactly as before.
  • The in-app apply step uses it, and runPinnedPnpm passes the step's environment to pnpm.
  • The manual recipe shown when an Android update fails (and the manual staging command on Android) now uses the same install, so the 1.7 GB download doesn't come back through the manual path.
  • scripts/regressions/update-apply-hardening.regression.ts now pins the Android install and checks it matches the start-termux.sh line. It also checks the Android manual recipe has no --force, desktop recipes and platforms keep --force, and the apply route is wired to the platform's install step.
  • CHANGELOG entry under [Unreleased].

Evidence (scratch install with the shared store, pnpm 10.34.5, --os android --cpu arm64, --ignore-scripts)

New Android command Old command (--force)
Virtual-store entries 673 787
pnpm skipped (platform-filtered) 114 0
claude-agent-sdk platform builds 0 8 (1.7 GB)
rollup / sharp / esbuild platform packages 1 / 1 / 1 (android-arm64, sharp-wasm32, android-arm64) 25 / 26 / 26
Logical size of the virtual store 864 MB 3.5 GB

The new command installed only the android-arm64 packages and the wasm32 fallbacks (@img/sharp-wasm32 plus @emnapi/runtime). For the stale #7173 state, I added @emnapi/runtime@1.11.3 back to .modules.yaml's skipped list and deleted its package. Rerunning the new command reinstalled it and removed it from skipped. The scratch installs were removed afterwards.

Desktop note (not changed)

--force disables pnpm's platform filter on every OS (skipped was 0 above), so desktop in-app updates also download builds for other platforms. The issue scoped this fix to Termux and the Windows installer intentionally uses --force, so desktop behaviour is unchanged here. Changing it could be a separate issue.

In-place update check (adversarial verification)

Each scratch install below kept its node_modules between versions, like a real in-place update. It used the shared store, pnpm 10.34.5, --os android --cpu arm64 and --ignore-scripts. After each run the result was compared with a fresh install of this branch and then loaded as Android (process.platform = "android").

History before the new command Packages missing vs fresh Dependency links that differ sharp WebAssembly resize rollup / lightningcss / esbuild / oxide android-arm64 check-workspace-install (android)
2.4.6 launcher → 2.5.0 launcher (the broken #7173 state) 0 0 works (failed before the update) all present no problems
2.4.6 forced → 2.5.0 forced (old in-app updater) 0 0 works all present no problems
2.4.6 launcher, then straight to this branch 0 0 works all present no problems
2.4.6 forced, then straight to this branch 0 0 works all present no problems
  • The skipped entries that 2.4.6 left behind are now only old versions that this lockfile no longer uses, and @emnapi/runtime@1.11.3 is no longer one of them.
  • Builds for other platforms that earlier forced updates already downloaded stay until pnpm's own virtual-store cleanup runs (by default when the last one was more than 7 days ago). When it does, the new command removes them. With that cleanup forced, the 2.5.0 forced history went from 7.0 GB and 942 entries to 864 MB and 673, the same as a fresh install, and sharp still worked.
  • Android detection uses the server's existing process.platform === "android" check, which the update timeouts and the one-package-at-a-time Termux build already use. Desktop and Docker never report android. If a Termux Node ever reported linux, the update would simply keep the old --force install. The manual commands for Windows, macOS, Linux and unknown platforms are the same as on staging, byte for byte, and so are all the hints.
  • Not changed here: under pnpm 10, start-termux.sh's supportedArchitectures.*[] lines in .npmrc have no effect (pnpm config get supportedArchitectures returns undefined). Termux therefore installs only the android packages, which this check relied on and the launcher already does.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Agent-run checks: pnpm check (exit 0). node scripts/run-regressions.mjs --filter update-apply-hardening passes, and fails without the route change. update-channel-metadata, termux-postmortem, shutdown-deadline and open-issues regressions pass, and so do the launcher update, format-guard and termux-client-build regressions.

After merging the latest staging (only CHANGELOG.md conflicted, and both entries are kept): pnpm check exits 0. update-apply-hardening passes, and fails against staging's updates.routes.ts. update-channel-metadata, termux-postmortem, sharp-wasm-runtime-missing, shutdown-deadline, open-issues and all 8 launcher regressions pass. termux-sharp passes against the shared pnpm store; it needs a populated store because it installs offline.

Manual verification notes

  • Manually verify on a Termux install that Settings → Advanced → Updates → Apply Update completes and Engine starts after relaunching.
  • Manually verify on a Termux install whose .pnpm has no claude-agent-sdk- platform folders yet (for example a fresh start-termux.sh install, checked with ls .pnpm | grep claude-agent-sdk-) that an in-app update adds none, and that the store doesn't grow by about 1.7 GB. On a phone that already ran forced updates, older folders stay until pnpm's weekly cleanup removes them, so they don't mean the fix failed.
  • Manually verify that thumbnails still load in a browser on that Termux install after the update (Sharp's WebAssembly fallback stays installed).
  • Manually verify that an in-app update on desktop (Windows, macOS or Linux) still completes as before.
  • Manually verify that a failed Android update shows a manual command with SHARP_IGNORE_GLOBAL_LIBVIPS=1 … install --frozen-lockfile --prefer-offline and no --force.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

CHANGELOG updated. No docs/ page describes the updater's install flags, so no English docs changed and there's nothing to translate.

UI evidence (if applicable)

Not applicable (server-only change).

Summary by CodeRabbit

  • Bug Fixes
    • Android/Termux updates now install only the builds required for Android, matching the behavior of the Termux launcher.
    • The manual command shown after an update failure now uses the same Android-specific installation settings.
    • Updates on Windows, macOS, Linux, and other platforms retain their existing installation behavior.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/7215 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/7/2026 **Status:** ✅ Merged **Merged:** 10/7/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/termux-updater-no-force-7214` --- ### 📝 Commits (3) - [`599c40e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/599c40e7b89a2055f118b2ddee9d8b5cf07497ad) fix(termux): update in-app without downloading every platform's binaries - [`c8880cf`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c8880cffc7957f00160e6602c3d4666619f5c177) Merge remote-tracking branch 'origin/staging' into fix/termux-updater-no-force-7214 - [`bacd062`](https://github.com/Pasta-Devs/Marinara-Engine/commit/bacd062ebadac918c9ddcd5f58225871eb8652ed) Merge remote-tracking branch 'origin/staging' into fix/termux-updater-no-force-7214 ### 📊 Changes **3 files changed** (+74 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `packages/server/src/routes/updates.routes.ts` (+20 -4) 📝 `scripts/regressions/update-apply-hardening.regression.ts` (+53 -1) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue Closes #7214 ## Why this change - On Termux, every in-app update (**Settings → Advanced → Updates**) ran `pnpm install --force --frozen-lockfile`. `--force` turns off pnpm's platform filter, so the phone downloaded and linked builds for every other platform: all eight `@anthropic-ai/claude-agent-sdk` builds (about 1.7 GB on their own), 25 rollup, 26 sharp and 26 esbuild platform packages. None of them can run on Android, and phones often run out of storage during updates. - `start-termux.sh` already avoids `--force` on Android for this reason. The updater was the odd one out. - `--force` was what healed the stale pnpm "skipped" state behind #7173. Since #7179 made `@emnapi/runtime` a direct server dependency, a plain frozen install repairs that state too (re-checked below), so Android no longer needs `--force`. ## What changed - `getUpdateInstallStep(platform)` in `packages/server/src/routes/updates.routes.ts` now returns the install command and its environment. On Android it is the same as `start-termux.sh`'s `install_workspace_dependencies`: `SHARP_IGNORE_GLOBAL_LIBVIPS=1 … install --frozen-lockfile --prefer-offline`. Windows, macOS, Linux and unknown platforms keep `install --force --frozen-lockfile` exactly as before. - The in-app apply step uses it, and `runPinnedPnpm` passes the step's environment to pnpm. - The manual recipe shown when an Android update fails (and the manual staging command on Android) now uses the same install, so the 1.7 GB download doesn't come back through the manual path. - `scripts/regressions/update-apply-hardening.regression.ts` now pins the Android install and checks it matches the `start-termux.sh` line. It also checks the Android manual recipe has no `--force`, desktop recipes and platforms keep `--force`, and the apply route is wired to the platform's install step. - CHANGELOG entry under `[Unreleased]`. ### Evidence (scratch install with the shared store, pnpm 10.34.5, `--os android --cpu arm64`, `--ignore-scripts`) | | New Android command | Old command (`--force`) | | --- | --- | --- | | Virtual-store entries | 673 | 787 | | pnpm `skipped` (platform-filtered) | 114 | 0 | | claude-agent-sdk platform builds | 0 | 8 (1.7 GB) | | rollup / sharp / esbuild platform packages | 1 / 1 / 1 (`android-arm64`, `sharp-wasm32`, `android-arm64`) | 25 / 26 / 26 | | Logical size of the virtual store | 864 MB | 3.5 GB | The new command installed only the android-arm64 packages and the wasm32 fallbacks (`@img/sharp-wasm32` plus `@emnapi/runtime`). For the stale #7173 state, I added `@emnapi/runtime@1.11.3` back to `.modules.yaml`'s `skipped` list and deleted its package. Rerunning the new command reinstalled it and removed it from `skipped`. The scratch installs were removed afterwards. ### Desktop note (not changed) `--force` disables pnpm's platform filter on every OS (`skipped` was 0 above), so desktop in-app updates also download builds for other platforms. The issue scoped this fix to Termux and the Windows installer intentionally uses `--force`, so desktop behaviour is unchanged here. Changing it could be a separate issue. ### In-place update check (adversarial verification) Each scratch install below kept its `node_modules` between versions, like a real in-place update. It used the shared store, pnpm 10.34.5, `--os android --cpu arm64` and `--ignore-scripts`. After each run the result was compared with a fresh install of this branch and then loaded as Android (`process.platform = "android"`). | History before the new command | Packages missing vs fresh | Dependency links that differ | sharp WebAssembly resize | rollup / lightningcss / esbuild / oxide `android-arm64` | `check-workspace-install` (android) | | --- | --- | --- | --- | --- | --- | | 2.4.6 launcher → 2.5.0 launcher (the broken #7173 state) | 0 | 0 | works (failed before the update) | all present | no problems | | 2.4.6 forced → 2.5.0 forced (old in-app updater) | 0 | 0 | works | all present | no problems | | 2.4.6 launcher, then straight to this branch | 0 | 0 | works | all present | no problems | | 2.4.6 forced, then straight to this branch | 0 | 0 | works | all present | no problems | - The `skipped` entries that 2.4.6 left behind are now only old versions that this lockfile no longer uses, and `@emnapi/runtime@1.11.3` is no longer one of them. - Builds for other platforms that earlier forced updates already downloaded stay until pnpm's own virtual-store cleanup runs (by default when the last one was more than 7 days ago). When it does, the new command removes them. With that cleanup forced, the 2.5.0 forced history went from 7.0 GB and 942 entries to 864 MB and 673, the same as a fresh install, and sharp still worked. - Android detection uses the server's existing `process.platform === "android"` check, which the update timeouts and the one-package-at-a-time Termux build already use. Desktop and Docker never report `android`. If a Termux Node ever reported `linux`, the update would simply keep the old `--force` install. The manual commands for Windows, macOS, Linux and unknown platforms are the same as on `staging`, byte for byte, and so are all the hints. - Not changed here: under pnpm 10, `start-termux.sh`'s `supportedArchitectures.*[]` lines in `.npmrc` have no effect (`pnpm config get supportedArchitectures` returns `undefined`). Termux therefore installs only the android packages, which this check relied on and the launcher already does. ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` Agent-run checks: `pnpm check` (exit 0). `node scripts/run-regressions.mjs --filter update-apply-hardening` passes, and fails without the route change. `update-channel-metadata`, `termux-postmortem`, `shutdown-deadline` and `open-issues` regressions pass, and so do the launcher `update`, `format-guard` and `termux-client-build` regressions. After merging the latest `staging` (only `CHANGELOG.md` conflicted, and both entries are kept): `pnpm check` exits 0. `update-apply-hardening` passes, and fails against `staging`'s `updates.routes.ts`. `update-channel-metadata`, `termux-postmortem`, `sharp-wasm-runtime-missing`, `shutdown-deadline`, `open-issues` and all 8 launcher regressions pass. `termux-sharp` passes against the shared pnpm store; it needs a populated store because it installs offline. ### Manual verification notes - Manually verify on a Termux install that **Settings → Advanced → Updates → Apply Update** completes and Engine starts after relaunching. - Manually verify on a Termux install whose `.pnpm` has no `claude-agent-sdk-` platform folders yet (for example a fresh `start-termux.sh` install, checked with `ls .pnpm | grep claude-agent-sdk-`) that an in-app update adds none, and that the store doesn't grow by about 1.7 GB. On a phone that already ran forced updates, older folders stay until pnpm's weekly cleanup removes them, so they don't mean the fix failed. - Manually verify that thumbnails still load in a browser on that Termux install after the update (Sharp's WebAssembly fallback stays installed). - Manually verify that an in-app update on desktop (Windows, macOS or Linux) still completes as before. - Manually verify that a failed Android update shows a manual command with `SHARP_IGNORE_GLOBAL_LIBVIPS=1 … install --frozen-lockfile --prefer-offline` and no `--force`. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) CHANGELOG updated. No `docs/` page describes the updater's install flags, so no English docs changed and there's nothing to translate. ## UI evidence (if applicable) Not applicable (server-only change). <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Android/Termux updates now install only the builds required for Android, matching the behavior of the Termux launcher. * The manual command shown after an update failure now uses the same Android-specific installation settings. * Updates on Windows, macOS, Linux, and other platforms retain their existing installation behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-24 04:05:58 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#7626
No description provided.