A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.
Report mid-round posts and bound the drain loop
Fei2411356b438f4465
diff --git a/ds-bot/src/host/groups.js b/ds-bot/src/host/groups.jsindex 6f8f5307..4b54ab76 100644--- a/ds-bot/src/host/groups.js+++ b/ds-bot/src/host/groups.js@@ -466,7 +466,9 @@ export function install(rt) {async function runRound(room, round, signal, agent) {// The inbox check keeps a message sent during the last speaker's turn inside// this round: it drains at the loop's head even once the slots ran out.- for (let index = 0; index < round.slots.length || waitingLines(agent).length > 0 || (rt.roomInbox.get(room.id) ?? []).length > 0; index += 1) {+ // Entries the drains below cannot take — user lines need their own round —+ // must not hold the loop open, so only posts a Bot sent count here.+ for (let index = 0; index < round.slots.length || waitingLines(agent).length > 0 || (rt.roomInbox.get(room.id) ?? []).some(post => post.botId !== undefined); index += 1) {if (signal.aborted) breakdrainRoomInbox(room, round, index, agent)drainRoomPosts(room, round, index)@@ -664,7 +666,9 @@ export function install(rt) {for (const turn of round.started) void rt.stopRoomTurn?.(room.sessions?.[turn.botId] ?? turn.sessionId, turn.exchangeId)}await rt.save()- for (const post of posts) {+ // Posts steered into the running turn reported back through the round too:+ // the relay's snapshot only sees what queued before it.+ for (const post of [...posts, ...(round.postBacks ?? [])]) {if (post.reportBack && rt.botOf(post.botId)) void reportRound(room, post, round)}exec.concludeTurn?.()diff --git a/ds-bot/test/group-work.test.js b/ds-bot/test/group-work.test.jsindex 5550d5b8..68366f69 100644--- a/ds-bot/test/group-work.test.js+++ b/ds-bot/test/group-work.test.js@@ -433,7 +433,7 @@ const busyRound = async (t, room, services) => {test('a post steered into a busy group Session picks its speakers inside the running round', async (t) => {const { host, first } = await busyRound(t)- await host.tool('post_to_group', { group: 'Ops', message: '@Tester 看一下文档' }, 'a')+ await host.tool('post_to_group', { group: 'Ops', message: '@Tester 看一下文档', report_back: true }, 'a')const post = host.takePost()// The steered post lands as a user/message inside the running turn: it queues// into the room inbox, and the running round drains it for its speakers.@@ -444,6 +444,9 @@ test('a post steered into a busy group Session picks its speakers inside the runhost.finish('gc', '看过了。')await settle(() => first() !== undefined)assert.ok(first().replies.some(reply => reply.botId === 'c'))+ // Its report_back reaches the poster once the round it joined ends.+ await settle(() => host.agentOf('a').calls.length === 1)+ assert.match(text(host.agentOf('a').calls[0]), /Tester: 看过了。/)// The group Session itself hears the post at its next step while it works.host.emit('r1', 'turn/start', { turn: 9 })