Conversation
nikolasdehor
left a comment
There was a problem hiding this comment.
The WeCom integration adds useful channel support, but there are several issues that should be addressed before merging.
Missing error handling / security concerns:
-
No tests included: This PR adds ~1100 lines of Go code across
wecom.go(466 lines) andwecom_app.go(629 lines) with zero test files. At minimum, the AES decryption, signature verification, and XML parsing paths need unit tests — these are security-critical code paths. -
Config watcher (
pkg/config/watcher.go): This adds a 258-line file watcher that is unrelated to WeCom. It should be a separate PR. Mixing orthogonal features makes review harder and increases merge conflict surface. -
allow_fromfield inconsistency: The README docs useallow_from(snake_case) for WeCom but some existing channels useallowFrom(camelCase). The config struct should be consistent with the rest of the codebase. -
Missing
context.Contextpropagation: The WeCom HTTP handler should accept and pass throughcontext.Contextfor proper cancellation support, consistent with how other channels (LINE, MaixCam) handle it. -
Hardcoded timeout values: The 5-second WeCom reply deadline is mentioned in docs but I do not see a configurable timeout in the code or config struct. This should be a config option.
-
loop.gochanges: The diff shows 18 additions / 21 deletions inloop.go— these changes should be reviewed carefully to ensure they do not affect existing channel behavior. Please describe what changed in the agent loop and why it was necessary for WeCom support.
Please split the config watcher into a separate PR and add tests for the security-critical paths (AES decryption, signature verification).
c65c5ab to
0b25f34
Compare
alexhoshina
left a comment
There was a problem hiding this comment.
所有的peer_kind都硬编码为direct,应该存在一些问题。我无法确定,你可以进行相关测试。
- 所有的群聊消息都会被当作私信处理,直接导致session中会为群聊中的每个用户都创建一个json,也就是说:群聊中的每个用户的llm会话都是独立的。
- 可能会出现隔离错误,当dm_scope设置为main时,所有的群聊、私聊都会被合并为同一个main会话。
All peer_kind are hardcoded as direct, which likely indicates some issues. I'm not entirely certain; you can conduct relevant tests.
- All group chat messages are treated as private messages, which directly results in a JSON being created for each user in the group chat within the session. In other words, each user in the group chat has an independent LLM session.
- Isolation errors may occur. When
dm_scopeis set tomain, all group chats and private chats are merged into the same main session.
pkg/channels/wecom_app.go
Outdated
| } | ||
|
|
||
| // pkcs7Unpad removes PKCS7 padding with validation | ||
| func pkcs7Unpad(data []byte) ([]byte, error) { |
There was a problem hiding this comment.
与wecom.go中的pkcs7UnpadWeCom完全重复,直接调用wecom.go中的pkcs7UnpadWeCom即可
Completely duplicates pkcs7UnpadWeCom in wecom.go, simply call pkcs7UnpadWeCom from wecom.go directly.
pkg/channels/wecom_app.go
Outdated
| } | ||
|
|
||
| // verifySignature verifies the message signature | ||
| func (c *WeComAppChannel) verifySignature(msgSignature, timestamp, nonce, msgEncrypt string) bool { |
There was a problem hiding this comment.
与wecom.go中的verifySignature仅receiver不同,可以声明为公共函数。
Only the receiver differs from verifySignature in wecom.go, so it can be declared as a public function.
pkg/channels/wecom_app.go
Outdated
| } | ||
|
|
||
| // decryptMessage decrypts the encrypted message using AES | ||
| func (c *WeComAppChannel) decryptMessage(encryptedMsg string) (string, error) { |
There was a problem hiding this comment.
与wecom.go中的decryptMessage仅receiver不同,和调用的_pkcs7_不同,可以声明为公共函数
Only the receiver differs from decryptMessage in wecom.go, and the called pkcs7 is different; it can be declared as a public function.
|
thanks for the pr |
|
@swordkee Nice addition bringing WeCom and WeCom App channels into PicoClaw! This opens up the project to a lot of enterprise users on the platform. We have the PicoClaw Dev Group on Discord for contributors to chat and collaborate. If you want to join, send an email to |
add wecom and wecomApp
📝 Description
🗣️ Type of Change
🤖 AI Code Generation
🔗 Related Issue
📚 Technical Context (Skip for Docs)
🧪 Test Environment
📸 Evidence (Optional)
Click to view Logs/Screenshots
☑️ Checklist