fix(cli): skip web UI rebuild when dist is fresh (salvage #15863, closes #14898)#16292
Merged
Conversation
_web_ui_build_needed() in PR #14914 checked web_dir/"dist" as the sentinel, but vite.config.ts sets outDir: "../hermes_cli/web_dist" so the build output lands in hermes_cli/web_dist/, never in web/dist/. The sentinel was therefore always missing → _web_ui_build_needed always returned True → npm install + Vite build ran on every startup → OOM on low-memory VPS persisted unchanged. Fix: derive dist_dir as web_dir.parent / "hermes_cli" / "web_dist" so the sentinel points to the actual build output directory. Fixes #14898
This was referenced Apr 27, 2026
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.
Stops
hermes dashboardfrom runningnpm install+ Vite build on every startup when the dist is already fresh, so low-memory VPS installs (≤1 GB RAM) no longer get systemd-OOM-killed before the server can start. Closes #14898.Straight cherry-pick of #15863 by @georgeglessner (the reporter of #14898), clean against current main.
Why this over #14914
Both PRs add the same
_web_ui_build_needed()mtime check. #14914 usedweb_dir / "dist"as the sentinel path, butweb/vite.config.tssetsoutDir: "../hermes_cli/web_dist"— the build output never lands inweb/dist/. The sentinel was always missing, so the check always returned True and the full rebuild still ran. #15863 uses the correctweb_dir.parent / "hermes_cli" / "web_dist"path and includes a dedicated regression test (test_web_dist_dir_not_web_dist_subdir) that would have caught the #14914 bug.#14918 (MANIFEST.in graft for sdist packaging) targets a different issue (#14880) and is out of scope for this fix.
Changes
hermes_cli/main.py: new_web_ui_build_needed(web_dir)helper — sentinel ishermes_cli/web_dist/.vite/manifest.json, falls back toindex.html. Walksweb/for.ts/.tsx/.js/.jsx/.css/.html/.vuenewer than the sentinel; also checkspackage.json, lockfiles,vite.config.*. Early-return guard added to_build_web_ui().tests/hermes_cli/test_web_ui_build.py(new, 121 LOC): 11 tests — missing dist, stale sources, fresh dist, sentinel fallback, lockfile changes, vite config changes, node_modules exclusion, wrong-dir regression guard, npm skip, npm run.Validation
hermes dashboardstartup on low-memory VPSnpm install+ Vite build every time, ~388 MB peak → systemd OOM-killhermes_cli/web_dist/.vite/manifest.jsonis newer than all web sourcestest_web_dist_dir_not_web_dist_subdirregression guard)Closes #14898. Credit to @georgeglessner (original reporter + fix). @nftpoetrist's #14914 was the right idea with a wrong path; acknowledged in the salvage.