Skip to content

fix(browser): add termux PATH fallbacks#7603

Closed
adybag14-cyber wants to merge 1 commit into
NousResearch:mainfrom
adybag14-cyber:fix/issue-5845-termux-browser-path
Closed

fix(browser): add termux PATH fallbacks#7603
adybag14-cyber wants to merge 1 commit into
NousResearch:mainfrom
adybag14-cyber:fix/issue-5845-termux-browser-path

Conversation

@adybag14-cyber

Copy link
Copy Markdown
Contributor

What does this PR do?

This PR fixes browser_tool on Android/Termux by restoring the Termux-specific PATH entries needed by agent-browser subprocesses.

Before this change, browser command discovery and subprocess execution used different fallback PATH logic. The subprocess path rebuild only included Homebrew/system directories, so it dropped Termux paths like /data/data/com.termux/files/usr/bin and /data/data/com.termux/files/usr/sbin. On Android, that breaks the agent-browsergrun handoff and causes browser commands to fail even when the required binaries are installed.

This fix keeps the change minimal and targeted:

  • add Termux fallback PATH directories alongside the existing Homebrew/system fallbacks
  • centralize browser PATH fallback assembly so discovery and subprocess execution use the same logic
  • add focused regression tests covering Termux fallback lookup and subprocess PATH propagation

Related Issue

Fixes #5845

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • tools/browser_tool.py
    • added Termux PATH fallback directories
    • introduced shared browser PATH helpers used by both CLI discovery and subprocess execution
    • updated _find_agent_browser() to search the merged fallback PATH
    • updated _run_browser_command() to build subprocess PATH from the same merged helper
  • tests/tools/test_browser_homebrew_paths.py
    • added regression coverage for Termux fallback dirs in _SANE_PATH
    • added regression coverage for npx discovery via Termux fallback dirs
    • added regression coverage for subprocess PATH propagation on Termux

How to Test

  1. On Termux/Android, ensure agent-browser and its Android runtime dependencies are installed.
  2. Run:
    source /data/data/com.termux/files/home/.hermes/hermes-agent/.venv/bin/activate && python -m pytest tests/tools/test_browser_homebrew_paths.py -q
  3. Verify the new Termux-specific tests pass and that browser subprocess PATH construction includes /data/data/com.termux/files/usr/bin.

Screenshots / Logs

Targeted validation run:

  • 21 passed in 1.82s

@gut-puncture

@adybag14-cyber

Copy link
Copy Markdown
Contributor Author

@kaan-escober

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for this contribution, @adybag14-cyber! The Termux PATH fix has already landed on main and shipped.

Automated hermes-sweeper review found that this PR's changes are already implemented:

  • _SANE_PATH_DIRS with Termux entries (/data/data/com.termux/files/usr/bin, /data/data/com.termux/files/usr/sbin) — tools/browser_tool.py line 99
  • _browser_candidate_path_dirs() and _merge_browser_path() helpers centralizing PATH construction
  • Both _find_agent_browser() and _run_browser_command() using _merge_browser_path()
  • Regression tests in tests/tools/test_browser_homebrew_paths.py covering all three scenarios

All of this landed in commit 56c34ac (fix(browser): add termux PATH fallbacks, cherry-picked from PR #9846) and shipped in v2026.4.16. Closing as implemented_on_main.

@teknium1 teknium1 closed this Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

browser_tool: _SANE_PATH missing Termux paths breaks browser on Android

2 participants