perf(termux): fast-path cli version startup#30521
Closed
adybag14-cyber wants to merge 2 commits into
Closed
Conversation
Contributor
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.
What does this PR do?
This PR speeds up Termux non-TUI CLI startup in two places:
hermes --version,hermes -V, andhermes versionnow use a pre-importTermux fast path.
hermesnow reaches the classic non-TUI prompt first, thendefers agent-only discovery until the first submitted turn.
The bare
hermespath is the real end-to-end prompt startup path, not aversion-check proxy. It still launches the Python console entry point, imports
the CLI, renders the compact startup UI, initializes prompt-toolkit, and waits
for the input prompt marker.
Why this approach:
tool counts, scan skill commands, initialize tool callbacks, or check terminal
command security before the user has typed anything.
the first submitted message keeps the same agent behavior.
HERMES_TERMUX_DISABLE_FAST_CLI=1.Related Issue
Issue filed on discord by @likiuslnik https://discord.com/channels/1053877538025386074/1507281286073417798
Related PRs found during duplicate check:
perf(termux): speed up non-tui cli startup) was closed.perf(termux): speed up tui cold start) was merged.perf(termux): speed up tui cold start) was closed.Type of Change
Changes Made
hermes_cli/main.pyhermesuse compact startup UI.chat -qpaths.cli.pywhen
HERMES_DEFER_AGENT_STARTUP=1.tests/hermes_cli/test_tui_resume_flow.pyhermesdefers agent startup and enablescompact fast startup.
How to Test
Run syntax, lint, whitespace, and compatibility checks:
Run focused tests:
Measure full bare
hermesprompt readiness with a PTY and CPU pinning:/data/data/com.termux/files/home/.hermes/hermes-agent/.venv/bin/hermeswith
PYTHONPATHpointing at this branch.taskset -c <cpu>.Welcome to Hermes Agentand the prompt marker�have appeared.Results
Test platform:
6.6.92-android15-8-g3637f4904cf5-ab13944661-4k3.11.100.14.00.15.10Validation:
py_compilepassed for changed Python files.ruff check hermes_cli/main.py cli.py tests/hermes_cli/test_tui_resume_flow.pypassed.
git diff --checkpassed.python scripts/check-windows-footguns.py hermes_cli/main.py cli.py tests/hermes_cli/test_tui_resume_flow.pypassed.
97 passed, 0 failed.Performance:
hermesPTY startup-to-prompt measurement was about5.079soncpu4.hermesbaseline before this second pass was about2.90son
cpu4.hermesprompt readiness on the slowest measuredcore in this run:
cpu0final avg0.814466s0.805957s0.827856s0.809 0.816 0.819 0.806 0.815 0.814 0.809 0.828 0.814 0.813cpu0: avg0.825642s, max0.878412scpu1: avg0.808882s, max0.812983scpu2: avg0.811985s, max0.818701scpu3: avg0.813983s, max0.818755scpu4: avg0.806089s, max0.818785scpu5: avg0.809485s, max0.817154scpu6: avg0.584450s, max0.590861scpu7: avg0.580315s, max0.580855s0.05starget on efficiencycores from the earlier validation: worst-core
cpu4avg0.037920s, max0.041s.Checklist
Code
pytest tests/ -qand all tests pass.Documentation & Housekeeping
cli-config.yaml.exampleupdate: N/A, no config keys added.CONTRIBUTING.md/AGENTS.mdupdate: N/A, no workflow policy changed.regular desktop startup remains unchanged.
For New Skills
N/A.
Screenshots / Logs
Focused test output:
Worst-core bare prompt timing: