fix(cli): skip web UI rebuild when dist/ is present and sources are unchanged#14914
Closed
nftpoetrist wants to merge 1 commit into
Closed
Conversation
…nchanged _build_web_ui() ran npm install + npm run build unconditionally on every hermes dashboard startup. On low-memory hosts (≤1GB RAM) the Node build process peaked at ~388MB and was OOM-killed by systemd before the server could start. Docker installs hit the same root cause when overlayfs blocked the npm install on a read-only layer. Adds _web_ui_build_needed() that mirrors the mtime-based staleness check already used by _tui_build_needed() for the TUI. The Vite manifest (dist/.vite/manifest.json) is used as the sentinel — it is written last and therefore has the newest mtime of any build artifact. Falls back to dist/index.html for older builds. Rebuild is triggered when any tracked source file (.ts, .tsx, .js, .jsx, .css, .html, .vue) or dependency manifest (package.json, package-lock.json, yarn.lock, pnpm-lock.yaml, vite.config.*) is newer than the sentinel. Fixes NousResearch#14898 Fixes NousResearch#12243
teknium1
pushed a commit
that referenced
this pull request
Apr 27, 2026
_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
Contributor
|
Superseded by #16292 (salvaged @georgeglessner's #15863). Your PR had the right idea — the mtime-based staleness check is exactly the approach — but the sentinel path was |
ulasbilgen
pushed a commit
to ulasbilgen/hermes-adhd-agent
that referenced
this pull request
May 1, 2026
_web_ui_build_needed() in PR NousResearch#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 NousResearch#14898
donald131
pushed a commit
to donald131/hermes-agent
that referenced
this pull request
May 2, 2026
_web_ui_build_needed() in PR NousResearch#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 NousResearch#14898
02356abc
pushed a commit
to 02356abc/hermes-agent
that referenced
this pull request
May 14, 2026
_web_ui_build_needed() in PR NousResearch#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 NousResearch#14898
dannyJ848
pushed a commit
to dannyJ848/hermes-agent
that referenced
this pull request
May 17, 2026
_web_ui_build_needed() in PR NousResearch#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 NousResearch#14898
gweeteve
pushed a commit
to gweeteve/hermes-agent
that referenced
this pull request
Jun 2, 2026
_web_ui_build_needed() in PR NousResearch#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 NousResearch#14898
Egavasyug
pushed a commit
to Egavasyug/hermes-agent
that referenced
this pull request
Jun 10, 2026
_web_ui_build_needed() in PR NousResearch#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 NousResearch#14898
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?
`_build_web_ui()` ran `npm install` + `npm run build` unconditionally on every `hermes dashboard` startup. On low-memory hosts (≤1GB RAM) the Node build process peaked at ~388MB and was OOM-killed by systemd before the server could start. Docker installs hit the same root cause when overlayfs blocked `npm install` on a read-only layer.
Parity fix: adds `_web_ui_build_needed()` that mirrors the mtime-based staleness check already used by `_tui_build_needed()` for the TUI. The Vite manifest (`dist/.vite/manifest.json`) is used as the sentinel — it is written last and therefore has the newest mtime of any build artifact. Falls back to `dist/index.html` for older builds. Rebuild is triggered when any tracked source file (`.ts`, `.tsx`, `.js`, `.jsx`, `.css`, `.html`, `.vue`) or dependency manifest (`package.json`, `package-lock.json`, `yarn.lock`, `pnpm-lock.yaml`, `vite.config.*`) is newer than the sentinel. When `dist/` is absent the existing build path runs unchanged.
Related Issue
Fixes #14898
Fixes #12243
Type of Change
Changes Made
How to Test
All 9 tests pass. To verify end-to-end: run `hermes dashboard` once to build, then run again — the second startup should skip the npm build entirely.
Checklist
Code
pytest tests/hermes_cli/test_web_ui_build.py -vand all 9 tests passDocumentation & Housekeeping