Skip to content

fix(weixin): steer agent to images or list format for wide tables (#16951)#18552

Open
gaurav0107 wants to merge 2 commits intoNousResearch:mainfrom
gaurav0107:fix/16951-weixin-wide-table-hint
Open

fix(weixin): steer agent to images or list format for wide tables (#16951)#18552
gaurav0107 wants to merge 2 commits intoNousResearch:mainfrom
gaurav0107:fix/16951-weixin-wide-table-hint

Conversation

@gaurav0107
Copy link
Copy Markdown

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"] in agent/prompt_builder.py)
so the agent proactively avoids wide pipe tables when chatting on Weixin
and instead either:

  1. renders the table as an image via the bundled table-image-generator
    skill and attaches it with MEDIA:/absolute/path/to/table.png, or
  2. formats the data as a simple key: value list.

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

  • 🐛 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

  • agent/prompt_builder.py: append a "Tables:" paragraph to
    PLATFORM_HINTS["weixin"] that explicitly forbids 3+ column pipe
    tables on Weixin and points at table-image-generator + MEDIA: or
    key: value list format as the two recommended alternatives.
  • tests/agent/test_prompt_builder.py: add
    test_platform_hints_weixin_discourages_wide_pipe_tables to pin the
    new guidance (regression gate).

How to Test

uv venv .venv --python 3.11
source .venv/bin/activate
uv pip install -e ".[all,dev]"
python -m pytest tests/agent/test_prompt_builder.py -q

All 116 tests in that module pass (1 pre-existing skip).

Checklist

Code

Documentation & Housekeeping

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

…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"].
@gaurav0107 gaurav0107 marked this pull request as ready for review May 1, 2026 20:49
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/agent Core agent loop, run_agent.py, prompt builder labels May 1, 2026
Copy link
Copy Markdown
Contributor

@liuhao1024 liuhao1024 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. 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.
  2. Ship the skill — if table-image-generator is 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.
@gaurav0107
Copy link
Copy Markdown
Author

Good catch — you're right, I grepped the tree and there's no table-image-generator skill anywhere. Pushed 6a8b16b which drops the specific skill reference and just tells the agent to use whatever image-generation tool is available (or code that produces a screenshot). Test updated to match. Thanks for the careful read.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent loop, run_agent.py, prompt builder P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Weixin] WeChat client clips right-side content when scrolling Markdown tables

3 participants