Skip to content

fix: Updated the WeixinChannel identifier name to match the registry key name#3605

Open
celestialhorse51D wants to merge 2 commits intoagentscope-ai:mainfrom
celestialhorse51D:fix/weixin-channel-name-mismatch
Open

fix: Updated the WeixinChannel identifier name to match the registry key name#3605
celestialhorse51D wants to merge 2 commits intoagentscope-ai:mainfrom
celestialhorse51D:fix/weixin-channel-name-mismatch

Conversation

@celestialhorse51D
Copy link
Copy Markdown
Collaborator

Description

The root cause was an identity mismatch in WeixinChannel:

  • Registry Key: The channel is registered as "weixin" in _BUILTIN_SPECS.
  • Instance Attribute: The WeixinChannel.channel property was incorrectly defined as "wechat".
  • Failure Mode: ChannelManager.get_channel() matches tasks against the instance's .channel property. Since cron jobs store the target as "weixin", the lookup failed ("wechat" != "weixin").

This PR changes WeixinChannel.channel from "wechat" to "weixin", unifying the identifier across the registry, session IDs (which use the weixin: prefix), and task dispatch logic.

Related Issue: Fixes #3573

Security Considerations: No security impact. This is a constant alignment fix; it does not alter authentication flows or environment variable handling.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Refactoring

Component(s) Affected

  • Core / Backend (app, agents, config, providers, utils, local_models)
  • Console (frontend web UI)
  • Channels (DingTalk, Feishu, QQ, Discord, iMessage, etc.)
  • Skills
  • CLI
  • Documentation (website)
  • Tests
  • CI/CD
  • Scripts / Deploy

Checklist

  • I ran pre-commit run --all-files locally and it passes
  • If pre-commit auto-fixed files, I committed those changes and reran checks
  • I ran tests locally (pytest or as relevant) and they pass
  • Documentation updated (if needed)
  • Ready for review

For Channel Changes (DingTalk, Feishu, QQ, Console, etc.)

  • I ran ./scripts/check-channels.sh (or ./scripts/check-channels.sh --changed) and it passes
  • Contract test exists in tests/contract/channels/test_<channel>_contract.py (REQUIRED)
  • Contract test implements create_instance() with proper channel initialization
  • All 19 contract verification points pass (see tests/contract/channels/__init__.py)
  • Optional: Unit tests in tests/unit/channels/test_<channel>.py for complex internal logic

Testing

[How to test these changes]

Local Verification Evidence

pre-commit run --all-files
check python ast.........................................................Passed
sort simple yaml files...............................(no files to check)Skipped
check yaml...............................................................Passed
check xml................................................................Passed
check toml...............................................................Passed
check docstring is first.................................................Passed
check json...............................................................Passed
fix python encoding pragma...............................................Passed
detect private key.......................................................Passed
trim trailing whitespace.................................................Passed
Add trailing commas......................................................Passed
mypy.....................................................................Passed
black....................................................................Passed
flake8...................................................................Passed
pylint...................................................................Passed
prettier.................................................................Passed
  ********************************Passed******************************** 

pytest
# paste summary result

Additional Notes

[Optional: any other context]

@github-actions
Copy link
Copy Markdown

Welcome to QwenPaw! 🐾

Hi @celestialhorse51D, this is your 5th Pull Request.

🙌 Join Developer Community

Thanks so much for your contribution! We'd love to invite you to join the official QwenPaw developer group! You can find the Discord and DingTalk group links under the "Developer Community" section on our docs page:
https://qwenpaw.agentscope.io/docs/community

We truly appreciate your enthusiasm—and look forward to your future contributions! 😊

We'll review your PR soon.

@xieyxclack
Copy link
Copy Markdown
Member

@celestialhorse51D Please pass the unit test

@celestialhorse51D
Copy link
Copy Markdown
Collaborator Author

@celestialhorse51D Please pass the unit test

Thanks for the review!
The current test asserts channel = "wechat", which corresponds to the legacy buggy behavior. The test will pass if the assertion is updated to expect "weixin".

@xieyxclack
Copy link
Copy Markdown
Member

@celestialhorse51D Maybe you need to correct and update the test accordingly

@hongxicheng
Copy link
Copy Markdown
Collaborator

Thanks for the effort, @celestialhorse51D.The cron job works correctly when using channel=wechat -- the reported issue in #3573 was caused by the user using channel=weixin which doesn't match the actual channel identifier.I'd like to keep "wechat" as the identifier since it's the internationally recognized name and changing it would be a breaking change for existing users. If anything, we can improve the error message or add documentation to clarify the correct channel name.Closing this PR. Thanks for your time!

@github-project-automation github-project-automation Bot moved this from Todo to Done in QwenPaw Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Bug] cron 任务 channel=weixin 执行时报 KeyError

3 participants