Skip to content

Preserve QQ group sender identity and passive reply context - #1201

Open
kevinwang0224 wants to merge 2 commits into
Fei2411:devfrom
kevinwang0224:fix/1200-qq-group-replies
Open

kevinwang0224 wants to merge 2 commits into
Fei2411:devfrom
kevinwang0224:fix/1200-qq-group-replies

Conversation

@kevinwang0224

@kevinwang0224 kevinwang0224 commented Nov 9, 2026 •

Copy link
Copy Markdown

Issue

Fixes #1200

Summary

QQ group messages reached the model without member_openid, so messages from different members looked like the same user. A delayed passive reply also used the most recently received message in the chat, even when it answered an earlier question.

QQ group event
  retain member_openid and original message ID
  add sender identity to the model input
  persist reply context in the request source
    Bot turn: keep the first consumed QQ request
    group member turn: capture its context before answering
  queued response: send with that request's msg_id

Carry the same context through group progress and late replies. Keep existing multi-chat broadcasting: other listeners use their own chat context rather than borrowing another conversation's message ID. Existing QQ source IDs remain readable as platform markers. Delivery retains upstream sender-name overrides and abandoned-wait/exchange-recording options alongside QQ reply metadata; a regression covers these options together.

Changelog

QQ group conversations identify each sender by member openid, and delayed replies keep the original message association when another member speaks.

Evidence

  • Before: the two new identity/reply regressions both fail against untouched latest dev at c303f1f0: the model input is only my question, and the inbound chat has no original-message reply context.
  • After: all 52 tests in im.test.js, im-qq.test.js, qq-reply.test.js, handoff-abandon.test.js, and plugin-reload.test.js pass, including overlapping questions in a DS Bot group and independent message sequences for Alice and Bob.
  • Full unit suite, in a clean process environment: 2075 passed, 0 failed, 3 skipped.
  • Lint: 0 errors; generated client check passes; repository privacy scan: 0 must-fix findings.
  • Repository API smoke test against published DSH 0.2.2-rc.1, in fresh isolated profiles with matching mock settings: 51/52 steps passed on both this merge and unmodified dev at c303f1f0. Both fail the identical Chief first group turn sees its attached MCP and skill check: the skill is present, but the first group turn reports no MCP tool. This is a reproduced baseline limitation in this test setup, rather than a new failure introduced by the QQ change. Real QQ integration has not been exercised.

The QQ transport tests use a local fake HTTP/Gateway server; no real QQ credentials or group messages are involved. QQ's passive-reply window and quota still apply. Native quote bubbles and automatic member mentions are outside this change.

How I checked it / 怎么验证的

  • npm test (in ds-bot/, with inherited application environment cleared)
  • node scripts/build-client.mjs --check
  • npm run lint
  • Smoke test fully passes: executed node dev/smoke.mjs qq-merge 13096 and the matching unmodified-dev baseline node dev/smoke.mjs qq-merge-base 13097; results and the remaining limitation are detailed above. All test processes were stopped.
  • Screenshot: not applicable; host behavior only.

Merge Danger

Door: two-way

The change can be reverted without a data migration. Reply metadata is optional, and older QQ request IDs keep the previous fallback behavior.

Blast Radius: QQ

The metadata also crosses shared group/delivery code. The full unit suite covers those flows; the new group regression checks that a later question cannot overwrite a running member's captured reply context. Several inputs consumed in one turn share that turn's reply association.

Checklist / 检查

  • One issue, one subject.
  • Client sources and generated client.js are unchanged.
  • No keys, tokens, personal data, installed app files, or local application data are included.
  • No AI tool as author or Co-authored-by.

Group prompts discarded member_openid, and delayed passive replies reused the latest message in the chat. Carry the sender and original message through queued Bot replies and group member turns so later questions do not replace their reply context.
@kevinwang0224
kevinwang0224 marked this pull request as ready for review November 9, 2026 05:30
Merge upstream dev c303f1f. Keep the new sender-name, abandoned-wait and exchange-recording options together with QQ reply metadata. Cover their combined delivery path with a regression test.

@Fei2411 Fei2411 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Verdict: changes requested. The fix is still needed: on dev, qq.js still replies with the chat's lastMsgId (the newest message, not the one being answered), and group messages still reach the model without member_openid. But this branch can't go in as it stands.

  1. Merge dev. It is about 1000 commits behind, and the conflicts in delivery.js, groups.js, turns.js, im/index.js, qq.js and both tests are real ones. Please use scripts/merge-dev.sh (no rebase or force-push).
  2. Reuse dev's origin tracking. Since this branch was cut, dev records where each user message came from (the origin binding from e3d1e67). Carrying qqReply as a base64 JSON blob inside rpcId, and then threading it by hand through deliver, roomTurn, postInRound, postToRoom and lateRoomReply, adds a second QQ-only path through shared group code. Hanging the reply anchor off the origin dev already keeps would make this much smaller and keep groups.js and turns.js platform-neutral.
  3. Sender tag in the prompt. [QQ group sender: member_openid=...] goes into the user text, so it also shows in the transcript and in search. Please check whether dev's group speaker/via rendering can carry the sender instead.
  4. Ordering. Related work is in #1725, #1750 and #1768. Please rebase the idea on top of whichever of those lands first, so the QQ reply anchor and the origin fix don't fight.

The tests for the passive-reply window (qq-reply.test.js) are a good base to keep.

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.

2 participants