combine_record_xml (49/19) wraps <recorditem> in split CDATA, truncating Channels (<finderFeed>) and dropping subsequent messages on official WeChat
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
Start in packages/native-client-rust/crates/wechat-protocol/src/forward.rs at combine_record_xml, then read push_tag and the merged-forward.xml fixture. Change the recorditem serialization as suggested and check whether XML escaping still fits MAX_FORWARD_APP_MSG_XML_BYTES. Done when a combined record preserves a Channels item and all following messages; add or update a focused regression test for content containing ]]>.
Written by the indexing model from the issue text.
Description
Summary
When combine-forwarding (mode="combine", 49/19) a batch that includes a WeChat Channels video (49/51, <finderFeed>) followed by additional messages, official WeChat mobile clients (observed on iOS):
- Render the Channels item as a blank grey card with only the Channels butterfly icon (missing cover, title, and media metadata), and
- Silently drop every message after the Channels item from the combined chat history.
Meanwhile, agent-wechat's own forwarded.rs reader still displays all items (including messages after the Channels item), because roxmltree concatenates adjacent split CDATA nodes whereas official WeChat's <recorditem> parser does not.
Root Cause
In packages/native-client-rust/crates/wechat-protocol/src/forward.rs (combine_record_xml, lines 675–677), <recorditem> is wrapped in CDATA via push_cdata:
out.push_str("<recorditem>");
push_cdata(&mut out, &record_info);
out.push_str("</recorditem>");
where push_cdata (lines 70–79) splits any inner ]]> into ]]]]><![CDATA[>:
while let Some(idx) = rest.find("]]>") {
out.push_str(&rest[..idx]);
out.push_str("]]]]><![CDATA[>");
rest = &rest[idx + 3..];
}
In packages/native-client-rust/crates/wechat-core/src/forwards.rs (lines 1055–1102), serialize_record_info embeds raw child XML fragments verbatim into <recordinfo> — including <finderFeed> (49/51), <finderLive> (49/63), <weappinfo> (49/33, 49/36), and nested <recordxml><recordinfo>...</recordinfo></recordxml> (49/19).
In real WeChat 49/51 messages, <finderFeed> wraps nearly every sub-field (<objectId>, <username>, <nickname>, <desc>, <url>, <thumbUrl>, etc.) in <![CDATA[...]]>. When push_cdata wraps the outer <recorditem>, every inner ]]> becomes ]]]]><![CDATA[>.
Official WeChat's XML parser does not concatenate split CDATA sections inside <recorditem> and instead truncates at the very first ]]> inside <finderFeed>:
- Items before
<finderFeed>and the<dataitem datatype="22">header (<sourcename>,<sourcetime>) precede<finderFeed>, so they survive (producing the blank grey Channels card with just the butterfly icon). - Everything after the first
]]>(the rest of<finderFeed>and all subsequent<dataitem>entries) is lost on official WeChat.
By contrast, official WeChat's own 49/19 wire format (see packages/native-client-rust/crates/wechat-core/tests/fixtures/merged-forward.xml) XML-escapes <recorditem> instead of wrapping it in <![CDATA[...]]>:
<recorditem><recordinfo><datalist count="4">...<![CDATA[...]]>...</datalist></recordinfo></recorditem>
Affected Types
Any combined 49/19 batch containing inner ]]> inside <recordinfo>, including:
49/51Channels video (<finderFeed>)49/63Channels live (<finderLive>)49/33,49/36Mini Program (<weappinfo>, when containing CDATA)49/19Nested chat history (<recordxml><recordinfo>...</recordinfo></recordxml>, when inner<datadesc>uses CDATA)- Plain text messages literally containing
]]>
Reproduction Steps
- Select 4 messages in a chat:
[text_1, text_2, channels_video_49_51, text_4]. - Call
POST /v1/accounts/{a}/forwardswith"mode": "combine"and all 4messageIds. - Open the resulting
49/19combined chat-history card in official WeChat (e.g. iOS):text_1andtext_2appear normally.channels_video_49_51appears as an empty grey card with only the Channels icon.text_4is completely missing.
- Reading the same committed message via
agent-wechat(GET /v1/accounts/{a}/messages/{id}) shows all 4 entries (confirmingroxmltreeparsed the split CDATA while official WeChat truncated at the first]]>).
Suggested Fix
In packages/native-client-rust/crates/wechat-protocol/src/forward.rs (combine_record_xml), encode <recorditem> as XML-escaped text matching official WeChat instead of CDATA:
push_tag(&mut out, "recorditem", &record_info);
(forwarded.rs and app_msg_echo_matches in wechat-core/src/forwards.rs already support XML-escaped <recorditem>.)
(Also worth checking in combine_record_xml whether MAX_FORWARD_APP_MSG_XML_BYTES headroom is still comfortable after XML-escaping </>/" inside <recorditem>.)
- Dominant language
- Rust
- Stars
- 319
- Forks
- 131
- Avg merge
- 3h 14m
- Merged PRs (30d)
- 349
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from thisnick/agent-wechat
-
question
Difficulty 4/5 3-5 days Newbie friendliness 42/100
thisnick/agent-wechat#894 · 1 comment ·
Maintainers usually reply within 1 day
-
enhancement postponed
Difficulty 5/5 Over a week Newbie friendliness 38/100
thisnick/agent-wechat#840 · 1 comment ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 45/100
thisnick/agent-wechat#828 · 1 comment ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 20/100
thisnick/agent-wechat#701 · 1 comment ·
Maintainers usually reply within 1 day
-
enhancement postponed
Difficulty 5/5 Over a week Newbie friendliness 35/100
thisnick/agent-wechat#456 · 2 comments ·
Maintainers usually reply within 1 day
All issues in thisnick/agent-wechat
Similar issues
-
bug(services/fs): deleting "/" removes the configured root directoryPossibly taken @xgbtxy claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 81/100
apache/opendal#9635 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
[Bug]: streaming_end_of_stream_only guardrails rescan the whole stream on every chunk - blocks event loopPossibly taken A pull request linked to this issue is open or already merged. Openbug llm translation
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
build comp-keeper
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
ClickHouse/ClickHouse#137202 ·
Maintainers usually reply within 1 day