Repository navigation
fix(host): retiring a Bot also disarms the group Sessions it speaks through (#1816) - #1825
Conversation
archiveBot paused the tasks of the Bot's own chat and its earlier parts, but a task armed on room.sessions[botId] or room.segments[botId] stayed active and kept delivering to a Bot that will not run. Every seat the Bot holds in a room is one of its Sessions; the room's own Session is not, since its rows belong to the whole group, and that stays armed. The archive answer counts those rows too, so it no longer says "in its own chat". Fixes ThinkFlowLab#1816 Tests: core/test/retired-bot-paths.test.js
|
Verdict: PASS at 33a5d46 Ran at this tip: Red first holds. With
The change is what it claims:
Scope: Not run at this tip: the full |
Written-by: Dev-4
Owner: Dev-4
Reviewer: Birfy
Fixes #1816
What was wrong
#1806closed#1799for a Bot's own chat and every part of it, and its doc sentence indocs/subsystems/core-host.mdsaid exactly that — which was the hole.rt.pauseBotSchedules(core/src/host/schedules.js) built the set of Sessions it disarms fromrt.chatOf(botId)plus each earlier part inbot.segments, so a Bot that speaks in a group kept every schedule it had armed on its group seat: the standup armed onroom.sessions[botId]was stillactiveafterarchive_bot, so a retired Bot still woke on its own.Red first
Base
6d969ea5cbe795eaee975f1bfc9773d0b7cf5952(live main at push time), treeb1f5352cd2e2907437b75addc5dd2aba6291aca3. Clean checkout at that base with only the new test file placed in the tree, runningnode --import ./test/harness-resolve.mjs --test test/retired-bot-paths.test.js:The shape is the issue's: Bot
Coderis a member of roomLaunch, with a standup armed ons-b3(room.sessions.b3) and one task onb3(its own chat), and the guards are the room's own taskr1and another member's seats-b2. Before the fix onlyb3was paused — the count saidPaused 1 task(s)ands-b3's row was leftactive.What changed
pauseBotSchedulesextends itspartsset with the room seats the Bot owns: for eachstate.roomsentry,room.sessions[botId]and everysessionIdinroom.segments[botId]. It reuses the ownership idearoster.deleteBotalready applies (roster.js:568-574, which records eachroom.sessions[id]/room.segments[id]part intostate.retiredSessions) rather than inventing a second one.room.idis never added: a room's own Session belongs to the whole group, so its schedules and those of the other members' seats stay armed — the test assertsr1ands-b2are stillactive.core/src/host/tools.jschanges the answer's copy fromPaused N task(s) in its own chat./N task(s) in its own chat are still armed.toacross its chats, because the count can now come from any part the Bot owns.The copy change's blast radius
grep -rn "in its own chat\|in its chats" core/ docs/ patches/ds-bot/files/: the only occurrences of the archive sentences are the two lines incore/src/host/tools.js(mirrored inpatches/ds-bot/0002-flybot-api-host.patch). Every other hit is unrelated copy —message_bot'sreply_todescription and receipt,request_secretin the README, the group-dispatch notes, and test names. No test pins the full sentence (the existing assertions match/Paused 2 task\(s\)/), and the zh path has no dictionary entry for it:i18n.js's ZH table has noArchived/Pausedstring andhostText()only translates verbatim ZH keys orHOST_ERRORSpatterns, so this text is not touched by locale. It is a tool result (model-facing), not a UI string — the client has no archive entry point; the sidebar's delete isdelete-bot→roster.deleteBot. So everyarchive_botanswer changes, including for a Bot with no group seat: that is intended, since the count may now come from any part.Doc: the
#1806sentence had to changedocs/subsystems/core-host.md(1 line, same paragraph):Before:
After:
Files
How
patches/ds-bot/0001was produced — read this before regenerating本机 git 2.34 的 diff 会重排相邻行的上下文/新增,故本补丁按 main 的
0001手工对齐 hunk 头;ds-bot-patches.mjs check只验 pin、按序 apply、结果等于core/,不验 patch 与generate输出一致;日后重跑generate可能重切这份补丁。Concretely: a fresh
generateon this base rewrites 25 lines around the insertion point (re-aligning context and added lines;--minimalhardly helps), so this PR takes main's0001as the base and inserts only the change that takes effect — the hunk header@@ -89,63 +89,547 @@→+89,554, the 3-line comment rewrite, and the 5-line loop. The result is 9/2 against main's0001, andcheck's third line proves the applied tree equalscore/byte for byte. A futuregeneratemay re-cut this patch; that drift is not smuggled content.generateon this base leftpatches/ds-bot/0008-client-bundle.patchbyte-identical to main's — the#1823bundle is carried as merged, not re-cut here.Where to read it
Checkout:
/home/xuke/.dsh/bot/workspace/w225(worktree of/home/xuke/.dsh/bot/workspace/flybot-clone), branchdev/4-group-session-pause, head33a5d4639f699ebe7c2d55272a5a7d3ce3365d68, tree30f3c7f3033129d2dc134c64d54d4d8c765437cb, base6d969ea5cbe795eaee975f1bfc9773d0b7cf5952.git diff 6d969ea5 -- core/src/host/schedules.jsshows thepartsset and thatroom.idis never added.Tests
core/test/retired-bot-paths.test.js: 22/22, including#1816: archiving disarms a task armed in the Bot's group Session, and only that(assertsPaused 2 task(s) across its chats.,pausedSchedulessessionIds['b3','s-b3'], and thatr1ands-b2are stillactive) and#1816: an earlier part of the Bot's group seat is disarmed too(aroom.segments.b3entry withsessionId: 's-b3-old').corefull suite: 2184/2184 at this head.ds-bot-patches check:ok ds-bot/ = Fei2411/DeepSeek-Bot@2b10c70,ok 10 patches apply cleanly in order,ok core/ equals ds-bot/ + patches/ds-bot/.check-arch-docswithARCH_DOCS_BASE=6d969ea5:OK (8 changed file(s)).build-client --check: exit 0.