Repository navigation
Conversation
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. Moved from #1750 onto dev (originally 92ab554).
|
I'll fix CI failures and address comments from users with write access that start with 'Devin'.
|
There was a problem hiding this comment.
Devin Review found 1 finding. It is left for you to triage below.
| const midTurn = opened.has(session.id) | ||
| opened.add(session.id) | ||
| if (midTurn && OWN_WORK_KINDS.has(source?.kind)) return |
There was a problem hiding this comment.
🟥 Background results leak across IM chats
When A's background work finishes during B's turn on the same Bot Session, OWN_WORK_KINDS preserves B's reply origin. Neither tool-jobs nor subagent-settled checks which turn started the work. Replies incorporating A's private results can reach B's chat.
Devin left this for you to triage: This is the known open problem this draft was split out of #1750 for: one chat's job result can reach another chat that shares the Bot Session. Do not merge until each tool-jobs/subagent-settled result is bound to the turn that started it; lulu's call is that this fix goes in this PR before it is ready.
Was this helpful? React with 👍 or 👎 to provide feedback.
|
Closing in favor of #1953: keeping IM replies for background work started in the same turn isn't safe until completion notices say which turn launched it. |
Issue
No issue yet. This change was split out of #1750 (originally commit 92ab554) so that #1750 only fixes #1735.
Not ready to merge. Devin Review found a cross-chat leak (below). Before this can merge, each background job and subagent has to be bound to the turn that started it.
What changed / 改了什么
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.jsdoes the same for a call that a steer detached. The IM classifier inds-bot/src/host/im/index.jstreated these as a new asker and withdrew the chat's origin. So an IM turn that moved a slow command into the background lost its reply without any message.Now the first classified message of a turn still decides who asked. After that,
OWN_WORK_KINDS(tool-jobs,subagent-settled) 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. Schedules, peer relays and Web messages that join a turn still withdraw the origin.Open problem (Devin Review, security): two IM chats can share one Bot Session. A job started in chat A's turn can finish during chat B's turn, and the reply that uses A's result then goes to B; before this change, that reply was not sent at all. The exemption needs to check that the job or subagent was started by the current turn.
This PR is kept separate from the planned change that keeps the IM origin for the whole turn (#1869 / #1886).
Changelog
IM replies are no longer lost when a background job or subagent that the same turn started reports back mid-turn.
How I checked it / 怎么验证的
npm test(inds-bot/):test/im.test.jspasses 80/80 on this branch, including the new own-work tests (direct, group, idle wake) and the schedule / relay / Web withdraw testsnode scripts/build-client.mjs --check(no client change)npm run lintChecklist / 检查
src/client/changed →npm run buildran andclient.jsis committed. (not changed)Co-authored-by.Agent: Devin (moved Fei2411's commit; the original change was written with Claude Code)
Implemented in session Fix Telegram replies dropped with time-context message
Review with Devin · Open in Devin Desktop