Skip to content

The agent that grows with you

fix(termux): carry the Vulkan loader and finish runtime diagnostics

ethernet203c0a96aa50
diff --git a/.github/workflows/termux-verify.yml b/.github/workflows/termux-verify.yml
index c314f46e34e..e8860b605f6 100644
--- a/.github/workflows/termux-verify.yml
+++ b/.github/workflows/termux-verify.yml
@@ -63,7 +63,22 @@ jobs:
run: |
bash scripts/termux/build_cpython.sh termux-build/payload
bash scripts/termux/build_uv.sh termux-build/payload
+ bash scripts/termux/termux_pkg_build.sh ffmpeg ffmpeg termux-build/payload
python3 scripts/termux/stage_runtime_libs.py termux-build/payload
+ - name: Verify ffmpeg on the bare bionic runtime
+ run: |
+ digest=$(python3 -c 'from pm.lock import termux_docker_digest; print(termux_docker_digest())')
+ docker run --rm --platform linux/arm64 --user 1000:1000 --network none \
+ -v "$PWD/termux-build/payload:/payload:ro" \
+ "termux/termux-docker@$digest" bash -c '
+ set -euo pipefail
+ export PREFIX=/data/data/com.termux/files/usr
+ export LD_LIBRARY_PATH="/payload/ffmpeg$PREFIX/lib:/payload/runtime-libs/lib:$PREFIX/lib"
+ "/payload/ffmpeg$PREFIX/bin/ffmpeg" -hide_banner \
+ -f lavfi -i anullsrc=r=16000:cl=mono -t 0.1 -f wav "$PREFIX/tmp/ffmpeg-proof.wav"
+ test -s "$PREFIX/tmp/ffmpeg-proof.wav"
+ printf "FFMPEG_BARE_RUNTIME_OK\n"
+ '
- name: Download the wheel from the confirmed failing build
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
diff --git a/hermes_cli/doctor.py b/hermes_cli/doctor.py
index d41cbc87c4f..b15690a0d71 100644
--- a/hermes_cli/doctor.py
+++ b/hermes_cli/doctor.py
@@ -6,6 +6,7 @@ Check bodies live in the ``doctor_*`` siblings.
import os
import sys
+from pathlib import Path
from hermes_cli.config import get_env_path, get_hermes_home, get_project_root
from hermes_cli.env_loader import load_hermes_dotenv
diff --git a/hermes_cli/doctor_platform.py b/hermes_cli/doctor_platform.py
index 9b1f7edf2da..1672a5931b0 100644
--- a/hermes_cli/doctor_platform.py
+++ b/hermes_cli/doctor_platform.py
@@ -367,6 +367,17 @@ def _check_security_advisories(should_fix: bool, f: Finding) -> None:
check_warn(f"{h.package}=={h.installed_version} still installed (advisory {h.advisory.id} acknowledged)")
+def _pm_venv_active() -> bool:
+ """A resident bundle can use its dependency tree without a venv interpreter."""
+ if sys.prefix != sys.base_prefix:
+ return True
+ from pm.lock import Facts
+ from pm.paths import store_root
+
+ store = store_root()
+ return bool(Facts(store / "facts.json").get("venv")) and (store.parent / "venv").is_dir()
+
+
@doctor_check()
def _check_python_environment(should_fix: bool, f: Finding) -> None:
"""Interpreter, linked SQLite, venv, macOS TCC anchors/FDA/grants, version-file drift."""
@@ -387,7 +398,7 @@ def _check_python_environment(should_fix: bool, f: Finding) -> None:
if src:
check_info(f"SQLite source id: {(src[:48] + '…') if len(src) > 48 else src}")
_report_database_journal_modes()
- check_bool(sys.prefix != sys.base_prefix, "Virtual environment active", ("Not in virtual environment", "(recommended)"))
+ check_bool(_pm_venv_active(), "Virtual environment active", ("Not in virtual environment", "(recommended)"))
# macOS TCC interpreter anchor (#95596): dylib-complete re-land of the mechanism reverted in #95563.
# Silent on non-macOS.
check_macos_tcc_anchor(should_fix=should_fix)
diff --git a/hermes_cli/doctor_state.py b/hermes_cli/doctor_state.py
index 940a5453277..abff43baa20 100644
--- a/hermes_cli/doctor_state.py
+++ b/hermes_cli/doctor_state.py
@@ -263,7 +263,7 @@ def _gh_authenticated() -> bool:
try:
result = subprocess.run(["gh", "auth", "status", "--json", "authenticated"], capture_output=True, timeout=10)
return result.returncode == 0
- except (FileNotFoundError, subprocess.TimeoutExpired):
+ except (OSError, subprocess.TimeoutExpired):
return False
diff --git a/scripts/termux/runtime_libs.json b/scripts/termux/runtime_libs.json
index 7f030f69aa9..0d19fbabbda 100644
--- a/scripts/termux/runtime_libs.json
+++ b/scripts/termux/runtime_libs.json
@@ -396,6 +396,11 @@
"url": "https://packages.termux.dev/apt/termux-main/pool/main/s/svt-av1/svt-av1_4.2.0_aarch64.deb",
"version": "4.2.0"
},
+ "vulkan-loader-generic": {
+ "sha256": "f830c374fae2b3d421de401185e4171ff52b706701a1d9e19ab17281a84893ac",
+ "url": "https://packages.termux.dev/apt/termux-main/pool/main/v/vulkan-loader-generic/vulkan-loader-generic_1.4.362_aarch64.deb",
+ "version": "1.4.362"
+ },
"xvidcore": {
"sha256": "2f358b11fd750935b43ac19f09bb7c4228e007079426e0b73ee8bae1ddf26fc1",
"url": "https://packages.termux.dev/apt/termux-main/pool/main/x/xvidcore/xvidcore_1.3.7-1_aarch64.deb",
diff --git a/tests/hermes_cli/test_doctor.py b/tests/hermes_cli/test_doctor.py
index e501d29db82..095051830a1 100644
--- a/tests/hermes_cli/test_doctor.py
+++ b/tests/hermes_cli/test_doctor.py
@@ -41,13 +41,11 @@ class TestDoctorPlatformHints:
assert "run `hermes update`" in hint
- def test_sqlite_upgrade_hint_apt_stamp_falls_back_to_generic_update(self):
- # The Termux 'apt' lane was removed; a legacy stamp now routes to the
- # generic `hermes update` path.
- hint = doctor._sqlite_upgrade_hint("apt")
+ def test_sqlite_upgrade_hint_uses_apt_remediation(self):
+ hint = doctor_platform._sqlite_upgrade_hint("apt")
- assert "run `hermes update`" in hint
- assert "pkg upgrade" not in hint
+ assert "pkg upgrade hermes-agent" in hint
+ assert "run `hermes update`" not in hint
def test_sqlite_upgrade_hint_preserves_nix_guidance_as_prose(self):
from hermes_cli.config import recommended_update_command_for_method
@@ -348,9 +346,10 @@ class TestDoctorMemoryProviderSection:
# when gh resolves to a Store/MSIX reparse-point shim. The gh-
# specific doctor behaviors have their own dedicated tests below,
# which mock gh explicitly.
- real_which = doctor_mod.shutil.which
+ import shutil
+ real_which = shutil.which
monkeypatch.setattr(
- doctor_mod.shutil,
+ shutil,
"which",
lambda cmd: None if cmd == "gh" else real_which(cmd),
)
@@ -1670,7 +1669,7 @@ class TestPmVenvActive:
monkeypatch.setattr(doctor_mod.sys, "prefix", "/usr")
monkeypatch.setattr(doctor_mod.sys, "base_prefix", "/usr")
- assert doctor_mod._pm_venv_active() is True
+ assert doctor_platform._pm_venv_active() is True
def test_no_venv_fact_falls_back_to_legacy_probe(self, tmp_path, monkeypatch):
monkeypatch.setenv("HERMES_RUNTIME_DIR", str(tmp_path / "no-such-store"))
@@ -1678,10 +1677,10 @@ class TestPmVenvActive:
monkeypatch.setattr(doctor_mod.sys, "prefix", "/usr")
monkeypatch.setattr(doctor_mod.sys, "base_prefix", "/usr")
- assert doctor_mod._pm_venv_active() is False
+ assert doctor_platform._pm_venv_active() is False
monkeypatch.setattr(doctor_mod.sys, "prefix", "/some/venv")
- assert doctor_mod._pm_venv_active() is True
+ assert doctor_platform._pm_venv_active() is True
def test_bundled_venv_fact_without_venv_dir_is_not_active(self, tmp_path, monkeypatch):
import json
@@ -1700,7 +1699,7 @@ class TestPmVenvActive:
monkeypatch.setattr(doctor_mod.sys, "prefix", "/usr")
monkeypatch.setattr(doctor_mod.sys, "base_prefix", "/usr")
- assert doctor_mod._pm_venv_active() is False
+ assert doctor_platform._pm_venv_active() is False
def test_run_doctor_reports_shadowed_lightpanda_engine(monkeypatch, tmp_path):
helper = TestDoctorMemoryProviderSection()
diff --git a/tests/tools/test_voice_mode.py b/tests/tools/test_voice_mode.py
index d4d0e6e78d3..1bbaf1943c9 100644
--- a/tests/tools/test_voice_mode.py
+++ b/tests/tools/test_voice_mode.py
@@ -199,6 +199,7 @@ class TestDetectAudioEnvironment:
assert result["warnings"] == []
assert any("SSH" in n for n in result.get("notices", []))
+ @pytest.mark.platforms("linux")
def test_wsl_without_pulse_blocks_voice(self, monkeypatch, tmp_path):
"""WSL without PULSE_SERVER should block voice mode."""
monkeypatch.delenv("SSH_CLIENT", raising=False)
diff --git a/tools/voice_mode.py b/tools/voice_mode.py
index 62d2fa4aa9a..58ae83d3e78 100644
--- a/tools/voice_mode.py
+++ b/tools/voice_mode.py
@@ -1166,7 +1166,8 @@ def transcribe_recording(wav_path: str, model: Optional[str] = None) -> Dict[str
Returns:
Dict with ``success``, ``transcript``, and optionally ``error``.
"""
- from tools.transcription_tools import MAX_FILE_SIZE, transcribe_audio
+ from tools.transcription_common import MAX_FILE_SIZE
+ from tools.transcription_tools import transcribe_audio
result = transcribe_audio(wav_path, model=model, source="voice_mode")