Skip to content

A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.

Archive earlier parts with stopActivity on handoff

Fei241167e02613dd23
diff --git a/ds-bot/src/host/parts.js b/ds-bot/src/host/parts.js
index 5ec7222c..e456f305 100644
--- a/ds-bot/src/host/parts.js
+++ b/ds-bot/src/host/parts.js
@@ -788,7 +788,7 @@ export function install(rt) {
if (currentOf(owner) !== sessionId) {
await forward(owner, held)
for (const message of held) agent.inbox.remove(message.id)
- await ctx.workspaceRegistry.archiveSession(sessionId)
+ await ctx.workspaceRegistry.archiveSession(sessionId, { stopActivity: true })
.catch(error => rt.warn('ds-bot: earlier part %s not archived: %s', sessionId, error))
} else {
try { wake(agent) } catch (error) { rt.warn('ds-bot: part %s could not be woken for its kept input: %s', sessionId, error) }
@@ -876,7 +876,7 @@ export function install(rt) {
}
if (job.moved) {
rt.renewMemory(agent.id)
- await ctx.workspaceRegistry.archiveSession(agent.id)
+ await ctx.workspaceRegistry.archiveSession(agent.id, { stopActivity: true })
.catch(error => rt.warn('ds-bot: earlier part %s not archived: %s', agent.id, error))
}
}
diff --git a/ds-bot/test/switch-keeps-input.test.js b/ds-bot/test/switch-keeps-input.test.js
index 1dff409d..344feedb 100644
--- a/ds-bot/test/switch-keeps-input.test.js
+++ b/ds-bot/test/switch-keeps-input.test.js
@@ -114,7 +114,7 @@ async function start({ fail = {}, services = {}, home: reuse } = {}) {
list: () => [{ id: 'w1', path: team }],
resolveByPath: async () => undefined,
create: async path => ({ id: 'w-new', path }),
- archiveSession: async (sessionId) => { archived.push(sessionId) },
+ archiveSession: async (sessionId, options) => { archived.push([sessionId, options]) },
},
sessionController: {
create: async (options) => {
@@ -301,7 +301,7 @@ test('a marked earlier part hands its kept input on after a restart, once, and i
assert.equal(delivered.filter(id => id === 'e-carry').length, 0) // already pending — not sent twice
assert.equal(delivered.filter(id => id === 'e-held').length, 1)
assert.deepEqual(inboxTexts(second.agentOf('b')), [])
- assert.ok(second.archived.includes('b'))
+ assert.deepEqual(second.archived, [['b', { stopActivity: true }]])
assert.deepEqual(second.state().switching, {})
})