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.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
Merge batch 11-04 b2250: #3040 #3038 #3034 (#3048)
0xken15d0a7355e29ef
diff --git a/backend/integration/superTabBuddies.test.ts b/backend/integration/superTabBuddies.test.tsindex 36a183420..6b75b993f 100644--- a/backend/integration/superTabBuddies.test.ts+++ b/backend/integration/superTabBuddies.test.ts@@ -362,6 +362,10 @@ describe('a Buddy through the store', () => {const theirs = (await f.store.decisions(peer, f.tab, 'open')).decisionsexpect(theirs.map(d => d.question).sort()).toEqual([...routing.map(r => r.question), 'Which week?'].sort())expect((await f.store.decisions(peer, f.tab, 'open', agentId)).decisions.map(d => d.question)).toEqual(['Which week?'])+ // An agent reads whom a decision asks by name, never email; the person's own app keeps it (review of #2954).+ expect((await f.store.decisions(peer, f.tab, 'open', agentId)).decisions[0]).toMatchObject({ personEmail: null, personName: expect.any(String) })+ expect(JSON.stringify((await f.store.decisions(peer, f.tab, 'open', agentId)).decisions)).not.toContain(peer.email)+ expect(theirs.find(d => d.question === 'Which week?')).toMatchObject({ personEmail: peer.email })// Left to the PM: the plain one's line reaches the Buddy chat, the proposal's never does, and the Buddy's answered list holds no proposal.await f.execute({ type: 'decision.answer', decisionId: routing[0]!.id, delegate: true }, peer)await f.execute({ type: 'decision.answer', decisionId: theirs.find(d => d.question === 'Which week?')!.id, delegate: true }, peer)diff --git a/backend/integration/superTabLiveness.test.ts b/backend/integration/superTabLiveness.test.tsindex f9f5eca04..80f236556 100644--- a/backend/integration/superTabLiveness.test.ts+++ b/backend/integration/superTabLiveness.test.ts@@ -566,11 +566,13 @@ describe('messages from an agent whose task moved', () => {String((await f.execute({ type: 'message.send', conversationId: f.group, text, replyTo: extra.replyTo ?? null, recipientIds: extra.recipientIds ?? [] },host, agentId)).result.messageId)- it('reach the Lead once the task is lost, its alarm and its reply to the Lead\'s question alike, while its status stays refused', async () => {+ // Since #2963 a post reaches the Lead when it names it or answers it; an unnamed one reaches no agent.+ it('reach the Lead once the task is lost, its alarm naming it and its reply to the Lead\'s question alike, while its status stays refused', async () => {const f = await swarm()await f.observe('test-host', [], { stoppedHarnessIds: [f.harness.worker] })expect((await f.assignment()).status).toBe('lost')- const alarm = await post(f, f.worker, 'Severe, prod: the backend worker has been down for 44 minutes.')+ expect(await deliveredTo(await post(f, f.worker, 'Is anyone there?'))).toEqual([])+ const alarm = await post(f, f.worker, 'Severe, prod: the backend worker has been down for 44 minutes.', { recipientIds: [f.lead] })const question = await post(f, f.lead, 'Is it still down?', { recipientIds: [f.worker] })const answer = await post(f, f.worker, 'Still down at 22:50.', { replyTo: question })expect(await deliveredTo(alarm)).toEqual([f.lead])@@ -590,7 +592,9 @@ describe('messages from an agent whose task moved', () => {const neighbour = await f.add(elsewhere, 'test-host', randomUUID(), 'Neighbour')const otherProject = String((await f.execute({ type: 'project.create', name: 'Other', visibility: 'public', brief: '' })).result.conversationId)const outsider = await f.add(otherProject, 'test-host', randomUUID(), 'Outsider')- expect(await deliveredTo(await post(f, f.worker, 'The worker is down.'))).toEqual([f.lead])+ // An unnamed post reaches the task's assignee now, the Lead when it names it (#2963).+ expect(await deliveredTo(await post(f, f.worker, 'The worker is down.'))).toEqual([other])+ expect(await deliveredTo(await post(f, f.worker, 'The worker is down.', { recipientIds: [f.lead] }))).toEqual([f.lead])// A post that names its agents reaches only them, never a copy to the Lead (project instructions, phase 1).expect(await deliveredTo(await post(f, f.worker, 'Over to you.', { recipientIds: [other] }))).toEqual([other])const stored = await db.superTabMessage.count({ where: { tabId: f.tab } })@@ -599,8 +603,9 @@ describe('messages from an agent whose task moved', () => {expect(await db.superTabDelivery.count({ where: { tabId: f.tab, agentId: outsider } })).toBe(0)// An agent of the same project in another task is named directly, and joins the group to answer there.expect(await deliveredTo(await post(f, f.worker, 'Can you look?', { recipientIds: [neighbour] }))).toEqual([neighbour])- // The new worker and the Lead talk as before; the Lead's plain post reaches the new worker, not the old one.- expect(await deliveredTo(await post(f, other, 'Taking over.'))).toEqual([f.lead])+ // The new worker names the Lead; the Lead's plain post reaches the new worker, not the old one.+ expect(await deliveredTo(await post(f, other, 'Taking over.'))).toEqual([])+ expect(await deliveredTo(await post(f, other, 'Taking over.', { recipientIds: [f.lead] }))).toEqual([f.lead])expect(await deliveredTo(await post(f, f.lead, 'Go ahead.'))).toEqual([other])await expect(f.execute({ type: 'work.status', conversationId: f.group, assignmentId: f.assignmentId, status: 'working', result: null }, host, f.worker)).rejects.toMatchObject({ code: 'ASSIGNMENT_LOST' })@@ -611,7 +616,8 @@ describe('messages from an agent whose task moved', () => {const f = await swarm()await f.observe('test-host', [], { stoppedHarnessIds: [f.harness.worker] })await f.execute({ type: 'work.cancel', conversationId: f.group, assignmentId: f.assignmentId, reason: 'Not needed any more' }, host, f.lead)- expect(await deliveredTo(await post(f, f.worker, 'Stopping; the last check was clean.'))).toEqual([f.lead])+ expect(await deliveredTo(await post(f, f.worker, 'Stopping; the last check was clean.'))).toEqual([])+ expect(await deliveredTo(await post(f, f.worker, 'Stopping; the last check was clean.', { recipientIds: [f.lead] }))).toEqual([f.lead])})// Review of #2243: only the current assignment and the latest lost attempt were recognized.@@ -620,7 +626,7 @@ describe('messages from an agent whose task moved', () => {await f.execute({ type: 'work.cancel', conversationId: f.group, assignmentId: f.assignmentId, reason: 'Moving it' }, host, f.lead)const other = await f.add(f.group, 'test-host', f.harness.other, 'Other')await f.execute({ type: 'work.assign', conversationId: f.group, agentId: other })- expect(await deliveredTo(await post(f, f.worker, 'Severe: the worker is down.'))).toEqual([f.lead])+ expect(await deliveredTo(await post(f, f.worker, 'Severe: the worker is down.', { recipientIds: [f.lead] }))).toEqual([f.lead])await expect(f.execute({ type: 'work.status', conversationId: f.group, assignmentId: f.assignmentId, status: 'working', result: null }, host, f.worker)).rejects.toMatchObject({ code: 'STALE_ASSIGNMENT' })})@@ -633,8 +639,8 @@ describe('messages from an agent whose task moved', () => {// The first worker is back and running; only the second's session stopped.await f.observe('test-host', [f.harness.worker], { stoppedHarnessIds: [f.harness.other] })expect(await f.assignment()).toMatchObject({ id: next, status: 'lost' })- expect(await deliveredTo(await post(f, f.worker, 'Severe: the worker is down.'))).toEqual([f.lead])- expect(await deliveredTo(await post(f, other, 'Lost my session.'))).toEqual([f.lead])+ expect(await deliveredTo(await post(f, f.worker, 'Severe: the worker is down.', { recipientIds: [f.lead] }))).toEqual([f.lead])+ expect(await deliveredTo(await post(f, other, 'Lost my session.', { recipientIds: [f.lead] }))).toEqual([f.lead])await expect(f.execute({ type: 'work.status', conversationId: f.group, assignmentId: f.assignmentId, status: 'working', result: null }, host, f.worker)).rejects.toMatchObject({ code: 'STALE_ASSIGNMENT' })await expect(f.execute({ type: 'work.status', conversationId: f.group, assignmentId: next, status: 'working', result: null }, host, other))@@ -1878,9 +1884,9 @@ describe('the push for a new delivery', () => {const forWorker = await claimedFor(f, f.worker, 'For the worker', 'claim-worker')await claimedFor(f, f.lead, 'For the lead', 'claim-lead')waiting.length = 0- await f.execute({ type: 'message.send', conversationId: f.group, text: 'Done.', replyTo: forWorker, recipientIds: [] }, host, f.worker)+ await f.execute({ type: 'message.send', conversationId: f.group, text: 'Done.', replyTo: forWorker, recipientIds: [f.lead] }, host, f.worker)expect(waiting).toContainEqual({ machineId: 'test-host', tabId: f.tab, agentId: f.worker })- // The reply is itself a new delivery for the Lead, told once for it: not told again for the claim it holds.+ // The reply, naming the Lead (#2963), is itself a new delivery for the Lead, told once for it: not told again for the claim it holds.expect(waiting.filter(w => w.agentId === f.lead)).toHaveLength(1)})@@ -2018,9 +2024,9 @@ describe('the morning digest', () => {// One shared decision, older than 200 private ones.await db.superTabDecision.createMany({ data: [...asked(f.group, 1, 1_000), ...asked(secret, 200, 5_000)] })f.clock.now = 3 * 60 * 60_000 - 24 * 60 * 60_000- expect(await digestText()).toMatch(/\nDecisions waiting:\n- #1 Ship the parser: 1 for owner@example\.com$/)+ expect(await digestText()).toMatch(/\nDecisions waiting:\n- #1 Ship the parser: 1 for owner$/)await db.superTabDecision.createMany({ data: asked(f.group, 200, 10_000) })- expect(await digestText()).toMatch(/\nDecisions waiting:\n- #1 Ship the parser: 201 for owner@example\.com$/)+ expect(await digestText()).toMatch(/\nDecisions waiting:\n- #1 Ship the parser: 201 for owner$/)})// groupBy on SuperTabDecision once panicked the Prisma engine on Mongo (review of #1855): the same counts, read without it.@@ -2038,7 +2044,7 @@ describe('the morning digest', () => {await f.leadInbox()expect(counted.ops).not.toContain('SuperTabDecision.groupBy')const digest = (await db.superTabMessage.findMany({ where: { tabId: f.tab } })).find(m => (m.source as { kind?: string } | null)?.kind === 'digest-request')!- expect(digest.text).toMatch(/\nDecisions waiting:\n- #1 Ship the parser: 2 for owner@example\.com$/)+ expect(digest.text).toMatch(/\nDecisions waiting:\n- #1 Ship the parser: 2 for owner$/)// The Lead's to write up: the people in its chat read the digest it posts, not this request.const read = async (asAgentId?: string) => (await f.timed.messages(asAgentId ? host : owner, f.tab, digest.conversationId, {}, asAgentId)).messages.map(m => m.id)expect(await read(f.lead)).toContain(digest.id)@@ -2057,7 +2063,7 @@ describe('the morning digest', () => {f.clock.now = 3 * 60 * 60_000 + 2 * 24 * 60 * 60_000await f.leadInbox()const digest = (await db.superTabMessage.findMany({ where: { tabId: f.tab } })).find(m => (m.source as { kind?: string } | null)?.kind === 'digest-request')!- expect(digest.text).toMatch(/\nDecisions waiting:\n- #1 Ship the parser: 1 for owner@example\.com$/)+ expect(digest.text).toMatch(/\nDecisions waiting:\n- #1 Ship the parser: 1 for owner$/)})it('lists the decisions waiting, by conversation and person, never their questions', async () => {@@ -2069,7 +2075,7 @@ describe('the morning digest', () => {f.clock.now = 3 * 60 * 60_000await f.leadInbox()const digest = (await db.superTabMessage.findMany({ where: { tabId: f.tab } })).find(m => (m.source as { kind?: string } | null)?.kind === 'digest-request')!- expect(digest.text).toMatch(/\nDecisions waiting:\n- #1 Ship the parser: 2 for owner@example\.com$/)+ expect(digest.text).toMatch(/\nDecisions waiting:\n- #1 Ship the parser: 2 for owner$/)expect(digest.text).not.toMatch(/Secret launch plan|Price it|Behind a flag/)})diff --git a/backend/integration/superTabMessagePages.test.ts b/backend/integration/superTabMessagePages.test.tsindex 1c348c2de..7423478cd 100644--- a/backend/integration/superTabMessagePages.test.ts+++ b/backend/integration/superTabMessagePages.test.ts@@ -222,3 +222,26 @@ describe('receipts read the same live or compacted (spec 5 A3)', () => {for (const reply of replies) expect(JSON.stringify(reply)).not.toMatch(/"receipts"|"deliveryIds"|"deliveryId"|"machineOwnerId"|"claimId"/)})})++// Task #2954 (Ken, 11-04): a person's message is stored with their email as its author's name; agents copied it into+// commands and pull request bodies until a machine's privacy hook stopped their sessions for a person to approve.+describe('a person author as an agent reads it (task #2954)', () => {+ it('names the person, never their email, in a claim, a page, a one-message read and a thread; a person reads the row as stored', async () => {+ const f = await fixture()+ const root = String((await run(f.tab, { type: 'message.send', conversationId: 'lead', text: 'Ship it?', replyTo: null, recipientIds: [] })).result.messageId)+ const reply = String((await run(f.tab, { type: 'message.send', conversationId: 'lead', text: 'Today, please.', replyTo: root, recipientIds: [] })).result.messageId)+ const named = { kind: 'person', id: owner.sub, name: 'owner', displayName: 'owner' }+ const delivery = (await store.deliveries(host, f.tab, f.lead)).find(d => d.messageId === reply)!+ const claimed = await store.delivery(host, f.tab, f.lead, delivery.id, { type: 'claim', claimId: 'claim-2954' })+ expect(claimed.message!.author).toMatchObject(named)+ const reads = [claimed, await store.messages(host, f.tab, 'lead', {}, f.lead), await store.messages(host, f.tab, 'lead', { messageId: root }, f.lead),+ await store.messages(host, f.tab, 'lead', { thread: root }, f.lead)]+ for (const read of reads) expect(JSON.stringify(read)).not.toContain(owner.email)+ const page = await store.messages(host, f.tab, 'lead', {}, f.lead)+ expect(page.messages.find(m => m.id === root)!.author).toMatchObject(named)+ expect(page.threads.find(t => t.id === root)!.authors).toEqual([expect.objectContaining(named)])+ // People's apps match a person author by the stored row (Desktop superTabPersonName): theirs is unchanged.+ const theirs = await store.messages(owner, f.tab, 'lead', {})+ expect(theirs.messages.find(m => m.id === root)!.author).toEqual({ kind: 'person', id: owner.sub, name: owner.email, membershipGeneration: expect.any(String) })+ })+})diff --git a/backend/integration/superTabProjectChatWorkers.test.ts b/backend/integration/superTabProjectChatWorkers.test.tsindex d1759d8d6..0c98ee558 100644--- a/backend/integration/superTabProjectChatWorkers.test.ts+++ b/backend/integration/superTabProjectChatWorkers.test.ts@@ -57,7 +57,7 @@ describe('an agent with a task in the project, in its project chat', () => {const below = String((await run(tab, post('Also the phone, please.'))).result.messageId)expect(await members()).toEqual([lead])const rows = (await store.messages(owner, tab, 'lead', {})).messages- expect(rows.find(m => m.id === line)).toMatchObject({ author: { kind: 'agent', id: engineer }, thread: asked, recipientIds: [lead] })+ expect(rows.find(m => m.id === line)).toMatchObject({ author: { kind: 'agent', id: engineer }, thread: asked, recipientIds: [] })expect(rows.find(m => m.id === inThread)!.recipientIds).toEqual([engineer])expect(rows.find(m => m.id === below)!.recipientIds).toEqual([engineer, lead])const deliveries = await store.deliveries(host, tab, engineer)diff --git a/backend/integration/superTabRead.test.ts b/backend/integration/superTabRead.test.tsindex 9a581fe5f..665e6ab43 100644--- a/backend/integration/superTabRead.test.ts+++ b/backend/integration/superTabRead.test.ts@@ -1175,7 +1175,7 @@ describe('decisions asked of one person (v2)', () => {const needs = await post(s.tabId, { type: 'work.status', conversationId: s.web, assignmentId, status: 'needs_human', result: 'Ship how?',ask: { personId: peer.sub, options: ['Behind a flag', 'To everyone'], recommended: 0, unblocks: 'The release' } }, owner, s.worker)expect(needs.status, JSON.stringify(needs.body)).toBe(200)- const notAsked = `Not asked ${peer.email}: 20 decisions you asked them are still open, and at most 20 can be. Wait for answers before asking more.`+ const notAsked = `Not asked peer: 20 decisions you asked them are still open, and at most 20 can be. Wait for answers before asking more.`expect(needs.body.data.result.notAsked).toBe(notAsked)const after = await assignment()expect(after).toMatchObject({ status: 'needs_human', result: 'Ship how?' })@@ -1188,7 +1188,7 @@ describe('decisions asked of one person (v2)', () => {ask: { personId: peer.sub, options: ['Behind a flag', 'To everyone'], recommended: 0, unblocks: 'The release' } }, owner, s.worker)expect(repeat.body.data.result.notAsked).toBeUndefined()expect((await db.superTabMessage.findFirst({ where: { tabId: s.tabId, conversationId: s.web }, orderBy: { sequence: 'desc' } }))!.text)- .toBe(`Needs a human\n\nQuestion 1?\n\nAsked ${peer.email}.`)+ .toBe(`Needs a human\n\nQuestion 1?\n\nAsked peer.`)expect(await db.superTabDecision.count({ where: { tabId: s.tabId, askerAgentId: s.worker } })).toBe(20)})diff --git a/backend/integration/superTabs.test.ts b/backend/integration/superTabs.test.tsindex 09c28f0df..cdb4022a2 100644--- a/backend/integration/superTabs.test.ts+++ b/backend/integration/superTabs.test.ts@@ -5280,7 +5280,7 @@ describe('Swarm parts under concurrent writes', () => {const { tab, lead } = await fixture()const groups = await Promise.all(['North', 'South', 'East'].map(title => workGroup(tab, title)))for (const { group, worker } of groups) {- for (let i = 0; i < 2; i++) await run(tab, { type: 'message.send', conversationId: group, text: `Report ${i}`, replyTo: null, recipientIds: [] }, host, worker)+ for (let i = 0; i < 2; i++) await run(tab, { type: 'message.send', conversationId: group, text: `Report ${i}`, replyTo: null, recipientIds: [lead] }, host, worker)}const waiting = await store.deliveries(host, tab, lead)expect(waiting.length).toBeGreaterThanOrEqual(6)@@ -5325,7 +5325,7 @@ describe('Swarm parts under concurrent writes', () => {it('serializes a claim against revoking an agent sender', async () => {const { tab, lead } = await fixture()const { group, worker } = await workGroup(tab, 'Revoked')- await run(tab, { type: 'message.send', conversationId: group, text: 'Report for the Lead.', replyTo: null, recipientIds: [] }, host, worker)+ await run(tab, { type: 'message.send', conversationId: group, text: 'Report for the Lead.', replyTo: null, recipientIds: [lead] }, host, worker)const delivery = (await store.deliveries(host, tab, lead)).find(d => d.authorId === worker)!await run(tab, { type: 'work.cancel', conversationId: group, assignmentId: (await store.read(owner, tab)).state.conversations.find(c => c.id === group)!.assignment!.id,reason: 'Withdrawing the worker' })diff --git a/backend/src/superTabs/buddies.test.ts b/backend/src/superTabs/buddies.test.tsindex f643642e0..7243353cf 100644--- a/backend/src/superTabs/buddies.test.ts+++ b/backend/src/superTabs/buddies.test.ts@@ -1069,7 +1069,8 @@ describe('the PM\'s private line to a person (Ken, 10-29)', () => {const secret = f.run({ type: 'project.create', name: 'Secret', visibility: 'private', brief: '' }).result as { projectId: string; conversationId: string }const secretPm = f.run({ type: 'agent.add', conversationId: secret.conversationId, harnessId: 'secret-pm', machineId: 'machine', name: 'Secret PM',configuration, lead: true }).result.agentId as string- expect(() => f.run(tell(), agentActor(secretPm))).toThrow('cannot read this project')+ // By username, never email (task #2954).+ expect(() => f.run(tell(), agentActor(secretPm))).toThrow(/^peer cannot read this project\.$/)const webPm = f.state.agents.find(a => a.harnessId === 'web-pm')!.idconst told = f.run(tell(), agentActor(webPm))expect(told.messages.map(m => m.conversationId)).toEqual([peerSwarmChat, buddyChatId(f.web.projectId, { id: 'peer', generation: 'first' })])diff --git a/backend/src/superTabs/commands.test.ts b/backend/src/superTabs/commands.test.tsindex 9306820db..a4971460b 100644--- a/backend/src/superTabs/commands.test.ts+++ b/backend/src/superTabs/commands.test.ts@@ -1,6 +1,6 @@import { describe, expect, it } from 'vitest'import { storeOldLeads } from './leads.test-support.js'-import { applyCommand, assertUniqueMessageIds, commandSchema, LOOP_NOTICE_AT, PAIR_CHAIN_LIMIT, swarmGridName, withoutCredentials, type Command, type CommandContext } from './commands.js'+import { applyCommand, assertUniqueMessageIds, commandSchema, LOOP_NOTICE_AT, swarmGridName, withoutCredentials, type Command, type CommandContext } from './commands.js'import { CREDENTIAL_MARKER, type CredentialKind } from './credentials.js'import { sweepLiveness } from './liveness.js'import { SWITCH_UNCLAIMED_MS } from './tidy.js'@@ -102,7 +102,7 @@ describe('five-part tasks', () => {const delivery = f.run({ type: 'work.assign', conversationId: group, agentId: worker }).messages[0]!// The worker runs on another person's machine (host-owner's): the task names whom its pull requests are for (projects.ts// requestedByLine, security review 2 of #2492).- expect(delivery.text).toBe(`${brief}\n\nAcceptance checks:\n- Reconnect preserves edits\n\nStart each pull request body with: Requested by [email protected] through Harness.`)+ expect(delivery.text).toBe(`${brief}\n\nAcceptance checks:\n- Reconnect preserves edits\n\nStart each pull request body with: Requested by owner through Harness.`)expect(delivery.recipients).toEqual([worker])})@@ -282,8 +282,8 @@ describe('Super Tab collaboration policy', () => {const worker = f.add('worker')const posted = f.run({ type: 'message.send', conversationId: 'lead', text: 'Which behavior?', replyTo: null, recipientIds: [] },{ kind: 'agent', agentId: worker, machineOwnerId: 'host-owner' }).messages[0]!- // Any agent in a group reaches its Lead (review of #2243).- expect(posted.recipients).toEqual([lead])+ // An agent's post reaches only who it names (#2963).+ expect(posted.recipients).toEqual([])const reply = f.run({ type: 'message.send', conversationId: 'lead', text: 'Keep the local copy.', replyTo: posted.id, recipientIds: [] }, owner,{ reply: { id: posted.id, conversationId: 'lead', author: posted.author, createdAt: 0 } })expect(reply.messages[0]!.recipients).toEqual([worker])@@ -314,7 +314,7 @@ describe('Super Tab collaboration policy', () => {expect(inline.alsoInChat).toBeUndefined()})- it('delivers an assigned worker\'s own post to its Lead, or to the agents it names instead', () => {+ it('delivers an assigned worker\'s own post to the agents it names alone, and the Lead\'s unnamed one to the worker', () => {const f = fixture()const lead = f.add('lead', 'owner', 'lead', true)const group = f.group(), worker = f.add('worker', 'owner', group), other = f.add('other', 'owner', group)@@ -322,15 +322,17 @@ describe('Super Tab collaboration policy', () => {const post = (actor: Actor, recipientIds: string[] = []) => f.run({ type: 'message.send', conversationId: group, text: 'PR is green.',replyTo: null, recipientIds }, actor).messages[0]!.recipientsf.run({ type: 'work.assign', conversationId: group, agentId: worker })- expect(post(as(worker))).toEqual([lead])+ expect(post(as(worker))).toEqual([])expect(post(as(worker), [other])).toEqual([other])+ expect(post(as(worker), [lead])).toEqual([lead])expect(post(as(lead))).toEqual([worker])f.run({ type: 'work.status', conversationId: group, assignmentId: f.state.conversations[1]!.assignment!.id, status: 'blocked', result: 'Stuck.' }, as(worker))- expect(post(as(worker))).toEqual([lead])+ expect(post(as(worker))).toEqual([])})- // 10-29: a moved agent's alarm and answers reached no one, and the backend worker stayed down 4 h 50 min.- it('delivers any other agent\'s unnamed post in the group to its Lead, and a named one only to the agents it names', () => {+ // 10-29: a moved agent's alarm and answers reached no one, and the backend worker stayed down 4 h 50 min. Since #2963 an+ // alarm names the PM: an unnamed post reaches the assignee at most.+ it('delivers another agent\'s unnamed post in the group to its assignee alone, and a named one only to the agents it names', () => {const f = fixture()const lead = f.add('lead', 'owner', 'lead', true)const group = f.group(), worker = f.add('worker', 'owner', group), other = f.add('other', 'owner', group)@@ -338,13 +340,13 @@ describe('Super Tab collaboration policy', () => {const post = (actor: Actor, recipientIds: string[] = [], agentOnly?: boolean) => f.run({ type: 'message.send', conversationId: group,text: 'Severe: the worker is down.', replyTo: null, recipientIds, ...(agentOnly ? { agentOnly } : {}) }, actor).messages[0]!.recipientsconst assignment = () => f.state.conversations.find(c => c.id === group)!.assignment!- expect(post(as(worker))).toEqual([lead])+ expect(post(as(worker))).toEqual([])expect(post(as(lead))).toEqual([])f.run({ type: 'work.assign', conversationId: group, agentId: worker })- expect(post(as(other))).toEqual([lead])- expect(post(as(other), [worker])).toEqual([worker])+ expect(post(as(other))).toEqual([worker])+ expect(post(as(other), [lead])).toEqual([lead])f.run({ type: 'work.cancel', conversationId: group, assignmentId: assignment().id, reason: 'Duplicate of another task' })- expect(post(as(worker))).toEqual([lead])+ expect(post(as(worker))).toEqual([])expect(post(as(worker), [other])).toEqual([other])expect(post(as(worker), [lead])).toEqual([lead])// A note to itself stays its own.@@ -352,7 +354,7 @@ describe('Super Tab collaboration policy', () => {expect(post(as(lead))).toEqual([])f.run({ type: 'work.assign', conversationId: group, agentId: other })f.run({ type: 'work.status', conversationId: group, assignmentId: assignment().id, status: 'stopped', result: null }, owner, { confirmedStopped: true })- expect(post(as(other))).toEqual([lead])+ expect(post(as(other))).toEqual([])expect(() => post(as(other), ['not-an-agent'])).toThrow()})@@ -447,12 +449,13 @@ describe('Super Tab collaboration policy', () => {expect(ping(exchanged(LOOP_NOTICE_AT - 1).map(m => ({ ...m, createdAt: 1000 - 31 * 60_000 })))).toHaveLength(1)})- it('treats a post that names only its sender as unnamed, so it still reaches the Lead', () => {+ it('treats a post that names only its sender as unnamed, so it reaches the assignee', () => {const f = fixture()- const lead = f.add('lead', 'owner', 'lead', true)+ f.add('lead', 'owner', 'lead', true)const group = f.group(), worker = f.add('worker', 'owner', group)- f.add('other', 'owner', group)- expect(send(f, as(worker), group, [worker]).recipients).toEqual([lead])+ const other = f.add('other', 'owner', group)+ f.run({ type: 'work.assign', conversationId: group, agentId: worker })+ expect(send(f, as(other), group, [other]).recipients).toEqual([worker])})it('does not count its own loop notice as a break, so an endless pair is reported once', () => {@@ -473,12 +476,12 @@ describe('Super Tab collaboration policy', () => {expect(ping(forty)).toHaveLength(1)})- it('copies nothing to the Lead when an agent names its recipients, and still delivers an unnamed post to it', () => {+ it('copies nothing to the Lead, named or unnamed', () => {const f = fixture()- const lead = f.add('lead', 'owner', 'lead', true)+ f.add('lead', 'owner', 'lead', true)const group = f.group(), worker = f.add('worker', 'owner', group), other = f.add('other', 'owner', group)expect(send(f, as(other), group, [worker]).recipients).toEqual([worker])- expect(send(f, as(other), group, []).recipients).toEqual([lead])+ expect(send(f, as(other), group, []).recipients).toEqual([])})// A linked task takes any agent, a Reviewer-kind one too (project instructions, phase 4): joining it hands it no work.@@ -493,11 +496,11 @@ describe('Super Tab collaboration policy', () => {expect(f.state.conversations.find(c => c.id === review)!.agentIds).toEqual(expect.arrayContaining([engineer, reviewer]))const other = f.run({ type: 'conversation.create', title: 'Review', brief: 'Review it.', reviewOf: f.group(),checks: [{ description: 'Verdict', independent: false }] }, as(lead)).result.conversationId as string- expect(send(f, as(reviewer), other, []).recipients).toEqual([lead])+ expect(send(f, as(reviewer), other, []).recipients).toEqual([])expect(f.state.conversations.find(c => c.id === other)!.agentIds).toContain(reviewer)// The project chat is the people's: an agent is not named or posted into it.expect(() => send(f, as(engineer), 'lead', [])).toThrow('does not participate')- expect(() => send(f, as(lead), 'lead', [engineer])).toThrow('The project chat holds only its coordinator among agents: a post here reaches the coordinator.')+ expect(() => send(f, as(lead), 'lead', [engineer])).toThrow('The project chat holds only its coordinator among agents: a post here reaches no other agent.')})it('never delivers an agent its own message, except its note to itself', () => {@@ -576,7 +579,7 @@ describe('Super Tab collaboration policy', () => {const post = (agentId: string, recipientIds: string[] = [], replyTo: string | null = null) => {const reply = history.find(m => m.id === replyTo)const sent = f.run({ type: 'message.send', conversationId: group, text: 'Update.', replyTo, recipientIds }, as(agentId), {- recent: history.slice().reverse().slice(0, PAIR_CHAIN_LIMIT).map(m => ({ author: m.author as never, recipients: m.recipients })),+ recent: history.slice().reverse().map(m => ({ author: m.author as never, recipients: m.recipients })),...(reply ? { reply: { id: reply.id, conversationId: group, author: reply.author as never, createdAt: 0 } } : {}),}).messages[0]!history.push({ author: { kind: 'agent', id: agentId }, recipients: sent.recipients, id: sent.id })@@ -606,7 +609,7 @@ describe('Super Tab collaboration policy', () => {const { f, lead, group, worker, post } = setup()f.run({ type: 'work.assign', conversationId: group, agentId: worker })const report = post(worker)- expect(report.recipients).toEqual([lead])+ expect(report.recipients).toEqual([])expect(post(lead, [], report.id).recipients).toEqual([worker])})@@ -614,16 +617,17 @@ describe('Super Tab collaboration policy', () => {const { f, lead, group, worker, other, as, post, history } = setup()f.run({ type: 'work.assign', conversationId: group, agentId: worker })expect(post(lead, [other]).recipients).toEqual([other])+ // Another agent's unnamed post reaches the assignee, and a reply to it reaches its author (#2963).const aside = post(other)- expect(aside.recipients).toEqual([lead])- expect(post(lead, [], aside.id).recipients).toEqual([])+ expect(aside.recipients).toEqual([worker])+ expect(post(lead, [], aside.id).recipients).toEqual([other, worker])const personMessage = f.run({ type: 'message.send', conversationId: group, text: 'Status?', replyTo: null, recipientIds: [] }).messages[0]!history.push({ author: { kind: 'person', id: 'owner' }, recipients: personMessage.recipients, id: personMessage.id })expect(personMessage.recipients).toEqual([lead])const reply = f.run({ type: 'message.send', conversationId: group, text: 'Ask the worker', replyTo: personMessage.id, recipientIds: [] }, as(lead), {reply: { id: personMessage.id, conversationId: group, author: personMessage.author, createdAt: 0 },}).messages[0]!- expect(reply.recipients).toEqual([])+ expect(reply.recipients).toEqual([worker])})// Answers go right below, not in a thread (anh Dee, 2026-11-04; task #2929): an answer is routed as a reply to the same@@ -638,8 +642,8 @@ describe('Super Tab collaboration policy', () => {expect(below).toMatchObject({ replyTo: null, recipients: [worker] })expect(below.thread).toBeUndefined()const personMessage = f.run({ type: 'message.send', conversationId: group, text: 'Status?', replyTo: null, recipientIds: [] }).messages[0]!- // Answering a person does not wake the worker, as a reply to them does not.- expect(answer(personMessage).recipients).toEqual([])+ // Answering a person reaches the task's assignee, as any unnamed post in a task does (#2963), and as a reply to them does.+ expect(answer(personMessage).recipients).toEqual([worker])})it('refuses an answer to a message it cannot find here, and an answer that is also a reply', () => {@@ -660,19 +664,21 @@ describe('Super Tab collaboration policy', () => {const { lead, worker, post, assign } = setup()expect(assign(assigner).recipients).toEqual([worker])const plan = post(worker)- expect(plan.recipients).toEqual([lead])- expect(post(lead).recipients).toEqual([worker])- expect(post(worker, [], plan.id).recipients).toEqual([lead])+ expect(plan.recipients).toEqual([])+ const approval = post(lead)+ expect(approval.recipients).toEqual([worker])+ expect(post(worker, [], approval.id).recipients).toEqual([lead])expect(post(lead, [], plan.id).recipients).toEqual([worker])}})- it('stops an unattended Lead and worker loop, and a person message or explicit recipients start a new one', () => {- const { f, lead, group, worker, post, assign, history } = setup()+ // #2963: the worker's unnamed post reaches no one, so no automatic round trip is left to bound.+ it('has no automatic round trip between the Lead and its worker', () => {+ const { lead, worker, post, assign } = setup()assign('lead')const hops: string[][] = []let speaker = worker- // Each agent answers every message it receives, the worst case for a loop.+ // Each agent answers every message it receives with an unnamed post, the worst case for a loop.for (let turn = 0; turn < 50; turn++) {const sent = post(speaker)hops.push(sent.recipients)@@ -680,13 +686,9 @@ describe('Super Tab collaboration policy', () => {if (!next) breakspeaker = next}- expect(hops.slice(0, -1).every(recipients => recipients.length === 1)).toBe(true)- expect(hops.at(-1)).toEqual([])- expect(hops).toHaveLength(PAIR_CHAIN_LIMIT)- expect(post(lead, [worker]).recipients).toEqual([worker])- const person = f.run({ type: 'message.send', conversationId: group, text: 'Carry on.', replyTo: null, recipientIds: [worker] }).messages[0]!- history.push({ author: { kind: 'person', id: 'owner' }, recipients: person.recipients, id: person.id })+ expect(hops).toEqual([[]])expect(post(lead).recipients).toEqual([worker])+ expect(post(worker).recipients).toEqual([])})})@@ -1182,7 +1184,8 @@ describe('route.record and route.override', () => {expect(effects.routeDecisions).toEqual([{ op: 'override', id: 'd1', override: expect.objectContaining({ by: 'person', candidateId: 'c1', reason: 'Opus quota is needed elsewhere.' }) }])expect(effects.messages[0]!.recipients).toEqual([f.lead])// What happened and why, never the next step (project instructions, phase 4).- expect(effects.messages[0]!.text).toBe('[email protected] chose Title c1 instead of Title c0. Reason: Opus quota is needed elsewhere.')+ // By name, never email: the PM reads this row and copied the email into a tag (review of #2954).+ expect(effects.messages[0]!.text).toBe('owner chose Title c1 instead of Title c0. Reason: Opus quota is needed elsewhere.')expect(effects.messages[0]!.source).toEqual({ kind: 'route-override', decisionId: 'd1', by: 'person' })})it('refuses an override by an agent, of a closed decision, or of the current choice', () => {@@ -1466,10 +1469,10 @@ describe('a route that names no pick', () => {const command = { type: 'route.override', decisionId: 'd1', candidateId: 'c0', reason: 'Opus for the schema.' } as constconst effects = f.run(command, undefined, { routeDecision: open() })expect(effects.routeDecisions).toEqual([{ op: 'override', id: 'd1', override: expect.objectContaining({ by: 'person', candidateId: 'c0' }) }])- expect(effects.messages[0]!.text).toBe('[email protected] chose Title c0. Reason: Opus for the schema.')+ expect(effects.messages[0]!.text).toBe('owner chose Title c0. Reason: Opus for the schema.')const started = open({ final: { kind: 'new', startId: 's', machineId: 'machine', engine: 'claude', model: 'sonnet', effort: 'high', candidateId: 'c1' } })expect(() => f.run({ ...command, candidateId: 'c1' }, undefined, { routeDecision: started })).toThrow(expect.objectContaining({ code: 'ALREADY_CHOSEN' }))- expect(f.run(command, undefined, { routeDecision: started }).messages[0]!.text).toBe('[email protected] chose Title c0 instead of Title c1. Reason: Opus for the schema.')+ expect(f.run(command, undefined, { routeDecision: started }).messages[0]!.text).toBe('owner chose Title c0 instead of Title c1. Reason: Opus for the schema.')})it('links a start to the candidate a person chose, as before, keeping that candidate in the final', () => {@@ -1988,9 +1991,9 @@ describe('any agent of the project', () => {// A person sharing there a session already in the Swarm.expect(() => f.run({ type: 'agent.add', conversationId: 'lead', machineId: 'host', harnessId: 'reviewer', name: 'reviewer', configuration: config, lead: false },owner, { contribution: f.contribution })).toThrow(refused)- // A post naming it still reaches nobody new: the refusal says the coordinator hears posts here, and where to tell it.+ // A post naming it still reaches nobody new: the refusal says no other agent hears posts here, and where to tell it.expect(() => f.run({ type: 'message.send', conversationId: 'lead', text: 'Announce the review.', replyTo: null, recipientIds: [reviewer] }, f.leadActor))- .toThrow(expect.objectContaining({ code: 'PROJECT_CHAT_COORDINATOR_ONLY', message: expect.stringContaining('reaches the coordinator') }))+ .toThrow(expect.objectContaining({ code: 'PROJECT_CHAT_COORDINATOR_ONLY', message: expect.stringContaining('reaches no other agent') }))expect(f.state).toEqual(before)// An agent stored there before is named as before (it stays until removed); the coordinator and a new one are still set.f.run({ type: 'message.send', conversationId: 'lead', text: 'Your turn.', replyTo: null, recipientIds: [f.worker] }, f.leadActor)@@ -2037,16 +2040,17 @@ describe('any agent of the project', () => {return { f, task, step, engineer, reviewer, chat, assigned }}- it('posts a top-level line and a thread reply there, joins nothing, and reaches the coordinator as before', () => {+ it('posts a top-level line and a thread reply there, joins nothing, and reaches the coordinator only by name (#2963)', () => {const { f, engineer, reviewer, chat } = working()const members = [...chat().agentIds]const asked = f.run(post('Can someone check the login bug?')).messages[0]!for (const agentId of [engineer, reviewer]) {const line = f.run(post('I am on it.'), actorOf(agentId)).messages.at(-1)!- expect(line).toMatchObject({ conversationId: 'lead', author: { kind: 'agent', id: agentId }, replyTo: null, recipients: [f.lead] })+ expect(line).toMatchObject({ conversationId: 'lead', author: { kind: 'agent', id: agentId }, replyTo: null, recipients: [] })const reply = f.run(post('Found it: the token expired.', asked.id), actorOf(agentId),{ reply: { id: asked.id, conversationId: 'lead', author: asked.author, createdAt: 0, thread: asked.id } }).messages.at(-1)!- expect(reply).toMatchObject({ conversationId: 'lead', replyTo: asked.id, thread: asked.id, recipients: [f.lead] })+ expect(reply).toMatchObject({ conversationId: 'lead', replyTo: asked.id, thread: asked.id, recipients: [] })+ expect(f.run(post('Need a ruling.', null, [f.lead]), actorOf(agentId)).messages.at(-1)!.recipients).toEqual([f.lead])}expect(chat().agentIds).toEqual(members)expect(chat().agentIds).not.toContain(engineer)@@ -4236,7 +4240,7 @@ describe('credentials in Swarm chat', () => {f.run({ type: 'conversation.agent', conversationId: group, agentId: lead, present: true, lead: true })f.run({ type: 'work.assign', conversationId: group, agentId: worker })const posted = f.run(send(`npm publish failed: //registry.npmjs.org/:_authToken=${github}`, group), { kind: 'agent', agentId: worker, machineOwnerId: 'host-owner' })- expect(posted.messages).toEqual([expect.objectContaining({ text: `npm publish failed: //registry.npmjs.org/:_authToken=${CREDENTIAL_MARKER}`, recipients: [lead] })])+ expect(posted.messages).toEqual([expect.objectContaining({ text: `npm publish failed: //registry.npmjs.org/:_authToken=${CREDENTIAL_MARKER}`, recipients: [] })])expect(posted.result.credentialNotice).toBe('Removed a credential (GitHub token) before saving. Revoke or rotate it.')})@@ -4791,12 +4795,12 @@ describe('checks are information', () => {f.run(commandSchema.parse({ type: 'work.define', conversationId: group, brief: 'Fix the install docs.', checks: [] }), f.leadActor)f.run({ type: 'conversation.agent', conversationId: group, agentId: f.worker, present: true, lead: false }, f.leadActor)const assigned = f.run({ type: 'work.assign', conversationId: group, agentId: f.worker })- expect(assigned.messages.find(m => m.recipients.includes(f.worker))!.text).toBe('Fix the install docs.\n\nStart each pull request body with: Requested by [email protected] through Harness.')+ expect(assigned.messages.find(m => m.recipients.includes(f.worker))!.text).toBe('Fix the install docs.\n\nStart each pull request body with: Requested by owner through Harness.')// A task with no brief at all is assigned too: its title is what its agent reads.const bare = f.run({ type: 'conversation.create', title: 'Look into the flaky test', brief: '', checks: [] }, f.leadActor).result.conversationId as stringconst other = f.add('other', 'owner', bare)expect(f.run({ type: 'work.assign', conversationId: bare, agentId: other }).messages.find(m => m.recipients.includes(other))!.text)- .toBe('Look into the flaky test\n\nStart each pull request body with: Requested by [email protected] through Harness.')+ .toBe('Look into the flaky test\n\nStart each pull request body with: Requested by owner through Harness.')})it('keeps a failed check as a finding', () => {@@ -5466,6 +5470,12 @@ describe('lead.switch', () => {const told = done(s).messages.filter(m => (m.source as { kind?: string } | undefined)?.kind === 'pm-switch-notice')expect(told).toEqual([expect.objectContaining({ conversationId: s.f.state.conversations.find(c => c.kind === 'swarm-buddy')!.id,text: 'owner moved the PM of Pilot on Studio to your Codex account "Work".', source: { kind: 'pm-switch-notice', machineId: 'host' } })])+ // The owner's Buddy reads it: never an email, even one the asker took as their name (review of #2954).+ const named = lent()+ named.f.state.people.find(p => p.id === 'owner')!.name = '[email protected]'+ named.f.run(named.request)+ expect(done(named).messages.find(m => (m.source as { kind?: string } | undefined)?.kind === 'pm-switch-notice')!.text)+ .toBe('owner moved the PM of Pilot on Studio to your Codex account "Work".')const def = lent()def.f.run({ ...def.request, profileId: 'default' })expect(done(def).messages).toHaveLength(1)diff --git a/backend/src/superTabs/commands.ts b/backend/src/superTabs/commands.tsindex 422e4a63c..91831605c 100644--- a/backend/src/superTabs/commands.ts+++ b/backend/src/superTabs/commands.ts@@ -1,10 +1,10 @@-import { applyPushOrigin, failPushUnknown, failTeamWritten, hasStep, mainAccountMembers, markTeamWritten, requireNameable, requireTeamWrittenAccount, requireTeamWrittenMachine, TEAM_WRITTEN_REASON, TEAM_WRITTEN_STOP, teamWrittenTask } from './teamWritten.js'+import { applyPushOrigin, failPushUnknown, failTeamWritten, hasStep, mainAccountMembers, markTeamWritten, mayName, requireNameable, requireTeamWrittenAccount, requireTeamWrittenMachine, TEAM_WRITTEN_REASON, TEAM_WRITTEN_STOP, teamWrittenTask } from './teamWritten.js'import type { PushOrigin } from '../github/pushOrigin.js'import { admitByRoom, admitMachineStart, defaultProfileId, storedProfileId, BUDDY_WINDOWS_REFUSAL, refusesWindowsBuddy, buddyHomeFolder, buddyProjectsOn, SWARM_BUDDY_CAPABILITY, cleanupOverdue, dropIdleBuddyMachines, machineLimitReached, MACHINE_LIMIT_MESSAGE, NOT_SWARM_MACHINE, downSince, expireRemoval, expireRemovals, failTeamWork, machineContribution, machineOffline, machineSlots, contributedEngines, ownedMachine, productManagerOn, projectFolder, projectsOnMachine, requireTeamWork, teamMachineFor, teamAccountPool, teamPoolsOf, teamStartRequest, teamWorkCheck, movedToTeamAccount, type ContributedMachine } from './machines.js'import { agentDisplayName, assignAgentDisplayNames } from './agentNames.js'import { addedAgentName, renameAgentTo } from './agentRename.js'import { keepUsernames, setUsername, swarmUsernames, usernameOf } from './usernames.js'-import { setName, writtenNameOf } from './personNames.js'+import { agentWrittenNameOf, setName } from './personNames.js'import { z } from 'zod'import { tokensByModelSchema } from './costs/tokens.js'import {@@ -13,13 +13,13 @@ import {type Actor, type AgentConfiguration, type AgentStart, type AgentStartRequest, type BuddySessionEntry, type WorkTask, type Agent, type Author, type Check, type CommandEffects, type Conversation, type SuperTabState,} from './model.js'import { jobKindOf } from './evidence/jobKind.js'-import { endSteps, stepEndedRows, holdsStepOf, isStep, ownerOf, taskOwner } from './steps.js'+import { endSteps, stepEndedRows, isStep, taskOwner } from './steps.js'import { recordCheckVerdict } from './checkVerdicts.js'import { routeRecordSchema, routeTitle, startedAs, type KeptCandidate, type RouteDecision, type RouteFinal, type RouteOverride } from './routeRecord.js'import { routingOverrideSaveSchema } from './routingPolicy.js'import { askedInSchema, RULE_MESSAGE_MS, ruleSchema, ruleTextSchema } from './rules.js'import { MAX_ATTACHMENTS, type Attachment } from './attachments.js'-import { checkMentions, MAX_MENTIONS, namedIn, saysName, textTags, withTags, type MentionTarget } from './mentions.js'+import { agentsNamedIn, checkMentions, MAX_MENTIONS, namedIn, saysName, textTags, withTags, type MentionTarget } from './mentions.js'import { answerDecision, askDecisions, checkAsker, decisionChoices, decisionQuestion, MAX_OPEN_DECISIONS, MAX_QUESTIONS, type DecisionTarget } from './decisions.js'import { leadOf, TERMINAL_KEYS, terminalAlert, terminalRequest, terminalResult, toLead, type TerminalRequest, workedAgain } from './terminal.js'import { changesRequested, engineerAnswered, leadNoticeRows, loseTasks, recordTaskState, renewLease, renewOwnTask, restartQuietTime, revisionReady, toldEngineer, waitingForReview } from './liveness.js'@@ -566,20 +566,9 @@ export interface CommandContext {teamAccountsIdle?: boolean}-/** Messages in a row between the Lead and its worker after which the Lead's message is no longer delivered automatically. */-export const PAIR_CHAIN_LIMIT = 6--/** A Lead's automatic delivery to the assigned worker answers the worker's post. Worker posts reach the Lead automatically, so- * without a bound the two agents would keep answering each other. Count the messages in a row between the pair, newest first,- * until one is anyone else's or is not addressed to the other (a person's message, a notice, a message to someone else). A normal- * exchange (brief, plan, approval, report) stays well under the limit; an unattended loop stops at it. Explicit recipients still- * deliver, so the Lead can always continue on purpose. */-function leadWorkerBounced(recent: CommandContext['recent'] = [], leadId: string, workerId: string): boolean {- const sentToPartner = (m: NonNullable<CommandContext['recent']>[number]) => m.author.kind === 'agent'- && (m.author.id === leadId ? m.recipients.includes(workerId) : m.author.id === workerId && m.recipients.includes(leadId))- const run = recent.findIndex(m => !sentToPartner(m))- return (run < 0 ? recent.length : run) >= PAIR_CHAIN_LIMIT-}+/** What an agent's post that reached no agent tells its sender, in the result every CLI prints (Egret6's review of #2963):+ * since #2963 an unnamed post outside a task's assignee reaches no one, and a sender that meant someone to act would not know. */+export const REACHED_NO_AGENT = 'This post reached no agent; people read it in the conversation. Name an agent with --to or @Name when it must act.'/** Messages in a row between two agents after which their project's Lead is told, once (project instructions, phase 1:* agents talk to each other directly, so nothing else would notice two of them answering each other for ever). */@@ -1039,7 +1028,7 @@ function applyCommandOnce(original: SuperTabState, actor: Actor, input: Command,if (!projectsOf(state).some(p => p.leadConversationId === group.id)) returnif (agentId && (agentId === group.leadId || group.agentIds.includes(agentId))) returnfail('PROJECT_CHAT_COORDINATOR_ONLY', post- ? `The project chat holds only its coordinator among agents: a post here reaches the coordinator. Tell ${name} in its task.`+ ? `The project chat holds only its coordinator among agents: a post here reaches no other agent. Tell ${name} in its task.`: `The project chat holds only its coordinator among agents, so ${name} cannot join it. Its work and announcements go in its task.`, 403)}/** An agent starts or assigns only what the route chose; a person may still do either by hand. */@@ -2564,7 +2553,7 @@ function applyCommandOnce(original: SuperTabState, actor: Actor, input: Command,if (!projectId || !projectAgent(state, actor, projectId)) fail('FORBIDDEN', 'An agent sends a person a private line, in its own project.', 403)const project = projectOf(state, projectId)const to = state.people.find(p => p.id === command.personId) ?? fail('INVALID_PERSON', 'Tell a person in this Swarm.', 400)- if (!canReadProject(state, { kind: 'person', userId: to.id, email: to.email }, project)) fail('INVALID_PERSON', `${to.email} cannot read this project.`, 400)+ if (!canReadProject(state, { kind: 'person', userId: to.id, email: to.email }, project)) fail('INVALID_PERSON', `${usernameOf(state, to.id)} cannot read this project.`, 400)// To nobody: the person reads it; their Buddy, if they have one, is not asked to answer for them. In their one Buddy chat,// marked with its project so it hides once they lose it (buddies.ts hiddenProjectRow), and in their older chat there,// which older apps and the phone still show (spec: Older apps).@@ -3010,7 +2999,8 @@ function applyCommandOnce(original: SuperTabState, actor: Actor, input: Command,// The machine owner hears when their non-default account runs another person's PM; the project line may be out of their reach.const owner = state.people.find(p => p.id === target.machineOwnerId), pool = state.machines?.find(m => m.machineId === target.machineId)if (moved && label && asked && owner && asked !== owner.id) {- const who = writtenNameOf(state, asked) ?? state.people.find(p => p.id === asked)?.email ?? 'Someone'+ // The owner's Buddy reads it: by name, never email (review of #2954).+ const who = agentWrittenNameOf(state, asked) ?? 'Someone'effects.messages.push({ id: stableId(operationId, 'pm-switch-notice'), conversationId: openSwarmBuddyChat(state, owner).id, author: sender, replyTo: null, recipients: [],source: { kind: 'pm-switch-notice', machineId: target.machineId },text: `${who} moved the PM of ${project.name} on ${pool?.name ?? target.machineId} to your ${engine} account "${label}".` })@@ -3226,48 +3216,25 @@ function applyCommandOnce(original: SuperTabState, actor: Actor, input: Command,fail('INVALID_ANSWER', command.replyTo ? 'Answer a message right below it or reply in its thread, not both.' : 'Answer a message in this conversation.', 400)}const replyAgent = context.reply?.author.kind === 'agent' ? context.reply.author.id : null- // An assigned worker's own post in its group reaches the Lead. Workers reported results as plain posts, which went to no- // one: the Lead heard only at the next scheduled consolidation, and the owner saw no summary of finished work for up to- // 19 minutes (2026-10-21/22). The Lead's message reaches the worker the same way (#1549), except for a reply to someone- // else and a message that would continue an automatic round trip (leadWorkerBounced), so agents cannot loop.- // An agent is never delivered its own message, except its note to itself: naming only- // itself, its post is unnamed (final review of phase 1).- const addressed = command.agentOnly || actor.kind !== 'agent' ? command.recipientIds : command.recipientIds.filter(id => id !== actor.agentId)+ // An agent's post reaches the agents it names, by --to or by @Name, the agent whose message it answers, and, when it names+ // no one in a task or step, that conversation's current assignee, who owns the room (River's ruling on #2963). Nothing+ // else: an unnamed post stays readable in its conversation. Until 11-04 an unnamed post went to the coordinator, the task's+ // owner or the assignee by five rules, and in a day 402 of 437 agent posts reached the PM as their only recipient though+ // only 1 named it (Ken, #2963). The PM hears an agent's work through its status. An agent is never delivered its own+ // message, except its note to itself: naming only itself, its post is unnamed (final review of phase 1).+ // @Name never turns a post into a refusal: an agent the sender may not name with --to is left out (mayName).+ const poster = actor.kind === 'agent' ? agent(state, actor.agentId) : null+ const textNamed = poster && !command.agentOnly+ ? agentsNamedIn(state, group, command.text, names).filter(id => mayName(state, group, poster, agent(state, id))) : []+ const addressed = command.agentOnly || !poster ? command.recipientIds+ : [...new Set([...command.recipientIds, ...textNamed])].filter(id => id !== poster.id)const assigned = activeWork(group) ? group.assignment!.agentId : null- const leadToWorker = actor.kind === 'agent' && actor.agentId === group.leadId && assigned && assigned !== group.leadId- && group.agentIds.includes(assigned) && (!context.reply || replyAgent === assigned)- && !leadWorkerBounced(context.recent, group.leadId, assigned) ? assigned : null- // A step's agent tells its task's owner, as its status does (task steps design); with no owner, the coordinator.- const stepOwner = actor.kind === 'agent' && isStep(group) ? taskOwner(state, group) : null- const workerToLead = actor.kind === 'agent' && activeWork(group) && group.assignment?.agentId === actor.agentId- && stepOwner && stepOwner !== actor.agentId ? stepOwner- : actor.kind === 'agent' && activeWork(group) && group.assignment?.agentId === actor.agentId- && group.leadId && group.leadId !== actor.agentId && group.agentIds.includes(group.leadId) ? group.leadId : null- // The task's owner talks to its step's agent the same way (Diego, 2026-11-02: an Engineer's "fixed, please re-check" in its- // Review step woke the PM and the Reviewer never heard it). Its unnamed post there reaches that agent alone, never the- // coordinator. A reply to someone else, or a post leadWorkerBounced holds back, falls back to the coordinator as before:- // nothing is dropped.- const ownerToStepAgent = actor.kind === 'agent' && isStep(group) && assigned && assigned !== actor.agentId- && taskOwner(state, group) === actor.agentId && group.agentIds.includes(assigned) && (!context.reply || replyAgent === assigned)- && !leadWorkerBounced(context.recent, actor.agentId, assigned) ? assigned : null- const agentRecipient = leadToWorker ?? workerToLead ?? ownerToStepAgent- // Any other agent's unnamed post in the group reaches its Lead: an agent whose task here was lost, moved or cancelled has- // its status and results refused, so its posts are all the Lead hears from it. They reached no one until 10-29, when a- // moved prod-watch agent's "the backend worker is down" alarm and its answers to the Lead's questions had no delivery,- // and the worker stayed down 4 h 50 min. Membership, not a record of past attempts, decides (Lead's ruling on #2243).- // A post that names its agents reaches only them: copying every one to the Lead filled its terminal (Ken, 10-30: 198 of- // the 486 messages it got in a day were such copies). The assigned worker keeps its own rule above; a note to itself- // stays its own.- // In a task, an agent holding one of its open steps reaches the task's owner instead (task steps design).- const owner = ownerOf(state, group)- const ownerHere = actor.kind === 'agent' && owner && owner !== actor.agentId && holdsStepOf(state, group.id, actor.agentId) ? owner : null- // In a step, any agent but the coordinator talks to the task's owner: its own agent after its work ended too (a lost or- // done step's agent, 2026-11-02, reached the PM).- const stepTold = actor.kind === 'agent' && isStep(group) && actor.agentId !== group.leadId ? taskOwner(state, group) : null- const ownerInStep = actor.kind === 'agent' && stepTold && stepTold !== actor.agentId ? stepTold : null- const memberToLead = actor.kind === 'agent' && !command.agentOnly && !addressed.length && assigned !== actor.agentId && (ownerHere ?? ownerInStep) ? [(ownerHere ?? ownerInStep)!]- : actor.kind === 'agent' && !command.agentOnly && !addressed.length && assigned !== actor.agentId && !ownerToStepAgent && group.leadId- && group.leadId !== actor.agentId && group.agentIds.includes(group.leadId) ? [group.leadId] : []+ const toAssignee = actor.kind === 'agent' && !command.agentOnly && !addressed.length && assigned && assigned !== actor.agentId+ && group.agentIds.includes(assigned) ? assigned : null+ // An agent with work in the project posts in its project chat without joining it (worksInProjectChat): an answer to its+ // line reaches it there too.+ const answeredAgent = actor.kind === 'agent' && !command.agentOnly && !isBuddyChat(group) && replyAgent && replyAgent !== actor.agentId+ && (group.agentIds.includes(replyAgent) || worksInProjectChat(state, group, replyAgent)) ? replyAgent : null// Buddy thread sessions (buddySessions.ts): a session thread's replies reach its session alone and stay in its thread; the// main Buddy hears the rest. Decided here from the thread, so every client, an old one or the phone, is routed alike.const session = isBuddyChat(group) ? routeBuddySession(group) : undefined@@ -3285,17 +3252,17 @@ function applyCommandOnce(original: SuperTabState, actor: Actor, input: Command,const below = !command.replyTo && context.above?.author.kind === 'agent' ? chatWorker(context.above.author.id) : null// A Buddy chat has no Lead: its owner talks to its Buddy.const automatic = actor.kind === 'person' ? (isBuddyChat(group) ? (session?.inSession ? session.to : mainBuddyOf(state, group)?.id ?? null)- : answered ?? (replyAgent && group.agentIds.includes(replyAgent) ? replyAgent : group.leadId)) : agentRecipient- const recipients = [...new Set([...addressed, ...memberToLead, ...(addressed.length ? [] : [below, automatic].filter((id): id is string => !!id))])]+ : answered ?? (replyAgent && group.agentIds.includes(replyAgent) ? replyAgent : group.leadId)) : toAssignee+ const recipients = [...new Set([...addressed, ...answeredAgent ? [answeredAgent] : [], ...(addressed.length ? [] : [below, automatic].filter((id): id is string => !!id))])]for (const id of recipients) {const target = agent(state, id)// Naming an agent asks it to act, and a re-test is asked this way: a post's default addressee is only told (audit H2).- if (actor.kind === 'agent' && addressed.includes(id)) requireNameable(state, group, agent(state, actor.agentId), target)+ if (poster && addressed.includes(id)) requireNameable(state, group, poster, target)// In a Buddy chat a session hears its own thread alone, and the main Buddy none of it.if (session && (session.inSession ? id !== session.to : !!target.buddySession)) fail('INVALID_RECIPIENT', 'Choose an agent in this conversation.', 400)// An agent of this project that another agent names from outside the group joins it, so it can read and answer there// (joinsProject). A person's message adds nobody: a person adds an agent to a task with conversation.agent.- if (!group.agentIds.includes(id) && id !== answered && id !== below) {+ if (!group.agentIds.includes(id) && id !== answered && id !== below && id !== answeredAgent) {// Named only when it is of this chat's project: another's is refused below without its name (Orion's review).if (agentProjectId(state, target) === groupProject(state, group).id) projectChatJoin(group, id, target.displayName ?? target.name, true)if (actor.kind !== 'agent' || !joinsProject(state, group, id)) fail('INVALID_RECIPIENT', 'Choose an agent in this conversation.', 400)@@ -3312,6 +3279,7 @@ function applyCommandOnce(original: SuperTabState, actor: Actor, input: Command,message(group.id, text, recipients, command.replyTo, command.agentOnly ? { ...AGENT_ONLY, ...command.notice ? { notice: command.notice } : {} } : undefined, attachments, mentions, command.mentionsIfNoWorker)// After the person's message: nobody answers it, so its person is told why (Dee, review of #2447).if (buddyDown) buddyDownLine(group, buddyDown)+ if (poster && !command.agentOnly && !recipients.length) effects.result.reachedNoAgent = REACHED_NO_AGENT// A Personal Swarm project chat with no Lead: the message waits for the Lead its person's Desktop starts (task #2633).// A Team Swarm's says Not sent, as before.const unled = actor.kind === 'person' && !recipients.length && !isBuddyChat(group) && isPersonalSwarm(state) ? groupProject(state, group) : undefined@@ -3319,7 +3287,7 @@ function applyCommandOnce(original: SuperTabState, actor: Actor, input: Command,leadWaits(unled, operationId, context.now)}// The message that makes it LOOP_NOTICE_AT in a row between two agents tells their Lead, once; delivery is never held.- const speaker = actor.kind === 'agent' ? agent(state, actor.agentId) : null+ const speaker = posterconst partner = speaker && recipients.length === 1 && recipients[0] !== speaker.id ? agent(state, recipients[0]!) : nullconst pairLead = speaker && leadOf(state, speaker)if (speaker && partner && pairLead && pairLead.id !== partner.id && pairLoop(context.recent, speaker.id, partner.id, context.now) + 1 === LOOP_NOTICE_AT) {@@ -3441,7 +3409,8 @@ function applyCommandOnce(original: SuperTabState, actor: Actor, input: Command,effects.routeDecisions.push({ op: 'override', id: decision.id, override: { by: 'person', actorKey: actorKey(actor), candidateId: chosen.id, reason: command.reason } })const lead = conversation(state, decision.conversationId).leadIdmessage(decision.conversationId,- `${sender.name} chose ${chosen.title}${current === undefined ? '' : ` instead of ${routeTitle(decision, current)}`}. Reason: ${command.reason}`,+ // By name, never email: the PM reads this row (review of #2954).+ `${agentWrittenNameOf(state, actor.userId) ?? 'Someone'} chose ${chosen.title}${current === undefined ? '' : ` instead of ${routeTitle(decision, current)}`}. Reason: ${command.reason}`,lead ? [lead] : [], null, { kind: 'route-override', decisionId: decision.id, by: 'person' })break}@@ -3572,7 +3541,7 @@ function applyCommandOnce(original: SuperTabState, actor: Actor, input: Command,effects.decisions = draftsasked = context.repeatedDecision ?? drafts[0]!.id}- else effects.result.notAsked = `Not asked ${person(state, personId).email}: ${context.openDecisions} decisions you asked them are still open, and at most ${MAX_OPEN_DECISIONS} can be. Wait for answers before asking more.`+ else effects.result.notAsked = `Not asked ${agentWrittenNameOf(state, person(state, personId).id)}: ${context.openDecisions} decisions you asked them are still open, and at most ${MAX_OPEN_DECISIONS} can be. Wait for answers before asking more.`}// A Team agent's push can land on any branch: its Ready reads who pushed (teamWritten.ts, audit H2).if (command.status === 'review') marking(group, () => applyPushOrigin(state, group, context.pushOrigin))@@ -3612,7 +3581,7 @@ function applyCommandOnce(original: SuperTabState, actor: Actor, input: Command,: own ? (lead && ['needs_human', 'blocked', 'done'].includes(command.status) ? [lead] : []): [...command.status === 'stopped' ? [] : [assignment.agentId], ...lead ? [lead] : []]const recipients = [...new Set(told)].filter(id => actor.kind !== 'agent' || id !== actor.agentId)- const asked = !command.ask ? '' : effects.result.notAsked ? `\n\n${effects.result.notAsked}` : `\n\nAsked ${person(state, command.ask.personId).email}.`+ const asked = !command.ask ? '' : effects.result.notAsked ? `\n\n${effects.result.notAsked}` : `\n\nAsked ${agentWrittenNameOf(state, person(state, command.ask.personId).id)}.`// The status set, on the row: a Done waits for the coordinator's next digest, what needs someone does not (store.ts writeMessages).message(group.id, `${label}${command.result ? `\n\n${command.result}` : ''}${asked}`, recipients, null, { ...SYSTEM_ROW, status: command.status })// The server opens no review by itself: the agent whose work is ready opens and assigns it, as the project's instructionsdiff --git a/backend/src/superTabs/decisions.test.ts b/backend/src/superTabs/decisions.test.tsindex 7e7ec7744..0fdf7c8ed 100644--- a/backend/src/superTabs/decisions.test.ts+++ b/backend/src/superTabs/decisions.test.ts@@ -3,7 +3,7 @@ import { storeOldLeads } from './leads.test-support.js'import type { Prisma } from '@prisma/client'import { applyCommand, commandSchema, type Command, type CommandContext } from './commands.js'import { createSuperTab, type Actor, type AgentConfiguration } from './model.js'-import { checkAsker, decisionsWaiting, listDecisions, overdueNotice, delegatedNotice, answerDecision, waitingInProject, withdrawIn, workEnded, workOver, type DecisionTarget } from './decisions.js'+import { askDecisions, checkAsker, decisionsWaiting, listDecisions, overdueNotice, delegatedNotice, answerDecision, waitingInProject, withdrawIn, workEnded, workOver, type DecisionTarget } from './decisions.js'import { buddyChatId } from './buddies.js'const owner: Extract<Actor, { kind: 'person' }> = { kind: 'person', userId: 'owner', email: '[email protected]' }@@ -55,6 +55,11 @@ describe('asking a person for decisions', () => {expect(ask(owner)).toThrow(expect.objectContaining({ code: 'FORBIDDEN' }))expect(ask(asAgent(s.lead), 'stranger')).toThrow('person in this Swarm')expect(ask(asAgent(s.lead), 'peer', 2)).toThrow('recommend one of its options')+ // Someone who cannot read the conversation is named by username, never email (task #2954).+ const group = s.state.conversations.find(c => c.id === s.group)!+ const narrowed = { ...group, audience: { people: [{ id: 'owner', generation: s.state.people[0]!.generation }] } }+ expect(() => askDecisions(s.state, narrowed, 'peer', [question('Ship how?')], { operationId: 'op', askerAgentId: s.lead, assignmentId: null }))+ .toThrow(/^peer cannot read this conversation\.$/)expect(commandSchema.safeParse({ type: 'decision.ask', conversationId: s.group, personId: 'peer',questions: [{ ...question('One option only'), options: ['Yes'] }] }).success).toBe(false)expect(commandSchema.safeParse({ type: 'decision.ask', conversationId: s.group, personId: 'peer',@@ -67,7 +72,7 @@ describe('asking a person for decisions', () => {ask: { personId: 'peer', options: ['Behind a flag', 'To everyone'], recommended: 0, unblocks: 'Turning the feature on' } }, asAgent(s.worker))expect(needs.decisions).toEqual([expect.objectContaining({ personId: 'peer', askerAgentId: s.worker, assignmentId: s.assignmentId,question: 'Ship to everyone, or behind a flag?', recommended: 0, unblocks: 'Turning the feature on' })])- expect(needs.messages[0]).toMatchObject({ text: 'Needs a human\n\nShip to everyone, or behind a flag?\n\nAsked [email protected].', recipients: [s.lead] })+ expect(needs.messages[0]).toMatchObject({ text: 'Needs a human\n\nShip to everyone, or behind a flag?\n\nAsked peer.', recipients: [s.lead] })// Without a person and options it reaches the Lead as before, who asks.const plain = s.run({ type: 'work.status', conversationId: s.group, assignmentId: s.assignmentId, status: 'needs_human', result: 'Which database?' }, asAgent(s.worker))expect(plain.decisions ?? []).toEqual([])diff --git a/backend/src/superTabs/decisions.ts b/backend/src/superTabs/decisions.tsindex 1832c129a..cc0114d17 100644--- a/backend/src/superTabs/decisions.ts+++ b/backend/src/superTabs/decisions.ts@@ -4,6 +4,8 @@* SuperTabDecision, never in the tab state, as mentions do. A decision is not a private channel: the PM's private lines go* to the person's Buddy chat (buddies.ts). Called inside SuperTabStore's transactions. */import { isBuddy, isSwarmBuddy, openBuddyChat, openSwarmBuddyChat } from './buddies.js'+import { usernameOf } from './usernames.js'+import { agentWrittenNameOf } from './personNames.js'import { createHash } from 'node:crypto'import type { Prisma } from '@prisma/client'import { z } from 'zod'@@ -60,7 +62,7 @@ export function askDecisions(state: SuperTabState, group: Conversation, personIdfrom: { operationId: string; askerAgentId: string; assignmentId: string | null; kind?: typeof REFLECTION_DECISION }): DecisionDraft[] {const asked = state.people.find(p => p.id === personId) ?? fail('INVALID_PERSON', 'Ask a person in this Swarm.', 400)if (!canReadGroup(state, { kind: 'person', userId: asked.id, email: asked.email }, group)) {- fail('INVALID_PERSON', `${asked.email} cannot read this conversation.`, 400)+ fail('INVALID_PERSON', `${usernameOf(state, asked.id)} cannot read this conversation.`, 400)}for (const q of questions) if (q.recommended >= q.options.length) fail('INVALID_DECISION', 'A question must recommend one of its options.', 400)// It would wait for nobody: none waits where the work is over (workOver).@@ -386,7 +388,9 @@ export async function listDecisions(tx: Tx, tabId: string, state: SuperTabState,const asker = state.agents.find(a => a.id === row.askerAgentId)return { id: row.id, batchId: row.batchId, projectId: row.projectId, projectName: projectOf(state, row.projectId).name,conversationId: row.conversationId, conversationTitle: group.title, assignmentId: row.assignmentId ?? null,- personId: row.personId, personEmail: state.people.find(p => p.id === row.personId)?.email ?? null,+ // An agent reads whom it asked by name, never email (review of #2954); the person's own app keeps the email.+ personId: row.personId, personEmail: actor.kind === 'agent' ? null : state.people.find(p => p.id === row.personId)?.email ?? null,+ personName: agentWrittenNameOf(state, row.personId) ?? null,askerAgentId: row.askerAgentId, askerName: asker?.displayName ?? asker?.name ?? 'Agent',question: row.question, options: row.options, recommended: row.recommended, unblocks: row.unblocks,createdAt: row.createdAt, answeredAt: row.answeredAt ?? null, choice: row.choice ?? null, note: row.note ?? null,diff --git a/backend/src/superTabs/digest.test.ts b/backend/src/superTabs/digest.test.tsindex 8ff05a314..37a623bf5 100644--- a/backend/src/superTabs/digest.test.ts+++ b/backend/src/superTabs/digest.test.ts@@ -76,9 +76,9 @@ describe('a project\'s morning digest', () => {{ conversationId: 'g3', personId: 'ann', count: 1 }, { conversationId: 'g7', personId: 'ann', count: 1 }, { conversationId: 'g11', personId: 'owner', count: 1 },{ conversationId: 'g9', personId: 'owner', count: 1 }, { conversationId: 'g3', personId: 'gone', count: 1 }, { conversationId: 'deleted', personId: 'owner', count: 1 },{ conversationId: 'lead-p1', personId: 'ann', count: 1 }])).toEqual([- '- This chat: 1 for [email protected]',- '- #3 Lexer: 1 for [email protected]',- '- #7 Pricing: 2 for [email protected], 1 for [email protected]',+ '- This chat: 1 for ann',+ '- #3 Lexer: 1 for ann',+ '- #7 Pricing: 2 for owner, 1 for ann',])expect(decisionLines(state, lampOS(state), [])).toEqual([])})@@ -88,12 +88,12 @@ describe('a project\'s morning digest', () => {const group = state.conversations.find(c => c.id === 'g7')!group.assignment = { ...group.assignment!, status: 'done' }expect(decisionLines(state, lampOS(state), [{ conversationId: 'g7', personId: 'owner', count: 1 }, { conversationId: 'g3', personId: 'ann', count: 1 }]))- .toEqual(['- #3 Lexer: 1 for [email protected]'])+ .toEqual(['- #3 Lexer: 1 for ann'])})it('puts the decisions waiting in the Lead\'s digest wake-up only when there are some', () => {const state = fixture(), lead = state.agents.find(a => a.id === 'lead')!- expect(digestRequest(state, lead, EIGHT, [{ conversationId: 'g7', personId: 'ann', count: 1 }])!.text).toMatch(/\nDecisions waiting:\n- #7 Pricing: 1 for ann@example\.com$/)+ expect(digestRequest(state, lead, EIGHT, [{ conversationId: 'g7', personId: 'ann', count: 1 }])!.text).toMatch(/\nDecisions waiting:\n- #7 Pricing: 1 for ann$/)expect(digestRequest(state, lead, EIGHT, [])!.text).not.toContain('Decisions waiting')})diff --git a/backend/src/superTabs/digest.ts b/backend/src/superTabs/digest.tsindex ce112cc9f..e234a8b99 100644--- a/backend/src/superTabs/digest.ts+++ b/backend/src/superTabs/digest.ts@@ -4,6 +4,7 @@ import { canReadGroup, ledProject, type SwarmProject } from './projects.js'import { reportGroups } from './projectUpdates.js'import { workOver } from './decisions.js'import { DEFAULT_TIME_ZONE } from './costs/reflection.js'+import { agentWrittenNameOf } from './personNames.js'// Night shift (v2 B): people wake to one message per project saying what the Swarm did overnight. At the project's local// digest time its Lead's poll wakes the Lead with the lists below, built from state; the Lead checks each pull request is@@ -100,10 +101,11 @@ export function decisionLines(state: SuperTabState, project: SwarmProject, waiti// None waits where the work is over (decisions.ts workOver).if (!group || !asked || workOver(state, group) || !canReadGroup(state, { kind: 'person', userId: asked.id, email: asked.email }, group)) continueconst people = counts.get(group.id) ?? new Map<string, number>()- counts.set(group.id, people.set(asked.email, (people.get(asked.email) ?? 0) + count))+ counts.set(group.id, people.set(asked.id, (people.get(asked.id) ?? 0) + count))}+ // By name, never email: the PM reads this and copies names into what it types (task #2954).return groups.filter(g => counts.has(g.id)).map(g => `- ${g === chat ? 'This chat' : `#${g.number} ${g.title}`}: `- + [...counts.get(g.id)!].map(([email, n]) => `${n} for ${email}`).join(', '))+ + [...counts.get(g.id)!].map(([id, n]) => `${n} for ${agentWrittenNameOf(state, id)}`).join(', '))}/** The Lead's wake-up for its project's digest when one is due, or null. The caller records it as sent (store.ts). */diff --git a/backend/src/superTabs/instructions.test.ts b/backend/src/superTabs/instructions.test.tsindex 34fe3f5a1..87ae17363 100644--- a/backend/src/superTabs/instructions.test.ts+++ b/backend/src/superTabs/instructions.test.ts@@ -45,6 +45,8 @@ describe('the built-in template', () => {expect(TEMPLATE_WORKFLOW).toContain('run `mine`')expect(TEMPLATE_WORKFLOW).toContain('read `task GROUP`')expect(TEMPLATE_WORKFLOW).toContain('read the thread before acting on it')+ // Task #2963: an unnamed post no longer reaches the PM, so the workflow says where verdicts and results go.+ expect(TEMPLATE_WORKFLOW).toContain('A verdict goes to the Engineer by name\n (--to, or a reply to its request); a result reaches the PM through status, never by a post to the PM.')// Ken, 2026-11-02 (from openharness): a two-review task gets two review steps; the Engineer picks its Reviewers// itself instead of asking the PM (since 2026-11-03, when the pull request is ready).expect(TEMPLATE_WORKFLOW).toContain('A task that needs two\n reviews gets two review steps.')diff --git a/backend/src/superTabs/instructionsTemplate.ts b/backend/src/superTabs/instructionsTemplate.tsindex ff0a146da..7187e81f1 100644--- a/backend/src/superTabs/instructionsTemplate.ts+++ b/backend/src/superTabs/instructionsTemplate.ts@@ -78,7 +78,8 @@ export const TEMPLATE_WORKFLOW = `## Workflowand the evidence in its result: that status is how the PM hears, once. A Reviewer or Tester is heard the same way,through its step's result. No agent sends the PM any other message besides a task that needs a person (Workflow 6)or the answer to a question the PM asked: no progress notes, no "ready for review", no separate verdict or "done"- message, and no acknowledgement such as "understood", "on it" or "stopped".+ message, and no acknowledgement such as "understood", "on it" or "stopped". A verdict goes to the Engineer by name+ (--to, or a reply to its request); a result reaches the PM through status, never by a post to the PM.5. The PM checks CI on the pull requests that passed, merges them, and tells the people who asked.6. A task that needs a person, or a machine that is down, goes to the PM at once, by name.7. Idle Engineers are stopped. Reviewers and Testers are kept while the work they checked is open.diff --git a/backend/src/superTabs/memberRows.test.ts b/backend/src/superTabs/memberRows.test.tsindex faa12a8b8..920ad5760 100644--- a/backend/src/superTabs/memberRows.test.ts+++ b/backend/src/superTabs/memberRows.test.ts@@ -65,6 +65,9 @@ describe('the row that says so', () => {expect(actorLabel(state, 'person:ken')).toBe('ken15')expect(actorLabel(state, 'agent:gone')).toBeUndefined()expect(actorLabel(state, 'person:gone')).toBeUndefined()+ // Never an email, even one they took as their name (review of #2954).+ state.people.find(p => p.id === 'ken')!.name = state.people.find(p => p.id === 'ken')!.email+ expect(actorLabel(state, 'person:ken')).toBe('ken15')})it('names a person by the name they set, when they set one, as plain words', () => {diff --git a/backend/src/superTabs/memberRows.ts b/backend/src/superTabs/memberRows.tsindex 3fd687075..b05f3d7b8 100644--- a/backend/src/superTabs/memberRows.ts+++ b/backend/src/superTabs/memberRows.ts@@ -1,7 +1,7 @@import { agentDisplayName } from './agentNames.js'import { isBuddyChat } from './buddies.js'import { stableId, type Agent, type Conversation, type MessageDraft, type SuperTabState } from './model.js'-import { writtenNameOf } from './personNames.js'+import { agentWrittenNameOf } from './personNames.js'/** One agent that joined or left one chat in a command. */export type MemberChange = { group: Conversation; agent: Agent; added: boolean }@@ -49,7 +49,8 @@ export function actorLabel(state: SuperTabState, key: string): string | undefinereturn agent && quotedName(agent.displayName ?? agent.name)}const person = state.people.find(p => p.id === id)- return person && (writtenNameOf(state, id) ?? person.email.split('@')[0])+ // Agents read these rows: by name, never an email someone took as their name (review of #2954).+ return person && (agentWrittenNameOf(state, id) ?? person.email.split('@')[0])}/**diff --git a/backend/src/superTabs/mentions.ts b/backend/src/superTabs/mentions.tsindex bb49e0527..01cc5785c 100644--- a/backend/src/superTabs/mentions.ts+++ b/backend/src/superTabs/mentions.ts@@ -87,6 +87,22 @@ export function namedIn(state: SuperTabState, text: string, names: ReadonlyMap<sreturn [...new Set(ids)]}+/** The agents of [group] that [text] names by `@Name` (task #2963): its display name or name in any case, matched only when+ * exactly one agent there goes by it and no person's username is the same, so a person's tag stays a tag. [names] is the+ * Swarm's usernames by person (usernames.ts swarmUsernames). A Buddy chat names no one this way: its sessions hear their own+ * threads alone (buddySessions.ts). */+export function agentsNamedIn(state: SuperTabState, group: Conversation, text: string, names: ReadonlyMap<string, string>): string[] {+ if (isBuddyChat(group)) return []+ const people = new Set([...names.values()].map(name => name.toLowerCase()))+ const tokens = tagTokens(text).filter(token => !token.includes('@') && !people.has(token))+ if (!tokens.length) return []+ const members = state.agents.filter(a => group.agentIds.includes(a.id))+ return [...new Set(tokens.flatMap(token => {+ const matches = members.filter(a => a.displayName?.toLowerCase() === token || a.name.toLowerCase() === token)+ return matches.length === 1 ? [matches[0]!.id] : []+ }))]+}+/** Whether [text] says `@` and exactly [name] outside code and links, in any case: a stored name that ends in a dot, chosen* before such names were refused, reads as a shorter tag in [namedIn] but is still said. */export function saysName(text: string, name: string): boolean {diff --git a/backend/src/superTabs/parts/touches.test.ts b/backend/src/superTabs/parts/touches.test.tsindex 082eb02a0..542eb72dc 100644--- a/backend/src/superTabs/parts/touches.test.ts+++ b/backend/src/superTabs/parts/touches.test.ts@@ -64,7 +64,7 @@ describe('the parts a command touches (design section 1.2, column T)', () => {it('leaves a post\'s recipients alone, so workers posting to their Lead in different groups never meet on the Lead', () => {const f = swarm(), a = f.group('A')- const { effects, touches } = f.run({ type: 'message.send', conversationId: a.id, text: 'Report', replyTo: null, recipientIds: [] }, f.agentActor(a.worker))+ const { effects, touches } = f.run({ type: 'message.send', conversationId: a.id, text: 'Report', replyTo: null, recipientIds: [f.lead] }, f.agentActor(a.worker))expect(effects.messages[0]!.recipients).toEqual([f.lead])expect(has(touches, 'agent', f.lead)).toBe(false)})diff --git a/backend/src/superTabs/personNames.test.ts b/backend/src/superTabs/personNames.test.tsindex a4daaf8c5..8ebd9bf6f 100644--- a/backend/src/superTabs/personNames.test.ts+++ b/backend/src/superTabs/personNames.test.ts@@ -4,8 +4,8 @@ import { createSuperTab, visibleState, type Actor } from './model.js'import { split } from './parts/shape.js'import { touchesFor } from './parts/touches.js'import { readerView } from './read/views.js'-import { MAX_NAME_LENGTH, shownNameOf, writtenNameOf } from './personNames.js'-import { usernameOf } from './usernames.js'+import { authorForAgent, lazyUsernames, MAX_NAME_LENGTH, namesPerson, rowForAgent, shownNameOf, writtenNameOf } from './personNames.js'+import { swarmUsernames, usernameOf } from './usernames.js'const owner: Extract<Actor, { kind: 'person' }> = { kind: 'person', userId: 'owner', email: '[email protected]' }const NOW = Date.parse('2026-11-03T10:00:00.000Z')@@ -176,3 +176,62 @@ describe('member.name', () => {expect(writtenNameOf(f.state, 'peer')).toBe('dee')})})++// Task #2954 (Ken, 11-04): a person's message is stored with their email as its author's name, and agents copied it into+// commands and pull request bodies until a machine's privacy hook stopped their sessions. An agent reads names instead.+describe('a person author as an agent reads it', () => {+ const stored = (id: string, email: string) => ({ kind: 'person' as const, id, name: email, membershipGeneration: 'g' })++ it('names them by username and the name they show, never by email', () => {+ const f = fixture()+ f.setName('Minh Nguyen')+ const names = swarmUsernames(f.state)+ expect(authorForAgent(f.state, stored('relay', relay.email), names))+ .toEqual({ kind: 'person', id: 'relay', name: 'wkpnjjhbnm', displayName: 'Minh Nguyen', membershipGeneration: 'g' })+ expect(authorForAgent(f.state, stored('peer', peer.email), names))+ .toEqual({ kind: 'person', id: 'peer', name: 'dee', displayName: 'dee', membershipGeneration: 'g' })+ })++ // A person may take their own email as their name (member.name): an agent still never reads it.+ it('names a person whose name is their own email by username', () => {+ const f = fixture()+ f.setName(relay.email)+ expect(authorForAgent(f.state, stored('relay', relay.email), swarmUsernames(f.state)))+ .toEqual({ kind: 'person', id: 'relay', name: 'wkpnjjhbnm', displayName: 'wkpnjjhbnm', membershipGeneration: 'g' })+ // Or holds it among other words (review of #2954).+ f.setName(`Minh ${relay.email}`)+ expect(authorForAgent(f.state, stored('relay', relay.email), swarmUsernames(f.state))).toMatchObject({ displayName: 'wkpnjjhbnm' })+ })++ it('reads every username as swarmUsernames gives it, working them out only for one not stored', () => {+ const f = fixture()+ f.run({ type: 'member.username', username: 'minh' }, relay)+ const lazy = lazyUsernames(f.state), all = swarmUsernames(f.state)+ for (const p of f.state.people) expect(lazy.get(p.id), p.id).toBe(all.get(p.id))+ expect(lazy.get('gone')).toBeUndefined()+ })++ it('names someone who left as a person, and leaves an agent author as it is', () => {+ const f = fixture()+ const names = swarmUsernames(f.state)+ const gone = authorForAgent(f.state, stored('gone', '[email protected]'), names)+ expect(gone).toEqual({ kind: 'person', id: 'gone', name: 'a person', displayName: 'a person', membershipGeneration: 'g' })+ expect(JSON.stringify(gone)).not.toContain('@')+ const agent = { kind: 'agent' as const, id: 'a1', name: 'Lead', displayName: 'River', membershipGeneration: 'g' }+ expect(authorForAgent(f.state, agent, names)).toBe(agent)+ })++ it('names the person who typed into an agent\'s terminal by name too, in a row an agent reads', () => {+ const f = fixture()+ const names = swarmUsernames(f.state)+ const agent = { kind: 'agent' as const, id: 'a1', name: 'Builder', displayName: 'Robin', membershipGeneration: 'g' }+ const native = { id: 'm1', author: agent, text: 'npm test', source: { kind: 'native', phase: 'input', operator: stored('peer', peer.email) } }+ expect(namesPerson(native)).toBe(true)+ const read = rowForAgent(f.state, names, native)+ expect(read).toEqual({ ...native, source: { kind: 'native', phase: 'input', operator: { kind: 'person', id: 'peer', name: 'dee', displayName: 'dee', membershipGeneration: 'g' } } })+ expect(JSON.stringify(read)).not.toContain('@')+ const plain = { id: 'm2', author: agent, text: 'Done.', source: null }+ expect(namesPerson(plain)).toBe(false)+ expect(rowForAgent(f.state, names, plain)).toEqual(plain)+ })+})diff --git a/backend/src/superTabs/personNames.ts b/backend/src/superTabs/personNames.tsindex a4690238c..84b0a0156 100644--- a/backend/src/superTabs/personNames.ts+++ b/backend/src/superTabs/personNames.ts@@ -1,6 +1,6 @@import { isRoleName } from './agentNames.js'import { reserved } from './buddies.js'-import { fail, person, type Actor, type SuperTabState } from './model.js'+import { fail, person, type Actor, type Author, type SuperTabState } from './model.js'import { printable } from './profile.js'import { agentNamesSeenBy, nameKey, swarmUsernames, usernameOf } from './usernames.js'@@ -68,3 +68,46 @@ export function writtenNameOf(state: SuperTabState, id: string): string | undeficonst name = state.people.find(p => p.id === id)?.namereturn name ? escaped(name) : usernameOf(state, id)}++/** A message's author as an agent reads it: a person by their username and the name they show, never by the email their+ * stored row names them with, which agents copied into commands and pull requests until a machine's privacy hook stopped+ * their sessions (task #2954, Ken 11-04). Someone who left reads as "a person". People's apps keep the stored row, which+ * they match to a person (Desktop superTabPersonName). [names] is `lazyUsernames(state)`, made once per read. */+export function authorForAgent<T extends Pick<Author, 'kind' | 'id'>>(state: SuperTabState, author: T, names: Usernames): T {+ if (author.kind !== 'person') return author+ const name = names.get(author.id) ?? 'a person'+ return { ...author, name, displayName: agentReadName(state.people.find(p => p.id === author.id)?.name) ?? name }+}++/** A name a person set, unless it holds an email address, which setName allows for one's own: an agent never reads one. */+const agentReadName = (name: string | undefined): string | undefined => name && !/[^\s@]+@[^\s@]+\.[^\s@]+/.test(name) ? name : undefined++/** Person [id] as server-written text an agent reads names them (writtenNameOf), never by an email they took as their name. */+export const agentWrittenNameOf = (state: SuperTabState, id: string): string | undefined =>+ agentReadName(state.people.find(p => p.id === id)?.name) ? writtenNameOf(state, id) : usernameOf(state, id)++type Row = { author: unknown; source?: unknown }+const personAuthor = (value: unknown): value is Author => !!value && typeof value === 'object' && (value as Author).kind === 'person'+/** Whether a stored row names a person by email: its author, or the person who typed into an agent's terminal (native.ts). */+export const namesPerson = (row: Row): boolean => personAuthor(row.author) || personAuthor((row.source as { operator?: unknown } | null)?.operator)+/** A stored row as an agent reads it (authorForAgent): its author and, for input someone typed into an agent's terminal, its+ * operator by name. */+export function rowForAgent<T extends Row>(state: SuperTabState, names: Usernames, row: T): T {+ const source = row.source as { kind?: unknown; operator?: unknown } | null | undefined+ const operator = source?.operator+ return {+ ...row,+ ...personAuthor(row.author) ? { author: authorForAgent(state, row.author, names) } : {},+ ...source && personAuthor(operator) ? { source: { ...source, operator: authorForAgent(state, operator, names) } } : {},+ }+}++/** Usernames by person id, as `swarmUsernames` gives them. */+export type Usernames = Pick<ReadonlyMap<string, string>, 'get'>+/** `swarmUsernames(state)`, worked out only for a person with no stored username: a stored one is final (usernames.ts), and+ * working out every default names every agent too, about 0.25 ms for today's 40 people and 40 agents and 7.5 ms at ten+ * times that, on each claim and page an agent reads (task #2954). */+export function lazyUsernames(state: SuperTabState): Usernames {+ let all: Map<string, string> | undefined+ return { get: id => state.people.find(p => p.id === id)?.username ?? (all ??= swarmUsernames(state)).get(id) }+}diff --git a/backend/src/superTabs/postRecipients.test.ts b/backend/src/superTabs/postRecipients.test.tsnew file mode 100644index 000000000..27cfa7a6c--- /dev/null+++ b/backend/src/superTabs/postRecipients.test.ts@@ -0,0 +1,160 @@+/**+ * Who an agent's post reaches (task #2963, Ken, 2026-11-04): in a day the PM got 841 deliveries, 420 of them agent posts,+ * and 402 of 437 agent posts reached it as their only recipient though only 1 named it. An agent's post reaches the agents+ * it names, the agent whose message it answers, and, in a task or step, its assignee when it names no one (River's ruling+ * in the task's thread). The PM hears the rest through status.+ */+import { describe, expect, it } from 'vitest'+import { REACHED_NO_AGENT, type Command } from './commands.js'+import { agent } from './model.js'+import { owner, stepsFixture } from './steps.test-support.js'++function setup() {+ const f = stepsFixture()+ const post = (by: string, on: string, text: string, recipientIds: string[] = [], reply?: { id: string; author: never }) =>+ f.run({ type: 'message.send', conversationId: on, text, replyTo: reply?.id ?? null, recipientIds } as Command, f.as(by),+ reply ? { reply: { id: reply.id, conversationId: on, author: reply.author, createdAt: 0, thread: reply.id } } : {}).messages+ const to = (messages: ReturnType<typeof post>) => messages.filter(m => m.source?.kind !== 'system').map(m => m.recipients)+ const nameOf = (id: string) => agent(f.state, id).displayName ?? agent(f.state, id).name+ return { f, post, to, nameOf }+}++describe('an agent post that names no one', () => {+ it('in its own task reaches no agent, not the PM', () => {+ const { f, post, to } = setup()+ expect(to(post(f.dev, f.task, 'PR #12 is ready for review.'))).toEqual([[]])+ })++ it('from another agent in a task reaches the task\'s assignee alone', () => {+ const { f, post, to } = setup()+ const other = f.add('other', f.task)+ expect(to(post(other, f.task, 'I pushed the fixture you asked for.'))).toEqual([[f.dev]])+ expect(to(post(f.lead, f.task, 'Rebase on main first.'))).toEqual([[f.dev]])+ })++ it('in a task with no active assignee reaches no agent', () => {+ const { f, post, to } = setup()+ const other = f.add('other', f.task)+ f.run({ type: 'work.status', conversationId: f.task, assignmentId: f.group(f.task).assignment!.id, status: 'done', result: 'Merged' } as Command, f.as(f.dev))+ expect(to(post(other, f.task, 'Thanks.'))).toEqual([[]])+ expect(to(post(f.dev, f.task, 'Merged.'))).toEqual([[]])+ })++ it('from a step\'s agent reaches no agent; the Engineer\'s reaches the step\'s agent', () => {+ const { f, post, to } = setup()+ const step = f.step('Review'), reviewer = f.add('reviewer', step)+ f.run({ type: 'work.assign', conversationId: step, agentId: reviewer }, f.as(f.dev))+ expect(to(post(reviewer, step, 'Ready to merge: Yes'))).toEqual([[]])+ expect(to(post(f.dev, step, 'Fixed in abc123, please re-check.'))).toEqual([[reviewer]])+ })++ it('in the project chat reaches no agent', () => {+ const { f, post, to } = setup()+ // The Engineer has a task in the project, so it posts there without joining.+ const rows = post(f.dev, 'lead', 'Ken, the fix is out.')+ expect(to(rows)).toEqual([[]])+ })+})++// Egret6's review: a post that reaches no agent says so to the agent that sent it, in the command's result every CLI prints.+describe('an agent post that reaches no agent', () => {+ const sent = (f: ReturnType<typeof stepsFixture>, by: string | null, on: string, recipientIds: string[] = [], agentOnly = false) =>+ f.run({ type: 'message.send', conversationId: on, text: 'PR #12 is ready.', replyTo: null, recipientIds, ...agentOnly ? { agentOnly } : {} } as Command,+ by ? f.as(by) : owner).result+ it('tells its sender, and a post that reached someone or a person\'s says nothing', () => {+ const f = stepsFixture()+ expect(sent(f, f.dev, f.task).reachedNoAgent).toBe(REACHED_NO_AGENT)+ expect(sent(f, f.dev, f.task, [f.lead])).not.toHaveProperty('reachedNoAgent')+ expect(sent(f, f.lead, f.task)).not.toHaveProperty('reachedNoAgent')+ expect(sent(f, f.dev, f.task, [f.dev], true)).not.toHaveProperty('reachedNoAgent')+ expect(sent(f, null, f.task, [])).not.toHaveProperty('reachedNoAgent')+ })+})++describe('an agent post that names agents', () => {+ it('reaches the PM only when it names the PM', () => {+ const { f, post, to } = setup()+ expect(to(post(f.dev, f.task, 'Need a ruling on the schema.', [f.lead]))).toEqual([[f.lead]])+ })++ it('reaches only the agent it names', () => {+ const { f, post, to } = setup()+ const other = f.add('other', f.task)+ expect(to(post(f.dev, f.task, 'Can you check the fixture?', [other]))).toEqual([[other]])+ expect(to(post(f.lead, f.task, 'Take a look.', [other]))).toEqual([[other]])+ })++ it('names an agent of the conversation by @Name in its text', () => {+ const { f, post, to, nameOf } = setup()+ const other = f.add('other', f.task)+ expect(to(post(f.dev, f.task, `@${nameOf(other)} the CI runner is down.`))).toEqual([[other]])+ expect(to(post(f.dev, f.task, `@${nameOf(f.lead)} the CI runner is down.`))).toEqual([[f.lead]])+ })+})++describe('an agent\'s thread reply', () => {+ it('reaches the agent who wrote the message it answers', () => {+ const { f, post, to } = setup()+ const other = f.add('other', f.task)+ const asked = post(other, f.task, 'Which migration does this need?', [f.dev])[0]!+ expect(to(post(f.dev, f.task, 'None: the field is optional.', [], { id: asked.id, author: asked.author as never }))).toEqual([[other]])+ const ruled = post(f.lead, f.task, 'Is the migration reversible?', [f.dev])[0]!+ expect(to(post(f.dev, f.task, 'Yes.', [], { id: ruled.id, author: ruled.author as never }))).toEqual([[f.lead]])+ })++ it('reaches a step agent that answered the Engineer, and nobody for a person\'s message', () => {+ const { f, post, to } = setup()+ const step = f.step('Review'), reviewer = f.add('reviewer', step)+ f.run({ type: 'work.assign', conversationId: step, agentId: reviewer }, f.as(f.dev))+ const verdict = post(reviewer, step, 'Ready to merge: With fixes', [f.dev])[0]!+ expect(to(post(f.dev, step, 'Fixed, please re-check.', [], { id: verdict.id, author: verdict.author as never }))).toEqual([[reviewer]])+ const asked = f.run({ type: 'message.send', conversationId: 'lead', text: 'Is the fix out?', replyTo: null, recipientIds: [] } as Command, owner).messages[0]!+ expect(to(post(f.dev, 'lead', 'Yes, since 14:00.', [], { id: asked.id, author: asked.author as never }))).toEqual([[]])+ })+})++describe('status still reaches the PM', () => {+ const status = (status: string, result: string | null) => {+ const f = stepsFixture()+ const rows = f.run({ type: 'work.status', conversationId: f.task, assignmentId: f.group(f.task).assignment!.id, status, result } as Command, f.as(f.dev)).messages+ return { f, rows: rows.filter(m => m.conversationId === f.task) }+ }++ it.each([['done', 'Merged #12'], ['needs_human', 'Ship behind a flag?'], ['blocked', 'No Mac here']])('%s', (kind, result) => {+ const { f, rows } = status(kind, result)+ expect(rows.some(m => m.recipients.includes(f.lead))).toBe(true)+ })++ it('lost', () => {+ const f = stepsFixture()+ const rows = f.run({ type: 'agent.alert', agentId: f.dev, alert: 'limit', active: true, resetAt: new Date(3_600_000).toISOString() } as Command, f.as(f.dev)).messages+ expect(rows.some(m => m.source?.kind === 'work-lost' && m.recipients.includes(f.lead))).toBe(true)+ })+})++/** One hour of a working day, in the shape of Ken's 11-04 numbers: most agent posts are reports, verdicts and+ * acknowledgements that name no one; one names the PM and one answers it. */+describe('the PM\'s deliveries in a fixture hour', () => {+ it('are only the posts that name it or answer it', () => {+ const { f, post, nameOf } = setup()+ const step = f.step('Review'), reviewer = f.add('reviewer', step)+ f.run({ type: 'work.assign', conversationId: step, agentId: reviewer }, f.as(f.dev))+ const other = f.add('helper', f.task)+ const rows = [+ ...['Plan pushed.', 'Task 1 red.', 'Task 1 green.', 'PR is ready.', 'CI green.', 'Merged main in.'].flatMap(t => post(f.dev, f.task, t)),+ ...['Reading the diff.', 'Ready to merge: With fixes', 'Ready to merge: Yes'].flatMap(t => post(reviewer, step, t)),+ ...post(reviewer, f.task, 'Understood.'),+ ...post(other, f.task, 'On it.'),+ ...post(f.dev, f.task, '@owner here is the mockup.'),+ ...['Ken, I am on it.', 'Ken, it shipped.'].flatMap(t => post(f.dev, 'lead', t)),+ ...post(f.dev, step, 'Fixed in abc123.', [reviewer]),+ ...post(f.dev, f.task, 'Which database should this use?', [f.lead]),+ ...post(f.dev, f.task, `@${nameOf(f.lead)} the runner is down.`),+ ]+ const asked = post(f.lead, f.task, 'Is the migration reversible?', [f.dev])[0]!+ rows.push(...post(f.dev, f.task, 'Yes.', [], { id: asked.id, author: asked.author as never }))+ const agentPosts = rows.filter(m => m.author.kind === 'agent' && m.source?.kind !== 'system')+ expect(agentPosts).toHaveLength(18)+ expect(agentPosts.filter(m => m.recipients.includes(f.lead))).toHaveLength(3)+ })+})diff --git a/backend/src/superTabs/projects.test.ts b/backend/src/superTabs/projects.test.tsindex 2ad7bebbd..50644a050 100644--- a/backend/src/superTabs/projects.test.ts+++ b/backend/src/superTabs/projects.test.ts@@ -643,7 +643,8 @@ describe('whom a group\'s work is for', () => {// Security review 2 of #2492: the line comes with each task, from that task's requester, never once at the agent's start.describe('whom a task\'s pull requests are for', () => {- const line = (email: string) => `Start each pull request body with: Requested by ${email} through Harness.`+ // By name, never email (task #2954): agents copied the email into pull requests and a privacy hook stopped them.+ const line = (name: string) => `Start each pull request body with: Requested by ${name} through Harness.`it('ends each task\'s message with its own requester, for an Engineer reused across two people\'s tasks', () => {const f = setup()f.state.people.push({ id: 'third', email: '[email protected]', role: 'collaborator', generation: 'first' })@@ -657,11 +658,12 @@ describe('whom a task\'s pull requests are for', () => {f.run({ type: 'work.assign', conversationId: group, agentId: worker })return f.messages.find(m => m.conversationId === group && m.recipients?.includes(worker))!.text}- expect(assigned(first)).toBe(`Work for peer\n\nAcceptance checks:\n- Done\n\n${line('[email protected]')}`)+ expect(assigned(first)).toBe(`Work for peer\n\nAcceptance checks:\n- Done\n\n${line('peer')}`)f.run({ type: 'work.cancel', conversationId: first, assignmentId: f.state.conversations.find(c => c.id === first)!.assignment!.id, reason: 'Next one' })const text = assigned(second)- expect(text.endsWith(line('[email protected]'))).toBe(true)- expect(text).not.toContain('[email protected]')+ expect(text.endsWith(line('third'))).toBe(true)+ expect(text).not.toContain('peer')+ expect(text).not.toContain('@')})it('is the owner\'s for a group nobody asked for, and absent on the owner\'s own machine and for a review', () => {@@ -671,7 +673,14 @@ describe('whom a task\'s pull requests are for', () => {const review = String(f.run({ type: 'conversation.create', title: 'Review', brief: '', checks: [], reviewOf: plain }).conversationId)const group = (id: string) => f.state.conversations.find(c => c.id === id)!const project = projectOf(f.state, 'lead'), agentOf = (owner: string) => ({ ...f.state.agents.find(a => a.id === worker)!, machineOwnerId: owner })- expect(requestedByLine(f.state, project, group(plain), agentOf('host'))).toBe(line('[email protected]'))+ expect(requestedByLine(f.state, project, group(plain), agentOf('host'))).toBe(line('owner'))+ // The name they show, written as plain words (personNames.ts writtenNameOf).+ f.state.people.find(p => p.id === 'owner')!.name = 'Ken *15*'+ expect(requestedByLine(f.state, project, group(plain), agentOf('host'))).toBe(line('Ken \\*15\\*'))+ // Never an email, even one they took as their name.+ f.state.people.find(p => p.id === 'owner')!.name = '[email protected]'+ expect(requestedByLine(f.state, project, group(plain), agentOf('host'))).toBe(line('owner'))+ delete f.state.people.find(p => p.id === 'owner')!.nameexpect(requestedByLine(f.state, project, group(plain), agentOf('owner'))).toBeNull()expect(requestedByLine(f.state, project, group(review), agentOf('host'))).toBeNull()// An owner with no email on their row: no line, as the start gave none.diff --git a/backend/src/superTabs/projects.ts b/backend/src/superTabs/projects.tsindex 8859cd1e0..3e3744479 100644--- a/backend/src/superTabs/projects.ts+++ b/backend/src/superTabs/projects.ts@@ -2,6 +2,7 @@ import { createHash } from 'node:crypto'import { activeWork, agent, agentRole, author, conversation, fail, isLeads, leadsRemoved, nextConversationNumber, person, type Actor, type Agent, type AgentStart, type AgentStartRequest, type Conversation, type Person, type SuperTabState } from './model.js'import type { SwarmRule } from './rules.js'import { buddyReads, isBuddy, isBuddyChat, isSwarmBuddy, isSwarmBuddyChat } from './buddies.js'+import { agentWrittenNameOf } from './personNames.js'export type ProjectVisibility = 'public' | 'private'/** Which built-in skill texts the project's agents get: Default (the team process only) or today's Harness orchestration. */@@ -187,11 +188,12 @@ export function workRequesterId(state: SuperTabState, project: SwarmProject, gro* task, from that task's requester, so a reused Engineer never names the one before; the start prompt names nobody* (security review 2 of #2492). Given where the start prompt gave it before: another person's project work, where the* project's owner is not the machine's (cli/src/superTabs/start.ts `githubPromptLine`). A review opens no pull request.- * The email is the Swarm row's, which the Swarm's members already see. */+ * The name is the one the Swarm shows them (personNames.ts writtenNameOf). */export function requestedByLine(state: SuperTabState, project: SwarmProject, group: Conversation, worker: Agent): string | null {if (group.reviewOf || project.ownerId === worker.machineOwnerId) return null- const email = state.people.find(p => p.id === workRequesterId(state, project, group))?.email- return email ? `Start each pull request body with: Requested by ${email} through Harness.` : null+ const requester = state.people.find(p => p.id === workRequesterId(state, project, group))+ // By name, never email: agents pasted the email into pull requests and a machine's privacy hook stopped them (task #2954).+ return requester?.email ? `Start each pull request body with: Requested by ${agentWrittenNameOf(state, requester.id)} through Harness.` : null}export function readProject(state: SuperTabState, actor: Actor, projectId: string): SwarmProject {diff --git a/backend/src/superTabs/steps.test.ts b/backend/src/superTabs/steps.test.tsindex 2451d2a4c..edf45a3ef 100644--- a/backend/src/superTabs/steps.test.ts+++ b/backend/src/superTabs/steps.test.ts@@ -4,7 +4,7 @@* readers show it inside its task. No step name means anything to the server.*/import { describe, expect, it } from 'vitest'-import { PAIR_CHAIN_LIMIT, type Command } from './commands.js'+import type { Command } from './commands.js'import { agent, type Actor } from './model.js'import { extracted } from './parts/write.js'import { owner, stepsFixture } from './steps.test-support.js'@@ -95,9 +95,13 @@ describe('assigning a step', () => {const a = reviewing()post(a.f, a.id, [a.f.dev], a.rev)expect(a.f.group(a.id).assignment!.toldEngineerAt).toBe(a.f.now)- // A plain post in a step reaches its Engineer by default, so it counts too.+ // A reply to the Engineer's message reaches it, so it counts too; a plain post reaches no one since #2963.const b = reviewing()post(b.f, b.id, [], b.rev)+ expect(b.f.group(b.id).assignment!.toldEngineerAt).toBeUndefined()+ const asked = b.f.run({ type: 'message.send', conversationId: b.id, text: 'Ready for review.', replyTo: null, recipientIds: [b.rev] } as Command, b.f.as(b.f.dev)).messages[0]!+ b.f.run({ type: 'message.send', conversationId: b.id, text: 'Ready to merge: No.', replyTo: asked.id, recipientIds: [] } as Command, b.f.as(b.rev),+ { reply: { id: asked.id, conversationId: b.id, author: asked.author, createdAt: 0 } })expect(b.f.group(b.id).assignment!.toldEngineerAt).toBe(b.f.now)// Named from the task's own chat, once the Reviewer is in it.const c = reviewing()@@ -302,10 +306,10 @@ describe('who hears a step', () => {expect(to(status('done', 'Passed'), id)).toEqual([[f.dev]])})- it('an unnamed post in the task reaches the owner after the owner\'s own work is done', () => {+ it('an unnamed post in the task reaches no one after the owner\'s own work is done', () => {const { f, post, status } = reviewing()status('done', 'Merged', f.task, f.dev)- expect(to(post(f.task), f.task)).toEqual([[f.dev]])+ expect(to(post(f.task), f.task)).toEqual([[]])})it('with the owner gone from the Swarm, a step\'s done reaches the coordinator', () => {@@ -325,9 +329,10 @@ describe('who hears a step', () => {expect(status('review', 'Findings posted').filter(m => m.conversationId === id).map(m => m.text)).toEqual(['Ready\n\nFindings posted'])})- it('a step agent\'s unnamed post reaches the owner, in its step or in its task', () => {+ // #2963: a step agent names its Engineer; its unnamed post in the task reaches the task's assignee, the Engineer.+ it('a step agent\'s unnamed post reaches no one in its step, and the owner in its task', () => {const { f, id, post } = reviewing()- expect(to(post(id), id)).toEqual([[f.dev]])+ expect(to(post(id), id)).toEqual([[]])expect(to(post(f.task), f.task)).toEqual([[f.dev]])})@@ -343,26 +348,18 @@ describe('who hears a step', () => {expect(to(named, id)).toEqual([[f.lead]])})- // Cleo's review of #2635: nothing is dropped. Where the owner's post does not go to the step's agent, it falls back as before.- it('the owner\'s unnamed post after the pair\'s loop guard stops still reaches the coordinator', () => {+ it('the owner\'s unnamed reply to the PM in its step reaches the PM and the step\'s agent', () => {const { f, id, rev } = reviewing()- const recent = Array.from({ length: PAIR_CHAIN_LIMIT }, (_, i) => ({ author: { kind: 'agent', id: i % 2 ? rev : f.dev } as never, recipients: [i % 2 ? f.dev : rev] }))- const sent = f.run({ type: 'message.send', conversationId: id, text: 'Fixed, please re-check.', replyTo: null, recipientIds: [] } as Command, f.as(f.dev), { recent }).messages- expect(to(sent, id)).toEqual([[f.lead]])- })-- it('the owner\'s unnamed reply to someone else in its step still reaches the coordinator', () => {- const { f, id } = reviewing()const asked = f.run({ type: 'message.send', conversationId: id, text: 'Status?', replyTo: null, recipientIds: [f.dev] } as Command, f.as(f.lead)).messages[0]!const answer = f.run({ type: 'message.send', conversationId: id, text: 'Almost.', replyTo: asked.id, recipientIds: [] } as Command, f.as(f.dev),{ reply: { id: asked.id, conversationId: id, author: asked.author, createdAt: 0 } }).messages- expect(to(answer, id)).toEqual([[f.lead]])+ expect(to(answer, id)).toEqual([[f.lead, rev]])})- it('an agent with no open step in the task still reaches the coordinator', () => {+ it('an agent with no open step in the task reaches the task\'s assignee, never the coordinator', () => {const { f, post } = reviewing()const other = f.add('other', f.task)- expect(to(post(f.task, other), f.task)).toEqual([[f.lead]])+ expect(to(post(f.task, other), f.task)).toEqual([[f.dev]])})})@@ -439,10 +436,12 @@ describe('a linked task opened without a step name', () => {expect(done.filter(m => m.conversationId === id).map(m => m.recipients)).toEqual([[f.dev], []])expect(f.group(f.task).agentIds).toContain(tester)})- it('an unnamed post from its agent reaches the owner', () => {+ it('an unnamed post from its agent reaches no one, and one naming the owner reaches it (#2963)', () => {const { f, id, tester } = linked()const posted = f.run({ type: 'message.send', conversationId: id, text: 'Starting on the simulator.', replyTo: null, recipientIds: [] } as Command, f.as(tester)).messages- expect(posted.map(m => m.recipients)).toEqual([[f.dev], []])+ expect(posted.map(m => m.recipients)).toEqual([[]])+ const named = f.run({ type: 'message.send', conversationId: id, text: 'Ready to merge: No.', replyTo: null, recipientIds: [f.dev] } as Command, f.as(tester)).messages+ expect(named.map(m => m.recipients)[0]).toEqual([f.dev])})it('closes with its task, not on its own clock', () => {const { f, id, tester } = linked()@@ -457,14 +456,16 @@ describe('a linked task opened without a step name', () => {// Ken, 2026-11-02: in 20 minutes the PM got 23 messages; about half were agents' posts it had nothing to do with.describe('the PM is not told what a step\'s agent says to its task', () => {- it('a step agent that lost its step still reaches the owner, in the step', () => {+ it('a step agent that lost its step reaches the owner by name, in the step', () => {const f = stepsFixture()const id = f.step('Review')const rev = f.add('rev', id)f.run({ type: 'work.assign', conversationId: id, agentId: rev }, f.as(f.dev))f.run({ type: 'work.status', conversationId: id, assignmentId: f.group(id).assignment!.id, status: 'done', result: 'Passed' } as Command, f.as(rev))- const posted = f.run({ type: 'message.send', conversationId: id, text: 'Re-read the new head: still passes.', replyTo: null, recipientIds: [] } as Command, f.as(rev)).messages- expect(posted.map(m => m.recipients)).toEqual([[f.dev]])+ const unnamed = f.run({ type: 'message.send', conversationId: id, text: 'Re-read the new head: still passes.', replyTo: null, recipientIds: [] } as Command, f.as(rev)).messages+ expect(unnamed.map(m => m.recipients)).toEqual([[]])+ const posted = f.run({ type: 'message.send', conversationId: id, text: 'Re-read the new head: still passes.', replyTo: null, recipientIds: [f.dev] } as Command, f.as(rev)).messages+ expect(posted.map(m => m.recipients)[0]).toEqual([f.dev])})it('an agent whose step is done still reaches the owner, in the task', () => {const f = stepsFixture()diff --git a/backend/src/superTabs/steps.ts b/backend/src/superTabs/steps.tsindex 7f8bab35d..1674f4a23 100644--- a/backend/src/superTabs/steps.ts+++ b/backend/src/superTabs/steps.ts@@ -73,11 +73,6 @@ export function taskOwner(state: SuperTabState, step: Conversation): string | nureturn task ? ownerOf(state, task) : null}-/** Whether [agentId] holds or held a step of task [taskId], open or finished: its posts there are about that step's work- * (Ken, 2026-11-02: a Reviewer's "both re-checks pass", after its step was done, reached the PM). */-export const holdsStepOf = (state: SuperTabState, taskId: string, agentId: string): boolean =>- stepsOf(state, taskId).some(s => s.assignment?.agentId === agentId)-/** Whether [agentId] has held steps only, never a task, in the groups loaded, and a task one of them checks has not ended: a* Reviewer or Tester the instructions keep while the work it checked is open, whatever its role is called, so its idle time* is no news for the coordinator. Once each of those tasks is done or cancelled it is idle as any agent is, whether or notdiff --git a/backend/src/superTabs/store.ts b/backend/src/superTabs/store.tsindex 821be0d09..7087bd857 100644--- a/backend/src/superTabs/store.ts+++ b/backend/src/superTabs/store.ts@@ -1,7 +1,7 @@import { refusalLogFields, type DeclaredClient } from './refusalLog.js'import { writeReactionActivity, writeReplyActivity } from './activity.js'import { accountMachineName, availableSlots, expireRemovals, followAccountName, LASTING_TEAM_REFUSALS, machineContribution, machineObservationSchema, slotCounter, machineTeamWork, preparableStart, readingOnly, refusableStart, recordAgentPresence, renamedBy, removalPreview, startPreparing, storedObservation, swarmGridRow, teamAccountRequired, teamWorkRefusal, ownAccountWork, ownAccountNote, type MachineObservation } from './machines.js'-import { shownNameOf } from './personNames.js'+import { authorForAgent, lazyUsernames, namesPerson, rowForAgent, shownNameOf } from './personNames.js'import { readingClearsSuspensions, suspendedEngines } from './engineHealth.js'import { BUDDY_OWN_MACHINE_REFUSAL } from './buddyContract.js'import { createHash } from 'node:crypto'@@ -18,7 +18,7 @@ import { isTeamSession, teamMachine, TEAM_SESSION_LIMITED, TEAM_SESSION_MESSAGEimport { machineShareGrant, sharedVia } from '../lib/machineSharePolicy.js'import { machineBillingAllowsDataPlane } from '../lib/billingState.js'import { DELETED_SWARM_COMMANDS, DELETION_COMMANDS, notThere } from './deletion.js'-import { applyCommand, authorizeCommandAccess, IGNORED_NOTE, LOOP_NOTICE_AT, mayResumeStart, operationSchema, PAIR_CHAIN_LIMIT, postable, reserveHarnessSlot, worksInProjectChat, ruleProject, type Command, type CommandContext } from './commands.js'+import { applyCommand, authorizeCommandAccess, IGNORED_NOTE, LOOP_NOTICE_AT, mayResumeStart, operationSchema, postable, reserveHarnessSlot, worksInProjectChat, ruleProject, type Command, type CommandContext } from './commands.js'import { redactCredentials } from './credentials.js'import type { AvatarUpload } from './profile.js'import { reactionCounts, type ReactionTarget } from './reactions.js'@@ -1700,7 +1700,7 @@ export class SuperTabStore {}if (command.type === 'message.send' && actor.kind === 'agent') {const recent = await tx.superTabMessage.findMany({ where: { tabId, conversationId: command.conversationId },- orderBy: { sequence: 'desc' }, take: Math.max(PAIR_CHAIN_LIMIT, LOOP_NOTICE_AT), select: { author: true, recipientIds: true, createdAt: true, source: true } })+ orderBy: { sequence: 'desc' }, take: LOOP_NOTICE_AT, select: { author: true, recipientIds: true, createdAt: true, source: true } })context.recent = recent.map(m => ({ author: m.author as unknown as Author, recipients: m.recipientIds, createdAt: m.createdAt.getTime(), source: m.source }))}if (command.type === 'work.status' && command.status === 'stopped') {@@ -3032,16 +3032,20 @@ export class SuperTabStore {// The main Buddy counts none of a session thread's replies, as it reads none (buddySessions.ts).const counted = buddy ? threadRows.filter(r => !r.routing && (own || !(isBuddyChat(group) && r.session))) : threadRowsconst summaries = counted.length ? threadSummaries(state, group, counted) : []- const threads = buddy ? summaries.map(t => ({ ...t, authors: t.authors.map(authorForBuddy) })) : summaries+ // An agent reads people by name, never email (task #2954): the usernames are worked out only for a read that has a person.+ const names = actor.kind === 'agent' && (page.some(namesPerson) || summaries.some(t => t.authors.some(a => a.kind === 'person')))+ ? lazyUsernames(state) : null+ const named = names ? summaries.map(t => ({ ...t, authors: t.authors.map(a => authorForAgent(state, a, names)) })) : summaries+ const threads = buddy ? named.map(t => ({ ...t, authors: t.authors.map(authorForBuddy) })) : named// A lost task's rows and a machine leaving name the machine; a Buddy reads them without it (security reviews of #2115), and// an agent's rows without its membership (delta review 1 of #2258).- const shown = (buddy ? page.map(rowForBuddy) : page).map(m => (m.thread && hidden.has(m.thread)) || (m.replyTo && hidden.has(m.replyTo))+ const shown = (buddy ? page.map(rowForBuddy) : page).map(m => names ? rowForAgent(state, names, m) : m).map(m => (m.thread && hidden.has(m.thread)) || (m.replyTo && hidden.has(m.replyTo))? { ...m, ...(m.thread && hidden.has(m.thread) ? { thread: null } : {}), ...(m.replyTo && hidden.has(m.replyTo) ? { replyTo: null } : {}) } : m)// Whose Buddy hears a row is its person's own: its news shows to that Buddy alone.const shownTo = (m: SuperTabMessage, d: PageDelivery) => !buddyNews(m, d) || (actor.kind === 'agent' && actor.agentId === d.agentId)// A session's own thread read carries the main-chat excerpt it started from (buddySessions.ts sessionContext).// A project session of a person's one Buddy chat reads no excerpt: the main chat may hold any project's material (spec: Guard).- const context = own && !own.projectId && !forward && cursor.before === undefined && !cursor.messageId ? await this.sessionExcerpt(tx, tabId, conversationId, own.from, m => rowRead(m) && sessionReadsRow(undefined, group, state)(m)) : undefined+ const context = own && !own.projectId && !forward && cursor.before === undefined && !cursor.messageId ? await this.sessionExcerpt(tx, state, tabId, conversationId, own.from, m => rowRead(m) && sessionReadsRow(undefined, group, state)(m)) : undefined// Only the rows this reader is shown get file links, each signed afresh for this read (fileLinks.ts).const linked = await this.linked(tabId, shown)// A person's read of new messages is where a message reaches them (task #2840): every app reads `after` once a push or its@@ -3076,12 +3080,14 @@ export class SuperTabStore {/** The main-chat excerpt a Buddy thread session starts from: main-stream rows at or before `from` it may read (never a session* thread's, never a reply only in its thread), by the conversation's sequence index, at most 50 rows read for 10 kept. */- private async sessionExcerpt(tx: Transaction, tabId: string, conversationId: string, from: number,+ private async sessionExcerpt(tx: Transaction, state: SuperTabState, tabId: string, conversationId: string, from: number,rowRead: (m: Pick<SuperTabMessage, 'id' | 'source' | 'recipientIds' | 'thread' | 'buddySession' | 'buddyProject'>) => boolean) {const rows = await tx.superTabMessage.findMany({ where: { tabId, conversationId, sequence: { lte: from } }, orderBy: [{ sequence: 'desc' }, { id: 'desc' }],take: 50, select: { id: true, sequence: true, text: true, author: true, createdAt: true, thread: true, alsoInChat: true, buddySession: true, source: true, recipientIds: true, buddyProject: true } })const main = rows.filter(r => !r.buddySession && (!r.thread || r.thread === r.id || r.alsoInChat) && rowRead(r))- return sessionContext(main.map(r => ({ ...r, author: r.author as unknown as ContextRow["author"] })))+ // A Buddy is an agent: it reads people by name, never email (task #2954).+ const names = lazyUsernames(state)+ return sessionContext(main.map(r => ({ ...r, author: authorForAgent(state, r.author as unknown as Author, names) as ContextRow['author'] })))}/** What the person missed in one conversation since `after` (catchUp.ts), from the rows past it they may read, as a page@@ -4103,7 +4109,9 @@ export class SuperTabStore {// A Buddy reads no machine names, in what it is handed too (security review 2 of #2178). News from outside its chat// (buddyNews.ts) is marked, so its host words it as news to note, never a message to answer there.const target = agent(state, agentId), group = conversation(state, delivery.conversationId)- const shown = row && isBuddy(target) ? rowForBuddy(row) : row+ // An agent reads people by name, never email (task #2954).+ const named = row && namesPerson(row) ? rowForAgent(state, lazyUsernames(state), row) : row+ const shown = named && isBuddy(target) ? rowForBuddy(named) : named// A voice message reaches an agent as its words, marked as one (voiceMessages.ts); people hear the clip.const message = shown && { ...shown, text: agentText(shown.text, shown.attachments) }// Only a claim's answer is typed: an acknowledgement reads nothing for it.diff --git a/backend/src/superTabs/teamWritten.test.ts b/backend/src/superTabs/teamWritten.test.tsindex 21ceed0ba..ba1efe848 100644--- a/backend/src/superTabs/teamWritten.test.ts+++ b/backend/src/superTabs/teamWritten.test.ts@@ -183,6 +183,19 @@ describe('a task a Team agent worked on', () => {expect(refusal(() => post(task, [tester], owner))).toBeNull()})+ // #2963: @Name in the text names an agent too, but only one the sender may name; it never turns a post into a refusal.+ it('skips a main-account member a post names by @Name in a marked task, and still posts', () => {+ const f = swarm(), task = f.group(), builder = f.member('main-builder', 'mac'), tester = f.member('main-tester', 'mac')+ f.run({ type: 'work.assign', conversationId: task, agentId: builder })+ f.run({ type: 'conversation.agent', conversationId: task, agentId: tester, present: true, lead: false })+ f.state.conversations.find(c => c.id === task)!.teamWritten = true+ const team = f.member('team-tester', 'mac-team')+ f.run({ type: 'conversation.agent', conversationId: task, agentId: team, present: true, lead: false })+ const sent = f.run({ type: 'message.send', conversationId: task, text: '@main-tester and @team-tester, please test again.', replyTo: null, recipientIds: [] },+ { kind: 'agent', agentId: builder, machineOwnerId: 'owner' })+ expect(sent.messages[0]!.recipients).toEqual([team])+ })+it('reads who pushed before adding an agent: a bot\'s push or an unknown refuses the main account, and a Team agent still joins', () => {const f = swarm(), task = f.group(), main = f.member('main-reviewer', 'mac')const add = (agentId: string, pushOrigin: 'team' | 'unknown') => f.run({ type: 'conversation.agent', conversationId: task, agentId, present: true, lead: false }, owner, { pushOrigin })diff --git a/backend/src/superTabs/teamWritten.ts b/backend/src/superTabs/teamWritten.tsindex f3a98324d..7c232404c 100644--- a/backend/src/superTabs/teamWritten.ts+++ b/backend/src/superTabs/teamWritten.ts@@ -61,10 +61,14 @@ export function failTeamWritten(details?: Record<string, unknown>): never {export const hasStep = (state: SuperTabState, group: Conversation, worker: Agent): boolean =>state.conversations.some(c => c.reviewOf === group.id && (c.assignment?.agentId === worker.id || c.agentIds.includes(worker.id)))-/** Refuses an agent naming a main-account member of Team-written work in a post: how a re-test or re-check is asked for. */+/** Whether [sender] may name [named] in a post: not a main-account member of Team-written work, how a re-test or re-check is+ * asked for, unless [sender] coordinates. */+export const mayName = (state: SuperTabState, group: Conversation, sender: Agent, named: Agent): boolean =>+ coordinates(state, group, sender) || named.id === sender.id || !barredFromTeamWritten(state, group, named)++/** Refuses an agent naming one it may not ([mayName]) with --to. */export function requireNameable(state: SuperTabState, group: Conversation, sender: Agent, named: Agent): void {- if (coordinates(state, group, sender) || named.id === sender.id) return- requireTeamWrittenAccount(state, group, named)+ if (!mayName(state, group, sender, named)) failTeamWritten()}/** Everyone to tell when [group]'s task has just been marked, by the conversation that reaches them, each once: the main-accountdiff --git a/cli/src/cable/cableSession.spec.ts b/cli/src/cable/cableSession.spec.tsindex 5cb78669f..4f09f581c 100644--- a/cli/src/cable/cableSession.spec.ts+++ b/cli/src/cable/cableSession.spec.ts@@ -5413,6 +5413,30 @@ describe('swarm cards', () => {} finally { await session.stop() }})+ // A tag in a task thread (#2965): sent once, as `group` with its thread; a second card with that tag sends nothing, and+ // one that arrives while the window has that thread open is read there.+ it('a task thread\'s tag is sent once, and not while the window has that thread open', async () => {+ const tagged = (id: string) => ({ chat: 'group' as const, chatId: 'g1', id, text: 'Sam: @diego look', at: 1792560000, thread: 'r1' })+ const state: Parameters<typeof cardHost>[0] = { cards: [card('st1', [lead(1, { chat: pmChat })])] }+ const { session, port } = await connect(cardHost(state))+ try {+ port.say(ROUND_THREAD)+ await vi.waitFor(() => expect(ofType(port, 'supertab')).toHaveLength(1))+ state.cards = [card('st1', [lead(1, { chat: pmChat, notice: tagged('msg1') })])]+ await session.syncSwarmCards()+ await vi.waitFor(() => expect(ofType(port, 'supertab.notice')).toEqual([+ { t: 'supertab.notice', tab: 'st1', lead: 'lead1', chat: 'group', chatId: 'g1', id: 'msg1', text: 'Sam: @diego look', at: 1792560000, thread: 'r1' }]))+ await session.syncSwarmCards()+ await new Promise((r) => setTimeout(r, 350))+ expect(ofType(port, 'supertab.notice')).toHaveLength(1)+ state.open = { superTabId: 'st1', projectId: 'proj1', conversationId: 'g1', threadRoot: 'r1', fromDevice: false }+ state.cards = [card('st1', [lead(1, { chat: pmChat, notice: tagged('msg2') })])]+ await session.syncSwarmCards()+ await new Promise((r) => setTimeout(r, 350))+ expect(ofType(port, 'supertab.notice')).toHaveLength(1)+ } finally { await session.stop() }+ })+it('a dial without swarmThread gets today\'s frame for a thread notice', async () => {const state: Parameters<typeof cardHost>[0] = { cards: [card('st1', [lead(1, { chat: pmChat })])], open: { superTabId: 'st1', projectId: 'proj1', conversationId: 'pm1', fromDevice: false } }const { session, port } = await connect(cardHost(state))diff --git a/cli/src/core/api.ts b/cli/src/core/api.tsindex 10eb283cb..b312a9661 100644--- a/cli/src/core/api.ts+++ b/cli/src/core/api.ts@@ -1275,10 +1275,11 @@ export interface SwarmChat { kind: ChatKind; id: string; name: string; working:/** While the face is in a thread (the app's, or the one the dial's words started): its root, its title (first line, 80 bytes)* and, when the read gives it, its reply count. Sent only to a dial that speaks swarmThread. */thread?: { root: string; title: string; replies?: number } }-/** The newest message the project's Lead wrote in its Lead conversation or the reader's Buddy chat since the baseline (the- * dial's alert), or the reader's Buddy wrote in its chat (`buddy`, the quiet one). `thread`: the root of the thread it- * replies in, when it is in that thread only; such a notice is read only where that thread is open. */-export interface LeadNotice { chat: 'lead' | 'pm' | 'buddy'; chatId: string; id: string; text: string; at: number; thread?: string }+/** The newest tag of the reader's in the project since the baseline, the dial's alert: in its Lead conversation (`lead`), the+ * reader's Buddy chat or a Chat with PM (`pm`), or a task chat (`group`, #2965); or the newest message the reader's Buddy+ * wrote in its chat (`buddy`, the quiet one). `thread`: the root of the thread it is in, when it is in that thread only; such+ * a notice is read only where that thread is open. */+export interface LeadNotice { chat: 'lead' | 'pm' | 'group' | 'buddy'; chatId: string; id: string; text: string; at: number; thread?: string }/** The reader's own Buddy in a project, for a round dial's Buddy screen: its chat, name and engine, Desktop's pattern for* its name (`cells`, the 15 half bits; `color`, `#rrggbb`), and `live` false while it is down. */export interface SwarmBuddy { chatId: string; name: string; engine: string; cells: number; color: string; live: booleandiff --git a/cli/src/lib/swarmSkills.spec.ts b/cli/src/lib/swarmSkills.spec.tsindex 09dac6a5d..196aee53b 100644--- a/cli/src/lib/swarmSkills.spec.ts+++ b/cli/src/lib/swarmSkills.spec.ts@@ -112,7 +112,8 @@ describe('built-in Swarm skills', () => {const local = '- Local models: when the Swarm serves one (a member\'s model, a shared API, a model shared with a member), the route may pick it for low-difficulty, well-specified work; it costs no subscription. Set "local":true in the route only when a person asks for a local model. When a person names a model, set "model" to their words ("deepseek 4.1 flash"): the route then offers that model alone. Start the pick with the gridModel and gridName the route gives, never a model or effort.\n'const localDefault = '- Local models: the route may pick one for low-difficulty, well-specified work; set "local":true only when a person asks for one, set "model" to a model a person names, and start it with the route\'s gridModel and gridName.\n'// The approved mention line (spec/2026-10-24-lead-mentions.md, call 5), the Lead's alone, in both modes.- const mention = '- When you need a person to act or decide, tag them in the message.\n'+ // By @username or id, never email (task #2954).+ const mention = '- When you need a person to act or decide, tag them in the message by @username or id, never by email.\n'// The lost-work and checkpoint lines (Lead's brief for v1 liveness, 2026-10-26; docs: swarm-never-stops): the Lead's and// the Builder's alone, in both modes.const lost = '- When you are told a task is lost, hand it on at once: route it and assign it to another agent, avoiding what failed (another machine if its machine died, another account or engine if it hit a usage limit). The new brief tells the successor to continue from the lost attempt\'s pushed branch and last result, not to start over.\n'@@ -222,9 +223,11 @@ describe('built-in Swarm skills', () => {// Before a section that is last: after a blank line, without its own.const reactionsBefore = (role: 'lead' | 'dev' | 'review') => `\n${reactions(role).trimEnd()}\n`// Who a post reaches (project instructions, phase 1): every role, in both modes, in a section of its own right before Reactions.- const reaches = '- A post reaches only the agents you name with --to <agent id>, any agent of this project; they join the group if they are not in it.'- const whoReaches = (role: 'lead' | 'dev' | 'review') => `## Who a post reaches\n${reaches}${role === 'lead' ? ' Your post in a task that names no one reaches its assigned agent.\n'- : ` A post that names no one reaches the Lead.\n${role === 'dev' ? '- Answer your Reviewer, and tell it a fix is pushed, with --to its agent id.\n' : '- Send your verdict and findings to the Builder with --to its agent id.\n'}`}\n`+ // Task #2963 (Ken, 2026-11-04): a post that names no one no longer reaches the Lead.+ const reaches = '- A post reaches only the agents you name, with --to <agent id> or @Name in its text, any agent of this project; they join the group if they are not in it. A reply also reaches the agent whose message it answers. A post in a task or step that names no one reaches its assigned agent, and anywhere else no agent.\n'+ const status = '- The Lead hears your work through your status (done, stuck, needs a human): never post it a result, a verdict, a Ready or an acknowledgement.\n'+ const whoReaches = (role: 'lead' | 'dev' | 'review') => `## Who a post reaches\n${reaches}${role === 'lead' ? '- Agents report to you through their status; their posts reach you only when they name you.\n'+ : `${role === 'dev' ? '- Answer your Reviewer, and tell it a fix is pushed, with --to its agent id.\n' : '- Send your verdict and findings to the Builder with --to its agent id.\n'}${status}`}\n`// The Builder's 👀 replaces its "say that you took it" line, in both modes.const took = '- React 👀 to the message that assigned it and mark it working; your first post is your plan or a first result, never that you took it.\n'// The task's review plan (nightly reflection 10-30): a new bullet right after each Lead's review line, nothing replaced.@@ -243,13 +246,13 @@ describe('built-in Swarm skills', () => {expect(text, `${mode} ${role}`).not.toContain('that you took it and')}})- // Project instructions, phase 1: agents talk to each other by name; only an unnamed post goes to the Lead.+ // Project instructions, phase 1: agents talk to each other by name; since #2963 an unnamed post never goes to the Lead.it('tells every role who a post reaches, the Builder to answer its Reviewer and the Reviewer its Builder by name', () => {for (const mode of ['orchestration', 'default'] as const) for (const role of ['lead', 'dev', 'review'] as const) {const text = readFileSync(prepareSwarmSkill(fixture(), { role, key: 'session', mode }).file, 'utf8')expect(text.split('## Who a post reaches\n'), `${mode} ${role}`).toHaveLength(2)- expect(text, `${mode} ${role}`).toContain('A post reaches only the agents you name with --to <agent id>, any agent of this project')- expect(text, `${mode} ${role}`).toContain(role === 'lead' ? 'Your post in a task that names no one reaches its assigned agent.' : 'A post that names no one reaches the Lead.')+ expect(text, `${mode} ${role}`).toContain(reaches)+ expect(text, `${mode} ${role}`).not.toContain('names no one reaches the Lead')expect(text, `${mode} ${role}`).toContain(`\n\n${whoReaches(role)}## Reactions\n`)}})@@ -995,8 +998,8 @@ describe('a Buddy\'s folder', () => {// Project instructions, phase 4 (decision 1): a session is a coordinator, an agent or a Buddy. Its role file stays the// built-in text it launched with, for a Swarm with no instructions, and a row an older CLI saved relaunches onto its own.describe('role kinds keep their role files', () => {- /** The whole file a Reviewer's launch writes in each mode, byte for byte, as before role kinds. */- const REVIEW = { orchestration: '7b9273ef8d7a5f4dd7fd2133c7048aa734e29d3b3a700b5e26f46b4c04b20711', default: '594c0f21ba60582624c0a141d64bc2aa6751dbd2a0f3ed81fb1b65cd20fdde82' }+ /** The whole file a Reviewer's launch writes in each mode, byte for byte, as before role kinds (its post rules as of #2963). */+ const REVIEW = { orchestration: '4270fcbf17355c8df6a65c6977b70bcc6064c2d3210533dc99fdf3b16af5d2d9', default: '2704930e91c7861d47c95f1c19ec7383edf23220eb720bed09ab1acbe7d34034' }const folder = (workspace: string, key: string, name: string) =>join(realpathSync(workspace), '.harness', 'runtime', sha256(key), 'swarm', 'skills', name)it('keeps each session\'s role file', () => {diff --git a/cli/src/lib/swarmSkills.ts b/cli/src/lib/swarmSkills.tsindex 46faec7a3..ad10e0b53 100644--- a/cli/src/lib/swarmSkills.ts+++ b/cli/src/lib/swarmSkills.ts@@ -110,7 +110,7 @@ For large work, post the group plan and get the owner's ok before assigning; onc## 7. Run the work- When a restart interrupts active work, read the recovery notice and its last recorded checkpoint, then check the agent’s actual session and saved work. Ask it to continue from that checkpoint and report working; either you or the assigned agent can clear the recovery block. Never replay old input or commands: they may already have taken effect. A delayed recording gap after fresh progress is not a new interruption. Keep work already in review in review while you inspect the session. Ordinary typed input, an expired recording view, a missing recorded prompt, or an unclassified gap from an older recorder does not establish that work was interrupted.- Needs-human: get the person's decision now.-- When you need a person to act or decide, tag them in the message.+- When you need a person to act or decide, tag them in the message by @username or id, never by email.- Ask people for decisions in one place: decision.ask puts up to 10 questions to one person at once, each with 2 to 5 options, the one you recommend and what the answer unblocks. Keep working on your recommendation, marked provisional, until they answer: a notice in that conversation tells you, and harness super-tab decisions --answered shows the answer. A decision is not a private channel: to tell one person something directly, send person.tell; it lands in their Buddy chat, which you cannot read. Project members watching your terminal see what you send. Put nothing there you wouldn't say in the project chat.- Blocked: change something. Give more context, re-route to a stronger model, cut the work smaller, or fix the plan. Never resend the same thing to the same model.- A Builder or Reviewer blocked on a missing tool, device or sign-in: within minutes, route the task again with what was missing in its needs (fix its required machine if that is the one without it), assign it to a machine and account that has it, then stop the blocked agent unless other work fits its machine. A Mac's own account and its Team account are different: the Team account has none of the owner's tools, devices or sign-ins. If none has it, tag the requester with the choice.@@ -163,7 +163,8 @@ For large work, post the group plan and get the owner's ok before assigning; onc- When talking to people, call the roles Product Manager, Engineer and Reviewer.## Who a post reaches-- A post reaches only the agents you name with --to <agent id>, any agent of this project; they join the group if they are not in it. Your post in a task that names no one reaches its assigned agent.+- A post reaches only the agents you name, with --to <agent id> or @Name in its text, any agent of this project; they join the group if they are not in it. A reply also reaches the agent whose message it answers. A post in a task or step that names no one reaches its assigned agent, and anywhere else no agent.+- Agents report to you through their status; their posts reach you only when they name you.## Reactions- Acknowledge with a reaction instead of a post, as Slack bots do: react 👀 to a message addressed to you when you start on it; when you have done what it asked, take the 👀 back and react ✅. Use harness super-tab react GROUP MESSAGE_ID eyes|check OPERATION_ID, with --off to take one back. A reaction tells the people in the chat; your work status still tells the Swarm.@@ -299,8 +300,9 @@ Record each acceptance check with the exact command, revision and observed resul- Print little to save quota. Keep progress and blockers in the group chat.## Who a post reaches-- A post reaches only the agents you name with --to <agent id>, any agent of this project; they join the group if they are not in it. A post that names no one reaches the Lead.+- A post reaches only the agents you name, with --to <agent id> or @Name in its text, any agent of this project; they join the group if they are not in it. A reply also reaches the agent whose message it answers. A post in a task or step that names no one reaches its assigned agent, and anywhere else no agent.- Answer your Reviewer, and tell it a fix is pushed, with --to its agent id.+- The Lead hears your work through your status (done, stuck, needs a human): never post it a result, a verdict, a Ready or an acknowledgement.## Reactions- Acknowledge with a reaction instead of a post, as Slack bots do: react 👀 to a message addressed to you when you start on it; when you have done what it asked, take the 👀 back and react ✅. Use harness super-tab react GROUP MESSAGE_ID eyes|check OPERATION_ID, with --off to take one back. A reaction tells the people in the chat; your work status still tells the Swarm.@@ -376,8 +378,9 @@ Review only the changes since the revision you reviewed. Mark each finding fixedMark your review assignment done with the verdict and revision. Print little.## Who a post reaches-- A post reaches only the agents you name with --to <agent id>, any agent of this project; they join the group if they are not in it. A post that names no one reaches the Lead.+- A post reaches only the agents you name, with --to <agent id> or @Name in its text, any agent of this project; they join the group if they are not in it. A reply also reaches the agent whose message it answers. A post in a task or step that names no one reaches its assigned agent, and anywhere else no agent.- Send your verdict and findings to the Builder with --to its agent id.+- The Lead hears your work through your status (done, stuck, needs a human): never post it a result, a verdict, a Ready or an acknowledgement.## Reactions- Acknowledge with a reaction instead of a post, as Slack bots do: react 👀 to a message addressed to you when you start on it; when you have done what it asked, take the 👀 back and react ✅. Use harness super-tab react GROUP MESSAGE_ID eyes|check OPERATION_ID, with --off to take one back. A reaction tells the people in the chat; your work status still tells the Swarm.@@ -457,7 +460,7 @@ Keep each Builder's list a few tasks deep; do the easy, self-contained parts fir- Morning digest: every project has one by default, at 08:00 Vietnam time. When a person asks, move it to their local time and time zone ("project.digest" with time "08:00" and timeZone "Asia/Ho_Chi_Minh"), or turn it off with time null. When it wakes you, check that each pull request under Shipped is merged, then post one message to the people in the project chat.- When the Swarm tells you a task stalled (quiet or orphaned), act on it within minutes: nudge its agent, reassign it, or post in its chat why it waits.- Needs a person: get the decision now. Blocked: change something (context, model, size or plan); never resend the same thing.-- When you need a person to act or decide, tag them in the message.+- When you need a person to act or decide, tag them in the message by @username or id, never by email.- Ask people for decisions in one place: decision.ask puts up to 10 questions to one person at once, each with 2 to 5 options, the one you recommend and what the answer unblocks. Keep working on your recommendation, marked provisional, until they answer: a notice in that conversation tells you, and harness super-tab decisions --answered shows the answer. A decision is not a private channel: to tell one person something directly, send person.tell; it lands in their Buddy chat, which you cannot read. Project members watching your terminal see what you send. Put nothing there you wouldn't say in the project chat.- A Builder or Reviewer blocked on a missing tool, device or sign-in: within minutes, route the task again with what was missing in its needs (fix its required machine if that is the one without it), assign it to a machine and account that has it, then stop the blocked agent unless other work fits its machine. A Mac's own account and its Team account are different: the Team account has none of the owner's tools, devices or sign-ins. If none has it, tag the requester with the choice.- Settle ambiguities you can and record "Ruling: what — why — cost if wrong".@@ -485,7 +488,8 @@ When the project owner asks in chat to switch this project's skills (Default or- Answer a message where it was asked: one in the main chat right below it, with post --answers that message; one in a thread inside that thread, with post --reply-to it. Open a thread yourself only for a back-and-forth on one topic, or to answer something far up the chat. Post with neither only to start a new topic.## Who a post reaches-- A post reaches only the agents you name with --to <agent id>, any agent of this project; they join the group if they are not in it. Your post in a task that names no one reaches its assigned agent.+- A post reaches only the agents you name, with --to <agent id> or @Name in its text, any agent of this project; they join the group if they are not in it. A reply also reaches the agent whose message it answers. A post in a task or step that names no one reaches its assigned agent, and anywhere else no agent.+- Agents report to you through their status; their posts reach you only when they name you.## Reactions- Acknowledge with a reaction instead of a post, as Slack bots do: react 👀 to a message addressed to you when you start on it; when you have done what it asked, take the 👀 back and react ✅. Use harness super-tab react GROUP MESSAGE_ID eyes|check OPERATION_ID, with --off to take one back. A reaction tells the people in the chat; your work status still tells the Swarm.@@ -551,8 +555,9 @@ You finish one group's work completely, inside its brief, as if nobody will come- Write to people in their language, without commands or internal ids. Call the roles Product Manager, Engineer and Reviewer.## Who a post reaches-- A post reaches only the agents you name with --to <agent id>, any agent of this project; they join the group if they are not in it. A post that names no one reaches the Lead.+- A post reaches only the agents you name, with --to <agent id> or @Name in its text, any agent of this project; they join the group if they are not in it. A reply also reaches the agent whose message it answers. A post in a task or step that names no one reaches its assigned agent, and anywhere else no agent.- Answer your Reviewer, and tell it a fix is pushed, with --to its agent id.+- The Lead hears your work through your status (done, stuck, needs a human): never post it a result, a verdict, a Ready or an acknowledgement.## Reactions- Acknowledge with a reaction instead of a post, as Slack bots do: react 👀 to a message addressed to you when you start on it; when you have done what it asked, take the 👀 back and react ✅. Use harness super-tab react GROUP MESSAGE_ID eyes|check OPERATION_ID, with --off to take one back. A reaction tells the people in the chat; your work status still tells the Swarm.@@ -601,8 +606,9 @@ Start within 30 minutes of being asked; oldest ready work first. If you cannot,Mark your review done with the verdict and revision.## Who a post reaches-- A post reaches only the agents you name with --to <agent id>, any agent of this project; they join the group if they are not in it. A post that names no one reaches the Lead.+- A post reaches only the agents you name, with --to <agent id> or @Name in its text, any agent of this project; they join the group if they are not in it. A reply also reaches the agent whose message it answers. A post in a task or step that names no one reaches its assigned agent, and anywhere else no agent.- Send your verdict and findings to the Builder with --to its agent id.+- The Lead hears your work through your status (done, stuck, needs a human): never post it a result, a verdict, a Ready or an acknowledgement.## Reactions- Acknowledge with a reaction instead of a post, as Slack bots do: react 👀 to a message addressed to you when you start on it; when you have done what it asked, take the 👀 back and react ✅. Use harness super-tab react GROUP MESSAGE_ID eyes|check OPERATION_ID, with --off to take one back. A reaction tells the people in the chat; your work status still tells the Swarm.diff --git a/cli/src/lib/swarmTools.spec.ts b/cli/src/lib/swarmTools.spec.tsindex d1c65a74c..1f4347798 100644--- a/cli/src/lib/swarmTools.spec.ts+++ b/cli/src/lib/swarmTools.spec.ts@@ -27,6 +27,18 @@ describe('SWARM_TOOLS_SKILL', () => {it('says an agent with work in the project posts in its chat without joining it', () => {expect(SWARM_TOOLS_SKILL).toContain('In the project chat, an agent with a task or step in the project posts and reacts without joining it, and a person\'s answer to its line reaches it; `--to` there adds no agent, so name only the coordinator.')})+ // Task #2963 (Ken, 2026-11-04): 402 of 437 agent posts in a day reached the PM as their only recipient; 1 named it.+ it('says a post reaches only who it names, a reply its author, an unnamed one in a task its assignee, and the coordinator by status', () => {+ const at = SWARM_TOOLS_SKILL.indexOf('### Who a post reaches')+ const section = SWARM_TOOLS_SKILL.slice(at, SWARM_TOOLS_SKILL.indexOf('## Reactions'))+ expect(section).toContain('`@Name` in TEXT names an agent of this conversation the same way')+ expect(section).toContain('A reply (`--reply-to`) also reaches the agent who wrote the message it answers.')+ expect(section).toContain('A post that names no one reaches no agent, except in a task or step, where it reaches the agent assigned there unless that is you.')+ expect(section).toContain('The coordinator gets a post only when it is named: your status (done, needs_human, blocked) is how it hears your work')+ expect(section).not.toContain('reaches the project\'s coordinator')+ expect(section).toContain('its result says when it reached no agent.')+ expect(section).not.toContain('Nothing is dropped')+ })// Task #2901 (Ken, 2026-11-04): PMs took the route's top line against the project's Routing instructions.it('says the route ranks nothing and names no pick, and that a start gives the Routing rule that chose it', () => {expect(SWARM_TOOLS_SKILL).toContain('It ranks nothing and names no pick: the rest come by machine name, then engine')@@ -34,6 +46,13 @@ describe('SWARM_TOOLS_SKILL', () => {expect(SWARM_TOOLS_SKILL).toContain('`routeDecisionId` and `overrideReason`: the Routing rule that chose it')expect(SWARM_TOOLS_SKILL).not.toMatch(/ranks the rest|by strength, then price|choose by strength|A pick on|ranks who could/)})+ // Task #2954 (Ken, 11-04): a PM typed --mention with Ken's email and a machine's privacy hook stopped its session.+ it('says to tag people by username, display name or id, never by email', () => {+ const tagging = SWARM_TOOLS_SKILL.split('\n').filter(line => /--mention|tags? /.test(line))+ expect(tagging.join('\n')).toContain('`--mention PERSON` tags a person by the username, display name or id shown in status')+ for (const line of tagging) expect(line).not.toMatch(/by the id or email|@email/)+ expect(SWARM_TOOLS_SKILL).toContain('Never type a person\'s email: name them by username.')+ })it('describes the commands the server accepts now', () => {expect(SWARM_TOOLS_SKILL).not.toMatch(/Refused to some agents|route first|hard rules|rated 3|rule\.set|project\.skills/)for (const part of ['post GROUP', '--to AGENT', 'instructions', 'instructions.save']) expect(SWARM_TOOLS_SKILL).toContain(part)diff --git a/cli/src/lib/swarmTools.ts b/cli/src/lib/swarmTools.tsindex 61feceaab..1135c660d 100644--- a/cli/src/lib/swarmTools.ts+++ b/cli/src/lib/swarmTools.ts@@ -29,13 +29,16 @@ Every command starts \`harness super-tab --tab TAB\` (your tab id is in your lau\`post GROUP TEXT OPERATION_ID [--to AGENT]... [--answers MESSAGE_ID | --reply-to MESSAGE_ID] [--attach PATH]... [--mention PERSON]...\`- Answer a message once, where it was asked: \`--answers MESSAGE_ID\` puts your answer right below a message in the main chat; \`--reply-to MESSAGE_ID\` puts it in the thread of a message that is in one. Open a thread yourself only for a back-and-forth on one topic, or to answer something far up the chat. Post with neither only to start a new topic.- \`--attach PATH\` sends a file (a screenshot, a log; up to 10 files of 256 MB each); TEXT may then be empty.-- \`--mention PERSON\` tags a person by the id or email shown in status (up to 5), when you need them to act or decide; an @username or @email in TEXT tags too, outside code and links. Nobody is tagged who cannot read the conversation.+- \`--mention PERSON\` tags a person by the username, display name or id shown in status (up to 5), when you need them to act or decide; an @username in TEXT tags too, outside code and links. Nobody is tagged who cannot read the conversation.+- Never type a person's email: name them by username. A machine's privacy check stops a session whose command holds its owner's email until a person approves it.- Quote TEXT so the shell keeps it one argument.### Who a post reaches- \`--to AGENT\` names the agents it reaches: any agent of this project, by id from status, up to 16. Named agents are told and join the conversation if they are not in it. A post reaches exactly the agents you name, no others.-- With no \`--to\`, an agent's post reaches the project's coordinator; the coordinator's post in a task reaches the task's assigned agent. Name the agent whenever you answer one.-- Nothing is dropped: a post that names no one still goes to its default addressee.+- \`@Name\` in TEXT names an agent of this conversation the same way, when only one agent there goes by that name and no person does.+- A reply (\`--reply-to\`) also reaches the agent who wrote the message it answers.+- A post that names no one reaches no agent, except in a task or step, where it reaches the agent assigned there unless that is you. It stays readable in its conversation, and the people it tags are still told; its result says when it reached no agent.+- The coordinator gets a post only when it is named: your status (done, needs_human, blocked) is how it hears your work, so never post it a result, a verdict, a Ready or an acknowledgement.- In the project chat, an agent with a task or step in the project posts and reacts without joining it, and a person's answer to its line reaches it; \`--to\` there adds no agent, so name only the coordinator.- A post stays inside your project. Private chats and Buddy chats keep their own members.diff --git a/cli/src/superTabs/agentContext.spec.ts b/cli/src/superTabs/agentContext.spec.tsindex a0321dbf9..27991d200 100644--- a/cli/src/superTabs/agentContext.spec.ts+++ b/cli/src/superTabs/agentContext.spec.ts@@ -220,8 +220,9 @@ describe('a check with several checkers', () => {it('shows each checker\'s verdict, a failure first', () => {const group = withCheck({ evidence: 'Crashes offline\nlog', passedBy: null,verdicts: [verdict('agent:rev1', true, 'Diff reads right', 1), verdict('person:owner', false, 'Crashes offline\nlog', 2)] })- const state = swarm([group], { people: [{ id: 'owner', email: '[email protected]' }] })- expect(taskText(group, state, [], changed({}), NOW)).toContain('✗ Signs in offline — failed by [email protected]: Crashes offline; passed by Rev1')+ // A person by username, never email (task #2954).+ const state = swarm([group], { people: [{ id: 'owner', email: '[email protected]', username: 'ken15' }] })+ expect(taskText(group, state, [], changed({}), NOW)).toContain('✗ Signs in offline — failed by ken15: Crashes offline; passed by Rev1')})it('names every checker that passed it', () => {diff --git a/cli/src/superTabs/agentContext.ts b/cli/src/superTabs/agentContext.tsindex be734fe3a..e603df8c6 100644--- a/cli/src/superTabs/agentContext.ts+++ b/cli/src/superTabs/agentContext.ts@@ -5,6 +5,8 @@* readers need it. Nothing here decides workflow: when to read them is the project's instructions'.*/+import { personName } from './personName.js'+type Json = Record<string, unknown>const object = (value: unknown): Json => value && typeof value === 'object' && !Array.isArray(value) ? value as Json : {}const list = (value: unknown): Json[] => Array.isArray(value) ? value.map(object) : []@@ -155,10 +157,10 @@ export function mineText(state: Json, groupChangedAt: ReadonlyMap<string, number...line.step ? [] : [...stepsLine(state, line.id), ...linkedTo(state, groups.get(line.id)!).map(linked => ` linked: ${otherLine(linked)}`)]].join('\n')).join('\n')}-/** Who an actor key (`agent:ID` or `person:ID`) names: an agent by its name, a person by their email. */+/** Who an actor key (`agent:ID` or `person:ID`) names: an agent by its name, a person by theirs, never their email (task #2954). */function checkerName(state: Json, by: string): string {const [kind, id] = by.split(':', 2)- return (kind === 'agent' ? agentName(state, id) : text(list(state.people).find(p => p.id === id)?.email)) ?? id ?? by+ return (kind === 'agent' ? agentName(state, id) : personName(list(state.people).find(p => p.id === id))) ?? id ?? by}/** A check with each checker's latest verdict (backend checkVerdicts.ts, #2311): failed while any of them failed, eachdiff --git a/cli/src/superTabs/cards.spec.ts b/cli/src/superTabs/cards.spec.tsindex f2fdbfd77..eec2e3769 100644--- a/cli/src/superTabs/cards.spec.ts+++ b/cli/src/superTabs/cards.spec.ts@@ -1,3 +1,4 @@+import { createHash } from 'node:crypto'import { afterEach, describe, expect, it, vi } from 'vitest'import type { BackendNotice, CoreApi } from '../core/api.js'import { fakeCore } from '../testing/fakeCore.js'@@ -246,7 +247,7 @@ describe('lastAgentMessage in a chat or a thread', () => {})/** A fake backend: tabs by id with the time each last changed, a message store per conversation, and call counting. */-function setup(tabs: Record<string, { lastChangedAt: number; state: Record<string, unknown> }>, extra: { activity?: Record<string, 'working' | 'idle'>; elapsed?: number; messages?: (path: string) => unknown; post?: () => { status: number; body: Record<string, unknown> }; delayMs?: number } = {}) {+function setup(tabs: Record<string, { lastChangedAt: number; state: Record<string, unknown> }>, extra: { activity?: Record<string, 'working' | 'idle'>; elapsed?: number; messages?: (path: string) => unknown; post?: () => { status: number; body: Record<string, unknown> }; delayMs?: number; mentions?: (path: string) => unknown[] } = {}) {const calls: string[] = []// Message reads in flight now and at most, for a backend whose reads take `delayMs`.let reading = 0, mostReading = 0@@ -278,6 +279,8 @@ function setup(tabs: Record<string, { lastChangedAt: number; state: Record<strinreading++; mostReading = Math.max(mostReading, reading)try {if (extra.delayMs) await new Promise(resolve => setTimeout(resolve, extra.delayMs))+ // The reader's tags, as the backend lists them (mentions.ts listMentions).+ if (/^\/api\/super-tabs\/[^/]+\/mentions$/.test(route)) return { status: 200, body: { success: true, data: { mentions: extra.mentions?.(path) ?? [] } } }return { status: 200, body: { success: true, data: { ...(extra.messages?.(path) ?? { messages: [], next: null }) as object } } }} finally { reading-- }})@@ -792,122 +795,134 @@ const said = (sequence: number, who: string, over: Record<string, unknown> = {})const saidAt = Date.parse('2026-10-22T00:00:00.000Z') / 1000describe('SwarmCards notices', () => {- it('records a baseline on the first read and sends no notice', async () => {- const t = chatSwarm({ 'lead-web': [said(1, 'a1')], 'pm-web': [said(1, 'a1')] })- await t.cards.tick()- await t.cards.tick()- expect(t.webLead()).not.toHaveProperty('notice')+ // Diego, 2026-11-04: the dial beeped all day for PM chatter in projects that had nothing to do with him. Only a tag is a+ // notice now (SwarmCards tag notices).+ it('raises no notice for a Lead\'s message in its Lead conversation or the reader\'s Buddy chat, in a thread or not', async () => {+ const t = chatSwarm({ 'lead-web': [said(2, 'a1')], 'pm-web': [said(3, 'a1', { thread: 'r1' })] })+ await t.cards.tick()+ await t.move(2, 3)+ await t.move(3, 4)+ expect(t.seen.flat().flatMap(c => c.leads).filter(l => l.notice)).toEqual([])+ // Nor is either read for one: the face's recap is read when a dial has it open.expect(t.reads('lead-web') + t.reads('pm-web')).toBe(0)})+})- it('notices a new Lead message in the Lead conversation', async () => {- const t = chatSwarm({ 'lead-web': [said(1, 'a1'), said(2, 'a1')] })- await t.cards.tick()- await t.move(2)- expect(t.webLead()?.notice).toEqual({ chat: 'lead', chatId: 'lead-web', id: 'x2', text: 'm2', at: saidAt })- expect(t.reads('lead-web')).toBe(1)- // Nothing moved: no read and the same notice.- await t.cards.tick()- expect(t.reads('lead-web')).toBe(1)- })+/** A waiting tag of the reader's, as `/mentions?state=waiting` lists it (backend mentions.ts listMentions). */+const tag = (id: string, conversationId: string, over: Record<string, unknown> = {}) => ({ id, projectId: 'web', projectName: 'web',+ conversationId, conversationTitle: 'Fix login', messageId: `msg-${id}`, leadId: 'sam', leadName: 'Sam', text: '@me look',+ createdAt: '2026-10-22T00:00:00.000Z', resolvedAt: null, resolvedBy: null, threadId: null, messageSequence: 5, ...over })+type Tag = ReturnType<typeof tag>+/** The digest the backend gives a list of waiting tag ids (mentions.ts mentionsDigest). */+const digestOf = (ids: string[]) => createHash('sha256').update([...ids].sort().join('\n')).digest('base64url').slice(0, 16)+/** `web` with its three chats, and the reader's waiting tags behind the Swarm read's `mentionsDigest`. */+function tagSwarm(initial: Tag[] = []) {+ let waiting = initial, offline = false+ const state = (lead = 1) => ({ ...chats({ conversations: [conv('lead-web', 'a1', { projectId: 'web', lastMessageSequence: lead }),+ conv('lead-mobile', 'a2', { projectId: 'mobile' }), pm(), group()] }), mentionsDigest: digestOf(waiting.map(w => w.id)) })+ const t = setup({ t1: { lastChangedAt: 1, state: state() } }, { mentions: path => {+ expect(path).toBe('/api/super-tabs/t1/mentions?state=waiting')+ if (offline) throw new Error('offline')+ return waiting+ }, messages: () => ({ messages: [said(2, 'a1', { text: 'PM chatter' })], next: null }) })+ /** The tags waiting now; the Swarm's change time moves, as a new message moves it. */+ const tagged = async (...rows: Tag[]) => { waiting = rows; t.tabs.t1.lastChangedAt++; t.tabs.t1.state = state(); await t.cards.tick() }+ const said2 = async (lead: number) => { t.tabs.t1.lastChangedAt++; t.tabs.t1.state = state(lead); await t.cards.tick() }+ const mentionReads = () => t.calls.filter(c => c.includes('/mentions')).length+ const webLead = (cards = t.seen.at(-1)) => cards?.[0].leads.find(l => l.id === 'a1')+ return { ...t, tagged, said: said2, mentionReads, webLead, offline: (v: boolean) => { offline = v } }+}- it('notices a new private line from the Lead in the reader\'s Buddy chat', async () => {- const t = chatSwarm({ 'pm-web': [said(2, 'a1', { text: `${'p'.repeat(1499)}éé` })] })+describe('SwarmCards tag notices', () => {+ it('takes the tags waiting at the first read as the baseline, and reads nothing when none wait', async () => {+ const none = tagSwarm()+ await none.cards.tick()+ await none.cards.tick()+ expect(none.mentionReads()).toBe(0)+ const t = tagSwarm([tag('tag1', 'g-web')])await t.cards.tick()- await t.move(1, 2)- expect(t.webLead()?.notice).toEqual({ chat: 'pm', chatId: 'pm-web', id: 'x2', text: 'p'.repeat(1499), at: saidAt })- })-- it('a PM reply inside a thread is a thread notice, named by the thread\'s root', async () => {- const t = chatSwarm({ 'pm-web': [said(2, 'a1', { thread: 'r1' })] })+ expect(t.mentionReads()).toBe(1)+ expect(t.webLead()).not.toHaveProperty('notice')+ // Nothing moved: no read again.await t.cards.tick()- await t.move(1, 2)- expect(t.webLead()?.notice).toEqual({ chat: 'pm', chatId: 'pm-web', id: 'x2', text: 'm2', at: saidAt, thread: 'r1' })- })-- it('a thread reply also sent to the chat, or a thread\'s root, is no thread notice', async () => {- for (const over of [{ thread: 'r1', alsoInChat: true }, { thread: 'x2' }]) {- const t = chatSwarm({ 'pm-web': [said(2, 'a1', over)] })- await t.cards.tick()- await t.move(1, 2)- expect(t.webLead()?.notice).toEqual({ chat: 'pm', chatId: 'pm-web', id: 'x2', text: 'm2', at: saidAt })- }+ expect(t.mentionReads()).toBe(1)})- it('never notices a group message, the person\'s message or a system row', async () => {- const t = chatSwarm({- 'lead-web': [said(2, 'me', { author: { kind: 'person', id: 'me' } }), said(3, 'a1', { source: { kind: 'system' } }), said(4, 'b1')],- 'g-web': [said(2, 'b1')],- })+ it('a new tag in a task thread is its project Lead\'s notice, naming the chat and the thread', async () => {+ const t = tagSwarm([tag('tag1', 'g-web')])+ await t.cards.tick()+ await t.tagged(tag('tag2', 'g-web', { threadId: 'r1', createdAt: '2026-10-22T00:05:00.000Z' }), tag('tag1', 'g-web'))+ expect(t.webLead()?.notice).toEqual({ chat: 'group', chatId: 'g-web', id: 'tag2', text: 'Sam: @me look', at: saidAt + 300, thread: 'r1' })+ expect(t.mentionReads()).toBe(2)+ // The digest did not move: no read, the same notice.await t.cards.tick()- await t.move(4, 1, 2)+ expect(t.mentionReads()).toBe(2)+ expect(t.webLead()?.notice).toMatchObject({ id: 'tag2' })+ // tag2 read on the desktop: the digest moves, and no tag is new.+ await t.tagged(tag('tag1', 'g-web'))+ expect(t.mentionReads()).toBe(3)expect(t.webLead()).not.toHaveProperty('notice')- // Groups are never watched: their pages are not read for alerts.- expect(t.reads('g-web')).toBe(0)})- it('one notice for the newest of two messages', async () => {- const t = chatSwarm({ 'lead-web': [said(3, 'a1'), said(2, 'a1')] })+ it('names a tag in the Lead conversation `lead`, in the reader\'s Buddy chat `pm`, and the newest of two for one project', async () => {+ const t = tagSwarm()await t.cards.tick()- await t.move(3)- const notices = t.seen.map(c => t.webLead(c)?.notice?.id).filter(Boolean)- expect(notices).toEqual(['x3'])+ await t.tagged(tag('tag1', 'lead-web'))+ expect(t.webLead()?.notice).toMatchObject({ chat: 'lead', chatId: 'lead-web', id: 'tag1' })+ expect(t.webLead()?.notice).not.toHaveProperty('thread')+ await t.tagged(tag('tag1', 'lead-web'), tag('tag2', 'pm-web', { createdAt: '2026-10-22T00:01:00.000Z' }),+ tag('tag3', 'g-web', { createdAt: '2026-10-22T00:09:00.000Z' }), tag('tag4', 'lead-mobile', { projectId: 'mobile' }))+ expect(t.webLead()?.notice).toMatchObject({ chat: 'group', id: 'tag3' })+ expect(t.seen.at(-1)?.[0].leads.find(l => l.id === 'a2')?.notice).toMatchObject({ chat: 'lead', chatId: 'lead-mobile', id: 'tag4' })+ await t.tagged(tag('tag5', 'pm-web', { createdAt: '2026-10-22T00:10:00.000Z' }))+ expect(t.webLead()?.notice).toMatchObject({ chat: 'pm', chatId: 'pm-web', id: 'tag5' })})- it('takes the newer of a Lead and a PM message that land in one read', async () => {- const t = chatSwarm({ 'lead-web': [said(2, 'a1', { createdAt: '2026-10-22T00:05:00.000Z' })], 'pm-web': [said(2, 'a1', { createdAt: '2026-10-22T00:01:00.000Z' })] })+ it('a tag seen once is never a notice again, and one waiting when the devices came back is not one', async () => {+ const t = tagSwarm()await t.cards.tick()- await t.move(2, 2)- expect(t.webLead()?.notice).toMatchObject({ chat: 'lead', chatId: 'lead-web' })+ await t.tagged(tag('tag1', 'g-web'))+ expect(t.webLead()?.notice).toMatchObject({ id: 'tag1' })+ // The devices went; a tag came meanwhile; they came back: both are the new baseline.+ t.cards.want(false)+ await t.tagged(tag('tag1', 'g-web'), tag('tag2', 'g-web'))+ expect(t.webLead()).not.toHaveProperty('notice')+ await t.tagged(tag('tag1', 'g-web'), tag('tag2', 'g-web'), tag('tag3', 'lead-mobile', { projectId: 'mobile' }))+ expect(t.webLead()).not.toHaveProperty('notice')+ expect(t.seen.at(-1)?.[0].leads.find(l => l.id === 'a2')?.notice).toMatchObject({ id: 'tag3' })})- it('drops a held notice when its Swarm leaves the cards', async () => {- const t = chatSwarm({ 'lead-web': [said(2, 'a1')] })- await t.cards.tick()- await t.move(2)- expect(t.webLead()?.notice).toMatchObject({ id: 'x2' })- const gone = t.tabs.t1- delete t.tabs.t1- await t.cards.tick()- t.tabs.t1 = gone+ it('the PM\'s messages that tag nobody raise no notice and are not read for one', async () => {+ const projects = ['p0', 'p1', 'p2', 'p3', 'p4']+ const busy = (n: number) => swarm({ projects: projects.map(p => ({ id: p, name: p, leadConversationId: `lead-${p}` })),+ agents: projects.map(p => agent(`a-${p}`)), mentionsDigest: digestOf([]),+ conversations: projects.map(p => conv(`lead-${p}`, `a-${p}`, { projectId: p, lastMessageSequence: n })) })+ const t = setup({ t1: { lastChangedAt: 1, state: busy(0) } }, { messages: path => ({ messages: [said(9, `a-${/lead-(p\d)/.exec(path)?.[1]}`)], next: null }) })await t.cards.tick()- expect(t.webLead()).not.toHaveProperty('notice')+ // 20 messages: four from each project's PM.+ for (let n = 1; n <= 4; n++) { t.tabs.t1.lastChangedAt++; t.tabs.t1.state = busy(n); await t.cards.tick() }+ expect(t.seen.flat().flatMap(c => c.leads).filter(l => l.notice)).toEqual([])+ expect(t.calls.filter(c => c.includes('/messages') || c.includes('/mentions'))).toEqual([])})- it('a failed read keeps the baseline', async () => {- let fail = true- const t = chatSwarm({ 'lead-web': () => { if (fail) throw new Error('offline'); return [said(2, 'a1')] } })+ it('a failed read of the tags keeps the digest, is logged once and is read again at the next poll', async () => {+ const t = tagSwarm()await t.cards.tick()- await t.move(2)+ t.offline(true)+ await t.tagged(tag('tag1', 'g-web'))await t.cards.tick()expect(t.webLead()).not.toHaveProperty('notice')- // Logged once for the run of failures, not every 5 s.expect(t.log).toHaveBeenCalledOnce()- fail = false- await t.cards.tick()- expect(t.webLead()?.notice).toMatchObject({ chat: 'lead', id: 'x2' })- })-- it('reads a page only for a message after the baseline, and takes none from before it', async () => {- // The page still holds the Lead's older message; only the person wrote since.- const t = chatSwarm({ 'lead-web': [said(1, 'a1'), said(2, 'me', { author: { kind: 'person', id: 'me' } })] })+ t.offline(false)await t.cards.tick()- await t.move(2)- expect(t.webLead()).not.toHaveProperty('notice')+ expect(t.webLead()?.notice).toMatchObject({ id: 'tag1' })})- it('starts a fresh baseline after the devices go, and forgets a tab that leaves the cards', async () => {- const t = chatSwarm({ 'lead-web': [said(2, 'a1')] })- await t.cards.tick()- t.cards.want(false)- await t.move(2)- expect(t.webLead()).not.toHaveProperty('notice')- const gone = t.tabs.t1- delete t.tabs.t1+ it('makes no notice for a tag of a project with no Lead, and keeps going', async () => {+ const t = tagSwarm()await t.cards.tick()- t.tabs.t1 = gone- await t.move(3)- expect(t.webLead()).not.toHaveProperty('notice')+ await t.tagged(tag('tag1', 'g-gone', { projectId: 'gone' }), tag('tag2', 'g-web', { createdAt: '2026-10-21T00:00:00.000Z' }))+ expect(Object.fromEntries(t.seen.at(-1)![0].leads.map(l => [l.id, l.notice?.id]))).toEqual({ a1: 'tag2', a2: undefined })})})@@ -1132,21 +1147,29 @@ describe('leadsOf Buddies', () => {})// Diego's dial, 2026-11-03: a switch to the PM or Buddy side showed the resting pet 5-6 s before the recap, the dial's own-// read refused while the notices' and the pushes' two reads ran.+// read refused while the notices' and the pushes' two reads ran (the notices' read is the tags' since #2965).describe('SwarmCards dial recap', () => {const buddySays = [said(1, 'a1', { text: 'from the PM' }), said(2, 'y1', { text: 'from the Buddy' })]it('answers the dial\'s recap while two background reads run', async () => {- const t = chatSwarm({ 'lead-web': [said(2, 'a1', { text: 'lead says' })], 'pm-web': buddySays, 'lead-mobile': [said(1, 'a2', { text: 'mobile says' })] }, true, 50)+ let digest = digestOf([])+ const state = () => ({ ...chats({ buddies: true, agents: [...chats().agents as object[], buddy()],+ conversations: [...swarm().conversations, pm({ agentIds: ['y1'] }), group()] }), mentionsDigest: digest })+ const pages: Record<string, unknown[]> = { 'pm-web': buddySays, 'lead-mobile': [said(1, 'a2', { text: 'mobile says' })] }+ const t = setup({ t1: { lastChangedAt: 1, state: state() } }, { delayMs: 50, mentions: () => [tag('tag1', 'g-web')],+ messages: path => ({ messages: pages[/conversations\/([^/]+)\//.exec(path)?.[1] ?? ''] ?? [], next: null }) })t.cards.want(true, [], null)await vi.waitFor(() => expect(t.seen).toHaveLength(1))t.cards.open('s1', 't1', 'a1', 'buddy')- // The Lead spoke: the poll reads its conversation for the notice.- const polled = t.move(2)- await vi.waitFor(() => expect(t.reads('lead-web')).toBe(1), { interval: 1 })+ // Someone tagged the reader: the poll reads the tags.+ digest = digestOf(['tag1'])+ t.tabs.t1.lastChangedAt+++ t.tabs.t1.state = state()+ const polled = t.cards.tick()+ await vi.waitFor(() => expect(t.calls.filter(c => c.includes('/mentions'))).toHaveLength(1), { interval: 1 })// The dial swiped: the push of its new face reads the Buddy chat.t.cards.side('t1', 'buddy')- await vi.waitFor(() => expect(t.reads('pm-web')).toBe(1), { interval: 1 })+ await vi.waitFor(() => expect(t.calls.filter(c => c.includes('/conversations/pm-web/messages'))).toHaveLength(1), { interval: 1 })await expect(t.cards.recap('t1', 'a2', 'buddy')).resolves.toMatchObject({ text: 'mobile says', none: false, chatId: 'lead-mobile' })await polledt.cards.want(false)@@ -1187,16 +1210,13 @@ describe('SwarmCards dial recap', () => {t.cards.want(false)})- it('answers from the Lead\'s notice for that chat before any recap was read, without waiting on a read', async () => {- let offline = false- const t = chatSwarm({ 'lead-web': () => { if (offline) throw new Error('offline'); return [said(2, 'a1', { text: 'lead says' })] } })+ it('answers the face\'s recap from its chat, never from a tag notice of that chat', async () => {+ const t = tagSwarm()t.cards.want(true, [], null)await vi.waitFor(() => expect(t.seen).toHaveLength(1))- await t.move(2)- expect(t.webLead()?.notice).toMatchObject({ text: 'lead says', chatId: 'lead-web' })- // The read after the answer fails: the answer did not wait on it.- offline = true- expect(await t.cards.recap('t1', 'a1', true)).toMatchObject({ text: 'lead says', chatId: 'lead-web', none: false })+ await t.tagged(tag('tag1', 'lead-web', { text: '@me look here' }))+ expect(t.webLead()?.notice).toMatchObject({ chatId: 'lead-web', text: 'Sam: @me look here' })+ expect(await t.cards.recap('t1', 'a1', true)).toMatchObject({ text: 'PM chatter', chatId: 'lead-web', none: false })t.cards.want(false)})@@ -1273,12 +1293,11 @@ describe('SwarmCards chat recap and threads', () => {t.cards.want(false)})- it('never answers the chat recap from a notice that is a thread reply', async () => {+ it('never answers the chat recap from a thread reply', async () => {const t = chatSwarm({ 'lead-web': [said(1, 'a1', { text: 'top', thread: 'x1' }), said(2, 'a1', { text: 'in the thread', thread: 'x1' })] })t.cards.want(true, [], null)await vi.waitFor(() => expect(t.seen).toHaveLength(1))await t.move(2)- expect(t.webLead()?.notice).toMatchObject({ text: 'in the thread' })expect(await t.cards.recap('t1', 'a1', true)).toMatchObject({ text: 'top', chatId: 'lead-web' })t.cards.want(false)})@@ -1874,11 +1893,12 @@ describe('SwarmCards Buddy notices', () => {expect(mine.webLead()).not.toHaveProperty('buddyNotice')})- it('keeps the PM\'s private line as the Lead\'s notice when the Buddy speaks after it', async () => {+ it('takes the Buddy\'s word after the PM\'s private line as its quiet notice, and the PM\'s line as none', async () => {const t = chatSwarm({ 'pm-web': [said(2, 'a1', { text: 'from the PM' }), said(3, 'y1', { text: 'from the Buddy' })] }, true)await t.cards.tick()await t.move(1, 3)- expect(t.webLead()).toMatchObject({ notice: { chat: 'pm', id: 'x2' }, buddyNotice: { chat: 'buddy', id: 'x3' } })+ expect(t.webLead()).toMatchObject({ buddyNotice: { chat: 'buddy', id: 'x3' } })+ expect(t.webLead()).not.toHaveProperty('notice')})it('raises no buddy notice while Buddies are off, or from another person\'s Buddy chat', async () => {diff --git a/cli/src/superTabs/cards.ts b/cli/src/superTabs/cards.tsindex 1f4c68e5f..2c8beadd4 100644--- a/cli/src/superTabs/cards.ts+++ b/cli/src/superTabs/cards.ts@@ -13,11 +13,11 @@* A paused Swarm keeps its card and every Lead reads `done`.** For the round dial (design 2026-10-28-round-dial-swarm-chat) every Lead also carries the chat on its project's face (`chat`):- * the Lead conversation, or the reader's Buddy chat or group the window has open (`want`'s focus); and the newest message- * the Lead wrote in its Lead conversation or the reader's Buddy chat since the baseline (`notice`), the dial's one alert. `state` keeps- * its meaning for the Pro and older dials, which never read either.+ * the Lead conversation, or the reader's Buddy chat or group the window has open (`want`'s focus); and the newest tag of the+ * reader's in its project since the baseline (`notice`), the dial's one alert: PM messages that tag nobody never alert (Diego,+ * #2965). `state` keeps its meaning for the Pro and older dials, which never read either.*/-import { randomUUID } from 'node:crypto'+import { createHash, randomUUID } from 'node:crypto'import type { BackendNotice, CoreApi } from '../core/api.js'import { backend, SuperTabHostError } from './host.js'import { identifier, object, within } from './wire.js'@@ -30,6 +30,10 @@ import type { CardChat, CardFocus, CardSide, ChatKind, LeadNotice, LeadRecap, Leexport type { CardChat, CardFocus, CardSide, LeadNotice, LeadRecap, LeadState, SaidOnCard, SayOptions, SwarmBuddy, SwarmCard, SwarmChat, SwarmLead } from '../core/api.js'const MAX_CARDS = 16, MAX_LEADS = 12, NAME_BYTES = 48, RECAP_BYTES = 1500, MAX_LIST_PAGES = 10, MAX_RECAPS_IN_FLIGHT = 2+/** The tag ids kept per Swarm as seen: the server lists at most 500 of a person's tags there (backend mentions.ts tagRows). */+const MAX_TAGS_SEEN = 500+/** The digest of no waiting tags (backend mentions.ts mentionsDigest([])): a Swarm at it has none to read. */+const NO_TAGS = createHash('sha256').update('').digest('base64url').slice(0, 16)/** The longest a dial's recap read waits on the one before it. */const ASK_WAIT_MS = 10_000/** A failed read of a dial thread's first message is tried again after this, doubling, at most ROOT_READ_TRIES times in all. */@@ -302,8 +306,11 @@ export class SwarmCards {private pushing: Promise<void> = Promise.resolve()/** The alert baseline: per watched conversation (`${tab}:${conversation}`), the last sequence whose messages were seen. */private seen = new Map<string, number>()- /** Each Lead's newest notice (`${tab}:${lead}`), carried on its card. */+ /** Each Lead's newest notice (`${tab}:${lead}`), a tag of the reader's in its project, carried on its card. */private notices = new Map<string, LeadNotice>()+ /** The tags baseline: per Swarm, the mentions digest last read, and the ids of the tags seen waiting since the baseline. */+ private tagDigests = new Map<string, string>()+ private tagsSeen = new Map<string, string[]>()/** Each Lead's newest quiet notice from the reader's Buddy (`${tab}:${lead}`): apart, so it never hides the Lead's. */private buddyNotices = new Map<string, LeadNotice>()/** The side a swarmBuddy dial swiped to, per Swarm; cleared by the window's next focus change (the newest wins). */@@ -604,13 +611,13 @@ export class SwarmCards {}/**- * The dial's alerts (design 2026-10-28 §2): each project's Lead conversation and the reader's Buddy chat, by the `lastMessageSequence`- * the tab reads already carry. A conversation first seen sets the baseline and is not read; one that moved past it has its- * newest page read once, under the recaps' limit, and the newest message its Lead wrote after the baseline becomes the- * Lead's notice. Two messages between two reads make one notice, for the newest. The baseline moves only after a read- * that worked, so a failed one is tried again at the next poll. Groups are never watched, nor another person's Buddy chat.- * While Buddies are on, the same read of the Buddy chat gives the newest message of the reader's Buddy as the Lead's- * quiet notice (spec 2026-10-29 Alerts), kept apart from its notice.+ * The dial's alerts (design 2026-10-28 §2, task #2965): each project's Lead holds the newest tag of the reader's in that project+ * (watchTags), and while Buddies are on the reader's Buddy chat gives the newest message of the reader's Buddy as the Lead's+ * quiet notice (spec 2026-10-29 Alerts), kept apart from its notice. A Buddy chat first seen sets the baseline and is not+ * read; one that moved past it, by the `lastMessageSequence` the tab reads already carry, has its newest page read once,+ * under the recaps' limit. The baseline moves only after a read that worked, so a failed one is tried again at the next+ * poll. The PM's own messages are no alert, in its Lead conversation or the reader's Buddy chat: they beeped all day for+ * chatter in projects that had nothing to do with the reader (Diego, 2026-11-04). Another person's Buddy chat is never read.*/private async watchNotices(): Promise<void> {const watched = new Set<string>()@@ -620,68 +627,102 @@ export class SwarmCards {// The reader's one Swarm Buddy chat is every project's Buddy: read once per poll (its key is the chat's), and its newest// word is the quiet notice of each Lead alike. A project's own Buddy chat (older Swarms) is that project's alone.const swarmChat = buddies ? conversations.find(c => isSwarmBuddyChat(c) && isReadersBuddyChat(c, this.me) && c.archived !== true && cardId(c.id)) : undefined- if (swarmChat && typeof swarmChat.lastMessageSequence === 'number') {- const key = `${tabId}:${swarmChat.id}`, sequence = swarmChat.lastMessageSequence, baseline = this.seen.get(key)+ const chats: Array<{ conversation: Json; leadIds: string[] }> = [...swarmChat ? [{ conversation: swarmChat, leadIds: projects.map(p => p.leadId) }] : [],+ ...buddies ? projects.flatMap(({ project, leadId }) => conversations.filter(c => !isSwarmBuddyChat(c) && inProject(c, projectKey(project))+ && isReadersBuddyChat(c, this.me) && c.archived !== true && cardId(c.id)).map(conversation => ({ conversation, leadIds: [leadId] }))) : []]+ for (const { conversation, leadIds } of chats) {+ if (typeof conversation.lastMessageSequence !== 'number') continue+ const key = `${tabId}:${conversation.id}`, sequence = conversation.lastMessageSequence, baseline = this.seen.get(key)watched.add(key)- if (baseline === undefined) this.seen.set(key, sequence)- else if (sequence > baseline && this.recapsRunning < MAX_RECAPS_IN_FLIGHT) {- this.recapsRunning++- try {- const page = object(await backend(this.core, 'GET', `/api/super-tabs/${tabId}/conversations/${swarmChat.id}/messages`))- const after = list(page.messages).filter(m => typeof m.sequence === 'number' && m.sequence > baseline)- const voices = new Set(buddiesIn(agents, swarmChat, this.me).map(a => a.id as string))- for (const { leadId } of projects) this.raise(this.buddyNotices, recapKey(tabId, leadId), 'buddy', swarmChat.id as string, after, voices)- this.seen.set(key, sequence)- this.failed.delete(key)- } catch (error) {- if (!this.failed.has(key)) {- this.failed.add(key)- this.log(`[super-tabs] the Buddy's new message could not be read for the dial; tried again at the next poll: ${error instanceof Error ? error.message : String(error)}`)- }- } finally { this.recapsRunning-- }- }- }- for (const { project, lead, leadId } of projects) {- const projectId = projectKey(project)- const chats: Array<{ conversation: Json; chat: 'lead' | 'pm' }> = [{ conversation: lead, chat: 'lead' },- ...conversations.filter(c => !isSwarmBuddyChat(c) && inProject(c, projectId) && isReadersBuddyChat(c, this.me) && c.archived !== true).map(conversation => ({ conversation, chat: 'pm' as const }))]- for (const { conversation, chat } of chats) {- if (!cardId(conversation.id) || typeof conversation.lastMessageSequence !== 'number') continue- const key = `${tabId}:${conversation.id}`, sequence = conversation.lastMessageSequence- watched.add(key)- const baseline = this.seen.get(key)- if (baseline === undefined) { this.seen.set(key, sequence); continue }- if (sequence <= baseline || this.recapsRunning >= MAX_RECAPS_IN_FLIGHT) continue- this.recapsRunning++- try {- const page = object(await backend(this.core, 'GET', `/api/super-tabs/${tabId}/conversations/${conversation.id}/messages`))- const after = list(page.messages).filter(m => typeof m.sequence === 'number' && m.sequence > baseline)- this.raise(this.notices, recapKey(tabId, leadId), chat, conversation.id, after, new Set([leadId]))- if (chat === 'pm' && buddies) {- const voices = new Set(buddiesIn(agents, conversation, this.me).map(a => a.id as string))- this.raise(this.buddyNotices, recapKey(tabId, leadId), 'buddy', conversation.id, after, voices)- }- this.seen.set(key, sequence)- this.failed.delete(key)- } catch (error) {- if (!this.failed.has(key)) {- this.failed.add(key)- this.log(`[super-tabs] a Lead's new message could not be read for the dial; tried again at the next poll: ${error instanceof Error ? error.message : String(error)}`)- }- } finally { this.recapsRunning-- }- }+ if (baseline === undefined) { this.seen.set(key, sequence); continue }+ if (sequence <= baseline || this.recapsRunning >= MAX_RECAPS_IN_FLIGHT) continue+ this.recapsRunning+++ try {+ const page = object(await backend(this.core, 'GET', `/api/super-tabs/${tabId}/conversations/${conversation.id}/messages`))+ const after = list(page.messages).filter(m => typeof m.sequence === 'number' && m.sequence > baseline)+ const voices = new Set(buddiesIn(agents, conversation, this.me).map(a => a.id as string))+ for (const leadId of leadIds) this.raise(this.buddyNotices, recapKey(tabId, leadId), 'buddy', conversation.id as string, after, voices)+ this.seen.set(key, sequence)+ this.failed.delete(key)+ } catch (error) {+ if (!this.failed.has(key)) {+ this.failed.add(key)+ this.log(`[super-tabs] the Buddy's new message could not be read for the dial; tried again at the next poll: ${error instanceof Error ? error.message : String(error)}`)+ }+ } finally { this.recapsRunning-- }}+ watched.add(`${tabId}:mentions`)+ await this.watchTags(tabId, state, projects)}// A Swarm or project that left the cards takes its baseline and notices with it.for (const key of [...this.seen.keys()]) if (!watched.has(key)) this.seen.delete(key)for (const key of [...this.failed]) if (!watched.has(key)) this.failed.delete(key)- for (const held of [this.notices, this.buddyNotices]) {- for (const [key, notice] of held) if (!watched.has(`${key.slice(0, key.indexOf(':'))}:${notice.chatId}`)) held.delete(key)+ for (const [key, notice] of this.buddyNotices) if (!watched.has(`${key.slice(0, key.indexOf(':'))}:${notice.chatId}`)) this.buddyNotices.delete(key)+ for (const tabId of [...this.tagDigests.keys()]) if (!this.tabs.has(tabId)) { this.tagDigests.delete(tabId); this.tagsSeen.delete(tabId) }+ for (const key of [...this.notices.keys()]) {+ const [tabId, leadId] = key.split(':'), state = this.tabs.get(tabId)?.state+ if (!state || !leadProjects(state).some(p => p.leadId === leadId)) this.notices.delete(key)+ }+ }++ /**+ * The reader's waiting tags in a Swarm, read only when its mentions digest (each Swarm read's `mentionsDigest`) moved, never+ * on a timer. The first digest seen is the baseline: the tags waiting then were there before the dial came, and never alert;+ * at the digest of none there is nothing to read. After it, a tag id not seen before is new, and the newest new tag of a+ * project is its Lead's notice, naming the tag's chat and, for a thread reply, its thread. A tag seen once is never new again;+ * one read or marked done stops waiting, so it never comes back, and the Lead's notice for it goes. A Swarm read from a+ * backend without the digest raises none. A failed read keeps the digest, so the next poll reads again.+ */+ private async watchTags(tabId: string, state: Json, projects: Array<{ project: Json; lead: Json; leadId: string }>): Promise<void> {+ const digest = state.mentionsDigest, seen = this.tagsSeen.get(tabId)+ if (typeof digest !== 'string' || this.tagDigests.get(tabId) === digest) return+ if (seen === undefined && digest === NO_TAGS) { this.tagDigests.set(tabId, digest); this.tagsSeen.set(tabId, []); return }+ if (this.recapsRunning >= MAX_RECAPS_IN_FLIGHT) return+ const key = `${tabId}:mentions`+ this.recapsRunning+++ try {+ const rows = list(object(await backend(this.core, 'GET', `/api/super-tabs/${tabId}/mentions?state=waiting`)).mentions).filter(r => cardId(r.id))+ const waiting = new Set(rows.map(r => r.id as string))+ if (seen) {+ const known = new Set(seen)+ this.raiseTags(tabId, state, projects, rows.filter(r => !known.has(r.id as string)))+ }+ for (const { leadId } of projects) if (this.notices.has(recapKey(tabId, leadId)) && !waiting.has(this.notices.get(recapKey(tabId, leadId))!.id)) this.notices.delete(recapKey(tabId, leadId))+ this.tagsSeen.set(tabId, [...(seen ?? []).filter(id => !waiting.has(id)), ...waiting].slice(-MAX_TAGS_SEEN))+ this.tagDigests.set(tabId, digest)+ this.failed.delete(key)+ } catch (error) {+ if (!this.failed.has(key)) {+ this.failed.add(key)+ this.log(`[super-tabs] the tags waiting for you could not be read for the dial; tried again at the next poll: ${error instanceof Error ? error.message : String(error)}`)+ }+ } finally { this.recapsRunning-- }+ }++ /** New tags (`rows`, as `/mentions` lists them) as their project Lead's notice: the newest of each project, unless the one+ * held is newer. Its chat is `lead` in the project's Lead conversation, `pm` in the reader's Buddy chat or a Chat with PM,+ * and `group` elsewhere (a task chat); its text names who tagged. A tag of a project with no Lead makes none. */+ private raiseTags(tabId: string, state: Json, projects: Array<{ project: Json; lead: Json; leadId: string }>, rows: Json[]): void {+ const conversations = list(state.conversations)+ for (const row of rows) {+ const found = projects.find(p => projectKey(p.project) === row.projectId)+ if (!found || !cardId(row.conversationId) || typeof row.text !== 'string') continue+ const conversation = conversations.find(c => c.id === row.conversationId)+ const chat: LeadNotice['chat'] = row.conversationId === found.lead.id ? 'lead'+ : conversation && (isBuddyChat(conversation) || isChatWithPm(conversation)) ? 'pm' : 'group'+ const stamp = Date.parse(String(row.createdAt))+ const at = Number.isFinite(stamp) ? Math.floor(stamp / 1000) : 0+ const who = typeof row.leadName === 'string' && row.leadName ? `${row.leadName}: ` : ''+ const notice: LeadNotice = { chat, chatId: row.conversationId, id: row.id as string, text: cut(`${who}${row.text}`, RECAP_BYTES), at,+ ...(identifier(row.threadId) ? { thread: row.threadId } : {}) }+ const held = this.notices.get(recapKey(tabId, found.leadId))+ if (held && held.at > notice.at) continue+ this.notices.set(recapKey(tabId, found.leadId), notice)}}/** The newest message `voices` said in `messages` becomes the held notice at `key`, unless one held is newer; with its- * thread when it replies in one only. Since tasks live in threads (#2704) the PM answers there, and a notice that read+ * thread when it replies in one only. Since tasks live in threads (#2704) agents answer there, and a notice that read* as its chat's was read by opening the chat while the reply sat collapsed in its thread (Diego, 2026-10-29). */private raise(held: Map<string, LeadNotice>, key: string, chat: LeadNotice['chat'], chatId: string, messages: Json[], voices: ReadonlySet<string>): void {const said = lastAgentMessage(messages, voices)@@ -692,7 +733,7 @@ export class SwarmCards {held.set(key, notice)}- private forgetNotices(): void { this.notices.clear(); this.buddyNotices.clear(); this.failed.clear() }+ private forgetNotices(): void { this.notices.clear(); this.buddyNotices.clear(); this.tagDigests.clear(); this.tagsSeen.clear(); this.failed.clear() }/** Which of the Leads that run here are in a turn, and since when (the core's windows' own measure of "working"). */private async turnsHere(): Promise<Map<string, { inTurn: boolean; since?: number }>> {@@ -742,7 +783,7 @@ export class SwarmCards {/** What the Lead last said: the newest page of its conversation, then one page back; `none` when neither holds a row of its own.* With `chat`, what the chat on its face last heard from its agents, naming that chat. The dial's own read: never refused,- * and answered at once from the recap held for that chat or the notice from it, read again after when the chat moved on. */+ * and answered at once from the recap held for that chat or the Buddy's notice from it, read again after when the chat moved on. */async recap(tabId: string, leadId: string, chat: CardChat = false): Promise<LeadRecap> {if (!cardId(tabId) || !cardId(leadId)) return { tabId, leadId, text: '', at: 0, none: true }const quick = this.held(tabId, leadId, chat)@@ -762,14 +803,15 @@ export class SwarmCards {return run}- /** What can be answered for the chat on the face with no read: the recap held for it, or the newer notice from it, with the- * sequence it was read at (-1 for a notice); `stale` when the chat has moved on since, so it is read again. */+ /** What can be answered for the chat on the face with no read: the recap held for it, or on a Buddy face the newer quiet+ * notice from it, with the sequence it was read at (-1 for a notice); `stale` when the chat has moved on since, so it is+ * read again. A tag is not the chat's recap: whoever tagged may be no voice of it. */private held(tabId: string, leadId: string, chat: CardChat): { recap: LeadRecap; sequence: number; stale: boolean } | null {const found = this.target(tabId, leadId, chat)if (!found) return nullconst kept = this.recaps.get(cachedKey(tabId, leadId, found, chat))// A notice is of the chat, never of a thread on the face.- const notice = found.thread === undefined ? (found.buddy ? this.buddyNotices : this.notices).get(recapKey(tabId, leadId)) : undefined+ const notice = found.thread === undefined && found.buddy ? this.buddyNotices.get(recapKey(tabId, leadId)) : undefinedconst heard = notice && notice.chatId === found.id && notice.thread === undefined ? notice : undefinedif (kept && (!heard || heard.at <= kept.recap.at)) return { recap: kept.recap, sequence: kept.sequence, stale: kept.sequence !== found.sequence }if (!heard) return nulldiff --git a/cli/src/superTabs/command.spec.ts b/cli/src/superTabs/command.spec.tsindex 800023a18..ab83306a7 100644--- a/cli/src/superTabs/command.spec.ts+++ b/cli/src/superTabs/command.spec.ts@@ -569,7 +569,7 @@ it('refuses to set a machine\'s agents for an agent: a Swarm agent\'s pane, an o}expect(request.mock.calls.some(c => c[0] === 'super_tabs')).toBe(false)})-// Project instructions, phase 1: an agent names the agents a post reaches; with none it reaches the PM.+// Project instructions, phase 1: an agent names the agents a post reaches (task #2963: with none, the server reaches no PM).it('passes each --to as a recipient, at most 16, and keeps a post without one unnamed', () => {expect(parseSuperTabArgs([...prefix, 'post', 'g1', 'Ready', 'op-1', '--to', 'a1', '--to', 'a2', '--to', 'a1'], where).payload.command).toMatchObject({ type: 'message.send', conversationId: 'g1', recipientIds: ['a1', 'a2'] })diff --git a/cli/src/superTabs/command.ts b/cli/src/superTabs/command.tsindex 400885091..900e1a1bc 100644--- a/cli/src/superTabs/command.ts+++ b/cli/src/superTabs/command.ts@@ -213,10 +213,10 @@ export function parseSuperTabArgs(argv: readonly string[], where: Where, stdin:if (flag === '--reply-to' && identifier(value) && replyTo === null && answers === null) replyTo = value// The answer right below a message, in the main flow (task #2929); a reply to it goes in its thread.else if (flag === '--answers' && identifier(value) && answers === null && replyTo === null) answers = value- // The agents it reaches, any agent of this project; with none, an agent's post reaches the PM (project instructions).+ // The agents it reaches, any agent of this project; the server adds @Name, a reply's author and a task's assignee (#2963).else if (flag === '--to' && identifier(value) && (to.includes(value) || to.length < 16)) { if (!to.includes(value)) to.push(value) }else if (flag === '--attach' && value && attach.length < 10) attach.push(resolve(value))- // A person's id or email, as written; the service maps it to the person (spec 2026-10-24-lead-mentions).+ // A person's id, username or display name (an email from older callers), as written; the service maps it (task #2954).else if (flag === '--mention' && value?.trim()) mentions.push(value.trim())else throw usageError()}diff --git a/cli/src/superTabs/deliveryContext.spec.ts b/cli/src/superTabs/deliveryContext.spec.tsindex 6d9962530..826d41a74 100644--- a/cli/src/superTabs/deliveryContext.spec.ts+++ b/cli/src/superTabs/deliveryContext.spec.ts@@ -3,7 +3,7 @@ import { placeLine, threadLine, workLine } from './deliveryContext.js'const state = {projects: [{ id: 'app', name: 'App', leadConversationId: 'lead-app' }],- people: [{ id: 'ken', email: '[email protected]' }],+ people: [{ id: 'ken', email: '[email protected]', username: 'ken15' }] as Array<Record<string, unknown>>,agents: [{ id: 'pm', name: 'PM' }, { id: 'dev1', name: 'Dev1' }, { id: 'buddy', name: 'Ken\'s Buddy', buddyOf: { personId: 'ken' } }],conversations: [{ id: 'lead-app', projectId: 'app', title: 'App', leadId: 'pm', agentIds: ['pm'], archived: false, assignment: null },@@ -22,8 +22,11 @@ describe('placeLine', () => {it('names the project chat', () => {expect(placeLine(state, 'lead-app')).toBe('In the project chat of App (conversation lead-app).')})+ // By the name the Swarm shows them, never their email (task #2954).it('names a Buddy chat by its person', () => {- expect(placeLine(state, 'chat')).toBe('In [email protected]\'s Buddy chat (conversation chat).')+ expect(placeLine(state, 'chat')).toBe('In ken15\'s Buddy chat (conversation chat).')+ const named = { ...state, people: state.people.map(p => ({ ...p, name: 'Ken' })) }+ expect(placeLine(named, 'chat')).toBe('In Ken\'s Buddy chat (conversation chat).')})it('gives the id alone when it does not know the conversation', () => {expect(placeLine(state, 'gone')).toBe('In conversation gone.')diff --git a/cli/src/superTabs/deliveryContext.ts b/cli/src/superTabs/deliveryContext.tsindex 0b0ca297c..8c68188b0 100644--- a/cli/src/superTabs/deliveryContext.ts+++ b/cli/src/superTabs/deliveryContext.ts@@ -5,6 +5,7 @@* thread. Each line is left out when it does not apply or cannot be read; the delivery always goes.*/import { isCoordinator, isStep, openWorkOf, projectOpenWork, stepName } from './agentContext.js'+import { personName } from './personName.js'type Json = Record<string, unknown>const object = (value: unknown): Json => value && typeof value === 'object' && !Array.isArray(value) ? value as Json : {}@@ -23,7 +24,9 @@ export function placeLine(state: Json, groupId: string): string {if (group.kind === 'buddy' || group.kind === 'swarm-buddy') {const buddy = list(state.agents).find(a => Array.isArray(group.agentIds) && group.agentIds.includes(a.id) && object(a.buddyOf).personId)const person = buddy ? list(state.people).find(p => p.id === object(buddy.buddyOf).personId) : undefined- return person ? `In ${String(person.email)}'s Buddy chat ${at}` : `In a Buddy chat ${at}`+ // By name, never email (task #2954).+ const name = personName(person)+ return name ? `In ${name}'s Buddy chat ${at}` : `In a Buddy chat ${at}`}const title = JSON.stringify(String(group.title ?? ''))// A step is said as its task and its name (task steps design).diff --git a/cli/src/superTabs/fixtures/read/index.ts b/cli/src/superTabs/fixtures/read/index.tsindex 317d2083d..f5aa457f6 100644--- a/cli/src/superTabs/fixtures/read/index.ts+++ b/cli/src/superTabs/fixtures/read/index.ts@@ -45,13 +45,13 @@ export function hostForm(rows: unknown, options: { tabs?: string[]; pools?: unknexport function partsOf(state: Json, options: { githubApp?: boolean; lastChangedAt?: number } = {}): Json {const v = ++versionconst part = (key: unknown, data: Json) => ({ key: String(key), version: v, changedAt: v, data })- const { people, agents, conversations, machines, starts, otherProjectsWork, mentionsWaiting, teamAccounts, ...head } = state+ const { people, agents, conversations, machines, starts, otherProjectsWork, mentionsWaiting, mentionsDigest, teamAccounts, ...head } = statereturn { format: 2, tabId: String(state.id ?? 'tab'), cursor: `tab-${v}`, serverTime: v, lastChangedAt: options.lastChangedAt ?? v, epoch: 1,...(options.githubApp ? { githubApp: true } : {}),head: part('head', head), members: asList(people).map(p => part(p.id, p)), agents: asList(agents).map(a => part(a.id, a)),groups: asList(conversations).map((c, i) => part(c.id ?? `group-${i}`, c)), machines: asList(machines).map(m => part(m.machineId, m)),starts: asList(starts).map(s => part(s.id, s)), progress: [],- derived: { ...(otherProjectsWork !== undefined ? { otherProjectsWork } : {}), ...(mentionsWaiting !== undefined ? { mentionsWaiting } : {}),+ derived: { ...(otherProjectsWork !== undefined ? { otherProjectsWork } : {}), ...(mentionsWaiting !== undefined ? { mentionsWaiting } : {}), ...(mentionsDigest !== undefined ? { mentionsDigest } : {}),...(teamAccounts === false ? { teamAccounts } : {}) } }}diff --git a/cli/src/superTabs/host.spec.ts b/cli/src/superTabs/host.spec.tsindex b6b15e1c8..667e19aec 100644--- a/cli/src/superTabs/host.spec.ts+++ b/cli/src/superTabs/host.spec.ts@@ -891,13 +891,27 @@ describe('Super Tab native delivery handoff', () => {const t = setup({ author: { kind: 'person', id: 'p1', name: '[email protected]' }, text: 'How is it going?' })await t.open().tick()const prompt = vi.mocked(t.core.turns.deliver).mock.calls[0]![1] as string- expect(prompt).toContain('Message message from [email protected]:\nHow is it going?')+ expect(prompt).toContain('Message message from sam:\nHow is it going?')expect(prompt).toContain("post 'lead' 'your message' UNIQUE_OPERATION_ID --answers 'message'")expect(prompt).toContain('Ask questions and post results in this conversation.')expect(prompt).toContain('Answer each message once')expect(prompt).not.toContain('email addresses')expect(prompt).not.toContain('Report exact revisions')})+ // Task #2954 (Ken, 11-04): agents copied an author's email into commands and pull requests until a machine's privacy hook+ // stopped their sessions. A person is named by the name the server gives, and an older server's email never shows.+ it('names a person by the name the server gives, and never by email', async () => {+ const named = setup({ author: { kind: 'person', id: 'p1', name: 'sam', displayName: 'Sam Lee' }, text: 'Ship it?' })+ await named.open().tick()+ expect(vi.mocked(named.core.turns.deliver).mock.calls[0]![1]).toContain('Message message from Sam Lee:\nShip it?')+ const older = setup({ author: { kind: 'person', id: 'p1', name: '[email protected]' }, text: 'Ship it?',+ source: { kind: 'native', phase: 'input', operator: { kind: 'person', id: 'p2', name: '[email protected]' } } })+ await older.open().tick()+ const prompt = vi.mocked(older.core.turns.deliver).mock.calls[0]![1] as string+ expect(prompt).toContain('opened by kim.')+ expect(prompt).toContain('Message message from sam:\nShip it?')+ expect(prompt).not.toContain('@example.com')+ })// Answers go right below, not in a thread (anh Dee, 2026-11-04; task #2929): a top-level message is answered below it, a// thread reply in its thread, and a Buddy session's thread stays its own.it('tells the agent to answer a top-level message right below it, and a thread reply in its thread', async () => {@@ -1018,6 +1032,15 @@ describe('Super Tab native delivery handoff', () => {expect(prompt).toContain('In a thread Ken started')expect(reads.filter(id => id === 'root')).toHaveLength(1)})+ it('names a thread\'s people by name, never by email (task #2954)', async () => {+ const root = { ...ROOT, author: { kind: 'person', id: 'ken', name: '[email protected]' } }+ const { t } = wired({ thread: 'root', replyTo: 'root' }, { root: page([root], [{ id: 'root', replies: 3,+ authors: [{ kind: 'person', id: 'dee', name: '[email protected]' }, { kind: 'person', id: 'sam', name: 'sam', displayName: 'Sam Lee' }] }]) })+ const prompt = await delivered(t)+ expect(prompt).toContain('In a thread ken started (2026-11-02 09:15 UTC): "Should we ship today?" — 3 replies so far, from dee, Sam Lee.')+ expect(prompt).toContain('Replying to ken (2026-11-02 09:15 UTC):')+ expect(prompt).not.toContain('@example.com')+ })it('a thread\'s only reply has no thread line', async () => {const { t } = wired({ thread: 'root', replyTo: 'root' }, { root: page([ROOT], [{ id: 'root', replies: 1, authors: [{ name: 'Collaborator' }] }]) })expect(await delivered(t)).not.toContain('In a thread')@@ -1565,13 +1588,14 @@ describe('the super-tab command in delivered input', () => {return String(vi.mocked(t.core.turns.deliver).mock.calls[0]?.[1])}// anh Dee, task #2926: a Buddy's proposal is its owner's own message; its goal, scope and priority ride in its source for the PM.+ // Named, never by email (task #2954).it('hands the PM a proposal\'s goal, scope and priority after its owner\'s words', async () => {const author = { kind: 'person', id: 'peer', name: '[email protected]' }const source = { kind: 'buddy-proposal', personId: 'peer', buddyId: 'buddy', goal: 'Desktop keeps drafts offline', scope: 'Desktop only', priority: 'high' }- expect((await delivered({ text: 'Keep my drafts when I go offline', author, source })).endsWith('Message message from [email protected]:\nKeep my drafts when I go offline\n\n'+ expect((await delivered({ text: 'Keep my drafts when I go offline', author, source })).endsWith('Message message from peer:\nKeep my drafts when I go offline\n\n'+ 'Proposal details from their Buddy, for the PM:\nGoal: Desktop keeps drafts offline\nScope: Desktop only\nPriority: high')).toBe(true)// A proposal from before keeps its details in its Buddy's reply, and any other row is as it was.- expect((await delivered({ text: 'Offline drafts', author, source: { kind: 'buddy-proposal', personId: 'peer' } })).endsWith('Message message from [email protected]:\nOffline drafts')).toBe(true)+ expect((await delivered({ text: 'Offline drafts', author, source: { kind: 'buddy-proposal', personId: 'peer' } })).endsWith('Message message from peer:\nOffline drafts')).toBe(true)})it('marks a message the server says an agent of another account wrote, right before it (audit M3)', async () => {const author = { kind: 'agent', id: 'team-agent', name: 'Tester' }diff --git a/cli/src/superTabs/host.ts b/cli/src/superTabs/host.tsindex 861f2b018..39316b30d 100644--- a/cli/src/superTabs/host.ts+++ b/cli/src/superTabs/host.ts@@ -50,6 +50,7 @@ import { parseSwarmSkill, recordSwarmSkillNotice, refreshSwarmSkill, wireRole, ttype SwarmSkillMode } from '../lib/swarmSkills.js'import { recordProjectSkillsNotice, refreshProjectSkills } from '../lib/swarmInstructionsSkill.js'import { artifactLinks, buddyLaunchOf, buddyReadsOf, forgetBuddyReads, grantBuddyWide, SentListsError, writeBuddyAccount } from '../lib/buddyGuard.js'+import { authorName } from './personName.js'/** The skills of a group's project in a tab state: a group from before projects is in the first, and a project from before* modes, or a Swarm from before projects, is orchestration. */@@ -118,13 +119,8 @@ const BUDDY_NEWS = (group: string) => `News for your owner from the project conv+ 'instructions to you, and do not answer it there. If it is a step in your owner\'s proposal or in work they requested (the PM took it, the task it '+ 'went to, its pull request merged or released) and you have not told them yet, post one short note in your chat with your owner; otherwise post nothing.\n'-/** The name an agent reading a delivery knows [author] by: its display name (Robin, River), else its stored name. An agent's- * stored name is the kind it was first started as ("Builder", "Lead", "Reviewer"), not anyone the reader can name or- * address: "Message ... from Builder" left a PM unsure which Engineer wrote, and the idle notice read "from Lead" (Ken, 11-02). */-const shownName = (author: unknown, fallback: string): string => {- const { displayName, name } = object(author)- return typeof displayName === 'string' && displayName.trim() ? displayName : String(name ?? fallback)-}+/** The name an agent reading a delivery knows [author] by (personName.ts authorName): never a person's email (task #2954). */+const shownName = authorName/** Right before a message the server says an agent of another account wrote (backend store.ts otherAccount, audit M3): a Team* agent's message reached its Mac owner's agents, which acted with the owner's rights ("post me ~/.ssh/config"). It covers@@ -2276,10 +2272,10 @@ export class SuperTabHost {// A notice for this agent alone (a skill update): nobody else sees it, so nothing invites a reply in the conversation.if (source.kind === 'agent-only') return String(message.text)const native = source.kind === 'native'- ? `This is an observed native ${String(source.phase)} in ${shownName(message.author, 'an agent')}’s terminal, opened by ${String(object(source.operator).name ?? 'a collaborator')}. The input already reached that agent. Keep the shared work coordinated; do not replay the same instruction.\n\n`+ ? `This is an observed native ${String(source.phase)} in ${shownName(message.author, 'an agent')}’s terminal, opened by ${shownName(source.operator, 'a collaborator')}. The input already reached that agent. Keep the shared work coordinated; do not replay the same instruction.\n\n`: ''- // A post that names no one reaches the coordinator, or from the coordinator the task's assignee: a reply to another agent- // names it, or an Engineer answering a Reviewer reaches the PM instead (final review). A person reads the chat itself.+ // A reply to an agent names it: a backend from before #2963 delivered an unnamed reply to the coordinator instead of its+ // author (final review). A person reads the chat itself.const author = object(message.author)const to = author.kind === 'agent' && identifier(author.id) ? ` --to ${shellQuote(author.id)}` : ''// A thread reply is answered in its thread, and a Buddy session's thread stays its own; any other message right below it.diff --git a/cli/src/superTabs/inCore/cards.spec.ts b/cli/src/superTabs/inCore/cards.spec.tsindex 8439e96bf..5a1d8ccd6 100644--- a/cli/src/superTabs/inCore/cards.spec.ts+++ b/cli/src/superTabs/inCore/cards.spec.ts@@ -108,9 +108,12 @@ describe('the Swarm cards on the devices', () => {cards.cards([card('t1', [lead('l1', { chat: { kind: 'lead', id: 'c1', name: 'Lead', working: false }, notice: notice({ chat: 'lead' }) })])])expect(swarmCards.mock.calls[1][0][0].leads[0]).toMatchObject({ chat: { kind: 'lead', id: 'c1' }, notice: { chat: 'lead' } })expect(swarmCards.mock.calls[1][0][0].leads[0].chat).not.toHaveProperty('since')+ // A tag in a task chat (#2965), in its thread.+ cards.cards([card('t1', [lead('l1', { notice: notice({ chat: 'group', chatId: 'g1', thread: 'r1' }) })])])+ expect(swarmCards.mock.calls[2][0][0].leads[0].notice).toEqual(notice({ chat: 'group', chatId: 'g1', thread: 'r1' }))swarmCards.mockClear()const badChats = [chat({ kind: 'other' }), chat({ id: 'bad id' }), chat({ name: 5 }), chat({ working: 'yes' }), chat({ since: -1 }), 'chat']- const badNotices = [notice({ chat: 'group' }), notice({ chatId: 'bad id' }), notice({ id: '' }), notice({ text: 5 }), notice({ at: -1 }), 7]+ const badNotices = [notice({ chat: 'other' }), notice({ chatId: 'bad id' }), notice({ id: '' }), notice({ text: 5 }), notice({ at: -1 }), 7]for (const bad of badChats) cards.cards([card('t1', [lead('l1', { chat: bad })])])for (const bad of badNotices) cards.cards([card('t1', [lead('l1', { notice: bad })])])// The Lead stays, without what was not sound.diff --git a/cli/src/superTabs/inCore/cards.ts b/cli/src/superTabs/inCore/cards.tsindex ba2d999e0..5f65b8948 100644--- a/cli/src/superTabs/inCore/cards.ts+++ b/cli/src/superTabs/inCore/cards.ts@@ -30,7 +30,7 @@ const STATES: ReadonlySet<string> = new Set(['ask', 'stuck', 'work', 'done'])const CHATS: ReadonlySet<string> = new Set(['lead', 'pm', 'group', 'buddy'])/** The Lead's notice comes from its Lead or Buddy chat, the Buddy's quiet one from its chat alone: an older dial reads only* the first, so the Buddy's words never reach it. */-const NOTICE_CHATS: ReadonlySet<string> = new Set(['lead', 'pm'])+const NOTICE_CHATS: ReadonlySet<string> = new Set(['lead', 'pm', 'group'])const BUDDY_NOTICE_CHATS: ReadonlySet<string> = new Set(['buddy'])/** Desktop's pattern is the 15 half bits of a 5×5 grid (superTabs/buddyAvatar.ts). */const MAX_CELLS = 0x7fffdiff --git a/cli/src/superTabs/personName.ts b/cli/src/superTabs/personName.tsnew file mode 100644index 000000000..eccd7bb21--- /dev/null+++ b/cli/src/superTabs/personName.ts@@ -0,0 +1,39 @@+/**+ * How the CLI names a person in what it hands an agent: by the name they show, else their username, never by email. Agents+ * copied emails from deliveries into commands and pull request bodies, and a machine's privacy hook stopped their sessions+ * for a person to approve (task #2954, Ken 11-04). The server names people to agents already (backend personNames.ts+ * authorForAgent); this keeps an older server's email out too.+ */+type Json = Record<string, unknown>+const text = (value: unknown): string | undefined => typeof value === 'string' && value.trim() ? value.trim() : undefined+const EMAIL = /^[^\s@]+@[^\s@]+\.[^\s@]+$/+/** [name], or the part before its @ when it is an email address: the username an older server would have made from it. */+const notEmail = (name: string | undefined): string | undefined => name && EMAIL.test(name) ? name.slice(0, name.indexOf('@')) : name++/** A person row of a Swarm read, as the Swarm shows them. */+export const personName = (person: Json | undefined): string | undefined =>+ person ? notEmail(text(person.name)) ?? text(person.username) ?? notEmail(text(person.email)) : undefined++/** A message's author (or a terminal's operator): by its display name, else its stored name. An agent's stored name is the+ * kind it was first started as ("Builder", "Lead"), not anyone the reader can name: "Message ... from Builder" left a PM+ * unsure which Engineer wrote (Ken, 11-02). A person's is never shown as an email. */+export function authorName(author: unknown, fallback: string): string {+ const { displayName, name } = author && typeof author === 'object' ? author as Json : {}+ return notEmail(text(displayName) ?? (typeof name === 'string' && name ? name : undefined)) ?? fallback+}++/** The people [token] names, as a post's `--mention` takes it: their id, their username or display name in any case and+ * spacing, with or without a leading @, or (older callers) their email. A username is unique in a Swarm (backend+ * usernames.ts), so it wins; a display name two people share names them both. */+export function peopleNamed(people: Json[], token: string): Json[] {+ const key = (value: unknown) => typeof value === 'string' ? value.normalize('NFKC').toLowerCase().replace(/\s+/gu, '').replace(/^@+/, '') : ''+ const wanted = key(token)+ if (!wanted) return []+ const byId = people.filter(p => p.id === token.trim())+ if (byId.length) return byId+ const byUsername = people.filter(p => key(p.username) === wanted)+ if (byUsername.length) return byUsername+ const byEmail = people.filter(p => key(p.email) === wanted)+ if (byEmail.length) return byEmail+ return people.filter(p => key(p.name) === wanted)+}diff --git a/cli/src/superTabs/readContract.ts b/cli/src/superTabs/readContract.tsindex a9d610866..0bbe6abbd 100644--- a/cli/src/superTabs/readContract.ts+++ b/cli/src/superTabs/readContract.ts@@ -35,6 +35,8 @@ export interface Derived {otherProjectsWork?: Json[]/** A person only. */mentionsWaiting?: number+ /** A person only: a digest of which of their tags wait, moving when one is made, answered or expires. */+ mentionsDigest?: string/** False only in a Swarm Harness Team accounts are not tried in yet (backend machines.ts teamAccountSwarm). */teamAccounts?: false}diff --git a/cli/src/superTabs/reassemble.ts b/cli/src/superTabs/reassemble.tsindex 13d2866ee..b6da716fb 100644--- a/cli/src/superTabs/reassemble.ts+++ b/cli/src/superTabs/reassemble.ts@@ -62,5 +62,6 @@ export function reassemble(store: PartsStore): Json {}if (derived.otherProjectsWork !== undefined) state.otherProjectsWork = derived.otherProjectsWorkif (derived.mentionsWaiting !== undefined) state.mentionsWaiting = derived.mentionsWaiting+ if (derived.mentionsDigest !== undefined) state.mentionsDigest = derived.mentionsDigestreturn state}diff --git a/cli/src/superTabs/service.spec.ts b/cli/src/superTabs/service.spec.tsindex 1efb48cc8..8ee6d2786 100644--- a/cli/src/superTabs/service.spec.ts+++ b/cli/src/superTabs/service.spec.ts@@ -348,6 +348,9 @@ it('gives every agent the same help, with no rule the server dropped', async ()expect(String(help.post)).toContain('--mention')// Task #2924: an agent with work in the project posts in its project chat itself, joining nobody there (#2207).expect(String(help.post)).toContain('In the project chat, an agent with a task or step in the project posts and reacts without joining it, and a person\'s answer to its line reaches it; --to there adds no agent, so name only the PM.')+ // Task #2963: an unnamed post no longer reaches the PM.+ expect(String(help.post)).toContain('With no --to or @Name it reaches no agent, except the agent a reply answers and, in a task or step, its assignee. Your status tells the PM your work: never post it results, verdicts or acknowledgements.')+ expect(String(help.post)).not.toContain('your post reaches the PM')expect((help.commands as Array<{ type: string }>).map(c => c.type)).toEqual(expect.arrayContaining(['decision.ask', 'person.tell']))expect(help.plan).toEqual(expect.stringMatching(/^plan \[JSON\]/))const dropped = /prefer stop|agree an order|Only its project's Lead|without a routeDecisionId is refused|hard rule|top tier|steps the task up|"name":"Builder"|role "reviewer"/i@@ -1315,7 +1318,8 @@ describe('the Harness Team account, offered by Desktop on this Mac', () => {// Lead mentions (spec 2026-10-24-lead-mentions): a post names people by id or email; the backend gets their person ids,// and every agent's help offers it (project instructions, phase 4).describe('mentions on a post', () => {- const people = [{ id: 'person-ken', email: '[email protected]', role: 'owner' }, { id: 'person-dee', email: '[email protected]', role: 'collaborator' }]+ const people: Array<Record<string, unknown>> = [{ id: 'person-ken', email: '[email protected]', role: 'owner', username: '0xken15', name: 'Ken' },+ { id: 'person-dee', email: '[email protected]', role: 'collaborator', username: 'dee' }]const swarm = (t: ReturnType<typeof setup>, leadId: string | null) => {const state = { agents: [t.agent], people, projects: [{ id: 'pilot', name: 'Pilot', leadConversationId: 'pilot' }],conversations: [{ id: 'pilot', leadId, agentIds: [t.agentId] }, { id: 'work', projectId: 'pilot', leadId: t.agentId, agentIds: [t.agentId] }] }@@ -1333,11 +1337,33 @@ describe('mentions on a post', () => {command: { type: 'message.send', conversationId: 'pilot', text: 'Please confirm', replyTo: null, recipientIds: [], mentions: ['person-ken', 'person-dee'] } }]])})+ // Task #2954 (Ken, 11-04): a PM typed --mention with Ken's email and a machine's privacy hook stopped its session. A post+ // names people by username or display name; an email still works for older callers.+ it('sends the person ids of people named by username or display name, in any case and with or without @', async () => {+ const t = setup()+ swarm(t, t.agentId)+ expect(await post(t, ['@0xKen15', 'Dee', ' ken '])).toMatchObject({ ok: true })+ expect(posted(t).map(([, , body]) => (body as { command: { mentions: string[] } }).command.mentions)).toEqual([['person-ken', 'person-dee']])+ })++ it('refuses a display name two people go by, naming their usernames, and takes either by username', async () => {+ const t = setup()+ people.push({ id: 'person-ken2', email: '[email protected]', role: 'collaborator', username: 'kenb', name: 'ken' })+ try {+ swarm(t, t.agentId)+ expect(await post(t, ['Ken'])).toEqual({ error: 'MENTION_AMBIGUOUS',+ detail: 'Ken is the name of more than one person here (0xken15, kenb). Tag them by username or id.', status: 400 })+ expect(posted(t)).toEqual([])+ expect(await post(t, ['kenb', '0xken15'])).toMatchObject({ ok: true })+ expect(posted(t).map(([, , body]) => (body as { command: { mentions: string[] } }).command.mentions)).toEqual([['person-ken2', 'person-ken']])+ } finally { people.pop() }+ })+it('refuses a person who is not in the Swarm before anything is sent', async () => {const t = setup()swarm(t, t.agentId)expect(await post(t, ['[email protected]', '[email protected]'])).toEqual({ error: 'MENTION_UNKNOWN',- detail: '[email protected] is not a person in this Swarm. Tag a person by the id or email shown in status.', status: 400 })+ detail: '[email protected] is not a person in this Swarm. Tag a person by the username or id shown in status.', status: 400 })expect(await post(t, [42])).toMatchObject({ error: 'MENTION_UNKNOWN' })expect(posted(t)).toEqual([])})@@ -1362,9 +1388,11 @@ describe('mentions on a post', () => {expect(lead.post).toContain('--answers puts your answer right below that message, in the main chat; --reply-to puts it in that message\'s thread.')// 2026-10-30: TEXT - posted a literal dash; help says - reads the message from stdin (command.ts postStdin).expect(lead.post).toContain("when it holds quotes, or is only -, put - in its place and send the message on stdin (post GROUP - OPERATION_ID <<'MSG' … MSG); an empty stdin is refused and nothing is posted.")- expect(lead.post).toContain('--mention tags a person, by the id or email shown in status (up to 5), when you need them to act or decide; it shows in their notifications.')+ // By username, display name or id, never email (task #2954).+ expect(lead.post).toContain('--mention tags a person, by the username, display name or id shown in status (up to 5), when you need them to act or decide; it shows in their notifications.')// The server reads tags from the text too (backend mentions.ts).- expect(lead.post).toContain('An @username or @email in TEXT tags that person as well, outside code and links.')+ expect(lead.post).toContain('An @username in TEXT tags that person as well, outside code and links. Never type a person\'s email.')+ expect(lead.post).not.toMatch(/email shown|@email/)expect(String(lead.plan)).toContain('plan [JSON]: the best plan for all your open groups')expect(await help(t, { tabId: 'tab', harnessId: 'native' })).toEqual(lead)// An agent that coordinates nothing reads the same, and so does help outside a tab or with a caller that cannot be read.diff --git a/cli/src/superTabs/service.ts b/cli/src/superTabs/service.tsindex 12d1f7395..05b6c507c 100644--- a/cli/src/superTabs/service.ts+++ b/cli/src/superTabs/service.ts@@ -39,14 +39,17 @@ import { createOwnerSubscriptions } from '../lib/ownerSubscriptions.js'import { createPullRequestsStatusReader } from '../lib/pullRequestsStatus.js'import { buddyArchived, buddyStatus, isBuddyIn, isSwarmBuddyIn, projectNamed, type BuddyStatusDeps } from './buddyStatus.js'import { startSubscriptionRelay } from '../lib/subscriptionRelay.js'+import { peopleNamed, personName } from './personName.js'-const POST_ABOUT = 'reply in that conversation. Use a unique ID per message and reuse it after an interrupted request. Answer a message once, with its ID: --answers puts your answer right below that message, in the main chat; --reply-to puts it in that message\'s thread. --attach sends a file (a screenshot, a log; up to 10 files of 256 MB each), and TEXT may then be empty. --to names the agents it reaches (any agent of this project, by id from status; up to 16): they join the conversation if they are not in it. With no --to, your post reaches the PM. In the project chat, an agent with a task or step in the project posts and reacts without joining it, and a person\'s answer to its line reaches it; --to there adds no agent, so name only the PM.'+const POST_ABOUT = 'reply in that conversation. Use a unique ID per message and reuse it after an interrupted request. Answer a message once, with its ID: --answers puts your answer right below that message, in the main chat; --reply-to puts it in that message\'s thread. --attach sends a file (a screenshot, a log; up to 10 files of 256 MB each), and TEXT may then be empty. --to names the agents it reaches (any agent of this project, by id from status; up to 16): they join the conversation if they are not in it. With no --to or @Name it reaches no agent, except the agent a reply answers and, in a task or step, its assignee. Your status tells the PM your work: never post it results, verdicts or acknowledgements. In the project chat, an agent with a task or step in the project posts and reacts without joining it, and a person\'s answer to its line reaches it; --to there adds no agent, so name only the PM.'const POST_HELP = `${POST_ABOUT} TEXT is one argument: when it holds quotes, or is only -, put - in its place and send the message on stdin (post GROUP - OPERATION_ID <<'MSG' … MSG); an empty stdin is refused and nothing is posted.`/** A Buddy's guard refuses TEXT - (#2358): on stdin its message would skip the secret check. A Buddy that followed the stdin* hint was refused and tried again, so its help passes the message in quotes, as the guard's refusal says. */const BUDDY_POST_HELP = `${POST_ABOUT} TEXT is one argument, the message itself in quotes: 'your message', or "it's done" when it holds an apostrophe. A Buddy never passes - for TEXT: its message is checked for secrets, so one read from stdin is refused and nothing is posted.`const POST_FLAGS = '[--to AGENT]... [--answers MESSAGE_ID | --reply-to MESSAGE_ID] [--attach PATH]... [--mention PERSON]...'-const MENTION_HELP = ' --mention tags a person, by the id or email shown in status (up to 5), when you need them to act or decide; it shows in their notifications. An @username or @email in TEXT tags that person as well, outside code and links. Nobody is tagged who cannot read the conversation.'+// By username, display name or id, never email: a PM typed --mention with Ken's email and a machine's privacy hook stopped it+// (task #2954). An email still resolves for older callers (mentionCommand), and the server still reads @email in TEXT.+const MENTION_HELP = ' --mention tags a person, by the username, display name or id shown in status (up to 5), when you need them to act or decide; it shows in their notifications. An @username in TEXT tags that person as well, outside code and links. Never type a person\'s email. Nobody is tagged who cannot read the conversation.'/** What the command entry says after how its JSON is passed, the same for everyone. A task's review plan (#2382) is said in* its brief (backend superTabs/model.ts renderWorkTask), for whoever opens its review (project instructions, phase 4). */const COMMAND_ABOUT = 'send one of the commands below.'@@ -185,21 +188,26 @@ function statusView(answer: Record<string, unknown>, agentId: string): Record<streturn { ...answer, state: { ...state, conversations } }}-/** A post's mentions name people by id or email; the backend takes person ids. A name that is nobody in the Swarm is refused- * here, before anything is sent. Whether this agent may tag them in this conversation is the backend's to judge. Only such- * a post reads the Swarm, for its people. */+/** A post's mentions name people by id, username or display name, or (older callers) email (personName.ts peopleNamed); the+ * backend takes person ids. A name that is nobody in the Swarm, or that two people go by, is refused here, before anything is+ * sent. Whether this agent may tag them in this conversation is the backend's to judge. Only such a post reads the Swarm,+ * for its people. */async function mentionCommand(command: Record<string, unknown>, swarm: () => Promise<Record<string, unknown>>): Promise<Record<string, unknown>> {if (command.type !== 'message.send' || !Array.isArray(command.mentions)) return commandconst people = list((await swarm()).people)const ids = command.mentions.map(name => {- const person = people.find(p => p.id === name || typeof name === 'string' && typeof p.email === 'string' && p.email.toLowerCase() === name.toLowerCase())- if (!person) throw new SuperTabHostError('MENTION_UNKNOWN', `${String(name)} is not a person in this Swarm. Tag a person by the id or email shown in status.`, 400)- return person.id+ const named = typeof name === 'string' ? peopleNamed(people, name) : []+ if (!named.length) throw new SuperTabHostError('MENTION_UNKNOWN', `${String(name)} is not a person in this Swarm. Tag a person by the username or id shown in status.`, 400)+ if (named.length > 1) {+ const usernames = named.map(p => String(p.username ?? p.id)).join(', ')+ throw new SuperTabHostError('MENTION_AMBIGUOUS', `${String(name)} is the name of more than one person here (${usernames}). Tag them by username or id.`, 400)+ }+ return named[0]!.id})return { ...command, mentions: [...new Set(ids)] }}-/** The instructions with each note's asker named (`askedByName`: their username, else their email), as the status read has+/** The instructions with each note's asker named (`askedByName`: their username, never their email, task #2954), as the status read has* them, so the printed notes say who asked rather than an id (final review). Only a document with notes reads the Swarm; a* member the read does not have, or a read that fails, keeps the id alone. */async function withAskerNames(document: Record<string, unknown>, state: () => Promise<Record<string, unknown>>): Promise<Record<string, unknown>> {@@ -207,7 +215,7 @@ async function withAskerNames(document: Record<string, unknown>, state: () => Prconst people = await state().then(read => list(read.people), () => [])const nameOf = (id: unknown) => {const person = people.find(p => p.id === id)- return typeof person?.username === 'string' && person.username ? person.username : typeof person?.email === 'string' ? person.email : null+ return typeof person?.username === 'string' && person.username ? person.username : personName(person) ?? null}return { ...document, notes: document.notes.map(note => {const name = nameOf(object(note).askedBy)diff --git a/cli/src/superTabs/serviceReads.spec.ts b/cli/src/superTabs/serviceReads.spec.tsindex f1ddf0e71..440cbcd1a 100644--- a/cli/src/superTabs/serviceReads.spec.ts+++ b/cli/src/superTabs/serviceReads.spec.ts@@ -217,12 +217,13 @@ describe('instructions', () => {expect(await ask(parts, 'p4')).toMatchObject({ ok: true, value: { projectId: 'p4' } })})})+ // Never an email, whom an agent would copy into a command (task #2954): an older server's row without a username reads by its prefix.it('names who asked for each note, as the status read has them, and keeps the id of one it does not', async () => {const notes = [{ id: 'n1', text: 'Ship Fridays.', askedBy: FIXTURE.collaboratorId, at: 1, expiresAt: null },{ id: 'n2', text: 'Ask Ana.', askedBy: '6a000000000000000000000f', at: 2, expiresAt: null }]const s = swarm((_method, path) => path === instructionsPath('p2', FIXTURE.leadId) ? ok({ ...document, projectId: 'p2', notes }) : undefined)expect(await s.ask({ action: 'instructions', tabId: T, agentId: FIXTURE.leadId, projectId: 'p2' }, owner)).toMatchObject({ ok: true, value: { notes: [- { id: 'n1', askedBy: FIXTURE.collaboratorId, askedByName: '[email protected]' }, { id: 'n2', askedBy: '6a000000000000000000000f' }] } })+ { id: 'n1', askedBy: FIXTURE.collaboratorId, askedByName: 'dev' }, { id: 'n2', askedBy: '6a000000000000000000000f' }] } })const value = (await s.ask({ action: 'instructions', tabId: T, agentId: FIXTURE.leadId, projectId: 'p2' }, owner)) as { value: { notes: Json[] } }expect(value.value.notes[1]).not.toHaveProperty('askedByName')})diff --git a/devices/harness-device/firmware/main/cable_client.c b/devices/harness-device/firmware/main/cable_client.cindex 42ada01ce..3dd5e72bc 100644--- a/devices/harness-device/firmware/main/cable_client.c+++ b/devices/harness-device/firmware/main/cable_client.c@@ -1037,18 +1037,20 @@ static void handle_supertab_recap(const cJSON *p)const bool none = cJSON_IsTrue(cJSON_GetObjectItemCaseSensitive(p, "none"));ui_supertab_recap(tab, lead, chat_id ? chat_id : "", thread ? thread : "", none || !text ? "" : text, secs > 4294967295.0 ? 0xFFFFFFFFu : (uint32_t)secs, none);}-// `supertab.notice` {tab, lead, chat, chatId, id, text, at}: the Lead's new message in its Lead conversation or Chat with-// PM, the one thing that alerts with a swarmChat daemon, or the Buddy's in its chat (chat "buddy", a quiet one). The daemon-// sends each once; the UI decides the beep.+// `supertab.notice` {tab, lead, chat, chatId, id, text, at}: the one thing that alerts with a swarmChat daemon. From a daemon+// since #2965 a tag of the person's in the Lead's project, in its Lead conversation ("lead"), Chat with PM ("pm") or a task+// chat ("group"); from one before, the Lead's new message in the first two. Or the Buddy's in its chat (chat "buddy", a quiet+// one). The daemon sends each once; the UI decides the beep.static void handle_supertab_notice(const cJSON *p){const char *tab = str_of(p, "tab"), *lead = str_of(p, "lead"), *chat = str_of(p, "chat"), *chat_id = str_of(p, "chatId");const char *id = str_of(p, "id"), *text = str_of(p, "text");if (!id_fits(tab) || !id_fits(lead) || !id_fits(chat_id) || !id_fits(id) || !text || !chat) return;- if (strcmp(chat, "lead") && strcmp(chat, "pm") && strcmp(chat, "buddy")) return; // groups never alert+ if (strcmp(chat, "lead") && strcmp(chat, "pm") && strcmp(chat, "group") && strcmp(chat, "buddy")) return; // a kind it does not knowconst cJSON *at = cJSON_GetObjectItemCaseSensitive(p, "at");const double secs = cJSON_IsNumber(at) && at->valuedouble > 0 ? at->valuedouble : 0;- ht_chat_kind_t kind = !strcmp(chat, "pm") ? HT_CHAT_PM : !strcmp(chat, "buddy") ? HT_CHAT_BUDDY : HT_CHAT_LEAD;+ ht_chat_kind_t kind = !strcmp(chat, "pm") ? HT_CHAT_PM : !strcmp(chat, "buddy") ? HT_CHAT_BUDDY+ : !strcmp(chat, "group") ? HT_CHAT_GROUP : HT_CHAT_LEAD;// A reply inside a thread names its root (#2463): read on the face only in that thread. A root too long to hold is// passed as it is: no face's root matches it, so it beeps, never read as the main chat's.const char *thread = str_of(p, "thread");diff --git a/devices/harness-device/firmware/main/ui/habitat/ui_habitat.c b/devices/harness-device/firmware/main/ui/habitat/ui_habitat.cindex 6a8b1d0f1..1f55cae30 100644--- a/devices/harness-device/firmware/main/ui/habitat/ui_habitat.c+++ b/devices/harness-device/firmware/main/ui/habitat/ui_habitat.c@@ -5457,12 +5457,13 @@ void ui_supertab_focus(const char *tab, const char *lead)display_unlock();}/*- * A LEAD'S NEW MESSAGE (design 2026-10-28-round-dial-swarm-chat §3), in its Lead conversation or Chat with PM: the one- * alert a swarmChat daemon raises. It is that Lead's single entry, news rather than a question, the message as its text- * and the Swarm's name (with " · PM" for Chat with PM) as its grey line. Each notice counts as unread again; it is read at- * once only when that Lead's face shows that very chat, and for a reply inside a thread (`thread`, its root) that very- * thread: the main chat shows it collapsed under its root, so the PM's answer in a task thread rang nowhere (#2463). True- * when the caller should beep (the coalescing is the audio's).+ * A LEAD'S NOTICE (design 2026-10-28-round-dial-swarm-chat §3): the one alert a swarmChat daemon raises, a tag of the+ * person's in that Lead's project since #2965 (`chat` HT_CHAT_GROUP for a task chat's), the Lead's new message in its Lead+ * conversation or Chat with PM from a daemon before. It is that Lead's single entry, news rather than a question, the+ * message as its text and the Swarm's name (with " · PM" for Chat with PM) as its grey line. Each notice counts as unread+ * again; it is read at once only when that Lead's face shows that very chat, and for a reply inside a thread (`thread`, its+ * root) that very thread: the main chat shows it collapsed under its root, so the PM's answer in a task thread rang nowhere+ * (#2463). True when the caller should beep (the coalescing is the audio's).*/_Static_assert(SWARM_SAID == NOTICES, "a chat for every inbox entry a Lead's message can take");static int swarm_said_of(const char *lead)diff --git a/devices/harness-device/firmware/main/ui/ui_screens.h b/devices/harness-device/firmware/main/ui/ui_screens.hindex cede0dac2..fb8621f71 100644--- a/devices/harness-device/firmware/main/ui/ui_screens.h+++ b/devices/harness-device/firmware/main/ui/ui_screens.h@@ -261,7 +261,7 @@ bool ui_supertab(const ht_supertab_t *in);// `chat_id`: the chat the text is the last message of, "" from a daemon without swarmChat. Dropped for another chat.void ui_supertab_recap(const char *tab, const char *lead, const char *chat_id, const char *thread, const char *text, uint32_t at, bool none);void ui_supertab_focus(const char *tab, const char *lead);-// The Lead's new message in its Lead conversation or Chat with PM (`supertab.notice`): that Lead's one inbox entry, read at+// A tag in the Lead's project, or an older daemon's Lead message (`supertab.notice`): that Lead's one inbox entry, read at// once when its chat is on the face. `thread`: the root of the thread it replies in, "" for the main stream; such a notice// is read at once only when the face shows that thread. True when the caller should beep.bool ui_supertab_notice(const char *tab, const char *lead, ht_chat_kind_t chat, const char *chat_id, const char *thread, const char *text, uint32_t at);diff --git a/devices/harness-device/firmware/test/test_cable_supertab.py b/devices/harness-device/firmware/test/test_cable_supertab.pyindex da0f96a98..fd9f8e58f 100644--- a/devices/harness-device/firmware/test/test_cable_supertab.py+++ b/devices/harness-device/firmware/test/test_cable_supertab.py@@ -226,15 +226,21 @@ int main(void) {// The Buddy's word: chat "buddy" reaches the UI as HT_CHAT_BUDDY; the UI says it is quiet.feed(handle_supertab_notice,"{\"tab\":\"s1\",\"lead\":\"L1\",\"chat\":\"buddy\",\"chatId\":\"b1\",\"id\":\"m11\",\"text\":\"Cache it.\",\"at\":6}");assert(notice_calls==3 && got_chat==HT_CHAT_BUDDY && !strcmp(got_chat_id,"b1") && !strcmp(got_text,"Cache it.") && beeps==beeps_before+1);+ // A tag in a task chat (#2965): chat "group" reaches the UI as HT_CHAT_GROUP, with its thread; the UI decides the beep.+ beep_next=true;+ feed(handle_supertab_notice,"{\"tab\":\"s1\",\"lead\":\"L2\",\"chat\":\"group\",\"chatId\":\"g1\",\"id\":\"tag1\",\"text\":\"Sam: @diego look\",\"at\":8,\"thread\":\"r1\"}");+ beep_next=false;+ assert(notice_calls==4 && got_chat==HT_CHAT_GROUP && !strcmp(got_chat_id,"g1") && !strcmp(got_thread,"r1") && beeps==beeps_before+2);+ beeps=beeps_before+1;notice_calls=2;feed(handle_supertab_notice_read,"{\"tab\":\"s1\",\"lead\":\"L2\",\"chatId\":\"pm1\"}");assert(read_calls==1 && !strcmp(got_tab,"s1") && !strcmp(got_lead,"L2") && !strcmp(got_chat_id,"pm1"));- // a notice with a non-id chatId or no lead is ignored, and so is one of a group, with no id, or no text.+ // a notice with a non-id chatId or no lead is ignored, and so is one of a kind it does not know, with no id, or no text.char longer_id[ID_MAX+8];memset(longer_id,'c',ID_MAX);longer_id[ID_MAX]=0;char bad[256];snprintf(bad,sizeof bad,"{\"tab\":\"s1\",\"lead\":\"L2\",\"chat\":\"pm\",\"chatId\":\"%s\",\"id\":\"m1\",\"text\":\"x\",\"at\":1}",longer_id);feed(handle_supertab_notice,bad);feed(handle_supertab_notice,"{\"tab\":\"s1\",\"chat\":\"pm\",\"chatId\":\"pm1\",\"id\":\"m1\",\"text\":\"x\",\"at\":1}");- feed(handle_supertab_notice,"{\"tab\":\"s1\",\"lead\":\"L2\",\"chat\":\"group\",\"chatId\":\"g1\",\"id\":\"m1\",\"text\":\"x\",\"at\":1}");+ feed(handle_supertab_notice,"{\"tab\":\"s1\",\"lead\":\"L2\",\"chat\":\"tag\",\"chatId\":\"g1\",\"id\":\"m1\",\"text\":\"x\",\"at\":1}");feed(handle_supertab_notice,"{\"tab\":\"s1\",\"lead\":\"L2\",\"chat\":\"pm\",\"chatId\":\"pm1\",\"text\":\"x\",\"at\":1}");feed(handle_supertab_notice,"{\"tab\":\"s1\",\"lead\":\"L2\",\"chat\":\"pm\",\"chatId\":\"pm1\",\"id\":\"m1\",\"at\":1}");feed(handle_supertab_notice,"{\"tab\":\"\",\"lead\":\"L2\",\"chat\":\"pm\",\"chatId\":\"pm1\",\"id\":\"m1\",\"text\":\"x\",\"at\":1}");diff --git a/devices/harness-device/firmware/test/test_touch_ui.py b/devices/harness-device/firmware/test/test_touch_ui.pyindex 9d027c497..dbc40c015 100644--- a/devices/harness-device/firmware/test/test_touch_ui.py+++ b/devices/harness-device/firmware/test/test_touch_ui.py@@ -2289,6 +2289,34 @@ static void swarm_thread_notice_checks(void) {assert(ui_supertab_notice("s1", "T1", HT_CHAT_PM, "pm1", "m9", "Flashed.", 1792560005u));puts("Swarm thread notices: read at once only on that thread's face, a beep on the main chat or another thread, main-stream notices as before PASS");}+// A tag in a task chat (#2965, Diego 2026-11-04): it alerts as a Lead's notice does, read at once only while the face shows+// that very chat and thread, else it beeps and wakes. The daemon sends each tag once.+static void group_lead(const char *id, const char *thread) {+ ht_lead_in_t in = {.id = id, .project = "web", .engine = "claude", .local = "", .state = "work", .order = card.lead_n, .since = -1,+ .chat = "group", .chat_id = "g1", .chat_name = "Fix login", .thread = thread,+ .thread_title = thread[0] ? "Fix login on Safari" : "", .thread_replies = -1};+ assert(ht_supertab_lead_add(&card, &in));+}+static void swarm_tag_notice_checks(void) {+ reset(); ht_character_select(&character, HT_CHARACTER_FOCUS); fake_ms = 100000;+ desk_open();+ const char ids[1][ID_MAX] = {"s1"};+ ui_supertabs_ids(ids, 1);+ card_begin("s1", "t1", "openharness"); group_lead("G0", "r1"); thread_lead("G1", "firmware", "", "", -1); assert(!card_send());+ enter_at("s1", "G0"); scene_take();+ assert(!strcmp(sw.lead, "G0"));+ // The face is in that task chat's thread r1: the tag there is read at once, with no beep.+ assert(!ui_supertab_notice("s1", "G0", HT_CHAT_GROUP, "g1", "r1", "Sam: @diego look", 1792560001u));+ int e = swarm_entry("G0"); assert(e >= 0 && s.notice[e].read_on_dial);+ // Another thread of the chat on the face beeps and stays unread; its main stream is that chat's, read at once.+ assert(ui_supertab_notice("s1", "G0", HT_CHAT_GROUP, "g1", "r2", "Sam: @diego and here", 1792560002u));+ e = swarm_entry("G0"); assert(e >= 0 && !s.notice[e].read_on_dial && !strcmp(s.notice[e].summary, "Sam: @diego and here"));+ assert(!ui_supertab_notice("s1", "G0", HT_CHAT_GROUP, "g1", "", "Sam: @diego main", 1792560003u));+ // Another project's task chat, off the face: it beeps and is that Lead's one entry, named for the Swarm.+ assert(ui_supertab_notice("s1", "G1", HT_CHAT_GROUP, "g9", "", "River: @diego merged?", 1792560004u));+ e = swarm_entry("G1"); assert(e >= 0 && !s.notice[e].read_on_dial && !strcmp(s.notice[e].summary, "River: @diego merged?"));+ puts("Swarm tag notices: a task chat's tag is read at once only on that chat and thread's face, else it beeps PASS");+}static void swarm_buddy_checks(const char *dir) {// 7a the PM side: today's face and two dots, the upper one lit.buddy_setup();@@ -4076,6 +4104,7 @@ int main(int argc, char **argv) {swarm_buddy_checks(argc>1 ? argv[1] : NULL);swarm_thread_checks(argc>1 ? argv[1] : NULL);swarm_thread_notice_checks();+ swarm_tag_notice_checks();}'''extra_sources = []diff --git a/docs/plans/2026-11-04-agents-never-see-emails-plan.md b/docs/plans/2026-11-04-agents-never-see-emails-plan.mdnew file mode 100644index 000000000..8afdd1aac--- /dev/null+++ b/docs/plans/2026-11-04-agents-never-see-emails-plan.md@@ -0,0 +1,88 @@+# Agents never see or type people's emails: implementation plan++> Way of working: the project's Engineer role (plan first, then each task test first, one review on the pull request).++**Goal:** No text the Swarm hands an agent names a person by their email, so no agent copies an email into a command+or a pull request body and a machine's privacy hook never stops its session. Agents tag people by username, display+name or id; an email still tags for older callers. (Task #2954, Ken.)++**Architecture:** The backend is where emails enter what agents read: a person's message author is stored as+`{ name: <email> }`, the requester line and a few refusals and notes interpolate `person.email`. The backend now hands+an agent reader each person author as `{ name: <username>, displayName: <shown name> }` (claims and message pages),+and writes names instead of emails into the agent-facing lines. Every CLI, old or new, already prefers `displayName`.+The CLI host additionally never prints a person author's `name` that holds an `@` (an older backend), and names people+by username where it read their email (Buddy chat line, check verdicts, note askers). `post --mention` resolves an id,+a username, a display name or (older callers) an email, and refuses a name two people answer to. Help and skill texts+say to tag by @username or id.++**Tech stack:** TypeScript; backend vitest units (`npm test`) and the Super Tab integration suite in PR CI; CLI vitest+specs.++**Spec:** the task's brief (#2954).++## Global constraints++- PR body first line: "Requested by Ken through Harness."+- Keep older CLIs working: email mentions still resolve; the wire shapes are only extended.+- Two people with the same display name resolve by username or id, with a clear refusal when ambiguous.+- Status keeps people's emails (the apps need them); prompts, help and examples never show one.+- Swarm code stays out of cli/src/core. Never run a test that signs the Mac out of the real CLI.+- People readers (Desktop, phone, web) keep reading person authors exactly as today: only agent readers change.++## Review focus++- A person reader's page and an agent reader's page of the same conversation: only the agent's person authors change.+- A Buddy's own-person check compares author id and membership generation, never the name: it still passes.+- A person who left the Swarm: their old messages still read with a name (their stored username is gone), never an email.+- `--mention` with a token that is one person's username and another's display name: the username wins (the server+ never lets these collide, so this only meets legacy data).+- Text `@tags` are unchanged: `@username` and `@email` (older agents) still tag; display names are not text tags,+ since the apps highlight tags by username (tagFixture.json).++## Design++- growth: N/A because nothing new is stored; names are worked out at read time from the people rows.+- concurrency: N/A because reads only.+- read cost: one username map per page or claim that has a person author (`swarmUsernames`, already computed on sends).+- scale: per read, linear in people and agents, as `swarmUsernames` already is on every message send.+- compatibility: the author keeps its fields; agent readers get a username in `name` and a new `displayName`, which every+ CLI already prefers. Older CLIs keep sending emails to `--mention`, which still resolve.+- migration + rollback: none; reverting the change restores today's reads.+- audience: the server decides by reader kind (agent vs person); people rows in status are unchanged.+- identity: N/A because no login is used.+- failure: an author whose person is gone reads as "a person" in `name`, never an email.+- platforms: backend; CLI on macOS and Linux.++## Task 1: the backend names people, not emails, to agents++**Files:**+- Modify: `backend/src/superTabs/personNames.ts` (new `authorForAgent`), `backend/src/superTabs/store.ts` (claim and+ page reads for agent readers), `backend/src/superTabs/projects.ts` (`requestedByLine`), `backend/src/superTabs/decisions.ts`,+ `backend/src/superTabs/commands.ts` (person.tell refusal, "Asked …", "Not asked …"), `backend/src/superTabs/digest.ts`.+- Test: `backend/src/superTabs/personNames.test.ts`, `projects.test.ts`, `commands.test.ts`, `digest.test.ts`,+ `backend/integration/superTabMessagePages.test.ts`.++**Interfaces:**+- Produces: `authorForAgent(state: SuperTabState, author: Author): Author` — a person author as+ `{ ...author, name: usernameOf(state, id) ?? 'a person', displayName: shownNameOf(state, id) ?? that name }`; an agent's unchanged.++- [ ] Failing tests: `requestedByLine` reads `Start each pull request body with: Requested by <written name> through Harness.`+ with no `@`; `authorForAgent` gives a username/display name and no email; the decision and tell refusals, the "Asked"+ line and the digest line name the username; an integration read of a person's message as an agent (claim and page)+ has no email anywhere in its JSON, while the same page read by a person keeps `name: <email>`.+- [ ] Implement; run those test files; commit.++## Task 2: the CLI names people, not emails, and tags by name++**Files:**+- Modify: `cli/src/superTabs/host.ts` (`shownName`), `deliveryContext.ts` (Buddy chat line), `agentContext.ts`+ (`checkerName`), `service.ts` (`mentionCommand`, `MENTION_HELP`, `withAskerNames`), `command.ts` (comment),+ `cli/src/lib/swarmTools.ts`, `cli/src/lib/swarmSkills.ts` (Lead and Buddy "tag them" lines).+- Test: `cli/src/superTabs/host.spec.ts`, `deliveryContext.spec.ts`, `service.spec.ts`, `cli/src/lib/swarmTools.spec.ts`.++- [ ] Failing tests: a delivery of a person's message whose author carries `displayName` names it, and one from an older+ backend (`name: [email protected]`, no `displayName`) has no email anywhere in the delivered text; the Buddy chat line+ names the username; `--mention` by username (any case, with or without `@`) and by display name sends that person's+ id; two people with one display name are refused with `MENTION_AMBIGUOUS` naming their usernames; an email still+ resolves; help and skill texts carry no "email" for tagging.+- [ ] Implement; run those spec files; commit.diff --git a/docs/plans/2026-11-04-dial-beeps-on-tags-plan.md b/docs/plans/2026-11-04-dial-beeps-on-tags-plan.mdnew file mode 100644index 000000000..da5af03a9--- /dev/null+++ b/docs/plans/2026-11-04-dial-beeps-on-tags-plan.md@@ -0,0 +1,153 @@+# The round dial beeps only when you're tagged Implementation Plan++> Implemented by the task's Engineer task by task, each failing test committed before its code (project instructions,+> Engineer). One independent review on the pull request.++**Goal:** The round dial beeps and wakes when, and only when, someone tags the person: in a project chat, a task chat or+a thread. PM chatter that tags nobody never beeps (task #2965, Diego, 2026-11-04).++**Architecture:** Today `SwarmCards.watchNotices` (cli/src/superTabs/cards.ts) turns each Lead's newest message in its+Lead conversation or the reader's Buddy chat into the Lead's `notice`. The cable session sends it once as+`supertab.notice`, and the firmware beeps for every `lead`/`pm` notice unless that chat is on the face. Task chats never+alert (cable_client.c drops `chat: "group"`).++- The Lead's `notice` comes from the person's waiting tags instead. Each Swarm read already carries+ `derived.mentionsDigest` (backend read/service.ts), which moves when a tag is made, answered or expires. The cards keep+ the digest per Swarm. Only when it moves do they read `GET /api/super-tabs/:tab/mentions?state=waiting`, under the+ background reads' limit. A tag id not seen before is new. Each new tag becomes the notice of its project's Lead (newest+ per Lead), naming its conversation (`chatId`) and its thread (`thread`, the root, when the tag is a thread reply).+ `chat` is `lead` for the project's Lead conversation, `pm` for the reader's Buddy chat or a Chat with PM, and `group`+ for any other chat (a task chat).+- Baseline: the first digest seen for a Swarm after a device attaches, a sign-in or a daemon start records the tags+ waiting then, with no notice. When it is the empty digest, there is nothing to read. A tag id once seen is never a+ notice again. A read or done tag leaves the waiting list, so it can never be new again. The cable session already+ sends each notice id once and notes, without sending, the ones there at attach.+- Lead and Buddy-chat messages no longer raise notices; the Lead conversation is not read for alerts at all. The face+ recap is still read and pushed by `pushOpen` from the chat's sequence (unchanged), so the recap updates quietly. The+ Buddy's quiet `buddyNotice` (its own chat's reads) stays as it is.+- Firmware: `handle_supertab_notice` takes `chat: "group"` as `HT_CHAT_GROUP`. `ui_supertab_notice` already reads a+ notice on the face only when the face shows that chat and that thread, and beeps otherwise. The notice is the Lead's+ inbox entry, so opening it on the dial enters that project's face, as a Lead's message does today.+- Older firmware drops `group` notices. On it, tags in Lead chats and Buddy chats beep and open the project's face, and PM+ chatter is quiet. Tags in task chats need the new firmware.+- Not in this task: moving the window and the face into the tagged task thread when the entry is opened. Desktop's dial+ pick opens a project's Lead chat only, and a thread open sent beside the pick races it. It goes to the PM as a proposal+ (a pick that names its conversation and thread).++**Tech Stack:** TypeScript (vitest) in cli/; C firmware with host tests (devices/harness-device/firmware/test/run.sh).++**Spec:** task #2965's brief.++## Global Constraints++- Read the waiting mentions only when the server's mentions digest moves, never on a timer.+- Each new tag beeps once, never again after it is read or marked read (Activity rule, #3005), including after a+ reconnect or daemon restart. What arrived with no device attached does not beep.+- No beep if the tagged chat or thread is on the face.+- A PM message that tags nobody refreshes the face recap quietly: no beep, no wake, no inbox entry, also in Chat with PM.+- Device rules: never publish firmware, never run upload scripts, never touch the OTA manifest.+- Swarm code stays out of cli/src/core. The one change there is the `LeadNotice.chat` union in core/api.ts, which is the+ contract the core declares for the Swarm, with no logic.+- PR body first line: "Requested by [email protected] through Harness."++## Design++- Growth: nothing stored. The cards hold, per Swarm, one digest and the tag ids seen, capped at 500 (the server's own+ cap on a person's tags per Swarm). A Swarm that leaves the cards takes them with it.+- Concurrency: one poll at a time (`busy`). The mentions read takes one of the two background read slots.+- Read cost: one mentions read per digest move per Swarm, none otherwise. The Lead conversations' alert reads go away,+ about one page read per Lead message today.+- Scale: 10x tags means 10x reads when the digest moves, bounded by two in flight. The first metric to warn is mentions+ reads per minute in the backend's route timings.+- Compatibility: a backend without `mentionsDigest` gives no tag notices, and PM chatter is quiet. Old firmware: see+ above. An old Desktop ignores nothing new: `superTabThread` already exists.+- Migration and rollback: none; reverting the CLI brings back PM-message notices.+- Audience: the server lists only the person's own tags in conversations they can read (mentions.ts `readable`).+- Identity: read as the signed-in person, as every card read is.+- Failure: a failed mentions read is logged once per run of failures and tried again at the next poll, with the digest+ unchanged.+- Platforms: the CLI daemon on macOS, Linux and Windows; the round dial's firmware.++## Review Focus++- Two tags for one project between two reads: one notice (the newest) and one beep, the other still in Activity.+- A tag made while no device was attached, then the device attaches: no beep, and none when the digest later moves for+ another tag.+- A tag in a task thread whose task chat is on the face but whose thread is not: it beeps (the main chat shows it+ collapsed).+- A Swarm whose project has no Lead: its tags make no notice and the cards keep going.+- The tag read fails while the digest moved: nothing is lost; the next poll reads again.++---++### Task 1: Tags are the Lead's notice; PM messages are quiet++**Files:**+- Modify: `cli/src/superTabs/readContract.ts` (Derived: `mentionsDigest?: string`)+- Modify: `cli/src/superTabs/reassemble.ts` (state.mentionsDigest from derived)+- Modify: `cli/src/superTabs/fixtures/read/index.ts` (pass `mentionsDigest` through `partsOf`)+- Modify: `cli/src/superTabs/cards.ts` (`watchNotices` → tags; `held` no longer answers from `notices`)+- Modify: `cli/src/core/api.ts` (`LeadNotice.chat`: add `'group'`)+- Modify: `cli/src/superTabs/inCore/cards.ts` (`NOTICE_CHATS` takes `group`)+- Test: `cli/src/superTabs/cards.spec.ts`++**Interfaces:**+- Produces: `SwarmLead.notice: LeadNotice` with `chat: 'lead' | 'pm' | 'group'`, `chatId` the tag's conversation,+ `id` the tag's id, `text` "Author: text" cut to RECAP_BYTES, `at` the tag's createdAt in seconds, `thread` the root+ when the tag is a thread reply.++- [ ] **Step 1: Write the failing tests** in a new `describe('SwarmCards tag notices')`, with the fake backend serving+ `/api/super-tabs/:tab/mentions?state=waiting` from a list the test holds and the Swarm read carrying `mentionsDigest`:+ - the first digest is a baseline: no notice, and no mentions read when it is the empty digest;+ - a new tag in a task thread becomes the project Lead's notice `{ chat: 'group', chatId: 'g-web', id: 'tag2',+ text: 'Sam: @me look', at, thread: 'r1' }`, read once;+ - nothing moved: no second mentions read and the same notice; a later digest move that adds no new id raises none;+ - a tag in the Lead conversation is `chat: 'lead'`, in the reader's Buddy chat `chat: 'pm'`;+ - two new tags for one project: the newest is the notice;+ - 20 new Lead messages across 5 projects in a poll stream, with the digest unmoved: no notice, no mentions read, and+ no Lead conversation page read for alerts;+ - after `want(false)` and `want(true)` the waiting tags are a fresh baseline: no notice;+ - a failed mentions read keeps the digest, is logged once, and the next poll raises the notice.+- [ ] **Step 2: Run** `cd cli && npx vitest run src/superTabs/cards.spec.ts -t 'tag notices'`. Expected: FAIL (no notice,+ or a Lead message notice).+- [ ] **Step 3: Update the old `SwarmCards notices` tests** that pin PM messages as notices, so they now say no notice+ comes from them, and the recap tests that answered from a Lead notice.+- [ ] **Step 4: Commit the failing tests.**+- [ ] **Step 5: Implement** `private async watchTags(): Promise<void>` in cards.ts, replacing the Lead and Buddy-chat+ part of `watchNotices` (the Buddy notices stay). State: `tagDigests: Map<string, string>`, `tagsSeen: Map<string,+ Set<string>>`, both cleared where `seen` is cleared. `held()` answers only from recaps and `buddyNotices`.+- [ ] **Step 6: Run** the cards spec and `src/superTabs/inCore` specs. Expected: PASS.+- [ ] **Step 7: Commit.**++### Task 2: Firmware takes task-chat tags++**Files:**+- Modify: `devices/harness-device/firmware/main/cable_client.c` (`handle_supertab_notice`: `group` → `HT_CHAT_GROUP`)+- Modify: `devices/harness-device/firmware/main/ui/habitat/ui_habitat.c` (`ui_supertab_notice` comment; grey line)+- Test: `devices/harness-device/firmware/test/test_cable_supertab.py`, `test_touch_ui.py`++- [ ] **Step 1: Write the failing tests:** a `group` notice reaches `ui_supertab_notice` with `HT_CHAT_GROUP` and beeps;+ an unknown kind (`"tag"`) is still dropped. In `test_touch_ui.py`: a group notice with its chat and thread on the face+ is read at once with no beep; the same chat on the face with another thread beeps; a second notice with the same id+ after it was read adds no beep (the daemon sends each once; the dial's count does not rise).+- [ ] **Step 2: Run** `devices/harness-device/firmware/test/run.sh`. Expected: FAIL at the group case.+- [ ] **Step 3: Commit the failing tests.**+- [ ] **Step 4: Implement:** accept `group` in `handle_supertab_notice`.+- [ ] **Step 5: Run** `run.sh`. Expected: PASS.+- [ ] **Step 6: Commit.**++### Task 3: The daemon sends a task chat's tag once++**Files:**+- Test: `cli/src/cable/cableSession.spec.ts`++- [ ] **Step 1: Pin it:** a `group` notice with thread `r1` goes to a swarmThread dial once, with its chat and thread; the+ same card again sends nothing; a new tag while the window has that thread open is read there and not sent. The cable+ session's rule is unchanged (one send per id, none for the chat and thread open), so this passes at once.+- [ ] **Step 2: Commit.**++### Task 4: Red/green evidence and the pull request++- [ ] Run the cards, inCore, cableSession specs, `npm run typecheck` in cli/, and the firmware's `run.sh`, on the+ fix and with the fix reverted, and post the red/green evidence as a pull request comment.+- [ ] The PR says that tags in task chats need a firmware release and that the PM-quiet part works on current firmware.diff --git a/docs/plans/2026-11-04-posts-reach-who-they-name-plan.md b/docs/plans/2026-11-04-posts-reach-who-they-name-plan.mdnew file mode 100644index 000000000..9083d0013--- /dev/null+++ b/docs/plans/2026-11-04-posts-reach-who-they-name-plan.md@@ -0,0 +1,100 @@+# Agent posts reach only who they name Implementation Plan++> Implemented by the task's Engineer task by task, each failing test committed before its code (project instructions,+> Engineer). One independent review on the pull request.++**Goal:** The PM is delivered an agent's post only when the post names it (task #2963, Ken, 2026-11-04). In a day of+production data the PM got 841 deliveries, 420 of them agent posts; 402 of 437 agent posts reached the PM as their only+recipient and only 1 named it.++**Architecture:** `message.send` in `backend/src/superTabs/commands.ts` decides an agent post's recipients on the+server, so every CLI, old or new, gets the same rule. Today an unnamed agent post falls back to a default addressee:+the coordinator, the task's owner, or the assignee, through five overlapping rules (`leadToWorker`, `workerToLead`,+`ownerToStepAgent`, `memberToLead`, the step owner). They are replaced by one rule:++- An agent post reaches the agents it names: `--to` (recipientIds) and `@Name` of an agent in the conversation+ (`mentions.ts`, an agent's display name or name, matched only when exactly one agent there has it and no person's+ username is the same).+- A reply reaches the agent who wrote the message it answers, when that agent reads the conversation.+- A post that names no one in a task or step reaches its current assignee, unless the poster is the assignee (River's+ ruling in the task thread, 2026-11-04: the worker owns that room).+- Nothing else: no default to the coordinator, the task's owner or anyone in the project chat. The post stays readable+ in its conversation and people's tags and thread notices are unchanged.++Status notices (done, needs_human, blocked, lost, stalled) are built by `work.status` and the liveness sweep, not by+`message.send`, so they still reach the PM. The PM-to-worker loop guard (`leadWorkerBounced`, `PAIR_CHAIN_LIMIT`) only+existed because worker posts bounced back to the PM by default; with the assignee's unnamed post reaching no one there is+no automatic round trip, so it is removed. The 20-message pair notice stays.++**Tech Stack:** TypeScript, vitest (backend unit tests on the in-memory command model), the CLI's skill texts.++**Spec:** task #2963's brief and River's ruling in its thread.++## Global Constraints++- Server-side only for delivery: older CLIs send the same `message.send` and get the new rule.+- People's deliveries (a person's post, tags, thread notices) do not change.+- Swarm code stays out of `cli/src/core`.+- No new stored data.++## Design++- growth: N/A because nothing new is stored; deliveries only shrink.+- concurrency: N/A because recipients are computed inside the existing command transaction.+- read cost: N/A because no read is added; `@Name` matching reads only the conversation's own agents, and only for a+ post that says `@`.+- scale: fewer deliveries per post; the warning metric is the PM's deliveries per hour, measured in the fixture below.+- compatibility: old clients send the same command; the server decides. An old CLI's help still says unnamed posts reach+ the PM; its delivered prompt already names the author with `--to` when replying, so its replies still arrive.+- migration + rollback: none; revert the commit.+- audience: the server picks recipients; a named agent must still be one the sender may name (`requireNameable`).+- identity: N/A because no login is used.+- failure: an unnamed post is not lost: it stays in its conversation for people and agents who read it. The skill texts+ and help say to name whoever must act.+- platforms: backend (Linux), the CLI's skill texts on every platform.++## Review Focus++- Every default to the coordinator is gone, including in steps, the project chat and for an agent whose task ended.+- A thread reply reaches its author agent; a reply to an agent that does not read the conversation is not forced in.+- `@Name` never shadows a person's tag and never resolves an ambiguous agent name.+- Status notices still reach the PM.++## Task 1: one rule for an agent post's recipients++**Files:** `backend/src/superTabs/commands.ts`, `backend/src/superTabs/mentions.ts`, `backend/src/superTabs/commands.test.ts`,+`backend/src/superTabs/steps.test.ts`++- [ ] Failing tests: an unnamed post in a task by its assignee or another agent reaches no agent; one naming the PM+ reaches only the PM; one naming another agent reaches only it; `@Name` names an agent; an unnamed post by the PM or+ an Engineer reaches the assignee; a thread reply reaches the author agent; in a step, an unnamed post by the+ Reviewer reaches nobody and the Engineer's reaches the Reviewer; in the project chat an agent's line reaches nobody.+- [ ] Watch them fail.+- [ ] Replace the five defaults with the rule above; remove `leadWorkerBounced` and `PAIR_CHAIN_LIMIT`.+- [ ] Update the existing tests that asserted the old defaults.++## Task 2: status still reaches the PM++**Files:** `backend/src/superTabs/commands.test.ts`++- [ ] A test that done, needs_human, blocked and lost notices still reach the coordinator after the change (passes on+ both sides; it guards the rule).++## Task 3: the PM's deliveries per hour++**Files:** `backend/src/superTabs/commands.test.ts`++- [ ] A fixture day shaped like Ken's data (assignee reports, verdicts, acknowledgements, project-chat lines, one post+ naming the PM, a few replies to the PM) counts the PM's deliveries per hour. Run on main for the before number, on+ the branch for the after.++## Task 4: the texts say the new rule++**Files:** `cli/src/lib/swarmTools.ts`, `cli/src/lib/swarmSkills.ts`, `cli/src/superTabs/service.ts` (post help),+`cli/src/superTabs/command.ts`, `cli/src/superTabs/host.ts` (comments), `backend/src/superTabs/instructionsTemplate.ts`+(workflow), `backend/src/superTabs/commands.ts` (project-chat refusal text), and their specs.++- [ ] Failing spec lines for the new wording in swarmTools and swarmSkills.+- [ ] Rewrite "Who a post reaches" in swarm-tools and each role skill (Lead, Engineer, Reviewer, both sets); the post+ help; the workflow template: verdicts go to the Engineer by name, results reach the PM through status, never by a+ post to the PM.diff --git a/docs/swarms.md b/docs/swarms.mdindex 15b159d78..e2cde4286 100644--- a/docs/swarms.md+++ b/docs/swarms.md@@ -873,19 +873,20 @@ Agents talk to each other directly, not through the product manager- A post that names agents reaches exactly them: no copy goes to the productmanager. On 2026-10-30 such copies were 198 of the 486 messages it received ina day.-- A post that names no one goes to its default addressee: an agent's to the- project's coordinator (the product manager unless the project names it- otherwise), the coordinator's to the task's assigned agent, a person's as- before. It is never lost: the post is written, and the coordinator gets it as a- notice (see [Notices to the coordinator](#notices-to-the-coordinator)). On- 2026-10-29 a monitoring agent's "the backend worker is down" alarm named no- one and reached nobody for 4 h 50 min.+- An agent also names an agent of the conversation by `@Name` in its text: its+ display name or name, when exactly one agent there goes by it and no person's+ username is the same. A reply reaches the agent who wrote the message it+ answers.+- An agent's post that names no one reaches, in a task or step, that+ conversation's current assignee (unless the poster is the assignee), and+ anywhere else no agent (task #2963). It is written and stays readable in its+ conversation; the people it tags are told. The coordinator is delivered an+ agent's post only when it is named, and hears the work through status (done,+ needs a human, stuck, lost, stalled). Until 2026-11-04 an unnamed post went to+ the coordinator: in a day 402 of 437 agent posts reached the product manager+ as their only recipient, and only 1 named it.- A person's message is unchanged: it reaches the agent it addresses, or thecoordinator when it addresses none.-- The coordinator's unnamed posts to its assigned agent keep their bounce limit- (`leadWorkerBounced`): once the two have exchanged 6 messages in a row, with- no person or other agent between, its next unnamed post reaches nobody until- it names the agent.- Agents of another project, Buddies, Buddy chats, private chats, the projectchat keep their own members; naming an agent thereis refused with `INVALID_RECIPIENT`. Only the coordinator or a person adds an@@ -904,9 +905,10 @@ Design:- Read cost: the loop count reads the conversation's 20 newest messages, theread a message already made for 6.- Scale: delivery rows per message equal the agents named, at most 16.-- Compatibility: an older CLI names no one, so its posts keep their old- addressee and reach the coordinator as before; a newer CLI on an older- backend is refused only when it names an agent outside the conversation.+- Compatibility: the server picks the recipients, so an older CLI's unnamed+ post follows the same rule; its delivered prompt already names the author it+ replies to. A newer CLI on an older backend is refused only when it names an+ agent outside the conversation.- Migration and rollback: none; a rollback restores the copies.- Audience: the server checks the recipient belongs to the same project and theconversation is not a Buddy chat, the project chat or@@ -914,7 +916,8 @@ Design:needs no role.- Identity: messages stay the agent's own.- Failure: a refused recipient is an `INVALID_RECIPIENT` error to the sender; a- post that names no one is delivered as a notice, not dropped.+ post that names no one is written to its conversation, where people and its+ agents read it.- Platforms: server-side; the same everywhere.## Notices to the coordinator@@ -1283,8 +1286,8 @@ advice) ships in the same order, and its parts need each other:- Then Desktop and the web app, then the phone. A newer client on an olderbackend finds no `coordinatorName`: it shows no Instructions and sends no`roleName`, and everything else works as before.-- An older CLI on a newer backend names no one, so its posts reach the- coordinator as before, and its `rule.set` lands in the Routing section of the+- An older CLI on a newer backend names no one, so its unnamed posts follow the+ server's rule (task #2963), and its `rule.set` lands in the Routing section of theinstructions. An older Desktop's role, skill-set and policy saves are acceptedand ignored (see [Routing](#routing)).- A machine on an older CLI that is sent an agent by a newer one installs the