mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-18 04:41:56 +00:00
fix(dashboard): validate dist exists when --skip-build is set
Follow-up to PR #23824. Adds two correctness fixes on top of the contributor's salvaged commit: 1. Stale-dist fallback no longer gated on `fatal=False`. `cmd_dashboard` passes `fatal=True` and is the primary scenario this fallback is for (issue #23817 — Windows Scheduled Task at logon). The previous gate meant the fallback never fired in the case it was designed for. 2. `--skip-build` now verifies the dist actually exists before starting the server. Without this, a misconfigured pre-build would launch the dashboard pointing at a missing dist and silently serve 404s. We now exit 1 with a clear "pre-build first: cd web && npm run build" message, and on success print which dist directory is being used. Verified end-to-end on Linux: - build fails + stale dist (fatal=True) -> fallback fires - build fails + no dist (fatal=True) -> exit 1 with stderr surfaced - build fails + stale dist (fatal=False) -> fallback fires - --skip-build + missing dist -> exit 1 with clear guidance - --skip-build + valid dist -> 'Skipping web UI build...'
This commit is contained in:
parent
7085f4e238
commit
283381b1ce
2 changed files with 76 additions and 0 deletions
|
|
@ -9120,6 +9120,21 @@ def cmd_dashboard(args):
|
|||
if "HERMES_WEB_DIST" not in os.environ and not getattr(args, "skip_build", False):
|
||||
if not _build_web_ui(PROJECT_ROOT / "web", fatal=True):
|
||||
sys.exit(1)
|
||||
elif getattr(args, "skip_build", False):
|
||||
# --skip-build trusts the caller to have pre-built the web UI.
|
||||
# Verify the dist actually exists; otherwise the server will start
|
||||
# and serve 404s with no obvious cause (issue #23817).
|
||||
_dist_root = (
|
||||
Path(os.environ["HERMES_WEB_DIST"])
|
||||
if "HERMES_WEB_DIST" in os.environ
|
||||
else PROJECT_ROOT / "hermes_cli" / "web_dist"
|
||||
)
|
||||
if not (_dist_root / "index.html").exists():
|
||||
print(f"✗ --skip-build was passed but no web dist found at: {_dist_root}")
|
||||
print(" Pre-build first: cd web && npm install && npm run build")
|
||||
print(" Or drop --skip-build to build automatically.")
|
||||
sys.exit(1)
|
||||
print(f"→ Skipping web UI build (--skip-build); using dist at {_dist_root}")
|
||||
|
||||
from hermes_cli.web_server import start_server
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue