fix(weixin): steer agent to images or list format for wide tables (#16951)#18552
fix(weixin): steer agent to images or list format for wide tables (#16951)#18552gaurav0107 wants to merge 2 commits intoNousResearch:mainfrom
Conversation
…usResearch#16951) The WeChat personal client clips the right-hand side of wide pipe-style Markdown tables — columns beyond the initial viewport stay hidden even when the user scrolls. The clipping is a client-side rendering bug; the Markdown arrives intact at the WeChat side. Extend the Weixin platform hint so the agent proactively avoids pipe tables for 3+ column data and instead either renders the table as an image (e.g. via the bundled table-image-generator skill, delivered with MEDIA:) or uses a simple key: value list. Two-column pipe tables still render fine and remain allowed. Add a regression test that pins the new guidance in PLATFORM_HINTS["weixin"].
liuhao1024
left a comment
There was a problem hiding this comment.
The hint references "the bundled table-image-generator skill" but no such skill exists in the repository. I searched the full tree (git trees/main?recursive=1) for any path containing table-image, table.*image, or image.*table — zero results.
When the agent encounters this hint on Weixin, it may attempt to invoke table-image-generator as a skill/tool, fail, and waste a tool call before falling back to the key:value alternative.
Two options:
- Remove the skill reference — just say "render the table as an image" without naming a specific skill, letting the agent use whatever image generation tools are available.
- Ship the skill — if
table-image-generatoris planned, this PR should include it or be blocked until it lands.
Suggested edit:
"(a) render the table as an image (for example using an image generation tool or "
"code that produces a table screenshot) and attach it with MEDIA:/absolute/path/to/table.png, "Reviewer flagged that the weixin hint pointed the agent at a table-image-generator skill that does not exist in the repo. On Weixin the agent would try to invoke it, fail, and waste a tool call before falling back to the key:value alternative. Reword the (a) branch to reference whatever image-generation tool is available (or code that produces a table screenshot) instead of naming a specific skill. Update the matching regression test.
|
Good catch — you're right, I grepped the tree and there's no |
What does this PR do?
The WeChat personal client clips the right-hand side of wide pipe-style
Markdown tables — columns beyond the initial viewport stay hidden even
when the user horizontally scrolls. This is a client-side rendering bug
in the WeChat Webview engine, not a Hermes transport issue: since #11571
the Weixin adapter already preserves Markdown tables intact, so the
clipping happens after delivery.
Per the issue reporter's proposed mitigation, this PR extends the Weixin
platform hint (
PLATFORM_HINTS["weixin"]inagent/prompt_builder.py)so the agent proactively avoids wide pipe tables when chatting on Weixin
and instead either:
table-image-generatorskill and attaches it with
MEDIA:/absolute/path/to/table.png, orkey: valuelist.Two-column pipe tables render fine on WeChat and remain permitted.
The change is scoped to the system-prompt string. There is no change to
the transport layer, to any gateway adapter, or to the
wecom(Enterprise WeChat) hint.
Related Issue
Fixes #16951
Type of Change
Changes Made
agent/prompt_builder.py: append a "Tables:" paragraph toPLATFORM_HINTS["weixin"]that explicitly forbids 3+ column pipetables on Weixin and points at
table-image-generator+MEDIA:orkey: valuelist format as the two recommended alternatives.tests/agent/test_prompt_builder.py: addtest_platform_hints_weixin_discourages_wide_pipe_tablesto pin thenew guidance (regression gate).
How to Test
All 116 tests in that module pass (1 pre-existing skip).
Checklist
Code
fix(weixin): …)pytest tests/agent/test_prompt_builder.py -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — N/A (prompt string only)cli-config.yaml.exampleif I added/changed config keys — N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — N/A