A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.
Recreate the team folder for a group's relay Session, notice on a member that never moved
Fei2411f04e8ab53550
diff --git a/ds-bot/src/host/parts.js b/ds-bot/src/host/parts.jsindex 00742018..7b57110d 100644--- a/ds-bot/src/host/parts.js+++ b/ds-bot/src/host/parts.js@@ -1088,22 +1088,27 @@ export function install(rt) {// fresh part to move to, so a stale or gone folder is corrected in place; without// this every round failed with 'directory does not exist' (#710).if (rt.roomOf(agent.id) !== undefined) {- if (current === rt.teamFolder()) return next()+ if (current === rt.teamFolder() && await rt.isFolder(current)) return next()const team = await rt.keepTeamFolder()if (team === undefined) return next()- await folders.set(agent, team, context.signal)- .catch(error => rt.warn('ds-bot: the group chat works in %s and could not change to %s: %s', current, team, error))+ // Already at the team path, it was only gone and is now made again.+ if (current !== team) {+ await folders.set(agent, team, context.signal)+ .catch(error => rt.warn('ds-bot: the group chat works in %s and could not change to %s: %s', current, team, error))+ }return next()}- if (await rt.isFolder(current)) return next()- const team = await rt.keepTeamFolder()- if (current === team || !rt.isBotSession(agent.id)) return next()const place = placeOf(agent.id)const wanted = rt.workDirOf(place)const usable = wanted !== undefined && await rt.isFolder(wanted)// A member whose group's folder went away works on in the team workspace; the- // group is told once, so every round is not told again.+ // group is told once, so every round is not told again. A member still in a+ // usable folder — it may never have moved to the group's — needs no correction,+ // but the group is told all the same.if (!usable) await rt.roomFolderNotice?.(place?.roomId, wanted)+ if (await rt.isFolder(current)) return next()+ const team = await rt.keepTeamFolder()+ if (current === team || !rt.isBotSession(agent.id)) return next()const target = usable ? wanted : teamif (target !== undefined) {await folders.set(agent, target, context.signal)diff --git a/ds-bot/test/work-dir.test.js b/ds-bot/test/work-dir.test.jsindex 96dce517..2e793794 100644--- a/ds-bot/test/work-dir.test.js+++ b/ds-bot/test/work-dir.test.js@@ -624,6 +624,18 @@ test("a group chat's own Session follows the team workspace it was made in", asyassert.deepEqual(sets, [['r1', moved]])})+// #710: the group's own Session sits in the team workspace; when that folder itself is+// deleted it is made again, as for any other Session.+test("a group chat's own Session makes a deleted team workspace again", async (t) => {+ const { sets, service } = folderService()+ const { ctx, agentOf, team, stop } = await start({ services: { workingDirectory: service } })+ t.after(stop)+ rmSync(team, { recursive: true, force: true })+ assert.equal(await assemble(ctx, agentOf('r1')), true)+ assert.equal(existsSync(team), true)+ assert.deepEqual(sets, [])+})+// #710: a member whose group's folder went away works on in the team workspace, and// the group is told once, not on every round.test('a group whose folder is gone works on in the team workspace and is told once', async (t) => {@@ -645,6 +657,24 @@ test('a group whose folder is gone works on in the team workspace and is told onassert.equal(state().rooms.r1.folderNotice, undefined)})+// #710: a member still in the team workspace when the group's folder went away needs+// no correction, but the group is still told once.+test("a member that never reached the group's folder still brings the one-time notice", async (t) => {+ const { sets, service } = folderService()+ const { ctx, call, agentOf, project, state, stop } = await start({ services: { workingDirectory: service } })+ t.after(stop)+ assert.equal((await call('update-room', { id: 'r1', workDir: project })).ok, true)+ rmSync(project, { recursive: true, force: true })+ // 'gb' was made in the team workspace and never moved to the group's folder.+ assert.equal(await assemble(ctx, agentOf('gb')), true)+ assert.deepEqual(sets, [])+ const notice = () => (state().rooms.r1.log ?? []).filter(line => line.kind === 'notice' && line.reason === 'folder')+ assert.equal(notice().length, 1)+ assert.equal(notice()[0].path, project)+ assert.equal(await assemble(ctx, agentOf('gb')), true)+ assert.equal(notice().length, 1)+})+// #710: a Session made for a folder that is registered as a workspace joins it, so it// does not stay ungrouped.test('a Bot whose working folder is a registered workspace joins it', async (t) => {