Skip to content

fix(cli): skip web UI rebuild when dist is fresh (salvage #15863, closes #14898)#16292

Merged
teknium1 merged 2 commits into
mainfrom
hermes/hermes-5de18fdc
Apr 27, 2026
Merged

fix(cli): skip web UI rebuild when dist is fresh (salvage #15863, closes #14898)#16292
teknium1 merged 2 commits into
mainfrom
hermes/hermes-5de18fdc

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Stops hermes dashboard from running npm 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 used web_dir / "dist" as the sentinel path, but web/vite.config.ts sets outDir: "../hermes_cli/web_dist" — the build output never lands in web/dist/. The sentinel was always missing, so the check always returned True and the full rebuild still ran. #15863 uses the correct web_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 is hermes_cli/web_dist/.vite/manifest.json, falls back to index.html. Walks web/ for .ts/.tsx/.js/.jsx/.css/.html/.vue newer than the sentinel; also checks package.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

Before After
hermes dashboard startup on low-memory VPS Full npm install + Vite build every time, ~388 MB peak → systemd OOM-kill Skipped when hermes_cli/web_dist/.vite/manifest.json is newer than all web sources
Targeted tests 11/11 pass (including test_web_dist_dir_not_web_dist_subdir regression guard)
E2E with real layout Missing dist → rebuilds; fresh dist → skips; source bump → rebuilds; wrong-dir dist (the #14914 mistake) → still detected as missing and rebuilds correct dir

Closes #14898. Credit to @georgeglessner (original reporter + fix). @nftpoetrist's #14914 was the right idea with a wrong path; acknowledged in the salvage.

George Glessner and others added 2 commits April 26, 2026 18:39
_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
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.

Dashboard rebuilds web UI on every startup - causes OOM on low-memory VPS (≤1GB)

1 participant