Repository navigation
fix(im): resend only the undelivered chunks when a QQ reply is retried - #1871
Merged
Merged
Conversation
A long QQ reply goes out as several posts. When a later post failed, the IM queue kept the whole job and Try again (or a backoff retry) sent it from the first chunk, so the recipient got the delivered chunks twice. The QQ adapter now remembers, per job, how many chunks QQ took and resumes after them.
Contributor
|
I'll fix CI failures and address comments from users with write access that start with 'Devin'.
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Fei2411
commented
Nov 19, 2026
Fei2411
left a comment
Owner
Author
There was a problem hiding this comment.
Code Reaper review (comments only).
Verdict: ready for lulu, after one body fix.
What I checked
- The resume logic is right for the queue as it is:
drainsendsqueue.jobs[0](index.js:589), a backoff retry re-runs the same object,retainFailedkeeps it, andim-retryputs it back withenqueue(conn, chatKey, job)(index.js:1353). The replay onto a new runner (index.js:607) also moves the same object. So theWeakMapkeyed by the job holds in every retry path, and the newim.test.jscase pins that contract. - The
textcheck anddelivered.deleteon success mean an edited or finished job starts from chunk 1. A failed markdown→plain fallback leaves the chunk uncounted, so it is retried, which is correct. - With #1866 merged in (
git mergeof both heads, no conflicts):im-qq.test.js+im.test.js80/80 pass. #1866's 304023/304024 "awaiting audit" return has noid, somessageIdkeeps the last real id andcountstill moves on. That's correct: the audited chunk is not sent again.
Needs fixing
- The PR body has no
Agent: Devin (Cognition)line (AGENTS.md PR rule).
Not a blocker, for the record
- A timeout or 5xx on a chunk that QQ actually accepted is still sent twice on retry. The client can't tell that case apart, so this PR doesn't cover it and doesn't have to.
Overlaps
- #1866: separate hunks, merges cleanly. Fine in either order.
- #1862 (QQ/DingTalk/WeChat inbound media) conflicts with this PR in
qq.js. Both add top-level declarations afterINTENTS: this PR'sdeliveredWeakMap and #1862'sIMAGE_EXTS/attachment helpers. Keep both blocks. Whichever lands second needsscripts/merge-dev.shand that one-line resolution.
…-chunks # Conflicts: # ds-bot/src/host/im/platforms/qq.js
…-chunks # Conflicts: # ds-bot/test/im.test.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
No issue filed. Devin Review found it on #1866 (finding); the bug is older than that PR.
What changed / 改了什么
Bug: QQ sends a long reply as several posts. When a later post failed, the IM queue kept the whole job, and Try again (or a backoff retry after a 5xx) sent it again from the first chunk. The recipient got the chunks that were already delivered a second time.
WeakMapkeyed by the job, so it also works when Try again reconnects and gets a new handle). A retry of the same job continues after those chunks. If the job's text changed, or the job already finished, it starts again from the first chunk.im.test.jschecks that.Overlap with #1866: that PR changes
api()in the same file, and this one changes thesendloop. The two branches merge with no conflicts, andim-qq.test.jspasses with both applied (20/20). #1866 sends 2xxerr_coderefusals into the same retained-failure path, so after both merge, those refusals also retry only the remaining chunks.Changelog
Using Try again on a long QQ reply that partly failed now sends only the parts that did not arrive, so the recipient no longer gets the earlier parts twice.
How I checked it / 怎么验证的
npm test(inds-bot/): 3094 tests, 0 fail, 4 skipped. The new QQ test fails ondev(postsa, b, a, b, cinstead ofa, b, b, c).node scripts/build-client.mjs --checknpm run lintdsh-v0.2.2-rc.1: all 52 steps passChecklist / 检查
src/client/changed →npm run buildran andclient.jsis committed. (src/client/not changed)Co-authored-by. / 没有把 AI 工具写成作者或Co-authored-by。Agent: Devin (Cognition)
Implemented in session Stop QQ Try again resending delivered chunks
Review with Devin · Open in Devin Desktop