Webhook Wake Mechanism Details

Gateway 平滑重启(2026-10-26 修正)

Linux 的 Soma、Alaya、Manas 已配置 ExecReload=/bin/kill -USR1 $MAINPID 与 Restart=always。从 Discord 使用原生 /restart,或请求 Hermes 执行:

systemctl --user reload hermes-gateway-soma.service

按明确目标替换 profile;自己的当前轮发送请求后结束,gateway 收尾退出,由 systemd 拉起新进程。不要在自身 gateway 内使用 direct restart/stop、delegate_task 或 nohup 包装绕过守卫。请求返回成功不代表 Discord 已连接;完整验收与本次修复见 运维规则 A2。

此命令仅适用于已核对 ExecReload 的 Linux 用户服务;Windows 的 NSSM / 直接启动进程需另查各自的服务管理入口,本次没有验证 Windows 自重启。

Pitfalls

  1. --deliver and --deliver-chat-id are separate flags (not discord:chatid)
  2. Python urllib.request required for HMAC (curl encoding differs)
  3. Webhook secret regenerates on every subscribe
  4. Config changes need gateway restart to take effect
  5. Windows nssm services run as SYSTEM - cannot kill from WSL
  6. Use WMI Terminate method for orphan gateway processes

Cross-Platform Management

WSL

  • systemctl —user for all services
  • Gateway 启动器以各服务的实时 ExecStart 为准;Soma 当前使用固定源码的官方 .hermes/bin/hermes,不能统一硬编码旧 venv。
  • Profiles at ~/.hermes/profiles//

Windows

  • Mano: nssm service Hermes-Mano-Gateway (SYSTEM context)
  • Anchor: direct spawn via hermes --profile anchor gateway start
  • Hermes CLI: C:\Users\yunlu\miniconda3\Scripts\hermes.exe
  • Config: %LOCALAPPDATA%\hermes\profiles\<name>\config.yaml
  • PowerShell access from WSL: powershell.exe -Command "..."
  • Process kill: Invoke-CimMethod -InputObject $proc -MethodName Terminate

2026-10-09 Codex 审阅说明

nohup 不改变 cgroup 成员身份,停止父服务仍可能终止后台回调。HMAC 需要签名与发送完全相同的原始字节,JSON 格式化差异会改变签名;并不必然只能用 Python,curl —data-binary 配合正确生成的签名也能保持字节。配置是否需要重启取决于读取实现;Windows/WSL 跨进程终止受实际权限影响。

核验依据:systemd KillMode 说明;Linux cgroup v2。