[PR #7198] [MERGED] fix(termux): remove the dead .npmrc architecture block #7620

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

📋 Pull Request Information

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

Base: staging ← Head: fix/termux-arch-flags-7178


📝 Commits (8)

  • 904834b fix(termux): remove the dead .npmrc architecture block
  • 912ace7 test(termux): pin the default pnpm target in every config pnpm reads
  • 23660c9 Merge origin/staging into fix/termux-arch-flags-7178
  • d33ff60 docs(changelog): note the Android app start no longer refreshes dependencies (#7178)
  • b32f559 Merge origin/staging into fix/termux-arch-flags-7178
  • 336175d Merge remote-tracking branch 'origin/staging' into fix/termux-arch-flags-7178
  • b0c826e test(termux): parse lockfile entries by key and reject negated architectures (#7178)
  • ced325d Merge remote-tracking branch 'origin/staging' into fix/termux-arch-flags-7178

📊 Changes

3 files changed (+70 additions, -31 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
➕ scripts/regressions/termux-native-deps.regression.mjs (+65 -0)
📝 start-termux.sh (+4 -31)

📄 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 #7178

Why this change

  • On Android, start-termux.sh appended supportedArchitectures.os[] / cpu[] lines (current, linux, the CPU and wasm32) to the tracked .npmrc. pnpm 10.34.5 reads supportedArchitectures only from pnpm-workspace.yaml, the root package.json pnpm field, or --os/--cpu/--libc, so those lines never did anything. Termux has always installed with pnpm's default android/<arch> target. The block also left .npmrc modified on every device, so each launcher update had to stash and restore it.
  • The issue asked whether Termux needs the Linux or WASM binaries before choosing a fix. It does not:
    • Scratch installs of this lockfile with --os android --cpu arm64 installed the Android builds of every native loader: @esbuild/android-arm64, @rollup/rollup-android-arm64, lightningcss-android-arm64, @tailwindcss/oxide-android-arm64 and @napi-rs/canvas-android-arm64.
    • Each loader picks its binary from process.platform, which is android on Termux, so a Linux package would never be loaded. Termux uses Android's own C library (Bionic), and the glibc/musl builds cannot load there anyway.
    • Sharp's WASM fallback, @img/sharp-wasm32, is a regular server dependency since #7173, so it is installed whatever the CPU setting.
    • onnxruntime-node keeps its binaries inside its own package and has no Android build. The architecture setting does not change that, and ensure-native-deps already skips it on Android.
    • Adding --os linux --cpu wasm32 would install 28 platform packages instead of 11, about 540 MB more. Most of that is the two Linux claude-agent-sdk binaries (about 220 MB each), and none of it would load.
  • Starting Engine from the Android app ran a needless dependency step every time. The app's setup command runs git checkout --detach -f <release commit>, which resets the tracked .npmrc. The old block then found its marker missing, re-added the lines and set TERMUX_FORCE_INSTALL=1, so each app start ran pnpm store prune and "Installing dependencies (refreshing for platform fix)". Without the block, an app start installs only when node_modules is missing or out of date. This applies to APKs built from a commit that includes this change.
  • The fix is to delete the block, not to move it to CLI flags.

What changed

  • start-termux.sh: removed the .npmrc architecture block and the TERMUX_FORCE_INSTALL trigger it set, including the "(refreshing for platform fix)" install message. Added a short comment in install_workspace_dependencies saying pnpm's default target is the correct one.
  • Existing device .npmrc files keep their inert lines. Nothing rewrites or deletes them.
  • New scripts/regressions/termux-native-deps.regression.mjs:
    • Checks that no config pnpm reads (start-termux.sh, .npmrc, pnpm-workspace.yaml, root package.json) sets supportedArchitectures or restores the force trigger.
    • Reads the lockfile and checks that every locked version of esbuild, rollup, lightningcss, @tailwindcss/oxide and @napi-rs/canvas still has an android/arm64 optional build. A future upgrade that drops one fails the regression.
  • CHANGELOG.md: one [Unreleased] entry, which also mentions the faster Android app start.
  • The in-app updater (packages/server/src/routes/updates.routes.ts) is unchanged. It never read the .npmrc lines, and it runs install --force, which installs every optional package and ignores --os/--cpu. I confirmed this with a scratch install: all 25 of rollup's platform packages were installed under --force --os android --cpu arm64.

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 evidence, to be confirmed by a human:

  • pnpm check exited 0 on the branch.
  • node scripts/regressions/termux-native-deps.regression.mjs passes. It fails as intended with the old start-termux.sh and with lightningcss-android-arm64 relabelled os: [linux] in the lockfile.
  • node scripts/regressions/launcher/update.regression.mjs and node scripts/regressions/launcher/termux-client-build.regression.mjs pass.
  • node scripts/regressions/termux-sharp.regression.mjs passes when pointed at the populated pnpm store. In a fresh worktree whose relative .pnpm-store is empty, it fails with ERR_PNPM_NO_OFFLINE_TARBALL; this change does not cause that.
  • Scratch installs (pnpm 10.34.5, --frozen-lockfile --ignore-scripts):
    • .npmrc lines only (macOS): darwin builds only; no Linux or WASM optional package was installed.
    • --os android --cpu arm64: the 11 Android/WASM packages listed above.
    • --os android --os linux --cpu arm64 --cpu wasm32: 28 packages.
  • Local CodeRabbit (coderabbit review --agent --committed) reported one trivial finding: also cover pnpm-workspace.yaml and package.json. It is fixed in 912ace77b.

Adversarial verification (second agent), on the branch merged with staging at 93834b5ab:

  • Termux simulation: scratch installs with pnpm 10.34.5 running under node --import that sets process.platform to android, so pnpm's own default target is android/arm64, as on a phone.
    • New launcher (unchanged .npmrc) and old launcher (.npmrc with the # termux-supported-architectures lines) installed the same 12 platform-specific packages and a 787 MB virtual store. The lines are inert on Android too.
    • Passing what the lines asked for as flags (--os current --os linux --cpu current --cpu arm64 --cpu wasm32) would add 17 Linux/WASM packages and about 578 MB.
    • Adding or removing the old lines on an existing install, then reinstalling, gives "Already up to date" in under a second. Updates from 2.4.6 or 2.5.0 (which stash and restore the lines) and app starts (which reset them) do not reinstall or re-download anything.
  • Loaders under the simulated Android platform: rollup, lightningcss, @tailwindcss/oxide and @napi-rs/canvas (a regular dependency of pdf-parse) each resolve their android-arm64 package and fail only at dlopen, as expected on macOS. esbuild spawns @esbuild/android-arm64/bin/esbuild, an Android ELF linked against /system/bin/linker64. sharp loads through @img/sharp-wasm32.
  • git checkout --detach -f on the same commit discards a modified .npmrc, and the old block then sets TERMUX_FORCE_INSTALL=1. Reproduced with staging's block and a node shim reporting android.
  • pnpm check exited 0. These pass: termux-native-deps (also fails when rollup's Android build is removed from the lockfile, and against staging's start-termux.sh), pnpm regression:launcher-update, launcher/termux-client-build, termux-sharp (with the shared store), termux-postmortem, open-issues, android-local-auth and restart-supervisor. bash -n start-termux.sh is clean, and no removed variable is still used.
  • CI runs the new regression: complete-node-regressions runs pnpm regression, which picks up *.regression.mjs.
  • Local CodeRabbit was rate-limited on the verification run (41-minute wait), so no second local review happened.

Manual verification notes

  • Manually verify a fresh Termux install on an arm64 phone: run the one-line install from docs/installation/android-termux.md. Confirm that git status shows .npmrc unchanged, the client build finishes, and Engine opens at http://127.0.0.1:7860.
  • Manually verify an existing Termux install whose .npmrc already has the # termux-supported-architectures lines. Update to this branch with ./start-termux.sh, and confirm that the update's stash and restore keep those lines, that dependencies install without "(refreshing for platform fix)", and that the server starts.
  • On that device, manually verify that ls .pnpm | grep -E "android-arm64|sharp-wasm32" (this repo's .npmrc keeps the virtual store in .pnpm, not node_modules/.pnpm) lists the esbuild, rollup, lightningcss, oxide, napi-rs canvas and sharp WASM packages, and that generating a sprite or thumbnail still works.
  • With an APK built from a commit that includes this change, manually verify that starting Engine from the app, stopping it, then starting it from the app again shows no "Installing dependencies" or "Reclaiming dependency cache space" step on the second start, and that Engine opens.

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)

Only CHANGELOG.md changed. No guide under docs/, android/README.md or docs/TROUBLESHOOTING.md describes the removed block, so no translation follow-up is needed.

Out of scope, noted for a follow-up: the in-app updater's Android install uses install --force, so it installs every platform's optional binaries, including all eight claude-agent-sdk builds (about 220 MB each). In the Termux simulation, --force installed 126 platform-specific packages and a 3.4 GB virtual store, against 12 packages and 787 MB without it. The start-termux.sh comment already warns against --force on Android. This PR does not change that path.

UI evidence (if applicable)

Not applicable (launcher script and regression only).

Summary by CodeRabbit

  • Bug Fixes
    • Android/Termux installs now use the default Android package settings, without adding architecture overrides.
    • Starting Engine from the Android app no longer repeats dependency installation or cache cleanup.
    • Existing installations require no action.

🔄 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/7198 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/6/2026 **Status:** ✅ Merged **Merged:** 10/7/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/termux-arch-flags-7178` --- ### 📝 Commits (8) - [`904834b`](https://github.com/Pasta-Devs/Marinara-Engine/commit/904834b905b06afeca7170284d166ae62d1141cb) fix(termux): remove the dead .npmrc architecture block - [`912ace7`](https://github.com/Pasta-Devs/Marinara-Engine/commit/912ace77b08217ae32733bf963e27154407f6524) test(termux): pin the default pnpm target in every config pnpm reads - [`23660c9`](https://github.com/Pasta-Devs/Marinara-Engine/commit/23660c9b414a5c214ceeea17f2e628afd57cee7c) Merge origin/staging into fix/termux-arch-flags-7178 - [`d33ff60`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d33ff602b5196d10954c97392fd462dc27fe7521) docs(changelog): note the Android app start no longer refreshes dependencies (#7178) - [`b32f559`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b32f559a67a72cb0e186086e647c0fce44772bef) Merge origin/staging into fix/termux-arch-flags-7178 - [`336175d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/336175d09902f77068863f918c773a4bbd3ae34f) Merge remote-tracking branch 'origin/staging' into fix/termux-arch-flags-7178 - [`b0c826e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b0c826e94c26c322ff22c02459dc0bedfaa6cb04) test(termux): parse lockfile entries by key and reject negated architectures (#7178) - [`ced325d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ced325dfdcc6103bfb369c3f6a7bbeaadb5a5d7a) Merge remote-tracking branch 'origin/staging' into fix/termux-arch-flags-7178 ### 📊 Changes **3 files changed** (+70 additions, -31 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) ➕ `scripts/regressions/termux-native-deps.regression.mjs` (+65 -0) 📝 `start-termux.sh` (+4 -31) </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 #7178 ## Why this change - On Android, `start-termux.sh` appended `supportedArchitectures.os[]` / `cpu[]` lines (`current`, `linux`, the CPU and `wasm32`) to the tracked `.npmrc`. pnpm 10.34.5 reads `supportedArchitectures` only from `pnpm-workspace.yaml`, the root `package.json` `pnpm` field, or `--os`/`--cpu`/`--libc`, so those lines never did anything. Termux has always installed with pnpm's default `android/<arch>` target. The block also left `.npmrc` modified on every device, so each launcher update had to stash and restore it. - The issue asked whether Termux needs the Linux or WASM binaries before choosing a fix. It does not: - Scratch installs of this lockfile with `--os android --cpu arm64` installed the Android builds of every native loader: `@esbuild/android-arm64`, `@rollup/rollup-android-arm64`, `lightningcss-android-arm64`, `@tailwindcss/oxide-android-arm64` and `@napi-rs/canvas-android-arm64`. - Each loader picks its binary from `process.platform`, which is `android` on Termux, so a Linux package would never be loaded. Termux uses Android's own C library (Bionic), and the glibc/musl builds cannot load there anyway. - Sharp's WASM fallback, `@img/sharp-wasm32`, is a regular server dependency since #7173, so it is installed whatever the CPU setting. - `onnxruntime-node` keeps its binaries inside its own package and has no Android build. The architecture setting does not change that, and `ensure-native-deps` already skips it on Android. - Adding `--os linux --cpu wasm32` would install 28 platform packages instead of 11, about 540 MB more. Most of that is the two Linux `claude-agent-sdk` binaries (about 220 MB each), and none of it would load. - Starting Engine from the Android app ran a needless dependency step every time. The app's setup command runs `git checkout --detach -f <release commit>`, which resets the tracked `.npmrc`. The old block then found its marker missing, re-added the lines and set `TERMUX_FORCE_INSTALL=1`, so each app start ran `pnpm store prune` and "Installing dependencies (refreshing for platform fix)". Without the block, an app start installs only when `node_modules` is missing or out of date. This applies to APKs built from a commit that includes this change. - The fix is to delete the block, not to move it to CLI flags. ## What changed - `start-termux.sh`: removed the `.npmrc` architecture block and the `TERMUX_FORCE_INSTALL` trigger it set, including the "(refreshing for platform fix)" install message. Added a short comment in `install_workspace_dependencies` saying pnpm's default target is the correct one. - Existing device `.npmrc` files keep their inert lines. Nothing rewrites or deletes them. - New `scripts/regressions/termux-native-deps.regression.mjs`: - Checks that no config pnpm reads (`start-termux.sh`, `.npmrc`, `pnpm-workspace.yaml`, root `package.json`) sets `supportedArchitectures` or restores the force trigger. - Reads the lockfile and checks that every locked version of esbuild, rollup, lightningcss, `@tailwindcss/oxide` and `@napi-rs/canvas` still has an `android`/`arm64` optional build. A future upgrade that drops one fails the regression. - `CHANGELOG.md`: one `[Unreleased]` entry, which also mentions the faster Android app start. - The in-app updater (`packages/server/src/routes/updates.routes.ts`) is unchanged. It never read the `.npmrc` lines, and it runs `install --force`, which installs every optional package and ignores `--os`/`--cpu`. I confirmed this with a scratch install: all 25 of rollup's platform packages were installed under `--force --os android --cpu arm64`. ## 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 evidence, to be confirmed by a human: - `pnpm check` exited 0 on the branch. - `node scripts/regressions/termux-native-deps.regression.mjs` passes. It fails as intended with the old `start-termux.sh` and with `lightningcss-android-arm64` relabelled `os: [linux]` in the lockfile. - `node scripts/regressions/launcher/update.regression.mjs` and `node scripts/regressions/launcher/termux-client-build.regression.mjs` pass. - `node scripts/regressions/termux-sharp.regression.mjs` passes when pointed at the populated pnpm store. In a fresh worktree whose relative `.pnpm-store` is empty, it fails with `ERR_PNPM_NO_OFFLINE_TARBALL`; this change does not cause that. - Scratch installs (pnpm 10.34.5, `--frozen-lockfile --ignore-scripts`): - `.npmrc` lines only (macOS): darwin builds only; no Linux or WASM optional package was installed. - `--os android --cpu arm64`: the 11 Android/WASM packages listed above. - `--os android --os linux --cpu arm64 --cpu wasm32`: 28 packages. - Local CodeRabbit (`coderabbit review --agent --committed`) reported one trivial finding: also cover `pnpm-workspace.yaml` and `package.json`. It is fixed in 912ace77b. Adversarial verification (second agent), on the branch merged with `staging` at 93834b5ab: - Termux simulation: scratch installs with pnpm 10.34.5 running under `node --import` that sets `process.platform` to `android`, so pnpm's own default target is `android/arm64`, as on a phone. - New launcher (unchanged `.npmrc`) and old launcher (`.npmrc` with the `# termux-supported-architectures` lines) installed the same 12 platform-specific packages and a 787 MB virtual store. The lines are inert on Android too. - Passing what the lines asked for as flags (`--os current --os linux --cpu current --cpu arm64 --cpu wasm32`) would add 17 Linux/WASM packages and about 578 MB. - Adding or removing the old lines on an existing install, then reinstalling, gives "Already up to date" in under a second. Updates from 2.4.6 or 2.5.0 (which stash and restore the lines) and app starts (which reset them) do not reinstall or re-download anything. - Loaders under the simulated Android platform: rollup, lightningcss, `@tailwindcss/oxide` and `@napi-rs/canvas` (a regular dependency of `pdf-parse`) each resolve their `android-arm64` package and fail only at `dlopen`, as expected on macOS. esbuild spawns `@esbuild/android-arm64/bin/esbuild`, an Android ELF linked against `/system/bin/linker64`. sharp loads through `@img/sharp-wasm32`. - `git checkout --detach -f` on the same commit discards a modified `.npmrc`, and the old block then sets `TERMUX_FORCE_INSTALL=1`. Reproduced with staging's block and a `node` shim reporting `android`. - `pnpm check` exited 0. These pass: `termux-native-deps` (also fails when rollup's Android build is removed from the lockfile, and against staging's `start-termux.sh`), `pnpm regression:launcher-update`, `launcher/termux-client-build`, `termux-sharp` (with the shared store), `termux-postmortem`, `open-issues`, `android-local-auth` and `restart-supervisor`. `bash -n start-termux.sh` is clean, and no removed variable is still used. - CI runs the new regression: `complete-node-regressions` runs `pnpm regression`, which picks up `*.regression.mjs`. - Local CodeRabbit was rate-limited on the verification run (41-minute wait), so no second local review happened. ### Manual verification notes - Manually verify a fresh Termux install on an arm64 phone: run the one-line install from `docs/installation/android-termux.md`. Confirm that `git status` shows `.npmrc` unchanged, the client build finishes, and Engine opens at `http://127.0.0.1:7860`. - Manually verify an existing Termux install whose `.npmrc` already has the `# termux-supported-architectures` lines. Update to this branch with `./start-termux.sh`, and confirm that the update's stash and restore keep those lines, that dependencies install without "(refreshing for platform fix)", and that the server starts. - On that device, manually verify that `ls .pnpm | grep -E "android-arm64|sharp-wasm32"` (this repo's `.npmrc` keeps the virtual store in `.pnpm`, not `node_modules/.pnpm`) lists the esbuild, rollup, lightningcss, oxide, napi-rs canvas and sharp WASM packages, and that generating a sprite or thumbnail still works. - With an APK built from a commit that includes this change, manually verify that starting Engine from the app, stopping it, then starting it from the app again shows no "Installing dependencies" or "Reclaiming dependency cache space" step on the second start, and that Engine opens. ## 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) Only `CHANGELOG.md` changed. No guide under `docs/`, `android/README.md` or `docs/TROUBLESHOOTING.md` describes the removed block, so no translation follow-up is needed. Out of scope, noted for a follow-up: the in-app updater's Android install uses `install --force`, so it installs every platform's optional binaries, including all eight `claude-agent-sdk` builds (about 220 MB each). In the Termux simulation, `--force` installed 126 platform-specific packages and a 3.4 GB virtual store, against 12 packages and 787 MB without it. The `start-termux.sh` comment already warns against `--force` on Android. This PR does not change that path. ## UI evidence (if applicable) Not applicable (launcher script and regression only). <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Android/Termux installs now use the default Android package settings, without adding architecture overrides. * Starting Engine from the Android app no longer repeats dependency installation or cache cleanup. * Existing installations require no action. <!-- 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:56 +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#7620
No description provided.