Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

Hotfix: a Buddy receives its own person's chat messages again (#2295)

0xken15e66e692e749e
diff --git a/backend/integration/superTabBuddies.test.ts b/backend/integration/superTabBuddies.test.ts
index 4e36ac1c1..7384144cb 100644
--- a/backend/integration/superTabBuddies.test.ts
+++ b/backend/integration/superTabBuddies.test.ts
@@ -155,6 +155,19 @@ describe('a Buddy through the store', () => {
expect((await f.store.read(owner, f.tab)).state.conversations.map(c => c.id)).not.toContain(chat)
})
+ it('hands its owner\'s own chat messages to the Buddy: the claim and the receipt both go through (prod 10-30, v1.3.71)', async () => {
+ const f = await swarm()
+ const { chat, agentId } = await buddy(f)
+ const sent = String((await f.execute({ type: 'message.send', conversationId: chat, text: 'Summarize my tasks', replyTo: null, recipientIds: [] }, peer)).result.messageId)
+ const waiting = (await f.store.deliveries(peer, f.tab, agentId)).find(d => d.messageId === sent)!
+ expect(waiting).toMatchObject({ status: 'queued' })
+ const claimId = randomUUID()
+ const claimed = await f.store.delivery(peer, f.tab, agentId, waiting.id, { type: 'claim', claimId })
+ expect(claimed).toMatchObject({ message: { id: sent, conversationId: chat } })
+ await f.store.delivery(peer, f.tab, agentId, waiting.id, { type: 'ack', claimId, receipt: 'r-1', uncertain: false })
+ expect(await db.superTabDelivery.findUniqueOrThrow({ where: { id: waiting.id } })).toMatchObject({ status: 'delivered', receipt: 'r-1' })
+ })
+
it('sends its owner\'s proposal to the PM in the project chat, once per ask', async () => {
const f = await swarm()
const { chat, agentId } = await buddy(f)
diff --git a/backend/src/superTabs/store.ts b/backend/src/superTabs/store.ts
index 936e4fed4..2f7e9d1ad 100644
--- a/backend/src/superTabs/store.ts
+++ b/backend/src/superTabs/store.ts
@@ -137,7 +137,9 @@ function deliveryTouches(delivery: SuperTabDelivery, state: SuperTabState): Touc
// A Buddy receives only while its person reads there (buddyNews.ts): their part guards the delivery, so taking the
// project from them while a claim is in flight makes it check again (security review 1 of #2178).
const person = state.agents.find(a => a.id === delivery.agentId)?.buddyOf?.personId
- if (person) touches.push({ kind: 'member', key: person })
+ // In the Buddy's own chat its person is also the sender: one part is touched once, or the claim's second guarded write of
+ // the same part version conflicts every retry and no message of theirs ever reaches the Buddy (prod 10-30, v1.3.71).
+ if (person && !touches.some(t => t.kind === 'member' && t.key === person)) touches.push({ kind: 'member', key: person })
return touches
}