fix: support channel-message API and normalize context-token peer IDs - #51
Conversation
…alization (v3.0.3) - channel-runtime import moved to channel-message (beta.x removed the old entry; createTypingCallbacks signature unchanged) - contextTokenKey normalizes user IDs to lowercase (sendMessage ret=-3 after gateway restart, refs Tencent/openclaw-weixin#243) - ret=-2 prepare failed: actionable diagnostic hint 571/571 tests pass.
There was a problem hiding this comment.
Pull request overview
Improves OpenClaw beta compatibility, context-token lookup reliability, and outbound failure diagnostics.
Changes:
- Moves typing callbacks to the supported SDK entry point.
- Normalizes context-token user IDs.
- Adds diagnostics and bumps the release to 3.0.3.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
src/messaging/process-message.ts |
Updates the SDK import. |
src/messaging/inbound.ts |
Normalizes token lookup keys. |
src/api/api.ts |
Expands failure diagnostics. |
src/api/api.test.ts |
Tests the diagnostic hint. |
package.json |
Bumps package version. |
package-lock.json |
Synchronizes package version. |
openclaw.plugin.json |
Synchronizes plugin version. |
CHANGELOG.md |
Documents the release in Chinese. |
CHANGELOG_EN.md |
Documents the release in English. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
生产侧复核(OpenClaw
|
| 改动 | 看法 |
|---|---|
createTypingCallbacks → channel-message |
✅ 必要;与我们生产热补丁同路径。请同步改 process-message.test.ts 的 mock(仍 mock channel-runtime,测不到这条边界)。 |
contextTokenKey 统一 userId.toLowerCase() |
✅ 高价值。多账号个微也见过出站 ret=-2/-3 / token 对不上。请补 mixed-case 写入 / lowercase 读出(含重启恢复) 回归(Copilot 已点)。 |
ret=-2 prepare failed 文案 |
|
版本撞到 3.0.3 |
同意维护者:别在功能 PR 里改 version,交给自动 release。 |
我们愿意做的实测(维护窗)
若本 PR 按上面补齐测试且不带版本号 bump,我们计划在旁路/金丝雀上:
openclaw plugins install npm:openclaw-weixin --force(或装本分支 pack)到2026.7.2-beta.6宿主- 确认 无需 再跑
channel-runtimesed 补丁 - 多账号:入站 → 出站、gateway 重启后出站(验证 token 大小写)、长工具回合不丢轮询
结论:该合,但建议先按 CHANGES_REQUESTED 补测试矩阵 + changelog/版本约定,再合。 修复点本身是社区 fork 相对官方停更包的关键差异。
ericcaiwx-star
left a comment
There was a problem hiding this comment.
Collaborator follow-up (no merge from me)
Head is still 29f0ad9; none of the previously requested changes have landed yet. From a production-operator + collaborator view, I’d keep this blocked until the following are addressed (overlap with @NewFuture / Copilot / my earlier thread comment):
Still blocking
- Drop the
3.0.3version bump (package.json/ lockfile /openclaw.plugin.json/ dated changelog section). Put the notes under未发布/Unreleasedand let the maintainer release flow own the version. - Real host-compat evidence for
channel-message, not only a mock swap — matrix / import smoke on min host (2026.6.1) and a2026.7.2-beta.x(or newest SDK that droppedchannel-runtime). Our deploy still sed-patches official2.4.6for exactly this crash loop; CI today cannot prove the beta path. - Regression for mixed-case OpenID → lowercase lookup (store + restart restore) in
context-token-storetests — this is the #243 class failure. - Soften the ret=-2 prepare failed hint so it does not claim “fresh inbound always fixes it” when #244-style empty
getUpdates/ server bot state is in play.
Non-blocking / process
- Changelog section order: keep
未发布/Unreleasedfirst. - Update
process-message.test.tsmock path when the import moves (still useful, but insufficient alone).
Happy to re-check and help canary on 2026.7.2-beta.6 multi-account once the above is pushed. Merge decision stays with @NewFuture.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
NewFuture
left a comment
There was a problem hiding this comment.
已基于最新 main 完成重写:保留自动 release 版本管理,补齐 mixed-case/restart/legacy persistence 回归,并用最低、lockfile 与 modern API profile 的真实 SDK 完成 channel-message 构建和无 mock import/registration smoke。全部 CI 与 review threads 已处理。
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.
Suppressed comments (2)
src/messaging/context-token-store.test.ts:115
- This assertion does not exercise the new path redaction: a JSON parse error contains neither the account ID nor the state-file path, so the test still passes if
formatContextTokenStoreErroris removed. Add a filesystem failure whose message embedsfilePath, then assert that the warning contains<state-file>and omits both the raw path and account ID.
expect(mocks.logger.warn.mock.calls.flat().join(" ")).not.toContain("account-invalid");
.github/workflows/ci.yml:138
- The modern profile builds
dist/index.jsbefore installingopenclaw@beta, so the later registration smoke imports output compiled against the lockfile SDK. Only the isolatedprocess-messagegraph is compiled after the modern SDK is installed; this does not verify that the full plugin typechecks and builds against the host it claims to support. Install the compatibility SDK first, then run the full typecheck/build for this profile too.
- name: Build lockfile runtime for modern API smoke
if: matrix.compatibility_profile == 'channel-message-only'
run: npm run build
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
修复内容
createTypingCallbacks改从openclaw/plugin-sdk/channel-message导入,兼容仍提供旧入口的最低宿主,以及已经移除channel-runtime的新版宿主。ret=-3After Gateway Restart Tencent/openclaw-weixin#243)。兼容性覆盖
channel-message子路径,并断言 typing callbacks 实际传入 dispatcher。process-message;modern profile 还验证旧channel-runtime已不可用,避免测试落回旧 API。createTypingCallbacks、导入完整插件并验证openclaw-weixin注册结果。调整
3.0.2,不修改 package、lockfile 或插件版本;中英文说明放入Unreleased。ret=-2 prepare failed特判,避免对服务端 bot 状态问题给出误导性恢复建议。验证
npm run test:unit -- src/messaging/process-message.test.ts src/messaging/context-token-store.test.ts src/api/api.test.tsnpm run typecheck/npm run typecheck:tests/npm run test:coverage/npm run buildnpm run pack:checknpm test --prefix docs/site/npm run build --prefix docs/site