Skip to content

fix(dingtalk): route text-only richText to the agent instead of dropping it - #3293

Merged
zhayujie merged 1 commit into
zhayujie:masterfrom
Lesereingrape:fix/dingtalk-richtext-without-images
Sep 29, 2026
Merged

zhayujie merged 1 commit into
zhayujie:masterfrom
Lesereingrape:fix/dingtalk-richtext-without-images

Conversation

@Lesereingrape

Copy link
Copy Markdown
Contributor

What does this PR do?

A DingTalk richText message whose image list is empty is pure formatted text,
but DingTalkMessage classified it as ContextType.IMAGE with the
[未找到图片] placeholder and never set image_path. Both receive paths in
dingtalk_channel.py (single chat :689-694, group chat :767-772) cache an
IMAGE message only when image_path exists and then return unconditionally,
so produce() was never reached: the user's message got no reply at all, and
nothing was logged above debug.

The fix extracts the text on that path, mirroring what the with-images branch
already does a few lines above, and only keeps the IMAGE placeholder when the
message genuinely carries neither an image nor text. picture messages with an
empty image list are unchanged.

Fixes #3292.

Type of change

  • Bug fix
  • New feature
  • Docs
  • Refactor / chore

Checklist

Local verification, on master @ 5da52c87:

  • tests/test_dingtalk_richtext_without_images.py on the unpatched file:
    1 failed, 2 passed — the failure is exactly the text-only richText case
    coming back as ContextType.IMAGE.
  • With the fix: 3 passed. The two other cases pin the behaviour that must not
    change (no image and no text keeps the placeholder; picture with an empty
    image list stays an IMAGE).
  • All five DingTalk test files together: 46 passed, with dingtalk_stream
    both importable and absent, and in both collection orders.
  • ruff check --select F on the two changed files: All checks passed!
  • Full suite pytest tests/ -q: 36 failed, 2228 passed on this branch vs
    36 failed, 2225 passed on a separate worktree at the same commit — same
    pre-existing failures, +3 = the new tests, so no regression.
  • I did not run the app against a live DingTalk conversation, so the two broken
    links (dingtalk_message.py:155-158 and the unconditional return in
    dingtalk_channel.py) are verified by reading those paths, and the parsing
    fix itself is covered by the regression test above.

…ing it

A richText message whose image list is empty is pure formatted text, but it
was classified as ContextType.IMAGE with a "[未找到图片]" placeholder and no
image_path. Both receive paths cache only when image_path is set and then
return unconditionally, so the user's message produced no reply at all.
@zhayujie
zhayujie merged commit ebf206b into zhayujie:master Sep 29, 2026
3 checks passed
@zhayujie

Copy link
Copy Markdown
Owner

Merged, thanks! Text-only richText now reaches the agent the same way the with-images branch does, and the regression tests pin the cases that must not change.

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.

[Bug] DingTalk text-only richText messages are classified as images and silently dropped

2 participants