Skip to content

feat: parse merged-forward (chat history) messages#159

Open
kyan-du wants to merge 1 commit intothisnick:mainfrom
kyan-du:feat/parse-merged-forward-messages
Open

feat: parse merged-forward (chat history) messages#159
kyan-du wants to merge 1 commit intothisnick:mainfrom
kyan-du:feat/parse-merged-forward-messages

Conversation

@kyan-du
Copy link
Copy Markdown
Contributor

@kyan-du kyan-du commented Apr 25, 2026

Summary

Parse appmsg subtype 19 (merged forward / "Combine and Forward" / chat history) messages by extracting the XML-escaped <recorditem> content and rendering each <dataitem> as sender: message.

Before: Agents only see the title, e.g. Chat History of Group X — the actual forwarded messages are invisible.

After: Each forwarded message is extracted and rendered:

[Chat History] Chat History of Group X
Alice: Hey, did you see this?
Bob: Yes, looks great!
Charlie: [media]

Changes

  • packages/agent-server-rust/src/tools/wechat_messages.rs: Add match arm for appmsg subtype 19
    • Decode XML-escaped <recorditem> (&lt;<, etc.)
    • Iterate <dataitem> blocks, extract <sourcename>/<displayname> and <datatitle>/<datadesc>
    • Fall back to [media] when no text content is available
    • Fall back to title-only when no <dataitem> blocks are found

Testing

Tested in production with real merged-forward messages from WeChat group chats containing 100+ messages, mixed media types, and nested forwards. The agent now correctly reads and responds to forwarded conversation content.

Closes #126

Parse appmsg subtype 19 (merged forward / chat history) by extracting
the XML-escaped <recorditem> content and rendering each <dataitem> as
'sender: message'. Previously only the title was shown, making these
messages opaque to agents.

Closes thisnick#126
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.

Agents cannot read the detail of "Combine and Forward" messages.

1 participant