Skip to content

Bug: admin/restart is self-destructive on Windows (pkill/bash/tsx unavailable, daemon always killed) #2213

Description

@asorry75

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:

  1. terminateHermesChat() runs pkill -TERM -f "/bin/hermes" / "hermes chat"pkill does not exist on Windows, so this returns false and does nothing (silently).
  2. 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).
  3. 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

  1. Windows host, memos-local-plugin running under Hermes.
  2. Open viewer → Settings → save any change (or click the restart prompt).
  3. 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)

Metadata

Metadata

Labels

ai:pr-readyAI-created PR is ready for review | AI 生成的 PR 已等待评审area:pluginOpenClaw & Hermesstatus:in-progressSomeone or AI is working on it | 人工或 AI 正在处理types:bugSomething isn't working | 功能异常

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions