fix(tirith): skip auto-install on Termux native (Bionic libc) - #26281
Closed
briandevans wants to merge 1 commit into
Closed
fix(tirith): skip auto-install on Termux native (Bionic libc)#26281briandevans wants to merge 1 commit into
briandevans wants to merge 1 commit into
Conversation
Contributor
|
LGTM — dedicated |
Contributor
Author
|
CI audit — all 3
Reproduces locally on clean |
briandevans
force-pushed
the
fix/tirith-termux-native-skip-26275
branch
from
May 19, 2026 03:46
f12ab62 to
efac340
Compare
briandevans
force-pushed
the
fix/tirith-termux-native-skip-26275
branch
4 times, most recently
from
May 29, 2026 00:11
44dc682 to
f03770f
Compare
Issue NousResearch#26275: hermes-agent on Termux for Android emits `tirith spawn failed: [Errno 2] No such file or directory: '/data/data/com.termux/files/home/.hermes/profiles/X/bin/tirith'` even though the binary file is present at the path. The OSError is misleading: the binary exists, but the dynamic interpreter embedded in its ELF header (`/lib/ld-linux-aarch64.so.1`, or x86_64 equivalent) does not — Termux ships Bionic libc under `/data/data/com.termux/files/usr/` and has no `/lib` at all. The kernel returns ENOENT for the missing interpreter, which Python surfaces as a FileNotFoundError pointing at the binary. So the auto-installer (99af222, "fix(tirith): detect Android/Termux as Linux ABI-compatible") happily downloads `tirith-aarch64-unknown-linux-gnu.tar.gz` and writes a binary that can never run. Narrow the Linux/Android branch in `_detect_target()` to skip Termux native, detected via `PREFIX=/data/data/com.termux/files/...` (the canonical Termux env var). Inside a proot Ubuntu chroot on Termux, PREFIX is rewritten to the chroot's `/usr` and a real glibc is available, so that path is unaffected. `_install_tirith()` returns a distinct `termux_native_unsupported` reason and logs an actionable INFO line pointing the user at proot Ubuntu or `TIRITH_ENABLED=false`. Regression guard: with the production change reverted, the new `test_detect_target_returns_none_on_termux_native` test fails with `AssertionError: assert 'aarch64-unknown-linux-gnu' is None`, demonstrating the exact bug path from the issue. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
briandevans
force-pushed
the
fix/tirith-termux-native-skip-26275
branch
from
May 30, 2026 02:30
f03770f to
e8ed9e1
Compare
Contributor
Author
|
Housekeeping: closing to keep my open-PR set focused on actively-reviewed work. This has been open ~17d without maintainer review and the surrounding code has continued to move, so it's unlikely to land as-is. The underlying fix still stands — happy to reopen and rebase if it would be useful. Thanks! |
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
PREFIX=/data/data/com.termux/files/...) in_detect_target()and short-circuit toNoneso the linux-gnu binaries — whose dynamic interpreter/lib/ld-linux-*.so.*doesn't exist on Termux's Bionic-libc filesystem — are never downloaded.termux_native_unsupportedreason from_install_tirith()plus an actionable INFO log pointing the user at proot Ubuntu orTIRITH_ENABLED=false.Fixes #26275.
The bug
Issue #26275: hermes-agent on Termux for Android 26 (aarch64) emits
— even though the binary file is present at the path. The reporter pinned this down via
file tirith:The kernel can't load
/lib/ld-linux-aarch64.so.1(Termux has no/libat all — its filesystem lives entirely under/data/data/com.termux/files/usr/), so it returns ENOENT for the interpreter, which Python surfaces as aFileNotFoundErrorwhose path attribute is the binary's path, not the interpreter's. The error message is misleading; the binary is fine, the dynamic linker is missing.The auto-installer downloaded that broken binary because commit 99af222ec (
fix(tirith): detect Android/Termux as Linux ABI-compatible) opted Android into theunknown-linux-gnuRust target on the assumption that Bionic is ABI-compatible with glibc. It isn't, for any binary that's dynamically linked against glibc — the prebuilt tirith ELF embeds a glibc dynamic interpreter path that Termux can't satisfy.The fix
Narrow the
Linux/Androidbranch in_detect_target()to skip Termux native, detected viaPREFIX=/data/data/com.termux/files/...(Termux's canonical env var, set by every Termux session). Inside a proot Ubuntu chroot on top of Termux,PREFIXis rewritten to the chroot's/usrand a real glibc is available, so that path is unaffected — verified bytest_detect_target_proot_ubuntu_inside_termux_still_works._install_tirith()returns a distincttermux_native_unsupportedreason so the disk failure marker is specific (rather than the genericunsupported_platformtag), and emits an INFO log telling the user the actual cause and three workarounds:A
Conda-stylePREFIX(e.g./opt/conda/envs/dev) would NOT match — the prefix-string check is anchored at/data/data/com.termux/files/, verified bytest_is_termux_native_false_for_unrelated_prefix.Test plan
tests/tools/test_tirith_security.py::TestTermuxNativeSkip— 7/7 passtests/tools/test_tirith_security.py— 70/70 pass;tests/tools/test_command_guards.py tests/tools/test_yolo_mode.py— 38/38 passtools/tirith_security.pyreverted viagit stash,test_detect_target_returns_none_on_termux_nativefails withAssertionError: assert 'aarch64-unknown-linux-gnu' is None, demonstrating the exact bug path from the issue. Restored fix → passes.Related
fix(tirith): detect Android/Termux as Linux ABI-compatible) which incorrectly assumed Bionic + glibc are ABI-compatible for dynamically-linked binaries.