fix(maintenance): cleanly stop, rebuild and restart hermes-builtin-ui during agent updates

This commit is contained in:
Hitonabi
2026-07-07 17:25:35 +02:00
parent 6f77dbb9d9
commit 989b6de850
+16 -5
View File
@@ -702,14 +702,25 @@ def hermes_update_job() -> dict:
py = os.path.join(path, "venv", "bin", "python") py = os.path.join(path, "venv", "bin", "python")
backup = os.path.join(_REPO_ROOT, "deploy", "backup.sh") backup = os.path.join(_REPO_ROOT, "deploy", "backup.sh")
postcheck = os.path.join(_REPO_ROOT, "deploy", "hermes-postcheck.sh") postcheck = os.path.join(_REPO_ROOT, "deploy", "hermes-postcheck.sh")
# Backup → update → Gateway-Neustart → Gehirn-Check (Job wird rot, wenn Mem0/Plugin kaputt). # Backup → Stop UI (verhindert Crash durch Löschen der Sourcen) → update → doctor →
# Backup → update → doctor (Config/Deps-Diagnose der NEUEN Version) → Gateway-Neustart → # UI-Build mit MC2-Basepath (/hermes-ui/) → Gateway + UI-Neustart → Smoke-Test.
# Gehirn-Check (erweitert um Config-Drift-Scan, Tool- und Voice-Smoke — Lehre aus v0.18: hui_web = os.path.join(path, "web")
# 'approvals.mode auto' wurde still ungültig und legte alle Tools in pending_approval). hui_dist = os.path.join(path, "hermes_cli", "web_dist")
npm_path = os.path.expanduser("~/.hermes/node/bin")
build_cmd = (
f"if [ -d {hui_web} ]; then "
f"cd {hui_web} && PATH={npm_path}:$PATH npx --no-install vite build --base=/hermes-ui/ --outDir /tmp/h-build --emptyOutDir "
f"&& rm -rf {hui_dist} && cp -r /tmp/h-build {hui_dist}; fi"
)
cmd = (f"bash {backup} || true; " cmd = (f"bash {backup} || true; "
f"systemctl --user stop hermes-builtin-ui || true; "
f"cd {path} && {py} -m hermes_cli.main update --yes " f"cd {path} && {py} -m hermes_cli.main update --yes "
f"&& {py} -m hermes_cli.main doctor " f"&& {py} -m hermes_cli.main doctor "
f"&& systemctl --user restart hermes-gateway " f"&& {build_cmd} "
f"&& systemctl --user reset-failed hermes-builtin-ui || true; "
f"systemctl --user restart hermes-gateway hermes-builtin-ui "
f"&& sleep 6 && bash {postcheck}") f"&& sleep 6 && bash {postcheck}")
def on_done(): def on_done():