Bug Description
POST /api/v1/admin/restart is self-destructive on Windows: the daemon always dies and is never replaced, leaving the Memory Viewer unreachable.
Flow in server/routes/admin.ts:
terminateHermesChat() runs pkill -TERM -f "/bin/hermes" / "hermes chat" — pkill does not exist on Windows, so this returns false and does nothing (silently).
spawnReplacementDaemon() runs bash -c "sleep 3 && <node> <tsx> bridge.cts --daemon" — bash/tsx are not reliably available on Windows (and tsx lives in devDependencies, absent from the published package).
scheduleHermesShutdown(200) then sends SIGTERM to its own PID after 200 ms — this always succeeds.
Net result: the original daemon is killed 200 ms after the restart request and the replacement never comes up, so the viewer port goes silent. This also happens if the user only saves settings, because SettingsView.tsx triggers the restart overlay after save.
Steps to Reproduce
- Windows host, memos-local-plugin running under Hermes.
- Open viewer → Settings → save any change (or click the restart prompt).
- Viewer becomes unreachable; the daemon process exits and nothing replaces it.
Expected Behavior
On Windows, restart should either (a) work — spawn a replacement via cmd.exe/PowerShell or a Windows-friendly mechanism — or (b) degrade gracefully: tell the user to restart Hermes instead of killing the daemon.
Suggested Fix
- Detect
process.platform === "win32" and skip the pkill/bash replacement path; either restart in-process or instruct the user to restart the host agent.
- Only self-terminate after a replacement is confirmed listening (or skip the 200 ms suicide entirely).
Related
Environment
- OS: Windows
- Plugin: memos-local-plugin 2.0.12 (Hermes adapter)
Bug Description
POST /api/v1/admin/restartis self-destructive on Windows: the daemon always dies and is never replaced, leaving the Memory Viewer unreachable.Flow in
server/routes/admin.ts:terminateHermesChat()runspkill -TERM -f "/bin/hermes"/"hermes chat"—pkilldoes not exist on Windows, so this returns false and does nothing (silently).spawnReplacementDaemon()runsbash -c "sleep 3 && <node> <tsx> bridge.cts --daemon"—bash/tsxare not reliably available on Windows (andtsxlives in devDependencies, absent from the published package).scheduleHermesShutdown(200)then sendsSIGTERMto its own PID after 200 ms — this always succeeds.Net result: the original daemon is killed 200 ms after the restart request and the replacement never comes up, so the viewer port goes silent. This also happens if the user only saves settings, because
SettingsView.tsxtriggers the restart overlay after save.Steps to Reproduce
Expected Behavior
On Windows, restart should either (a) work — spawn a replacement via
cmd.exe/PowerShell or a Windows-friendly mechanism — or (b) degrade gracefully: tell the user to restart Hermes instead of killing the daemon.Suggested Fix
process.platform === "win32"and skip the pkill/bash replacement path; either restart in-process or instruct the user to restart the host agent.Related
Environment