feat(channel): add wecom_ws AI bot channel#3305
feat(channel): add wecom_ws AI bot channel#3305whtiehack wants to merge 3 commits intozeroclaw-labs:masterfrom
Conversation
5bb5ee6 to
f1a5987
Compare
|
Hey @theonlyhennygod — heads up regarding #3439. I see that #3439 implements a WeCom outbound-only channel via the Bot Webhook API ( Just wanted to flag that WeCom actually has two distinct API modes for its AI Bot (智能机器人), and they serve very different purposes:
This PR (#3305) implements the WebSocket long-connection mode for a full bidirectional AI Bot channel, including:
This has been tested and verified against a live WeCom deployment. Since #3439 covers outbound-only and this PR covers the full AI bot — how should we handle these? Should they coexist as separate channels, or should this PR supersede #3439 since it already includes outbound capabilities? |
|
@theonlyhennygod — regarding the linked issues:
How would you like to proceed? Should this PR handle the bidirectional AI bot use case while #3439 stays as a lightweight outbound-only option, or would you prefer consolidating into one? |
|
If the team is open to adding the AI Bot channel, I'm happy to take on WeCom-related issues going forward. I'm based in China and my company uses WeCom daily, so I can understand the requirements and debug issues more easily. |
Wecom daily user too, thanks a lot for your support. I'm gonna try wecom bot multiplexing considering multiple users (and their credentials) using one bot is a common scene. Yet no [multiple users] - [one bot] - [multiple claws] feature are implemented in any openclaw runtime. |
I encountered the same issue as you. Originally, I wanted to do isolation in zeroclaw, but later found it quite challenging. So now, I'm planning to achieve isolation by running multiple containers with multiple bots. One general bot, and other dedicated bots. Because now bots can apply freely. No management permissions are needed anymore. |
|
@chengongpp If you have any good ideas, share them with me! thanks |
f1a5987 to
c743215
Compare
Summary
masterfor all contributions):masterchannels_config.wecomis now the webhook-based WeCom bot onmaster, so the long-connection AI bot work in this PR needed a non-conflicting channel/config identity.wecom_wschannel withchannels_config.wecom_ws, added the long-connection WebSocket channel/runtime implementation, allowlists, attachment download/decrypt handling,stream_mode, WeCom-specific conversation/history handling, and scheduler delivery through the active connectedwecom_wschannel instance.channels_config.wecomchannel, no pairing flow changes, and no intended behavior change for non-WeCom channels beyond the shared live-channel registry/runtime plumbing required for active-session announcement routing.Label Snapshot (required)
risk: low|medium|high):risk: mediumsize: XS|S|M|L|XL, auto-managed/read-only): auto-managed/read-only (expected:L)core|agent|channel|config|cron|daemon|doctor|gateway|health|heartbeat|integration|memory|observability|onboard|provider|runtime|security|service|skillforge|skills|tool|tunnel|docs|dependencies|ci|tests|scripts|dev, comma-separated):channel, config, cron, dependencies<module>: <component>, for examplechannel: telegram,provider: kimi,tool: shell):channel: wecomtrusted contributor|experienced contributor|principal contributor|distinguished contributor, auto-managed/read-only; author merged PRs >=5/10/20/50): auto-managed/read-onlyNoneChange Metadata
bug|feature|refactor|docs|security|chore):featureruntime|provider|channel|memory|security|ci|docs|multi):channelLinked Issue
N.A.N.A.N.A.Supersede Attribution (required when
Supersedes #is used)#<pr> by @<author>, one per line):N.A.N.A.Co-authored-bytrailers added for materially incorporated contributors? (Yes/No):NoNo, explain why (for example: inspiration-only, no direct code/design carry-over): This PR does not supersede or materially incorporate another contributor PR.\n): (Pass/Fail):PassValidation Evidence (required)
Commands and result summary:
fmtandclippyare clean; allwecom_ws-targeted unit tests pass, including the migrated non-blocking WebSocket callback tests from commit1f9a3538fbe1218fe31a13b55c240b26f06f87b9.cargo testwas executed, but currentupstream/masterstill has unrelated baseline failures (for exampleconfig::schema::*missingdata_retention,security::policy::workspace_only_false_allows_resolved_outside_workspace, andtools::web_search_tool::*config-parse failures). Those failures are outside this PR's touched files.Security Impact (required)
Yes/No):YesYes/No):YesYes/No):YesYes/No):YesYes, describe risk and mitigation: This adds an optional inbound/outbound long-connection WeCom channel with a new encryptedsecret, WebSocket traffic, and attachment download/decrypt/persist logic. Risk is bounded by opt-in configuration, explicitallowed_users/allowed_groupsallowlists, attachment size limits, workspace-scoped file caching, and retention cleanup.Privacy and Data Hygiene (required)
pass|needs-follow-up):passzeroclaw_userandzeroclaw_group.Confirmed.Compatibility / Migration
Yes/No):YesYes/No):YesYes/No):Only for previous PR reviewers/users of this branch[channels_config.wecom]from the old PR version to[channels_config.wecom_ws]; keep[channels_config.wecom]reserved for the upstream webhook channel introduced by PR feat(channel): add WeCom Bot Webhook channel #3439.i18n Follow-Through (required when docs or user-facing wording changes)
Yes/No):NoHuman Verification (required)
What was personally validated beyond CI:
wecom_wsconfig serde/defaults, runtime command parsing, conversation-key routing, stream-mode behavior, access-control decisions, non-blocking WebSocket callback dispatch, and scheduler delivery wiring through the active live channel registry.*wildcards allow access, group denials includechatid,stream_mode = "off"disables draft updates, and callback dispatch does not block when the framework queue is full or when access-denied replies are still waiting for WebSocket ack.Side Effects / Blast Radius (required)
wecom_wsattachment caching.Agent Collaboration Notes (recommended)
upstream/master, removed docs from scope, retargeted the long-connection implementation fromwecomtowecom_ws, merged the later non-blocking callback fix from commit1f9a3538fbe1218fe31a13b55c240b26f06f87b9, then revalidated the affected path.wecom_wsconfig/runtime wiring, callback responsiveness, allowlists, streaming behavior, and proactive delivery through the live channel registry.AGENTS.md+CONTRIBUTING.md):YesRollback Plan (required)
[channels_config.wecom_ws]from deployments that should not start the long-connection channel.wecom_wssupport is fully opt-in via[channels_config.wecom_ws];stream_modecan be set tooff.wecom_wsfails to connect, proactive sends reportwecom_ws channel is not connected, or inbound messages are denied due to missing/misconfigured allowlists.Risks and Mitigations
wecomtowecom_wsmay surprise anyone testing older iterations of this PR.channels_config.wecomownership for the webhook-based bot from PR feat(channel): add WeCom Bot Webhook channel #3439.wecom_wssession.