Files
zeekay acaeda400a Eradicate OpenClaw — resolve merge conflicts and finish the rebrand
Three coordinated things:

1. Resolve the committed upstream/main merge conflicts. 94 files were
   sitting with raw <<<<<<< HEAD ... >>>>>>> upstream/main blocks. Every
   conflict had HanzoBot/Bot on HEAD and OpenClaw on upstream. Resolved
   by keeping HEAD everywhere — 540 conflict blocks.

2. Rewrite remaining OpenClaw text refs.
     OPENCLAW   → HANZO_BOT
     OpenClaw   → HanzoBot          (PascalCase type identifiers)
     openclaw   → bot               (codebase convention — botToken,
                                    botUsername etc.; avoids invalid
                                    hyphenated JS identifiers)
     openclaw[_]/openclaw[A-Z] → bot[_]/bot[A-Z]   (compound)
     ai.openclaw.x → ai.hanzo.bot.x  (JVM package path)

3. Delete or rename openclaw-named file paths (116 of them). Dead
   duplicates with a Bot-named canonical from the partial migration:
   deleted. Otherwise renamed.
     ai/openclaw/**           → deleted (ai/hanzo/bot/** canonical)
     Sources/OpenClaw*/       → deleted (Sources/Bot* canonical)
     Tests/OpenClawIPCTests/  → deleted (Tests/BotIPCTests canonical)
     OpenClawKit/             → deleted (BotKit canonical)
     openclaw-tools.*.ts      → deleted (bot-tools.*.ts canonical)
     openclaw-root.ts etc.    → deleted (bot-root.ts canonical)
     types.openclaw.ts        → deleted (types.bot.ts canonical)
     extensions/*/openclaw.plugin.json → renamed hanzo-bot.plugin.json
     docs/start/openclaw.md   → renamed hanzo-bot.md (+ zh-CN)
     docs/assets/openclaw-*.png, whatsapp-openclaw*.jpg → deleted
     scripts/.../openclaw-*   → deleted (bot/hanzo-bot parallels)
     openclaw.mjs             → deleted (hanzo-bot.mjs is package.bin)

Then patched 65 broken JS/TS import strings where hanzo-bot had ended
up inside an import path ('./types.hanzo-bot.js' → './types.bot.js'
etc., since the on-disk filename uses the brand-neutral bot- prefix).

Pre-existing lint debt cleaned up to get oxlint --type-aware to 0/0:
removed the dead i18n test that referenced a path no longer existing;
defined the missing DIDConfig and WalletConfig types in types.base.ts
(they were imported but never declared); dropped unused imports;
collapsed redundant type assertion and a tautological meta.bot lookup
that the openclaw→bot rename made redundant.

The a2ui.bundle.js generated artifact is kept at its pre-rebrand
contents — it gets regenerated by 'pnpm canvas:a2ui:bundle' from
sources I cannot rebuild in this commit; the source side is clean.

Verified: 0 occurrences of openclaw (case-insensitive) in tree source
content, 0 file or directory paths with openclaw in the name; oxlint
--type-aware src test reports 0/0.
2026-05-11 17:56:29 -07:00

1.8 KiB

read_when, summary, title, x-i18n
read_when summary title x-i18n
运行或调试 Gateway 网关进程
调查单实例强制执行
使用 WebSocket 监听器绑定的 Gateway 网关单例保护 Gateway 网关锁
generated_at model provider source_hash source_path workflow
2026-02-03T07:47:52Z claude-opus-4-5 pi 15fdfa066d1925da8b4632073a876709f77ca8d40e6828c174a30d953ba4f8e9 gateway/gateway-lock.md 15

Gateway 网关锁

最后更新:2025-12-11

原因

  • 确保同一主机上每个基础端口只运行一个 Gateway 网关实例;额外的 Gateway 网关必须使用隔离的配置文件和唯一的端口。
  • 在崩溃/SIGKILL 后不留下过时的锁文件。
  • 当控制端口已被占用时快速失败并给出清晰的错误。

机制

  • Gateway 网关在启动时立即使用独占 TCP 监听器绑定 WebSocket 监听器(默认 ws://127.0.0.1:18789)。
  • 如果绑定因 EADDRINUSE 失败,启动会抛出 GatewayLockError("another gateway instance is already listening on ws://127.0.0.1:<port>")。
  • 操作系统在任何进程退出时(包括崩溃和 SIGKILL)自动释放监听器——不需要单独的锁文件或清理步骤。
  • 关闭时,Gateway 网关关闭 WebSocket 服务器和底层 HTTP 服务器以及时释放端口。

错误表面

  • 如果另一个进程持有端口,启动会抛出 GatewayLockError("another gateway instance is already listening on ws://127.0.0.1:<port>")。
  • 其他绑定失败会显示为 GatewayLockError("failed to bind gateway socket on ws://127.0.0.1:<port>: …")。

运维说明

  • 如果端口被另一个进程占用,错误是相同的;释放端口或使用 hanzo-bot gateway --port <port> 选择另一个端口。
  • macOS 应用在启动 Gateway 网关之前仍维护自己的轻量级 PID 保护;运行时锁由 WebSocket 绑定强制执行。