Skip to content

fix(dingtalk): resolve message extraction and callback type mismatch#10820

Closed
lshy0000 wants to merge 1 commit into
NousResearch:mainfrom
lshy0000:main
Closed

fix(dingtalk): resolve message extraction and callback type mismatch#10820
lshy0000 wants to merge 1 commit into
NousResearch:mainfrom
lshy0000:main

Conversation

@lshy0000

Copy link
Copy Markdown
  • Fix _IncomingHandler.process() to convert CallbackMessage to ChatbotMessage using ChatbotMessage.from_dict(), matching dingtalk-stream SDK behavior.
  • Replace manual _extract_text() logic with SDK's get_text_list() which correctly handles TextContent objects and richText messages.
  • Relax _DINGTALK_WEBHOOK_RE to match *.dingtalk.com (was api.dingtalk.com) to support oapi.dingtalk.com webhook URLs.
  • Add detailed debug logging for webhook caching and send() routing.
  • Remove blocking asyncio.to_thread() call since stream client now runs async natively in the main event loop.
  • Update test_dingtalk.py to use real ChatbotMessage.from_dict() instead of MagicMock for _extract_text() tests.

What does this PR do?

Related Issue

Fixes #

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

How to Test

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform:

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

For New Skills

  • This skill is broadly useful to most users (if bundled) — see Contributing Guide
  • SKILL.md follows the standard format (frontmatter, trigger conditions, steps, pitfalls)
  • No external dependencies that aren't already available (prefer stdlib, curl, existing Hermes tools)
  • I've tested the skill end-to-end: hermes --toolsets skills -q "Use the X skill to do Y"

Screenshots / Logs

- Fix _IncomingHandler.process() to convert CallbackMessage to ChatbotMessage
  using ChatbotMessage.from_dict(), matching dingtalk-stream SDK behavior.
- Replace manual _extract_text() logic with SDK's get_text_list() which
  correctly handles TextContent objects and richText messages.
- Relax _DINGTALK_WEBHOOK_RE to match *.dingtalk.com (was api.dingtalk.com)
  to support oapi.dingtalk.com webhook URLs.
- Add detailed debug logging for webhook caching and send() routing.
- Remove blocking asyncio.to_thread() call since stream client now runs
  async natively in the main event loop.
- Update test_dingtalk.py to use real ChatbotMessage.from_dict() instead
  of MagicMock for _extract_text() tests.
@teknium1

Copy link
Copy Markdown
Contributor

Closing as superseded by #11471 (#11471) which salvaged @kevinskysunny's minimal fix (#11257) and added a follow-up for the broken _extract_text() path found during E2E testing.

Thanks for the fix — a lot of contributors hit this SDK break at the same time. Your investigation helped confirm the root cause.

@teknium1 teknium1 closed this Apr 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants