fix(send_message): honor markdown_support config for QQ platform (#26697) - #26701
Closed
briandevans wants to merge 1 commit into
Closed
fix(send_message): honor markdown_support config for QQ platform (#26697)#26701briandevans wants to merge 1 commit into
briandevans wants to merge 1 commit into
Conversation
Contributor
Author
|
CI audit — all 4 test failures are pre-existing baselines unrelated to this PR's touched code (
All four reproduce on clean |
briandevans
force-pushed
the
fix/send-message-qqbot-markdown-support-26697
branch
4 times, most recently
from
May 26, 2026 02:12
d28f9ea to
541771e
Compare
briandevans
force-pushed
the
fix/send-message-qqbot-markdown-support-26697
branch
from
May 28, 2026 13:09
541771e to
89d8b25
Compare
…sResearch#26697) `tools.send_message_tool._send_qqbot` hardcoded `msg_type: 0` (plain text) for every QQ endpoint, ignoring the `markdown_support` config in `pconfig.extra`. As a result, sending a markdown table to QQ via `send_message` arrived as raw markdown syntax even when the gateway adapter (which honors the same flag) would have rendered the table. Mirror the gateway adapter's pattern from `gateway/platforms/qqbot/adapter.py::_build_text_body`: when `markdown_support` is True (the default, matching the adapter), use a `{"markdown": {"content": ...}, "msg_type": 2}` body for the C2C (`/v2/users/...`) and group (`/v2/groups/...`) endpoints. Plain text (`msg_type: 0`) is still used when the flag is False. The guild channel endpoint (`/channels/...`) keeps the simpler `{"content": ...}` shape that the adapter's `_send_guild_text` already uses — guild channels don't take `msg_type` via this path. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
briandevans
force-pushed
the
fix/send-message-qqbot-markdown-support-26697
branch
from
May 29, 2026 14:11
89d8b25 to
147788e
Compare
Contributor
Author
|
Closing this to keep the contribution queue manageable while it awaits maintainer review. The fix still applies cleanly and I'm happy to reopen if a maintainer wants to pick it up — just give it a nudge and I'll refresh it against main. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tools/send_message_tool.py::_send_qqbothardcodedmsg_type: 0(plain text) for every QQ endpoint, ignoring themarkdown_supportconfig inpconfig.extra.markdown_supportis True (default), use{"markdown": {"content": ...}, "msg_type": 2}for the C2C and group endpoints. Plain text falls back tomsg_type: 0.{"content": ...}shape thatgateway/platforms/qqbot/adapter.py::_send_guild_textalready uses.The bug
Steps from the issue:
markdown_support: trueinconfig.yaml.send_messageto deliver a markdown table to a QQ C2C or group chat.msg_type: 0, not the markdown payload the QQ Open Platform expects.Meanwhile the gateway adapter (
gateway/platforms/qqbot/adapter.py:209) readsmarkdown_supportfromextra(defaultTrue) and_build_text_body(2596–2620) emits the correctmarkdown.content+msg_type: 2shape. The tool path didn't, so the two ingress paths disagreed about how to render the same message.The fix
Read
markdown_support(default True) frompconfig.extraand build the v2 (C2C/group) payload the same way the adapter does. The guild channel endpoint payload becomes a plain{"content": ...}(nomsg_type) to match_send_guild_textand avoid sending the unsupportedmarkdownshape there.Test plan
tests/tools/test_send_message_qqbot_markdown.py(5 cases — C2C markdown, group markdown, C2C plain when flag=False, default-True when flag unset, channel-endpoint shape unchanged). All pass underuv run --with pytest --with pytest-xdist --with pytest-asyncio.main— pre-fix code haspayload = {"content": ..., "msg_type": 0}with nomarkdownfield and nomarkdown_supportlookup, so all four "msg_type == 2" / "markdown.content" assertions wouldKeyErroror fail.tests/tools/test_send_message_*.pyfailures are pre-existing aiohttp-not-installed baseline (CI install pulls it via.[all,dev]); none touch_send_qqbot.Related