perf(termux): speed up tui cold start#29419
Merged
Merged
Conversation
Contributor
🔎 Lint report:
|
19 tasks
1 task
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.
Salvage of #29404 by @adybag14-cyber onto current main.
Summary
Termux-gated cold-start optimizations. Desktop/CI startup paths are unchanged.
Changes
hermes_cli/main.py: new_is_termux_startup_environment()helper; model catalog top-level import (from hermes_cli.models import _PROVIDER_MODELS) deferred on Termux into the handlers that need it (kept eager on desktop/CI); new_tui_need_rebuild()mtime check on TUI source/config inputs; Termux skipsnpm run buildwhendist/entry.jsis fresh; new_try_termux_fast_tui_launch()parses lightweight top-level parser for unambiguoushermes --tui/hermes chat --tuibefore building the full subparser tree;migrateadded to_BUILTIN_SUBCOMMANDS.test_tui_npm_install.py(build-skip freshness, Termux-only gating, desktop always-builds),test_tui_resume_flow.py(fast-launch happy path, help fallback, non-Termux fallback).Validation
test_tui_npm_install.py+test_tui_resume_flow.py+test_startup_plugin_gating.py).python -m hermes_cli.main --versionon desktop unchanged.hermes_cli.models) pullsrequests(~29ms) +agent.models_dev(~42ms) viapython -X importtimeon desktop; on a Pixel 5 Termux this is the load-bearing piece for the barehermesCLI startup win.Note
Closes #29404. Reported by community user on Termux/Android (Pixel 5) — "hermes" command takes 10-15s to start. The fast TUI launch path only helps
--tuiinvocations; barehermes/hermes chatstartup benefits from the model catalog deferral only (~500ms-1s win, not a full fix for 15s startup).Infographic