Repository navigation
Stop IM replies leaking background results across chats - #1953
Conversation
Use the harness job registry and IM test adapter to expose the cross-chat reply routing on dev after PR #1920.
A job or child run from an earlier turn can report into the next chat on the same Session. Suppress outbound IM for the receiving turn when a notice cannot establish its launch turn, while leaving other input sources unchanged.
|
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. |
There was a problem hiding this comment.
Review at 60d15e5: one fix is needed before lulu merges.
The direct-Bot fix is correct. A tool-jobs or subagent-settled notice now drops the origin both before and after the claim, and the next clean turn can claim again. steer.js detached calls also use tool-jobs, so they are covered. Dropping instead of trying to prove ownership is the right call while DSH notices carry no job or launch-turn id. test/im.test.js passes 98/98, and lint and --check are clean.
Must fix: group member Sessions are not covered. In a group, room lines go out through originOf(room.sessionId). The new branch, however, calls dropOrigin(session.id) on the member's Session, which holds no origin, so the room's origin stays. I confirmed this with a probe: during an IM round in g1, member Session member-session (in groupOwners for r1) admits a tool-jobs notice and a subagent-settled notice. The member's room line reply using desktop job secret was still sent to g1. So a job or subagent started in an earlier desktop round, or in a round from another IM chat bound to the same room, can still reach the IM group. That is the same class as the P0-B "must never leak" case. Suggested direction: when the Session is a group member (rt.groupOwners.get(session.id)), also drop the origin of that room's Session. Add a group test like the direct ones.
Note, not blocking: a turn's own background job finishing mid-turn in the same chat now also withholds the rest of that IM reply. That matches dev before #1920, and the PR description explains it (DSH has no launch id). It means #1917's goal can't land as written: #1917 conflicts with this PR in im/index.js and should be closed, or wait for a DSH job/launch id.
Merge order: this PR and #1750 merge together cleanly. Land this first, then #1750 merges dev. #1917: see above.
Group messages use the room Session's origin, so dropping only a member's origin leaves background job and subagent results visible to an unrelated IM round. Drop the room's claim as well, without letting its pending reset re-enable delivery in the same turn.
There was a problem hiding this comment.
Re-review at 9e65daf: pass, ready for lulu.
My group finding is fixed. When a group member takes in a tool-jobs or subagent-settled notice, IM delivery now also stops on the room Session (rt.sessionOfRoom(...)), the same Session originOf uses for room lines. Clearing pendingReset for that room means a late room turn can't reopen IM in the same round. I reran my earlier probe on this head and nothing reached g1. The new tests cover both orders (notice before and after the claim) and show the next fresh group round still reaches g1. test/im.test.js passes 100/100, and lint and --check are clean.
Note, not blocking: if a member takes in such a notice while the room still counts as working (a member's turn is still running), the following IM round can't claim until the room's next idle turn/start. This fails closed and matches the doc.
Merge order: unchanged from my last review. Land this before #1750; the two merge cleanly. #1917 conflicts with this PR and should be closed.
Issue
Fixes the regression from #1920 that Devin Review flagged on #1917 (finding). Two IM chats can share one Bot Session. If a background job or subagent started in chat A's turn finishes (
tool-jobs/subagent-settled) during chat B's turn, the reply that uses A's result is sent to B. Since #1920, the claimed IM origin holds for the whole turn, so nothing in that turn withdraws it. The same leak happens in IM groups: when a group member Bot takes in such a result, its group reply goes out through the room's Session.What changed / 改了什么
ds-bot/src/host/im/index.js: a job or subagent completion that can't be shown to belong to the active IM claim drops the origin through the existingdropOriginpath. In a group, the drop also covers the room Session's claim, and a pending reset can't turn delivery back on later in that turn. For the rest of that turn, no IM output is sent; nothing is redirected. Every other input, Desktop/Web and card answers included, keeps Keep a turn's IM origin when other sources join it #1920's whole-turn behavior.tool-jobsnotice has no job id or launch-turn id either, so routing the result back to A would need that capability from DSH.ds-bot/test/im.test.js: new direct-chat regressions use a real DSH job completion and subagent notices that arrive before or after B claims the turn. New group regressions send a job notice and a subagent notice to a member, one before the room claims the turn and one after the relay turn ends. Before this fix they leaked todev(B got A's job output) or to the group (g1got the member's earlier result). Each test also checks that the next clean turn can still reply.docs/plans/2026-11-04-im.md: documents the exception.Changelog
IM replies no longer send a background job or subagent result to a different direct chat or IM group that shares the same Bot or room Session.
How I checked it / 怎么验证的
npm test(inds-bot/): 3611 tests, 3607 pass, 0 fail, 4 skippednode scripts/build-client.mjs --checknpm run lint: 0 errors, 89 warnings (same asdev)Checklist / 检查
src/client/changed →npm run buildran andclient.jsis committed. / 改了src/client/就已重新 build 并提交client.js。 (src/client/not changed)Co-authored-by. / 没有把 AI 工具写成作者或Co-authored-by。Agent: Devin (Cognition)
Implemented in session Check cross-chat IM reply leak on dev after 1920
Review with Devin · Open in Devin Desktop