Repository navigation
Conversation
The clock and memory recall append a user/message with form 'snapshot' after the chat's message. The outbound classifier treated it as another source and withdrew the origin, so the reply to the IM chat was dropped whenever a snapshot was injected (#1735).
|
I'll fix CI failures and address comments from users with write access that start with 'Devin'.
|
Codex Review Summary: ❌ FailedThis 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. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Review: the fix looks correct and safe. No blocking issues.
Does what it says
- The cause in #1735 is confirmed.
@deepseek-ai/dsh-time-context,ds-bot-time-context(src/host/time-context.js) and the memory snapshots insrc/host/memory.js(recall, group memory, memory update) all append auser/messagewithsource.form === 'snapshot'. Before this PR, such a message went to the finalelse, which calleddropOrigin(). - Keying on
forminstead of a list ofkinds is the right choice.snapshotis a variant of DSH's documentedContextFormedsource type, so any future context plugin that uses it is covered. - The early return comes before
pendingReset.delete(...). If a snapshot is the first message in a group Session's turn, it does not use up the pending reset; the next real message (orturn/end) still decides. The return also skips the send loop below, which is fine: auser/messageproduces nobot/viewdisplay items.
Tested
- I ran this locally on the PR head. Without the
im/index.jschange, the new test "a context snapshot in the same turn keeps the IM origin" fails. With it, the test passes.im,time-contextandtext-annotationtests: 83/83 pass.lintexits 0 (only existing warnings).build-client --checkis OK. - The second new test (a snapshot does not open a Web turn to IM) is a good guard. It also passes on
dev, so it is a regression test, not a repro.
Findings (non-blocking)
- CI:
ubuntu-latest · Node 24 · DSH 0.2.0-rc.2is red. The failure istest/text-annotation.test.js:157("Ctrl+Enter sends the annotated quote to a group…",0 !== 1). That is a client-side test this PR does not touch. The same job passed ondevat the same base (a95e3af), and the test passed 4 out of 4 runs locally. It looks like a flake. Please re-run the job and get it green before merging rather than merging on red. - Smoke test not run. AGENTS.md asks for the smoke test on
src/host/changes. The PR says so and gives a reason, and the change is small and fully covered by unit tests, so I consider the risk low. Still, it is a skipped step in the checklist. - Possible follow-up, not for this PR. DSH's
ContextFormedalso hasinstructions,catalogandnoticeforms. If any DSH plugin ever appends one of these as a mid-turnuser/message, it would still withdraw the IM origin in the same way. I did not see one in the current harness, so this is only a note.
PR form: the branch name fix/1735-… into dev, Fixes #1735, the Changelog field and the commit author (no AI co-author) follow AGENTS.md and CONTRIBUTING.
Fei2411
left a comment
There was a problem hiding this comment.
Verdict: APPROVE (posted as a comment because GitHub doesn't allow approving one's own PR) — the preferred fix of the three for #1735 (vs #1725, #1768).
- The early
returnforsource.form === 'snapshot'sits beforependingReset.delete, so a snapshot never claims, withdraws, or consumes the pending reset. In a group Session's late turn, the first real message still decides whether the origin is kept. - It covers every snapshot source on
dev: DSHruntime-context/time-contextand DS Bot's ownds-bot-time-context(time-context.js:42),ds-bot-memory-recall, group memory, andds-bot-memory-update(memory.js:919/932/962). Non-snapshot unknown sources still drop the origin, so the rule stays fail-closed. - Verified: merges cleanly with dev a95e3af,
npm test2899 pass / 0 fail,npm run lintexits 0.
Non-blocking: #1768's matrix (before/after × direct/group) is worth porting here or as a follow-up, especially the group-Session case, which these two tests don't cover. Once this lands, #1768 and #1725 can be closed.
Cover a snapshot arriving before and after the chat's message in both a direct and a group Session, and a group turn taken over from the Web.
Skip all non-waking attached context forms (snapshot, catalog, instructions, recall) and in-turn context kinds (working-directory, model-selection, repeat-tool-reminder, ptc-mode, plan-mode, action-cards, tool-goal, user-approval, compact-checkpoint, and cleared runtime-context) in the IM origin classifier, while continuing to fail closed for waking notices and relays (tool-jobs, subagent-settled, agent-message, schedule, goal). Fixes #1735.
Fei2411
left a comment
There was a problem hiding this comment.
Re-review of the commits since 714f3fa (comments only): nothing new to fix.
d6a33690adds the missing group-Session tests: before/after × direct/group, with group-line delivery asserted. That closes the gap noted earlier.b1cf3e09replaces the snapshot-only check withisAttachedContextSource(). Explicit user, IM, relay and RPC identities still go through normal classification.noticeandrelayforms fail closed, so tool jobs, subagents, peer relays, schedules and goals never keep an IM origin. The early return still runs beforependingReset.delete().- At
a615459the branch merges cleanly withdev.npm test(3057 pass),build-client --checkandlintpass. I did not rerun the bench smoke test.
One scope note, not a defect: a same-goal nudge (queueGoalRelay in goals.js, form: 'relay', role: 'goal') still withdraws the IM origin. #1768 proposed keeping it for a matching active goal. So landing this closes #1735 but not the scenario in #1767. Leave #1767 open, or link it to a follow-up.
…apshot # Conflicts: # ds-bot/src/host/im/index.js
…apshot # Conflicts: # ds-bot/src/host/im/index.js
DSH injects a background job's completion (tool-jobs) and a subagent's result (subagent-settled) into a busy owner's next step, inside the running turn; steer.js does the same for a call a steer detached. The IM classifier counted these like a new asker and withdrew the chat's origin, so an IM turn that ran a slow command into the background lost its reply without a word. A turn's first classified message still decides who asked. After it, these two kinds are the result of the turn's own work and leave the origin alone. As the first message of a turn (an idle Bot woken by followup) they still open a turn no IM chat asked for, and schedules, peer relays and Web messages joining a turn still withdraw it.
The diagnostics log is written in the background. Two tests read it with no wanted entry, so the first read could return before the MAX_TOKENS line landed and fail with 0 !== 1 on a slow runner. Wait for that entry, as the watched-turn test already does.
…apshot # Conflicts: # ds-bot/src/host/im/index.js
Issue
Fixes #1735
What changed / 改了什么
Bug: replies to an IM chat (Telegram etc.) were silently dropped whenever a context message was appended to the turn. The DSH clock (
kind: 'time-context'), DS Bot's own clock (ds-bot-time-context) and memory recall (ds-bot-memory-recall) all add auser/messagewithsource.form === 'snapshot'after the chat's message. Thesession/eventclassifier inds-bot/src/host/im/index.jssent it to the "any other source" branch, which calleddropOrigin()and marked the turn mixed, so the assistant's reply had no origin and was not sent.Now
isAttachedContextSource()skips attached context before classification: thesnapshot,catalog,instructionsandrecallforms, plus non-waking in-turn context kinds (runtime-context,working-directory,model-selection,plan-mode,compact-checkpoint, …, which also covers DSH releases beforesource.form). Such a message neither claims nor withdraws the origin, and does not consume a group's pending reset. Messages with an IM, RPC, user or DS Bot relay identity still go through normal classification, and thenoticeandrelayforms (tool jobs, subagents, peer relays, schedules, goals) still fail closed. A turn that a Web/peer/scheduled message started still sends nothing to IM. The check sits next to #1908's guard for an already consumed IM request, and both are kept.The job/subagent mid-turn exemption (92ab554) has been reverted here and moved to its own PR, #1917, because it still needs each job bound to the turn that started it (Devin Review found a cross-chat leak).
Changelog
IM replies are no longer lost when the current time, a memory recall or other context is added to the same turn.
How I checked it / 怎么验证的
npm test(inds-bot/): new tests intest/im.test.jscover a snapshot before and after the chat's message in a direct and a group Session (all four fail ondev, pass with the fix), the other attached context forms and kinds, waking notices/relays that still drop the origin, and Web-turn guards for a direct and a group Session. Full run after mergingdevwith Keep IM replies when an IM message event is redelivered #1908: 3516 passed, 0 failednode scripts/build-client.mjs --checknpm run lintindex.jsorsrc/host/: against DSHdsh-v0.2.2-rc.1, all 56 steps passed after merging currentdevChecklist / 检查
src/client/changed →npm run buildran andclient.jsis committed. (not changed)Co-authored-by.Implemented in session Fix Telegram replies dropped with time-context message
Review with Devin · Open in Devin Desktop