fix(maintenance): cleanly stop, rebuild and restart hermes-builtin-ui during agent updates
This commit is contained in:
@@ -702,14 +702,25 @@ def hermes_update_job() -> dict:
|
||||
py = os.path.join(path, "venv", "bin", "python")
|
||||
backup = os.path.join(_REPO_ROOT, "deploy", "backup.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 → update → doctor (Config/Deps-Diagnose der NEUEN Version) → Gateway-Neustart →
|
||||
# Gehirn-Check (erweitert um Config-Drift-Scan, Tool- und Voice-Smoke — Lehre aus v0.18:
|
||||
# 'approvals.mode auto' wurde still ungültig und legte alle Tools in pending_approval).
|
||||
# Backup → Stop UI (verhindert Crash durch Löschen der Sourcen) → update → doctor →
|
||||
# UI-Build mit MC2-Basepath (/hermes-ui/) → Gateway + UI-Neustart → Smoke-Test.
|
||||
hui_web = os.path.join(path, "web")
|
||||
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; "
|
||||
f"systemctl --user stop hermes-builtin-ui || true; "
|
||||
f"cd {path} && {py} -m hermes_cli.main update --yes "
|
||||
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}")
|
||||
|
||||
def on_done():
|
||||
|
||||
Reference in New Issue
Block a user