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-03 ba: #2636 #2631 (#2665)
0xken15428246d61f8a
diff --git a/backend/integration/superTabBuddies.test.ts b/backend/integration/superTabBuddies.test.tsindex 0c309ba69..bc4931f21 100644--- a/backend/integration/superTabBuddies.test.ts+++ b/backend/integration/superTabBuddies.test.ts@@ -692,7 +692,9 @@ describe('naming a Buddy through the store (Diego, 10-29)', () => {it('refuses the name of an agent still starting (review of #2094)', async () => {const f = await swarm()- await f.execute({ type: 'agent.start', request: { conversationId: 'lead', machineId: 'peer-mac', engine: 'claude', name: 'Sparky', cwd: '/swarm/lead',+ // Into a task: no agent but its coordinator starts into the project chat (#2207).+ const group = String((await f.execute({ type: 'conversation.create', projectId: 'lead', title: 'Parser', brief: '', checks: [] }, peer)).result.conversationId)+ await f.execute({ type: 'agent.start', request: { conversationId: group, machineId: 'peer-mac', engine: 'claude', name: 'Sparky', cwd: '/swarm/lead',worktree: true, requirements: { memoryBytes: 0, diskBytes: 0, maxCpuPercent: 100, tools: [], devices: [], quotaRequired: false } } } as Command, peer)const mine = String((await f.execute({ type: 'buddy.chat', projectId: 'lead' }, peer)).result.conversationId)await expect(rename(f, mine, 'sparky')).rejects.toThrow('taken')diff --git a/backend/integration/superTabGithub.test.ts b/backend/integration/superTabGithub.test.tsindex bbfeecf33..faeb602d1 100644--- a/backend/integration/superTabGithub.test.ts+++ b/backend/integration/superTabGithub.test.ts@@ -304,9 +304,10 @@ describe('a queued start\'s preparation token', () => {const pool = (await poolRows(env.store, team, machineId)).find(p => p.tabId === tab)!await env.store.observeMachine(team, tab, machineId, { generation: pool.machine.generation, ...observed, privacy: { mode: 'dedicated' } })}- // A group [requester] asked for, its start's conversation; else the Lead's. The contributor joined above.- const conversationId = requester ? String((await env.run(tab, { type: 'conversation.create', title: 'Add search', brief: 'Add a search field',- checks: [], requesterId: requester.sub } as Command)).result.conversationId) : 'lead'+ // A group of the project, its start's conversation: no agent but the coordinator starts into the project chat (#2207).+ // [requester] asked for it, where given. The contributor joined above.+ const conversationId = String((await env.run(tab, { type: 'conversation.create', title: 'Add search', brief: 'Add a search field',+ checks: [], ...(requester ? { requesterId: requester.sub } : {}) } as Command)).result.conversationId)const startId = String((await env.run(tab, { type: 'agent.start', request: { conversationId, machineId, engine: 'codex', name: 'Builder',cwd: '/swarm-root/lead', permissionMode: 'full', worktree: true, requirements: { memoryBytes: 0, diskBytes: 0, maxCpuPercent: 100, tools: [], devices: [], quotaRequired: false } } } as Command)).result.startId)return { tab, startId }diff --git a/backend/integration/superTabLiveness.test.ts b/backend/integration/superTabLiveness.test.tsindex b52f11bdf..17f6af5d1 100644--- a/backend/integration/superTabLiveness.test.ts+++ b/backend/integration/superTabLiveness.test.ts@@ -1068,26 +1068,29 @@ describe('an agent whose task was lost', () => {})describe('a start that never runs', () => {- /** The Lead starts "Builder" on Worker Mac, and Worker Mac launches it. */+ /** The Lead starts "Builder" on Worker Mac for a second task, and Worker Mac launches it. A task: no agent but its coordinator+ * starts into the project chat (#2207). */const launch = async (f: Awaited<ReturnType<typeof swarm>>) => {+ const group = String((await f.execute({ type: 'conversation.create', title: 'Write the docs', brief: 'Document it',+ checks: [{ description: 'Read', independent: false }] })).result.conversationId)const decision = { assessment: { difficulty: 'low', risk: 'low', why: 'Small task.' },candidates: [{ id: 'c0', kind: 'new', machineId: 'test-host', engine: 'codex', model: 'fixture-model', effort: 'high',quality: 2, cost: 2, title: 'New agent', label: 'New agent' }],excluded: [], floor: 1, notes: false, pick: 'c0', via: 'only', p: null, belowFloor: false, why: 'Only candidate.' }- const routeDecisionId = String((await f.execute({ type: 'route.record', conversationId: 'lead', decision } as Command, host, f.lead)).result.routeDecisionId)- const request = { conversationId: 'lead', machineId: 'test-host', engine: 'codex', model: 'fixture-model', effort: 'high', name: 'Builder',+ const routeDecisionId = String((await f.execute({ type: 'route.record', conversationId: group, decision } as Command, host, f.lead)).result.routeDecisionId)+ const request = { conversationId: group, machineId: 'test-host', engine: 'codex', model: 'fixture-model', effort: 'high', name: 'Builder',cwd: '/repo', worktree: false, requirements: { memoryBytes: 0, diskBytes: 0, maxCpuPercent: 100, tools: [], devices: [], quotaRequired: false } }const startId = String((await f.execute({ type: 'agent.start', request, routeDecisionId } as Command, host, f.lead)).result.startId)// The start's own machine dispatches and confirms it.const onMachine = (command: Command) => f.timed.execute(host, f.tab, { operationId: randomUUID(), command }, undefined, 'test-host')await onMachine({ type: 'agent.startDispatch', startId })- return { startId, onMachine }+ return { group, startId, onMachine }}it('fails 3 minutes after dispatch, naming its machine to its Lead only, and tells the Lead in its group', async () => {const f = await swarm()await f.beat(f.clock.now)- const { startId, onMachine } = await launch(f)+ const { group, startId, onMachine } = await launch(f)const dispatched = f.clock.nowf.clock.now = dispatched + 3 * MINUTEawait f.leadInbox()@@ -1096,7 +1099,7 @@ describe('a start that never runs', () => {f.clock.now = dispatched + 3 * MINUTE + 30_001const told = (await f.leadInbox()).find(m => (m.source as { kind?: string }).kind === 'start-timeout')!// Every group member reads the notice, so it names no machine (review of #1847); the start's Lead reads which one.- expect(told).toMatchObject({ conversationId: 'lead', text: 'Could not start Builder on fixture-model: its machine did not start it within 3 minutes.' })+ expect(told).toMatchObject({ conversationId: group, text: 'Could not start Builder on fixture-model: its machine did not start it within 3 minutes.' })expect((await f.timed.start(host, f.tab, startId, f.lead)).error).toBe('Worker Mac did not start it within 3 minutes')await expect(onMachine({ type: 'agent.started', startId, harnessId: randomUUID(), configuration: config })).rejects.toMatchObject({ code: 'START_FAILED' })@@ -1105,7 +1108,7 @@ describe('a start that never runs', () => {it('waits while its own machine reports it preparing, shows the Lead it is preparing, and fails it after 15 minutes', async () => {const f = await swarm()await f.beat(f.clock.now)- const { startId } = await launch(f)+ const { group, startId } = await launch(f)const dispatched = f.clock.nowconst ownerState = async () => (await f.timed.read(owner, f.tab)).state// Another machine cannot keep it waiting, and a machine keeps only its own launched starts in its report.@@ -1127,7 +1130,7 @@ describe('a start that never runs', () => {await f.observe('test-host', [f.harness.worker], { preparingStartIds: [startId] })await f.observe('lead-host', [f.harness.lead])const told = (await f.leadInbox()).find(m => (m.source as { kind?: string }).kind === 'start-timeout')!- expect(told).toMatchObject({ conversationId: 'lead', text: 'Could not start Builder on fixture-model: its machine was still preparing it after 15 minutes.' })+ expect(told).toMatchObject({ conversationId: group, text: 'Could not start Builder on fixture-model: its machine was still preparing it after 15 minutes.' })expect((await f.timed.start(host, f.tab, startId, f.lead)).error).toBe('Worker Mac was still preparing it after 15 minutes')expect((await ownerState()).starts!.find(s => s.id === startId)!.error).toBe('Its machine was still preparing it after 15 minutes.')expect((await ownerState()).starts!.find(s => s.id === startId)).not.toHaveProperty('preparing')@@ -2367,6 +2370,20 @@ describe('a session reopened after its agent was removed', () => {expect((await state(f)).agents.filter(a => a.id === f.idle)).toHaveLength(1)})+ // Reviews of #2207 (Cleo, Orion, Luna, Echo): a report closed and reopened sessions with no row, so an agent could come back to+ // read its chats unrecorded. Each chat it leaves or rejoins says so, written as the agent, waking nobody.+ it('says in its group that it left when its session closed, and that it rejoined when the session reopened', async () => {+ const f = await removed()+ const said = async () => (await db.superTabMessage.findMany({ where: { tabId: f.tab, conversationId: f.group }, orderBy: { sequence: 'asc' } }))+ .filter(m => m.text.startsWith('"Idle one"')).map(m => [m.text, m.recipientIds])+ expect(await said()).toEqual([['"Idle one" left: its session closed.', []]])+ await resume(f)+ expect(await said()).toEqual([['"Idle one" left: its session closed.', []], ['"Idle one" rejoined: its session reopened.', []]])+ // A report that changes nothing says nothing again.+ await resume(f)+ expect(await said()).toHaveLength(2)+ })+it('stays out while the report does not list it running', async () => {const f = await removed()f.clock.now += MINUTEdiff --git a/backend/integration/superTabProfile.test.ts b/backend/integration/superTabProfile.test.tsindex 2a698618b..8c1ee048b 100644--- a/backend/integration/superTabProfile.test.ts+++ b/backend/integration/superTabProfile.test.ts@@ -413,7 +413,8 @@ describe('reactions', () => {it('shows an agent\'s 👀 and then ✅ on the message it took, to every reader of the conversation', async () => {const tab = await swarm()- const builder = await agentIn(tab, 'lead', 'Kai')+ // Kai coordinates: the project chat holds only its coordinator among agents (#2207).+ const builder = await agentIn(tab, 'lead', 'Kai', true)const messageId = await post(tab, 'Kai, please add avatars.')await agentReact(tab, 'lead', messageId, builder, 'eyes')expect(await countsOf(tab, messageId, peer)).toEqual([{ emoji: 'eyes', count: 1, by: [{ kind: 'agent', id: builder }] }])@@ -439,14 +440,16 @@ describe('reactions', () => {const parts = await read(tab, peer)expect(parts.text).not.toContain(conversationId)// An agent outside the private project is not even told it exists, and another agent's private notice is not there for it to mark.- const builder = await agentIn(tab, 'lead', 'Kai')+ // Both agents share a task, as the project chat holds only its coordinator among agents (#2207).+ const group = (await run(tab, { type: 'conversation.create', title: 'Avatars', brief: 'Add avatars.', checks: [] })).result.conversationId as string+ const builder = await agentIn(tab, group, 'Kai')await expect(agentReact(tab, conversationId, secret, builder, 'eyes')).rejects.toMatchObject({ code: 'NOT_FOUND', status: 404 })- const lead = await agentIn(tab, 'lead', 'River', true)- const notice = (await run(tab, { type: 'message.send', conversationId: 'lead', text: 'Your skill changed.', replyTo: null, recipientIds: [lead],+ const lead = await agentIn(tab, group, 'River', true)+ const notice = (await run(tab, { type: 'message.send', conversationId: group, text: 'Your skill changed.', replyTo: null, recipientIds: [lead],agentOnly: true }, owner, lead)).result.messageId as string- await expect(agentReact(tab, 'lead', notice, builder, 'eyes')).rejects.toMatchObject({ code: 'NOT_FOUND' })- await agentReact(tab, 'lead', notice, lead, 'eyes')- expect((await page(tab, peer)).map(m => m.id)).not.toContain(notice)+ await expect(agentReact(tab, group, notice, builder, 'eyes')).rejects.toMatchObject({ code: 'NOT_FOUND' })+ await agentReact(tab, group, notice, lead, 'eyes')+ expect(((await read(tab, peer, `conversations/${group}/messages`)).body.data.messages as Array<{ id: string }>).map(m => m.id)).not.toContain(notice)})})diff --git a/backend/integration/superTabs.test.ts b/backend/integration/superTabs.test.tsindex aa86b401e..2e279ab79 100644--- a/backend/integration/superTabs.test.ts+++ b/backend/integration/superTabs.test.ts@@ -50,7 +50,9 @@ async function fixture() {name: 'Lead', configuration: config, lead: true })).result.agentId as stringreturn { tab, lead }}-async function routedStart(tab: string, lead: string, role?: 'reviewer', model = 'fixture-model', conversationId = 'lead') {+async function routedStart(tab: string, lead: string, role?: 'reviewer', model = 'fixture-model', conversationId?: string) {+ // In a new task unless one is named: no agent but its coordinator starts into the project chat (#2207).+ conversationId ??= String((await run(tab, { type: 'conversation.create', title: 'Routed work', brief: '', checks: [] })).result.conversationId)const decision = { assessment: { difficulty: 'low', risk: 'low', why: 'Small task.' },candidates: [{ id: 'c0', kind: 'new', machineId: 'test-host', engine: 'codex', model, effort: 'high',quality: 2, cost: 2, title: 'New agent', label: 'New agent' }],@@ -60,8 +62,12 @@ async function routedStart(tab: string, lead: string, role?: 'reviewer', model =name: 'Builder', cwd: '/fixture/repo', worktree: false, ...(role ? { role } : {}),requirements: { memoryBytes: 0, diskBytes: 0, maxCpuPercent: 100, tools: [], devices: [], quotaRequired: false } }const startId = String((await run(tab, { type: 'agent.start', request, routeDecisionId } as Command, host, lead)).result.startId)- return { routeDecisionId, startId }+ return { routeDecisionId, startId, conversationId }}+/** Whether [row] is the row naming who added or removed an agent in a chat, or that it joined or left (#2207): the fixture's+ * project chat opens with "owner added <Lead>.". */+const memberRow = (row: { text: string; source?: unknown }) => (row.source as { kind?: string } | null | undefined)?.kind === 'system' &&+ /^[^.]+ (added|removed) [^.]+\.$|^[^.]+ (joined|left)\.$/.test(row.text)const message = (text: string): Command => ({ type: 'message.send', conversationId: 'lead', text, replyTo: null, recipientIds: [] })/** Makes [machineId], a machine of `host`'s, one used only for agents (`harness team on`) for this test: its account row* is a team machine and it reports from its team session with that privacy, so it may take the owner's projects@@ -103,6 +109,14 @@ async function saveState(tab: string, state: SuperTabState) {sequenceBase: current.sequenceBase })})}+/** Stores [agentId] in the project chat [conversationId] as a Swarm from before #2207 holds one there: it stays until+ * removed, though no command adds an agent but the coordinator there now. */+async function seat(tab: string, agentId: string, conversationId = 'lead') {+ const state = await storedState(tab)+ const chat = state.conversations.find(c => c.id === conversationId)!+ if (!chat.agentIds.includes(agentId)) chat.agentIds.push(agentId)+ await saveState(tab, state)+}async function invite(tab: string, role: 'collaborator' | 'viewer' = 'collaborator') {const invitation = await run(tab, { type: 'invite.create', email: peer.email, role, conversationId: 'lead' })await run(tab, { type: 'invite.accept', inviteId: invitation.result.inviteId as string }, peer)@@ -456,13 +470,15 @@ describe('native recording restart recovery', () => {it('does not notify for a worker without an assignment', async () => {const { tab } = await fixture()- const worker = (await run(tab, { type: 'agent.add', conversationId: 'lead', machineId: 'test-host', harnessId: randomUUID(),+ // In a task: the project chat holds only its coordinator among agents (#2207).+ const group = String((await run(tab, { type: 'conversation.create', title: 'Idle task', brief: '', checks: [] })).result.conversationId)+ const worker = (await run(tab, { type: 'agent.add', conversationId: group, machineId: 'test-host', harnessId: randomUUID(),name: 'Idle Engineer', configuration: config, lead: false })).result.agentId as string- const { contextId } = await store.native.open(owner, tab, { operationId: randomUUID(), conversationId: 'lead', agentId: worker })+ const { contextId } = await store.native.open(owner, tab, { operationId: randomUUID(), conversationId: group, agentId: worker })const receipt = await store.native.append(host, tab, contextId, { turnId: 'idle_restart', kind: 'gap', previousEventId: null,text: '', truncated: false, interrupted: false,gap: { incidentId: 'idle_restart', reason: 'recording_restarted', detectedAt: Date.now() + 1000 } }) as { eventId: string }- expect((await store.read(owner, tab)).state.conversations[0]!.assignment).toBeNull()+ expect((await store.read(owner, tab)).state.conversations.find(c => c.id === group)!.assignment).toBeNull()expect(await db.superTabDelivery.findMany({ where: { messageId: receipt.eventId } })).toEqual([])})})@@ -553,7 +569,8 @@ describe('person removal notices', () => {checks: [{ description: 'Draft survives reconnect', independent: false }] })).result.conversationId as stringconst worker = (await run(tab, { type: 'agent.add', conversationId: group, machineId: 'test-host', harnessId: randomUUID(),name: 'Draft worker', configuration: config, lead: false })).result.agentId as string- await run(tab, { type: 'conversation.agent', conversationId: 'lead', agentId: worker, present: true, lead: false })+ // A member of the project chat stored before #2207, so the removal tells its coordinator there too.+ await seat(tab, worker)await run(tab, { type: 'work.assign', conversationId: group, agentId: worker })const operationId = randomUUID(), command: Command = { type: 'agent.remove', agentId: worker }const first = await run(tab, command, owner, undefined, operationId)@@ -583,6 +600,8 @@ describe('agent member identities', () => {expect(agent.displayName).not.toBe('Lead')expect(await run(tab, command, owner, undefined, operationId)).toEqual(added)expect((await store.read(owner, tab)).lastChangedAt).toBe(first.lastChangedAt)+ // Posting there as a member of the project chat stored before #2207 (agent.add no longer seats it there).+ await seat(tab, agentId)await run(tab, message('The plan is ready.'), host, agentId)await run(tab, { type: 'agent.remove', agentId })const rows = (await store.messages(owner, tab, 'lead', {})).messages@@ -659,7 +678,9 @@ describe('deleting abandoned swarm projects', () => {// Scholes's goals, piece 5: the heavy work a start declares is stored with it and read back, so later routes count it.it('stores the heavy work a start declares and reads it back with the start and the Super Tab', async () => {const { tab } = await fixture()- const { conversationId } = (await run(tab, { type: 'project.create', name: 'Heavy start', visibility: 'public', brief: '' })).result as { conversationId: string }+ const { projectId } = (await run(tab, { type: 'project.create', name: 'Heavy start', visibility: 'public', brief: '' })).result as { projectId: string }+ // In a task of the project: the project chat holds only its coordinator among agents (#2207).+ const conversationId = String((await run(tab, { type: 'conversation.create', projectId, title: 'Build', brief: '', checks: [] })).result.conversationId)const request = { conversationId, machineId: 'test-host', engine: 'codex', name: 'Builder', cwd: '/work', worktree: true, heavy: ['build'],requirements: { memoryBytes: 4e9, diskBytes: 15e9, maxCpuPercent: 100, tools: [], devices: [], quotaRequired: false } }const startId = String((await run(tab, { type: 'agent.start', request } as Command)).result.startId)@@ -669,7 +690,9 @@ describe('deleting abandoned swarm projects', () => {it('refuses pending starts and prevents a failed start from joining after deletion', async () => {const { tab } = await fixture()- const { projectId, conversationId } = (await run(tab, { type: 'project.create', name: 'Failed start', visibility: 'public', brief: '' })).result as { projectId: string; conversationId: string }+ const { projectId } = (await run(tab, { type: 'project.create', name: 'Failed start', visibility: 'public', brief: '' })).result as { projectId: string }+ // In a task of the project: the project chat holds only its coordinator among agents (#2207).+ const conversationId = String((await run(tab, { type: 'conversation.create', projectId, title: 'Build', brief: '', checks: [] })).result.conversationId)const request = { conversationId, machineId: 'test-host', engine: 'codex', name: 'Builder', cwd: '/work', worktree: true,requirements: { memoryBytes: 0, diskBytes: 0, maxCpuPercent: 100, tools: [], devices: [], quotaRequired: false } }const startId = String((await run(tab, { type: 'agent.start', request })).result.startId)@@ -730,7 +753,10 @@ describe('private swarm projects on the real control API', () => {engines: ['codex'], maxAgents: 2 }, host)await expect(run(tab, { type: 'tab.project', machineId, project: { cwd: '/unrelated', repositoryUrl: null } })).rejects.toMatchObject({ code: 'HOST_REQUIRED' })- const request = { conversationId, machineId, engine: 'codex', name: 'Builder',+ // Builders start in each project's task: the project chat holds only its coordinator among agents (#2207).+ const task = String((await run(tab, { type: 'conversation.create', projectId, title: 'Second work', brief: '', checks: [] })).result.conversationId)+ const leadTask = String((await run(tab, { type: 'conversation.create', title: 'Lead work', brief: '', checks: [] })).result.conversationId)+ const request = { conversationId: task, machineId, engine: 'codex', name: 'Builder',cwd: `/swarm-root/${projectId}`, worktree: true,requirements: { memoryBytes: 0, diskBytes: 0, maxCpuPercent: 100, tools: [], devices: [], quotaRequired: false } }await expect(run(tab, { type: 'agent.start', request })).rejects.toMatchObject({ code: 'PROJECT_CONTRIBUTION' })@@ -745,12 +771,12 @@ describe('private swarm projects on the real control API', () => {await expect(run(tab, { type: 'agent.start', request: { ...request, cwd: '/swarm-root/lead' } })).rejects.toMatchObject({ code: 'OUTSIDE_CONTRIBUTION' })const secondStart = (await run(tab, { type: 'agent.start', request })).result.startId as string- await run(tab, { type: 'agent.start', request: { ...request, conversationId: 'lead', cwd: '/swarm-root/lead' } })+ await run(tab, { type: 'agent.start', request: { ...request, conversationId: leadTask, cwd: '/swarm-root/lead' } })const queued = (await poolRows(store, team.session, machineId))[0]!expect(queued.starts).toHaveLength(2)expect(queued.projects!.find(p => p.id === projectId)).toMatchObject({repository: { machineId: 'test-host', cwd: '/lead/second', repositoryUrl: 'https://github.com/example/second' },- conversationIds: [conversationId],+ conversationIds: [conversationId, task],})expect((await store.read(host, tab)).state.projects!.some(p => p.id === projectId)).toBe(false)const hostRun = (command: Command) => store.execute(team.session, tab, { operationId: randomUUID(), command }, undefined, machineId)@@ -758,7 +784,8 @@ describe('private swarm projects on the real control API', () => {const started = await hostRun({ type: 'agent.started', startId: secondStart, harnessId: 'second-builder', configuration: config })await hostRun({ type: 'agent.startSettled', startId: secondStart, warning: null })const agentId = String(started.result.agentId)- expect((await store.read(team.session, tab, agentId)).state.conversations.map(c => c.id)).toEqual([conversationId])+ // Its project's chat and the task it started in, nothing of the other project's.+ expect((await store.read(team.session, tab, agentId)).state.conversations.map(c => c.id)).toEqual([conversationId, task])await expect(store.messages(team.session, tab, 'lead', {}, agentId)).rejects.toMatchObject({ code: 'NOT_FOUND' })expect(await db.machineShare.findUnique({ where: { machineId } })).toBeNull()})@@ -771,14 +798,16 @@ describe('private swarm projects on the real control API', () => {const harnessId = randomUUID()const agentId = String((await run(tab, { type: 'agent.add', conversationId, machineId: 'test-host', harnessId,name: 'Private lead', configuration: config, lead: true })).result.agentId)- // Its terminal observers are checked on a Builder's terminal: nobody but its machine's owner watches a Lead (Critical 1).+ // Its terminal observers are checked on a Builder's terminal: nobody but its machine's owner watches a Lead (Critical 1). The+ // Builder is in the project's task, as the project chat holds only its coordinator among agents (#2207).const workerHarness = randomUUID()- const workerId = String((await run(tab, { type: 'agent.add', conversationId, machineId: 'test-host', harnessId: workerHarness,+ const task = String((await run(tab, { type: 'conversation.create', projectId, title: 'Private work', brief: '', checks: [] })).result.conversationId)+ const workerId = String((await run(tab, { type: 'agent.add', conversationId: task, machineId: 'test-host', harnessId: workerHarness,name: 'Private builder', configuration: config, lead: false })).result.agentId)await run(tab, { ...message('Private result'), conversationId } as Command)expect((await store.read(peer, tab)).state.projects!.map(p => p.id)).not.toContain(projectId)await expect(store.messages(peer, tab, conversationId, {})).rejects.toMatchObject({ code: 'NOT_FOUND' })- await expect(store.native.open(peer, tab, { operationId: randomUUID(), conversationId, agentId: workerId })).rejects.toMatchObject({ code: 'NOT_FOUND' })+ await expect(store.native.open(peer, tab, { operationId: randomUUID(), conversationId: task, agentId: workerId })).rejects.toMatchObject({ code: 'NOT_FOUND' })expect(await store.mayObserve(peer, tab, 'test-host', workerHarness, host.sub)).toBe(false)expect((await rosterRows(store, host, 'test-host')).find(t => t.agent?.id === workerId)!.observers.map(p => p.userId)).not.toContain(peer.sub)await expect(store.messages(host, tab, 'lead', {}, agentId)).rejects.toMatchObject({ code: 'NOT_FOUND' })@@ -787,7 +816,7 @@ describe('private swarm projects on the real control API', () => {expect((await store.messages(peer, tab, conversationId, {})).messages.map(m => m.text)).toContain('Private result')expect(await store.mayObserve(peer, tab, 'test-host', workerHarness, host.sub)).toBe(true)// A member's terminal, also on the Builder: only its machine's owner drives a Lead.- const context = await store.native.open(peer, tab, { operationId: randomUUID(), conversationId, agentId: workerId })+ const context = await store.native.open(peer, tab, { operationId: randomUUID(), conversationId: task, agentId: workerId })const command = { ...message('Shared review'), conversationId } as Commandconst operationId = randomUUID()await run(tab, command, peer, undefined, operationId)@@ -826,7 +855,8 @@ describe('private swarm projects on the real control API', () => {const polls = await Promise.all(Array.from({ length: 3 }, () => updates()))const ids = new Set(polls.flat().map(d => d.id))expect(ids.size).toBe(1)- expect((await chat()).map(m => (m.source as Record<string, unknown>)?.kind)).toEqual(['update-request'])+ // After the row naming who added the Lead (#2207).+ expect((await chat()).map(m => (m.source as Record<string, unknown>)?.kind)).toEqual(['system', 'update-request'])await execute({ ...message('New evidence'), conversationId: group } as Command)now += 900_000expect((await updates()).map(d => d.id)).toEqual([...ids])@@ -1017,7 +1047,9 @@ describe('Super Tabs on a real Mongo replica set', () => {await store.observeMachine(team.session, tab, 'skills-host', { generation, resources: { cpuPercent: 10, memoryTotalBytes: 32e9, memoryUsedBytes: 4e9,diskFreeBytes: 120e9, diskTotalBytes: 500e9, projectDiskFreeBytes: 120e9, deviceType: 'Laptop', chip: 'Fixture CPU', os: 'macOS', gpuPercent: null },quotas: [], tools: { git: true }, runningHarnessIds: [], stoppedHarnessIds: [], privacy: team.privacy })- const start = async () => String((await run(tab, { type: 'agent.start', request: { conversationId: 'lead', machineId: 'skills-host', engine: 'claude',+ // Started in a task: the project chat holds only its coordinator among agents (#2207).+ const task = String((await run(tab, { type: 'conversation.create', title: 'Skills work', brief: '', checks: [] })).result.conversationId)+ const start = async () => String((await run(tab, { type: 'agent.start', request: { conversationId: task, machineId: 'skills-host', engine: 'claude',name: 'Builder', cwd: '/project', worktree: true,requirements: { memoryBytes: 0, diskBytes: 0, maxCpuPercent: 100, tools: [], devices: [], quotaRequired: false } } })).result.startId)const skillMode = async (startId: string) => (await store.start(team.session, tab, startId, undefined, 'skills-host')).skillMode@@ -1049,7 +1081,9 @@ describe('Super Tabs on a real Mongo replica set', () => {projectDiskFreeBytes: 120e9, deviceType: 'Laptop', chip: 'Fixture CPU', os: 'macOS', gpuPercent: null }, quotas: [], tools: { git: true }, runningHarnessIds: [], stoppedHarnessIds: [] }await expect(store.observeMachine(owner, tab, 'pool-host', observation)).rejects.toMatchObject({ code: 'CONTRIBUTION_REVOKED' })await store.observeMachine(team.session, tab, 'pool-host', { ...observation, privacy: team.privacy })- const request = { permissionMode: 'full', conversationId: 'lead', machineId: 'pool-host', engine: 'codex', name: 'Builder', cwd: '/project', worktree: true,+ // Started and assigned in a task: the project chat holds only its coordinator among agents (#2207).+ const task = String((await run(tab, { type: 'conversation.create', title: 'Pool work', brief: '', checks: [] })).result.conversationId)+ const request = { permissionMode: 'full', conversationId: task, machineId: 'pool-host', engine: 'codex', name: 'Builder', cwd: '/project', worktree: true,requirements: { memoryBytes: 0, diskBytes: 0, maxCpuPercent: 100, tools: [], devices: [], quotaRequired: false } }await expect(run(tab, { type: 'agent.start', request: { ...request, cwd: '/private' } })).rejects.toMatchObject({ code: 'OUTSIDE_CONTRIBUTION' })await expect(run(tab, { type: 'agent.start', request: { ...request, permissionMode: 'bypassPermissions' } })).rejects.toMatchObject({ code: 'OUTSIDE_CONTRIBUTION' })@@ -1071,7 +1105,7 @@ describe('Super Tabs on a real Mongo replica set', () => {await expect(hostRun({ type: 'agent.startDispatch', startId })).rejects.toMatchObject({ code: 'START_CLAIMED' })await hostRun({ type: 'agent.started', startId, harnessId: 'pool-builder', configuration: config })const pendingAgent = (await store.read(owner, tab)).state.agents[0]!- await expect(run(tab, { type: 'work.assign', conversationId: 'lead', agentId: pendingAgent.id })).rejects.toMatchObject({ code: 'START_PENDING' })+ await expect(run(tab, { type: 'work.assign', conversationId: task, agentId: pendingAgent.id })).rejects.toMatchObject({ code: 'START_PENDING' })await expect(run(tab, contribute, host)).rejects.toMatchObject({ code: 'STARTS_PENDING' })await expect(run(tab, { type: 'agent.startSettled', startId, warning: null })).rejects.toMatchObject({ code: 'HOST_REQUIRED' })await hostRun({ type: 'agent.startSettled', startId, warning: null })@@ -1100,7 +1134,9 @@ describe('Super Tabs on a real Mongo replica set', () => {await store.observeMachine(team.session, tab, 'health-host', observation)const pool = async () => (await store.read(owner, tab)).state.machines!.find(m => m.machineId === 'health-host')! as Record<string, any>expect((await pool()).observation.quotaReasons).toEqual({ codex: 'OpenAI could not be reached.' })- const request = { permissionMode: 'full', conversationId: 'lead', machineId: 'health-host', engine: 'codex', name: 'Builder', cwd: '/project', worktree: true,+ // Started in a task: the project chat holds only its coordinator among agents (#2207).+ const task = String((await run(tab, { type: 'conversation.create', title: 'Health work', brief: '', checks: [] })).result.conversationId)+ const request = { permissionMode: 'full', conversationId: task, machineId: 'health-host', engine: 'codex', name: 'Builder', cwd: '/project', worktree: true,requirements: { memoryBytes: 0, diskBytes: 0, maxCpuPercent: 100, tools: [], devices: [], quotaRequired: false } }const hostRun = (command: Command) => store.execute(team.session, tab, { operationId: randomUUID(), command }, undefined, 'health-host')for (let i = 0; i < 2; i++) {@@ -1109,7 +1145,7 @@ describe('Super Tabs on a real Mongo replica set', () => {await hostRun({ type: 'agent.startFailed', startId, error: 'Codex could not launch.' })}expect((await pool()).suspendedEngines).toEqual({ codex: expect.stringContaining('Codex is suspended on this machine for new work') })- const notices = (await store.messages(owner, tab, 'lead', {})).messages.filter(m => m.text.includes('Codex is suspended'))+ const notices = (await store.messages(owner, tab, task, {})).messages.filter(m => m.text.includes('Codex is suspended'))expect(notices.map(m => m.mentions)).toEqual([[host.sub]])await expect(run(tab, { type: 'agent.start', request })).rejects.toMatchObject({ code: 'ENGINE_UNAVAILABLE' })// Signed in, with quota left: the reading offers it again.@@ -1177,7 +1213,9 @@ describe('Super Tabs on a real Mongo replica set', () => {.rejects.toMatchObject({ code: 'NATIVE_PROMPT_MISSING' })const second = await store.native.append(host, tab, contextId, { ...answer, previousEventId: first.eventId })expect(await store.native.append(host, tab, contextId, prompt)).toEqual(first)- const rows = (await store.messages(owner, tab, 'lead', {})).messages+ // After the row naming who added the Lead (#2207).+ const [added, ...rows] = (await store.messages(owner, tab, 'lead', {})).messages+ expect(memberRow(added!)).toBe(true)expect(rows).toHaveLength(2)expect(rows[0]).toMatchObject({ text: prompt.text, author: { kind: 'agent', id: lead },source: { kind: 'native', phase: 'prompt', operator: { id: host.sub, kind: 'person' } } })@@ -1202,8 +1240,9 @@ describe('Super Tabs on a real Mongo replica set', () => {const event = { turnId: randomUUID(), kind: 'prompt' as const, previousEventId: null,text: 'Change this implementation', truncated: false, interrupted: false }const typed = await store.native.append(host, tab, contextId, event) as { eventId: string }- expect((await store.messages(owner, tab, 'lead', {})).messages).toHaveLength(0)- expect((await store.messages(owner, tab, group, {})).messages).toHaveLength(1)+ // Besides the rows naming who added each agent (#2207).+ expect((await store.messages(owner, tab, 'lead', {})).messages.filter(m => !memberRow(m))).toHaveLength(0)+ expect((await store.messages(owner, tab, group, {})).messages.filter(m => !memberRow(m))).toHaveLength(1)expect(await store.deliveries(host, tab, worker)).toEqual([])// A typed prompt names no one (project instructions, phase 4): the coordinator hears only of a gap on the task.expect(await store.deliveries(host, tab, lead)).toEqual([])@@ -1236,7 +1275,8 @@ describe('Super Tabs on a real Mongo replica set', () => {const event = { turnId: randomUUID(), kind: 'gap' as const, previousEventId: null,text: 'Caller text must not impersonate a gap explanation', truncated: false, interrupted: false }await store.native.append(host, tab, contextId, event)- expect((await store.messages(owner, tab, group, {})).messages[0]!.text).toContain('Some terminal activity could not be recorded')+ // The first row after the one naming who added the Builder (#2207).+ expect((await store.messages(owner, tab, group, {})).messages.find(m => !memberRow(m))!.text).toContain('Some terminal activity could not be recorded')const original = (await db.machineShare.findUnique({ where: { machineId: 'test-host' } }))!await db.machineShare.update({ where: { machineId: 'test-host' }, data: { emails: [owner.email],grantVersions: nextMachineShareGrants(original, [owner.email], null) } })@@ -1299,7 +1339,8 @@ describe('Super Tabs on a real Mongo replica set', () => {.rejects.toMatchObject({ code: 'CLAIM_CONFLICT' })expect(await store.delivery(host, tab, lead, delivery.id, { type: 'hold', claimId: 'claim', reason: 'team_waiting_user' })).toEqual({ held: true })expect(await db.superTabDelivery.findUnique({ where: { id: delivery.id } })).toMatchObject({ holdReason: 'team_waiting_user' })- expect((await store.messages(owner, tab, 'lead', {})).messages.map(m => m.text)).toEqual(['Please start.'])+ // After the row naming who added the Lead (#2207).+ expect((await store.messages(owner, tab, 'lead', {})).messages.map(m => m.text)).toEqual([expect.stringMatching(/^owner added [^.]+\.$/), 'Please start.'])await store.delivery(host, tab, lead, delivery.id, { type: 'ack', claimId: 'claim', receipt: 'done', uncertain: false })expect(await store.delivery(host, tab, lead, delivery.id, { type: 'hold', claimId: 'claim', reason: 'team_waiting_idle' })).toEqual({ held: false })})@@ -1321,7 +1362,7 @@ describe('Super Tabs on a real Mongo replica set', () => {expect(afterAll.lastMainSequence).toBe(afterAll.lastMessageSequence)// Agents read one feed: every reply, each with its thread root.- const feed = (await store.messages(host, tab, 'lead', {}, lead)).messages+ const feed = (await store.messages(host, tab, 'lead', {}, lead)).messages.filter(m => !memberRow(m)) // and the row naming who added it (#2207)expect(feed.map(m => [m.id, m.thread, m.alsoInChat ?? null])).toEqual([[root, root, null], [first, root, null], [second, root, true], [after, after, null]])expect(feed.find(m => m.id === second)!.replyTo).toBe(first)@@ -1377,18 +1418,19 @@ describe('Super Tabs on a real Mongo replica set', () => {const deliveries = (await store.deliveries(host, tab, lead)).filter(d => d.messageId === sent.result.messageId)expect(deliveries).toHaveLength(1)for (const person of [owner, peer]) {- expect((await store.messages(person, tab, 'lead', {})).messages).toEqual([])+ // Only the row naming who added the Lead (#2207).+ expect((await store.messages(person, tab, 'lead', {})).messages.filter(m => !memberRow(m))).toEqual([])expect((await store.messages(person, tab, 'lead', { messageId: sent.result.messageId as string })).messages).toEqual([])}expect((await store.read(owner, tab)).state.conversations.find(c => c.id === 'lead')!.lastMessageSequence).toBe(before)- expect((await store.messages(host, tab, 'lead', {}, lead)).messages.map(m => m.text)).toEqual(['Harness updated your built-in swarm-lead skill.'])+ expect((await store.messages(host, tab, 'lead', {}, lead)).messages.filter(m => !memberRow(m)).map(m => m.text)).toEqual(['Harness updated your built-in swarm-lead skill.'])// Typed through the normal claim; a hold while the input box is busy is recorded on the delivery, so the delivery pass// knows its host still holds it (deliverySettle.ts), and writes no row people would see.const claimed = await store.delivery(host, tab, lead, deliveries[0]!.id, { type: 'claim', claimId: 'claim' })expect(claimed.message).toMatchObject({ text: 'Harness updated your built-in swarm-lead skill.', source: { kind: 'agent-only' } })expect(await store.delivery(host, tab, lead, deliveries[0]!.id, { type: 'hold', claimId: 'claim', reason: 'team_waiting_draft' })).toEqual({ held: true })expect(await db.superTabDelivery.findUniqueOrThrow({ where: { id: deliveries[0]!.id } })).toMatchObject({ holdReason: 'team_waiting_draft' })- expect((await store.messages(owner, tab, 'lead', {})).messages).toEqual([])+ expect((await store.messages(owner, tab, 'lead', {})).messages.filter(m => !memberRow(m))).toEqual([])})it('delivers a worker\'s agent-only notice once in its group and lists it for no person and not for its Lead', async () => {@@ -1417,17 +1459,19 @@ describe('Super Tabs on a real Mongo replica set', () => {}const last = (await run(tab, message('After the notices.'))).result.messageId as string// Desktop's first read, then its next read after the last row it shows (desktop/lib/super_tabs/controller.dart).+ // Each after the row naming who added the Lead (#2207).const opened = await store.messages(owner, tab, 'lead', {})- expect(opened.messages.map(m => m.id)).toEqual([first, last])+ const added = opened.messages[0]!.id+ expect(opened.messages.map(m => m.id)).toEqual([added, first, last])expect(opened.next).toBeNull()- const tail = opened.messages[0]!.sequence+ const tail = opened.messages[1]!.sequenceexpect((await store.messages(owner, tab, 'lead', { after: tail })).messages.map(m => m.id)).toEqual([last])- expect((await store.messages(owner, tab, 'lead', { before: opened.messages[1]!.sequence })).messages.map(m => m.id)).toEqual([first])+ expect((await store.messages(owner, tab, 'lead', { before: opened.messages[2]!.sequence })).messages.map(m => m.id)).toEqual([added, first])// The Lead pages through all of its own notices, a full page then the rest.const page = await store.messages(host, tab, 'lead', {}, lead)expect(page.messages).toHaveLength(100)const rest = await store.messages(host, tab, 'lead', { before: page.next!.sequence, beforeId: page.next!.id }, lead)- expect([...rest.messages, ...page.messages].map(m => m.text)).toEqual(['Before the notices.', ...Array.from({ length: 120 }, (_, i) => `Notice ${i}.`), 'After the notices.'])+ expect([...rest.messages, ...page.messages].filter(m => !memberRow(m)).map(m => m.text)).toEqual(['Before the notices.', ...Array.from({ length: 120 }, (_, i) => `Notice ${i}.`), 'After the notices.'])expect(rest.next).toBeNull()})@@ -1465,14 +1509,17 @@ describe('Super Tabs on a real Mongo replica set', () => {}let opened!: Awaited<ReturnType<typeof store.messages>>expect(await examined(async () => { opened = await store.messages(owner, tab, 'lead', {}) })).toBeLessThan(6_000)- expect(opened.messages.map(m => m.id)).toEqual(['a-first', 'c-last'])+ // Besides the row naming who added the Lead (#2207).+ expect(opened.messages.filter(m => !memberRow(m)).map(m => m.id)).toEqual(['a-first', 'c-last'])expect(opened.next).toBeNull()- expect((await store.messages(owner, tab, 'lead', { after: 0 })).messages.map(m => m.id)).toEqual(['c-last'])+ expect((await store.messages(owner, tab, 'lead', { after: 0 })).messages.filter(m => !memberRow(m)).map(m => m.id)).toEqual(['c-last'])})it('accepts an agent-only notice only from an agent to itself alone', async () => {const { tab, lead } = await fixture()const worker = (await run(tab, { type: 'agent.add', conversationId: 'lead', machineId: 'test-host', harnessId: randomUUID(), name: 'Worker', configuration: config, lead: false })).result.agentId as string+ // A member of the project chat stored before #2207, so naming it is refused for the notice alone.+ await seat(tab, worker)const notice = (recipientIds: string[]): Command => ({ type: 'message.send', conversationId: 'lead', text: 'Skill changed.', replyTo: null, recipientIds, agentOnly: true })await expect(run(tab, notice([lead]))).rejects.toMatchObject({ code: 'INVALID_RECIPIENT' })await expect(run(tab, notice([worker]), host, lead)).rejects.toMatchObject({ code: 'INVALID_RECIPIENT' })@@ -1481,7 +1528,8 @@ describe('Super Tabs on a real Mongo replica set', () => {// A tag would tell a person about a notice they cannot see.await invite(tab)await expect(run(tab, { ...notice([lead]), mentions: [peer.sub] } as Command, host, lead)).rejects.toMatchObject({ code: 'INVALID_RECIPIENT' })- expect((await store.messages(owner, tab, 'lead', {})).messages).toEqual([])+ // Only the row naming who added the Lead (#2207), and the one saying the Worker joined the project.+ expect((await store.messages(owner, tab, 'lead', {})).messages.filter(m => !memberRow(m) && !m.text.includes('works in its tasks'))).toEqual([])})it('stores the current delivery hold and its first time without a conversation notice', async () => {@@ -1495,7 +1543,8 @@ describe('Super Tabs on a real Mongo replica set', () => {for (const reason of ['team_waiting_idle', 'team_waiting_user', 'team_waiting_draft', 'team_waiting_control', 'team_waiting_unavailable'] as const) {await timed.delivery(host, tab, lead, delivery.id, { type: 'hold', claimId: 'claim', reason })expect(await db.superTabDelivery.findUnique({ where: { id: delivery.id } })).toMatchObject({ holdReason: reason, holdSince: since })- const rows = (await timed.messages(owner, tab, 'lead', {})).messages+ // Besides the row naming who added the Lead (#2207).+ const rows = (await timed.messages(owner, tab, 'lead', {})).messages.filter(m => !memberRow(m))expect(rows).toHaveLength(1)expect(rows[0]!.deliveries[0]).toMatchObject({ holdReason: reason, holdSince: since })now += 5000@@ -1506,6 +1555,8 @@ describe('Super Tabs on a real Mongo replica set', () => {const { tab } = await fixture()const worker = (await run(tab, { type: 'agent.add', conversationId: 'lead', machineId: 'test-host', harnessId: randomUUID(), name: 'Worker',configuration: config, lead: false })).result.agentId as string+ // A member of the project chat stored before #2207.+ await seat(tab, worker)await run(tab, { ...message('Finish this held instruction.'), recipientIds: [worker] } as Command)const delivery = (await store.deliveries(host, tab, worker))[0]!await store.delivery(host, tab, worker, delivery.id, { type: 'claim', claimId: 'claim' })@@ -1579,7 +1630,8 @@ describe('Super Tabs on a real Mongo replica set', () => {await expect(run(tab, resend, peer)).rejects.toMatchObject({ code: 'DELIVERY_RESOLVED' })await expect(store.delivery(host, tab, lead, first.id, { type: 'ack', claimId, receipt: 'late', uncertain: false })).rejects.toMatchObject({ code: 'DELIVERY_RESOLVED' })- const rows = (await store.messages(owner, tab, 'lead', {})).messages+ // Besides the row naming who added the Lead (#2207).+ const rows = (await store.messages(owner, tab, 'lead', {})).messages.filter(m => !memberRow(m))expect(rows).toHaveLength(2)expect(rows[1]!.text).toBe(rows[0]!.text)expect(rows[1]!.replyTo).toBe(rows[0]!.id)@@ -1623,7 +1675,8 @@ describe('Super Tabs on a real Mongo replica set', () => {const sendId = randomUUID()const sends = await Promise.all(Array.from({ length: 5 }, () => run(tab, message('Exactly once.'), owner, undefined, sendId)))expect(new Set(sends.map(s => s.result.messageId)).size).toBe(1)- expect(await db.superTabMessage.count({ where: { tabId: tab } })).toBe(1)+ // And the row naming who added the Lead (#2207).+ expect(await db.superTabMessage.count({ where: { tabId: tab } })).toBe(2)expect(await store.deliveries(host, tab, lead)).toHaveLength(1)await expect(run(tab, message('Different'), owner, undefined, sendId)).rejects.toMatchObject({ code: 'OPERATION_REUSED' })})@@ -1677,7 +1730,8 @@ describe('Super Tabs on a real Mongo replica set', () => {expect((await run(tab, { type: 'rule.remove', ruleId: 'old', askedIn }, host, lead)).result).toMatchObject({ ignored: true })expect((await store.read(owner, tab)).state).not.toHaveProperty('rules')const rows = (await store.messages(owner, tab, chat, {})).messages.filter(m => m.source).map(m => m.text)- expect(rows).toEqual(['Lead changed the instructions for owner: Routing: Only this Mac.'])+ // After the row naming who added the Lead (#2207).+ expect(rows).toEqual([expect.stringMatching(/^owner added [^.]+\.$/), 'Lead changed the instructions for owner: Routing: Only this Mac.'])expect((await store.read(owner, tab)).state.projects!.map(p => p.id)).toEqual([projectId])})it('keeps a new Swarm\'s folder from tab.project on its first project, so the repository can be shared and the host uses it', async () => {@@ -1697,7 +1751,9 @@ describe('Super Tabs on a real Mongo replica set', () => {resources: { cpuPercent: 10, memoryTotalBytes: 32e9, memoryUsedBytes: 4e9, projectDiskFreeBytes: 100e9,diskFreeBytes: 100e9, diskTotalBytes: 500e9, deviceType: 'Laptop', chip: 'Fixture CPU', os: 'macOS', gpuPercent: null },quotas: [], tools: { git: true }, runningHarnessIds: [], stoppedHarnessIds: [], privacy: team.privacy })- const request = { conversationId: 'lead', machineId: 'test-host', engine: 'codex', name: 'Builder', cwd: '/work/app', worktree: true,+ // Started in the project's task: the project chat holds only its coordinator among agents (#2207).+ const task = String((await run(tab, { type: 'conversation.create', title: 'App work', brief: '', checks: [] })).result.conversationId)+ const request = { conversationId: task, machineId: 'test-host', engine: 'codex', name: 'Builder', cwd: '/work/app', worktree: true,requirements: { memoryBytes: 0, diskBytes: 0, maxCpuPercent: 100, tools: [], devices: [], quotaRequired: false } }await run(tab, { type: 'agent.start', request })expect((await poolRows(store, team.session, 'test-host')).find(p => p.tabId === tab)!.projects).toEqual([expect.objectContaining({ id: 'lead', repository })])@@ -1806,24 +1862,26 @@ describe('Super Tabs on a real Mongo replica set', () => {})it('writes a message to several recipients in two insert commands, preserving each delivery', async () => {const { tab, lead } = await fixture()+ // In a task, which holds its coordinator: the project chat holds no other agent (#2207).+ const group = String((await run(tab, { type: 'conversation.create', title: 'Task', brief: '', checks: [] })).result.conversationId)const recipients = [lead]for (const name of ['Parser', 'Renderer', 'Exporter']) recipients.push(String((await run(tab, {- type: 'agent.add', conversationId: 'lead', machineId: 'test-host', harnessId: randomUUID(), name, configuration: config, lead: false,+ type: 'agent.add', conversationId: group, machineId: 'test-host', harnessId: randomUUID(), name, configuration: config, lead: false,})).result.agentId))const queries: string[] = []recordQuery = query => { if (/SuperTab(Message|Delivery).*insert/i.test(query)) queries.push(query) }let sent: Awaited<ReturnType<typeof run>>try {- sent = await run(tab, { ...message('Batch to all four.'), recipientIds: recipients } as Command)+ sent = await run(tab, { ...message('Batch to all four.'), conversationId: group, recipientIds: recipients } as Command)} finally { recordQuery = () => {} }const messageId = String(sent.result.messageId)const stored = await db.superTabMessage.findUniqueOrThrow({ where: { id: messageId } })- expect(stored).toMatchObject({ tabId: tab, conversationId: 'lead', text: 'Batch to all four.', recipientIds: recipients,+ expect(stored).toMatchObject({ tabId: tab, conversationId: group, text: 'Batch to all four.', recipientIds: recipients,author: { kind: 'person', id: owner.sub }, replyTo: null, mentions: [] })const deliveries = await db.superTabDelivery.findMany({ where: { tabId: tab, messageId } })expect(deliveries).toHaveLength(4)for (const recipient of recipients) expect(deliveries.find(row => row.agentId === recipient)).toMatchObject({- id: stableId(messageId, recipient), tabId: tab, conversationId: 'lead', messageId, machineId: 'test-host',+ id: stableId(messageId, recipient), tabId: tab, conversationId: group, messageId, machineId: 'test-host',machineOwnerId: host.sub, membershipGeneration: tab, authorKind: 'person', authorId: owner.sub,authorGeneration: tab, assignmentId: null, status: 'queued',})@@ -1832,10 +1890,12 @@ describe('Super Tabs on a real Mongo replica set', () => {it('closes the replying agent\'s own deliveries of a message as answered, and nobody else\'s', async () => {const { tab, lead } = await fixture()- const helper = (await run(tab, { type: 'agent.add', conversationId: 'lead', machineId: 'test-host', harnessId: randomUUID(),+ // In a task, which holds its coordinator: the project chat holds no other agent (#2207).+ const group = String((await run(tab, { type: 'conversation.create', title: 'Task', brief: '', checks: [] })).result.conversationId)+ const helper = (await run(tab, { type: 'agent.add', conversationId: group, machineId: 'test-host', harnessId: randomUUID(),name: 'Helper', configuration: config, lead: false })).result.agentId as stringawait invite(tab)- const asked = await run(tab, { type: 'message.send', conversationId: 'lead', text: 'What is the status?', replyTo: null,+ const asked = await run(tab, { type: 'message.send', conversationId: group, text: 'What is the status?', replyTo: null,recipientIds: [lead, helper] }, peer)const messageId = asked.result.messageId as stringconst held = (await store.deliveries(host, tab, lead))[0]!@@ -1844,18 +1904,18 @@ describe('Super Tabs on a real Mongo replica set', () => {await store.delivery(host, tab, lead, held.id, { type: 'claim', claimId })const other = (await store.deliveries(host, tab, helper))[0]!// A person's reply closes nothing.- await run(tab, { type: 'message.send', conversationId: 'lead', text: 'Also, soon please.', replyTo: messageId, recipientIds: [] })+ await run(tab, { type: 'message.send', conversationId: group, text: 'Also, soon please.', replyTo: messageId, recipientIds: [] })expect(await store.deliveryReceipt(host, tab, lead, held.id)).toEqual({ id: held.id, status: 'claimed' })- await run(tab, { type: 'message.send', conversationId: 'lead', text: 'It is done.', replyTo: messageId, recipientIds: [] }, host, lead)+ await run(tab, { type: 'message.send', conversationId: group, text: 'It is done.', replyTo: messageId, recipientIds: [] }, host, lead)expect(await store.deliveryReceipt(host, tab, lead, held.id)).toEqual({ id: held.id, status: 'answered' })expect((await store.deliveries(host, tab, lead)).map(d => d.messageId)).not.toContain(messageId)expect(await store.deliveryReceipt(host, tab, helper, other.id)).toEqual({ id: other.id, status: 'queued' })await expect(store.delivery(host, tab, lead, held.id, { type: 'claim', claimId })).rejects.toMatchObject({ code: 'DELIVERY_RESOLVED' })await expect(store.delivery(host, tab, lead, held.id, { type: 'ack', claimId, receipt: 'late', uncertain: false })).rejects.toMatchObject({ code: 'DELIVERY_RESOLVED' })- const next = await run(tab, { type: 'message.send', conversationId: 'lead', text: 'And the tests?', replyTo: null, recipientIds: [lead] }, peer)+ const next = await run(tab, { type: 'message.send', conversationId: group, text: 'And the tests?', replyTo: null, recipientIds: [lead] }, peer)const queued = (await store.deliveries(host, tab, lead)).find(d => d.messageId === next.result.messageId)!- await run(tab, { type: 'message.send', conversationId: 'lead', text: 'They pass.', replyTo: next.result.messageId as string, recipientIds: [] }, host, lead)+ await run(tab, { type: 'message.send', conversationId: group, text: 'They pass.', replyTo: next.result.messageId as string, recipientIds: [] }, host, lead)expect(await store.deliveryReceipt(host, tab, lead, queued.id)).toEqual({ id: queued.id, status: 'answered' })})@@ -1875,7 +1935,8 @@ describe('Super Tabs on a real Mongo replica set', () => {await invite(tab)expect(await store.deliveries(host, tab, lead)).toHaveLength(0)await expect(store.delivery(host, tab, lead, delivery.id, { type: 'ack', claimId, receipt: 'receipt', uncertain: false })).rejects.toMatchObject({ code: 'DELIVERY_REVOKED' })- expect((await store.messages(owner, tab, 'lead', {})).messages).toHaveLength(1)+ // Besides the row naming who added the Lead (#2207).+ expect((await store.messages(owner, tab, 'lead', {})).messages.filter(m => !memberRow(m))).toHaveLength(1)})it('allows one claim winner and preserves the original native receipt', async () => {@@ -1911,36 +1972,41 @@ describe('Super Tabs on a real Mongo replica set', () => {const one = await fixture()const two = await fixture()const session = randomUUID()- const attach: Command = { type: 'agent.add', conversationId: 'lead', machineId: 'test-host', harnessId: session,- name: 'Worker', configuration: config, lead: false }- const worker = (await run(one.tab, attach)).result.agentId as string- await run(two.tab, attach)- const define: Command = { type: 'work.define', conversationId: 'lead', brief: 'Check the fixture.', checks: [{ description: 'Test passes.', independent: true }] }- await run(one.tab, define); await run(two.tab, define)- const assignmentId = (await run(one.tab, { type: 'work.assign', conversationId: 'lead', agentId: worker })).result.assignmentId as string- await expect(run(two.tab, { type: 'work.assign', conversationId: 'lead', agentId: worker })).rejects.toMatchObject({ code: 'AGENT_BUSY' })+ // Each tab's work is in a task: the project chat holds only its coordinator among agents (#2207).+ const task = async (tab: string) => String((await run(tab, { type: 'conversation.create', title: 'Task', brief: '', checks: [] })).result.conversationId)+ const group = await task(one.tab), other = await task(two.tab)+ const attach = (conversationId: string): Command => ({ type: 'agent.add', conversationId, machineId: 'test-host', harnessId: session,+ name: 'Worker', configuration: config, lead: false })+ const worker = (await run(one.tab, attach(group))).result.agentId as string+ await run(two.tab, attach(other))+ const define = (conversationId: string): Command => ({ type: 'work.define', conversationId, brief: 'Check the fixture.', checks: [{ description: 'Test passes.', independent: true }] })+ await run(one.tab, define(group)); await run(two.tab, define(other))+ const assignmentId = (await run(one.tab, { type: 'work.assign', conversationId: group, agentId: worker })).result.assignmentId as string+ await expect(run(two.tab, { type: 'work.assign', conversationId: other, agentId: worker })).rejects.toMatchObject({ code: 'AGENT_BUSY' })await run(one.tab, { type: 'agent.remove', agentId: worker })expect(await assignmentRows(store, host, 'test-host')).toContainEqual({ tabId: one.tab, assignmentId, harnessId: session })await expect(assignmentRows(store, owner, 'test-host')).rejects.toMatchObject({ code: 'HOST_UNAVAILABLE' })await expect(store.stopped(owner, one.tab, assignmentId, 'forged')).rejects.toMatchObject({ code: 'FORBIDDEN' })await store.stopped(host, one.tab, assignmentId, 'native-stop-receipt')- expect((await store.read(owner, one.tab)).state.conversations[0]!.assignment?.status).toBe('stopped')+ expect((await store.read(owner, one.tab)).state.conversations.find(c => c.id === group)!.assignment?.status).toBe('stopped')await store.stopped(host, one.tab, assignmentId, 'native-stop-receipt')expect(await assignmentRows(store, host, 'test-host')).not.toContainEqual({ tabId: one.tab, assignmentId, harnessId: session })expect(await db.superTabDelivery.count({ where: { tabId: one.tab, assignmentId, status: 'queued' } })).toBe(0)- await run(two.tab, { type: 'work.assign', conversationId: 'lead', agentId: worker })- await run(one.tab, define)+ await run(two.tab, { type: 'work.assign', conversationId: other, agentId: worker })+ await run(one.tab, define(group))expect((await db.superTabAttempt.findUnique({ where: { id: assignmentId } }))!.snapshot).toMatchObject({ assignment: { status: 'stopped', configuration: config } })})it('lists the attempts of one group, newest first, after a stop and a new definition', async () => {const { tab, lead } = await fixture()- const worker = (await run(tab, { type: 'agent.add', conversationId: 'lead', machineId: 'test-host', harnessId: randomUUID(),+ // A task's attempts: the project chat holds only its coordinator among agents (#2207).+ const group = String((await run(tab, { type: 'conversation.create', title: 'Task', brief: '', checks: [] })).result.conversationId)+ const worker = (await run(tab, { type: 'agent.add', conversationId: group, machineId: 'test-host', harnessId: randomUUID(),name: 'Builder', configuration: config, lead: false })).result.agentId as string- const define = (brief: string): Command => ({ type: 'work.define', conversationId: 'lead', brief, checks: [{ description: 'Test passes.', independent: false }] })+ const define = (brief: string): Command => ({ type: 'work.define', conversationId: group, brief, checks: [{ description: 'Test passes.', independent: false }] })const attempt = async (brief: string) => {await run(tab, define(brief))- const id = (await run(tab, { type: 'work.assign', conversationId: 'lead', agentId: worker })).result.assignmentId as string+ const id = (await run(tab, { type: 'work.assign', conversationId: group, agentId: worker })).result.assignmentId as stringawait store.stopped(host, tab, id, 'native-stop-receipt')return id}@@ -1949,9 +2015,9 @@ describe('Super Tabs on a real Mongo replica set', () => {await run(tab, define('Build it a third time.'))// A host-confirmed stop sets its own result, so a long one is seeded: the server cuts it.const long = randomUUID()- await db.superTabAttempt.create({ data: { id: long, tabId: tab, conversationId: 'lead', createdAt: new Date(0), snapshot: { assignment: {+ await db.superTabAttempt.create({ data: { id: long, tabId: tab, conversationId: group, createdAt: new Date(0), snapshot: { assignment: {id: long, agentId: worker, status: 'done', result: 'x'.repeat(900), execution: { machineId: 'test-host', harnessId: 'secret-harness', machineOwnerId: host.sub } } } } })- const url = `/api/super-tabs/${tab}/conversations/lead/attempts`+ const url = `/api/super-tabs/${tab}/conversations/${group}/attempts`const read = (user: AuthUser, query = '') => app.inject({ url: `${url}${query}`, headers: { authorization: `Bearer ${user.sub}` } })const listed = (await read(owner)).json().dataexpect(listed.map((a: { id: string }) => a.id)).toEqual([second, first, long])@@ -1980,22 +2046,24 @@ describe('Super Tabs on a real Mongo replica set', () => {it('tells the lead once when the host confirms its worker stopped', async () => {const { tab, lead } = await fixture()- const worker = (await run(tab, { type: 'agent.add', conversationId: 'lead', machineId: 'test-host', harnessId: randomUUID(),+ // A worker of a task: the project chat holds only its coordinator among agents (#2207).+ const group = String((await run(tab, { type: 'conversation.create', title: 'Task', brief: '', checks: [] })).result.conversationId)+ const worker = (await run(tab, { type: 'agent.add', conversationId: group, machineId: 'test-host', harnessId: randomUUID(),name: 'Builder', configuration: config, lead: false })).result.agentId as stringconst displayName = (await store.read(owner, tab)).state.agents.find(a => a.id === worker)!.displayName!- await run(tab, { type: 'work.define', conversationId: 'lead', brief: 'Build it.', checks: [{ description: 'Test passes.', independent: false }] })- const assignmentId = (await run(tab, { type: 'work.assign', conversationId: 'lead', agentId: worker })).result.assignmentId as string+ await run(tab, { type: 'work.define', conversationId: group, brief: 'Build it.', checks: [{ description: 'Test passes.', independent: false }] })+ const assignmentId = (await run(tab, { type: 'work.assign', conversationId: group, agentId: worker })).result.assignmentId as stringconst before = (await store.deliveries(host, tab, lead)).lengthawait store.stopped(host, tab, assignmentId, 'native-stop-receipt')await store.stopped(host, tab, assignmentId, 'native-stop-receipt')- const notices = (await store.messages(owner, tab, 'lead', {})).messages.filter(m => m.text.startsWith('Stopped'))+ const notices = (await store.messages(owner, tab, group, {})).messages.filter(m => m.text.startsWith('Stopped'))expect(notices).toHaveLength(1)expect(notices[0]).toMatchObject({ author: { kind: 'agent', id: worker, name: 'Builder', displayName },text: 'Stopped\n\nThe execution host confirmed that this harness stopped.' })expect(await store.deliveries(host, tab, lead)).toHaveLength(before + 1)- expect((await store.read(owner, tab)).state.conversations[0]!.lastMessageSequence).toBe(notices[0]!.sequence)+ expect((await store.read(owner, tab)).state.conversations.find(c => c.id === group)!.lastMessageSequence).toBe(notices[0]!.sequence)await run(tab, { type: 'agent.remove', agentId: worker })- expect((await store.messages(owner, tab, 'lead', {})).messages.find(m => m.id === notices[0]!.id)!.author)+ expect((await store.messages(owner, tab, group, {})).messages.find(m => m.id === notices[0]!.id)!.author).toMatchObject({ displayName })})@@ -2014,15 +2082,18 @@ describe('Super Tabs on a real Mongo replica set', () => {payload: { operationId: randomUUID(), command: message('A shared conversation.') } })expect(post.statusCode).toBe(200)const history = await app.inject({ url: `/api/super-tabs/${tab}/conversations/lead/messages`, headers })- expect(history.json().data.messages[0].text).toBe('A shared conversation.')+ // The first row after the one naming who added the Lead (#2207).+ expect(history.json().data.messages.find((m: { text: string; source?: unknown }) => !memberRow(m)).text).toBe('A shared conversation.')})it('rechecks the machine share at delivery even while the contributor remains in the tab', async () => {const { tab } = await fixture()await invite(tab)- const agentId = (await run(tab, { type: 'agent.add', conversationId: 'lead', machineId: 'test-host', harnessId: randomUUID(),+ // A worker of a task: the project chat holds only its coordinator among agents (#2207).+ const group = String((await run(tab, { type: 'conversation.create', title: 'Task', brief: '', checks: [] })).result.conversationId)+ const agentId = (await run(tab, { type: 'agent.add', conversationId: group, machineId: 'test-host', harnessId: randomUUID(),name: 'Peer worker', configuration: config, lead: false }, peer)).result.agentId as string- await run(tab, { ...message('Only on an authorized machine.'), recipientIds: [agentId] } as Command)+ await run(tab, { ...message('Only on an authorized machine.'), conversationId: group, recipientIds: [agentId] } as Command)expect(await store.deliveries(host, tab, agentId)).toHaveLength(1)try {const before = await db.machineShare.findUniqueOrThrow({ where: { machineId: 'test-host' } })@@ -2043,9 +2114,11 @@ describe('Super Tabs on a real Mongo replica set', () => {it('also withholds outgoing instructions from an agent whose machine grant was revoked', async () => {const { tab, lead } = await fixture()await invite(tab)- const worker = (await run(tab, { type: 'agent.add', conversationId: 'lead', machineId: 'test-host', harnessId: randomUUID(),+ // A worker of a task: the project chat holds only its coordinator among agents (#2207).+ const group = String((await run(tab, { type: 'conversation.create', title: 'Task', brief: '', checks: [] })).result.conversationId)+ const worker = (await run(tab, { type: 'agent.add', conversationId: group, machineId: 'test-host', harnessId: randomUUID(),name: 'Peer worker', configuration: config, lead: false }, peer)).result.agentId as string- await store.execute(host, tab, { operationId: randomUUID(), command: { ...message('Delegated before revocation.'), recipientIds: [worker] } as Command }, lead)+ await store.execute(host, tab, { operationId: randomUUID(), command: { ...message('Delegated before revocation.'), conversationId: group, recipientIds: [worker] } as Command }, lead)const [delivery] = await store.deliveries(host, tab, worker)expect(delivery).toBeTruthy()const before = await db.machineShare.findUniqueOrThrow({ where: { machineId: 'test-host' } })@@ -2108,7 +2181,9 @@ describe('Super Tabs on a real Mongo replica set', () => {it('serializes native start claims and fences a restored target-machine grant', async () => {const { tab } = await fixture()- const request = { conversationId: 'lead', machineId: 'test-host', engine: 'claude', name: 'Builder', cwd: '/fixture/repo', worktree: true,+ // In a task: the project chat holds only its coordinator among agents (#2207).+ const group = String((await run(tab, { type: 'conversation.create', title: 'Task', brief: '', checks: [] })).result.conversationId)+ const request = { conversationId: group, machineId: 'test-host', engine: 'claude', name: 'Builder', cwd: '/fixture/repo', worktree: true,requirements: { memoryBytes: 100, diskBytes: 200, maxCpuPercent: 80, tools: ['git'], devices: [], quotaRequired: false } }const intent = randomUUID()const starts = await Promise.all(Array.from({ length: 3 }, () => run(tab, { type: 'agent.start', request }, owner, undefined, intent)))@@ -2272,12 +2347,14 @@ describe('Super Tabs on a real Mongo replica set', () => {await db.machine.create({ data: { machineId, userId: host.sub, apiKey: 'fixture-only', managerId: 'fixture', autonomousEnv: 'prod', authMode: 'remote' } })await db.machineShare.create({ data: { machineId, ownerId: host.sub, autonomousEnv: 'prod', emails: [owner.email] } })const helper = (await run(tab, { type: 'agent.add', conversationId: 'lead', machineId, harnessId: randomUUID(), name: 'Helper', configuration: config, lead: false })).result.agentId as string- const request = { conversationId: 'lead', machineId, engine: 'codex', name: 'Builder', cwd: '/work', worktree: true,+ // Routed and started in a task: the project chat holds only its coordinator among agents (#2207).+ const group = String((await run(tab, { type: 'conversation.create', title: 'Task', brief: '', checks: [] })).result.conversationId)+ const request = { conversationId: group, machineId, engine: 'codex', name: 'Builder', cwd: '/work', worktree: true,requirements: { memoryBytes: 0, diskBytes: 0, maxCpuPercent: 100, tools: [], devices: [], quotaRequired: false } }const decision = { assessment: { difficulty: 'low', risk: 'low', why: 'Docs.' },candidates: [{ id: 'c0', kind: 'new', machineId: 'test-host', engine: 'claude', model: 'haiku', effort: 'auto', quality: 1, cost: 1, title: 'New agent', label: 'New agent' }],excluded: [], floor: 1, notes: false, pick: 'c0', via: 'only', p: null, belowFloor: false, why: 'Only candidate.' }- const routeDecisionId = (await run(tab, { type: 'route.record', conversationId: 'lead', decision } as Command, host, lead)).result.routeDecisionId as string+ const routeDecisionId = (await run(tab, { type: 'route.record', conversationId: group, decision } as Command, host, lead)).result.routeDecisionId as stringconst operationId = randomUUID(), command: Command = { type: 'agent.start', request, routeDecisionId, overrideReason: 'The helper machine has the repository.' }const first = await run(tab, command, host, lead, operationId)await run(tab, { type: 'agent.remove', agentId: helper })@@ -2288,21 +2365,23 @@ describe('Super Tabs on a real Mongo replica set', () => {it('corrects the log to the model that ran when the routed switch failed, and reads the times of one decision', async () => {const { tab, lead } = await fixture()+ // Routed and started in a task: the project chat holds only its coordinator among agents (#2207).+ const group = String((await run(tab, { type: 'conversation.create', title: 'Task', brief: '', checks: [] })).result.conversationId)const decision = { assessment: { difficulty: 'low', risk: 'low', why: 'Docs.' },candidates: [{ id: 'c0', kind: 'new', machineId: 'test-host', engine: 'claude', model: 'haiku', effort: 'auto', quality: 1, cost: 1, title: 'New agent', label: 'New agent' }],excluded: [], floor: 1, notes: false, pick: 'c0', via: 'only', p: null, belowFloor: false, why: 'Only candidate.' }- const routeDecisionId = (await run(tab, { type: 'route.record', conversationId: 'lead', decision } as Command, host, lead)).result.routeDecisionId as string- const request = { conversationId: 'lead', machineId: 'test-host', engine: 'claude', model: 'haiku', effort: 'auto', name: 'Builder', cwd: '/fixture/repo', worktree: false,+ const routeDecisionId = (await run(tab, { type: 'route.record', conversationId: group, decision } as Command, host, lead)).result.routeDecisionId as string+ const request = { conversationId: group, machineId: 'test-host', engine: 'claude', model: 'haiku', effort: 'auto', name: 'Builder', cwd: '/fixture/repo', worktree: false,requirements: { memoryBytes: 0, diskBytes: 0, maxCpuPercent: 100, tools: [], devices: [], quotaRequired: false } }const startId = (await run(tab, { type: 'agent.start', request, routeDecisionId } as Command, host, lead)).result.startId as string// A queued start already holds its account's quota when the Lead routes again.- await run(tab, { type: 'route.record', conversationId: 'lead', decision } as Command, host, lead)+ await run(tab, { type: 'route.record', conversationId: group, decision } as Command, host, lead)expect((await store.routeDecision(owner, tab, routeDecisionId)).outcome).toBeNull()await expect(run(tab, { type: 'route.modelResult', decisionId: routeDecisionId, startId: 'other', model: 'sonnet', effort: 'auto' } as Command, host, lead)).rejects.toMatchObject({ code: 'ROUTE_MISMATCH' })- const before = (await store.messages(owner, tab, 'lead', {})).messages.length+ const before = (await store.messages(owner, tab, group, {})).messages.lengthawait run(tab, { type: 'route.modelResult', decisionId: routeDecisionId, startId, model: 'sonnet', effort: 'auto' } as Command, host, lead)- expect((await store.messages(owner, tab, 'lead', {})).messages).toHaveLength(before)+ expect((await store.messages(owner, tab, group, {})).messages).toHaveLength(before)const read = async () => (await app.inject({ url: `/api/super-tabs/${tab}/route-decisions/${routeDecisionId}`, headers: { authorization: `Bearer ${owner.sub}` } })).json().dataexpect(await read()).toMatchObject({ outcome: null, outcomeAt: null, createdAt: expect.any(String),final: { kind: 'new', startId, model: 'sonnet', effort: 'auto', requested: { model: 'haiku', effort: 'auto' } } })@@ -3072,7 +3151,9 @@ describe('the owner\'s Lead machine joins its Swarm', () => {const tab = (await store.create(owner, randomUUID(), 'Own machine')).idconst lead = (await run(tab, { type: 'agent.add', conversationId: 'lead', machineId, harnessId: randomUUID(), name: 'Lead', configuration: config, lead: true })).result.agentId as stringexpect((await rosterRows(store, owner, machineId)).map(r => r.joinSwarm)).toEqual([true])- const request = { conversationId: 'lead', machineId, engine: 'codex', name: 'Builder', cwd: '/repo', worktree: true,+ // Started in a task: the project chat holds only its coordinator among agents (#2207). Its chat still hears of them.+ const group = String((await run(tab, { type: 'conversation.create', title: 'Builds', brief: '', checks: [] })).result.conversationId)+ const request = { conversationId: group, machineId, engine: 'codex', name: 'Builder', cwd: '/repo', worktree: true,requirements: { memoryBytes: 0, diskBytes: 0, maxCpuPercent: 100, tools: [], devices: [], quotaRequired: false } }const start = async () => (await run(tab, { type: 'agent.start', request })).result.startId as stringconst [abandoned, inFlight, dispatched] = [await start(), await start(), await start()]@@ -4727,7 +4808,9 @@ describe('Swarm parts under concurrent writes', () => {await store.observeMachine(host, tab, 'test-host', { generation, resources: { cpuPercent: 10, memoryTotalBytes: 32e9, memoryUsedBytes: 4e9,diskFreeBytes: 120e9, diskTotalBytes: 500e9, projectDiskFreeBytes: 120e9, deviceType: 'Laptop', chip: 'Fixture', os: 'macOS', gpuPercent: null },quotas: [], tools: {}, runningHarnessIds: [], stoppedHarnessIds: [] })- const request = (name: string) => ({ conversationId: 'lead', machineId: 'test-host', engine: 'codex', name, cwd: '/fixture/repo', worktree: false,+ // Started in a task: the project chat holds only its coordinator among agents (#2207).+ const group = String((await run(tab, { type: 'conversation.create', title: 'Slots work', brief: '', checks: [] })).result.conversationId)+ const request = (name: string) => ({ conversationId: group, machineId: 'test-host', engine: 'codex', name, cwd: '/fixture/repo', worktree: false,requirements: { memoryBytes: 0, diskBytes: 0, maxCpuPercent: 100, tools: [], devices: [], quotaRequired: false } })const results = await Promise.allSettled([run(tab, { type: 'agent.start', request: request('One') }, host),run(tab, { type: 'agent.start', request: request('Two') }, host)])@@ -4804,14 +4887,15 @@ describe('Swarm parts under concurrent writes', () => {it('assigns the routed agent through its finished start, without an override reason', async () => {const { tab, lead } = await fixture()- const { routeDecisionId, startId } = await routedStart(tab, lead)+ const { routeDecisionId, startId, conversationId } = await routedStart(tab, lead)await store.execute(host, tab, { operationId: randomUUID(), command: { type: 'agent.startDispatch', startId } }, lead)const agentId = String((await store.execute(host, tab, { operationId: randomUUID(), command: { type: 'agent.started', startId,harnessId: randomUUID(), configuration: config } }, lead)).result.agentId)// Started and not pooled: the start is finished and out of every command's active state.expect((await db.swarmStart.findFirstOrThrow({ where: { tabId: tab, key: startId } })).finishedAt).not.toBeNull()- await run(tab, { type: 'work.define', conversationId: 'lead', brief: 'Routed work', checks: [{ description: 'Done', independent: false }] }, host, lead)- const assigned = await run(tab, { type: 'work.assign', conversationId: 'lead', agentId, routeDecisionId }, host, lead)+ // In the task it was started for: the project chat holds only its coordinator among agents (#2207).+ await run(tab, { type: 'work.define', conversationId, brief: 'Routed work', checks: [{ description: 'Done', independent: false }] }, host, lead)+ const assigned = await run(tab, { type: 'work.assign', conversationId, agentId, routeDecisionId }, host, lead)expect(assigned.result.assignmentId).toBeTruthy()expect((await store.routeDecision(owner, tab, routeDecisionId)).final).toMatchObject({ kind: 'new', startId })})diff --git a/backend/scripts/project-chat-rows.ts b/backend/scripts/project-chat-rows.tsnew file mode 100644index 000000000..87d43d67b--- /dev/null+++ b/backend/scripts/project-chat-rows.ts@@ -0,0 +1,63 @@+// Task #2207's server check on made-up data: runs a Swarm through the real command code (commands.ts applyCommand) and a+// machine report's close and reopen (closedAgents.ts, memberRows.ts sessionRows, as store.ts runs them), and prints what each+// chat shows. In memory: no database, no network, no sign-in. Run from backend/: npx tsx scripts/project-chat-rows.ts+import { applyCommand, type Command } from '../src/superTabs/commands.js'+import { removeClosedAgents, restoreSessions } from '../src/superTabs/closedAgents.js'+import { sessionRows } from '../src/superTabs/memberRows.js'+import { createSuperTab, type Actor, type MessageDraft, type SuperTabState } from '../src/superTabs/model.js'++const ken: Actor = { kind: 'person', userId: 'ken', email: '[email protected]' }+const config = { engine: 'claude', model: 'opus', effort: 'high', contextWindow: null, engineVersion: null }+const grant = { contribution: { machineOwnerId: 'ken', contributorId: 'ken' } }+let state: SuperTabState = createSuperTab('demo', 'Demo Swarm', { id: 'ken', email: ken.email }, 'prod')+let step = 0+const title = (id: string) => state.conversations.find(c => c.id === id)?.title ?? id+const show = (label: string, rows: MessageDraft[]) => {+ console.log(`\n${label}`)+ for (const row of rows) console.log(` [${title(row.conversationId)}] ${row.text}`)+ if (!rows.length) console.log(' (no rows)')+}+const run = (command: Command, actor: Actor = ken, context = {}) => {+ const effects = applyCommand(state, actor, command, { now: 1_000 + step, operationId: `demo-${++step}`, ...context })+ state = effects.state+ return effects.messages+}+const tryRun = (label: string, command: Command, actor: Actor = ken, context = {}) => {+ try { show(label, run(command, actor, context)) } catch (error) { console.log(`\n${label}\n refused: ${(error as Error).message}`) }+}+const agentOf = (id: string): Actor => ({ kind: 'agent', agentId: id, machineOwnerId: 'ken' })+const add = (harnessId: string, name: string, conversationId: string, lead = false) => {+ const effects = applyCommand(state, ken, { type: 'agent.add', conversationId, machineId: 'studio', harnessId, name, configuration: config, lead } as Command,+ { now: 1_000 + step, operationId: `demo-${++step}`, ...grant })+ state = effects.state+ return effects.result.agentId as string+}++const river = add('river', 'River', 'lead', true)+const task = (run({ type: 'conversation.create', title: 'Offline editing', brief: 'Save edits offline.', checks: [] }).at(0)!.conversationId)+const finn = add('finn', 'Finn 2', task)+const kai = add('kai', 'Kai', task)+// An older Swarm: Finn 2 was put in the project chat before #2207. It stays until removed.+state.conversations.find(c => c.id === 'lead')!.agentIds.push(finn)+console.log(`Project chat members: ${state.conversations.find(c => c.id === 'lead')!.agentIds.map(id => state.agents.find(a => a.id === id)!.name).join(', ')}`)+console.log(`Task members: ${state.conversations.find(c => c.id === task)!.agentIds.map(id => state.agents.find(a => a.id === id)!.name).join(', ')}`)++tryRun('1. River (coordinator) adds Kai to the project chat:', { type: 'conversation.agent', conversationId: 'lead', agentId: kai, present: true, lead: false }, agentOf(river))+tryRun('2. Ken (a person) adds Kai to the project chat:', { type: 'conversation.agent', conversationId: 'lead', agentId: kai, present: true, lead: false })+tryRun('3. River posts in the project chat naming Kai:', { type: 'message.send', conversationId: 'lead', text: 'Kai, announce it here.', replyTo: null, recipientIds: [kai] }, agentOf(river))+tryRun('4. Ken removes Finn 2 from the project chat:', { type: 'conversation.agent', conversationId: 'lead', agentId: finn, present: false, lead: false })+tryRun('5. River removes Kai from the task:', { type: 'conversation.agent', conversationId: task, agentId: kai, present: false, lead: false }, agentOf(river))+tryRun('6. Ken adds Kai back to the task:', { type: 'conversation.agent', conversationId: task, agentId: kai, present: true, lead: false })++// 7. A machine report closes Kai's session, then a later one shows it running again (store.ts, machine report).+const before = structuredClone(state)+const closed = removeClosedAgents(state, state.agents.filter(a => a.id === kai), 2_000).map(a => a.id)+show('7. A machine report shows Kai\'s session closed:', sessionRows(before, state, new Set(closed), 'report-1'))+const beforeReopen = structuredClone(state)+const back = restoreSessions(state, 'studio', ['kai'], 3_000, new Set(['kai']), () => {})+show('8. A later report shows Kai\'s session running again:', sessionRows(beforeReopen, state, new Set(back.map(a => a.id)), 'report-2'))++// 9. Finn 2 is asked to stop, and its own host confirms it.+run({ type: 'agent.release', agentId: finn, decision: 'stop' } as Command, agentOf(river))+const releaseId = state.agents.find(a => a.id === finn)!.releaseId!+tryRun('9. Finn 2\'s host confirms its stop:', { type: 'agent.remove', agentId: finn, releaseId } as Command, agentOf(finn))diff --git a/backend/src/superTabs/closedAgents.test.ts b/backend/src/superTabs/closedAgents.test.tsindex f23a3b87d..d131f0ba6 100644--- a/backend/src/superTabs/closedAgents.test.ts+++ b/backend/src/superTabs/closedAgents.test.ts@@ -181,6 +181,18 @@ describe('what may come back', () => {expect(state.conversations.find(c => c.id === 'g1')!.agentIds).toEqual([])expect(state.conversations.find(c => c.id === 'g2')!.agentIds).toEqual(['a1'])})++ // #2207 (Ken): the project chat holds only its coordinator among agents, so a session that was a member there comes back to+ // its tasks alone, unless it comes back as the project chat's coordinator.+ it('comes back to the project chat only as its coordinator', () => {+ const chat = removedGroup({ id: 'lead-p' })+ const member = restoring({ conversations: [chat, removedGroup()], removedSessions: [record({ groupIds: ['lead-p', 'g1'] })] })+ restoreSessions(member, 'mac', ['h1'], AT, new Set(['h1']), () => {})+ expect(member.conversations.map(c => c.agentIds)).toEqual([[], ['a1']])+ const coordinator = restoring({ conversations: [{ ...chat }], removedSessions: [record({ groupIds: ['lead-p'], leadOf: ['lead-p'] })] })+ restoreSessions(coordinator, 'mac', ['h1'], AT, new Set(['h1']), () => {})+ expect(coordinator.conversations[0]).toMatchObject({ leadId: 'a1', agentIds: ['a1'] })+ })})describe('what a removal keeps', () => {diff --git a/backend/src/superTabs/closedAgents.ts b/backend/src/superTabs/closedAgents.tsindex 1028c4f7c..57c93803f 100644--- a/backend/src/superTabs/closedAgents.ts+++ b/backend/src/superTabs/closedAgents.ts@@ -144,6 +144,7 @@ export function restoreSessions(state: SuperTabState, machineId: string, runningconst records = state.removedSessionsif (!records?.length) return []const restored: Agent[] = []+ const projectChats = new Set(projectsOf(state).map(p => p.leadConversationId))const left = records.filter(record => {if (record.machineId !== machineId) return trueif (now - record.removedAt >= REMOVED_KEEP_MS) return false@@ -158,8 +159,10 @@ export function restoreSessions(state: SuperTabState, machineId: string, runningfor (const group of state.conversations) {if (group.archived || group.dormant || group.kind || group.audience || (state.projects && group.projectId !== record.agent.projectId)) continueif (barredFromTeamWritten(state, group, record.agent)) continue- if (record.groupIds.includes(group.id) && !group.agentIds.includes(record.agent.id)) group.agentIds.push(record.agent.id)if (record.leadOf.includes(group.id) && !group.leadId) group.leadId = record.agent.id+ // A project chat holds only its coordinator among agents (#2207): a member there comes back to it only as its coordinator.+ if (projectChats.has(group.id) && group.leadId !== record.agent.id) continue+ if (record.groupIds.includes(group.id) && !group.agentIds.includes(record.agent.id)) group.agentIds.push(record.agent.id)}restored.push(record.agent)return falsediff --git a/backend/src/superTabs/commands.test.ts b/backend/src/superTabs/commands.test.tsindex d3feb7140..3c5bd1dc4 100644--- a/backend/src/superTabs/commands.test.ts+++ b/backend/src/superTabs/commands.test.ts@@ -31,15 +31,23 @@ function fixture() {const invited = run({ type: 'invite.create', email: peer.email, role, conversationId: 'lead' })run({ type: 'invite.accept', inviteId: invited.result.inviteId as string }, peer)}+ /** [agentId] stored in the project chat as a Swarm from before #2207 holds one there: it stays until removed, though no+ * command adds an agent but the coordinator there now. */+ const seat = (agentId: string) => {+ const chat = state.conversations.find(c => c.id === 'lead')!+ if (!chat.agentIds.includes(agentId)) chat.agentIds.push(agentId)+ }const add = (harnessId: string, contributorId = 'owner', group = 'lead', lead = false) => {const result = run({ type: 'agent.add', conversationId: group, machineId: 'host', harnessId,name: harnessId, configuration: config, lead }, contributorId === 'owner' ? owner : peer,{ contribution: { machineOwnerId: 'host-owner', contributorId } })- return result.result.agentId as string+ const agentId = result.result.agentId as string+ if (group === 'lead' && !lead) seat(agentId)+ return agentId}const group = () => run({ type: 'conversation.create', title: 'Offline editing', brief: 'Save edits while offline.',checks: [{ description: 'Reconnect preserves the edits.', independent: true }] }).result.conversationId as string- return { run, invite, add, group, get state() { return state } }+ return { run, invite, add, seat, group, get state() { return state } }}/** Makes [machineId] [contributorId]'s contributed machine used only for agents (`harness team on`), reporting now, so a@@ -125,7 +133,7 @@ describe('five-part tasks', () => {describe('person removal notices', () => {it('tells each remaining Lead who removed an agent and its open task', () => {const f = fixture(), lead = f.add('lead', 'owner', 'lead', true), group = f.group(), worker = f.add('worker', 'owner', group)- f.run({ type: 'conversation.agent', conversationId: 'lead', agentId: worker, present: true, lead: false })+ f.seat(worker)f.run({ type: 'work.assign', conversationId: group, agentId: worker })const name = f.state.agents.find(a => a.id === worker)!.displayName!const effects = f.run({ type: 'agent.remove', agentId: worker })@@ -251,7 +259,8 @@ describe('Super Tab collaboration policy', () => {const result = f.run({ type: 'agent.add', conversationId: 'lead', machineId: 'host', harnessId: 'lead',name: 'Lead', configuration: config, lead: true, initialMessage: 'Discuss the architecture.' }, owner,{ contribution: { machineOwnerId: 'host-owner', contributorId: 'owner' } })- expect(result.messages).toEqual([expect.objectContaining({ text: 'Discuss the architecture.', recipients: [], author: expect.objectContaining({ kind: 'person', id: 'owner' }) })])+ expect(result.messages).toEqual([expect.objectContaining({ text: 'Discuss the architecture.', recipients: [], author: expect.objectContaining({ kind: 'person', id: 'owner' }) }),+ expect.objectContaining({ text: `owner added "${f.state.agents[0]!.displayName}".`, recipients: [], source: { kind: 'system' } })])expect(f.state.conversations[0]!.leadId).toBe(result.result.agentId)})it('keeps adding an agent separate from creating conversations and assigning work', () => {@@ -261,7 +270,7 @@ describe('Super Tab collaboration policy', () => {const worker = f.add('worker', 'owner', group)expect(f.state.conversations.map(c => c.title)).toEqual(['Lead', 'Offline editing'])expect(f.state.conversations[1]).toMatchObject({ leadId: lead, agentIds: [lead, worker], assignment: null })- f.run({ type: 'conversation.agent', conversationId: 'lead', agentId: worker, present: true, lead: false })+ f.run({ type: 'conversation.agent', conversationId: group, agentId: worker, present: true, lead: false })expect(f.state.agents).toHaveLength(2)expect(f.state.conversations).toHaveLength(2) // Lead and the group})@@ -463,7 +472,7 @@ describe('Super Tab collaboration policy', () => {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('Choose an agent in this conversation')+ expect(() => send(f, as(lead), 'lead', [engineer])).toThrow('The project chat holds only its coordinator among agents: a post here reaches the coordinator.')})it('never delivers an agent its own message, except its note to itself', () => {@@ -923,8 +932,8 @@ function routed() {const f = fixture()const lead = f.add('lead', 'owner', 'lead', true), worker = f.add('worker')// An agent runs on 'machine', so the Swarm lists it and a start there is allowed.- f.run({ type: 'agent.add', conversationId: 'lead', machineId: 'machine', harnessId: 'remote', name: 'Remote', configuration: config, lead: false },- owner, { contribution: { machineOwnerId: 'host-owner', contributorId: 'owner' } })+ f.seat(f.run({ type: 'agent.add', conversationId: 'lead', machineId: 'machine', harnessId: 'remote', name: 'Remote', configuration: config, lead: false },+ owner, { contribution: { machineOwnerId: 'host-owner', contributorId: 'owner' } }).result.agentId as string)const agentActor = (agentId: string): Actor => ({ kind: 'agent', agentId, machineOwnerId: 'host-owner' })const define = (group: string) => f.run({ type: 'work.define', conversationId: group, brief: 'Build it.', checks: [{ description: 'Tests pass.', independent: false }] })/** Records a completed native start for an agent, as the decision's `new` final refers to it. */@@ -1012,8 +1021,12 @@ describe('agent bookkeeping in the chats people read', () => {// The Lead choosing otherwise than its route, on a start or an assignment.const request = { conversationId: 'lead', machineId: 'machine', engine: 'claude', model: 'opus', effort: 'xhigh', name: 'Builder', cwd: '/repo', worktree: false,requirements: { memoryBytes: 0, diskBytes: 0, maxCpuPercent: 100, tools: [], devices: [], quotaRequired: false } }- const started = f.run({ type: 'agent.start', request, routeDecisionId: 'd1', overrideReason: 'Xhigh is needed here.' }, f.leadActor, { routeDecision: open(), contribution: f.contribution })- expect(started.messages.filter(m => m.text.startsWith('lead started')).map(shown)).toEqual([false])+ // No agent starts into the project chat any more (#2207); in a task the line is its record.+ expect(() => f.run({ type: 'agent.start', request, routeDecisionId: 'd1', overrideReason: 'Xhigh is needed here.' }, f.leadActor, { routeDecision: open(), contribution: f.contribution }))+ .toThrow(expect.objectContaining({ code: 'PROJECT_CHAT_COORDINATOR_ONLY' }))+ const started = f.run({ type: 'agent.start', request: { ...request, conversationId: group }, routeDecisionId: 'd1', overrideReason: 'Xhigh is needed here.' }, f.leadActor,+ { routeDecision: open({ conversationId: group }), contribution: f.contribution })+ expect(started.messages.filter(m => m.text.startsWith('lead started')).map(shown)).toEqual([true])f.define(group)const assigned = f.run({ type: 'work.assign', conversationId: group, agentId: f.worker, routeDecisionId: 'd1', overrideReason: 'It knows the code.' }, f.leadActor,{ routeDecision: open({ conversationId: group }) })@@ -1038,8 +1051,10 @@ describe('agent bookkeeping in the chats people read', () => {const ready = f.run({ type: 'agent.startSettled', startId, warning: null }, actor, { contribution }).messagesreturn [...joined, ...ready].map(m => [m.text, shown(m)])}- expect(lines('lead', 'in-lead')).toEqual([['Builder joined. Preparing its model.', false], ['Builder is ready for an assignment.', false]])- expect(lines(group, 'in-task')).toEqual([['Builder joined. Preparing its model.', true], ['Builder is ready for an assignment.', true]])+ // No agent but its coordinator starts into the project chat (#2207); its coordinator's lines are lead.start's (leadStart.test).+ expect(() => lines('lead', 'in-lead')).toThrow(expect.objectContaining({ code: 'PROJECT_CHAT_COORDINATOR_ONLY' }))+ const pm = f.state.agents.find(a => a.id === lead)!.displayName+ expect(lines(group, 'in-task')).toEqual([[`"${pm}" added "Builder". Preparing its model.`, true], ['Builder is ready for an assignment.', true]])})})@@ -1203,25 +1218,25 @@ describe('decisions linked to work', () => {})it('refuses a second link while the first assignment of the decision is still running', () => {- const f = routed()- f.define('lead')- const running = f.run({ type: 'work.assign', conversationId: 'lead', agentId: f.worker, ...via }, f.leadActor, decisionIn())+ const f = routed(), task = f.group()+ f.define(task)+ const running = f.run({ type: 'work.assign', conversationId: task, agentId: f.worker, ...via }, f.leadActor, decisionIn(task))const assignmentId = running.result.assignmentId as string- const request = { conversationId: 'lead', machineId: 'machine', engine: 'claude', model: 'opus', effort: 'high', name: 'Builder', cwd: '/repo', worktree: false,+ const request = { conversationId: task, machineId: 'machine', engine: 'claude', model: 'opus', effort: 'high', name: 'Builder', cwd: '/repo', worktree: false,requirements: { memoryBytes: 0, diskBytes: 0, maxCpuPercent: 100, tools: [], devices: [], quotaRequired: false } }- expect(() => f.run({ type: 'agent.start', request, routeDecisionId: 'd1' }, f.leadActor, { routeDecision: open({ assignmentId }), contribution: f.contribution }))+ expect(() => f.run({ type: 'agent.start', request, routeDecisionId: 'd1' }, f.leadActor, { routeDecision: open({ conversationId: task, assignmentId }), contribution: f.contribution })).toThrow('already has running work')// Once that work ended and the worker is kept, the decision may be linked again.- f.state.conversations.find(c => c.id === 'lead')!.assignment!.status = 'stopped'+ f.state.conversations.find(c => c.id === task)!.assignment!.status = 'stopped'f.run({ type: 'agent.release', agentId: f.worker, decision: 'keep' }, f.leadActor)- expect(f.run({ type: 'agent.start', request, routeDecisionId: 'd1' }, f.leadActor, { routeDecision: open({ assignmentId }), contribution: f.contribution }).routeDecisions).toHaveLength(1)+ expect(f.run({ type: 'agent.start', request, routeDecisionId: 'd1' }, f.leadActor, { routeDecision: open({ conversationId: task, assignmentId }), contribution: f.contribution }).routeDecisions).toHaveLength(1)})it('records a start that differs from the pick, with the reason when one is given, and tells the group about it', () => {- const f = routed()- const request = { conversationId: 'lead', machineId: 'machine', engine: 'claude', model: 'opus', effort: 'xhigh', name: 'Builder', cwd: '/repo', worktree: false,+ const f = routed(), task = f.group()+ const request = { conversationId: task, machineId: 'machine', engine: 'claude', model: 'opus', effort: 'xhigh', name: 'Builder', cwd: '/repo', worktree: false,requirements: { memoryBytes: 0, diskBytes: 0, maxCpuPercent: 100, tools: [], devices: [], quotaRequired: false } }- const start = (extra: Record<string, unknown> = {}) => f.run({ type: 'agent.start', request, routeDecisionId: 'd1', ...extra } as Command, f.leadActor, { routeDecision: open(), contribution: f.contribution })+ const start = (extra: Record<string, unknown> = {}) => f.run({ type: 'agent.start', request, routeDecisionId: 'd1', ...extra } as Command, f.leadActor, { routeDecision: open({ conversationId: task }), contribution: f.contribution })expect(start().routeDecisions[0]).toMatchObject({ op: 'final', override: { by: 'lead', reason: 'No reason given.' } })const effects = start({ overrideReason: 'Xhigh is needed here.' })expect(effects.routeDecisions[0]).toMatchObject({ op: 'final', override: { by: 'lead', reason: 'Xhigh is needed here.' } })@@ -1249,10 +1264,10 @@ describe('decisions linked to work', () => {})it('links a start that matches the picked new agent, model and effort', () => {- const f = routed()- const request = { conversationId: 'lead', machineId: 'machine', engine: 'claude', model: 'opus', effort: 'high', name: 'Builder', cwd: '/repo', worktree: false,+ const f = routed(), task = f.group()+ const request = { conversationId: task, machineId: 'machine', engine: 'claude', model: 'opus', effort: 'high', name: 'Builder', cwd: '/repo', worktree: false,requirements: { memoryBytes: 0, diskBytes: 0, maxCpuPercent: 100, tools: [], devices: [], quotaRequired: false } }- const effects = f.run({ type: 'agent.start', request, routeDecisionId: 'd1' }, f.leadActor, { routeDecision: open(), contribution: f.contribution })+ const effects = f.run({ type: 'agent.start', request, routeDecisionId: 'd1' }, f.leadActor, { routeDecision: open({ conversationId: task }), contribution: f.contribution })expect(effects.routeDecisions).toEqual([{ op: 'final', id: 'd1', final: { kind: 'new', startId: effects.result.startId, machineId: 'machine', engine: 'claude', model: 'opus', effort: 'high' } }])expect(f.state.starts![0]!.request).toMatchObject({ model: 'opus', effort: 'high' })})@@ -1292,14 +1307,14 @@ describe('the route is advice', () => {const as = (agentId: string): Actor => ({ kind: 'agent', agentId, machineOwnerId: 'host-owner' })it('starts and assigns without a route, an agent as a person does', () => {- const f = routed()- f.define('lead')- expect(f.run({ type: 'agent.start', request: request() }, f.leadActor, { contribution: f.contribution }).result.startId).toBeTruthy()- expect(f.run({ type: 'work.assign', conversationId: 'lead', agentId: f.worker }, f.leadActor).result.assignmentId).toBeTruthy()- const g = routed()- g.define('lead')- expect(g.run({ type: 'agent.start', request: request() }, owner, { contribution: g.contribution }).result.startId).toBeTruthy()- expect(g.run({ type: 'work.assign', conversationId: 'lead', agentId: g.worker }, owner).result.assignmentId).toBeTruthy()+ const f = routed(), task = f.group()+ f.define(task)+ expect(f.run({ type: 'agent.start', request: request({ conversationId: task }) }, f.leadActor, { contribution: f.contribution }).result.startId).toBeTruthy()+ expect(f.run({ type: 'work.assign', conversationId: task, agentId: f.worker }, f.leadActor).result.assignmentId).toBeTruthy()+ const g = routed(), gTask = g.group()+ g.define(gTask)+ expect(g.run({ type: 'agent.start', request: request({ conversationId: gTask }) }, owner, { contribution: g.contribution }).result.startId).toBeTruthy()+ expect(g.run({ type: 'work.assign', conversationId: gTask, agentId: g.worker }, owner).result.assignmentId).toBeTruthy()})it('starts, assigns and routes whatever the old rules said', () => {@@ -1399,7 +1414,7 @@ describe('the route is advice', () => {Object.assign(f.state.projects![0]!, { skillSet: 'custom', roles: [{ id: 'pm', name: 'PM', kind: 'lead', version: 'v1', defaults: { engine: 'claude', model: 'sonnet', effort: 'high' } },{ id: 'dev', name: 'Engineer', kind: 'builder', version: 'v1', defaults: { engine: 'claude', model: 'sonnet', effort: 'high' } }] })- const { model: _model, effort: _effort, ...unnamed } = request({ roleId: 'dev' })+ const { model: _model, effort: _effort, ...unnamed } = request({ roleId: 'dev', conversationId: f.group() })f.run({ type: 'agent.start', request: unnamed }, owner, { contribution: f.contribution })expect(f.state.starts!.at(-1)!.request).not.toHaveProperty('model')expect(f.state.starts!.at(-1)!.request).not.toHaveProperty('effort')@@ -1443,11 +1458,12 @@ it('says in the project chat when a Product Manager on its person\'s own Mac cou{ contribution: { machineOwnerId: 'owner', contributorId: 'owner' } })return effects.messages.filter(m => m.conversationId === 'lead').map(m => m.text)}+ // Each after the row naming who added it (#2207).expect(join({ launchRefused: { model: 'opus', effort: 'xhigh' } })).toEqual(- ['Product Manager started. It asked for opus at xhigh and runs its engine\u2019s own model there: this machine could not launch it with them.'])- expect(join({})).toEqual([])+ ['Product Manager started. It asked for opus at xhigh and runs its engine\u2019s own model there: this machine could not launch it with them.', expect.stringMatching(/^owner added \S+\.$/)])+ expect(join({})).toEqual([expect.stringMatching(/^owner added \S+\.$/)])// Only a Product Manager's start says it.- expect(join({ launchRefused: { model: 'opus', effort: 'xhigh' } }, false)).toEqual([])+ expect(join({ launchRefused: { model: 'opus', effort: 'xhigh' } }, false)).not.toContainEqual(expect.stringContaining('could not launch'))expect(commandSchema.safeParse({ type: 'agent.add', conversationId: 'lead', machineId: 'host', harnessId: 'pm', name: 'Lead', configuration: config, lead: true,launchRefused: { model: 'opus', other: 1 } }).success).toBe(false)// Only what a launch could have asked for (cli lib/launchModel.ts MODEL and EFFORT): one short word each.@@ -1561,8 +1577,16 @@ describe('message attachments', () => {f.run({ type: 'agent.release', agentId: worker, decision: 'stop' } as Command, leadActor)expect(() => f.run({ type: 'agent.remove', agentId: worker }, { ...workerActor, agentId: other })).toThrow()const releaseId = f.state.agents.find(a => a.id === worker)!.releaseId!+ const chats = f.state.conversations.filter(c => c.agentIds.includes(worker)).map(c => c.id)+ // A quiet chat it was in too: a row there would wake it (Luna's re-review).+ const quiet = f.group()+ Object.assign(f.state.conversations.find(c => c.id === quiet)!, { agentIds: [worker], dormant: true })+ const name = f.state.agents.find(a => a.id === worker)!.displayNameconst removed = f.run({ type: 'agent.remove', agentId: worker, releaseId }, workerActor)- expect(removed.messages).toEqual([])+ // Each chat it was in says it left (Luna's review of #2207): its own host confirmed the stop. The quiet one stays quiet.+ expect(chats.length).toBeGreaterThan(0)+ expect(removed.messages.map(m => [m.conversationId, m.text, m.recipients])).toEqual(chats.map(id => [id, `"${name}" left.`, []]))+ expect(f.state.conversations.find(c => c.id === quiet)).toMatchObject({ agentIds: [], dormant: true })expect(removed.cancelledAgents).toContain(worker)expect(f.state.agents.some(a => a.id === worker)).toBe(false)// Its host closed the session before confirming; nothing is left for it to close.@@ -1694,15 +1718,98 @@ describe('any agent of the project', () => {expect(() => f.run(member(outside, true), E)).toThrow(coordinatorRequired)expect(() => f.run(member(f.worker, false), E)).toThrow(coordinatorRequired)expect(chat()).not.toContain(outside)- f.run(member(outside, true), f.leadActor)- expect(chat()).toContain(outside)- f.run(member(outside, false), owner)- expect(chat()).not.toContain(outside)+ // An agent stored there before the project chat held only its coordinator is still the coordinator's or a person's to take out.+ f.run(member(f.worker, false), owner)+ expect(chat()).not.toContain(f.worker)// A task's members are any agent's to add.f.run({ type: 'conversation.agent', conversationId: group, agentId: engineer, present: true, lead: false }, E)expect(f.state.conversations.find(c => c.id === group)!.agentIds).toContain(engineer)})+ // Ken, 2026-11-02: a Reviewer was a member of the project chat next to the PM, so Desktop opened two terminals there and the+ // Reviewer posted an announcement in it. The project chat holds only its coordinator among agents, whoever adds one and by+ // whichever path; an announcement goes in its task, for the coordinator or its requester to repost.+ it('refuses any agent but the coordinator in the project chat, by every path', () => {+ const { f, engineer } = project(), group = f.group()+ const reviewer = f.add('reviewer', 'owner', group)+ const chat = () => f.state.conversations.find(c => c.id === 'lead')!+ const refused = expect.objectContaining({ code: 'PROJECT_CHAT_COORDINATOR_ONLY', message: expect.stringContaining('holds only its coordinator') })+ const member = (agentId: string, lead = false) => ({ type: 'conversation.agent', conversationId: 'lead', agentId, present: true, lead }) as Command+ const request = { conversationId: 'lead', machineId: 'machine', engine: 'claude', name: 'Finn 2', cwd: '/repo', worktree: true,+ requirements: { memoryBytes: 0, diskBytes: 0, maxCpuPercent: 80, tools: [], devices: [], quotaRequired: false } }+ const before = structuredClone(f.state)+ for (const actor of [f.leadActor, owner]) {+ expect(() => f.run(member(reviewer), actor)).toThrow(refused)+ expect(() => f.run({ type: 'agent.start', request } as Command, actor, { contribution: f.contribution })).toThrow(refused)+ expect(() => f.run({ type: 'work.assign', conversationId: 'lead', agentId: reviewer }, actor)).toThrow(refused)+ }+ // 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.+ 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') }))+ 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)+ f.run(member(f.lead), owner)+ expect(chat().agentIds).not.toContain(reviewer)+ // A project chat with no coordinator still takes one.+ const g = fixture(), task = g.group(), pm = g.add('pm', 'owner', task)+ g.run({ type: 'conversation.agent', conversationId: 'lead', agentId: pm, present: true, lead: true })+ expect(g.state.conversations.find(c => c.id === 'lead')).toMatchObject({ leadId: pm, agentIds: [pm] })+ // A new session shared there, as Desktop's New agent in the project chat does, joins the project for its tasks, and the+ // chat says who added it and why it is not a member.+ const shared = f.run({ type: 'agent.add', conversationId: 'lead', machineId: 'host', harnessId: 'shared', name: 'Shared', configuration: config, lead: false },+ owner, { contribution: f.contribution })+ expect(f.state.agents.map(a => a.id)).toContain(shared.result.agentId)+ expect(chat().agentIds).not.toContain(shared.result.agentId)+ expect(shared.messages).toEqual([expect.objectContaining({ conversationId: 'lead', recipients: [], source: { kind: 'system' },+ text: 'owner added "Shared" to the project. The project chat holds only its coordinator among agents, so "Shared" works in its tasks.' })])+ })++ // Ken, 2026-11-02: nothing recorded who put the Reviewer in the project chat. Each agent added to or removed from a chat+ // leaves a row there naming who did it, shown to the chat's readers and waking nobody.+ it('leaves a row naming who added or removed an agent', () => {+ const { f, engineer, E } = project(), group = f.group()+ const rows = (effects: { messages: Array<{ conversationId: string; text: string; recipients: string[]; source?: Record<string, unknown> }> }) =>+ effects.messages.filter(m => m.source?.kind === 'system' && /^\S+( \S+)? (added|removed|joined|left)\b/.test(m.text) && !m.text.includes('Swarm'))+ .map(m => [m.conversationId, m.text, m.recipients])+ // Quoted, as the rows give agents' names (Luna's review).+ const name = (id: string) => JSON.stringify(f.state.agents.find(a => a.id === id)!.displayName)+ const member = (agentId: string, present: boolean) => ({ type: 'conversation.agent', conversationId: group, agentId, present, lead: false }) as Command+ expect(rows(f.run(member(engineer, true), owner))).toEqual([[group, `owner added ${name(engineer)}.`, []]])+ expect(rows(f.run(member(engineer, false), f.leadActor))).toEqual([[group, `${name(f.lead)} removed ${name(engineer)}.`, []]])+ // An assignment, a post naming an agent from outside, and an agent's own first post there each say so too.+ expect(rows(f.run({ type: 'work.assign', conversationId: group, agentId: engineer }, f.leadActor))).toEqual([[group, `${name(f.lead)} added ${name(engineer)}.`, []]])+ expect(rows(f.run({ type: 'message.send', conversationId: group, text: 'Please review.', replyTo: null, recipientIds: [f.worker] }, E)))+ .toEqual([[group, `${name(engineer)} added ${name(f.worker)}.`, []]])+ const outsider = f.add('outsider', 'owner', f.group())+ expect(rows(f.run({ type: 'message.send', conversationId: group, text: 'Here too.', replyTo: null, recipientIds: [] }, { kind: 'agent', agentId: outsider, machineOwnerId: 'host-owner' })))+ .toEqual([[group, `${name(outsider)} joined.`, []]])+ // A start's line names who started it.+ const request = { conversationId: group, machineId: 'machine', engine: 'claude', name: 'Builder', cwd: '/repo', worktree: true,+ requirements: { memoryBytes: 0, diskBytes: 0, maxCpuPercent: 80, tools: [], devices: [], quotaRequired: false } }+ const startId = f.run({ type: 'agent.start', request } as Command, f.leadActor, { contribution: f.contribution }).result.startId as string+ f.run({ type: 'agent.startDispatch', startId }, f.leadActor, { contribution: f.contribution })+ expect(f.run({ type: 'agent.started', startId, harnessId: 'builder', configuration: { ...config, engine: 'claude' } }, f.leadActor, { contribution: f.contribution })+ .messages.map(m => m.text)).toEqual([`${name(f.lead)} added "Builder". Ready for an assignment.`])+ // Nothing changed, nothing said; an agent removed from the Swarm has its removal row alone.+ expect(rows(f.run(member(engineer, true), owner))).toEqual([])+ expect(rows(f.run({ type: 'agent.remove', agentId: outsider }))).toEqual([])+ })++ // Orion's review of #2207: refusing a post's recipient by name told whoever held another project's agent id its name.+ it('names in a refusal only an agent of the chat\'s own project', () => {+ const { f } = project()+ const other = f.run({ type: 'project.create', name: 'Private', visibility: 'private', brief: '' }).result as { conversationId: string }+ const theirs = f.run({ type: 'agent.add', conversationId: other.conversationId, machineId: 'host', harnessId: 'theirs', name: 'Secret name', configuration: config,+ lead: true }, owner, { contribution: f.contribution }).result.agentId as string+ const sent = () => f.run({ type: 'message.send', conversationId: 'lead', text: 'Hello.', replyTo: null, recipientIds: [theirs] }, f.leadActor)+ expect(sent).toThrow(expect.objectContaining({ code: 'INVALID_RECIPIENT' }))+ expect(sent).not.toThrow('Secret name')+ })+// Security review L2: the project chat is the people's and is never archived, so its work, name and records are its// coordinator's or a person's, as its members are. Any agent defined work there, assigned it, started agents into it,// renamed it and recorded merges on it.@@ -1722,8 +1829,11 @@ describe('any agent of the project', () => {const before = structuredClone(f.state)for (const [command, context] of commands) expect(() => f.run(command, E, context), command.type).toThrow(coordinatorRequired)expect(f.state).toEqual(before)- // The coordinator still does each there, and a person renames it.- for (const [command, context] of commands) f.run(command, f.leadActor, context)+ // The coordinator still does each there but a start, which no agent but its coordinator joins (#2207), and a person renames it.+ for (const [command, context] of commands) {+ if (command.type === 'agent.start') expect(() => f.run(command, f.leadActor, context)).toThrow(expect.objectContaining({ code: 'PROJECT_CHAT_COORDINATOR_ONLY' }))+ else f.run(command, f.leadActor, context)+ }expect(f.state.conversations.find(c => c.id === 'lead')!).toMatchObject({ title: 'Renamed by an agent', assignment: { agentId: engineer } })f.run({ type: 'conversation.rename', conversationId: 'lead', title: 'Pilot chat' }, owner)expect(f.state.conversations.find(c => c.id === 'lead')!.title).toBe('Pilot chat')@@ -2570,11 +2680,11 @@ describe('a task that requires a machine or a device', () => {// 2026-10-27: a task to check a device plugged into one person's Mac was routed to another machine by policy order.const task = { goal: 'Check the round device', changes: 'None', constraints: 'On the Mac it is plugged into', owns: ['devices'] }const checks = [{ description: 'It answers.', independent: false }]- const requiring = (f: ReturnType<typeof routed>, requires: Record<string, unknown>, actor: Actor = owner) =>- f.run({ type: 'work.define', conversationId: 'lead', task: { ...task, requires }, checks } as Command, actor)- const startOn = (f: ReturnType<typeof routed>, machineId: string, actor: Actor, devices: string[] = []) => f.run({ type: 'agent.start', request: { conversationId: 'lead', machineId,+ const requiring = (f: ReturnType<typeof routed>, requires: Record<string, unknown>, actor: Actor = owner, conversationId = 'lead') =>+ f.run({ type: 'work.define', conversationId, task: { ...task, requires }, checks } as Command, actor)+ const startOn = (f: ReturnType<typeof routed>, conversationId: string, machineId: string, actor: Actor, devices: string[] = []) => f.run({ type: 'agent.start', request: { conversationId, machineId,engine: 'claude', model: 'opus', effort: 'high', name: 'Builder', cwd: '/repo', worktree: true,- requirements: { memoryBytes: 1, diskBytes: 1, maxCpuPercent: 80, tools: [], devices, quotaRequired: false } }, ...via } as Command, actor, { contribution: f.contribution, ...decisionIn() })+ requirements: { memoryBytes: 1, diskBytes: 1, maxCpuPercent: 80, tools: [], devices, quotaRequired: false } }, ...via } as Command, actor, { contribution: f.contribution, ...decisionIn(conversationId) })it('keeps the requirement on the task, without naming the machine in the brief', () => {const f = routed()@@ -2592,15 +2702,15 @@ describe('a task that requires a machine or a device', () => {// A requirement is information (project instructions, phase 4): the route says where a task can run, and nothing refuses// a start, assignment or route elsewhere ('the route is advice > ignores a task's machine and device requirement').it('refuses no agent\'s start, assignment or route on another machine or without the device, and warns no person', () => {- const f = routed()- requiring(f, { machines: ['machine'], devices: ['/dev/cu.usbmodem1'] })+ const f = routed(), group = f.group()+ requiring(f, { machines: ['machine'], devices: ['/dev/cu.usbmodem1'] }, owner, group)for (const actor of [f.leadActor, owner]) {- const started = startOn(f, 'host', actor)+ const started = startOn(f, group, 'host', actor)expect(started.result.warnings).toBeUndefined()expect(started.messages.map(m => m.text)).not.toContain(expect.stringContaining('anyway'))}- expect(f.run({ type: 'work.assign', conversationId: 'lead', agentId: f.worker, ...via }, f.leadActor, decisionIn()).result.warnings).toBeUndefined()- expect(f.run({ type: 'route.record', conversationId: 'lead', decision: record({ candidates: [candidate('c0', { machineId: 'host' })] }) } as Command, f.leadActor, {})+ expect(f.run({ type: 'work.assign', conversationId: group, agentId: f.worker, ...via }, f.leadActor, decisionIn(group)).result.warnings).toBeUndefined()+ expect(f.run({ type: 'route.record', conversationId: group, decision: record({ candidates: [candidate('c0', { machineId: 'host' })] }) } as Command, f.leadActor, {}).result.routeDecisionId).toBeTruthy()})it('shows a reader who cannot see the machine only that the task waits for one', () => {@@ -2722,7 +2832,7 @@ it('marks every row the system writes in the owner\'s name, so a Lead cannot quorun({ type: 'machine.contribute', machineId: 'mac', name: 'Mac', cwd: '/swarm', engines: ['codex'], maxAgents: 2 },{ contribution: { machineOwnerId: 'owner', contributorId: 'owner' }, abandonedStartIds: ['s2'] })expect(rows.map(r => r.text)).toEqual(expect.arrayContaining(['Builder never started and will not start now.',- 'Could not start Builder: its machine could not prepare or launch it. Whoever started it, the Product Manager and the machine owner can read why.', 'owner removed worker from the Swarm.']))+ 'Could not start Builder: its machine could not prepare or launch it. Whoever started it, the Product Manager and the machine owner can read why.', 'owner removed "worker" from the Swarm.']))expect(rows.filter(r => !r.source).map(r => r.text)).toEqual([])})@@ -2820,26 +2930,28 @@ describe('the owner\'s rules, after review', () => {expect(f.run({ type: 'conversation.agent', conversationId: 'lead', agentId: f.worker, present: true, lead: false }, f.leadActor).result.warnings).toBeUndefined()const byHand = f.run({ type: 'conversation.agent', conversationId: group, agentId: f.worker, present: true, lead: true })expect(byHand.result.warnings).toBeUndefined()- expect(byHand.messages).toEqual([])- expect(f.run({ type: 'conversation.agent', conversationId: 'lead', agentId: f.worker, present: false, lead: false }, f.leadActor).messages).toEqual([])+ // Only the row naming who added it (#2207).+ expect(byHand.messages.map(m => m.text)).toEqual(['owner added "worker".'])+ expect(f.run({ type: 'conversation.agent', conversationId: 'lead', agentId: f.worker, present: false, lead: false }, f.leadActor).messages.map(m => m.text))+ .toEqual([`"${f.state.agents.find(a => a.id === f.lead)!.displayName}" removed "worker".`])})it('takes the owner\'s opt-out from grid models first into the instructions, and refuses no start', () => {- const f = routed()+ const f = routed(), task = f.group()delete f.state.projects![0]!.instructionsRevisionexpect(f.run(set({ kind: 'noGridFirst' }, 'Subscriptions first.')).instructions!.text).toBe(appendRouting(INSTRUCTIONS_TEMPLATE, 'Subscriptions first.'))expect(f.state).not.toHaveProperty('rules')- expect(f.run({ type: 'agent.start', request: request(), ...via } as Command, f.leadActor, { contribution: f.contribution, ...decisionIn() }).result.startId).toEqual(expect.any(String))+ expect(f.run({ type: 'agent.start', request: request({ conversationId: task }), ...via } as Command, f.leadActor, { contribution: f.contribution, ...decisionIn(task) }).result.startId).toEqual(expect.any(String))expect(() => f.run(set({ kind: 'noGridFirst', engine: 'claude' }))).toThrow()})it('launches a start recorded before a rule', () => {- const f = routed()- const startId = f.run({ type: 'agent.start', request: request(), ...via } as Command, f.leadActor, { contribution: f.contribution, ...decisionIn() }).result.startId as string+ const f = routed(), task = f.group()+ const startId = f.run({ type: 'agent.start', request: request({ conversationId: task }), ...via } as Command, f.leadActor, { contribution: f.contribution, ...decisionIn(task) }).result.startId as stringf.state.rules = [{ id: 'r', projectId: 'lead', rule: { kind: 'minEffort', effort: 'max' }, text: 'Max effort.', askedBy: 'owner', askedIn: null,addedBy: 'person:owner', createdAt: '' }]f.run({ type: 'agent.startDispatch', startId }, f.leadActor, { contribution: f.contribution })expect(f.state.starts!.find(s => s.id === startId)!.dispatched).toBe(true)// A person's own start is launched; the warning was given when it was asked for.- const own = f.run({ type: 'agent.start', request: request() } as Command, owner, { contribution: f.contribution }).result.startId as string+ const own = f.run({ type: 'agent.start', request: request({ conversationId: task }) } as Command, owner, { contribution: f.contribution }).result.startId as stringexpect(f.run({ type: 'agent.startDispatch', startId: own }, owner, { contribution: f.contribution }).messages).toEqual([])})// The nightly reflection still names models as the owner did (costs/reflection.ts).@@ -2904,8 +3016,10 @@ describe('machine.remove', () => {expect(f.state.conversations.find(c => c.id === group)!.assignment!.status).toBe('reconciling')const notice = effects.messages.find(m => m.conversationId === group)!expect(notice).toMatchObject({ author: { kind: 'person', id: 'owner' }, source: { kind: 'machine-removed', machine: 'Studio' } })- expect(notice.text).toBe(`owner removed Studio from the Swarm, and ${workerName} with it. Its task "Offline editing" has no agent now.`)+ // Its name quoted, as in every row naming an agent (Luna's re-review of #2207).+ expect(notice.text).toBe(`owner removed Studio from the Swarm, and "${workerName}" with it. Its task "Offline editing" has no agent now.`)expect(notice.recipients).toEqual([lead])+ // Its own row names the agent it took, so no member row repeats it (Echo's review of #2207).expect(effects.messages.map(m => m.conversationId)).toEqual([group])expect(new Set(effects.messages.map(m => m.id)).size).toBe(effects.messages.length)})@@ -3567,25 +3681,25 @@ describe('the Local models add-on', () => {})it('lets a contributed machine run a Builder on a model the Swarm\'s grid serves now, and only then', () => {- const f = fixture()+ const f = fixture(), task = f.group()const grid = f.run({ type: 'localModels.set', enabled: true }).result.grid as stringserved(f, grid)- f.run({ type: 'agent.start', request: start(grid) }, owner, grant)+ f.run({ type: 'agent.start', request: start(grid, { conversationId: task }) }, owner, grant)expect(f.state.starts).toHaveLength(1)const refused = (request: Record<string, unknown>, now = 1000) => () => applyCommand(f.state, owner, { type: 'agent.start', request } as Command,{ now, operationId: 'op-x', ...grant })- expect(refused(start('swarm-other'))).toThrow(expect.objectContaining({ code: 'OUTSIDE_CONTRIBUTION' }))- expect(refused(start(grid, { gridModel: 'llama-70b' }))).toThrow(expect.objectContaining({ code: 'OUTSIDE_CONTRIBUTION' }))- expect(refused(start(grid, { model: 'opus' }))).toThrow(expect.objectContaining({ code: 'OUTSIDE_CONTRIBUTION' }))+ expect(refused(start('swarm-other', { conversationId: task }))).toThrow(expect.objectContaining({ code: 'OUTSIDE_CONTRIBUTION' }))+ expect(refused(start(grid, { conversationId: task, gridModel: 'llama-70b' }))).toThrow(expect.objectContaining({ code: 'OUTSIDE_CONTRIBUTION' }))+ expect(refused(start(grid, { conversationId: task, model: 'opus' }))).toThrow(expect.objectContaining({ code: 'OUTSIDE_CONTRIBUTION' }))// A reading too old to trust says nothing is served.- expect(refused(start(grid), 1000 + 60_000)).toThrow(expect.objectContaining({ code: 'OUTSIDE_CONTRIBUTION' }))+ expect(refused(start(grid, { conversationId: task }), 1000 + 60_000)).toThrow(expect.objectContaining({ code: 'OUTSIDE_CONTRIBUTION' }))f.run({ type: 'localModels.set', enabled: false })- expect(refused(start(grid))).toThrow(expect.objectContaining({ code: 'OUTSIDE_CONTRIBUTION' }))+ expect(refused(start(grid, { conversationId: task }))).toThrow(expect.objectContaining({ code: 'OUTSIDE_CONTRIBUTION' }))})it('lets a machine run a Builder on a model shared with its owner on another grid, and only that machine', () => {- const f = fixture()+ const f = fixture(), task = f.group()const grid = f.run({ type: 'localModels.set', enabled: true }).result.grid as stringserved(f, grid)const host = f.state.machines![0]!@@ -3594,27 +3708,27 @@ describe('the Local models add-on', () => {f.state.machines!.push({ ...structuredClone(host), machineId: 'mini', name: 'Mini', observation: { ...structuredClone(host.observation!), localModels: [] } })const refused = (request: Record<string, unknown>, now = 1000) => () => applyCommand(f.state, owner, { type: 'agent.start', request } as Command,{ now, operationId: 'op-x', ...grant })- expect(refused(start('team-grid', { machineId: 'mini' }))).toThrow(expect.objectContaining({ code: 'OUTSIDE_CONTRIBUTION' }))- expect(refused(start('team-grid', { gridModel: 'llama-70b' }))).toThrow(expect.objectContaining({ code: 'OUTSIDE_CONTRIBUTION' }))- expect(refused(start('team-grid'), 1000 + 60_000)).toThrow(expect.objectContaining({ code: 'OUTSIDE_CONTRIBUTION' }))- f.run({ type: 'agent.start', request: start('team-grid') }, owner, grant)+ expect(refused(start('team-grid', { conversationId: task, machineId: 'mini' }))).toThrow(expect.objectContaining({ code: 'OUTSIDE_CONTRIBUTION' }))+ expect(refused(start('team-grid', { conversationId: task, gridModel: 'llama-70b' }))).toThrow(expect.objectContaining({ code: 'OUTSIDE_CONTRIBUTION' }))+ expect(refused(start('team-grid', { conversationId: task }), 1000 + 60_000)).toThrow(expect.objectContaining({ code: 'OUTSIDE_CONTRIBUTION' }))+ f.run({ type: 'agent.start', request: start('team-grid', { conversationId: task }) }, owner, grant)expect(f.state.starts).toEqual([expect.objectContaining({ request: expect.objectContaining({ machineId: 'host', gridName: 'team-grid', gridModel: 'qwen3-30b' }) })])// Not while the add-on is off.f.run({ type: 'localModels.set', enabled: false })- expect(refused(start('team-grid'))).toThrow(expect.objectContaining({ code: 'OUTSIDE_CONTRIBUTION' }))+ expect(refused(start('team-grid', { conversationId: task }))).toThrow(expect.objectContaining({ code: 'OUTSIDE_CONTRIBUTION' }))})it('matches a start to a local route candidate by its grid model, and records it on the decision', () => {- const f = fixture()+ const f = fixture(), task = f.group()const lead = f.add('lead', 'owner', 'lead', true)const grid = f.run({ type: 'localModels.set', enabled: true }).result.grid as stringserved(f, grid)const local = candidate('c0', { machineId: 'host', model: 'default', effort: 'default', quality: 1, cost: 1, gridModel: 'qwen3-30b', gridName: grid })const docs = { difficulty: 'low', risk: 'low', why: 'Fix the docs.', kind: 'docs' }- const decision = { routeDecision: { id: 'd1', conversationId: 'lead', record: record({ assessment: docs, candidates: [local, candidate('c1')], pick: 'c0' }),+ const decision = { routeDecision: { id: 'd1', conversationId: task, record: record({ assessment: docs, candidates: [local, candidate('c1')], pick: 'c0' }),final: null, override: null, assignmentId: null, outcome: null } as unknown as RouteDecision }const actor: Actor = { kind: 'agent', agentId: lead, machineOwnerId: 'host-owner' }- const effects = f.run({ type: 'agent.start', request: start(grid), routeDecisionId: 'd1' }, actor, { ...grant, ...decision })+ const effects = f.run({ type: 'agent.start', request: start(grid, { conversationId: task }), routeDecisionId: 'd1' }, actor, { ...grant, ...decision })expect(effects.routeDecisions).toEqual([expect.objectContaining({ op: 'final', final: expect.objectContaining({ gridModel: 'qwen3-30b', gridName: grid }) })])expect(effects.messages.some(m => m.source?.kind === 'route-override')).toBe(false)})@@ -4372,7 +4486,7 @@ describe('notices of failed work', () => {expect(texts.length).toBeGreaterThanOrEqual(7)for (const text of texts) expect(text).not.toMatch(NEXT_STEP)expect(texts).toEqual(expect.arrayContaining([expect.stringContaining('lost its task'), expect.stringContaining('can\'t get answers from its model'),- expect.stringContaining('instead of'), expect.stringContaining('removed worker from the Swarm. Its task "Offline editing" has no agent now.'),+ expect.stringContaining('instead of'), expect.stringContaining('removed "worker" from the Swarm. Its task "Offline editing" has no agent now.'),expect.stringContaining('removed Studio from the Swarm'), 'Builder never started and will not start now.']))})})@@ -4395,12 +4509,13 @@ describe('an engine that cannot run on a contributed machine', () => {request: { conversationId: 'lead', machineId: 'mac', engine: 'codex', name: 'Builder', cwd: '/repo', ...extra }, harnessId: null, dispatched: true, error: null })f.state.starts = ['s1', 's2', 's3', 's4'].map(id => start(id)) as neverconst fail = (startId: string) => f.run({ type: 'agent.startFailed', startId, error: 'Codex could not launch.' }, owner).messages[0]!- const request = (extra: Record<string, unknown> = {}) => ({ conversationId: 'lead', machineId: 'mac', engine: 'codex', name: 'Builder', cwd: '/repo',+ const task = f.group()+ const request = (extra: Record<string, unknown> = {}) => ({ conversationId: task, machineId: 'mac', engine: 'codex', name: 'Builder', cwd: '/repo',worktree: true, requirements: { memoryBytes: 1, diskBytes: 1, maxCpuPercent: 100, tools: ['git'], devices: [], quotaRequired: false }, ...extra })// A grid start is routed as docs work, which a grid model may build (rules.ts buildRefusal).const begin = (extra: Record<string, unknown> = {}) => f.run({ type: 'agent.start', request: request(extra), ...via } as Command, leadActor,{ contribution: { machineOwnerId: 'owner', contributorId: 'owner' },- ...decisionIn('lead', extra.gridModel ? { assessment: { difficulty: 'low', risk: 'low', why: 'Docs.', kind: 'docs' } } : {}) })+ ...decisionIn(task, extra.gridModel ? { assessment: { difficulty: 'low', risk: 'low', why: 'Docs.', kind: 'docs' } } : {}) })return { f, lead, fail, begin, start }}diff --git a/backend/src/superTabs/commands.ts b/backend/src/superTabs/commands.tsindex 8afe87e04..006443d40 100644--- a/backend/src/superTabs/commands.ts+++ b/backend/src/superTabs/commands.ts@@ -41,6 +41,7 @@ import { avatarChoice, setAgentAvatar, setMemberAvatar, setStatus, statusSchema,import { switchExpired } from './tidy.js'import { BUILT_IN_ROLE_DEFAULTS, agentProjectId, audienceOf, canReadProject, deleteProject, markConfidential, onTeamAccount, requireSingleRegistration, groupProject, inviteLanding, ledProject, manageProject, MAX_ROLES, mutableProjects, placeRules, projectAgent, projectMembers, projectOf, projectsOf, readAgent, readConversation, readProject, requestedByLine, sameProject, sharedWithLeads, withRoleDefaults, type SwarmProject, PROJECT_STATUS_MAX } from './projects.js'import { recordClosing } from './closedAgents.js'+import { actorLabel, memberChanges, memberRowText, quotedName } from './memberRows.js'import { BUDDY_SESSION_CAPABILITY, chatOwner, endSessionEntry, entryProject, liveSessions, mainBuddyOf, MAX_SESSION_WAITING, requireChatOwner, SESSION_ENDED_KIND, sessionAgentsOf, sessionOf, setSessions, type SessionEndReason } from './buddySessions.js'import { BUDDY_REQUIREMENTS, buddyChatId, buddyReady, chosenBuddyName, isBuddy, isBuddyChat, isSwarmBuddy, isSwarmBuddyChat, MAX_PROPOSAL_ASKS, MAX_PROPOSAL_ATTACHMENTS, openBuddyChat, openSwarmBuddyChat, PM_LINE_KIND, PROPOSAL_ASK_MS, PROPOSAL_SENT_KIND, proposalSentText, proposalText, renameBuddy, requireBuddyCommand, swarmBuddyChatId } from './buddies.js'import { BUDDY_OWN_MACHINE_REFUSAL, CODEX_BUDDY_REFUSAL } from './buddyContract.js'@@ -747,6 +748,8 @@ function applyCommandOnce(original: SuperTabState, actor: Actor, input: Command,assignAgentDisplayNames(state.agents)const result: Record<string, unknown> = {}const effects: CommandEffects = { state, messages: ended, cancelledAgents: [], previousAttempts: [], routeDecisions: [], result }+ /** Agents this command took out of the Swarm with a row of its own in each of their chats (agent.remove, removeMachine). */+ const announcedRemovals = new Set<string>()const operationId = stableId(state.id, actorKey(actor), context.operationId)// A deleted Swarm (deletion.ts) takes only its hosts' confirmations and its owner's restore; anything else, from anyone,@@ -893,6 +896,17 @@ function applyCommandOnce(original: SuperTabState, actor: Actor, input: Command,const projectChatWork = (conversationId: string) => {if (projectsOf(state).some(p => p.leadConversationId === conversationId)) coordinatorOrPerson(state, actor, conversationId)}+ /** The project chat holds only its coordinator among agents (Ken, #2207): a Reviewer added next to the PM opened a second+ * terminal there and posted announcements in the people's chat. Refused whoever adds one and by whichever command; an+ * agent stored there before stays until it is removed, and a new coordinator is still set (lead). [agentId] is null for an+ * agent not started yet. */+ const projectChatJoin = (group: Conversation, agentId: string | null, name: string, post = false) => {+ if (!projectsOf(state).some(p => p.leadConversationId === group.id)) return+ if (agentId && (agentId === group.leadId || group.agentIds.includes(agentId))) return+ fail('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, 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. *//** A private conversation is chat only (design section 4.8). */const chatOnly = (conversationId: string) => {@@ -1287,6 +1301,8 @@ function applyCommandOnce(original: SuperTabState, actor: Actor, input: Command,* until its host deletes the Swarm's folders there — or leaves at once when that host is offline* (spec 2026-10-23-remove-machine.md). */const removeMachine = (machineId: string, pool: ContributedMachine | undefined, members: Agent[], how: (machine: string) => string, lead = false) => {+ // Its row in each group names them, so no member row repeats it.+ for (const member of members) announcedRemovals.add(member.id)const pending = state.starts?.filter(s => s.request.machineId === machineId && !s.harnessId && !s.error) ?? []// A launch already under way would arrive with nowhere to go; it finishes in moments.if (pending.some(s => s.dispatched)) fail('STARTS_PENDING', 'An agent is starting on this machine. Try again in a moment.')@@ -1299,7 +1315,7 @@ function applyCommandOnce(original: SuperTabState, actor: Actor, input: Command,const affected = state.conversations.filter(group => group.agentIds.some(a => removed.has(a))|| (group.leadId && removed.has(group.leadId)) || (group.assignment && removed.has(group.assignment.agentId))).map(group => ({ group, names: members.filter(a => group.agentIds.includes(a.id) || group.leadId === a.id || group.assignment?.agentId === a.id)- .map(a => a.displayName ?? a.name), task: !!group.assignment && removed.has(group.assignment.agentId) && activeWork(group) }))+ .map(a => quotedName(a.displayName ?? a.name)), task: !!group.assignment && removed.has(group.assignment.agentId) && activeWork(group) }))for (const target of members) removeAgent(target, { lead })if (pool) {// Paused, so routing in clients that do not know removals stops offering it too.@@ -1985,6 +2001,10 @@ function applyCommandOnce(original: SuperTabState, actor: Actor, input: Command,// there. A new session may be on any machine of the person's, as their start may (agent.start).if (isBuddyChat(group)) fail('BUDDY_CHAT_FIXED', 'A Buddy chat stays its owner\'s and their Buddy\'s: nobody else is added to it.', 403)if (existing) joinable(group, existing)+ // A session already in the Swarm joins the project chat as conversation.agent adds one: refused but for its coordinator. A+ // new one shared there (Desktop's New agent in the project chat) joins the project alone, for its tasks (#2207).+ const sharedHere = !command.lead && projectsOf(state).some(p => p.leadConversationId === group.id)+ if (sharedHere && existing) projectChatJoin(group, existing.id, existing.displayName ?? existing.name)// An older Desktop adds a session in a custom role (roleId): kept, with a Reviewer role's kind, for older readers, and// read by no command. The role name it means is the agent's (instructions.ts legacyRoleName).const roleKind = command.roleId ? project.roles?.find(r => r.id === command.roleId)?.kind : undefined@@ -2024,7 +2044,8 @@ function applyCommandOnce(original: SuperTabState, actor: Actor, input: Command,if (existing && (existing.hostGrant ?? null) !== (grant.hostGrant ?? null)) {fail('CONTRIBUTION_REVOKED', 'Reconcile and remove this old contribution before adding it under the new machine share.', 403)}- if (!group.agentIds.includes(agentId)) group.agentIds.push(agentId)+ if (sharedHere && !existing) message(group.id, `${who} added ${quotedName(command.name)} to the project. The project chat holds only its coordinator among agents, so ${quotedName(command.name)} works in its tasks.`, [], null, SYSTEM_ROW)+ else if (!group.agentIds.includes(agentId)) group.agentIds.push(agentId)if (command.lead) {keepLead(group, agentId)if (group.leadId && group.leadId !== agentId && activeWork(group)) fail('WORK_ACTIVE', 'Reconcile active work before replacing its lead.')@@ -2046,6 +2067,8 @@ function applyCommandOnce(original: SuperTabState, actor: Actor, input: Command,case 'agent.start': {chatOnly(command.request.conversationId)projectChatWork(command.request.conversationId)+ // A coordinator starts there through lead.start alone.+ projectChatJoin(open(state, command.request.conversationId), null, command.request.name)const home = groupProject(state, open(state, command.request.conversationId))if (state.paused) fail('PAUSED', 'New work is paused in this Super Tab.')if (!['claude', 'codex'].includes(command.request.engine)) {@@ -2399,9 +2422,12 @@ function applyCommandOnce(original: SuperTabState, actor: Actor, input: Command,message(group.id, joined.text, [], null, joined.source)}// A Buddy always starts on a Swarm machine: its chat hears once it settles, as the Lead does for a worker.- else if (!start.request.buddyOf) message(group.id, start.poolGeneration- ? `${start.request.name} joined. Preparing its model.`- : `${start.request.name} joined. Ready for an assignment.`, [], null, bookkeeping(group.id, SYSTEM_ROW))+ // Naming who started it, as any agent added to a chat is named with who added it (#2207).+ else if (!start.request.buddyOf) {+ const starter = actorLabel(state, start.actorKey)+ const joined = starter ? `${starter} added ${quotedName(start.request.name)}.` : `${quotedName(start.request.name)} joined.`+ message(group.id, `${joined} ${start.poolGeneration ? 'Preparing its model.' : 'Ready for an assignment.'}`, [], null, bookkeeping(group.id, SYSTEM_ROW))+ }break}case 'agent.configuration': {@@ -2585,13 +2611,15 @@ function applyCommandOnce(original: SuperTabState, actor: Actor, input: Command,const affected = actor.kind === 'person' ? state.conversations.filter(group => group.agentIds.includes(target.id)|| group.leadId === target.id || group.assignment?.agentId === target.id) : []removeAgent(target, { close: !hostStop })+ // A person's removal says so in each of its chats; its host's confirmed stop leaves the member row.+ if (affected.length) announcedRemovals.add(target.id)for (const group of affected) {const task = group.assignment?.agentId === target.id && activeWork(group)? ` Its task "${group.title}" has no agent now.` : ''const lead = group.leadId && group.agentIds.includes(group.leadId) ? group.leadId : null// One person can withdraw an agent from several groups. Each notice needs its own durable message ID.effects.messages.push({ id: stableId(operationId, 'agent-removed', group.id), conversationId: group.id,- author: sender, text: `${sender.name.split('@')[0]} removed ${target.displayName ?? target.name} from the Swarm.${task}`,+ author: sender, text: `${sender.name.split('@')[0]} removed ${quotedName(target.displayName ?? target.name)} from the Swarm.${task}`,replyTo: null, recipients: lead ? [lead] : [], source: SYSTEM_ROW })}break@@ -2616,6 +2644,7 @@ function applyCommandOnce(original: SuperTabState, actor: Actor, input: Command,group.agentIds = group.agentIds.filter(id => id !== command.agentId)if (group.leadId === command.agentId) group.leadId = null} else {+ if (!command.lead) projectChatJoin(group, member.id, member.displayName ?? member.name)if (group.audience && ledProject(state, member.id)?.id !== groupProject(state, group).id) {fail('AUDIENCE_LEAD_ONLY', 'A private conversation holds only the Lead among agents.', 403)}@@ -2781,6 +2810,8 @@ function applyCommandOnce(original: SuperTabState, actor: Actor, input: Command,// 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)) {+ // 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)teamJoin(groupProject(state, group), id, group)group.agentIds.push(id)@@ -2950,6 +2981,7 @@ function applyCommandOnce(original: SuperTabState, actor: Actor, input: Command,if (state.paused) fail('PAUSED', 'New work is paused in this Super Tab.')if (activeWork(group)) fail('WORK_ACTIVE', 'The current assignment must finish or be reconciled before reassignment.')const worker = agent(state, command.agentId)+ projectChatJoin(group, worker.id, worker.displayName ?? worker.name)assignable(worker)sameProject(state, group, worker)const home = groupProject(state, group)@@ -3210,6 +3242,18 @@ function applyCommandOnce(original: SuperTabState, actor: Actor, input: Command,markConfidential(state)assignAgentDisplayNames(state.agents)keepUsernames(original, state)+ // Every agent added to or removed from a chat leaves a row there naming who did it (Ken, #2207), for the chat's readers and+ // waking nobody. A start's own line names its starter (agent.started).+ // Not for a removal this command already said in each chat, nor for a Swarm being deleted.+ const membership = command.type === 'agent.started' || command.type === 'swarm.delete' ? []+ : memberChanges(original, state).filter(c => !announcedRemovals.has(c.agent.id) || state.agents.some(a => a.id === c.agent.id))+ if (membership.length) {+ const by = { id: actor.kind === 'agent' ? actor.agentId : actor.userId, label: actorLabel(state, actorKey(actor)) ?? who }+ for (const { group, agent: member, added } of membership) {+ effects.messages.push({ id: stableId(operationId, 'member', group.id, member.id), conversationId: group.id, author: sender,+ text: memberRowText(by, { id: member.id, name: member.displayName ?? member.name }, added), replyTo: null, recipients: [], source: SYSTEM_ROW })+ }+ }// The size limit is per stored part now (parts/commit.ts PART_LIMIT_BYTES); a Swarm as a whole has none.// Every row this command writes, whatever its words came from: an older message resent, a rule written before this check.for (const draft of effects.messages) {diff --git a/backend/src/superTabs/memberRows.test.ts b/backend/src/superTabs/memberRows.test.tsnew file mode 100644index 000000000..5c4fcbd4a--- /dev/null+++ b/backend/src/superTabs/memberRows.test.ts@@ -0,0 +1,89 @@+import { describe, expect, it } from 'vitest'+import { actorLabel, memberChanges, memberRowText, sessionRows } from './memberRows.js'+import type { Agent, Conversation, SuperTabState } from './model.js'++const agent = (id: string, name = id, displayName?: string) => ({ id, name, ...(displayName ? { displayName } : {}) }) as Agent+const group = (id: string, agentIds: string[], patch: Partial<Conversation> = {}) => ({ id, agentIds, ...patch }) as Conversation+const swarm = (conversations: Conversation[], agents: Agent[] = [agent('a'), agent('b'), agent('c')]) =>+ ({ conversations, agents, people: [{ id: 'ken', email: '[email protected]', role: 'owner', generation: 'g' }] }) as unknown as SuperTabState++// Ken, 2026-11-02: nothing recorded who put a Reviewer in the project chat. Every agent added to or removed from a chat leaves+// a row naming who did it.+describe('who joined or left each chat in one command', () => {+ it('finds each agent added to or removed from a chat that was there before', () => {+ const before = swarm([group('task', ['a', 'b']), group('other', ['c'])])+ const after = swarm([group('task', ['a', 'c']), group('other', ['c'])])+ expect(memberChanges(before, after).map(c => [c.group.id, c.agent.id, c.added])).toEqual([['task', 'c', true], ['task', 'b', false]])+ })++ it('leaves out a chat the command opened and a Buddy chat', () => {+ const before = swarm([group('task', ['a']), group('buddy', ['a'], { kind: 'buddy' })])+ const after = swarm([group('task', ['a']), group('buddy', ['a', 'c'], { kind: 'buddy' }), group('new', ['a'])])+ expect(memberChanges(before, after)).toEqual([])+ })++ // Luna's review: a host-confirmed stop and a machine's removal took agents out of their chats with no row.+ it('finds an agent that left the Swarm in each chat it was in, by its name as it was', () => {+ const before = swarm([group('task', ['a', 'b']), group('other', ['b'])])+ const after = swarm([group('task', ['a']), group('other', [])], [agent('a'), agent('c')])+ expect(memberChanges(before, after).map(c => [c.group.id, c.agent.id, c.added])).toEqual([['task', 'b', false], ['other', 'b', false]])+ })++ // Luna's re-review: any row wakes its chat (parts/commit.ts), so a long-lived agent's close woke every quiet chat it was+ // ever in. Nobody reads there; its leaving is not said in an archived or dormant chat.+ it('says no removal in an archived or dormant chat, which a row would wake', () => {+ const before = swarm([group('old', ['a', 'b'], { archived: true }), group('quiet', ['b'], { dormant: true }), group('task', ['b'])])+ const after = swarm([group('old', ['a'], { archived: true }), group('quiet', [], { dormant: true }), group('task', [])], [agent('a')])+ expect(memberChanges(before, after).map(c => c.group.id)).toEqual(['task'])+ expect(sessionRows(before, after, new Set(['b']), 'report-1').map(r => r.conversationId)).toEqual(['task'])+ })++ it('finds nothing when no chat changed, in whatever order its members are kept', () => {+ const state = swarm([group('task', ['a', 'b'])])+ expect(memberChanges(state, swarm([group('task', ['a', 'b'])]))).toEqual([])+ expect(memberChanges(state, swarm([group('task', ['b', 'a'])]))).toEqual([])+ })+})++describe('the row that says so', () => {+ it('names who added or removed the agent, or says it joined or left itself', () => {+ expect(memberRowText({ id: 'ken', label: 'ken15' }, { id: 'finn', name: 'Finn 2' }, true)).toBe('ken15 added "Finn 2".')+ expect(memberRowText({ id: 'river', label: '"River"' }, { id: 'finn', name: 'Finn 2' }, false)).toBe('"River" removed "Finn 2".')+ expect(memberRowText({ id: 'finn', label: '"Finn 2"' }, { id: 'finn', name: 'Finn 2' }, true)).toBe('"Finn 2" joined.')+ expect(memberRowText({ id: 'finn', label: '"Finn 2"' }, { id: 'finn', name: 'Finn 2' }, false)).toBe('"Finn 2" left.')+ })++ // Luna's review: an agent's name is free text, and these rows are the audit trail. Quoted, a name cannot read as another row.+ it('quotes an agent\'s name, so one written as a sentence or with quotes in it reads as a name', () => {+ expect(memberRowText({ id: 'river', label: '"River"' }, { id: 'f', name: 'Finn. Ken removed Reviewer' }, true)).toBe('"River" added "Finn. Ken removed Reviewer".')+ expect(memberRowText({ id: 'ken', label: 'ken15' }, { id: 'f', name: 'Finn" removed "Reviewer' }, true)).toBe('ken15 added "Finn\\" removed \\"Reviewer".')+ })++ it('names an agent by its quoted display name and a person by their username, from a start\'s actor key too', () => {+ const state = swarm([], [agent('pm', 'Lead', 'River')])+ expect(actorLabel(state, 'agent:pm')).toBe('"River"')+ expect(actorLabel(state, 'person:ken')).toBe('ken15')+ expect(actorLabel(state, 'agent:gone')).toBeUndefined()+ expect(actorLabel(state, 'person:gone')).toBeUndefined()+ })+})++// Cleo, Orion, Luna and Echo: a machine's report closes sessions and reopens them outside any command, and those changes left no+// row. Nobody asked for them, so the row says what happened, written as the agent itself.+describe('a machine report\'s rows', () => {+ it('says an agent left each chat its closed session was in, and rejoined each one its reopened session came back to', () => {+ const before = swarm([group('task', ['a', 'b']), group('review', ['c'])])+ const after = swarm([group('task', ['a', 'c']), group('review', ['c'])], [agent('a'), agent('c', 'c', 'Cleo')])+ const rows = sessionRows(before, after, new Set(['b', 'c']), 'report-1')+ expect(rows.map(r => [r.conversationId, r.text, r.recipients, r.source, r.author.id])).toEqual([+ ['task', '"Cleo" rejoined: its session reopened.', [], { kind: 'system' }, 'c'],+ ['task', '"b" left: its session closed.', [], { kind: 'system' }, 'b']])+ expect(new Set(rows.map(r => r.id)).size).toBe(2)+ })++ it('writes nothing for an agent the report did not close or reopen, or in a Buddy chat', () => {+ const before = swarm([group('task', ['a']), group('buddy', ['b'], { kind: 'buddy' })])+ const after = swarm([group('task', []), group('buddy', [], { kind: 'buddy' })], [agent('a')])+ expect(sessionRows(before, after, new Set(['b']), 'report-1')).toEqual([])+ })+})diff --git a/backend/src/superTabs/memberRows.ts b/backend/src/superTabs/memberRows.tsnew file mode 100644index 000000000..11edd0dd7--- /dev/null+++ b/backend/src/superTabs/memberRows.ts@@ -0,0 +1,69 @@+import { agentDisplayName } from './agentNames.js'+import { isBuddyChat } from './buddies.js'+import { stableId, type Agent, type Conversation, type MessageDraft, type SuperTabState } from './model.js'+import { usernameOf } from './usernames.js'++/** One agent that joined or left one chat in a command. */+export type MemberChange = { group: Conversation; agent: Agent; added: boolean }++/**+ * Who joined or left each chat between [original] and [state], for the row that names who did it (Ken, #2207: nothing+ * recorded who put a Reviewer in the project chat). Only chats there before, as a new chat's opening says who is in it; never a+ * Buddy chat, whose sessions come and go with its threads. An agent that left the Swarm is found in each chat it was in, by+ * its name as it was (Luna's review: a host-confirmed stop said nothing), but for an archived or dormant one.+ */+export function memberChanges(original: SuperTabState, state: SuperTabState): MemberChange[] {+ const before = new Map(original.conversations.map(c => [c.id, c.agentIds]))+ const agents = new Map([...original.agents, ...state.agents].map(a => [a.id, a]))+ const changes: MemberChange[] = []+ for (const group of state.conversations) {+ const was = before.get(group.id)+ if (!was || isBuddyChat(group) || (was.length === group.agentIds.length && was.every((id, i) => group.agentIds[i] === id))) continue+ const then = new Set(was), now = new Set(group.agentIds)+ for (const id of group.agentIds) if (!then.has(id) && agents.has(id)) changes.push({ group, agent: agents.get(id)!, added: true })+ // Nobody reads an archived or dormant chat, and any row wakes it (parts/commit.ts): a long-lived agent's close woke every+ // quiet chat it was ever in (Luna's re-review). Its leaving is said only where people still read.+ if (group.archived || group.dormant) continue+ for (const id of was) if (!now.has(id) && agents.has(id)) changes.push({ group, agent: agents.get(id)!, added: false })+ }+ return changes+}++/** An agent's name as these rows give it: quoted, as it is free text and the rows are the chat's record of who is in it, so a+ * name written as a sentence ("Finn. Ken removed Reviewer") or holding quotes reads as one name (Luna's review). */+export const quotedName = (name: string): string => JSON.stringify(name)++/** 'ken15 added "Finn 2".' / '"River" removed "Finn 2".', or '"Finn 2" joined.' / '"Finn 2" left.' for the agent itself. [by]'s+ * label is actorLabel's. */+export function memberRowText(by: { id: string; label: string }, agent: { id: string; name: string }, added: boolean): string {+ if (by.id === agent.id) return `${quotedName(agent.name)} ${added ? 'joined' : 'left'}.`+ return `${by.label} ${added ? 'added' : 'removed'} ${quotedName(agent.name)}.`+}++/** How a row names the actor [key] (model.ts actorKey): an agent by its quoted display name, a person by their username; none+ * once gone. */+export function actorLabel(state: SuperTabState, key: string): string | undefined {+ const [kind, id] = [key.slice(0, key.indexOf(':')), key.slice(key.indexOf(':') + 1)]+ if (kind === 'agent') {+ const agent = state.agents.find(a => a.id === id)+ return agent && quotedName(agent.displayName ?? agent.name)+ }+ const person = state.people.find(p => p.id === id)+ return person && (usernameOf(state, id) ?? person.email.split('@')[0])+}++/**+ * The rows for the chats a machine's report closed [agentIds]' sessions out of or reopened them into (store.ts; Cleo, Orion,+ * Luna and Echo: these ran outside any command and wrote nothing, so an agent could come back to read its chats unrecorded).+ * Nobody asked for them, so each says what happened, written as the agent itself and shown to the chat's readers, waking+ * nobody. [stamp] keeps one report's rows apart from another's.+ */+export function sessionRows(original: SuperTabState, state: SuperTabState, agentIds: ReadonlySet<string>, stamp: string): MessageDraft[] {+ return memberChanges(original, state).filter(change => agentIds.has(change.agent.id)).map(({ group, agent, added }) => {+ const name = agent.displayName ?? agentDisplayName(state.agents, agent.id) ?? agent.name+ return { id: stableId('member-session', stamp, group.id, agent.id), conversationId: group.id,+ author: { kind: 'agent' as const, id: agent.id, name: agent.name, displayName: name, membershipGeneration: agent.membershipGeneration },+ text: `${quotedName(name)} ${added ? 'rejoined: its session reopened' : 'left: its session closed'}.`, replyTo: null, recipients: [],+ source: { kind: 'system' } }+ })+}diff --git a/backend/src/superTabs/mentions.test.ts b/backend/src/superTabs/mentions.test.tsindex 317a48204..28cbe6b3e 100644--- a/backend/src/superTabs/mentions.test.ts+++ b/backend/src/superTabs/mentions.test.ts@@ -32,10 +32,10 @@ function fixture() {// A conversation only `peer` reads: their chat with their Buddy.const pmChat = run({ type: 'buddy.chat', projectId: app.projectId }, peer).result.conversationId as stringconst send = (conversationId: string, mentions: string[], actor: Actor = owner) => run({ type: 'message.send', conversationId,- text: 'Please look.', replyTo: null, recipientIds: [], mentions }, actor).messages.at(-1)!+ text: 'Please look.', replyTo: null, recipientIds: [], mentions }, actor).messages.find(m => !m.source)!/** A post that tags only by what its text says, as people type in chat. */const say = (conversationId: string, text: string, actor: Actor = owner, mentions?: string[]) => run({ type: 'message.send', conversationId,- text, replyTo: null, recipientIds: [], ...(mentions ? { mentions } : {}) }, actor).messages.at(-1)!+ text, replyTo: null, recipientIds: [], ...(mentions ? { mentions } : {}) }, actor).messages.find(m => !m.source)!return { run, send, say, app, lead, worker, group, pmChat, get state() { return state } }}@@ -143,7 +143,8 @@ describe('tags in the text', () => {const f = fixture()const lead = { kind: 'agent' as const, agentId: f.lead, machineOwnerId: 'owner' }expect(f.say(f.app.conversationId, '@peer please confirm', lead).mentions).toEqual(['peer'])- const worker = f.say(f.app.conversationId, '@peer please confirm', { kind: 'agent', agentId: f.worker, machineOwnerId: 'owner' })+ // A worker posts in a task: the project chat holds only its coordinator among agents (#2207).+ const worker = f.say(f.group, '@peer please confirm', { kind: 'agent', agentId: f.worker, machineOwnerId: 'owner' })expect(worker.mentions).toEqual(['peer'])expect(worker.text).toBe('@peer please confirm')})diff --git a/backend/src/superTabs/parts/touches.test.ts b/backend/src/superTabs/parts/touches.test.tsindex 156279eb3..082eb02a0 100644--- a/backend/src/superTabs/parts/touches.test.ts+++ b/backend/src/superTabs/parts/touches.test.ts@@ -116,7 +116,7 @@ describe('the parts a command touches (design section 1.2, column T)', () => {it('makes two starts on one machine meet on its slot ledger and on the head', () => {const f = swarm()- const request = { conversationId: 'lead', machineId: 'host', engine: 'codex', name: 'New', cwd: '/w', worktree: false,+ const request = { conversationId: f.group('A').id, machineId: 'host', engine: 'codex', name: 'New', cwd: '/w', worktree: false,requirements: { memoryBytes: 0, diskBytes: 0, maxCpuPercent: 100, tools: [], devices: [], quotaRequired: false } }const { touches } = f.run({ type: 'agent.start', request }, owner, { contribution: { machineOwnerId: 'host-owner', contributorId: 'owner' } })expect(has(touches, 'machine', 'host')).toBe(true)diff --git a/backend/src/superTabs/projects.test.ts b/backend/src/superTabs/projects.test.tsindex d67b7b981..adf909a5c 100644--- a/backend/src/superTabs/projects.test.ts+++ b/backend/src/superTabs/projects.test.ts@@ -23,7 +23,10 @@ function setup() {run({ type: 'project.create', name: 'Other project', visibility, brief: 'Its own outcome' }, actor) as { projectId: string; conversationId: string }const add = (conversationId: string, harnessId: string, lead = true) =>run({ type: 'agent.add', conversationId, harnessId, machineId: 'machine', name: harnessId, configuration, lead }).agentId as string- return { run, project, add, get state() { return state }, get messages() { return messages } }+ /** A task of [projectId]: work starts and is assigned there, as the project chat holds only its coordinator (#2207). */+ const task = (projectId: string, actor = owner) =>+ run({ type: 'conversation.create', projectId, title: 'Work', brief: 'Do it', checks: [] }, actor).conversationId as string+ return { run, project, add, task, get state() { return state }, get messages() { return messages } }}describe('projects inside an invite-only swarm', () => {@@ -192,7 +195,7 @@ describe('projects inside an invite-only swarm', () => {it.each(['queued', 'dispatched', 'settling'] as const)('refuses %s starts and removes only settled project history', phase => {const f = setup(), p = f.project()- const request = { conversationId: p.conversationId, machineId: 'machine', engine: 'codex', name: 'Builder',+ const request = { conversationId: f.task(p.projectId), machineId: 'machine', engine: 'codex', name: 'Builder',cwd: '/work', worktree: true,requirements: { memoryBytes: 0, diskBytes: 0, maxCpuPercent: 100, tools: [], devices: [], quotaRequired: false } }const startId = String(f.run({ type: 'agent.start', request }).startId)@@ -236,13 +239,13 @@ describe('projects inside an invite-only swarm', () => {})it('keeps active work visible after its contributed agent is removed', () => {- const f = setup(), p = f.project(), agentId = f.add(p.conversationId, 'worker', false)- f.run({ type: 'work.define', conversationId: p.conversationId, brief: 'Finish the task',+ const f = setup(), p = f.project(), agentId = f.add(p.conversationId, 'worker', false), work = f.task(p.projectId)+ f.run({ type: 'work.define', conversationId: work, brief: 'Finish the task',checks: [{ description: 'Verified', independent: false }] })- f.run({ type: 'work.assign', conversationId: p.conversationId, agentId })+ f.run({ type: 'work.assign', conversationId: work, agentId })f.run({ type: 'agent.remove', agentId })expect(() => f.run({ type: 'project.delete', projectId: p.projectId })).toThrow('active work')- expect(readConversation(f.state, owner, p.conversationId).assignment?.status).toBe('reconciling')+ expect(readConversation(f.state, owner, work).assignment?.status).toBe('reconciling')})})@@ -335,9 +338,10 @@ describe('custom role sets', () => {const writer = { ...role('abcdefabcdef', 'Docs writer', 'builder'), defaults: { engine: 'codex' as const, model: 'gpt-6.1-sol', effort: 'medium' } }const { f, p, roles } = custom([...defaults(), writer])Object.assign(projectOf(f.state, p.projectId), { skillSet: 'custom' })+ const work = f.task(p.projectId, peer)expect(roles()!.find(r => r.id === 'abcdefabcdef')).toMatchObject({ defaults: { engine: 'codex', model: 'gpt-6.1-sol', effort: 'medium' } })const startWith = (extra: Record<string, unknown>) => {- const startId = String(f.run({ type: 'agent.start', request: request(p.conversationId, extra) } as Command, peer).startId)+ const startId = String(f.run({ type: 'agent.start', request: request(work, extra) } as Command, peer).startId)return f.state.starts!.find(s => s.id === startId)!.request}expect(startWith({ roleId: 'abcdefabcdef' })).not.toHaveProperty('model')@@ -357,7 +361,8 @@ describe('custom role sets', () => {it('starts and assigns in any role id an older client sends, keeping it and naming the agent by it', () => {const { f, p } = custom([...defaults(), role('abcdefabcdef', 'Docs writer', 'builder')])// The project's owner starts it: a teammate's project runs only on a Team machine (machines.ts teamWorkCheck).- const start = (extra: Record<string, unknown>) => String(f.run({ type: 'agent.start', request: request(p.conversationId, extra) } as Command, peer).startId)+ const work = f.task(p.projectId, peer)+ const start = (extra: Record<string, unknown>) => String(f.run({ type: 'agent.start', request: request(work, extra) } as Command, peer).startId)for (const extra of [{ roleId: 'review' }, { roleId: 'lead' }, { roleId: 'eeeeeeeeeeee' }, { role: 'reviewer', roleId: 'dev' }]) {const id = start(extra)expect(f.state.starts!.find(s => s.id === id)!.request).toMatchObject(extra)@@ -370,7 +375,7 @@ describe('custom role sets', () => {// Its role name stays the one it started in.expect(f.state.agents.find(a => a.id === worker)).toMatchObject({ roleId: 'review', roleName: 'Docs writer' })const plain = f.project('public', peer)- expect(f.run({ type: 'agent.start', request: request(plain.conversationId, { roleId: 'dev' }) } as Command).startId).toEqual(expect.any(String))+ expect(f.run({ type: 'agent.start', request: request(f.task(plain.projectId), { roleId: 'dev' }) } as Command).startId).toEqual(expect.any(String))})it('joins an agent with the role the New Harness form sends, kept with a reviewer role\'s kind for older readers and naming it', () => {@@ -412,7 +417,7 @@ describe('custom role sets', () => {Object.assign(projectOf(f.state, p.projectId), { skillSet: 'custom' })// A role set decides nothing (project instructions, phase 4): a review group, a Reviewer's start and its assignment are accepted.const review = String(f.run({ type: 'conversation.create', projectId: p.projectId, title: 'Review', brief: 'Check it', reviewOf: build, checks: [{ description: 'Read', independent: true }] }, peer).conversationId)- expect(f.run({ type: 'agent.start', request: request(p.conversationId, { role: 'reviewer' }) } as Command).startId).toEqual(expect.any(String))+ expect(f.run({ type: 'agent.start', request: request(build, { role: 'reviewer' }) } as Command).startId).toEqual(expect.any(String))f.run({ type: 'work.assign', conversationId: review, agentId: reviewer }, peer)expect(f.state.conversations.find(c => c.id === review)!.assignment).toMatchObject({ agentId: reviewer })})diff --git a/backend/src/superTabs/reactions.test.ts b/backend/src/superTabs/reactions.test.tsindex 130e692c9..cda384e75 100644--- a/backend/src/superTabs/reactions.test.ts+++ b/backend/src/superTabs/reactions.test.ts@@ -73,6 +73,8 @@ describe('reactions', () => {it('lets an agent react in a conversation it is in, as a person does, with ✅ for done', () => {const f = fixture()const builder = f.agent('lead', 'Builder')+ // A member stored there before the project chat held only its coordinator (#2207).+ f.lead().agentIds.push(builder)for (const emoji of ['eyes', 'check', 'rocket']) {expect(f.run(react(true, emoji), asAgent(builder), target(false)).result, emoji).toMatchObject({ changed: true })}diff --git a/backend/src/superTabs/steps.test.ts b/backend/src/superTabs/steps.test.tsindex 15d46c9a9..d8473ef1b 100644--- a/backend/src/superTabs/steps.test.ts+++ b/backend/src/superTabs/steps.test.ts@@ -295,7 +295,8 @@ describe('a step the PM opened', () => {f.run({ type: 'work.assign', conversationId: id, agentId: rev }, f.as(f.lead))expect(f.group(id).agentIds).not.toContain(f.dev)const messages = f.run({ type: 'work.status', conversationId: id, assignmentId: f.group(id).assignment!.id, status: 'done', result: 'Passed' } as Command, f.as(rev)).messages- expect(messages.filter(m => m.conversationId === id).map(m => m.recipients)).toEqual([[f.dev]])+ // Its Done, then the row that says the owner joined to hear it (#2207).+ expect(messages.filter(m => m.conversationId === id).map(m => m.recipients)).toEqual([[f.dev], []])expect(f.group(id).agentIds).toContain(f.dev)})})@@ -329,13 +330,13 @@ describe('a linked task opened without a step name', () => {it('tells the task\'s owner its Ready and Done, and its unnamed posts', () => {const { f, id, tester } = linked()const done = f.run({ type: 'work.status', conversationId: id, assignmentId: f.group(id).assignment!.id, status: 'done', result: 'Passed' } as Command, f.as(tester)).messages- expect(done.filter(m => m.conversationId === id).map(m => m.recipients)).toEqual([[f.dev]])+ 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', () => {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([[f.dev], []])})it('closes with its task, not on its own clock', () => {const { f, id, tester } = linked()diff --git a/backend/src/superTabs/store.ts b/backend/src/superTabs/store.tsindex e52fe6fe3..89f498b0f 100644--- a/backend/src/superTabs/store.ts+++ b/backend/src/superTabs/store.ts@@ -45,6 +45,7 @@ import { answersRequest, dirtyGroups, noteWorkChanges, projectUpdateRequest, UNAimport { cloneData } from './cloneData.js'import { digestDue, digestMessageId, digestOf, digestRequest, digestSince } from './digest.js'import { closedAgents, nextRemovalAt, removeClosedAgents, reopened, restoreRefusal, restoreSessions } from './closedAgents.js'+import { sessionRows } from './memberRows.js'import { judgedMachines, loseTasks, nextLossAt, sweepForLead, sweepLiveness, SWEEP_EVERY_MS, unpurgedNotice } from './liveness.js'import { archivable, archiveLine, idleNotices, reviewClosable, reviewCloseLine, reviewPullRequests } from './tidy.js'import { clock, insertParts, loadActive, loadGroups, loadLightGroups, loadMachineParts, loadObserved, reassemble, split, type GroupData, type HeadData, type MachineData, type Part, type SwarmParts } from './parts/index.js'@@ -3057,7 +3058,8 @@ export class SuperTabStore {// they keep running when the Lead's own machine is the one that died.const checked = [...loseTasks(state, now, worker => worker.machineId === machineId), ...sweep ? sweepLiveness(state, now) : []]// Then the agents it shows closed leave, those with no active work left: the Lead is told of their tasks above (closedAgents.ts).- removedIds.push(...removeClosedAgents(state, state.agents.filter(a => closed.includes(a.id)), now).map(a => a.id))+ const closedOut = removeClosedAgents(state, state.agents.filter(a => closed.includes(a.id)), now).map(a => a.id)+ removedIds.push(...closedOut)// And the sessions it shows open again come back, by this report alone: it is proved this machine's contributor's above.const allowed = new Set<string>()if (back.length) {@@ -3081,7 +3083,10 @@ export class SuperTabStore {const restored = restoreSessions(state, machineId, observation.runningHarnessIds, now, allowed, harnessId => reserveHarnessSlot(state, machineId, harnessId, `rejoin-${stamp}`))// An agent reads its groups again from here: said, as nothing else records why (security review 2 of #2601).for (const agent of restored) logger.info('[swarm] a reopened session rejoined', { tabId, agentId: agent.id, machineId, projectId: agent.projectId ?? null })- const written = await saved(checked)+ // And in each chat they left or came back to, for its readers: nothing else there says why they are gone or back (reviews of+ // #2207, memberRows.ts sessionRows).+ const membership = sessionRows(loaded.state, state, new Set([...closedOut, ...restored.map(a => a.id)]), `${machineId}:${stamp}`)+ const written = await saved([...checked, ...membership])// What the next reports of this machine need to skip the load, as this commit leaves the Swarm.const mine = state.machines?.find(m => m.machineId === machineId)return { ...written, ...mine ? { record: { lentCount: lentAgents(state, mine, mine.observation?.runningHarnessIds ?? []),diff --git a/desktop/integration_test/super_tab_native_test.dart b/desktop/integration_test/super_tab_native_test.dartindex b8a058d04..41fadc2bd 100644--- a/desktop/integration_test/super_tab_native_test.dart+++ b/desktop/integration_test/super_tab_native_test.dart@@ -22,6 +22,7 @@ import 'package:harness/ws/local_cli_discovery.dart';import '../test/super_tab_launch_test.dart'show SuperTabFixtureConnection, tabId;import '../test/support/super_tab_devices_fixture.dart';+import '../test/support/super_tab_members.dart';import '../test/super_tab_route_test.dart' show routeRow, decision;import '../test/support/super_tab_fixture.dart'show projectFixture, conversationFixture;@@ -481,6 +482,11 @@ void main() {await shot('project-cadence');await tester.tap(find.text('Cancel'));await tester.pumpAndSettle();+ // The right column opens only from Members (Quiet Swarm).+ await tester.tap(find.byKey(const ValueKey('super-members-button')));+ await tester.pump(const Duration(milliseconds: 250));+ await unfoldSuperTabIdle(tester, settle: false);+ await tester.pump(const Duration(milliseconds: 250));await tester.tap(find.byKey(ValueKey('super-member-${c.snapshot!.agents.single.id}')),);@@ -628,6 +634,11 @@ void main() {'terminal': {'available': false},};f.app.machineStates['m']!.agents = [Agent.fromJson(f.connection.native!)];+ // The right column opens only from Members (Quiet Swarm).+ await tester.tap(find.byKey(const ValueKey('super-members-button')));+ await tester.pump(const Duration(milliseconds: 250));+ await unfoldSuperTabIdle(tester, settle: false);+ await tester.pump(const Duration(milliseconds: 250));await tester.tap(find.byKey(ValueKey('super-member-${c.snapshot!.agents.single.id}')),);@@ -714,6 +725,10 @@ void main() {expect(find.text('#1 Offline editing'), findsWidgets);expect(tester.takeException(), isNull);await shot('group-terminals');+ await tester.tap(find.byKey(const ValueKey('super-members-button')));+ await tester.pump(const Duration(milliseconds: 250));+ await unfoldSuperTabIdle(tester, settle: false);+ await tester.pump(const Duration(milliseconds: 250));await tester.tap(find.byKey(const ValueKey('super-member-lead-agent')));await tester.pump(const Duration(milliseconds: 250));await tester.tap(find.text('Open terminal'));diff --git a/desktop/lib/super_tabs/agent_details.dart b/desktop/lib/super_tabs/agent_details.dartindex 523139db4..f84b21166 100644--- a/desktop/lib/super_tabs/agent_details.dart+++ b/desktop/lib/super_tabs/agent_details.dart@@ -15,6 +15,7 @@ import '../widgets/engine_identity.dart';import 'agent_line.dart';import 'agent_mark.dart';import 'controller.dart';+import 'detail_dialog.dart';import 'identity.dart';import 'model.dart';import 'profile_sheet.dart';@@ -379,6 +380,118 @@ Future<void> showSuperTabAgentDetails();}+/// An agent's card (Quiet Swarm, screen 5): its name and role badge, the+/// task it holds, then its model, effort and machine, with Open terminal and+/// Details… for everything else. Each line says only what is known.+Future<void> showSuperTabAgentCard(+ BuildContext context,+ SuperTabController controller,+ AppNotifier? app,+ SuperTabAgent agent, {+ required ValueChanged<SuperTabAgent> onOpenAgent,+ required ValueChanged<String> onOpenTask,+}) => showAppDialog<void>(+ context: context,+ builder: (dialog) => ListenableBuilder(+ listenable: Listenable.merge([+ controller,+ controller.machinesChanged,+ ?app,+ ]),+ builder: (dialog, _) {+ final current = controller.snapshot?.agent(agent.id) ?? agent;+ final info = SuperTabAgentInfo(+ controller,+ app,+ current,+ activity: superTabAgentState(+ controller,+ app,+ current,+ now: superTabServerNow(controller, DateTime.now()),+ ).words,+ );+ final glance = superTabAgentGlance(info);+ final name = controller.snapshot?.agentName(agent.id) ?? agent.name;+ final role = controller.snapshot?.roleOf(current.id);+ final group = info.taskGroup;+ final runs = [?glance.modelEffort, ?glance.machine].join(' · ');+ return SuperTabDetailDialog(+ key: const ValueKey('super-agent-card'),+ title: name,+ leading: SuperTabAvatar.agent(current, name: name, size: 32),+ headerActions: [+ Tooltip(+ message: role?.name ?? 'Engineer',+ child: Text(role?.badge ?? 'Dev', style: DesktopChrome.metadata()),+ ),+ ],+ body: Column(+ mainAxisSize: MainAxisSize.min,+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ if (group != null)+ Tooltip(+ message: 'Open the task',+ child: InkWell(+ key: const ValueKey('super-card-task'),+ onTap: () {+ Navigator.pop(dialog);+ onOpenTask(group.id);+ },+ child: Text(+ group.title,+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ style: DesktopChrome.control(),+ ),+ ),+ ),+ if (runs.isNotEmpty)+ Padding(+ key: const ValueKey('super-card-run'),+ padding: const EdgeInsets.only(top: DesktopChrome.controlGap),+ child: Text(+ runs,+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ style: DesktopChrome.metadata(),+ ),+ ),+ ],+ ),+ leadingActions: [+ TextButton(+ onPressed: () {+ Navigator.pop(dialog);+ onOpenAgent(current);+ },+ child: const Text('Open terminal'),+ ),+ ],+ actions: [+ TextButton(+ onPressed: () {+ Navigator.pop(dialog);+ if (!context.mounted) return;+ unawaited(+ showSuperTabAgentDetails(+ context,+ controller,+ app,+ current,+ onOpenAgent,+ ),+ );+ },+ child: const Text('Details…'),+ ),+ ],+ );+ },+ ),+);+Widget _fact(String label, String value) => Padding(padding: const EdgeInsets.only(bottom: 10),child: Column(diff --git a/desktop/lib/super_tabs/controller.dart b/desktop/lib/super_tabs/controller.dartindex 664d6e65e..a21e54c86 100644--- a/desktop/lib/super_tabs/controller.dart+++ b/desktop/lib/super_tabs/controller.dart@@ -1168,11 +1168,9 @@ class SuperTabController extends ChangeNotifier {List<SuperTabAgent> terminalAgents(String conversationId) {if (accessRevoked || devicesSelected) return const [];final id = _terminals[conversationId];- final group = snapshot?.conversation(conversationId);- if (id == null || group == null) return const [];- return snapshot!.agents- .where((agent) => group.agentIds.contains(agent.id))- .toList();+ final panes = snapshot?.paneAgentIds(conversationId) ?? const <String>[];+ if (id == null || panes.isEmpty) return const [];+ return snapshot!.agents.where((agent) => panes.contains(agent.id)).toList();}/// Whether [conversationId]'s terminals are open as a group ([term]).diff --git a/desktop/lib/super_tabs/leaderboard/person_row.dart b/desktop/lib/super_tabs/leaderboard/person_row.dartindex 179c026f0..c89b2943d 100644--- a/desktop/lib/super_tabs/leaderboard/person_row.dart+++ b/desktop/lib/super_tabs/leaderboard/person_row.dart@@ -37,6 +37,14 @@ String leaderboardName(SuperTabPerson person, SuperTabPersonScore? score) =>bool leaderboardCrowned(SuperTabPersonScore? score) =>score != null && score.rank == 1 && score.points > 0;+/// A person's card's numbers (Quiet Swarm, screen 5), each said even at 0:+/// "111 shipped · 40 unblocked · 411 hours" (hours lent).+String leaderboardCardNumbers(SuperTabPersonScore score) => [+ '${score.shipped} shipped',+ '${score.unblocked} unblocked',+ plural(int.parse(leaderboardHours(score.lentMs)), 'hour'),+].join(' · ');+/// "16 shipped", "1 unblocked", "43 hours lent": each number that would not/// read zero, in words; empty when all would.List<String> leaderboardNumbers(SuperTabPersonScore score) {@@ -74,12 +82,11 @@ class LeaderboardColumns {final double points;}-/// One person in the People section, in the row shape the agents share-/// (Dee, 2026-10-29): avatar, name (number one's with a crown beside it) and-/// status, their points at the right of that line, and a quiet line of their-/// non-zero numbers beneath. No rank. The viewer's own row carries the-/// selected fill. Without a [score] (no board yet, or a server without one)-/// only the name and status.+/// One person in the People section, on one line (Quiet Swarm, screen 4):+/// avatar, name (number one's with a crown beside it) and their points at the+/// right, the period on hover. Their numbers and status are on their card.+/// No rank. The viewer's own row carries the selected fill. Without a [score]+/// (no board yet, or a server without one) only the name.class LeaderboardPersonRow extends StatelessWidget {const LeaderboardPersonRow({super.key,@@ -88,7 +95,6 @@ class LeaderboardPersonRow extends StatelessWidget {required this.onTap,this.columns,this.own = false,- this.weekName = 'this week',});final SuperTabPerson person;final SuperTabPersonScore? score;@@ -100,42 +106,33 @@ class LeaderboardPersonRow extends StatelessWidget {/// Whether this is the viewer's own row.final bool own;- /// The week the board shows, "this week", "last week", …, as the crown says it.- final String weekName;-@overrideWidget build(BuildContext context) {final score = this.score;final columns = this.columns;- final numbers = score == null- ? const <String>[]- : leaderboardNumbers(score);return SuperTabMemberRow(rowKey: ValueKey('super-person-${person.id}'),onTap: onTap,selected: own,avatar: SuperTabAvatar.person(person, size: _avatarSize),name: _name(),- detail: numbers.isEmpty- ? null- : LeaderboardNumbers(- key: ValueKey('leaderboard-meta-${person.id}'),- parts: numbers,- ),trailing: columns == null || score == null? null- : SizedBox(- key: ValueKey('leaderboard-points-${person.id}'),- width: columns.points,- child: Align(- alignment: Alignment.centerRight,- child: Semantics(- label: '${score.points} points',- excludeSemantics: true,- child: Text(- '${score.points}',- maxLines: 1,- style: leaderboardPointsStyle(),+ : Tooltip(+ message: 'Points ${score.spanName}',+ child: SizedBox(+ key: ValueKey('leaderboard-points-${person.id}'),+ width: columns.points,+ child: Align(+ alignment: Alignment.centerRight,+ child: Semantics(+ label: '${score.points} points',+ excludeSemantics: true,+ child: Text(+ '${score.points}',+ maxLines: 1,+ style: leaderboardPointsStyle(),+ ),),),),@@ -143,26 +140,30 @@ class LeaderboardPersonRow extends StatelessWidget {);}- /// The name, number one's crown, then the status quietly; on hover the whole name, which a long one cut short- /// needs, and the email. The crown is content artwork beside the name, said in words, at the metadata size so a- /// crowned row is as tall as any other (Team and celebration, design system).- Widget _name() => Tooltip(- message: '${leaderboardName(person, score)}\n${person.email}',- child: SuperTabUntil(- until: person.status?.until,- builder: (context) => Text.rich(+ /// The name and number one's crown; on hover the whole name, which a long+ /// one cut short needs, the email and their status. The crown is content+ /// artwork beside the name, said in words, at the metadata size so a+ /// crowned row is as tall as any other (Team and celebration, design+ /// system).+ Widget _name() => SuperTabUntil(+ until: person.status?.until,+ builder: (context) => Tooltip(+ message: [+ leaderboardName(person, score),+ person.email,+ ?person.statusAt(clock.now())?.text,+ ].join('\n'),+ child: Text.rich(TextSpan(text: leaderboardName(person, score),children: [if (leaderboardCrowned(score))WidgetSpan(alignment: PlaceholderAlignment.middle,- child: LeaderboardCrown(id: person.id, weekName: weekName),- ),- if (person.statusAt(clock.now()) case final status?)- TextSpan(- text: ' ${status.text}',- style: DesktopChrome.metadata(),+ child: LeaderboardCrown(+ id: person.id,+ weekName: score!.spanName,+ ),),],),@@ -263,16 +264,31 @@ class LeaderboardNumbers extends StatelessWidget {/// they unblocked and what they lent, item by item. From a server without/// details, the medians, the time freed and lent, and their shipping streak.class LeaderboardPersonWeek extends StatelessWidget {- const LeaderboardPersonWeek({super.key, required this.score});+ const LeaderboardPersonWeek({+ super.key,+ required this.score,+ this.summary = true,+ });final SuperTabPersonScore score;+ /// Whether it says the points first; a card that shows them and the+ /// three numbers in its heading leaves them out, and from a server without+ /// details shows nothing more.+ final bool summary;+@overrideWidget build(BuildContext context) {if (score.details case final details?) {- return _LeaderboardPersonDetails(score: score, details: details);+ return _LeaderboardPersonDetails(+ score: score,+ details: details,+ summary: summary,+ );}String median(int? ms, String what) =>ms == null ? '' : ' · median ${leaderboardDuration(ms)}$what';+ // A card says the points and the three numbers itself.+ if (!summary) return const SizedBox.shrink();final rows = [('Points',@@ -339,9 +355,14 @@ class LeaderboardPersonWeek extends StatelessWidget {/// five and the rest one click away, and saying so when empty. The dialog/// around it scrolls (Ken, 2026-10-28).class _LeaderboardPersonDetails extends StatefulWidget {- const _LeaderboardPersonDetails({required this.score, required this.details});+ const _LeaderboardPersonDetails({+ required this.score,+ required this.details,+ required this.summary,+ });final SuperTabPersonScore score;final SuperTabPersonDetails details;+ final bool summary;@overrideState<_LeaderboardPersonDetails> createState() =>@@ -437,13 +458,14 @@ class _LeaderboardPersonDetailsState extends State<_LeaderboardPersonDetails> {mainAxisSize: MainAxisSize.min,crossAxisAlignment: CrossAxisAlignment.stretch,children: [- Text(- [- '${plural(score.points, 'point')} ${score.spanName}',- if (before != null) '$before ${score.earlierName}',- ].join(' · '),- style: quiet,- ),+ if (widget.summary)+ Text(+ [+ '${plural(score.points, 'point')} ${score.spanName}',+ if (before != null) '$before ${score.earlierName}',+ ].join(' · '),+ style: quiet,+ ),section('Shipped', 'No pull requests merged yet', [for (final shipped in details.shipped)item(switch (Uri.tryParse(shipped.prUrl ?? '')) {diff --git a/desktop/lib/super_tabs/leaderboard/waiting_line.dart b/desktop/lib/super_tabs/leaderboard/waiting_line.dartdeleted file mode 100644index c3aa996a4..000000000--- a/desktop/lib/super_tabs/leaderboard/waiting_line.dart+++ /dev/null@@ -1,71 +0,0 @@-import 'package:flutter/material.dart';--import '../../widgets/desktop_chrome.dart';-import 'format.dart';-import 'model.dart';--/// Who agents wait on now, in words: "3 agents are waiting on Ken", "1 agent-/// is waiting on you", in name order, never a ranking or blame. Answer goes-/// straight to the viewer's own waiting item, or to the first one when none-/// waits on them.-class LeaderboardWaitingLine extends StatelessWidget {- const LeaderboardWaitingLine({- super.key,- required this.waiting,- required this.viewerId,- required this.nameOf,- required this.onAnswer,- });- final SuperTabWaiting waiting;- final String viewerId;- final String Function(String personId) nameOf;- final ValueChanged<String> onAnswer;-- String? get _target {- final own = waiting.people.where((p) => p.personId == viewerId).firstOrNull;- return (own ?? waiting.people.firstOrNull)?.conversationIds.firstOrNull;- }-- @override- Widget build(BuildContext context) {- final target = _target;- // The team total's quiet hierarchy and inset.- return Padding(- key: const ValueKey('leaderboard-waiting'),- padding: const EdgeInsets.fromLTRB(- DesktopChrome.groupGap,- DesktopChrome.controlGap,- DesktopChrome.controlGap,- DesktopChrome.controlGap,- ),- child: waiting.total == 0- ? Text(- 'No agent is waiting on a person.',- style: DesktopChrome.metadata(),- )- : Row(- children: [- Expanded(- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- for (final person in waiting.people)- Text(- '${plural(person.count, 'agent')} '- '${person.count == 1 ? 'is' : 'are'} waiting on '- '${person.personId == viewerId ? 'you' : nameOf(person.personId)}',- style: DesktopChrome.metadata(),- ),- ],- ),- ),- if (target != null)- TextButton(- onPressed: () => onAnswer(target),- child: const Text('Answer'),- ),- ],- ),- );- }-}diff --git a/desktop/lib/super_tabs/model.dart b/desktop/lib/super_tabs/model.dartindex ad74384f3..0973d864e 100644--- a/desktop/lib/super_tabs/model.dart+++ b/desktop/lib/super_tabs/model.dart@@ -724,6 +724,17 @@ class SuperTabSnapshot {bool isProjectLead(String conversationId) =>projects.any((p) => p.leadConversationId == conversationId);+ /// The agents whose terminals [conversationId] opens: a project chat's+ /// coordinator alone, whoever else an older Swarm still holds there (#2207);+ /// any other group's members.+ List<String> paneAgentIds(String conversationId) {+ final group = conversation(conversationId);+ if (group == null) return const [];+ if (!isProjectLead(conversationId)) return group.agentIds;+ final lead = group.leadId;+ return lead != null && group.agentIds.contains(lead) ? [lead] : const [];+ }+SuperTabProject? leadProjectForAgent(String agentId) => projects.where((p) => conversation(p.leadConversationId)?.leadId == agentId).firstOrNull;diff --git a/desktop/lib/super_tabs/roster.dart b/desktop/lib/super_tabs/roster.dartindex a6a092c87..bcca30e71 100644--- a/desktop/lib/super_tabs/roster.dart+++ b/desktop/lib/super_tabs/roster.dart@@ -7,10 +7,13 @@ import '../core/local_key_value_store.dart';import '../core/relative_time.dart';import '../shared/theme/app_theme.dart' as grid;+import '../shared/theme/app_icons.dart';import '../shared/theme/appearance_prefs_store.dart';+import '../shared/widgets/app_icon_button.dart';import '../shared/widgets/app_dialog.dart';import '../shared/widgets/app_select_field.dart';import '../state/app_state.dart';+import '../state/harness_activity.dart';import '../terminal/terminal_theme.dart';import '../terminal/terminal_theme_store.dart';import '../widgets/browser_menu_guard.dart';@@ -28,7 +31,6 @@ import 'leaderboard/member_row.dart';import 'leaderboard/model.dart';import 'leaderboard/person_row.dart';import 'leaderboard/reader.dart';-import 'leaderboard/waiting_line.dart';import 'model.dart';import 'profile_sheet.dart';import 'roster_scope.dart';@@ -48,6 +50,7 @@ class SuperTabRoster extends StatefulWidget {required this.onOpenAgent,required this.onAddAgent,required this.onAnswer,+ this.onClose,this.app,this.board,this.storage,@@ -63,6 +66,10 @@ class SuperTabRoster extends StatefulWidget {/// row's task.final ValueChanged<String> onAnswer;+ /// Closes the column: it opens only from Members (Quiet Swarm, Dee,+ /// 2026-11-02). No close when null.+ final VoidCallback? onClose;+/// The open project's week board, shared with the sidebar's Models; the/// roster reads its own when not given.final SuperTabLeaderboardReader? board;@@ -80,6 +87,10 @@ class _SuperTabRosterState extends State<SuperTabRoster>/// One per agent menu open now, each keeping the browser's menu off.final _menuHolds = <Object>{};+ /// Whether the agents folded under Idle (N) show; folded at first, for+ /// this visit.+ bool _idleOpen = false;+SuperTabController get c => widget.controller;/// The board read here when the view shares none.@@ -274,44 +285,65 @@ class _SuperTabRosterState extends State<SuperTabRoster>);}- /// A person's email and role, and their week when the board has them. One's- /// own also opens the profile sheet, where one's avatar and status change.- Future<void> _person(SuperTabPerson person, SuperTabPersonScore? score) =>- showAppDialog<void>(- context: context,- builder: (context) => SuperTabDetailDialog(- title: leaderboardName(person, score),- // Who they are on one line under the name (Ken, 2026-10-28).- detail:+ /// A person's card (Quiet Swarm, screen 5): their name with the crown,+ /// their points, the period on hover, their numbers under the name and+ /// what is behind them; who they are on the avatar's hover. One's own also+ /// opens the profile sheet, where one's avatar and status change.+ Future<void> _person(SuperTabPerson person, SuperTabPersonScore? score) {+ final name = leaderboardName(person, score);+ return showAppDialog<void>(+ context: context,+ builder: (context) => SuperTabDetailDialog(+ title: leaderboardCrowned(score) ? '$name \u{1F451}' : name,+ detail: score == null ? null : leaderboardCardNumbers(score),+ leading: Tooltip(+ message:'${person.email} · ${switch (person.role) {'owner' => 'Owner','viewer' => 'Can view',_ => 'Can collaborate',}}',- leading: SuperTabAvatar.person(person, size: 40),- body: score == null- ? const SizedBox.shrink()- : LeaderboardPersonWeek(score: score),- actions: [+ child: SuperTabAvatar.person(person, size: 40),+ ),+ headerActions: [+ if (score != null)+ Tooltip(+ // The period, and the one before rather than a difference.+ message: [+ 'Points ${score.spanName}',+ if (score.prevWeekPoints case final before?)+ '$before ${score.earlierName}',+ ].join(' · '),+ child: Text(+ plural(score.points, 'point'),+ style: leaderboardPointsStyle(),+ ),+ ),+ ],+ body: score == null+ ? const SizedBox.shrink()+ : LeaderboardPersonWeek(score: score, summary: false),+ actions: [+ TextButton(+ onPressed: () {+ Navigator.pop(context);+ widget.onInvite();+ },+ child: const Text('Manage people'),+ ),+ if (person.id == c.accountId && c.canWrite)TextButton(+ key: const ValueKey('super-profile-edit'),onPressed: () {Navigator.pop(context);- widget.onInvite();+ showSuperTabProfile(this.context, c);},- child: const Text('Manage people'),+ child: const Text('Edit profile'),),- if (person.id == c.accountId && c.canWrite)- TextButton(- key: const ValueKey('super-profile-edit'),- onPressed: () {- Navigator.pop(context);- showSuperTabProfile(this.context, c);- },- child: const Text('Edit profile'),- ),- ],- ),- );+ ],+ ),+ );+ }Future<void> _details(SuperTabAgent agent) => showSuperTabAgentDetails(context,@@ -321,134 +353,42 @@ class _SuperTabRosterState extends State<SuperTabRoster>widget.onOpenAgent,);- /// Name, role chip, then the model and effort in the details line's grey- /// (Dee, 2026-10-31). The name and chip are measured first; the model takes- /// what is left and is cut before either shrinks.- Widget _agentIdentity(- String name,- String role,- String badge, {- String? model,- Key? modelKey,- }) => LayoutBuilder(- builder: (context, constraints) {- final nameStyle = DesktopChrome.control();- final tagStyle = DesktopChrome.metadata();- final scale = MediaQuery.textScalerOf(context);- double measure(String text, TextStyle style) {- final painter = TextPainter(- text: TextSpan(text: text, style: style),- textDirection: Directionality.of(context),- textScaler: scale,- maxLines: 1,- )..layout();- final width = painter.width;- painter.dispose();- return width;- }-- final badgeWidth = (measure(badge, tagStyle) + 10).clamp(- 0.0,- constraints.maxWidth,- );- // One gap between name, chip and model.- const gap = 6.0;- final nameWidth = measure(name, nameStyle).clamp(- 0.0,- (constraints.maxWidth - badgeWidth - gap).clamp(0.0, double.infinity),- );- Widget tag(String text) => Container(- padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 1),- decoration: BoxDecoration(- color: grid.AppSurface.hoverFill,- borderRadius: BorderRadius.circular(4),- ),- child: Text(- text,- maxLines: 1,- overflow: TextOverflow.ellipsis,- style: tagStyle,- ),- );- return Row(- children: [- if (nameWidth > 0) ...[- SizedBox(- width: nameWidth,- child: Text(- name,- maxLines: 1,- overflow: TextOverflow.ellipsis,- style: nameStyle,- ),- ),- const SizedBox(width: gap),- ],- Semantics(- label: role,- excludeSemantics: true,- child: SizedBox(width: badgeWidth, child: tag(badge)),- ),- // The gap shrinks with the model, so a name that fills the row never overflows.- if (model != null)- Flexible(- child: Padding(- padding: const EdgeInsets.only(left: gap),- child: Text(- model,- key: modelKey,- maxLines: 1,- softWrap: false,- overflow: TextOverflow.ellipsis,- style: tagStyle,- ),- ),- ),- ],- );- },+ /// The agent's card (Quiet Swarm, screen 5).+ Future<void> _card(SuperTabAgent agent) => showSuperTabAgentCard(+ context,+ c,+ widget.app,+ agent,+ onOpenAgent: widget.onOpenAgent,+ onOpenTask: widget.onAnswer,);- /// An agent's row, in the shape the people's rows share (Dee, 2026-10-29):- /// avatar, name and role chip, today's one status line beneath, and the- /// tabs' status mark at the right. No rank and no points.+ /// An agent's row, one line (Quiet Swarm, screen 4): avatar, name, then+ /// its state in a word and the tabs' status mark at the right. Role, task,+ /// model, effort and machine are on its card and its hover.Widget _agent(SuperTabAgent agent, SuperTabAgentState state, DateTime now) {final name = c.snapshot!.agentName(agent.id), shown = state.mark;final info = SuperTabAgentInfo(c, widget.app, agent, activity: state.words);- final work = state.work;- // The state in a word, where it runs, its engine, model and effort: on hover (Dee, 2026-10-30); the model and- // effort on the first line too (Dee, 2026-10-31).+ // The state in a word, where it runs, its engine, model and effort: on hover (Dee, 2026-10-30).final glance = superTabAgentGlance(info, now: now);final project = c.snapshot!.projects.where((p) => p.id == _agentProjectId(agent)).firstOrNull;- final (name: role, :badge) =+ final (name: role, badge: _) =c.snapshot!.roleOf(agent.id) ?? (name: 'Engineer', badge: 'Dev');final status = info.status ?? 'Status unavailable';+ // Who, then where and on what, then the task, then when (Dee,+ // 2026-10-30); since the row is one line, how long since its last+ // progress too, which its line said.final tooltip = [[name, role, ?project?.name, ?info.engine].join(' · '),glance.line,if (status != glance.label) status,+ if (state.work?.progressAt case final at?)+ 'Last progress ${relativeAgo(at, now)}',if (info.lastActive case final at?) 'Last active ${relativeAgo(at, now)}',].join('\n');- // The row's details line (Dee, 2026-10-30): the task in plain words and- // how long since its last progress; with no task, the state in a word.- final limited =- glance.label.startsWith('Limited until') || glance.label == 'Switching…'- ? glance.label- : null;- final detail = work == null- ? glance.label- : [- ?limited,- work.group.title,- if (work.progressAt case final at?)- superTabAgentAge(now.difference(at)),- ].join(' · ');- // A task opens its conversation, a needs-you one at its question; no task, the details.- void open() => work == null- ? unawaited(_details(agent))- : widget.onAnswer(work.group.id);+ void open() => unawaited(_card(agent));final theme = terminalThemeFor(grid.AppTheme.surfacePalette,terminalThemeStore.value,@@ -508,37 +448,41 @@ class _SuperTabRosterState extends State<SuperTabRoster>child: SuperTabMemberRow(rowKey: ValueKey('super-member-${agent.id}'),onTap: open,- onLongPress: () => unawaited(_details(agent)),+ onLongPress: open,avatar: SuperTabAvatar.agent(agent,name: name,size: SuperTabAvatar.rowSize,engineBadge: false,),- name: _agentIdentity(+ name: Text(name,- role,- badge,- model: glance.modelEffort,- modelKey: ValueKey('super-member-model-${agent.id}'),- ),- detail: Text(- detail,- key: ValueKey('super-member-line-${agent.id}'),maxLines: 1,overflow: TextOverflow.ellipsis,- style: DesktopChrome.metadata(),+ style: DesktopChrome.control(),),- trailing: ActivityMark(- key: ValueKey('super-member-mark-${agent.id}'),- activity: shown,- tooltip: false,- showIdle: true,- color: activityColor(- shown,- theme,- color: appearancePrefsStore.value.prompt.color,- ),+ trailing: Row(+ mainAxisSize: MainAxisSize.min,+ children: [+ Text(+ superTabMemberWord(glance.label),+ key: ValueKey('super-member-word-${agent.id}'),+ maxLines: 1,+ style: DesktopChrome.metadata(),+ ),+ const SizedBox(width: DesktopChrome.controlGap),+ ActivityMark(+ key: ValueKey('super-member-mark-${agent.id}'),+ activity: shown,+ tooltip: false,+ showIdle: true,+ color: activityColor(+ shown,+ theme,+ color: appearancePrefsStore.value.prompt.color,+ ),+ ),+ ],),),),@@ -635,7 +579,6 @@ class _SuperTabRosterState extends State<SuperTabRoster>return pb.compareTo(pa);},);- final current = leaderboardWeekOf(widget.now());// One points column for every person's row.final columns = board == null || board.people.isEmpty? null@@ -643,83 +586,11 @@ class _SuperTabRosterState extends State<SuperTabRoster>context,points: board.people.map((s) => s.points),);- final week = board?.spanName ?? weekName(_board.week, current);final openProject = projectId == null? null: state?.projectById(projectId);- final showWeek =- board != null ||- _board.week != null ||- (_board.period ?? leaderboardDefaultPeriod) != leaderboardDefaultPeriod;- Widget weekSelect({double? width}) => switch (_board.period) {- final period? => AppSelectField<String>(- key: const ValueKey('leaderboard-period'),- value: period,- width: width,- height: DesktopChrome.compactControlHeight,- semanticLabel: 'Period',- options: [- for (final option in leaderboardPeriods)- SelectOption(value: option, label: leaderboardPeriodLabel(option)),- ],- onChanged: (period) => unawaited(_board.showPeriod(period)),- ),- // A server before periods keeps the weeks.- null => AppSelectField<int>(- key: const ValueKey('leaderboard-week'),- value: _board.week ?? current,- width: width,- height: DesktopChrome.compactControlHeight,- semanticLabel: 'Week',- options: [- for (var back = 0; back < 4; back++)- SelectOption(- value: current - back * weekMs,- label: capitalized(weekName(current - back * weekMs, current)),- ),- ],- onChanged: (week) =>- unawaited(_board.showWeek(week == current ? null : week)),- ),- };return [- // Humans and Agents: the two roles in one team (Dee, 2026-10-29).- SuperTabSectionHeading(- 'Humans',- actions: [if (showWeek) weekSelect(width: 112)],- onAdd: c.isOwner ? widget.onInvite : null,- addTooltip: 'Invite people',- ),- if (openProject != null)- Padding(- padding: const EdgeInsets.fromLTRB(- DesktopChrome.groupGap,- 0,- DesktopChrome.groupGap,- DesktopChrome.controlGap,- ),- // The pane is too narrow for the scope beside the week on the- // heading's line, so it takes the line below.- child: AppSelectField<SuperTabRosterScope>(- key: const ValueKey('roster-scope'),- value: scoped == null- ? SuperTabRosterScope.all- : SuperTabRosterScope.project,- height: DesktopChrome.compactControlHeight,- semanticLabel: 'Show',- options: [- const SelectOption(- value: SuperTabRosterScope.all,- label: 'All projects',- ),- SelectOption(- value: SuperTabRosterScope.project,- label: openProject.name,- ),- ],- onChanged: _choice.choose,- ),- ),+ _heading(openProject == null ? null : scoped != null),if (_board.error case final error?)Padding(padding: const EdgeInsets.fromLTRB(@@ -730,27 +601,22 @@ class _SuperTabRosterState extends State<SuperTabRoster>),child: Text(error, style: DesktopChrome.metadata()),),+ // People and Agents: the two roles in one team (Quiet Swarm, screen 4).+ SuperTabSectionHeading(+ 'People',+ onAdd: c.isOwner ? widget.onInvite : null,+ addTooltip: 'Invite people',+ ),+ // Points are the last 7 days, the period on hover; who waits on whom is+ // Activity's Needs you (Quiet Swarm, 2026-11-02).for (final person in sorted)LeaderboardPersonRow(person: person,score: scores[person.id],columns: columns,own: person.id == c.accountId,- weekName: week,onTap: () => _person(person, scores[person.id]),),- if (board != null && board.waiting.total > 0)- LeaderboardWaitingLine(- waiting: board.waiting,- viewerId: c.accountId,- nameOf: (id) {- final person = state?.people.where((p) => p.id == id).firstOrNull;- return person == null- ? 'Former member'- : leaderboardName(person, scores[id]);- },- onAnswer: widget.onAnswer,- ),const SizedBox(height: DesktopChrome.groupGap),SuperTabSectionHeading('Agents',@@ -760,10 +626,87 @@ class _SuperTabRosterState extends State<SuperTabRoster>: null,addTooltip: 'Add agent',),- for (final agent in listed) _agent(agent, states[agent.id]!, now),+ for (final agent in listed)+ if (!superTabFoldsIdle(states[agent.id]!))+ _agent(agent, states[agent.id]!, now),+ if (listed.where((a) => superTabFoldsIdle(states[a.id]!)).toList()+ case final idle when idle.isNotEmpty) ...[+ SuperTabSectionHeading(+ 'Idle (${idle.length})',+ key: const ValueKey('super-members-idle'),+ // In line with People and Agents, which do not fold.+ startInset: 16,+ collapsed: !_idleOpen,+ onToggleCollapsed: () => setState(() => _idleOpen = !_idleOpen),+ ),+ if (_idleOpen)+ for (final agent in idle) _agent(agent, states[agent.id]!, now),+ ],];}+ /// The column's heading: the project-or-Swarm choice while a project is+ /// open ([narrowed] says which is chosen), All projects alone otherwise,+ /// and its close at the right as a thread's has.+ Widget _heading(bool? narrowed) {+ final style = DesktopChrome.heading();+ return Padding(+ key: const ValueKey('super-members-heading'),+ padding: const EdgeInsets.fromLTRB(+ DesktopChrome.groupGap,+ 0,+ DesktopChrome.controlGap,+ DesktopChrome.controlGap,+ ),+ child: Row(+ children: [+ Expanded(+ child: Align(+ alignment: AlignmentDirectional.centerStart,+ child: narrowed == null+ ? Semantics(+ header: true,+ child: Text(+ superTabRosterScopeLabel(SuperTabRosterScope.all),+ style: style,+ ),+ )+ : AppSelectField<SuperTabRosterScope>(+ key: const ValueKey('roster-scope'),+ value: narrowed+ ? SuperTabRosterScope.project+ : SuperTabRosterScope.all,+ width: AppSelectField.fitWidth(+ context,+ labels: SuperTabRosterScope.values.map(+ superTabRosterScopeLabel,+ ),+ ),+ height: DesktopChrome.compactControlHeight,+ semanticLabel: 'Show',+ options: [+ for (final scope in SuperTabRosterScope.values.reversed)+ SelectOption(+ value: scope,+ label: superTabRosterScopeLabel(scope),+ ),+ ],+ onChanged: _choice.choose,+ ),+ ),+ ),+ if (widget.onClose case final close?)+ AppIconButton(+ key: const ValueKey('super-members-close'),+ icon: AppIcons.close,+ tooltip: 'Close members',+ onPressed: close,+ ),+ ],+ ),+ );+ }+@overrideWidget build(BuildContext context) {grid.AppTheme.watch(context);@@ -787,3 +730,24 @@ class _SuperTabRosterState extends State<SuperTabRoster>);}}++/// An agent row's state word: the glance's in the chat's words ("waiting",+/// "working", "in review"), one short word so the row stays one line; a+/// reset time or a reason is on hover.+String superTabMemberWord(String label) => switch (label) {+ 'Waiting on others' => 'in review',+ 'Kept (closed)' => 'kept',+ _ when label.startsWith('Limited until') => 'limited',+ '' => label,+ _ => '${label[0].toLowerCase()}${label.substring(1)}',+};++/// Whether an agent folds under Idle (N): it holds no task and is idle,+/// stopped or offline. An agent with work, lost work too, stays in view.+bool superTabFoldsIdle(SuperTabAgentState state) =>+ state.work == null &&+ const {+ HarnessActivity.idle,+ HarnessActivity.paused,+ HarnessActivity.offline,+ }.contains(state.mark);diff --git a/desktop/lib/super_tabs/roster_scope.dart b/desktop/lib/super_tabs/roster_scope.dartindex 6f64a8db1..6c0332307 100644--- a/desktop/lib/super_tabs/roster_scope.dart+++ b/desktop/lib/super_tabs/roster_scope.dart@@ -10,6 +10,12 @@ import 'model.dart';/// Swarm, as before, or only the project open in the chat.enum SuperTabRosterScope { all, project }+/// The scope as Members' heading names it (Quiet Swarm, Dee, 2026-11-02).+String superTabRosterScopeLabel(SuperTabRosterScope scope) => switch (scope) {+ SuperTabRosterScope.project => 'This project',+ SuperTabRosterScope.all => 'All projects',+};+/// The roster's scope choice, kept per account and Swarm on this computer.////// It stores only the choice, never a project's id, name or members: thediff --git a/desktop/lib/super_tabs/view.dart b/desktop/lib/super_tabs/view.dartindex 4e29312cb..266b57d70 100644--- a/desktop/lib/super_tabs/view.dart+++ b/desktop/lib/super_tabs/view.dart@@ -2351,10 +2351,11 @@ class _SuperTabViewState extends State<SuperTabView>bool get _menuNamesViews =>_phone && !_devicesVisible && !_listViewHoldsThePane;- /// How many terminals [group]'s [term] opens: its agents', and in the- /// person's own Personal Swarm their panes of its project.+ /// How many terminals [group]'s [term] opens: its agents' (a project chat's+ /// coordinator alone), and in the person's own Personal Swarm their panes of+ /// its project.int _terminalCount(SuperTabConversation group) =>- group.agentIds.length ++ (c.snapshot?.paneAgentIds(group.id) ?? group.agentIds).length +switch (widget.app) {final app? => PersonalProjects.of(app).panesFor(c, group.id).length,null => 0,@@ -2375,7 +2376,14 @@ class _SuperTabViewState extends State<SuperTabView>setState(() => _showPullRequests = true);}- void _toggleRoster() => setState(() => _rosterOpen = !_rosterOpen);+ /// Members takes the right side from an open thread or task, as in Slack.+ void _toggleRoster() {+ if (!_rosterOpen) c.closeThread();+ setState(() {+ if (!_rosterOpen) _openedTask = null;+ _rosterOpen = !_rosterOpen;+ });+ }/// On a phone, the view ⋮ opened in place of the chat, which the bar has no/// icon to mark as selected; null while the chat is the view.@@ -2421,7 +2429,7 @@ class _SuperTabViewState extends State<SuperTabView>);}- Widget _header(SuperTabConversation? group, bool narrow, bool showRoster) {+ Widget _header(SuperTabConversation? group, bool narrow) {final isProject =group != null && c.snapshot?.isProjectLead(group.id) == true;return Container(@@ -2550,16 +2558,18 @@ class _SuperTabViewState extends State<SuperTabView>),],],- if (!showRoster)- fingerTarget(- enabled: _phone,- AppIconButton(- icon: AppIcons.users,- tooltip: 'Members and machines',- selected: _rosterOpen,- onPressed: _toggleRoster,- ),+ // The right column opens only from here (Quiet Swarm, Dee,+ // 2026-11-02): closed at rest, at every width.+ fingerTarget(+ enabled: _phone,+ AppIconButton(+ key: const ValueKey('super-members-button'),+ icon: AppIcons.users,+ tooltip: 'Members',+ selected: _rosterOpen,+ onPressed: _toggleRoster,),+ ),],),);@@ -4290,14 +4300,16 @@ class _SuperTabViewState extends State<SuperTabView>final terminal = widget.terminal;final narrow =constraints.maxWidth < MediaQuery.textScalerOf(context).scale(720);- final showRoster =+ // Wide enough for a right column beside the chat; it shows only an+ // open thread or Members, closed at rest (Quiet Swarm, 2026-11-02).+ final wide =constraints.maxWidth >= MediaQuery.textScalerOf(context).scale(1080);final thread = _threadPanel();- final threadDrawer = thread != null && !showRoster;+ // A thread opened since Members takes its side and closes it.+ if (thread != null) _rosterOpen = false;+ final threadDrawer = thread != null && !wide;final chatCovered =- (narrow && _sidebarOpen) ||- (!showRoster && _rosterOpen) ||- threadDrawer;+ (narrow && _sidebarOpen) || (!wide && _rosterOpen) || threadDrawer;if (_chatCovered && !chatCovered) {// Both dismissing a drawer and widening the window reveal the cached// transcript without loading another message.@@ -4331,6 +4343,7 @@ class _SuperTabViewState extends State<SuperTabView>});unawaited(c.select(id));},+ onClose: _closeRoster,);return Focus(canRequestFocus: false,@@ -4345,13 +4358,13 @@ class _SuperTabViewState extends State<SuperTabView>onLeave: _leaveResize,left: narrow ? null : _sidebar(),// An open thread takes the roster's side, as in Slack.- right: !showRoster ? null : thread ?? roster,+ right: !wide ? null : thread ?? (_rosterOpen ? roster : null),rightDefault: thread == null? SuperTabPaneLayout.rightWidth: SuperTabPaneLayout.threadWidth,center: Column(children: [- _header(c.selected, narrow, showRoster),+ _header(c.selected, narrow),if (_manageOpen)SuperTabManageTabs(selected: _devicesVisible@@ -4444,7 +4457,7 @@ class _SuperTabViewState extends State<SuperTabView>),),),- if (!showRoster && _rosterOpen && !threadDrawer)+ if (!wide && _rosterOpen && !threadDrawer)Positioned.fill(child: BlockSemantics(child: FocusScope(diff --git a/desktop/test/super_tab_agent_line_test.dart b/desktop/test/super_tab_agent_line_test.dartindex e31e085fa..4efa8368c 100644--- a/desktop/test/super_tab_agent_line_test.dart+++ b/desktop/test/super_tab_agent_line_test.dart@@ -10,6 +10,7 @@ import 'package:harness/super_tabs/roster.dart';import 'package:harness/super_tabs/agent_line.dart';import 'support/super_tab_fixture.dart';+import 'support/super_tab_members.dart';Map<String, dynamic> _machine(String id,@@ -114,6 +115,7 @@ Future<ConversationServer> _swarm(),);await tester.pumpAndSettle();+ await unfoldSuperTabIdle(tester);return server;}diff --git a/desktop/test/super_tab_avatars_view_test.dart b/desktop/test/super_tab_avatars_view_test.dartindex 8ada1c8aa..0eb89e0c0 100644--- a/desktop/test/super_tab_avatars_view_test.dart+++ b/desktop/test/super_tab_avatars_view_test.dart@@ -6,6 +6,11 @@ import 'package:harness/super_tabs/model.dart';import 'super_tab_roster_test.dart' show RosterFixture;+/// A hover that says [text].+Finder saying(String text) => find.byWidgetPredicate(+ (w) => w is Tooltip && (w.message ?? '').contains(text),+);+void main() {testWidgets('the roster shows each person’s avatar and status, each agent its pattern',@@ -40,11 +45,9 @@ void main() {find.descendant(of: person, matching: find.text('☕')),findsOneWidget,);+ // Its words on hover: a row is one line (Quiet Swarm).expect(- find.descendant(- of: person,- matching: find.textContaining('Coffee break'),- ),+ find.descendant(of: person, matching: saying('Coffee break')),findsOneWidget,);expect(f.inRow(1, find.text('🦉')), findsOneWidget);@@ -109,7 +112,7 @@ void expiryTests() {await f.show(tester);final person = find.byKey(const ValueKey('super-person-owner'));expect(- find.descendant(of: person, matching: find.textContaining('At lunch')),+ find.descendant(of: person, matching: saying('At lunch')),findsOneWidget,);expect(@@ -118,7 +121,7 @@ void expiryTests() {);await tester.pump(const Duration(minutes: 10, seconds: 1));expect(- find.descendant(of: person, matching: find.textContaining('At lunch')),+ find.descendant(of: person, matching: saying('At lunch')),findsNothing,);expect(diff --git a/desktop/test/super_tab_buddies_test.dart b/desktop/test/super_tab_buddies_test.dartindex 44b6cf11f..1bc2137b6 100644--- a/desktop/test/super_tab_buddies_test.dart+++ b/desktop/test/super_tab_buddies_test.dart@@ -15,6 +15,7 @@ import 'package:harness/super_tabs/view.dart';import 'support/buddy_fixture.dart';import 'support/pm_chat_fixture.dart';import 'support/super_tab_fixture.dart';+import 'support/super_tab_members.dart';import 'swarm_state_test.dart' show createApp;/// Buddies (Ken's spec, 10-28): a person's private agent per project. Since@@ -1356,6 +1357,7 @@ void main() {final server = buddySwarm();giveBuddy(server);final c = await show(tester, server);+ await openSuperTabMembers(tester);expect(find.byKey(const ValueKey('super-person-owner')),findsOneWidget,diff --git a/desktop/test/super_tab_chat_test.dart b/desktop/test/super_tab_chat_test.dartindex b5ed9302b..67cda700e 100644--- a/desktop/test/super_tab_chat_test.dart+++ b/desktop/test/super_tab_chat_test.dart@@ -12,6 +12,7 @@ import 'package:harness/super_tabs/model.dart';import 'package:harness/super_tabs/view.dart';import 'support/super_tab_fixture.dart';+import 'support/super_tab_members.dart';void main() {test('work that waits on a person reads as people say it', () {@@ -329,7 +330,7 @@ void main() {await closeReadView(tester, c);});- for (final drawer in ['Conversations', 'Members and machines']) {+ for (final drawer in ['Conversations', 'Members']) {testWidgets('$drawer keeps covered messages unread until revealed', (tester,) async {@@ -453,8 +454,7 @@ void main() {find.descendant(of: reply, matching: find.text('Atlas')),findsOneWidget,);- await tester.tap(find.byTooltip('Members and machines'));- await tester.pumpAndSettle();+ await openSuperTabMembers(tester);expect(find.text('hi'), findsNothing);expect(find.text('Atlas'), findsWidgets);expect(diff --git a/desktop/test/super_tab_controller_test.dart b/desktop/test/super_tab_controller_test.dartindex c78ee4c76..cb5ed81d8 100644--- a/desktop/test/super_tab_controller_test.dart+++ b/desktop/test/super_tab_controller_test.dart@@ -91,6 +91,42 @@ void main() {restored.dispose();},);+ // Ken, 2026-11-02: a Reviewer stored in the project chat next to the PM+ // opened a second terminal there. The project chat shows its coordinator's+ // terminal alone, whoever else an older Swarm still holds there; a task+ // shows every member's.+ test('opens only the coordinator\'s pane on the project chat, even with older members', () async {+ final server = ConversationServer();+ server.state['agents'] = [+ for (final id in ['a', 'b'])+ {+ 'id': id,+ 'name': id,+ 'machineId': 'm',+ 'harnessId': 'native-$id',+ 'contributorId': 'owner',+ 'configuration': {'engine': 'codex'},+ },+ ];+ final chats = server.state['conversations'] as List;+ chats[0]['agentIds'] = ['b', 'a'];+ chats[0]['leadId'] = 'a';+ chats[1]['agentIds'] = ['a', 'b'];+ final c = server.controller();+ await c.refresh();+ expect(c.snapshot!.paneAgentIds('lead'), ['a']);+ c.selectGroupTerminals('lead');+ expect(c.terminalAgents('lead').map((a) => a.id), ['a']);+ c.selectGroupTerminals('offline');+ expect(c.snapshot!.paneAgentIds('offline'), ['a', 'b']);+ expect(c.terminalAgents('offline').map((a) => a.id), ['a', 'b']);+ // No coordinator there: no pane at all.+ chats[0]['leadId'] = null;+ await c.refresh();+ expect(c.snapshot!.paneAgentIds('lead'), isEmpty);+ expect(c.terminalAgents('lead'), isEmpty);+ c.dispose();+ });test('terminal selections survive reopening and cannot cross accounts or group membership', () async {final server = ConversationServer();server.state['agents'] = [diff --git a/desktop/test/super_tab_delivery_test.dart b/desktop/test/super_tab_delivery_test.dartindex 2c74f44a7..59e18f239 100644--- a/desktop/test/super_tab_delivery_test.dart+++ b/desktop/test/super_tab_delivery_test.dart@@ -182,8 +182,8 @@ void main() {}await shot('conversation');- if (find.byTooltip('Members and machines').evaluate().isNotEmpty) {- await tester.tap(find.byTooltip('Members and machines'));+ if (find.byTooltip('Members').evaluate().isNotEmpty) {+ await tester.tap(find.byTooltip('Members'));await tester.pumpAndSettle();}await tester.tap(find.byTooltip('Invite people'));@@ -205,7 +205,7 @@ void main() {await shot('people');await tester.tap(find.byTooltip('Close'));await tester.pumpAndSettle();- if (find.byTooltip('Members and machines').evaluate().isNotEmpty) {+ if (find.byTooltip('Members').evaluate().isNotEmpty) {await tester.sendKeyEvent(LogicalKeyboardKey.escape);await tester.pumpAndSettle();}diff --git a/desktop/test/super_tab_devices_preview_test.dart b/desktop/test/super_tab_devices_preview_test.dartindex c6b3c24b6..8a11f38db 100644--- a/desktop/test/super_tab_devices_preview_test.dart+++ b/desktop/test/super_tab_devices_preview_test.dart@@ -36,7 +36,8 @@ Future<(SuperTabLaunchFixture, SuperTabController)> _mount('configuration': {'engine': 'codex'},},];- (state['conversations'] as List)[0]['agentIds'] = [+ // A workgroup: the project chat shows its coordinator's terminal alone (#2207).+ (state['conversations'] as List)[1]['agentIds'] = [for (var i = 0; i < agents; i++) 'agent-$i',];f.app.machineStates['m']!.agents = [@@ -58,7 +59,9 @@ Future<(SuperTabLaunchFixture, SuperTabController)> _mount(if (finder) f.app.finderRoots.set('m', 'native-0', _finderRoot);final c = await f.app.superTabs.open(tabId);await c.refresh();- c.selectGroupTerminals('lead');+ c+ ..select('offline')+ ..selectGroupTerminals('offline');if (legacyDevices) {final tab = f.app.activeSwarm;tab.panes@@ -165,7 +168,7 @@ void main() {await persisted.load();expect(persisted.rootOf('m', 'native-0'), _finderRoot);}- await tester.tap(find.byKey(const ValueKey('super-group-lead')));+ await tester.tap(find.byKey(const ValueKey('super-group-offline')));await tester.pumpAndSettle();expect(c.devicesSelected, isFalse);expectPreview();@@ -201,7 +204,7 @@ void main() {expect(tab.panes.single.isDevices, isTrue);expect(tab.panes.single.ownerAgentId, isNull);expect(tab.manualLayout, isNull);- c.select('lead');+ c.select('offline');await tester.pumpAndSettle();expect(tab.panes.map((pane) => pane.agentId), ['native-0', 'native-1']);}@@ -229,7 +232,7 @@ void main() {expect(tab.focusedPaneId, tab.panes.single.id);expect(tab.zoomedPaneId, isNull);expect(tab.manualLayout, isNull);- c.select('lead');+ c.select('offline');await tester.pumpAndSettle();expect(tab.panes.map((pane) => pane.agentId), ['native-0', 'native-1']);c.selectDevices();diff --git a/desktop/test/super_tab_devices_test.dart b/desktop/test/super_tab_devices_test.dartindex 4203c049f..16f405a93 100644--- a/desktop/test/super_tab_devices_test.dart+++ b/desktop/test/super_tab_devices_test.dart@@ -30,7 +30,9 @@ void main() {'configuration': {'engine': 'codex'},},];- (server.state['conversations'] as List)[0]['agentIds'] = ['pm'];+ (server.state['conversations'] as List)[0]+ ..['agentIds'] = ['pm']+ ..['leadId'] = 'pm';final c = server.controller();await c.refresh();c.setDraft('lead', 'Keep discussing this project.');diff --git a/desktop/test/super_tab_humans_test.dart b/desktop/test/super_tab_humans_test.dartindex 6f60a96e2..ac13ddad1 100644--- a/desktop/test/super_tab_humans_test.dart+++ b/desktop/test/super_tab_humans_test.dart@@ -1,6 +1,5 @@import 'package:flutter/gestures.dart';import 'package:flutter/material.dart';-import 'package:flutter/rendering.dart';import 'package:flutter/services.dart';import 'package:flutter_test/flutter_test.dart';import 'package:harness/super_tabs/detail_dialog.dart';@@ -13,6 +12,7 @@ import 'package:harness/super_tabs/view.dart';import 'support/humans_fixture.dart';import 'support/super_tab_fixture.dart';+import 'support/super_tab_members.dart';/// The leaderboard lives in the right pane's Humans section (Dee, 2026-10-27),/// built to the desktop design system (2026-10-28): a small week picker, then@@ -66,6 +66,7 @@ void main() {await tester.pump();}}+ await openSuperTabMembers(tester, settle: settle);return controller;}@@ -119,50 +120,6 @@ void main() {},);- testWidgets('switching the week sorts by that week\'s points', (- tester,- ) async {- final server = humansSwarm();- final controller = await show(tester, server);- final ids = [- 'peer',- 'owner',- 'tony',- 'scholes',- 'diego',- 'huy',- 'maximilian.alexander.longname',- ];- expect(order(tester, ids), ids);- // Last week: diego led, Dee had nothing.- final week = Map<String, int>.from({- 'diego': 30,- 'huy': 9,- 'tony': 9,- 'owner': 1,- 'peer': 0,- 'scholes': 0,- 'maximilian.alexander.longname': 0,- });- for (final score in server.leaderboard!['people'] as List) {- score['points'] = week[score['personId']];- }- await tester.tap(find.byKey(const ValueKey('leaderboard-week')));- await tester.pumpAndSettle();- await tester.tap(find.text('Last week').last);- await tester.pumpAndSettle();- expect(order(tester, ids), [- 'diego',- 'huy',- 'tony',- 'owner',- 'peer',- 'maximilian.alexander.longname',- 'scholes',- ]);- await close(tester, controller);- });-testWidgets('lends no order from a board for another project, a failed read or a lost project',(tester) async {@@ -289,65 +246,6 @@ void main() {},);- testWidgets(- 'writes the three numbers as one quiet line under the name, hiding zeros',- (tester) async {- final controller = await show(tester, humansSwarm());- // Each person's whole line, in full words on hover.- final lines = {- 'peer': '6 shipped · 3 unblocked',- 'owner': '1 shipped · 4 unblocked · 20 agent-hours lent',- 'tony': '2 shipped',- 'scholes': '2 unblocked · 10 agent-hours lent',- 'diego': '1 unblocked · 10 agent-hours lent',- };- String shown(String id) => tester- .widget<Text>(- find.descendant(of: part('meta', id), matching: find.byType(Text)),- )- .data!;- for (final MapEntry(key: id, value: line) in lines.entries) {- expect(find.byTooltip(line), findsOneWidget, reason: id);- // What fits is whole items from the start, never part of a word.- final full = line.replaceAll('agent-hours', 'hours');- final text = shown(id);- expect(full.startsWith(text), isTrue, reason: '$id: $text');- expect(- text == full || full.substring(text.length).startsWith(' · '),- isTrue,- reason: '$id: $text',- );- final paragraph = tester.renderObject<RenderParagraph>(- find.descendant(- of: part('meta', id),- matching: find.byType(RichText),- ),- );- expect(paragraph.didExceedMaxLines, isFalse, reason: id);- }- expect(shown('tony'), '2 shipped');- // Ken's line is too long for the pane: whole items fall off its end.- expect(- shown('owner'),- isNot(lines['owner']!.replaceAll('agent-hours', 'hours')),- );- // Nothing to say, no line at all.- expect(part('meta', 'huy'), findsNothing);- final style = styleOf(- tester,- find.descendant(of: part('meta', 'peer'), matching: find.byType(Text)),- );- expect(style.fontSize, grid.AppType.captionSize);- expect(style.color, grid.AppPalette.textSecondary);- // The line starts where the name does.- expect(- tester.getTopLeft(part('meta', 'peer')).dx,- tester.getTopLeft(nameIn('peer', 'dee')).dx,- );- await close(tester, controller);- },- );-Finder crown(String id) => part('crown', id);testWidgets(@@ -394,25 +292,6 @@ void main() {},);- testWidgets("on a past week the crown names that week, not this one", (- tester,- ) async {- final semantics = tester.ensureSemantics();- final controller = await show(tester, humansSwarm());- await tester.tap(find.byKey(const ValueKey('leaderboard-week')));- await tester.pumpAndSettle();- await tester.tap(find.text('Last week').last);- await tester.pumpAndSettle();- expect(crown('peer'), findsOneWidget);- expect(- find.bySemanticsLabel(RegExp('Number one last week')),- findsOneWidget,- );- expect(find.bySemanticsLabel(RegExp('this week')), findsNothing);- semantics.dispose();- await close(tester, controller);- });-testWidgets('crowns no one in a week where no one has points yet', (tester,) async {@@ -504,6 +383,7 @@ void main() {),);await tester.pumpAndSettle();+ await openSuperTabMembers(tester);expect(tester.takeException(), isNull);final points = tester.getTopRight(part('points', 'peer')).dx;expect(tester.getTopRight(part('points', 'owner')).dx, points);@@ -521,51 +401,6 @@ void main() {await close(tester, controller);});- testWidgets('puts the waiting line in the quiet metadata hierarchy', (- tester,- ) async {- final controller = await show(tester, humansSwarm());- final waiting = find.byKey(const ValueKey('leaderboard-waiting'));- final heading = find.descendant(- of: waiting,- matching: find.text('1 agent is waiting on you'),- );- expect(heading, findsOneWidget);- expect(styleOf(tester, heading).fontSize, grid.AppType.captionSize);- expect(styleOf(tester, heading).color, grid.AppPalette.textSecondary);- expect(find.textContaining('Dee 1'), findsNothing);- expect(styleOf(tester, heading).fontSize, grid.AppType.captionSize);- await close(tester, controller);- });-- testWidgets('says in words how many agents wait on whom, the viewer as you', (- tester,- ) async {- final server = humansSwarm();- server.leaderboard!['waiting'] = {- 'total': 4,- 'people': [- {- 'personId': 'owner',- 'count': 3,- 'conversationIds': ['g1'],- },- {- 'personId': 'peer',- 'count': 1,- 'conversationIds': ['offline'],- },- ],- };- final controller = await show(tester, server);- final waiting = find.byKey(const ValueKey('leaderboard-waiting'));- Finder line(String text) =>- find.descendant(of: waiting, matching: find.text(text));- expect(line('3 agents are waiting on ken'), findsOneWidget);- expect(line('1 agent is waiting on you'), findsOneWidget);- await close(tester, controller);- });-testWidgets('keeps a row with no points after those with points, its 0 in the points style',(tester) async {@@ -669,19 +504,6 @@ void main() {},);- testWidgets('reads another week from the small week picker', (tester) async {- final server = humansSwarm();- final controller = await show(tester, server);- final picker = find.byKey(const ValueKey('leaderboard-week'));- expect(tester.getSize(picker).height, lessThanOrEqualTo(32));- await tester.tap(picker);- await tester.pumpAndSettle();- await tester.tap(find.text('Last week').last);- await tester.pumpAndSettle();- expect(server.leaderboardReads.last, contains('&week='));- await close(tester, controller);- });-testWidgets('has no separate leaderboard view or trophy', (tester) async {final controller = await show(tester,@@ -719,11 +541,18 @@ void main() {final dialog = find.byType(SuperTabDetailDialog);Finder inDialog(String text) =>find.descendant(of: dialog, matching: find.text(text));- expect(inDialog('dee'), findsOneWidget);- // Who they are on one line under the name (Ken, 2026-10-28).- expect(inDialog('[email protected] · Can collaborate'), findsOneWidget);- // This week's points in words, and last week's beside them rather than a difference.- expect(inDialog('21 points this week · 15 last week'), findsOneWidget);+ // The card (Quiet Swarm, screen 5): name and crown, the points at the+ // right, the three numbers under the name.+ expect(inDialog('dee \u{1F451}'), findsOneWidget);+ expect(inDialog('21 points'), findsOneWidget);+ expect(inDialog('6 shipped · 3 unblocked · 0 hours'), findsOneWidget);+ // Who they are on the avatar's hover (Ken, 2026-10-28).+ expect(+ find.byTooltip('[email protected] · Can collaborate'),+ findsOneWidget,+ );+ // The period on hover, and last week's beside it rather than a difference.+ expect(find.byTooltip('Points this week · 15 last week'), findsOneWidget);expect(find.textContaining('pts'), findsNothing);expect(find.widgetWithText(TextButton, 'Close'), findsNothing);expect(inDialog('Shipped'), findsOneWidget);@@ -749,7 +578,8 @@ void main() {await tester.tap(person('owner'));await tester.pumpAndSettle();- expect(inDialog('13 points this week · 20 last week'), findsOneWidget);+ expect(inDialog('13 points'), findsOneWidget);+ expect(find.byTooltip('Points this week · 20 last week'), findsOneWidget);expect(inDialog('No pull requests merged yet'), findsOneWidget);expect(inDialog('No questions answered yet'), findsOneWidget);// The machine as it calls itself, without .local.@@ -762,7 +592,7 @@ void main() {);testWidgets(- "shows a person's week as before where the server has no details",+ "shows a person's numbers alone where the server has no details",(tester) async {final controller = await show(tester, humansSwarm());await tester.tap(person('scholes'));@@ -771,7 +601,10 @@ void main() {Finder inDialog(String text) =>find.descendant(of: dialog, matching: find.text(text));expect(inDialog('scholes'), findsOneWidget);- expect(inDialog('Nothing landed yet'), findsOneWidget);+ // The card's line says them; nothing repeats them below (screen 5).+ expect(inDialog('0 shipped · 2 unblocked · 10 hours'), findsOneWidget);+ expect(inDialog('Nothing landed yet'), findsNothing);+ expect(inDialog('Shipped'), findsNothing);expect(inDialog('No pull requests merged yet'), findsNothing);expect(find.textContaining('last week'), findsNothing);await close(tester, controller);@@ -852,14 +685,6 @@ void main() {await close(tester, controller);});- testWidgets('opens the waiting conversation from Answer', (tester) async {- final controller = await show(tester, humansSwarm());- await tester.tap(find.text('Answer'));- await tester.pumpAndSettle();- expect(controller.selectedId, 'offline');- await close(tester, controller);- });-testWidgets('reads the board of the open conversation’s project', (tester,) async {diff --git a/desktop/test/super_tab_manage_page_test.dart b/desktop/test/super_tab_manage_page_test.dartindex 898156660..4d5d3ab67 100644--- a/desktop/test/super_tab_manage_page_test.dart+++ b/desktop/test/super_tab_manage_page_test.dart@@ -8,6 +8,7 @@ import 'package:harness/super_tabs/view.dart';import 'support/humans_fixture.dart';import 'support/super_tab_fixture.dart';+import 'support/super_tab_members.dart';import 'swarm_state_test.dart' show createApp;/// Manage (docs/plans/2026-11-02-quiet-swarm-design.md, screens 10, 10b, 10c).@@ -178,7 +179,7 @@ void main() {List<String> opened,ValueNotifier<bool> terminals,) async {- final server = humansSwarm();+ final server = membersSwarm();final c = server.controller();await c.refresh();await tester.binding.setSurfaceSize(const Size(1300, 900));@@ -234,10 +235,11 @@ void main() {final opened = <String>[];final terminals = ValueNotifier(false);final c = await inView(tester, opened, terminals);+ await openSuperTabMembers(tester);final agent = c.snapshot!.agents.first;- await tester.longPress(find.byKey(ValueKey('super-member-${agent.id}')));+ await tester.tap(find.byKey(ValueKey('super-member-${agent.id}')));await tester.pumpAndSettle();- await tester.tap(find.widgetWithText(FilledButton, 'Open terminal'));+ await tester.tap(find.text('Open terminal'));await tester.pumpAndSettle();expect(opened, [agent.id]);expect(diff --git a/desktop/test/super_tab_members_list_test.dart b/desktop/test/super_tab_members_list_test.dartindex dae9b1d34..955ea8af2 100644--- a/desktop/test/super_tab_members_list_test.dart+++ b/desktop/test/super_tab_members_list_test.dart@@ -8,6 +8,7 @@ import 'package:harness/super_tabs/view.dart';import 'support/humans_fixture.dart';import 'support/super_tab_fixture.dart';+import 'support/super_tab_members.dart';/// One member list, one row shape (Dee, 2026-10-29): Humans under a heading/// that carries the week, each with their points, then the Agents with their@@ -41,6 +42,7 @@ void main() {),);await tester.pumpAndSettle();+ await openSuperTabMembers(tester);return controller;}@@ -54,28 +56,19 @@ void main() {Finder rank(String id) => find.byKey(ValueKey('super-member-rank-$id'));Finder points(String id) => find.byKey(ValueKey('super-member-points-$id'));- testWidgets('shows Humans under a heading with the week, and no list pills', (+ testWidgets('shows People under a heading, with no week and no list pills', (tester,) async {final controller = await show(tester, membersSwarm());for (final pill in ['humans', 'agents', 'models']) {expect(find.byKey(ValueKey('leaderboard-tab-$pill')), findsNothing);}- expect(find.text('Humans'), findsOneWidget);- expect(find.text('People'), findsNothing);- final week = find.byKey(const ValueKey('leaderboard-week'));- expect(week, findsOneWidget);- // The week sits on the Humans heading's line, at its trailing edge.- expect(- (tester.getCenter(week).dy - tester.getCenter(find.text('Humans')).dy)- .abs(),- lessThan(8),- );- expect(- tester.getCenter(week).dx,- greaterThan(tester.getCenter(find.text('Humans')).dx),- );- // Humans first, then the Agents below them.+ expect(find.text('People'), findsOneWidget);+ expect(find.text('Humans'), findsNothing);+ // The last 7 days, on hover: no week or period menu (Quiet Swarm).+ expect(find.byKey(const ValueKey('leaderboard-week')), findsNothing);+ expect(find.byKey(const ValueKey('leaderboard-period')), findsNothing);+ // People first, then the Agents below them.expect(find.byKey(const ValueKey('super-person-peer')), findsOneWidget);expect(tester.getTopLeft(member('lead-agent')).dy,@@ -87,7 +80,7 @@ void main() {});testWidgets(- 'gives an agent the board scores no rank and no points, and keeps its status line',+ 'gives an agent the board scores no rank and no points, and keeps its state word',(tester) async {final semantics = tester.ensureSemantics();final controller = await show(tester, membersSwarm());@@ -97,9 +90,9 @@ void main() {expect(find.bySemanticsLabel(RegExp(r'\b212 points')), findsNothing);// Nor does anyone carry a rank column.expect(find.byKey(const ValueKey('leaderboard-rank-peer')), findsNothing);- // Today's one status line stays under the name.+ // Its state word stays on its one line (Quiet Swarm).expect(- find.byKey(const ValueKey('super-member-line-lead-agent')),+ find.byKey(const ValueKey('super-member-word-lead-agent')),findsOneWidget,);semantics.dispose();@@ -155,7 +148,7 @@ void main() {findsNothing,);expect(- find.byKey(const ValueKey('super-member-line-luna')),+ find.byKey(const ValueKey('super-member-word-luna')),findsOneWidget,);// A Buddy is not in the Agents list, so its score shows nowhere.@@ -246,6 +239,7 @@ void main() {),);await tester.pumpAndSettle();+ await openSuperTabMembers(tester);expect(tester.takeException(), isNull);void holdsWhole(String number) {expect(find.text(number), findsOneWidget, reason: number);diff --git a/desktop/test/super_tab_members_test.dart b/desktop/test/super_tab_members_test.dartnew file mode 100644index 000000000..6e7261902--- /dev/null+++ b/desktop/test/super_tab_members_test.dart@@ -0,0 +1,642 @@+import 'package:flutter/gestures.dart';+import 'package:flutter/material.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:harness/core/models.dart';+import 'package:harness/state/harness_activity.dart';+import 'package:harness/shared/theme/app_theme.dart' as grid;+import 'package:harness/super_tabs/controller.dart';+import 'package:harness/super_tabs/roster.dart';+import 'package:harness/super_tabs/view.dart';++import 'super_tab_roster_test.dart' show RosterFixture;+import 'support/super_tab_fixture.dart';++/// Quiet Swarm, screens 4 and 5 (Dee, 2026-11-02): the right column opens+/// only from Members, its rows are one line each, and a click opens a card.+void main() {+ Future<SuperTabController> mountView(+ WidgetTester tester,+ ConversationServer server, {+ Size size = const Size(1440, 900),+ }) async {+ await tester.binding.setSurfaceSize(size);+ addTearDown(() => tester.binding.setSurfaceSize(null));+ final controller = server.controller();+ await controller.refresh();+ await tester.pumpWidget(+ MaterialApp(+ theme: grid.buildAppTheme(brightness: Brightness.dark),+ home: Scaffold(+ body: SuperTabView(+ controller: controller,+ onInvite: () {},+ onAddAgent: (_) {},+ onOpenTerminal: (_) {},+ machineName: (_) => 'Test Mac',+ ),+ ),+ ),+ );+ await tester.pumpAndSettle();+ return controller;+ }++ Future<void> unmount(WidgetTester tester, SuperTabController c) async {+ await tester.pumpWidget(const SizedBox());+ await c.flush();+ c.dispose();+ }++ final members = find.byKey(const ValueKey('super-members-button'));+ final close = find.byKey(const ValueKey('super-members-close'));++ group('the right column', () {+ testWidgets('is closed at rest in a wide window', (tester) async {+ final c = await mountView(tester, ConversationServer());+ expect(find.byType(SuperTabRoster), findsNothing);+ expect(members, findsOneWidget);+ expect(find.byTooltip('Members'), findsOneWidget);+ await unmount(tester, c);+ });++ testWidgets('Members opens it beside the chat and its close shuts it', (+ tester,+ ) async {+ final c = await mountView(tester, ConversationServer());+ await tester.tap(members);+ await tester.pumpAndSettle();+ final roster = find.byType(SuperTabRoster);+ expect(roster, findsOneWidget);+ // Docked at the right, not a drawer over the chat.+ expect(tester.getTopRight(roster).dx, 1440);+ expect(+ find.byKey(const ValueKey('super-message-composer')),+ findsOneWidget,+ );+ await tester.tap(close);+ await tester.pumpAndSettle();+ expect(roster, findsNothing);+ // Members again opens it again.+ await tester.tap(members);+ await tester.pumpAndSettle();+ expect(roster, findsOneWidget);+ await tester.tap(members);+ await tester.pumpAndSettle();+ expect(roster, findsNothing);+ await unmount(tester, c);+ });++ testWidgets('Members takes the right side from an open thread', (+ tester,+ ) async {+ final server = ConversationServer()..append('Root of a thread');+ final controller = await mountView(tester, server);+ controller.openThread(server.messages.last['id'] as String);+ await tester.pumpAndSettle();+ expect(find.byKey(const ValueKey('super-thread-panel')), findsOneWidget);+ await tester.tap(members);+ await tester.pumpAndSettle();+ expect(find.byKey(const ValueKey('super-thread-panel')), findsNothing);+ expect(find.byType(SuperTabRoster), findsOneWidget);+ // And a thread opened again takes it back.+ controller.openThread(server.messages.last['id'] as String);+ await tester.pumpAndSettle();+ expect(find.byKey(const ValueKey('super-thread-panel')), findsOneWidget);+ expect(find.byType(SuperTabRoster), findsNothing);+ controller.closeThread();+ await tester.pumpAndSettle();+ expect(find.byType(SuperTabRoster), findsNothing);+ await unmount(tester, controller);+ });++ testWidgets('a narrow window opens it as a drawer with the same close', (+ tester,+ ) async {+ final c = await mountView(+ tester,+ ConversationServer(),+ size: const Size(900, 700),+ );+ expect(find.byType(SuperTabRoster), findsNothing);+ await tester.tap(members);+ await tester.pumpAndSettle();+ expect(find.byType(SuperTabRoster), findsOneWidget);+ await tester.tap(close);+ await tester.pumpAndSettle();+ expect(find.byType(SuperTabRoster), findsNothing);+ await unmount(tester, c);+ });+ });++ Map<String, dynamic> score(String id, int points, int rank) => {+ 'personId': id,+ 'points': points,+ 'rank': rank,+ 'medal': null,+ 'shipped': {'count': 11, 'medianAskToShipMs': null},+ 'unblocked': {'count': 4, 'agentMs': 0, 'medianAnswerMs': null},+ 'lent': {'machines': 1, 'agentMs': 41 * 3600000},+ 'streakDays': 0,+ };++ /// A Swarm whose board sums the last 7 days ([rolling]) or, from a server+ /// before periods, this week.+ Future<RosterFixture> people(+ WidgetTester tester, {+ bool rolling = true,+ bool open = true,+ }) async {+ await tester.binding.setSurfaceSize(const Size(280, 760));+ addTearDown(() => tester.binding.setSurfaceSize(null));+ final f = RosterFixture();+ await f.initialize();+ addTearDown(f.dispose);+ (f.server.state['people'] as List).addAll([+ {'id': 'dee', 'email': '[email protected]', 'role': 'collaborator'},+ // On no board: a row with nothing under its name.+ {'id': 'tony', 'email': '[email protected]', 'role': 'collaborator'},+ ]);+ f.server.leaderboard = {+ 'projectId': 'lead',+ 'week': DateTime.utc(2026, 10, 26).millisecondsSinceEpoch,+ if (rolling) 'period': {'name': '7d', 'start': 1, 'end': 2},+ if (rolling) 'allProjects': true,+ 'people': [score('owner', 424, 1), score('dee', 339, 2)],+ 'waiting': {+ 'total': 1,+ 'people': [+ {+ 'personId': 'owner',+ 'count': 1,+ 'conversationIds': ['lead'],+ },+ ],+ },+ };+ await f.controller.refresh();+ if (open) await f.controller.select('lead');+ return f;+ }++ Finder person(String id) => find.byKey(ValueKey('super-person-$id'));+ final scope = find.byKey(const ValueKey('roster-scope'));++ group('People', () {+ testWidgets(+ 'the heading is the project-or-Swarm choice, beside the close',+ (tester) async {+ final f = await people(tester);+ await f.show(tester);+ expect(+ find.descendant(of: scope, matching: find.text('All projects')),+ findsOneWidget,+ );+ expect(tester.getCenter(scope).dy, tester.getCenter(close).dy);+ expect(find.text('People'), findsOneWidget);+ expect(find.text('Agents'), findsOneWidget);+ expect(find.text('Humans'), findsNothing);+ // Points are the last 7 days; no picker for the period or the week.+ expect(find.byKey(const ValueKey('leaderboard-period')), findsNothing);+ expect(find.byKey(const ValueKey('leaderboard-week')), findsNothing);+ await tester.tap(scope);+ await tester.pumpAndSettle();+ await tester.tap(find.text('This project').last);+ await tester.pumpAndSettle();+ expect(+ find.descendant(of: scope, matching: find.text('This project')),+ findsOneWidget,+ );+ expect(find.text('openharness'), findsNothing);+ await tester.tap(close);+ expect(f.closed, isTrue);+ await f.close(tester);+ },+ );++ testWidgets('with no project open the heading reads All projects alone', (+ tester,+ ) async {+ final f = await people(tester, open: false);+ f.controller.selectedId = 'missing';+ await f.show(tester);+ expect(scope, findsNothing);+ expect(+ find.byKey(const ValueKey('super-members-heading')),+ findsOneWidget,+ );+ expect(+ find.descendant(+ of: find.byKey(const ValueKey('super-members-heading')),+ matching: find.text('All projects'),+ ),+ findsOneWidget,+ );+ expect(person('owner'), findsOneWidget);+ await f.close(tester);+ });++ testWidgets('a person row is one line: name, crown and points', (+ tester,+ ) async {+ final f = await people(tester);+ await f.show(tester);+ final row = person('owner');+ expect(+ find.descendant(of: row, matching: find.text('424')),+ findsOneWidget,+ );+ expect(+ find.byKey(const ValueKey('leaderboard-crown-owner')),+ findsOneWidget,+ );+ expect(find.byKey(const ValueKey('leaderboard-crown-dee')), findsNothing);+ // The numbers go on the card.+ expect(+ find.byKey(const ValueKey('leaderboard-meta-owner')),+ findsNothing,+ );+ expect(find.textContaining('shipped'), findsNothing);+ // One line: as tall as a row with nothing under its name.+ expect(tester.getSize(row).height, tester.getSize(person('tony')).height);+ expect(find.byTooltip('Points in the last 7 days'), findsWidgets);+ await f.close(tester);+ });++ testWidgets('no waiting line under People: Activity says who waits', (+ tester,+ ) async {+ final f = await people(tester);+ await f.show(tester);+ expect(find.textContaining('waiting on'), findsNothing);+ expect(find.text('Answer'), findsNothing);+ await f.close(tester);+ });++ testWidgets('a server that sums weeks shows points, this week on hover', (+ tester,+ ) async {+ final f = await people(tester, rolling: false);+ await f.show(tester);+ expect(+ find.descendant(of: person('owner'), matching: find.text('424')),+ findsOneWidget,+ );+ expect(find.byTooltip('Points this week'), findsWidgets);+ expect(find.byKey(const ValueKey('leaderboard-week')), findsNothing);+ await f.close(tester);+ });+ });++ group('Agents', () {+ /// Finn (agent-3) waits on a person, Sage (agent-1) works, Juno (agent-4)+ /// lost its task; Atlas (agent-0) and Nova (agent-2) hold none.+ Future<RosterFixture> agents(WidgetTester tester) async {+ await tester.binding.setSurfaceSize(const Size(280, 760));+ addTearDown(() => tester.binding.setSurfaceSize(null));+ final f = RosterFixture();+ await f.initialize();+ addTearDown(f.dispose);+ final list = f.server.state['agents'] as List;+ list.add({+ ...(list[3] as Map).cast<String, Object>(),+ 'id': 'agent-4',+ 'harnessId': 'a4',+ 'name': 'Juno',+ 'displayName': 'Juno',+ 'configuration': {+ 'engine': 'claude',+ 'model': 'claude-opus-5-5',+ 'effort': 'high',+ },+ });+ (f.server.state['conversations'] as List).addAll(<Map<String, dynamic>>[+ {+ ...conversationFixture('ask', 'Pick a sign-in page'),+ 'assignment': {'agentId': 'agent-3', 'status': 'needs_human'},+ },+ {+ ...conversationFixture('build', 'Windows credential fix'),+ 'assignment': {'agentId': 'agent-1', 'status': 'working'},+ },+ {+ ...conversationFixture('gone', 'Old work'),+ 'assignment': {'agentId': 'agent-4', 'status': 'lost'},+ },+ ]);+ await f.controller.refresh();+ final machine = f.app.stateOf('m')!;+ machine.agents = [+ for (final i in [0, 1, 3, 4])+ Agent(id: 'a$i', name: 'n$i', engine: 'codex'),+ ];+ machine.processingAgentIds.add('a1');+ return f;+ }++ Finder word(int i) => find.byKey(ValueKey('super-member-word-agent-$i'));+ final idle = find.byKey(const ValueKey('super-members-idle'));++ testWidgets('a row is one line: name, status word and mark', (+ tester,+ ) async {+ final f = await agents(tester);+ await f.show(tester, unfold: false);+ expect(f.inRow(1, find.text('Sage')), findsOneWidget);+ expect(tester.widget<Text>(word(1)).data, 'working');+ expect(tester.widget<Text>(word(3)).data, 'waiting');+ expect(tester.widget<Text>(word(4)).data, 'lost');+ expect(f.activity(tester, 1), HarnessActivity.working);+ // Role, model, effort and the task go on the card.+ expect(f.inRow(1, find.text('Dev')), findsNothing);+ expect(+ find.byKey(const ValueKey('super-member-model-agent-1')),+ findsNothing,+ );+ expect(+ find.byKey(const ValueKey('super-member-line-agent-1')),+ findsNothing,+ );+ expect(find.textContaining('Windows credential fix'), findsNothing);+ // The word sits on the name's line, before the mark.+ expect(+ tester.getCenter(word(1)).dy,+ moreOrLessEquals(+ tester.getCenter(f.inRow(1, find.text('Sage'))).dy,+ epsilon: 1,+ ),+ );+ expect(+ tester.getCenter(word(1)).dx,+ lessThan(+ tester+ .getCenter(+ f.inRow(+ 1,+ find.byKey(const ValueKey('super-member-mark-agent-1')),+ ),+ )+ .dx,+ ),+ );+ await f.close(tester);+ });++ test('the state word is short: a reason or a time is on hover', () {+ expect(superTabMemberWord('Waiting'), 'waiting');+ expect(superTabMemberWord('Waiting on others'), 'in review');+ expect(superTabMemberWord('Limited until 09:05'), 'limited');+ expect(superTabMemberWord('Kept (closed)'), 'kept');+ expect(superTabMemberWord('Switching…'), 'switching…');+ expect(superTabMemberWord('Lost'), 'lost');+ });++ testWidgets('waiting first, then working; idle folds under Idle (N)', (+ tester,+ ) async {+ final f = await agents(tester);+ await f.show(tester, unfold: false);+ // Atlas and Nova hold no task: folded.+ expect(f.row(0), findsNothing);+ expect(f.row(2), findsNothing);+ expect(+ find.descendant(of: idle, matching: find.text('Idle (2)')),+ findsOneWidget,+ );+ final tops = [+ for (final i in [3, 1, 4]) tester.getTopLeft(f.row(i)).dy,+ ];+ expect(tops, [...tops]..sort());+ // Lost work stays above the fold.+ expect(+ tester.getTopLeft(f.row(4)).dy,+ lessThan(tester.getTopLeft(idle).dy),+ );+ // Its title lines up with the other headings'.+ expect(+ tester.getTopLeft(find.text('Idle (2)')).dx,+ tester.getTopLeft(find.text('Agents')).dx,+ );+ await tester.tap(find.text('Idle (2)'));+ await tester.pumpAndSettle();+ expect(f.row(0), findsOneWidget);+ expect(f.row(2), findsOneWidget);+ expect(tester.widget<Text>(word(0)).data, 'idle');+ expect(+ tester.getTopLeft(f.row(0)).dy,+ greaterThan(tester.getTopLeft(idle).dy),+ );+ await tester.tap(find.text('Idle (2)'));+ await tester.pumpAndSettle();+ expect(f.row(0), findsNothing);+ await f.close(tester);+ });++ testWidgets('a click opens the agent card, not the task', (tester) async {+ final f = await agents(tester);+ await f.show(tester, unfold: false);+ await tester.tap(f.row(1));+ await tester.pumpAndSettle();+ expect(f.answered, isNull);+ expect(find.byKey(const ValueKey('super-agent-card')), findsOneWidget);+ await f.close(tester);+ });++ testWidgets('the hover keeps the task and the time since its progress', (+ tester,+ ) async {+ final f = await agents(tester);+ final build = (f.server.state['conversations'] as List).firstWhere(+ (g) => g['id'] == 'build',+ );+ final at = DateTime.now()+ .subtract(const Duration(minutes: 4, seconds: 10))+ .millisecondsSinceEpoch;+ build['assignment'] = <String, Object>{+ ...(build['assignment'] as Map).cast<String, Object>(),+ 'progressAt': at,+ };+ await f.controller.refresh();+ await f.show(tester, unfold: false);+ final hover = tester+ .widgetList<Tooltip>(+ find.ancestor(of: f.row(1), matching: find.byType(Tooltip)),+ )+ .single+ .message!;+ expect(hover, contains('Windows credential fix'));+ expect(hover.split('\n').last, 'Last progress 4 minutes ago');+ await f.close(tester);+ });++ testWidgets('right-click keeps Details and Remove from Swarm', (+ tester,+ ) async {+ final f = await agents(tester);+ await f.show(tester, unfold: false);+ await tester.tap(f.row(1), buttons: kSecondaryMouseButton);+ await tester.pumpAndSettle();+ expect(find.text('Details'), findsOneWidget);+ expect(find.text('Remove from Swarm'), findsOneWidget);+ await tester.tapAt(Offset.zero);+ await tester.pumpAndSettle();+ await f.close(tester);+ });+ });++ group('Cards', () {+ final card = find.byKey(const ValueKey('super-agent-card'));+ final task = find.byKey(const ValueKey('super-card-task'));+ final run = find.byKey(const ValueKey('super-card-run'));++ Future<RosterFixture> juno(WidgetTester tester) async {+ await tester.binding.setSurfaceSize(const Size(900, 760));+ addTearDown(() => tester.binding.setSurfaceSize(null));+ final f = RosterFixture();+ await f.initialize();+ addTearDown(f.dispose);+ final list = f.server.state['agents'] as List;+ (list[1] as Map)['configuration'] = {+ 'engine': 'claude',+ 'model': 'claude-opus-5-5',+ 'effort': 'high',+ };+ (f.server.state['conversations'] as List).add({+ ...conversationFixture('build', 'Windows credential fix'),+ 'assignment': {'agentId': 'agent-1', 'status': 'working'},+ });+ await f.controller.refresh();+ return f;+ }++ testWidgets('the agent card: role, task, model · effort · machine, '+ 'Open terminal and Details…', (tester) async {+ final f = await juno(tester);+ await f.show(tester, unfold: false);+ await tester.tap(f.row(1));+ await tester.pumpAndSettle();+ expect(card, findsOneWidget);+ expect(+ find.descendant(of: card, matching: find.text('Sage')),+ findsOneWidget,+ );+ expect(+ find.descendant(of: card, matching: find.text('Dev')),+ findsOneWidget,+ );+ expect(+ find.descendant(+ of: task,+ matching: find.text('Windows credential fix'),+ ),+ findsOneWidget,+ );+ expect(+ tester+ .widget<Text>(find.descendant(of: run, matching: find.byType(Text)))+ .data,+ startsWith('Opus 5.5 · high · '),+ );+ expect(find.text('Open terminal'), findsOneWidget);+ expect(find.text('Details…'), findsOneWidget);+ // Open terminal opens the agent.+ await tester.tap(find.text('Open terminal'));+ await tester.pumpAndSettle();+ expect(card, findsNothing);+ expect(f.opened?.id, 'agent-1');+ await f.close(tester);+ });++ testWidgets("the card's task opens its conversation", (tester) async {+ final f = await juno(tester);+ await f.show(tester, unfold: false);+ await tester.tap(f.row(1));+ await tester.pumpAndSettle();+ await tester.tap(task);+ await tester.pumpAndSettle();+ expect(card, findsNothing);+ expect(f.answered, 'build');+ await f.close(tester);+ });++ testWidgets('Details… opens the full details', (tester) async {+ final f = await juno(tester);+ await f.show(tester, unfold: false);+ await tester.tap(f.row(1));+ await tester.pumpAndSettle();+ await tester.tap(find.text('Details…'));+ await tester.pumpAndSettle();+ expect(card, findsNothing);+ expect(find.text('Engine'), findsOneWidget);+ await f.close(tester);+ });++ testWidgets('an agent with nothing known shows no task or run line', (+ tester,+ ) async {+ final f = await juno(tester);+ f.server.state['machines'] = <Object>[];+ await f.controller.refresh();+ await f.show(tester, nativeState: false, unfold: false);+ await tester.tap(find.text('Idle (3)'));+ await tester.pumpAndSettle();+ await tester.tap(f.row(3));+ await tester.pumpAndSettle();+ expect(card, findsOneWidget);+ expect(task, findsNothing);+ expect(run, findsNothing);+ await f.close(tester);+ });++ testWidgets('the person card: crown, points and the three numbers', (+ tester,+ ) async {+ final f = await people(tester);+ // A dialog's width, beside the column.+ await tester.binding.setSurfaceSize(const Size(900, 760));+ await f.show(tester, unfold: false);+ await tester.tap(person('owner'));+ await tester.pumpAndSettle();+ final dialog = find.byType(Dialog);+ expect(+ find.descendant(of: dialog, matching: find.text('owner \u{1F451}')),+ findsOneWidget,+ );+ expect(+ find.descendant(of: dialog, matching: find.text('424 points')),+ findsOneWidget,+ );+ expect(find.byTooltip('Points in the last 7 days'), findsWidgets);+ expect(+ find.descendant(+ of: dialog,+ matching: find.text('11 shipped · 4 unblocked · 41 hours'),+ ),+ findsOneWidget,+ );+ expect(+ find.descendant(of: dialog, matching: find.text('Manage people')),+ findsOneWidget,+ );+ await f.close(tester);+ });++ testWidgets('a person off the board shows no points', (tester) async {+ final f = await people(tester);+ // A dialog's width, beside the column.+ await tester.binding.setSurfaceSize(const Size(900, 760));+ await f.show(tester, unfold: false);+ await tester.tap(person('tony'));+ await tester.pumpAndSettle();+ final dialog = find.byType(Dialog);+ expect(+ find.descendant(of: dialog, matching: find.text('tony')),+ findsOneWidget,+ );+ expect(+ find.descendant(of: dialog, matching: find.textContaining('points')),+ findsNothing,+ );+ await f.close(tester);+ });+ });+}diff --git a/desktop/test/super_tab_phone_header_test.dart b/desktop/test/super_tab_phone_header_test.dartindex b9241ee35..e216838bd 100644--- a/desktop/test/super_tab_phone_header_test.dart+++ b/desktop/test/super_tab_phone_header_test.dart@@ -11,7 +11,7 @@ import 'package:harness/super_tabs/roster.dart';import 'support/super_tab_phone.dart';final _menu = find.byTooltip('Project options');-final _people = find.byTooltip('Members and machines');+final _people = find.byTooltip('Members');final _openView = find.byKey(const ValueKey('super-open-view'));void main() {@@ -79,7 +79,7 @@ void main() {await tester.tap(_menu);await tester.pumpAndSettle();expect(find.text('Pull requests'), findsOneWidget);- expect(find.text('Members and machines'), findsNothing);+ expect(find.text('Members'), findsNothing);await unmountPhoneSuperTab(tester, controller);});diff --git a/desktop/test/super_tab_phone_targets_test.dart b/desktop/test/super_tab_phone_targets_test.dartindex 8afcb83d6..6a6c9a8f6 100644--- a/desktop/test/super_tab_phone_targets_test.dart+++ b/desktop/test/super_tab_phone_targets_test.dart@@ -166,7 +166,7 @@ void main() {);await _openReply(tester);expect(tester.getSize(find.byTooltip('Cancel reply')), const Size(32, 32));- await tester.tap(find.byTooltip('Members and machines'));+ await tester.tap(find.byTooltip('Members'));await tester.pumpAndSettle();expect(tester.getSize(find.byKey(const ValueKey('super-person-owner'))).height,diff --git a/desktop/test/super_tab_polish_test.dart b/desktop/test/super_tab_polish_test.dartindex de60ea1c5..420d9ea76 100644--- a/desktop/test/super_tab_polish_test.dart+++ b/desktop/test/super_tab_polish_test.dart@@ -377,7 +377,7 @@ void main() {await shot('');if (profile.scale > 1) {- await tester.tap(find.byTooltip('Members and machines'));+ await tester.tap(find.byTooltip('Members'));await tester.pumpAndSettle();await shot('-resources');expect(tester.takeException(), isNull);diff --git a/desktop/test/super_tab_roster_navigation_test.dart b/desktop/test/super_tab_roster_navigation_test.dartindex 4f3af8d3d..9b3fb6af1 100644--- a/desktop/test/super_tab_roster_navigation_test.dart+++ b/desktop/test/super_tab_roster_navigation_test.dart@@ -5,6 +5,7 @@ import 'package:harness/super_tabs/workspace.dart';import 'super_tab_launch_test.dart' show SuperTabLaunchFixture, tabId;import 'support/super_tab_fixture.dart';+import 'support/super_tab_members.dart';void main() {testWidgets(@@ -34,6 +35,7 @@ void main() {final mobileLead = {...conversationFixture('mobile-lead', 'Product Manager'),'projectId': 'mobile',+ 'leadId': 'nova','agentIds': ['nova'],};final mobileWork = {@@ -76,9 +78,10 @@ void main() {await tester.pumpAndSettle();expect(c.devicesSelected, isTrue);expect(c.selectedId, 'mobile-lead');+ await openSuperTabMembers(tester);await tester.tap(find.byKey(const ValueKey('super-member-nova')));await tester.pumpAndSettle();- await tester.tap(find.widgetWithText(FilledButton, 'Open terminal'));+ await tester.tap(find.text('Open terminal'));await tester.pumpAndSettle();await tester.tap(find.byKey(const ValueKey('super-agent-group-mobile-work')),diff --git a/desktop/test/super_tab_roster_scope_test.dart b/desktop/test/super_tab_roster_scope_test.dartindex 9d24ed655..f842dd3f9 100644--- a/desktop/test/super_tab_roster_scope_test.dart+++ b/desktop/test/super_tab_roster_scope_test.dart@@ -130,7 +130,7 @@ void main() {) async {final f = await swarm(tester);await f.show(tester);- await choose(tester, 'openharness');+ await choose(tester, 'This project');// The board of openharness names Ken and Dee; Tony cannot read it.expect(person('owner'), findsOneWidget);expect(person('dee'), findsOneWidget);@@ -154,7 +154,7 @@ void main() {"project's board", (tester) async {final f = await swarm(tester);await f.show(tester);- await choose(tester, 'openharness');+ await choose(tester, 'This project');await f.controller.select('os-lead');await tester.pumpAndSettle();// The scope follows the project now open: autonomous-os.@@ -178,7 +178,7 @@ void main() {final store = _Memory();final f = await swarm(tester, store: store);await f.show(tester);- await choose(tester, 'openharness');+ await choose(tester, 'This project');final key = SuperTabRosterScopeChoice.keyFor('owner', f.controller.tabId);expect(store.values[key], 'project');// The web sweeps it with the account's other keys at sign-out.@@ -190,7 +190,7 @@ void main() {expect(person('tony'), findsNothing);expect(agent(2), findsNothing);expect(- find.descendant(of: scope, matching: find.text('openharness')),+ find.descendant(of: scope, matching: find.text('This project')),findsOneWidget,);await again.close(tester);@@ -213,7 +213,7 @@ void main() {await f.show(tester);expect(f.controller.tabId, 'tab');// All projects is picked (the project is not saved yet), then the disk answers.- await choose(tester, 'openharness');+ await choose(tester, 'This project');await choose(tester, 'All projects');store.hold!.complete();await tester.pumpAndSettle();@@ -231,7 +231,7 @@ void main() {final store = _Memory();final f = await swarm(tester, store: store);await f.show(tester);- await choose(tester, 'openharness');+ await choose(tester, 'This project');expect(person('tony'), findsNothing);// The Swarm stops sending the project and its chat (access revoked).(f.server.state['projects'] as List).removeWhere((p) => p['id'] == 'lead');@@ -279,7 +279,7 @@ void main() {final f = await swarm(tester, board: false);f.server.failLeaderboardReads = 1;await f.show(tester);- await choose(tester, 'openharness');+ await choose(tester, 'This project');expect(person('owner'), findsOneWidget);expect(person('dee'), findsOneWidget);expect(person('tony'), findsOneWidget, reason: 'public: everyone');@@ -301,7 +301,7 @@ void main() {];await f.controller.refresh();await f.show(tester);- await choose(tester, 'openharness');+ await choose(tester, 'This project');expect(person('owner'), findsOneWidget);expect(person('dee'), findsOneWidget);expect(person('tony'), findsNothing);@@ -315,7 +315,7 @@ void main() {final store = _Memory()..failWrites = true;final f = await swarm(tester, store: store);await f.show(tester);- await choose(tester, 'openharness');+ await choose(tester, 'This project');expect(person('tony'), findsNothing);expect(tester.takeException(), isNull);await f.close(tester);@@ -345,7 +345,7 @@ void main() {Finder points(String id, String value) =>find.descendant(of: person(id), matching: find.textContaining(value));- testWidgets('All projects shows Swarm-wide points for the chosen period; '+ testWidgets('All projects shows Swarm-wide points for the last 7 days; ''a project its own', (tester) async {final f = await swarm(tester);rolling(f);@@ -353,24 +353,19 @@ void main() {expect(f.server.leaderboardReads.last, endsWith('&period=7d&scope=all'));expect(points('owner', '90'), findsWidgets);expect(points('tony', '40'), findsWidgets);+ // One period, the last 7 days, said on hover (Quiet Swarm).expect(find.byKey(const ValueKey('leaderboard-week')), findsNothing);+ expect(find.byKey(const ValueKey('leaderboard-period')), findsNothing);+ expect(find.byTooltip('Points in the last 7 days'), findsWidgets);- await tester.tap(find.byKey(const ValueKey('leaderboard-period')));- await tester.pumpAndSettle();- expect(find.text('Last 24h'), findsWidgets);- expect(find.text('Last 30d'), findsWidgets);- await tester.tap(find.text('Last 30d').last);- await tester.pumpAndSettle();- expect(f.server.leaderboardReads.last, endsWith('&period=30d&scope=all'));-- await choose(tester, 'openharness');- expect(f.server.leaderboardReads.last, endsWith('&period=30d'));+ await choose(tester, 'This project');+ expect(f.server.leaderboardReads.last, endsWith('&period=7d'));expect(points('owner', '30'), findsWidgets);expect(points('owner', '90'), findsNothing);expect(person('tony'), findsNothing);await choose(tester, 'All projects');- expect(f.server.leaderboardReads.last, endsWith('&period=30d&scope=all'));+ expect(f.server.leaderboardReads.last, endsWith('&period=7d&scope=all'));expect(points('owner', '90'), findsWidgets);expect(person('tony'), findsOneWidget);await f.close(tester);@@ -385,7 +380,7 @@ void main() {f.server.leaderboardGate = gate.future;await tester.tap(scope);await tester.pumpAndSettle();- await tester.tap(find.text('openharness').last);+ await tester.tap(find.text('This project').last);await tester.pump();await tester.pump(const Duration(milliseconds: 300));expect(points('owner', '90'), findsNothing);@@ -400,7 +395,7 @@ void main() {final f = await swarm(tester);rolling(f);await f.show(tester);- await choose(tester, 'openharness');+ await choose(tester, 'This project');expect(f.server.leaderboardReads.last, isNot(contains('scope=all')));f.server.state['projects'] = (f.server.state['projects'] as List).where((p) => (p as Map)['id'] != 'lead')@@ -411,7 +406,7 @@ void main() {await f.close(tester);});- testWidgets('light and dark, both menus and Swarm-wide points', (+ testWidgets('light and dark, the scope menu and Swarm-wide points', (tester,) async {final f = await swarm(tester);@@ -424,13 +419,7 @@ void main() {FocusManager.instance.primaryFocus?.unfocus();await tester.pumpAndSettle();expect(tester.takeException(), isNull);- expect(- find.descendant(- of: find.byKey(const ValueKey('leaderboard-period')),- matching: find.text('Last 7d'),- ),- findsOneWidget,- );+ expect(points('owner', '90'), findsWidgets);if (captureDir != null) {await captureBoundary(tester,@@ -444,11 +433,12 @@ void main() {await f.close(tester);});- testWidgets('from a server before periods: the week menu, its own project '+ testWidgets('from a server before periods: this week, its own project ''as before', (tester) async {final f = await swarm(tester);await f.show(tester);- expect(find.byKey(const ValueKey('leaderboard-week')), findsOneWidget);+ expect(find.byKey(const ValueKey('leaderboard-week')), findsNothing);+ expect(find.byTooltip('Points this week'), findsWidgets);expect(find.byKey(const ValueKey('leaderboard-period')), findsNothing);expect(points('owner', '30'), findsWidgets);await f.close(tester);@@ -476,14 +466,14 @@ void main() {expect(personInProject(project, 'owner', board: other), isTrue);});- testWidgets('light and dark, with both menus', (tester) async {+ testWidgets('light and dark, with the scope menu', (tester) async {final f = await swarm(tester);final saved = grid.AppTheme.brightness.value;addTearDown(() => grid.AppTheme.brightness.value = saved);for (final brightness in Brightness.values) {grid.AppTheme.brightness.value = brightness;await f.show(tester, brightness: brightness);- await choose(tester, 'openharness');+ await choose(tester, 'This project');FocusManager.instance.primaryFocus?.unfocus();await tester.pumpAndSettle();expect(tester.takeException(), isNull);diff --git a/desktop/test/super_tab_roster_test.dart b/desktop/test/super_tab_roster_test.dartindex b317136ab..4ca2a558f 100644--- a/desktop/test/super_tab_roster_test.dart+++ b/desktop/test/super_tab_roster_test.dart@@ -15,6 +15,7 @@ import 'package:harness/super_tabs/agent_details.dart';import 'package:harness/super_tabs/model.dart';import 'package:harness/super_tabs/identity.dart';import 'package:harness/super_tabs/roster.dart';+import 'package:harness/super_tabs/section_heading.dart';import 'package:harness/widgets/browser_menu_guard.dart';import 'package:harness/widgets/engine_identity.dart';import 'package:harness/widgets/harness_activity_mark.dart';@@ -34,6 +35,7 @@ class RosterFixture {SuperTabAgent? opened;SuperTabConversation? added;String? answered;+ bool closed = false;final boundary = GlobalKey();/// Where the roster keeps its scope choice; none by default.@@ -80,6 +82,7 @@ class RosterFixture {Brightness brightness = Brightness.dark,double scale = 1,DateTime Function()? now,+ bool unfold = true,}) async {await tester.pumpWidget(RepaintBoundary(@@ -103,6 +106,7 @@ class RosterFixture {onAddAgent: (group) => added = group,onAnswer: (id) => answered = id,onOpenAgent: (agent) => opened = agent,+ onClose: () => closed = true,storage: storage,now: now ?? DateTime.now,),@@ -111,20 +115,53 @@ class RosterFixture {),);await tester.pumpAndSettle();+ // Agents holding no task fold under Idle (N) (Quiet Swarm); most tests+ // read every row, so they open the fold, once per mounted list.+ final idle = find.byKey(const ValueKey('super-members-idle'));+ if (unfold &&+ idle.evaluate().isNotEmpty &&+ tester.widget<SuperTabSectionHeading>(idle).collapsed == true) {+ await tester.tap(+ find.descendant(of: idle, matching: find.textContaining('Idle (')),+ );+ await tester.pumpAndSettle();+ }}Finder row(int i) => find.byKey(ValueKey('super-member-agent-$i'));Finder inRow(int i, Finder child) =>find.descendant(of: row(i), matching: child);- /// The row's details line: its task and the time since its last progress,- /// or its state in a word (Dee, 2026-10-30).- Finder line(int i) => find.byKey(ValueKey('super-member-line-agent-$i'));- String lineText(WidgetTester tester, int i) =>- tester.widget<Text>(line(i)).data!;+ /// The row's state word (Quiet Swarm: one line, name, word and mark).+ Finder word(int i) => find.byKey(ValueKey('super-member-word-agent-$i'));+ String wordText(WidgetTester tester, int i) =>+ tester.widget<Text>(word(i)).data!;- /// The model and effort after the role chip (Dee, 2026-10-31).- Finder model(int i) => find.byKey(ValueKey('super-member-model-agent-$i'));+ /// How long since agent [i]'s last progress, which the row's details line+ /// said until Quiet Swarm (Dee, 2026-10-30): its hover's line for it.+ String? progressText(WidgetTester tester, int i) => tester+ .widgetList<Tooltip>(+ find.ancestor(of: row(i), matching: find.byType(Tooltip)),+ )+ .single+ .message!+ .split('\n')+ .where((line) => line.startsWith('Last progress '))+ .firstOrNull;++ /// Today's full details of agent [i], behind its row's right-click.+ Future<void> details(WidgetTester tester, int i) async {+ await tester.tap(row(i), buttons: kSecondaryMouseButton);+ await tester.pumpAndSettle();+ await tester.tap(find.text('Details'));+ await tester.pumpAndSettle();+ }++ /// Agent [i]'s card, as a click on its row opens it (Quiet Swarm).+ Future<void> card(WidgetTester tester, int i) async {+ await tester.tap(row(i));+ await tester.pumpAndSettle();+ }/// The hover's state line: state, machine, model and effort (team glance,/// 2026-10-27), on the row until 2026-10-30.@@ -319,7 +356,7 @@ void main() {await f.show(tester);expect(f.glanceText(tester, 1), contains('Opus 5.5'));expect(f.glanceText(tester, 1), isNot(contains('unknown')));- await tester.longPress(f.row(1));+ await f.details(tester, 1);await tester.pumpAndSettle();expect(find.descendant(@@ -332,112 +369,6 @@ void main() {await f.close(tester);});- // Dee (2026-10-31): "show the model and effort on the first line of each- // agent ... let's bring it back." Right after the role chip, in the grey of- // the line below.- group('first line model and effort', () {- Future<RosterFixture> withModel(- WidgetTester tester,- Map<String, Object> configuration,- ) async {- final f = await fixture(tester);- (f.server.state['agents'] as List)[1]['configuration'] = {- 'engine': 'claude',- ...configuration,- };- await f.controller.refresh();- await f.show(tester);- return f;- }-- testWidgets('reads "Opus 5.5 · high" after the role chip', (tester) async {- final f = await withModel(tester, {- 'model': 'claude-opus-5-5',- 'effort': 'high',- });- final model = f.model(1);- expect(tester.widget<Text>(model).data, 'Opus 5.5 · high');- final name = tester.getRect(f.inRow(1, find.text('Sage')));- final badge = tester.getRect(f.inRow(1, find.text('Dev')));- final shown = tester.getRect(model);- expect(shown.left, greaterThan(badge.right));- expect(shown.center.dy, closeTo(name.center.dy, 2));- expect(shown.bottom, lessThanOrEqualTo(tester.getRect(f.line(1)).top));- // The grey of the details line beneath.- expect(- tester.widget<Text>(model).style!.color,- tester.widget<Text>(f.line(1)).style!.color,- );- // The second line and the hover card stay as they were.- expect(f.lineText(tester, 1), isNot(contains('Opus')));- expect(f.glanceText(tester, 1), contains('Opus 5.5 · high'));- await f.close(tester);- });-- testWidgets('a model with no known effort shows the model alone', (- tester,- ) async {- final f = await withModel(tester, {- 'model': 'claude-opus-5-5',- 'effort': 'auto',- });- expect(tester.widget<Text>(f.model(1)).data, 'Opus 5.5');- await f.close(tester);- });-- testWidgets('an unknown model shows nothing extra', (tester) async {- final f = await withModel(tester, {'effort': 'high'});- expect(f.model(1), findsNothing);- expect(f.inRow(1, find.textContaining('high')), findsNothing);- await f.close(tester);- });-- for (final width in [220.0, 280.0]) {- for (final scale in [1.0, 2.0]) {- testWidgets(- 'at $width pixels and ${scale}x the model is cut before the name',- (tester) async {- final f = await fixture(tester);- await tester.binding.setSurfaceSize(Size(width, 700));- (f.server.state['agents'] as List)[1]['displayName'] = 'Alexandria';- await f.controller.refresh();- await f.show(tester, nativeState: false, scale: scale);- final name = f.inRow(1, find.text('Alexandria'));- final badge = f.inRow(1, find.text('Dev'));- final (nameAlone, badgeAlone) = (- tester.getRect(name),- tester.getRect(badge),- );- (f.server.state['agents'] as List)[1]['configuration'] = {- 'engine': 'claude',- 'model': 'claude-opus-5-5',- 'effort': 'xhigh',- };- await f.controller.refresh();- await f.show(tester, nativeState: false, scale: scale);- // The name and chip keep their size; the model takes what is left.- expect(tester.getRect(name), nameAlone);- expect(tester.getRect(badge), badgeAlone);- final row = tester.getRect(f.row(1));- final mark = tester.getRect(f.inRow(1, find.byType(ActivityMark)));- expect(f.model(1), findsOneWidget);- final model = tester.getRect(f.model(1));- expect(model.left, greaterThanOrEqualTo(badgeAlone.right));- expect(model.right, lessThanOrEqualTo(mark.left));- expect(model.right, lessThanOrEqualTo(row.right));- expect(tester.widget<Text>(f.model(1)).maxLines, 1);- expect(- tester.widget<Text>(f.model(1)).overflow,- TextOverflow.ellipsis,- );- expect(tester.takeException(), isNull);- await f.close(tester);- },- );- }- }- });-testWidgets('agent tooltip omits data that neither state nor host knows', (tester,) async {@@ -452,7 +383,7 @@ void main() {expect(f.glanceText(tester, 0), 'Idle');expect(rowTooltip(tester, f, 0), contains('Status unavailable'));expect(rowTooltip(tester, f, 0), isNot(contains('Last active')));- await tester.longPress(f.row(0));+ await f.details(tester, 0);await tester.pumpAndSettle();for (final absent in ['Model',@@ -510,7 +441,7 @@ void main() {final tooltip = rowTooltip(tester, f, 1);expect(tooltip, contains(title));expect(f.glanceText(tester, 1), 'Working · Test host');- expect(tester.getSize(f.line(1)).height, lessThan(30));+ expect(tester.getSize(f.word(1)).height, lessThan(30));final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);await mouse.addPointer(location: Offset.zero);await mouse.moveTo(tester.getCenter(f.row(1)));@@ -562,7 +493,7 @@ void main() {];await f.controller.refresh();await f.show(tester);- await tester.longPress(f.row(1));+ await f.details(tester, 1);await tester.pumpAndSettle();expect(find.byType(AlertDialog), findsOneWidget);expect(find.widgetWithText(TextButton, 'Offline editing'), findsOneWidget);@@ -606,7 +537,7 @@ void main() {);await f.controller.refresh();await f.show(tester);- await tester.longPress(f.row(1));+ await f.details(tester, 1);await tester.pumpAndSettle();expect(find.byTooltip('https://github.com/acme/project/pull/42'),@@ -639,7 +570,7 @@ void main() {}await f.controller.refresh();await f.show(tester);- await tester.longPress(f.row(1));+ await f.details(tester, 1);await tester.pumpAndSettle();expect(find.byTooltip('https://github.com/acme/project/pull/42'),@@ -676,7 +607,7 @@ void main() {};await f.controller.refresh();await f.show(tester);- await tester.longPress(f.row(1));+ await f.details(tester, 1);await tester.pumpAndSettle();expect(find.byTooltip('https://github.com/acme/project/pull/42'),@@ -711,7 +642,7 @@ void main() {}await f.controller.refresh();await f.show(tester);- await tester.longPress(f.row(1));+ await f.details(tester, 1);await tester.pumpAndSettle();expect(find.text('Latest PR'), findsNothing);expect(f.controller.messages('offline').length, 300);@@ -736,7 +667,7 @@ void main() {};await f.controller.refresh();await f.show(tester);- await tester.longPress(f.row(1));+ await f.details(tester, 1);await tester.pumpAndSettle();expect(find.text('Unrecognized setting'), findsOneWidget);expect(find.text('unmapped-mode-id'), findsNothing);@@ -764,7 +695,7 @@ void main() {};await f.controller.refresh();await f.show(tester);- await tester.longPress(f.row(1));+ await f.details(tester, 1);await tester.pumpAndSettle();expect(find.text('Read only, asks you'), findsOneWidget);expect(find.text('Unrecognized setting'), findsNothing);@@ -789,7 +720,7 @@ void main() {};await f.controller.refresh();await f.show(tester);- await tester.longPress(f.row(1));+ await f.details(tester, 1);await tester.pumpAndSettle();expect(find.text('Reads only, never asks'), findsOneWidget);expect(find.text('Unrecognized setting'), findsNothing);@@ -813,7 +744,7 @@ void main() {rowTooltip(tester, f, 1),contains('Waiting for a person to answer'),);- await tester.longPress(f.row(1));+ await f.details(tester, 1);await tester.pumpAndSettle();expect(find.text('Who can answer'), findsOneWidget);expect(@@ -828,7 +759,7 @@ void main() {await tester.pumpAndSettle();f.app.stateOf('m')!.blockedAgents.clear();await f.show(tester);- await tester.longPress(f.row(1));+ await f.details(tester, 1);await tester.pumpAndSettle();expect(find.text('Who can answer'), findsNothing);await f.close(tester);@@ -838,7 +769,7 @@ void main() {group('agent details Owner', () {Future<void> openDetails(WidgetTester tester, RosterFixture f) async {await f.show(tester);- await tester.longPress(f.row(1));+ await f.details(tester, 1);await tester.pumpAndSettle();}@@ -897,7 +828,7 @@ void main() {expect(f.controller.snapshot!.agents.first.id, 'agent-0');expect(f.controller.snapshot!.agents.first.harnessId, 'replacement');expect(f.controller.snapshot!.agents.first.engine, 'claude');- await tester.longPress(f.row(0));+ await f.details(tester, 0);await tester.pumpAndSettle();Finder details(String text) => find.descendant(of: find.byType(AlertDialog),@@ -905,8 +836,8 @@ void main() {);expect(details('Claude'), findsOneWidget);expect(details('Sonnet'), findsOneWidget);- // The row's first line names the new model too (Dee, 2026-10-31).- expect(tester.widget<Text>(f.model(0)).data, 'Sonnet');+ // So does its hover (the row is one line since Quiet Swarm).+ expect(f.glanceText(tester, 0), contains('Sonnet'));await tester.tap(find.widgetWithText(TextButton, 'Close'));await tester.pumpAndSettle();await f.close(tester);@@ -1131,19 +1062,29 @@ void main() {(f.server.state['agents'] as List)[1]['role'] = 'reviewer';await f.controller.refresh();await f.show(tester);- expect(f.inRow(1, find.text('Rev')), findsOneWidget);+ // The badge is on the card, its name on hover (Quiet Swarm).+ expect(f.inRow(1, find.text('Rev')), findsNothing);+ expect(rowTooltip(tester, f, 1), startsWith('Sage · Reviewer · '));+ expect(rowTooltip(tester, f, 3), startsWith('Finn · Engineer · '));+ await f.card(tester, 1);+ final card = find.byKey(const ValueKey('super-agent-card'));expect(- f.inRow(- 1,- find.byWidgetPredicate(- (w) => w is Semantics && w.properties.label == 'Reviewer',- ),- ),+ find.descendant(of: card, matching: find.text('Rev')),findsOneWidget,);- expect(f.inRow(1, find.text('Dev')), findsNothing);- expect(f.inRow(3, find.text('Dev')), findsOneWidget);- expect(f.inRow(0, find.text('PM')), findsOneWidget);+ expect(+ find.descendant(of: card, matching: find.byTooltip('Reviewer')),+ findsOneWidget,+ );+ await tester.tap(find.byTooltip('Close'));+ await tester.pumpAndSettle();+ await f.card(tester, 0);+ expect(+ find.descendant(of: card, matching: find.text('PM')),+ findsOneWidget,+ );+ await tester.tap(find.byTooltip('Close'));+ await tester.pumpAndSettle();await f.close(tester);});@@ -1188,22 +1129,18 @@ void main() {agents[0]['roleName'] = 'PM';await f.controller.refresh();await f.show(tester);- expect(f.inRow(1, find.text('Tester')), findsOneWidget);- expect(f.inRow(1, find.text('Dev')), findsNothing);+ // The row is one line: the role is on its hover and its card.+ expect(f.inRow(1, find.text('Tester')), findsNothing);expect(rowTooltip(tester, f, 1), startsWith('Sage · Tester · '));+ expect(rowTooltip(tester, f, 3), contains(' · Quality assurance lead · '));+ await f.card(tester, 1);+ final card = find.byKey(const ValueKey('super-agent-card'));expect(- f.inRow(- 1,- find.byWidgetPredicate(- (w) => w is Semantics && w.properties.label == 'Tester',- ),- ),+ find.descendant(of: card, matching: find.text('Tester')),findsOneWidget,);- // A long name's badge is cut; the tooltip and the label keep it whole.- expect(f.inRow(3, find.text('Quality ass…')), findsOneWidget);- expect(rowTooltip(tester, f, 3), contains(' · Quality assurance lead · '));- expect(f.inRow(0, find.text('PM')), findsOneWidget);+ await tester.tap(find.byTooltip('Close'));+ await tester.pumpAndSettle();final details = showSuperTabAgentDetails(tester.element(f.row(1)),f.controller,@@ -1384,10 +1321,12 @@ void main() {await f.controller.refresh();await f.show(tester);// autonomous-os's PM too, in openharness's chat (Dee, 2026-10-31).- expect(f.inRow(2, find.text('PM')), findsOneWidget);+ expect(f.row(2), findsOneWidget);for (final i in [0, 1, 3]) {expect(f.inRow(i, find.byType(SuperTabAvatar)), findsOneWidget);- expect(f.inRow(i, find.text(i == 0 ? 'PM' : 'Dev')), findsOneWidget);+ // One line: the role is on the card and the hover (Quiet Swarm).+ expect(f.word(i), findsOneWidget);+ expect(f.inRow(i, find.text(i == 0 ? 'PM' : 'Dev')), findsNothing);expect(f.inRow(i, find.byType(ActivityMark)), findsOneWidget);}expect(find.text('Join Super Tab roster'), findsNothing);@@ -1395,19 +1334,17 @@ void main() {expect(find.text('Ready'), findsNothing);final nameX = tester.getTopLeft(f.inRow(0, find.text('Atlas'))).dx;final name = tester.getRect(f.inRow(0, find.text('Atlas')));- final badge = tester.getRect(f.inRow(0, find.text('PM')));- final status = tester.getRect(f.line(0));+ final word = tester.getRect(f.word(0));final mark = tester.getRect(f.inRow(0, find.byType(ActivityMark)));// The status mark stands alone at the right, on the name's line (Dee, 2026-10-29); no engine icon.for (final i in [0, 1, 3]) {expect(f.inRow(i, find.byType(EngineMark)), findsNothing);}- expect(mark.left, greaterThan(badge.right));+ expect(mark.left, greaterThan(word.right));expect(mark.right, closeTo(tester.getRect(f.row(0)).right - 8, 1));expect(mark.center.dy, closeTo(name.center.dy, 2));- // The second line starts where the name does.- expect(status.left, nameX);- expect(status.top, greaterThanOrEqualTo(name.bottom));+ // The word is on the name's line too.+ expect(word.center.dy, closeTo(name.center.dy, 2));expect(tester.getSize(f.row(0)).height, lessThanOrEqualTo(60));expect(tester.getTopLeft(find.text('owner').first).dx,@@ -1451,7 +1388,7 @@ void main() {tester.getTopLeft(f.row(1)).dy,lessThan(tester.getTopLeft(f.row(3)).dy),);- await tester.longPress(f.row(1));+ await f.details(tester, 1);await tester.pumpAndSettle();expect(find.byType(AlertDialog), findsOneWidget);await tester.tap(find.widgetWithText(FilledButton, 'Open terminal'));@@ -1770,28 +1707,22 @@ void main() {await f.show(tester, nativeState: false, scale: scale);final row = tester.getRect(f.row(0));final name = tester.getRect(f.inRow(0, find.text(longName)));- final badgeFinder = f.inRow(0, find.text('PM'));- final badge = tester.getRect(badgeFinder);- final status = tester.getRect(f.line(0));+ final wordFinder = f.word(0);+ final word = tester.getRect(wordFinder);final mark = tester.getRect(f.inRow(0, find.byType(ActivityMark)));expect(name.left, tester.getTopLeft(find.text('owner')).dx);- expect(status.left, name.left);- expect(mark.left, greaterThanOrEqualTo(badge.right));- expect(name.right, lessThan(badge.left));- expect(status.top, greaterThanOrEqualTo(name.bottom));- for (final bounds in [name, badge, status, mark]) {+ expect(mark.left, greaterThanOrEqualTo(word.right));+ // A long name gives way to the word and the mark.+ expect(name.right, lessThanOrEqualTo(word.left));+ for (final bounds in [name, word, mark]) {expect(bounds.left, greaterThanOrEqualTo(row.left));expect(bounds.right, lessThanOrEqualTo(row.right));expect(bounds.bottom, lessThanOrEqualTo(row.bottom));}expect(- tester.renderObject<RenderParagraph>(badgeFinder).didExceedMaxLines,+ tester.renderObject<RenderParagraph>(wordFinder).didExceedMaxLines,isFalse,);- expect(- tester.widget<Text>(badgeFinder).style!.fontSize,- greaterThanOrEqualTo(12),- );final tooltip = rowTooltip(tester, f, 0);for (final fact in [longName,@@ -1879,10 +1810,11 @@ void main() {8: HarnessActivity.failed,3: HarnessActivity.done,1: HarnessActivity.working,- 0: HarnessActivity.idle,- 9: HarnessActivity.idle,7: HarnessActivity.paused,6: HarnessActivity.offline,+ // Holding no task, under Idle (N) (Quiet Swarm).+ 0: HarnessActivity.idle,+ 9: HarnessActivity.idle,};for (final MapEntry(key: i, value: activity) in expected.entries) {expect(f.activity(tester, i), activity, reason: 'agent-$i');@@ -2000,7 +1932,7 @@ void main() {// Nor its title, on the row's task line or on hover.expect(find.textContaining('Private plans'), findsNothing);expect(find.textContaining('Mira and Sparky'), findsNothing);- expect(f.lineText(tester, 3), 'Idle');+ expect(f.wordText(tester, 3), 'idle');expect(rowTooltip(tester, f, 3), isNot(contains('Private plans')));// The same group, once the reader is in it, does change the mark.((private['audience'] as Map)['people'] as List).add({'id': 'owner'});@@ -2047,8 +1979,9 @@ void main() {// Lost work reads Lost on its line; its mark is the tabs' Offline.expect(f.activity(tester, 4), HarnessActivity.offline);expect(f.glanceText(tester, 4), startsWith('Lost'));+ // Atlas holds no task: under Idle (N), below lost work (Quiet Swarm).final tops = [- for (final i in [3, 1, 0, 4]) tester.getTopLeft(f.row(i)).dy,+ for (final i in [3, 1, 4, 0]) tester.getTopLeft(f.row(i)).dy,];expect(tops, [...tops]..sort());expect(tops.toSet(), hasLength(4));@@ -2142,7 +2075,7 @@ void main() {// The tokens follow the app's theme, as the app's scope sets them.grid.AppTheme.brightness.value = brightness;await f.show(tester, brightness: brightness);- expect(find.text('Humans'), findsOneWidget);+ expect(find.text('People'), findsOneWidget);double avatar(Finder row) => tester.getTopLeft(find.descendant(of: row, matching: find.byType(SuperTabAvatar)),@@ -2324,11 +2257,16 @@ void main() {);expect(bounds.contains(status.center), isTrue);}- expect(- [for (var i = 0; i < 3; i++) tester.widget<Text>(f.model(i)).data],- ['GPT-5.6 Sol · xhigh', 'Opus 5.5 · high', 'GPT-5.6 Sol'],- );- expect(f.model(3), findsNothing);+ // Model and effort are on the hover, not the row (Quiet Swarm).+ for (final (i, model) in [+ (0, 'GPT-5.6 Sol · xhigh'),+ (1, 'Opus 5.5 · high'),+ (2, 'GPT-5.6 Sol'),+ ]) {+ expect(f.glanceText(tester, i), endsWith(model));+ expect(f.inRow(i, find.textContaining('GPT')), findsNothing);+ expect(f.inRow(i, find.textContaining('Opus')), findsNothing);+ }expect(tester.takeException(), isNull);await captureBoundary(tester,@@ -2402,11 +2340,11 @@ void main() {expect(f.activity(tester, 1), HarnessActivity.working);expect(f.activity(tester, 3), HarnessActivity.done);expect(f.activity(tester, 0), HarnessActivity.idle);- // The details line: the task in plain words and the time since its- // last progress; no task, the state in a word.- expect(f.lineText(tester, 1), 'Sidebar rescan fix · 4m');- expect(f.lineText(tester, 3), 'Reviewer names · 20m');- expect(f.lineText(tester, 0), 'Idle');+ // The hover's task line: the task in plain words and the time since+ // its last progress; no task, the row's state in a word.+ expect(f.progressText(tester, 1), 'Last progress 4 minutes ago');+ expect(f.progressText(tester, 3), 'Last progress 20 minutes ago');+ expect(f.wordText(tester, 0), 'idle');await f.close(tester);},);@@ -2445,17 +2383,17 @@ void main() {await f.show(tester, nativeState: false);// Nothing has said how agent-1 is for longer than its lease.expect(f.activity(tester, 1), HarnessActivity.unknown);- expect(f.lineText(tester, 1), 'Sidebar rescan fix · 9m');+ expect(f.progressText(tester, 1), 'Last progress 9 minutes ago');// Its pull request not merged yet: waiting, with the task it waits on.expect(f.activity(tester, 3), HarnessActivity.done);- expect(f.lineText(tester, 3), 'Reviewer names · 30m');+ expect(f.progressText(tester, 3), 'Last progress 30 minutes ago');// Merged: nothing left for it, idle.((done['cards'] as Map)['pullRequests'] as List).first['mergedAt'] =DateTime.now().millisecondsSinceEpoch;await f.controller.refresh();await tester.pumpAndSettle();expect(f.activity(tester, 3), HarnessActivity.idle);- expect(f.lineText(tester, 3), 'Idle');+ expect(f.wordText(tester, 3), 'idle');await f.close(tester);},);@@ -2537,7 +2475,7 @@ void main() {expect(tip, contains('Opus'));expect(tip, contains('high'));expect(tip, contains('Sidebar rescan fix'));- final line = f.lineText(tester, 1);+ final line = f.wordText(tester, 1);for (final word in ['Claude', 'Opus', 'high', 'Mac Studio']) {expect(line, isNot(contains(word)));}@@ -2555,7 +2493,7 @@ void main() {);testWidgets(- 'clicking a row opens its task\'s conversation; a needs-you row its question; no task, its details',+ 'clicking a row opens its card, whose task opens its conversation; no task, no task line',(tester) async {final f = await fixture(tester);(f.server.state['conversations'] as List).addAll(<Map<String, dynamic>>[@@ -2577,17 +2515,23 @@ void main() {await f.controller.refresh();await f.show(tester, nativeState: false);expect(f.activity(tester, 3), HarnessActivity.needsInput);- await tester.tap(f.row(1));+ final cardTask = find.byKey(const ValueKey('super-card-task'));+ await f.card(tester, 1);+ expect(f.answered, isNull);+ await tester.tap(cardTask);await tester.pumpAndSettle();expect(f.answered, 't1');- await tester.tap(f.row(3));+ await f.card(tester, 3);+ await tester.tap(cardTask);await tester.pumpAndSettle();expect(f.answered, 't3');f.answered = null;- await tester.tap(f.row(0));+ await f.card(tester, 0);+ expect(find.byKey(const ValueKey('super-agent-card')), findsOneWidget);+ expect(cardTask, findsNothing);+ await tester.tap(find.byTooltip('Close'));await tester.pumpAndSettle();expect(f.answered, isNull);- expect(find.widgetWithText(AlertDialog, 'Role'), findsOneWidget);await f.close(tester);},);@@ -2721,7 +2665,7 @@ void main() {expect(f.activity(tester, 6), HarnessActivity.unknown);expect(f.activity(tester, 8), HarnessActivity.paused);expect(f.activity(tester, 9), HarnessActivity.failed);- expect(f.lineText(tester, 1), 'Sidebar rescan fix · 4m');+ expect(f.progressText(tester, 1), 'Last progress 4 minutes ago');await captureBoundary(tester,f.boundary.currentContext!.findRenderObject()!@@ -2891,7 +2835,7 @@ void main() {now: () => DateTime.now().add(const Duration(minutes: 5)),);expect(f.activity(tester, 1), HarnessActivity.working);- expect(f.lineText(tester, 1), 'Sidebar rescan fix · 3m');+ expect(f.progressText(tester, 1), 'Last progress 3 minutes ago');await f.close(tester);},);@@ -2918,7 +2862,7 @@ void main() {await f.controller.refresh();await f.show(tester, nativeState: false);expect(f.activity(tester, 1), isNot(HarnessActivity.working));- expect(f.lineText(tester, 1), 'Night digest · 2h');+ expect(f.progressText(tester, 1), 'Last progress 2 hours ago');await f.close(tester);},);@@ -2941,12 +2885,12 @@ void main() {await f.controller.refresh();await f.show(tester, nativeState: false, now: () => clock);expect(f.activity(tester, 1), HarnessActivity.working);- expect(f.lineText(tester, 1), 'Sidebar rescan fix · 4m');+ expect(f.progressText(tester, 1), 'Last progress 4 minutes ago');// Nothing changes in the Swarm; only time passes.clock = clock.add(const Duration(seconds: 30));await tester.pump(const Duration(seconds: 30));expect(f.activity(tester, 1), HarnessActivity.unknown);- expect(f.lineText(tester, 1), 'Sidebar rescan fix · 5m');+ expect(f.progressText(tester, 1), 'Last progress 5 minutes ago');await f.close(tester);},);@@ -3010,10 +2954,14 @@ void main() {).taskGroup,isNull,);- // No task it may read: a click opens the details, which name none.- await tester.tap(f.row(3));- await tester.pumpAndSettle();+ // No task it may read: its card names none, nor do its details.+ await f.card(tester, 3);expect(f.answered, isNull);+ expect(find.byKey(const ValueKey('super-card-task')), findsNothing);+ expect(find.textContaining('Private plans'), findsNothing);+ await tester.tap(find.byTooltip('Close'));+ await tester.pumpAndSettle();+ await f.details(tester, 3);expect(find.widgetWithText(AlertDialog, 'Role'), findsOneWidget);expect(find.text('Task'), findsNothing);expect(find.textContaining('Private plans'), findsNothing);@@ -3041,12 +2989,18 @@ void main() {};await f.controller.refresh();await f.show(tester, nativeState: false);- expect(find.text('Sidebar rescan fix · 1m'), findsOneWidget);- expect(find.text('Opus 5.5 · high'), findsOneWidget);+ expect(rowTooltip(tester, f, 1), contains('Sidebar rescan fix'));+ expect(rowTooltip(tester, f, 1), contains('Opus 5.5 · high'));f.controller.revokeAccess('Access removed');await tester.pumpAndSettle();expect(find.textContaining('Sidebar rescan fix'), findsNothing);expect(find.textContaining('Opus 5.5'), findsNothing);+ expect(+ find.byWidgetPredicate(+ (w) => w is Tooltip && (w.message ?? '').contains('Sidebar'),+ ),+ findsNothing,+ );expect(f.row(1), findsNothing);await f.close(tester);},diff --git a/desktop/test/super_tab_sidebar_models_test.dart b/desktop/test/super_tab_sidebar_models_test.dartindex 755340b4e..c9c228498 100644--- a/desktop/test/super_tab_sidebar_models_test.dart+++ b/desktop/test/super_tab_sidebar_models_test.dart@@ -237,47 +237,35 @@ void main() {},);- testWidgets('keeps the last 7 days whichever week the right pane shows', (- tester,- ) async {- final server = modelsSwarm();- // The right pane is beside the chat: pick its week, then open Manage.- final controller = await show(tester, server, openManage: false);- await tester.tap(find.byKey(const ValueKey('leaderboard-week')));- await tester.pumpAndSettle();- await tester.tap(find.text('Last week').last);- await tester.pumpAndSettle();- expect(server.leaderboardReads.last, contains('&week='));- await openModels(tester);- expect(find.textContaining('last week'), findsNothing);- expect(inRow('Opus 5.5', find.text('87%')), findsOneWidget);- await close(tester, controller);- });-- testWidgets('shows the week\'s models from a server before the last 7 days', (- tester,- ) async {- final server = modelsSwarm();- server.leaderboard!.remove('recentModels');- final controller = await show(tester, server);- // 32 tasks: Opus at two efforts as one, 14; then 9, 6 and 3; Luna ran- // none of its own.- expect(names(tester), [- 'Opus 5.5',- 'GPT-6.1 Sol',- 'Sonnet 5.5',- 'Haiku 5.5',- ]);- expect(inRow('Opus 5.5', find.text('44%')), findsOneWidget);- expect(inRow('Haiku 5.5', find.text('9%')), findsOneWidget);- expect(- find.byTooltip(- 'Opus 5.5: 14 of 32 tasks this week · 92% passed first review',- ),- findsOneWidget,- );- await close(tester, controller);- });+ testWidgets(+ 'shows the week\'s models from a server before the last 7 days in Manage',+ (tester) async {+ final server = modelsSwarm();+ server.leaderboard!.remove('recentModels');+ final controller = await show(tester, server);+ expect(+ find.byKey(const ValueKey('super-manage-tab-models')),+ findsOneWidget,+ );+ // 32 tasks: Opus at two efforts as one, 14; then 9, 6 and 3; Luna ran+ // none of its own.+ expect(names(tester), [+ 'Opus 5.5',+ 'GPT-6.1 Sol',+ 'Sonnet 5.5',+ 'Haiku 5.5',+ ]);+ expect(inRow('Opus 5.5', find.text('44%')), findsOneWidget);+ expect(inRow('Haiku 5.5', find.text('9%')), findsOneWidget);+ expect(+ find.byTooltip(+ 'Opus 5.5: 14 of 32 tasks this week · 92% passed first review',+ ),+ findsOneWidget,+ );+ await close(tester, controller);+ },+ );testWidgets('leaves records with no reported model out of the list and the shares',@@ -319,7 +307,6 @@ void main() {];final controller = await show(tester, server);expect(rows, findsNothing);- expect(rows, findsNothing);expect(notReported, findsNothing);await close(tester, controller);});diff --git a/desktop/test/super_tab_switch_pm_test.dart b/desktop/test/super_tab_switch_pm_test.dartindex 3b4c94a99..0fa97b534 100644--- a/desktop/test/super_tab_switch_pm_test.dart+++ b/desktop/test/super_tab_switch_pm_test.dart@@ -5,6 +5,7 @@ import 'package:harness/super_tabs/controller.dart';import 'package:harness/super_tabs/view.dart';import 'support/super_tab_fixture.dart';+import 'support/super_tab_members.dart';/// Switch PM (spec 2026-11-02-pm-switch-engine-account-design.md, section 8):/// who is offered it, what its dialog lists and what Confirm sends.@@ -301,7 +302,9 @@ void main() {},);await mount(tester, server, 'owner');- expect(find.textContaining('Switching…'), findsWidgets);+ await openSuperTabMembers(tester);+ // The row's state word (Quiet Swarm).+ expect(find.text('switching…'), findsWidgets);await finish(tester);});}diff --git a/desktop/test/super_tab_task_line_test.dart b/desktop/test/super_tab_task_line_test.dartindex 16098e9cd..5e959a681 100644--- a/desktop/test/super_tab_task_line_test.dart+++ b/desktop/test/super_tab_task_line_test.dart@@ -7,6 +7,7 @@ import 'package:harness/shared/theme/app_icons.dart';import 'package:harness/state/harness_attachments.dart';import 'package:harness/super_tabs/controller.dart';import 'package:harness/super_tabs/message_row.dart';+import 'package:harness/super_tabs/roster.dart';import 'package:harness/super_tabs/task_line.dart';import 'package:harness/super_tabs/thread_panel.dart';@@ -335,6 +336,21 @@ void main() {expect(find.byType(SuperTabTaskPanel), findsNothing);});+ testWidgets('Members takes the task panel\'s place, as it takes a thread\'s', (+ tester,+ ) async {+ final c = await showView(tester, serverWith([taskRow('working')]));+ await c.loadMessages('lead');+ await tester.pumpAndSettle();+ await tester.tap(line);+ await tester.pumpAndSettle();+ expect(find.byType(SuperTabTaskPanel), findsOneWidget);+ await tester.tap(find.byKey(const ValueKey('super-members-button')));+ await tester.pumpAndSettle();+ expect(find.byType(SuperTabRoster), findsOneWidget);+ expect(find.byType(SuperTabTaskPanel), findsNothing);+ });+testWidgets('on a narrow window, a click outside closes the task panel', (tester,) async {diff --git a/desktop/test/super_tab_teammate_terminal_test.dart b/desktop/test/super_tab_teammate_terminal_test.dartindex 61e93a0cb..d17b045dd 100644--- a/desktop/test/super_tab_teammate_terminal_test.dart+++ b/desktop/test/super_tab_teammate_terminal_test.dart@@ -110,7 +110,8 @@ Future<(SuperTabLaunchFixture, _Machines, SuperTabController)> _swarm({'configuration': {'engine': 'claude'},},];- (state['conversations'] as List)[0]['agentIds'] = ['river'];+ // A workgroup: the project chat shows its coordinator's terminal alone (#2207).+ (state['conversations'] as List)[1]['agentIds'] = ['river'];final c = await f.app.superTabs.open(tabId);await c.refresh();return (f, api, c);@@ -371,7 +372,9 @@ void main() {(tester) async {final (f, api, c) = await _swarm();await _show(tester, f);- c.selectTerminal('lead', 'river');+ c+ ..select('offline')+ ..selectTerminal('offline', 'river');await _settle(tester);await _shoot(tester, 'teammate-without-invitation');expect(find.textContaining('must be online'), findsNothing);@@ -407,7 +410,9 @@ void main() {final (f, api, c) = await _swarm(confidential: true);await _show(tester, f);final reads = api.reads;- c.selectTerminal('lead', 'river');+ c+ ..select('offline')+ ..selectTerminal('offline', 'river');await _settle(tester);expect(find.textContaining('only scholes can watch'), findsOneWidget);expect(find.textContaining('update and restart'), findsNothing);@@ -425,7 +430,9 @@ void main() {api.list = [_own, _teammate(21)];await f.app.refreshMachines();await _show(tester, f);- c.selectTerminal('lead', 'river');+ c+ ..select('offline')+ ..selectTerminal('offline', 'river');await _settle(tester);final panel = tester.state(find.byType(SharedHarnessPanel));final pane = f.app.panes.single;@@ -456,7 +463,9 @@ void main() {..['machineOwnerId'] = 'owner';await c.refresh();await _show(tester, f);- c.selectTerminal('lead', 'river');+ c+ ..select('offline')+ ..selectTerminal('offline', 'river');await _settle(tester);expect(find.text(superTabTerminalOffline), findsOneWidget);expect(find.text('Retry'), findsOneWidget);diff --git a/desktop/test/super_tab_view_test.dart b/desktop/test/super_tab_view_test.dartindex 6c47b18e4..1ad1d0cdb 100644--- a/desktop/test/super_tab_view_test.dart+++ b/desktop/test/super_tab_view_test.dart@@ -12,6 +12,7 @@ import 'package:harness/super_tabs/roster.dart';import 'package:harness/shared/widgets/app_icon_button.dart';import 'support/super_tab_fixture.dart';+import 'support/super_tab_members.dart';void main() {testWidgets('rapid pending rows have independent identity and dimmed text', (@@ -315,7 +316,7 @@ void main() {),);await tester.pumpAndSettle();- await tester.tap(find.byTooltip('Members and machines'));+ await tester.tap(find.byTooltip('Members'));await tester.pumpAndSettle();final roster = find.byType(SuperTabRoster);expect(tester.getSize(roster).width, 360 * 0.7);@@ -407,6 +408,7 @@ void main() {),);await tester.pumpAndSettle();+ await openSuperTabMembers(tester);expect(find.text('Pilot'), findsOneWidget);expect(find.text('# Pilot'), findsOneWidget);expect(find.text('CHATS'), findsNothing);@@ -523,8 +525,21 @@ void main() {),);await tester.pumpAndSettle();- expect(find.text('Humans'), findsOneWidget);+ await openSuperTabMembers(tester);+ expect(find.text('People'), findsOneWidget);final member = find.byKey(const ValueKey('super-member-agent-0'));+ // Below twenty people, the agents holding no task fold under Idle (N).+ await tester.scrollUntilVisible(+ find.byKey(const ValueKey('super-members-idle')),+ 150,+ scrollable: find+ .descendant(+ of: find.byType(SuperTabRoster),+ matching: find.byType(Scrollable),+ )+ .first,+ );+ await unfoldSuperTabIdle(tester);await tester.scrollUntilVisible(member,150,@@ -540,8 +555,9 @@ void main() {await tester.pumpAndSettle();await tester.tap(member);await tester.pumpAndSettle();- expect(find.byType(AlertDialog), findsOneWidget);- await tester.tap(find.widgetWithText(FilledButton, 'Open terminal'));+ // The agent's card (Quiet Swarm).+ expect(find.byKey(const ValueKey('super-agent-card')), findsOneWidget);+ await tester.tap(find.text('Open terminal'));await tester.pumpAndSettle();expect(target?.id, 'agent-0');expect(find.byType(Dialog), findsNothing);@@ -581,7 +597,8 @@ void main() {expect(find.text('Native terminal fixture'), findsOneWidget);expect(find.text('Review this result.'), findsNothing);expect(find.byKey(const ValueKey('super-group-lead')), findsOneWidget);- expect(find.byType(SuperTabRoster), findsOneWidget);+ // The right column stays closed at rest beside the terminals too.+ expect(find.byType(SuperTabRoster), findsNothing);expect(tester.widget<AppIconButton>(diff --git a/desktop/test/super_tab_workspace_test.dart b/desktop/test/super_tab_workspace_test.dartindex fe40d7b01..9eae53bf5 100644--- a/desktop/test/super_tab_workspace_test.dart+++ b/desktop/test/super_tab_workspace_test.dart@@ -90,9 +90,9 @@ void main() {'configuration': {'engine': 'claude'},},];- (f.connection.server.state['conversations'] as List)[0]['agentIds'] = [- 'lead-agent',- ];+ (f.connection.server.state['conversations'] as List)[0]+ ..['agentIds'] = ['lead-agent']+ ..['leadId'] = 'lead-agent';f.app.machineStates['m']!.agents = [Agent.fromJson(f.connection.native!)];final c = await f.app.superTabs.open(tabId);await c.refresh();@@ -167,9 +167,9 @@ void main() {'configuration': {'engine': 'codex'},};f.connection.server.state['agents'] = [member];- (f.connection.server.state['conversations'] as List)[0]['agentIds'] = [- 'stable-member',- ];+ (f.connection.server.state['conversations'] as List)[0]+ ..['agentIds'] = ['stable-member']+ ..['leadId'] = 'stable-member';f.app.machineStates['m']!.agents = const [Agent(id: 'native-original',@@ -249,7 +249,9 @@ void main() {},];(state['conversations'] as List)[1]['agentIds'] = ['a', 'b', 'c', 'd'];- (state['conversations'] as List)[0]['agentIds'] = ['b'];+ (state['conversations'] as List)[0]+ ..['agentIds'] = ['b']+ ..['leadId'] = 'b';f.app.machineStates['m']!.agents = [for (final id in ['a', 'b', 'c', 'd'])Agent.fromJson({@@ -514,7 +516,9 @@ void main() {'configuration': {'engine': 'codex'},},];- (state['conversations'] as List)[0]['agentIds'] = ['a'];+ (state['conversations'] as List)[0]+ ..['agentIds'] = ['a']+ ..['leadId'] = 'a';(state['conversations'] as List)[1]['agentIds'] = ['b'];f.app.machineStates['m']!.agents = [for (final id in ['a', 'b'])@@ -625,7 +629,9 @@ void main() {'configuration': {'engine': 'codex'},},];- (state['conversations'] as List)[0]['agentIds'] = ['a'];+ (state['conversations'] as List)[0]+ ..['agentIds'] = ['a']+ ..['leadId'] = 'a';f.app.machineStates['m']!.agents = [Agent.fromJson({'id': 'native-a', 'name': 'Lead', 'engine': 'codex'}),];diff --git a/desktop/test/support/super_tab_members.dart b/desktop/test/support/super_tab_members.dartnew file mode 100644index 000000000..8b3a14680--- /dev/null+++ b/desktop/test/support/super_tab_members.dart@@ -0,0 +1,54 @@+import 'package:flutter/widgets.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:harness/super_tabs/section_heading.dart';++/// The chat header's Members button: the right column opens only from it+/// (Quiet Swarm, Dee, 2026-11-02).+final superTabMembersButton = find.byKey(+ const ValueKey('super-members-button'),+);++/// Opens the Members column of the Swarm view on screen, and with [unfold]+/// the agents folded under Idle (N). [settle] false pumps a few frames+/// instead, for a test that holds a read open.+Future<void> openSuperTabMembers(+ WidgetTester tester, {+ bool settle = true,+ bool unfold = true,+}) async {+ Future<void> wait() async {+ if (settle) {+ await tester.pumpAndSettle();+ } else {+ for (var i = 0; i < 5; i++) {+ await tester.pump();+ }+ }+ }++ await tester.tap(superTabMembersButton);+ await wait();+ if (unfold) await unfoldSuperTabIdle(tester, settle: settle);+}++/// Opens the agents folded under Idle (N), when a fold is there and shut.+Future<void> unfoldSuperTabIdle(+ WidgetTester tester, {+ bool settle = true,+}) async {+ final idle = find.byKey(const ValueKey('super-members-idle'));+ if (idle.evaluate().isEmpty ||+ tester.widget<SuperTabSectionHeading>(idle).collapsed != true) {+ return;+ }+ await tester.tap(+ find.descendant(of: idle, matching: find.textContaining('Idle (')),+ );+ if (settle) {+ await tester.pumpAndSettle();+ } else {+ for (var i = 0; i < 5; i++) {+ await tester.pump();+ }+ }+}diff --git a/desktop/test/support/super_tab_phone.dart b/desktop/test/support/super_tab_phone.dartindex 123fc2847..88cdfcd93 100644--- a/desktop/test/support/super_tab_phone.dart+++ b/desktop/test/support/super_tab_phone.dart@@ -32,7 +32,9 @@ Future<(ConversationServer, SuperTabController)> mountPhoneSuperTab(given ?? (ConversationServer()..append('Ship the phone header.'));if (given == null) {final lead = (server0.state['conversations'] as List).first as Map;- lead['agentIds'] = ['builder'];+ lead+ ..['agentIds'] = ['builder']+ ..['leadId'] = 'builder';}seed?.call(server0);final controller = server0.controller();diff --git a/desktop/test/swarm_projects_test.dart b/desktop/test/swarm_projects_test.dartindex 9b484c82c..3056088cb 100644--- a/desktop/test/swarm_projects_test.dart+++ b/desktop/test/swarm_projects_test.dart@@ -8,6 +8,7 @@ import 'package:harness/super_tabs/controller.dart';import 'package:harness/super_tabs/project_visibility.dart';import 'support/super_tab_fixture.dart';+import 'support/super_tab_members.dart';ConversationServer projectsServer() {final server = ConversationServer();@@ -70,7 +71,10 @@ void main() {);expect(find.text('Leads'), findsNothing);expect(find.text('Projects'), findsOneWidget);- expect(find.text('Humans'), findsOneWidget);+ // The right column opens only from Members (Quiet Swarm).+ expect(find.text('People'), findsNothing);+ await openSuperTabMembers(tester);+ expect(find.text('People'), findsOneWidget);// The roster's heading; the leaderboard's Agents pill is the other one.expect(find.descendant(diff --git a/desktop/test/web/release/project_chat_panes_app.dart b/desktop/test/web/release/project_chat_panes_app.dartnew file mode 100644index 000000000..0b2c52c08--- /dev/null+++ b/desktop/test/web/release/project_chat_panes_app.dart@@ -0,0 +1,100 @@+// A release-build page holding the real Swarm view on made-up data, for task+// #2207's test: an older project chat that still holds a Reviewer, Finn 2,+// next to its coordinator, River, and a task with two agents. The panel on the+// right lists the terminal panes Desktop opens for the chat shown (the+// controller's terminalAgents, which the workspace opens), as the browser has+// no native terminals to show. Never shipped: nothing in lib/ imports it.+// Build: flutter build web --release -t test/web/release/project_chat_panes_app.dart+import 'package:flutter/material.dart';+import 'package:harness/shared/theme/app_theme.dart' as grid;+import 'package:harness/super_tabs/controller.dart';+import 'package:harness/super_tabs/view.dart';++import '../../support/super_tab_fixture.dart';++Map<String, dynamic> _agent(String id, String name, String role) => {+ 'id': id,+ 'name': name,+ 'roleName': role,+ 'machineId': 'studio',+ 'harnessId': 'native-$id',+ 'contributorId': 'owner',+ 'configuration': {'engine': 'claude'},+};++Future<void> main() async {+ WidgetsFlutterBinding.ensureInitialized();+ final server = ConversationServer();+ server.state['agents'] = [+ _agent('river', 'River', 'Product Manager'),+ _agent('finn', 'Finn 2', 'Reviewer'),+ _agent('kai', 'Kai', 'Engineer'),+ ];+ final chats = server.state['conversations'] as List;+ // An older Swarm's project chat: Finn 2 was added there before #2207.+ chats[0]+ ..['leadId'] = 'river'+ ..['agentIds'] = ['river', 'finn'];+ chats[1]+ ..['leadId'] = 'river'+ ..['agentIds'] = ['kai', 'finn'];+ final controller = server.controller();+ await controller.refresh();+ await controller.select('lead');+ runApp(+ MaterialApp(+ debugShowCheckedModeBanner: false,+ theme: grid.buildAppTheme(brightness: Brightness.dark),+ home: Scaffold(+ body: Row(+ children: [+ Expanded(+ child: SuperTabView(+ controller: controller,+ onInvite: () {},+ onAddAgent: (_) {},+ onOpenTerminal: (_) {},+ onOpenGroupTerminals: () =>+ controller.selectGroupTerminals(controller.selectedId),+ machineName: (_) => 'Studio',+ ),+ ),+ SizedBox(width: 260, child: _Panes(controller: controller)),+ ],+ ),+ ),+ ),+ );+}++/// The panes the workspace would open beside the chat shown.+class _Panes extends StatelessWidget {+ const _Panes({required this.controller});++ final SuperTabController controller;++ @override+ Widget build(BuildContext context) => ListenableBuilder(+ listenable: controller,+ builder: (context, _) {+ final id = controller.selectedId;+ final open = controller.groupTerminalsOpen(id);+ final agents = open ? controller.terminalAgents(id) : const [];+ final title = controller.snapshot?.conversation(id)?.title ?? id;+ return Padding(+ padding: const EdgeInsets.all(16),+ child: Column(+ key: const ValueKey('panes'),+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Text('Terminal panes: $title'),+ const SizedBox(height: 8),+ if (!open) const Text('None open. Use the terminal button.'),+ for (final agent in agents)+ Text(agent.name, key: ValueKey('pane-${agent.id}')),+ ],+ ),+ );+ },+ );+}diff --git a/desktop/test/web_chrome_menus_test.dart b/desktop/test/web_chrome_menus_test.dartindex 1f9c25438..ea7cef210 100644--- a/desktop/test/web_chrome_menus_test.dart+++ b/desktop/test/web_chrome_menus_test.dart@@ -402,7 +402,7 @@ void main() {.first,);expect(icon('Conversations').left, name.left);- expect(icon('Members and machines').center.dx, avatar.center.dx);+ expect(icon('Members').center.dx, avatar.center.dx);expect(tester.takeException(), isNull);await unmountPhoneSuperTab(tester, controller);});diff --git a/desktop/tool/super_tab_members_review.dart b/desktop/tool/super_tab_members_review.dartnew file mode 100644index 000000000..809e65a93--- /dev/null+++ b/desktop/tool/super_tab_members_review.dart@@ -0,0 +1,283 @@+/// No-login review fixture for Quiet Swarm's Members (screens 4 and 5).+///+/// Build for web with `--dart-define=HARNESS_TEST=true -t+/// tool/super_tab_members_review.dart` and open with `?theme=dark` (Graphite;+/// light Paper is the default). It renders the real [SuperTabView] against an+/// in-memory fake backend on made-up data, read by dee, and never touches a+/// real account or production data.+library;++import 'package:flutter/material.dart';+import 'package:harness/shared/theme/app_theme.dart' as grid;+import 'package:harness/shared/theme/color_palette.dart';+import 'package:harness/super_tabs/controller.dart';+import 'package:harness/super_tabs/view.dart';++import '../test/support/super_tab_fixture.dart';++Future<void> main() async {+ WidgetsFlutterBinding.ensureInitialized();+ // Let headless browsers address the rendered buttons by role/name.+ WidgetsBinding.instance.ensureSemantics();+ final palette = Uri.base.queryParameters['theme'] == 'dark'+ ? HarnessPalette.graphite+ : HarnessPalette.paper;+ grid.AppTheme.palette.value = palette;+ grid.AppTheme.brightness.value = palette.brightness;+ final controller = _seed().controller(+ account: 'dee',+ initial: {'tabId': 'tab', 'accountId': 'dee', 'selectedId': 'lead'},+ );+ await controller.refresh();+ await controller.loadMessages('lead');+ runApp(+ MaterialApp(+ debugShowCheckedModeBanner: false,+ theme: grid.buildAppTheme(brightness: palette.brightness),+ home: _Review(controller: controller),+ ),+ );+}++class _Review extends StatefulWidget {+ const _Review({required this.controller});+ final SuperTabController controller;++ @override+ State<_Review> createState() => _ReviewState();+}++class _ReviewState extends State<_Review> {+ @override+ void dispose() {+ widget.controller.dispose();+ super.dispose();+ }++ @override+ Widget build(BuildContext context) => Scaffold(+ body: SuperTabView(+ controller: widget.controller,+ onInvite: () {},+ onAddAgent: (_) {},+ onOpenTerminal: (_) {},+ onNewProject: () {},+ machineName: (machineId) => machineId,+ ),+ );+}++final _now = DateTime.now();++ConversationServer _seed() {+ final server = ConversationServer();+ server.state+ ..clear()+ ..addAll({+ 'version': 1,+ 'id': 'tab',+ 'name': 'autonomous.ai',+ 'ownerId': 'ken15',+ 'paused': false,+ 'people': [+ for (final (id, role) in [+ ('ken15', 'owner'),+ ('diego', 'collaborator'),+ ('dee', 'collaborator'),+ ('tony', 'collaborator'),+ ('scholes', 'collaborator'),+ ('phamngochuy.1989', 'collaborator'),+ ])+ {'id': id, 'email': '[email protected]', 'role': role},+ ],+ 'agents': [+ _agent('river', 'River', 'studio', role: 'lead'),+ _agent('nico', 'Nico', 'studio'),+ _agent('theo', 'Theo', 'm9'),+ _agent('iris', 'Iris', 'studio', model: 'claude-sonnet-5-5'),+ for (final name in [+ 'Atlas',+ 'Sage',+ 'Nova',+ 'Finn',+ 'Juno',+ 'Lark',+ 'Moss',+ 'Teal',+ 'Wren',+ 'Echo',+ ])+ _agent(name.toLowerCase(), name, 'studio'),+ ],+ 'machines': [+ _machine('studio', 'MACs-Mac-Studio', 'ken15'),+ _machine('m9', 'MacBooks-MacBook-Pro-9', 'scholes'),+ ],+ 'invitations': <Object>[],+ 'projects': [+ {+ 'id': 'oh',+ 'name': 'openharness',+ 'ownerId': 'ken15',+ 'leadConversationId': 'lead',+ 'visibility': 'public',+ 'members': <Object>[],+ 'updateMinutes': 30,+ },+ ],+ 'conversations': [+ _conversation('lead', 'openharness', lead: 'river', agent: 'river'),+ _conversation(+ 't-nico',+ 'W1 ships alone or waits?',+ agent: 'nico',+ status: 'needs_human',+ ),+ _conversation('t-theo', 'Windows credential fix', agent: 'theo'),+ _conversation('t-iris', 'Activity read fix', agent: 'iris'),+ ],+ });+ server.revision = 200;+ server.leaderboard = {+ 'projectId': 'oh',+ 'week': DateTime.utc(2026, 10, 26).millisecondsSinceEpoch,+ 'period': {'name': '7d', 'start': 1, 'end': 2},+ 'allProjects': true,+ 'people': [+ {+ ..._score('ken15', 424, 1, 111, 40, 411),+ 'prevWeekPoints': 380,+ 'details': {+ 'shipped': [+ {+ 'title': 'Closed agents leave the list',+ 'prUrl': 'https://github.com/autonomous-ai/openharness/pull/2601',+ },+ {+ 'title': 'Prod DB profile: five slow reads',+ 'prUrl': 'https://github.com/autonomous-ai/openharness/pull/2610',+ },+ ],+ 'unblocked': [+ {+ 'title': 'W1 ships alone or waits?',+ 'conversationId': 't-nico',+ 'kind': 'decision',+ 'waitedMinutes': 42,+ },+ ],+ 'lent': [+ {'machineName': 'MACs-Mac-Studio.local', 'busyHours': 411},+ ],+ },+ },+ _score('diego', 394, 2, 98, 31, 260),+ _score('dee', 339, 3, 87, 22, 120),+ _score('tony', 239, 4, 54, 19, 88),+ _score('scholes', 210, 5, 49, 12, 140),+ _score('phamngochuy.1989', 48, 6, 9, 4, 36),+ ],+ 'waiting': {'total': 0, 'people': <Object>[]},+ };+ var sequence = 1;+ void say(String author, String text, Duration ago, {bool agent = false}) =>+ server.messages.add({+ 'id': 'lead-$sequence',+ 'conversationId': 'lead',+ 'sequence': sequence++,+ 'text': text,+ 'author': agent+ ? {'kind': 'agent', 'id': author, 'name': author}+ : {'kind': 'person', 'id': author, 'name': '[email protected]'},+ 'source': const <String, Object>{},+ 'attachments': const <Object>[],+ 'deliveries': const <Object>[],+ 'createdAt': _now.subtract(ago).toIso8601String(),+ });+ say(+ 'ken15',+ 'Prod DB profile: five slow reads to fix.',+ const Duration(hours: 2),+ );+ say(+ 'river',+ 'Three fixes are on main.',+ const Duration(minutes: 32),+ agent: true,+ );+ say('dee', "ok i like a. let's make it perfect.", const Duration(minutes: 1));+ return server;+}++Map<String, dynamic> _agent(+ String id,+ String name,+ String machineId, {+ String? role,+ String model = 'claude-opus-5-5',+}) => {+ 'id': id,+ 'projectId': 'oh',+ 'name': name,+ 'displayName': name,+ 'machineId': machineId,+ 'harnessId': 'h-$id',+ 'contributorId': 'ken15',+ 'role': ?role,+ 'configuration': {'engine': 'claude', 'model': model, 'effort': 'high'},+};++Map<String, dynamic> _machine(String id, String name, String owner) => {+ 'machineId': id,+ 'name': name,+ 'contributorId': owner,+ 'engines': ['claude', 'codex'],+ 'paused': false,+ 'observation': {'receivedAt': _now.millisecondsSinceEpoch},+};++Map<String, dynamic> _conversation(+ String id,+ String title, {+ required String agent,+ String? lead,+ String status = 'working',+}) => {+ 'id': id,+ 'projectId': 'oh',+ 'title': title,+ 'leadId': lead ?? 'river',+ 'agentIds': [agent],+ 'archived': false,+ 'brief': title,+ 'checks': <Object>[],+ 'assignment': {+ 'id': 'a-$id',+ 'agentId': agent,+ 'status': status,+ 'progressAt': _now+ .subtract(const Duration(minutes: 6))+ .millisecondsSinceEpoch,+ // Held: its own last post vouches for it until then.+ 'leaseUntil': _now.add(const Duration(hours: 2)).millisecondsSinceEpoch,+ },+ 'lastMessageSequence': id == 'lead' ? 3 : 0,+};++Map<String, dynamic> _score(+ String id,+ int points,+ int rank,+ int shipped,+ int unblocked,+ int hours,+) => {+ 'personId': id,+ 'points': points,+ 'rank': rank,+ 'medal': null,+ 'shipped': {'count': shipped, 'medianAskToShipMs': 7200000},+ 'unblocked': {'count': unblocked, 'agentMs': 0, 'medianAnswerMs': 600000},+ 'lent': {'machines': 1, 'agentMs': hours * 3600000},+ 'streakDays': 3,+};diff --git a/desktop/tool/web_ux/flows/states.mjs b/desktop/tool/web_ux/flows/states.mjsindex c939a94d6..9f11460cb 100644--- a/desktop/tool/web_ux/flows/states.mjs+++ b/desktop/tool/web_ux/flows/states.mjs@@ -24,7 +24,7 @@ export const FLOWS = [superTab('super-tab-viewer', 'viewer'),superTab('super-tab-offline', 'offline'),// People stay in a phone's header bar: one tap, as on a computer.- superTab('super-tab-roster', 'rich', { steps: [['click', 'Members and machines']] }),+ superTab('super-tab-roster', 'rich', { steps: [['click', 'Members']] }),superTab('super-tab-conversations', 'rich', { only: 'compact', steps: [['click', 'Conversations']] }),// On a phone these views are in the header's ⋮ menu, by name.superTab('super-tab-terminals', 'rich', {diff --git a/docs/naming-system.md b/docs/naming-system.mdindex 40a604de3..eb9b8bf22 100644--- a/docs/naming-system.md+++ b/docs/naming-system.md@@ -128,17 +128,20 @@ There is no **Chat with PM** any more.current Swarm, preserving project drafts and the selected workgroup. Ordinary tabs retaintheir standalone Devices view. The navigation, conversation and people panes havedraggable dividers; their default side widths are 300 and 280 pixels, respecting saved resizes.-The right pane is a stable directory of all humans and agents in the current Swarm that the-viewer can access. Selecting a project, workgroup or Devices does not filter that directory;-local machine inventory does not add people or agents to it.-The members pane has two sections, **Humans** and **Agents**: two roles in one team. **Humans**-is the section heading and the label for the human role; ordinary prose still says *people*.-Humans are listed by the selected week's points, highest first; equal points and no points-by name. Agents are listed most urgent first, by the tabs' status marks.-Agents have individual display names and the same avatar treatment as people. Their role badges-are **PM**, **Dev** and **Rev**. The name, role badge and compact project tag share the first line;-the existing status icon and activity or assigned task appear underneath. Shortened names and-tags retain their full text on hover. Reuse observed status and assignment data; do not generate+The right column, **Members**, opens only from the chat header's **Members** button and is closed+at rest. It lists the people and agents in the current Swarm that the viewer can access; its+heading is the choice of **This project** or **All projects**, beside its close. Local machine+inventory does not add people or agents to it.+It has two sections, **People** and **Agents**: two roles in one team. Every row is one line.+People show their username, the crown for the week's top name, and their points (rolling 7 days,+the period on hover), highest first; equal points and no points by name. Agents show their+display name, one state word (**waiting**, **working**, **in review**, **idle**, …) and the tabs'+status mark, most urgent first: waiting on a person, then working; agents holding no task that+are idle, stopped or offline fold under **Idle (N)**. Agents have the same avatar treatment as+people. Role, task, model, effort and machine are on the agent's card and its hover; a click+opens the card (task, model · effort · machine, **Open terminal**, **Details…**), and a person's+click opens theirs (points, shipped · unblocked · hours, **Manage people**). Role badges on the+card are **PM**, **Dev** and **Rev**. Reuse observed status and assignment data; do not generateactivity summaries or infer a work timer from the session's age. Engine names belong in details.Chat headings and quoted replies use the same current agent identity as the roster, includingolder messages. When an agent has left, its recorded author name remains available in history.diff --git a/docs/plans/2026-11-02-project-chat-coordinator-only-plan.md b/docs/plans/2026-11-02-project-chat-coordinator-only-plan.mdnew file mode 100644index 000000000..0397878f5--- /dev/null+++ b/docs/plans/2026-11-02-project-chat-coordinator-only-plan.md@@ -0,0 +1,123 @@+# Project chat holds only its coordinator, and member changes leave a row — Implementation Plan++> **For agentic workers:** this plan is worked by the project's Engineer, task by task, test first (project instructions,+> Engineer). Steps use checkbox (`- [ ]`) syntax for tracking.++**Goal:** no agent but the coordinator can be added to a project's chat (`leadConversationId`) by any path, Desktop's+terminal on the project chat opens only the coordinator's pane, and every agent added to or removed from a chat leaves a+system row naming who did it.++**Architecture:** one refusal helper in `applyCommand` (backend/src/superTabs/commands.ts), called wherever a command+puts an agent into a group's `agentIds`; one diff after the command's switch that compares each existing group's+members before and after and writes "X added Y." / "X removed Y." rows (new file memberRows.ts). Desktop filters the+project chat's pane agents to its lead in one snapshot method both the pane sync and the terminal count read.++**Tech Stack:** TypeScript, zod, vitest (backend); Dart, Flutter test (desktop).++**Spec:** task #2207 (Ken), brief in its conversation: Goal, Changes, Constraints, Owns, acceptance checks.++## Global Constraints++- The PR body starts with: Requested by [email protected] through Harness.+- Two independent security reviews before merge: Cleo and Orion.+- PR Design lines: audience (the server enforces it), compatibility (a chat that already holds extra agents keeps them+ until removed; Desktop shows only the coordinator), failure (the refusal says why).+- Full backend Super Tab integration suite (`npm run test:super-tabs`) before Ready.+- Swarm code stays out of cli/src/core.++## Review Focus++1. A person (not only an agent) adding a Reviewer to the project chat is refused too: the person path was the open one.+2. Naming the coordinator itself, or setting a new coordinator (`lead: true`), still works on every path.+3. An agent already stored in the project chat stays (no migration), is not re-added after a session restore, and a post+ naming it is not refused.+4. A command that changes no membership writes no row; an agent removed from the Swarm gets only its existing removal+ row, not a second one per group.+5. A Buddy chat's sessions come and go with threads: no member rows there.++---++### Task 1: The project chat takes no agent but its coordinator++**Files:**+- Modify: `backend/src/superTabs/commands.ts` (`conversation.agent`, `agent.add`, `agent.start`, `work.assign`,+ `message.send` recipients)+- Modify: `backend/src/superTabs/closedAgents.ts` (`restoreSessions`: no re-add to a project chat it does not lead)+- Test: `backend/src/superTabs/commands.test.ts`, `backend/src/superTabs/closedAgents.test.ts` if present, else commands.test.ts++**Interfaces:**+- Produces: `PROJECT_CHAT_COORDINATOR_ONLY` (403) with the message+ `The project chat holds only its coordinator among agents, so NAME cannot join it. Its work and announcements go in its task.`+ and, for a post's recipient,+ `The project chat holds only its coordinator among agents: a post here reaches the coordinator. Tell NAME in its task.`++- [ ] **Step 1: Write the failing tests** — `refuses any agent but the coordinator in the project chat, by every path`:+ a Reviewer added by `conversation.agent` (coordinator and person), by `agent.add` of a session already in the Swarm, by an+ `agent.start` whose conversation is the project chat (coordinator and person), by `work.assign` there, and by a post's+ recipients (coordinator) each throw `PROJECT_CHAT_COORDINATOR_ONLY`, and the chat's members are unchanged;+ `conversation.agent` with `lead: true` still sets a coordinator, `conversation.agent` naming the current coordinator+ passes, and an agent already stored there can still be named in a post. A new session a person shares there+ (`agent.add`, lead false: Desktop's New agent in the project chat) joins the project but not the chat, and the chat+ gets a row `"BY added NAME to the project. The project chat holds only its coordinator among agents, so NAME works in+ its tasks."`. The existing tests that start or assign in the project chat move to a task; fixtures that held workers in+ the project chat store them there directly, as older Swarms do.+- [ ] **Step 2: Run** `cd backend && npx vitest run src/superTabs/commands.test.ts -t "project chat"` — FAIL (no such code).+- [ ] **Step 3: Implement** `projectChatJoin(group: Conversation, agentId: string | null, name: string, why: 'post' | 'join')`+ in applyCommand: no-op unless `group` is a project's `leadConversationId`, the agent is its `leadId`, or already a+ member; otherwise fail. Call it before each push named above (start: before the start is recorded, with the request's+ name; `agent.add` and `conversation.agent` skip it for `lead: true`). In `restoreSessions` skip a project chat the+ record does not lead.+- [ ] **Step 4: Run** the same tests, then `npx vitest run src/superTabs` — PASS.+- [ ] **Step 5: Commit** test, then code.++### Task 2: Every agent added to or removed from a chat leaves a row naming who did it++**Files:**+- Create: `backend/src/superTabs/memberRows.ts`+- Modify: `backend/src/superTabs/commands.ts` (call after the switch; `agent.started`'s join row names its starter)+- Test: `backend/src/superTabs/memberRows.test.ts`, `backend/src/superTabs/commands.test.ts`++**Interfaces:**+- Produces: `memberChanges(original: SuperTabState, state: SuperTabState): Array<{ group: Conversation; agent: Agent; added: boolean }>`+ — groups present before and after, not Buddy chats, agents still in `state.agents`.+- Produces: `memberRowText(by: { id: string; name: string } , agent: { id: string; name: string }, added: boolean): string`+ — `"BY added NAME."`, `"BY removed NAME."`, or for the agent itself `"NAME joined."` / `"NAME left."`.+- The row: author the command's sender, `recipients: []`, source `{ kind: 'system' }` (shown to the chat's readers,+ wakes nobody), id `stableId(operationId, 'member', group.id, agent.id)`.+- `agent.started`'s worker row becomes `"STARTER added NAME. Preparing its model."` / `"… Ready for an assignment."`, the+ starter read from the start's `actorKey`; that command writes no diff row.++- [ ] **Step 1: Write the failing tests** — memberRows.test.ts for `memberChanges` (an add, a remove, a new group and+ a removed agent ignored, a Buddy chat ignored) and `memberRowText`; commands.test.ts `leaves a row naming who added or+ removed an agent`: Ken (a person) adds Finn 2 to a task — row `ken added Finn 2.`; River (the coordinator) removes it —+ row `River removed Finn 2.`; both with `recipients: []` and source kind `system`; an assign, a post's recipient and a+ start each leave one row naming their actor; an `agent.remove` writes no member row.+- [ ] **Step 2: Run** `npx vitest run src/superTabs/memberRows.test.ts src/superTabs/commands.test.ts -t "row naming"` — FAIL.+- [ ] **Step 3: Implement** memberRows.ts and the call after the switch (before the credential scrub, so its rows are+ scrubbed and bound like any other); the starter's name in `agent.started`.+- [ ] **Step 4: Run** `npx vitest run src/superTabs` and `npx tsc --noEmit -p .` — PASS.+- [ ] **Step 5: Commit** test, then code.++### Task 3: Desktop opens only the coordinator's pane on the project chat++**Files:**+- Modify: `desktop/lib/super_tabs/model.dart` (snapshot), `desktop/lib/super_tabs/controller.dart` (`terminalAgents`),+ `desktop/lib/super_tabs/view.dart` (`_terminalCount`)+- Test: `desktop/test/super_tab_controller_test.dart`++**Interfaces:**+- Produces: `List<String> SuperTabSnapshot.paneAgentIds(String conversationId)` — the project chat's lead alone when it+ is a member, else nothing; any other group's `agentIds`.++- [ ] **Step 1: Write the failing test** `opens only the coordinator's pane on the project chat, even with older members`:+ a snapshot whose project chat holds the lead and a Reviewer; after `selectGroupTerminals`, `terminalAgents` is the+ lead alone; a task's group still gives both.+- [ ] **Step 2: Run** `cd desktop && flutter test test/super_tab_controller_test.dart --plain-name "coordinator's pane"` — FAIL.+- [ ] **Step 3: Implement** `paneAgentIds` and use it in both places.+- [ ] **Step 4: Run** the controller test file and `flutter analyze lib/super_tabs` — PASS.+- [ ] **Step 5: Commit** test, then code.++### Task 4: Validation++- [ ] `cd backend && npx tsc --noEmit -p . && npx vitest run src/superTabs && npm run test:super-tabs`+- [ ] Red/green evidence (the new tests on main's code, then on the branch) in a PR comment.diff --git a/docs/plans/2026-11-02-quiet-swarm-members-plan.md b/docs/plans/2026-11-02-quiet-swarm-members-plan.mdnew file mode 100644index 000000000..a3e4f47f5--- /dev/null+++ b/docs/plans/2026-11-02-quiet-swarm-members-plan.md@@ -0,0 +1,164 @@+# Quiet Swarm 5/6: Members on demand and member cards Implementation Plan++> **For agentic workers:** this plan follows the project's own way of working (project instructions, Engineer):+> one Engineer implements it task by task, test first, each failing test committed before its code; the pull+> request's Review step is the one independent review. Steps use checkbox (`- [ ]`) syntax for tracking.++**Goal:** The Swarm screen's right column opens only from Members, and lists People and Agents in one line each+(screen 4); a click opens that person's or agent's card (screen 5).++**Architecture:** `SuperTabView` docks the roster only while `_rosterOpen` (wide windows) or shows it as today's+drawer (narrow); the Members button is in the header at every width and the roster's heading carries the+project-or-Swarm choice and a close. `SuperTabRoster` draws one-line rows: People with points and the crown, Agents+with name, status word and mark, ordered by the existing marks and with task-free idle, stopped or offline agents+folded under a collapsible "Idle (N)" heading. Cards are `SuperTabDetailDialog`s: the agent card in+`agent_details.dart` beside today's full details (which stay behind "Details…"), the person card in `roster.dart`+built from `leaderboard/person_row.dart` pieces.++**Tech Stack:** Flutter (Dart 3.13), `flutter_test` widget tests over the in-memory `ConversationServer` fixture+(`test/support/super_tab_fixture.dart`), the browser review fixture `tool/super_tab_mobile_fixture.dart` for+screenshots.++**Spec:** [docs/plans/2026-11-02-quiet-swarm-design.md](2026-11-02-quiet-swarm-design.md), screens 4 and 5, Rules,+"What moves where" rows Humans column / Agents column / Invite, and Calls made by the PM (Members).++## Global Constraints++- Follow `desktop/design/desktop-design-system.md`: no new colors, icons or controls; one line per row; fewer words.+- "Members rows: name, then status word and mark. Role, model, effort and machine go on the agent's card."+- "People show as their username." "Points: one number per person, rolling 7 days; the period is on hover. The crown+ follows the week's top name."+- "Agents are grouped: waiting on a person first, then working; idle agents fold under "Idle (N)"."+- "The project-or-Swarm choice Dee added today becomes Members' heading."+- Anything the design doesn't draw stays as it is (right-click Details / Remove from Swarm, the + on People and+ Agents, Edit profile, the row hovers). The waiting line under People goes: agents waiting on a person live only in+ Activity's Needs you (Lead, 2026-11-02).+- Desktop tests use a memory store and the fake server; never a test that signs this Mac out of the real CLI.+- Swarm code stays out of `cli/src/core`. No on/off switch: it ships on.+- Stay inside the owned files: `roster.dart`, `roster_scope.dart`, `agent_details.dart`, `leaderboard/person_row.dart`,+ their tests; plus the two touch points the column needs in `view.dart` (`_swarm`'s right side and the header's+ Members button) and the naming system's members paragraph.++## Review Focus++- A thread open in a wide window when Members is pressed: the thread closes and Members takes the right side+ (Slack's way), and Members closes when a thread opens. Test in Task 1.+- An agent with a task whose machine went down (lost work, mark offline) never hides under Idle (N). Test in Task 3.+- No project open (Activity, Devices): the heading reads "All projects" with no choice, and the list is the whole+ Swarm. Test in Task 2.+- A server before rolling periods (weeks only): points still show, with "this week" on hover, and no picker+ appears. Test in Task 2.+- An agent with no model or machine known: the card's second line shows only what is known, and is absent when+ nothing is. Test in Task 4.++---++### Task 1: The right column is closed at rest and opens from Members++**Files:**+- Modify: `desktop/lib/super_tabs/view.dart` (`_swarm`, `_header`'s Members button, `_toggleRoster`)+- Modify: `desktop/lib/super_tabs/roster.dart` (new `onClose`)+- Test: `desktop/test/super_tab_members_test.dart` (new)++**Interfaces:**+- Produces: `SuperTabRoster({..., VoidCallback? onClose})`; the close button `ValueKey('super-members-close')`;+ the header button keeps `AppIcons.users`, tooltip `Members`, `ValueKey('super-members-button')`.++- [ ] **Step 1: Write the failing tests** — `'the right column is closed at rest in a wide window'` (1440 wide:+ `find.byType(SuperTabRoster)` finds nothing); `'Members opens the column and its close shuts it'`;+ `'Members takes the right side from an open thread'`.+- [ ] **Step 2: Run** `flutter test test/super_tab_members_test.dart` — expected FAIL (roster docked at rest).+- [ ] **Step 3: Implement** — dock the roster when wide and `_rosterOpen`; the Members button shows at every width;+ opening it closes an open thread; opening a thread closes it.+- [ ] **Step 4: Run** the new file and `test/super_tab_view_test.dart` — PASS.+- [ ] **Step 5: Commit** test, then code.++### Task 2: The heading is the scope choice; People rows are one line++**Files:**+- Modify: `desktop/lib/super_tabs/roster.dart` (`_members` heading and people), `roster_scope.dart` (labels)+- Modify: `desktop/lib/super_tabs/leaderboard/person_row.dart` (`LeaderboardPersonRow`: one line)+- Test: `desktop/test/super_tab_members_test.dart`, `super_tab_humans_test.dart`, `super_tab_roster_scope_test.dart`++**Interfaces:**+- Produces: heading `AppSelectField<SuperTabRosterScope>` `ValueKey('roster-scope')` with labels+ `This project` / `All projects` (`superTabRosterScopeLabel(SuperTabRosterScope) -> String` in `roster_scope.dart`);+ section headings `People` and `Agents`; `LeaderboardPersonRow` no longer takes `weekName`-driven detail lines:+ avatar, name + crown, points; points' tooltip `Points in the last 7 days` (the board's `spanName`).++- [ ] **Step 1: Write the failing tests** — `'the heading is the project-or-Swarm choice'`+ (labels `This project`, `All projects`; no `leaderboard-period`/`leaderboard-week`);+ `'no open project reads All projects with no choice'`; `'a person row is one line: name, crown, points'`+ (no `leaderboard-meta-*`, points tooltip says the period); `'a weeks-only server shows points with this week on+ hover'`.+- [ ] **Step 2: Run** — FAIL.+- [ ] **Step 3: Implement.** The period picker goes; the board stays on `leaderboardDefaultPeriod` ('7d').+- [ ] **Step 4: Run** the three files — PASS; update older tests that pinned the Humans heading, the week picker+ and the numbers line to the new screen.+- [ ] **Step 5: Commit** test, then code.++### Task 3: Agent rows are one line; idle agents fold under Idle (N)++**Files:**+- Modify: `desktop/lib/super_tabs/roster.dart` (`_agent`, `_members` agents)+- Test: `desktop/test/super_tab_members_test.dart`, `super_tab_roster_test.dart`++**Interfaces:**+- Produces: row `ValueKey('super-member-<id>')` with avatar, name, status word `ValueKey('super-member-word-<id>')`+ (the glance label with its first letter lower-cased: `waiting`, `working`, `idle`, `limited until 09:05`) and+ `ActivityMark` `ValueKey('super-member-mark-<id>')`; fold heading `SuperTabSectionHeading('Idle (N)')` with+ `onToggleCollapsed`, `ValueKey('super-members-idle')`, folded by default, kept for the visit.+ `superTabFoldsIdle(SuperTabAgentState) -> bool`: no task and mark idle, paused or offline.++- [ ] **Step 1: Write the failing tests** — `'an agent row is name, status word and mark'` (no role chip, no model,+ no `super-member-line-*`); `'waiting agents come first, then working'`; `'idle agents fold under Idle (N)'`+ (count, hidden until the heading is pressed); `'an agent with lost work stays above the fold'`;+ `'a click opens the agent card'`.+- [ ] **Step 2: Run** — FAIL.+- [ ] **Step 3: Implement.** Tap and long press open the card (Task 4); right-click keeps Details and Remove from+ Swarm; the hover keeps today's tooltip.+- [ ] **Step 4: Run** — PASS; update older row tests (detail line, model after the chip, tap opens the task).+- [ ] **Step 5: Commit** test, then code.++### Task 4: The agent card and the person card++**Files:**+- Modify: `desktop/lib/super_tabs/agent_details.dart` (new `showSuperTabAgentCard`)+- Modify: `desktop/lib/super_tabs/roster.dart` (`_person` becomes the person card)+- Modify: `desktop/lib/super_tabs/leaderboard/person_row.dart` (`LeaderboardPersonWeek` without its points line on+ the card)+- Test: `desktop/test/super_tab_members_test.dart`, `super_tab_humans_test.dart`++**Interfaces:**+- Produces: `Future<void> showSuperTabAgentCard(BuildContext, SuperTabController, AppNotifier?, SuperTabAgent,+ {required ValueChanged<SuperTabAgent> onOpenAgent, required ValueChanged<String> onOpenTask})`: a+ `SuperTabDetailDialog` titled with the agent's name, its role badge at the header's right, then the task title+ (a link that opens the task, `ValueKey('super-card-task')`), then `model · effort · machine`+ (`ValueKey('super-card-run')`, only what is known), and `Open terminal` (leading) and `Details…` (which opens+ `showSuperTabAgentDetails`).+ Person card: title `username` with the crown, `N points` at the header's right (period on hover), detail line+ `N shipped · N unblocked · N hours` (`ValueKey('super-card-numbers')`), the week's lists below as today, and+ `Manage people` (+ `Edit profile` on one's own).++- [ ] **Step 1: Write the failing tests** — `'the agent card shows task, model · effort · machine, Open terminal and+ Details…'`; `'the card's task opens its conversation'`; `'Details… opens the full details'`;+ `'an agent with nothing known shows no run line'`; `'the person card shows points, crown and the three numbers'`.+- [ ] **Step 2: Run** — FAIL.+- [ ] **Step 3: Implement.**+- [ ] **Step 4: Run** — PASS.+- [ ] **Step 5: Commit** test, then code.++### Task 5: Naming, analysis, screenshots++**Files:**+- Modify: `docs/naming-system.md` (the members pane paragraph)+- Modify: `desktop/tool/super_tab_mobile_fixture.dart` (seed: points, waiting/working/idle agents) if the review+ scenario lacks them++- [ ] **Step 1:** Update the naming paragraph: Members opens on demand; People and Agents; one line each; the card.+- [ ] **Step 2: Run** `flutter analyze` on the changed files and the affected suites+ (`super_tab_members_test`, `super_tab_roster_test`, `super_tab_humans_test`, `super_tab_roster_scope_test`,+ `super_tab_view_test`, `super_tab_profile_sheet_test`, `super_tab_heartbeat_widgets_test`,+ `super_tab_phone_header_test`, `super_tab_agent_line_test`) — all PASS.+- [ ] **Step 3:** Build the browser fixture, capture screens 4 and 5 at 1440 in both themes, attach to the PR.+- [ ] **Step 4: Commit.**diff --git a/docs/plans/assets/quiet-swarm-members/4-members-dark.png b/docs/plans/assets/quiet-swarm-members/4-members-dark.pngnew file mode 100644index 000000000..82b430309Binary files /dev/null and b/docs/plans/assets/quiet-swarm-members/4-members-dark.png differdiff --git a/docs/plans/assets/quiet-swarm-members/4-members-idle-open-light.png b/docs/plans/assets/quiet-swarm-members/4-members-idle-open-light.pngnew file mode 100644index 000000000..dd70b5573Binary files /dev/null and b/docs/plans/assets/quiet-swarm-members/4-members-idle-open-light.png differdiff --git a/docs/plans/assets/quiet-swarm-members/5-agent-card-dark.png b/docs/plans/assets/quiet-swarm-members/5-agent-card-dark.pngnew file mode 100644index 000000000..4a6a5f9a9Binary files /dev/null and b/docs/plans/assets/quiet-swarm-members/5-agent-card-dark.png differdiff --git a/docs/plans/assets/quiet-swarm-members/5-person-card-light.png b/docs/plans/assets/quiet-swarm-members/5-person-card-light.pngnew file mode 100644index 000000000..06deb5e8dBinary files /dev/null and b/docs/plans/assets/quiet-swarm-members/5-person-card-light.png differdiff --git a/scripts/ui-style-allowlist/desktop.json b/scripts/ui-style-allowlist/desktop.jsonindex a20e07d09..9a3e4710c 100644--- a/scripts/ui-style-allowlist/desktop.json+++ b/scripts/ui-style-allowlist/desktop.json@@ -60,8 +60,7 @@"edge-insets": 3},"desktop/lib/super_tabs/roster.dart": {- "edge-insets": 2,- "border-radius": 1+ "edge-insets": 1},"desktop/lib/super_tabs/route_row.dart": {"edge-insets": 3