Repository navigation
fix(im): keep the reply origin when attached context joins the turn - #1842
super-new13 wants to merge 2 commits into
Conversation
Fei2411
left a comment
There was a problem hiding this comment.
Verdict: recommend closing in favour of #1750 (comment only, no changes requested).
The fix is correct for the WeChat case, and I confirmed it locally: merged onto current dev, test/im.test.js passes (61/61), build-client --check and lint are clean.
It is superseded, though:
- #1750 fixes the same root cause for #1718 / #1735. It is the fix the maintainer review already picked as the preferred one for this issue family, and it is still open.
- Both PRs rewrite the same block of
session/eventhandling insrc/host/im/index.jsand edittest/im.test.js. They conflict, so only one of them can land. - This PR filters attached context with a hard-coded list of
kind/formvalues. Any new context kind that is not added toATTACHED_CONTEXT_KINDSbrings the bug back. #1750 decides from the snapshot origin, so it does not need that list.
Your PR description already says to close this one if #1750 lands first, and I agree. The WeChat repro tests, a snapshot after the IM message and a snapshot before it, are still useful. If #1750 does not cover these orderings, please suggest them there as review comments or put them in a small follow-up PR on top of #1750.
Fei2411
left a comment
There was a problem hiding this comment.
I still recommend consolidating this in #1750, but the comparison has changed since my earlier review. At the current heads, ds-bot/src/host/im/index.js:29–60,1487–1490 has the same attached-context classifier and early return in both PRs (the production-file diff is just a blank line). #1750 no longer avoids the kind/form lists; that is not a reason to prefer it. The two branches still conflict if combined. #1750 has broader tests for direct/group turns and a waking notice; this PR has the explicit Weixin clock test and the before-IM ordering in ds-bot/test/im.test.js. Please carry those regressions into #1750 rather than merging both implementations.
|
Thank you for the investigation and clean tests! Since this overlaps with #1750, we'll consolidate the fix there and close this PR. |
Issue
Fixes #1718 (weixin case); same root cause family as #1735. Independently reproduced on the weixin (iLink) platform.
What changed / ????
ds-bot/src/host/im/index.js: thesession/eventoutbound classifier dropped a turn's IM origin whenever anyuser/messagethat is not the IM request joined the turn. On 0.3.8, a weixin direct chat message ("??") claimed the origin at seq 493, the DSH clock appended{ kind: 'time-context', form: 'snapshot' }at seq 494, the classifier hit the catch-allelse?dropOrigin()+mixed, and the Bot's reply at seq 495 was silently dropped (no send attempt, no log - "the app has it, WeChat never gets it").Attached context now neither claims nor withdraws the origin:
isAttachedContextSource()recognizes DSH's attachedContextFormvalues (snapshot/catalog/instructions/recall) and the non-waking in-turn context kinds (runtime-context,time-context,skill-catalog,model-selection,compact-checkpoint, .). Waking triggers that share thenotice/relayforms (tool-jobs, subagent-settled, webhook, peer relays) still fail closed, and a Web/peer/scheduled message still withdraws the origin.This is the same direction as #1750 - if that one lands first, please close this and feel free to take just the tests.
Evidence (weixin, 0.3.8 desktop asar)
Transcript of the Bot's session, one turn:
user/messagesource={kind:'user', rpcId:'im:weixin:38d6.'}- origin claimeduser/messagesource={kind:'time-context', form:'snapshot'}- the clock; on 0.3.8 this alone kills the replyassistant/message- delivered in the app, never sent to WeChatHot-patched the shipped
app.asarwith this change and restarted: the same flow now delivers to WeChat. The 10-minute injection interval (refreshIntervalMs) is why it looked intermittent: the first message after a quiet period is dropped, follow-ups within the interval arrive.How I checked it / ?????
node --checkon the changed filereply originsuite helpers; not able to run the fullnpm testsuite in this environment - please let CI cover itChecklist / ??
src/client/changed ?npm run buildran andclient.jsis committed. (not changed)Co-authored-by.