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-05 i1830: #3081 #3163 (#3170)
0xken15727bbe5eab70
diff --git a/backend/integration/superTabMachineNames.test.ts b/backend/integration/superTabMachineNames.test.tsindex 368d71324..b95f8ea5e 100644--- a/backend/integration/superTabMachineNames.test.ts+++ b/backend/integration/superTabMachineNames.test.ts@@ -136,12 +136,12 @@ describe('a rename after joining', () => {const tab = await swarm()await contribute(tab, 'studio-2', 'Macs-Mac-Studio-2')await contribute(tab, 'studio-2-team', 'Macs-Mac-Studio-2 · Team', dee, { ifMissing: true, maxAgents: 1 })- expect(await nameIn(tab, 'studio-2-team')).toBe('Macs-Mac-Studio-2.local')+ expect(await nameIn(tab, 'studio-2-team')).toBe('Macs-Mac-Studio-2.local · Team account')await rename('studio-2', 'Mac 3')await report(tab, 'studio-2')- expect(await nameIn(tab, 'studio-2-team')).toBe('Mac 3')+ expect(await nameIn(tab, 'studio-2-team')).toBe('Mac 3 · Team account')await report(tab, 'studio-2-team', deeTeam)- expect(await nameIn(tab, 'studio-2-team')).toBe('Mac 3')+ expect(await nameIn(tab, 'studio-2-team')).toBe('Mac 3 · Team account')})it('keeps the Swarm\'s name when its owner clears it back to none', async () => {@@ -170,7 +170,7 @@ describe('a rename in Machines', () => {pushes = []await renamed('studio-2')for (const tab of [one, two]) {- expect([await nameIn(tab, 'studio-2', huy), await nameIn(tab, 'studio-2-team'), await nameIn(tab, 'huy-mini')]).toEqual(['Mac 3', 'Mac 3', 'Huy Mini'])+ expect([await nameIn(tab, 'studio-2', huy), await nameIn(tab, 'studio-2-team'), await nameIn(tab, 'huy-mini')]).toEqual(['Mac 3', 'Mac 3 · Team account', 'Huy Mini'])expect(pushes.find(p => p.tabId === tab)).toMatchObject({ userIds: expect.arrayContaining([dee.sub, huy.sub]), parts: expect.arrayContaining(['main']) })}})diff --git a/backend/integration/superTabTeam.test.ts b/backend/integration/superTabTeam.test.tsindex aa5aca7cb..435a0570d 100644--- a/backend/integration/superTabTeam.test.ts+++ b/backend/integration/superTabTeam.test.ts@@ -745,7 +745,7 @@ describe('one machine: a Mac and its Harness Team account', () => {maxAgents: 1, ifMissing: true }, person)expect(await joins()).toEqual([])const listed = (await store.read(owner, tab)).state.machines!.find(m => m.machineId === 'team-mac')!- expect(listed).toMatchObject({ hostMachineId: 'personal-mac', name: 'MacBook Pro', maxAgents: 3, cwd: '/team' })+ expect(listed).toMatchObject({ hostMachineId: 'personal-mac', name: 'MacBook Pro · Team account', maxAgents: 3, cwd: '/team' })const generation = (await poolRows(store, team, 'team-mac')).find(p => p.tabId === tab)!.machine.generationawait store.observeMachine(team, tab, 'team-mac', reading(generation))const group = String((await run(tab, { type: 'conversation.create', projectId: 'lead', title: 'Work', brief: 'Do it',diff --git a/backend/src/superTabs/commands.ts b/backend/src/superTabs/commands.tsindex d41dbb6e8..f8cd4816e 100644--- a/backend/src/superTabs/commands.ts+++ b/backend/src/superTabs/commands.ts@@ -1,6 +1,6 @@import { applyPushOrigin, failPushUnknown, failTeamWritten, hasStep, mainAccountMembers, markTeamWritten, mayName, requireNameable, requireTeamWrittenAccount, requireTeamWrittenMachine, TEAM_WRITTEN_REASON, TEAM_WRITTEN_STOP, teamWrittenTask } from './teamWritten.js'import type { PushOrigin } from '../github/pushOrigin.js'-import { admitByRoom, admitMachineStart, noRepositoryStart, defaultProfileId, storedProfileId, BUDDY_WINDOWS_REFUSAL, refusesWindowsBuddy, buddyHomeFolder, buddyProjectsOn, SWARM_BUDDY_CAPABILITY, cleanupOverdue, dropIdleBuddyMachines, machineLimitReached, MACHINE_LIMIT_MESSAGE, NOT_SWARM_MACHINE, downSince, expireRemoval, expireRemovals, failTeamWork, machineContribution, machineOffline, machineSlots, contributedEngines, ownedMachine, productManagerOn, projectFolder, projectsOnMachine, requireTeamWork, teamMachineFor, teamAccountPool, teamPoolsOf, teamStartRequest, teamWorkCheck, movedToTeamAccount, type ContributedMachine } from './machines.js'+import { admitByRoom, admitMachineStart, noRepositoryStart, failOwnAccountTeamEntry, ownAccountTeamEntry, defaultProfileId, storedProfileId, BUDDY_WINDOWS_REFUSAL, refusesWindowsBuddy, buddyHomeFolder, buddyProjectsOn, SWARM_BUDDY_CAPABILITY, cleanupOverdue, dropIdleBuddyMachines, machineLimitReached, MACHINE_LIMIT_MESSAGE, NOT_SWARM_MACHINE, downSince, expireRemoval, expireRemovals, failTeamWork, machineContribution, machineOffline, machineSlots, contributedEngines, ownedMachine, productManagerOn, projectFolder, projectsOnMachine, requireTeamWork, teamMachineFor, teamAccountPool, teamPoolsOf, teamStartRequest, teamWorkCheck, movedToTeamAccount, type ContributedMachine } from './machines.js'import { movableEntry } from './computerMoves.js'import { agentDisplayName, assignAgentDisplayNames } from './agentNames.js'import { addedAgentName, renameAgentTo } from './agentRename.js'@@ -2531,6 +2531,10 @@ function applyCommandOnce(original: SuperTabState, actor: Actor, input: Command,const startGroup = conversation(state, command.request.conversationId)marking(startGroup, () => applyPushOrigin(state, startGroup, context.pushOrigin))const written = teamWrittenTask(state, startGroup)+ // Named the Team account's entry itself, which its owner's choice keeps teammates' work off (task #3060). A branch GitHub+ // cannot place runs only in a Team account (below), so it counts as Team-written here (security review 2 of #3081).+ const ownEntry = ownAccountTeamEntry(state, named.machineId, home, written || context.pushOrigin === 'unknown')+ if (ownEntry) failOwnAccountTeamEntry(ownEntry)const moved = teamStartRequest(state, named, home, context.teamAccountsIdle, context.teamMachines, written, taskAccess(startGroup))// Moved to the Mac's Team account: the starter is told why in one line (task #2806).if (moved.machineId !== named.machineId) {diff --git a/backend/src/superTabs/leadStart.test.ts b/backend/src/superTabs/leadStart.test.tsindex beefa4551..dbadfed03 100644--- a/backend/src/superTabs/leadStart.test.ts+++ b/backend/src/superTabs/leadStart.test.ts@@ -119,6 +119,14 @@ describe('starting a project\'s Product Manager on a Swarm machine', () => {expect(f.lead('mate-mac').result).toMatchObject({ machineId: 'mate-mac' })})+ // Task #3060: a start naming the Team account entry itself is refused there too, pointing at the Mac.+ it('named in a Team account itself whose Mac\'s owner runs teammates\' work in their own account, is refused, pointing at the Mac', () => {+ const f = swarm()+ f.run({ type: 'machine.ownAccountWork', machineId: 'mate-mac', allowed: true } as Command, mate)+ expect(refusal(() => f.lead('mate-team'))).toMatchObject({ code: 'OWN_ACCOUNT_WORK', message: expect.stringContaining('mate-mac') })+ expect(f.state.starts ?? []).toEqual([])+ })+it('on a teammate\'s Mac with no Team account, runs on the Mac itself, whatever the Swarm\'s switch says for workers', () => {process.env.SWARM_TEAM_ACCOUNT_REQUIRED = '1'const f = swarm()diff --git a/backend/src/superTabs/leadStart.ts b/backend/src/superTabs/leadStart.tsindex 938219c02..e0663255e 100644--- a/backend/src/superTabs/leadStart.ts+++ b/backend/src/superTabs/leadStart.ts@@ -5,7 +5,7 @@* names the machine: only they know which one stays on (Ken, 10-29). Desktop's own-machine flow (project.create, a local* start, agent.add) is unchanged. */import { admitMachineStart, contributedEngines, failTeamWork, machineContribution, projectFolder, projectsOnMachine, teamAccountPool, teamPoolOf,- noRepositoryStart, slotCounter, teamWorkRefusal, ownAccountWork, type ContributedMachine } from './machines.js'+ noRepositoryStart, slotCounter, teamWorkRefusal, ownAccountWork, ownAccountTeamEntry, failOwnAccountTeamEntry, type ContributedMachine } from './machines.js'import { actorKey, fail, person, SuperTabError, type AgentStart, type AgentStartRequest, type Conversation, type Person, type SuperTabState } from './model.js'import { BUILT_IN_ROLE_DEFAULTS, ownsProject, projectsOf, type SwarmProject } from './projects.js'import { failureNotice, publicReason } from './startFailure.js'@@ -100,6 +100,9 @@ export function leadHost(state: SuperTabState, project: SwarmProject, machineId:let candidates: ContributedMachine[]if (ownsProject(state, named.contributorId, project)) candidates = [named]else if (teamAccountPool(named)) {+ // Its Mac's owner runs teammates' work in their own account: the Mac, not this entry (machines.ts ownAccountTeamEntry, #3060).+ const mac = ownAccountTeamEntry(state, named.machineId, project, false)+ if (mac) failOwnAccountTeamEntry(mac)if (!teamsWork) fail('TEAM_ACCOUNT_REQUIRED', `Harness Team accounts take no work in this Swarm yet, so ${named.name} runs only its owner's projects.`, 403)const why = refusal(named)if (why) failTeamWork(why)diff --git a/backend/src/superTabs/machines.ts b/backend/src/superTabs/machines.tsindex 4547fd76b..e5378172e 100644--- a/backend/src/superTabs/machines.ts+++ b/backend/src/superTabs/machines.ts@@ -543,6 +543,25 @@ export function teamMachineFor(state: SuperTabState, machineId: string, project:return teamPoolOf(state, pool, live)?.machineId ?? machineId}+/** The Mac's own entry when [machineId] is its Harness Team account's and its owner lets teammates' work run in their own+ * account there (ownAccountWork), for a teammate's [project] whose code no Team agent wrote; else undefined. Such a start+ * belongs on the Mac, not the Team account it named (task #3060: a lamp start named Gray's Team entry, both entries named+ * 'Gray.local', and was placed there as named). */+export function ownAccountTeamEntry(state: SuperTabState, machineId: string, project: SwarmProject, teamWritten: boolean): ContributedMachine | undefined {+ if (teamWritten) return undefined+ const team = state.machines?.find(m => m.machineId === machineId)+ if (!team?.hostMachineId || team.contributorId === project.ownerId) return undefined+ const mac = state.machines?.find(m => m.machineId === team.hostMachineId && m.contributorId === team.contributorId && !m.removal)+ return ownAccountWork(mac) ? mac : undefined+}++/** Refuses a start that names a Team account's entry its owner's choice keeps teammates' work off (ownAccountTeamEntry), with+ * the Mac's own entry to start on. Refused, not moved: a move would put the work in a person's own account, with their files+ * and sign-ins, when the start named the isolated one; the starter picks the Mac knowingly, as its route row says. */+export function failOwnAccountTeamEntry(mac: ContributedMachine): never {+ fail('OWN_ACCOUNT_WORK', `${mac.name}'s owner runs teammates' work in their own account in this Swarm, so its Harness Team account takes only work a Harness Team agent wrote. Start on ${mac.name} itself (machine ${mac.machineId}).`, 409)+}+/** The folder a start for [project] uses on [pool]: what admitMachineStart accepts there. */export function projectFolder(pool: ContributedMachine, project: SwarmProject): string {return pool.scope === 'swarm'diff --git a/backend/src/superTabs/model.ts b/backend/src/superTabs/model.tsindex 6dbbd00ee..1fee60db4 100644--- a/backend/src/superTabs/model.ts+++ b/backend/src/superTabs/model.ts@@ -920,6 +920,11 @@ export function createSuperTab(id: string, name: string, owner: { id: string; em}/** Pending invitations are management data, not part of the shared conversation. */+/** What every read appends to a Mac's Harness Team account entry's name (task #3060). */+export const TEAM_ENTRY_LABEL = ' · Team account'+/** A Team account entry's name as people read it: its Mac's, then TEAM_ENTRY_LABEL, once. */+export const teamEntryName = (name: string): string => name.endsWith(TEAM_ENTRY_LABEL) ? name : `${name}${TEAM_ENTRY_LABEL}`+export function visibleState(state: SuperTabState, actor: Actor, now = Date.now()): SuperTabState {author(state, actor)// The copy leaves out what no reader gets and no step below reads: the owner-only sharing, the hosts' slot claims, released@@ -951,6 +956,10 @@ export function visibleState(state: SuperTabState, actor: Actor, now = Date.now(}// Rows by day and project that only the leaderboard read uses, and it takes them from the Swarm itself.for (const pool of visible.machines ?? []) delete pool.lentDays+ // A Mac's Harness Team account is stored under its Mac's name (machines.ts followAccountName), and read so it named two+ // entries alike: a lamp start picked the Team account's thinking it was the Mac (task #3060). Every read tells them apart;+ // the stored name, which renames and the server's own sentences read, stays the Mac's.+ for (const pool of visible.machines ?? []) if (pool.hostMachineId) pool.name = teamEntryName(pool.name)// A machine kept for some projects names to each reader only those they may read (machines.ts projects): a private// project's id is not another member's to see.for (const pool of visible.machines ?? []) {diff --git a/backend/src/superTabs/ownAccountWork.test.ts b/backend/src/superTabs/ownAccountWork.test.tsindex 72afed39f..b627ffbb1 100644--- a/backend/src/superTabs/ownAccountWork.test.ts+++ b/backend/src/superTabs/ownAccountWork.test.ts@@ -1,7 +1,7 @@import { afterEach, beforeEach, describe, expect, it } from 'vitest'import { applyCommand, commandSchema, type Command, type CommandContext } from './commands.js'import { machineTeamWork, teamWorkRefusal, type ContributedMachine, type MachinePrivacy } from './machines.js'-import { createSuperTab, SuperTabError, type Actor, type AgentConfiguration, type SuperTabState } from './model.js'+import { createSuperTab, SuperTabError, visibleState, type Actor, type AgentConfiguration, type SuperTabState } from './model.js'// Task #2806 (Scholes, 11-04): a Mac added as its person joined runs teammates' work only in its Harness Team account// (teamAccountOnly). The lampOS mobile team needs it in the owner's own account on Gray's Mac (Flutter and the phone signing@@ -243,3 +243,82 @@ describe('teammates\' work in a Mac owner\'s own account', () => {expect(moved.result.moved).toContain('in this Swarm\'s Manage > Machines')})})++// Task #3060 (Scholes, 11-05): on 11-04 a lamp start named Gray's Team account entry itself, not the Mac, after Gray had+// turned own-account work on. Both entries were named 'Gray.local', and the server placed it as named, with no note. A+// start that names the Team entry for a teammate's work no Team agent wrote is refused, with a pointer to the Mac's own+// entry: moving it would put the work in a person's own account when the start named the isolated one.+describe('a start that names a Mac\'s Team account entry while its owner runs teammates\' work in their own account', () => {+ const startOnTeam = (f: ReturnType<typeof swarm>, group: string, actor: Actor = f.leadActor, projectId = 'lead') =>+ f.run({ type: 'agent.start', request: { ...f.request(group, 'gray-team', projectId), cwd: `/team-swarm/${projectId}` } }, actor, f.joined)++ it('is refused for a teammate\'s task, pointing at the Mac\'s own entry, and nothing starts', () => {+ const f = swarm()+ f.choose(true)+ const result = refusal(() => startOnTeam(f, f.group()))+ expect(result?.code).toBe('OWN_ACCOUNT_WORK')+ expect(result?.message).toContain('Gray\'s Mac')+ expect(result?.message).toContain('gray-mac')+ expect(f.state.starts ?? []).toHaveLength(0)+ })++ it('is refused for a person\'s start too', () => {+ const f = swarm()+ f.choose(true)+ expect(refusal(() => startOnTeam(f, f.group(), owner))?.code).toBe('OWN_ACCOUNT_WORK')+ })++ it('still starts work a Team agent wrote in the Team account', () => {+ const f = swarm()+ f.choose(true)+ const group = f.group()+ Object.assign(f.state.conversations.find(c => c.id === group)!, { teamWritten: true })+ startOnTeam(f, group)+ expect(f.state.starts!.at(-1)!.request).toMatchObject({ machineId: 'gray-team', cwd: '/team-swarm/lead' })+ })++ // Security review 2 of #3081: a branch GitHub cannot place runs only in a Team account (commands.ts failPushUnknown), so it+ // is not sent to the Mac, which would refuse it in turn.+ it('still starts work whose push GitHub cannot place in the Team account, as Team-written work', () => {+ const f = swarm()+ f.choose(true)+ f.run({ type: 'agent.start', request: { ...f.request(f.group(), 'gray-team'), cwd: '/team-swarm/lead' } }, f.leadActor, { ...f.joined, pushOrigin: 'unknown' })+ expect(f.state.starts!.at(-1)!.request).toMatchObject({ machineId: 'gray-team', cwd: '/team-swarm/lead' })+ })++ it('starts there as before when its owner has not turned own-account work on, or turned it off', () => {+ const f = swarm()+ startOnTeam(f, f.group())+ expect(f.state.starts!.at(-1)!.request).toMatchObject({ machineId: 'gray-team' })+ f.choose(true)+ f.choose(false)+ startOnTeam(f, f.group())+ expect(f.state.starts!.at(-1)!.request).toMatchObject({ machineId: 'gray-team' })+ })++ it('leaves a choice recorded by someone other than the owner unread, as ownAccountWork does', () => {+ const f = swarm()+ f.machine('gray-mac').ownAccountChoice = { allowed: true, by: 'mate', at: new Date(NOW).toISOString() }+ startOnTeam(f, f.group())+ expect(f.state.starts!.at(-1)!.request).toMatchObject({ machineId: 'gray-team' })+ })+})++// Task #3060: both of Gray's entries were named 'Gray.local', so whoever picked one could not tell the Team account from the Mac.+describe('a Mac\'s Team account entry, as every read shows it', () => {+ it('goes by its Mac\'s name and "· Team account", while the Mac keeps its own name', () => {+ const f = swarm()+ const shown = (actor: Actor) => Object.fromEntries((visibleState(f.state, actor, NOW).machines ?? []).map(m => [m.machineId, m.name]))+ for (const reader of [owner, gray, mate, f.leadActor]) {+ expect(shown(reader)['gray-team']).toBe('Gray\'s Mac · Team account')+ expect(shown(reader)['gray-mac']).toBe('Gray\'s Mac')+ expect(shown(reader)['owner-mac']).toBe('Owner Mac')+ }+ })++ it('keeps the stored name its Mac\'s, which renames and the server\'s own sentences read', () => {+ const f = swarm()+ visibleState(f.state, owner, NOW)+ expect(f.machine('gray-team').name).toBe('Gray\'s Mac')+ })+})diff --git a/cli/src/superTabs/routeCommand.spec.ts b/cli/src/superTabs/routeCommand.spec.tsindex 6b3c0e84b..0dfc97f92 100644--- a/cli/src/superTabs/routeCommand.spec.ts+++ b/cli/src/superTabs/routeCommand.spec.ts@@ -1683,8 +1683,8 @@ describe('routing contributed capacity', () => {teamWork: { allowed: false, code: 'TEAM_ACCOUNT_REQUIRED', reason: NO_ACCOUNT } })const team = () => ({ ...healthy(), machineId: 'm1-team', hostMachineId: 'm1', name: 'MacBook Pro', scope: 'swarm', cwd: '/team/swarm', contributorId: 'mate',teamWork: { allowed: true } })- async function route(ownerId: string, machines: Record<string, unknown>[] = [mac(), team()]) {- const s = scoped({ context: { ok: true, value: { agentId: 'lead', tab: { state: { id: 'tab', agents: [], conversations: conversations(), machines,+ async function route(ownerId: string, machines: Record<string, unknown>[] = [mac(), team()], groups: Record<string, unknown>[] = conversations()) {+ const s = scoped({ context: { ok: true, value: { agentId: 'lead', tab: { state: { id: 'tab', agents: [], conversations: groups, machines,projects: [{ id: 'lead', ownerId, repository: { repositoryUrl: 'https://github.com/example/project' } }] } },policy: { policy, warnings: [] }, machines: [] } } })const answer = await routeTask(input, s, where, opener())@@ -1716,6 +1716,56 @@ describe('routing contributed capacity', () => {expect(excluded.some(e => e.reason === NO_ACCOUNT)).toBe(false)})+ // Task #3060 (Scholes, 11-05): the Mac's owner turned on own-account work (backend machines.ts ownAccountWork), and a lamp+ // start still went to their Team account. A teammate's work no Team agent wrote is offered on the Mac itself; work a Team+ // agent wrote stays in the Team account.+ describe('when the Mac\'s owner runs teammates\' work in their own account', () => {+ const said = 'MacBook Pro runs teammates\' work in Mate\'s own account.'+ const ownAccountMac = () => ({ ...mac(), teamWork: { allowed: true, ownAccount: said } })+ const newOn = (candidates: Array<{ machineId: string; kind: string }>) => candidates.filter(c => c.kind === 'new').map(c => c.machineId)++ it('offers the Mac\'s own entry for a teammate\'s task, never its Team account entry', async () => {+ const { answer, candidates } = await route('owner', [ownAccountMac(), team()])+ expect(answer).toMatchObject({ ok: true })+ expect(newOn(candidates)).toContain('m1')+ expect(newOn(candidates)).not.toContain('m1-team')+ expect(JSON.stringify(answer.candidates)).not.toContain('"cwd":"/team/swarm/lead"')+ })++ it('still offers the Team account entry, and not the Mac, for a task a Team agent wrote', async () => {+ const written = conversations().map(c => c.id === 'g1' ? { ...c, teamWritten: true } : c)+ const { candidates } = await route('owner', [ownAccountMac(), team()], written)+ expect(newOn(candidates)).toContain('m1-team')+ expect(newOn(candidates)).not.toContain('m1')+ })++ it('reads a step of a Team-written task as Team-written too', async () => {+ const groups = [...conversations().map(c => c.id === 'g1' ? { ...c, id: 'task', teamWritten: true } : c),+ { id: 'g1', title: 'Review', leadId: 'lead', agentIds: ['lead'], archived: false, brief: 'Review it.', checks: [], assignment: null, reviewOf: 'task' }]+ const { candidates } = await route('owner', [ownAccountMac(), team()], groups)+ expect(newOn(candidates)).toContain('m1-team')+ expect(newOn(candidates)).not.toContain('m1')+ })++ it('reads a task from before the mark, assigned to an agent in a Team account, as Team-written, as the backend does', async () => {+ const assigned = conversations({ agentId: 'tw', status: 'working' })+ const s = scoped({ context: { ok: true, value: { agentId: 'lead', tab: { state: { id: 'tab', conversations: assigned, machines: [ownAccountMac(), team()],+ agents: [{ id: 'tw', name: 'Writer', machineId: 'm9', harnessId: 'htw', teamAccount: true, configuration: { engine: 'claude', model: 'opus', effort: 'high' } }],+ projects: [{ id: 'lead', ownerId: 'owner', repository: { repositoryUrl: 'https://github.com/example/project' } }] } },+ policy: { policy, warnings: [] }, machines: [] } } })+ await routeTask(input, s, where, opener())+ const candidates = (recorded(s).command.decision.candidates ?? []) as Array<{ machineId: string; kind: string }>+ expect(newOn(candidates)).toContain('m1-team')+ expect(newOn(candidates)).not.toContain('m1')+ })++ it('keeps the Mac\'s owner\'s own project on the Mac', async () => {+ const { candidates } = await route('mate', [ownAccountMac(), team()])+ expect(newOn(candidates)).toContain('m1')+ expect(newOn(candidates)).not.toContain('m1-team')+ })+ })+it('offers a team account whose Mac is not in the Swarm as itself, folded into nothing', async () => {// Probed for new agents under its own name, not left out as folded.const { candidates } = await route('owner', [{ ...team(), hostMachineId: 'm-elsewhere' }])diff --git a/cli/src/superTabs/routeCommand.ts b/cli/src/superTabs/routeCommand.tsindex 386ab0f59..71e58197a 100644--- a/cli/src/superTabs/routeCommand.ts+++ b/cli/src/superTabs/routeCommand.ts@@ -419,11 +419,22 @@ export async function routeTask(input: { tabId: string; conversationId: string;// One machine (docs/plans/2026-10-24-swarm-team-account.md): a Mac's Harness Team account is that Mac, under its name. A// teammate's project starts only in the team account and the Mac's owner's own projects only with the owner, so only one// of the two offers new agents here, and the other is not listed as unfit; agents already on either stay members.+ // Not when the Mac's owner runs teammates' work in their own account (backend machines.ts ownAccountWork, task #3060): a+ // teammate's work no Team agent wrote starts on the Mac, and the server refuses a start naming the Team account there.+ // Work a Team agent wrote stays in the Team account (backend teamWritten.ts teamWrittenTask): a step reads its task's mark,+ // an unknown task counts as written, and so does a task from before the mark whose assignee runs in a Team account.+ const task = group.reviewOf ? conversations.find(c => c.id === group.reviewOf) : group+ const assignee = task ? agents.find(a => a.id === object(task.assignment).agentId) : undefined+ const onTeam = (agent: Json) => agent.teamAccount === true || list(state.machines).some(m => m.machineId === agent.machineId+ && (typeof m.hostMachineId === 'string' || object(m.observation).sessionKind === 'team'))+ const teamWritten = group.teamWritten === true || !task || task.teamWritten === true || (!!assignee && onTeam(assignee))for (const [team, mac] of macOf) {const pool = machines.get(team)?.poolif (!pool || !machines.has(mac)) continue- // A teammate's task needing only what the owner shared stays on the Mac (backend teamMachineFor): its Team account folds.- const onMac = projectOwner === pool.contributorId || (taskNamed && sharedOwnAccess(list(state.machines).find(m => m.machineId === mac), needed))+ // Its owner runs teammates' work no Team agent wrote in their own account (#3060), or a teammate's task needs only what+ // the owner shared (backend teamMachineFor): either stays on the Mac, and its Team account folds.+ const ownAccount = typeof machines.get(mac)!.pool?.ownAccount === 'string' && !teamWritten+ const onMac = projectOwner === pool.contributorId || ownAccount || (taskNamed && sharedOwnAccess(list(state.machines).find(m => m.machineId === mac), needed))machines.get(onMac ? team : mac)!.folded = true}// Every row of the catalog is probed: one not offered by default is offered when a person names it (route.ts choose).diff --git a/cli/src/superTabs/swarmReads.spec.ts b/cli/src/superTabs/swarmReads.spec.tsindex 436c56264..577572944 100644--- a/cli/src/superTabs/swarmReads.spec.ts+++ b/cli/src/superTabs/swarmReads.spec.ts@@ -83,6 +83,21 @@ describe('the daemon\'s Swarm reads', () => {await expect(changed.reads.read(T, LEAD)).rejects.toMatchObject({ code: 'UPDATE_REQUIRED', status: 426 })})+ it('recovers from a first reply without a format on the next read', async () => {+ const { reads } = backendOf({ [FIRST]: [ok({}), ok(readFixture('parts-lead'))] })+ await expect(reads.read(T, LEAD)).rejects.toMatchObject({ code: 'BACKEND_UNAVAILABLE', status: 503 })+ expect((await reads.read(T, LEAD)).state).toEqual(readFixture<{ state: Json }>('legacy-tab-lead').state)+ })++ it('keeps its cursor through a malformed changes reply and recovers', async () => {+ const { reads, call } = backendOf({ [FIRST]: [ok(readFixture('parts-lead'))],+ [CHANGES()]: [ok({}), ok(readFixture('changes-lead'))] })+ await reads.read(T, LEAD)+ await expect(reads.read(T, LEAD)).rejects.toMatchObject({ code: 'BACKEND_UNAVAILABLE', status: 503 })+ expect(conversations((await reads.read(T, LEAD)).state)).toHaveLength(3)+ expect(paths(call)).toEqual([FIRST, CHANGES(), CHANGES()])+ })+it('reads as the person without an agent, and keeps each reader\'s view apart', async () => {const person = `/api/super-tabs/${T}/parts`const { call, reads } = backendOf({ [person]: [ok(readFixture('parts-builder'))], [FIRST]: [ok(readFixture('parts-lead'))] })diff --git a/cli/src/superTabs/wire.spec.ts b/cli/src/superTabs/wire.spec.tsindex 34902b0f8..42c58f98b 100644--- a/cli/src/superTabs/wire.spec.ts+++ b/cli/src/superTabs/wire.spec.ts@@ -1,6 +1,6 @@import { describe, expect, it } from 'vitest'import type { CoreApi } from '../core/api.js'-import { backend, REQUEST_BLOCKED, SuperTabHostError } from './wire.js'+import { backend, readable, REQUEST_BLOCKED, SuperTabHostError } from './wire.js'const core = (status: number, body: Record<string, unknown>) => ({ account: { backend: async () => ({ status, body }) } }) as unknown as CoreApi@@ -20,3 +20,24 @@ describe('a backend request that fails', () => {expect(down.code).toBe('BACKEND_UNAVAILABLE')})})+++describe('read compatibility', () => {+ it.each([undefined, null, false, '2', '3', 0, 1, 2.5, NaN, Infinity, [], {}])('treats malformed or older format %j as a retryable read failure', format => {+ expect(() => readable({ format })).toThrow(expect.objectContaining({ code: 'BACKEND_UNAVAILABLE', status: 503 }))+ })++ it.each([undefined, null, 'garbled', [], {}])('does not require an update for a partial reply %j', reply => {+ expect(() => readable(reply)).toThrow(expect.objectContaining({ code: 'BACKEND_UNAVAILABLE', status: 503 }))+ })++ it('accepts format 2 and requires an update only for a higher integer format', () => {+ const reply = { format: 2 }+ expect(readable(reply)).toBe(reply)+ expect(() => readable({ format: 3 })).toThrow(expect.objectContaining({ code: 'UPDATE_REQUIRED', status: 426 }))+ })++ it('preserves a real HTTP 426 even without an error body', async () => {+ await expect(backend(core(426, {}), 'GET', '/x')).rejects.toMatchObject({ code: 'UPDATE_REQUIRED', status: 426 })+ })+})diff --git a/cli/src/superTabs/wire.ts b/cli/src/superTabs/wire.tsindex 43f142eb0..c7bfe5843 100644--- a/cli/src/superTabs/wire.ts+++ b/cli/src/superTabs/wire.ts@@ -39,8 +39,10 @@ export async function backend(core: CoreApi, method: string, path: string, body?return reply.body.data}-/** A read reply in a format this client cannot read comes from a newer server: the person updates Harness (design 5.1). */+/** Only a newer format proves this client needs an update. A partial reconnect reply is a retryable read failure. */export function readable<T>(reply: unknown): T {- if (object(reply).format !== READ_FORMAT) throw new SuperTabHostError(UPDATE_REQUIRED, UPDATE_MESSAGE, 426)+ const format = object(reply).format+ if (typeof format === 'number' && Number.isSafeInteger(format) && format > READ_FORMAT) throw new SuperTabHostError(UPDATE_REQUIRED, UPDATE_MESSAGE, 426)+ if (format !== READ_FORMAT) throw new SuperTabHostError('BACKEND_UNAVAILABLE', 'Could not read this Swarm. Try again.', 503)return reply as T}diff --git a/desktop/lib/super_tabs/agent_details.dart b/desktop/lib/super_tabs/agent_details.dartindex df8227f9f..71c7f46cc 100644--- a/desktop/lib/super_tabs/agent_details.dart+++ b/desktop/lib/super_tabs/agent_details.dart@@ -86,12 +86,17 @@ class SuperTabAgentInfo {String? get engine =>_known(agent.engine) == null ? null : engineIdentity(agent.engine).label;- /// The computer it runs on: the Mac, for an agent in that Mac's Harness Team account ([SuperTabSnapshot.placeOf]).+ /// The computer it runs on: the Mac, for an agent in that Mac's Harness Team account ([SuperTabSnapshot.placeOf]),+ /// named '<Mac> · Team account' then, so it never reads like an agent of the Mac's own account (task #3060).String? get machine {final place =controller.snapshot?.placeOf(agent.machineId) ?? agent.machineId;- return _known(app?.stateOf(place)?.machine.displayName) ??+ final mac =+ _known(app?.stateOf(place)?.machine.displayName) ??_known(controller.snapshot?.pool(place)?['name'] as String?);+ return mac == null || place == agent.machineId+ ? mac+ : '$mac$kTeamEntryLabel';}String? get folder => _known(native?.project?.cwd);diff --git a/desktop/lib/super_tabs/controller.dart b/desktop/lib/super_tabs/controller.dartindex cfb087e63..eedabf51b 100644--- a/desktop/lib/super_tabs/controller.dart+++ b/desktop/lib/super_tabs/controller.dart@@ -398,7 +398,7 @@ class SuperTabController extends ChangeNotifier {int lastChangedAt = -1;/// The backend no longer serves this build's reads (HTTP 426): the tab says- /// to update Harness and asks nothing more (section 5.1).+ /// to update Harness and waits for an explicit Retry (section 5.1).bool updateRequired = false;/// What the tab says once [updateRequired] (docs/naming-system.md).@@ -3791,6 +3791,16 @@ class SuperTabController extends ChangeNotifier {);}+ /// Rechecks a compatibility refusal only when the person presses Retry.+ /// Leo's reconnect once returned an update refusal that survived until quit.+ Future<void> retryRead() async {+ if (_disposed || accessRevoked) return;+ final stopped = updateRequired;+ updateRequired = false;+ await refresh();+ if (stopped) _schedule();+ }+Future<void> refresh() {if (_disposed || accessRevoked || updateRequired) return Future.value();return _refreshing ??= _read().whenComplete(() {@@ -4638,7 +4648,7 @@ class SuperTabController extends ChangeNotifier {(failure.statusCode == 426 ||(failure.code == 'UPDATE_REQUIRED' && failure.statusCode != 400));- /// Says to update Harness and stops the poll: no read can succeed now.+ /// Says to update Harness and stops background reads until an explicit Retry.void _requireUpdate() {updateRequired = true;error = updateMessage;diff --git a/desktop/lib/super_tabs/identity.dart b/desktop/lib/super_tabs/identity.dartindex 0cfbcf5be..5cd739bf9 100644--- a/desktop/lib/super_tabs/identity.dart+++ b/desktop/lib/super_tabs/identity.dart@@ -159,7 +159,15 @@ String superTabPersonName(String email) => email.split('@').first;/// A computer as it calls itself: a Bonjour hostname without its `.local` suffix ("MacBookPro2021"), never mapped/// to a model name, so two machines of one model stay told apart. A name a person chose stays as it is.+/// What names a Mac's Harness Team account entry after its Mac's name (backend model.ts TEAM_ENTRY_LABEL, task #3060).+const kTeamEntryLabel = ' · Team account';+String superTabMachineName(String name) {+ // A Team account entry reads as its Mac's name and the label: the Mac's part is shown like any hostname, the label kept.+ const team = kTeamEntryLabel;+ if (name.length > team.length && name.endsWith(team)) {+ return '${superTabMachineName(name.substring(0, name.length - team.length))}$team';+ }const suffix = '.local';return name.length > suffix.length && name.toLowerCase().endsWith(suffix)? name.substring(0, name.length - suffix.length)diff --git a/desktop/lib/super_tabs/view.dart b/desktop/lib/super_tabs/view.dartindex b9ddf4903..31a728ba3 100644--- a/desktop/lib/super_tabs/view.dart+++ b/desktop/lib/super_tabs/view.dart@@ -4429,11 +4429,11 @@ class _SuperTabViewState extends State<SuperTabView>textAlign: TextAlign.center,style: DesktopChrome.text(color: DesktopChrome.muted),),- if (!c.accessRevoked && !c.updateRequired) ...[+ if (!c.accessRevoked) ...[const SizedBox(height: 12),TextButton(style: _thumb,- onPressed: () => unawaited(c.refresh()),+ onPressed: () => unawaited(c.retryRead()),child: const Text('Retry'),),],@@ -4821,9 +4821,9 @@ class _SuperTabViewState extends State<SuperTabView>): Text(c.error!, style: DesktopChrome.control()),),- if (!c.accessRevoked && !c.updateRequired)+ if (!c.accessRevoked)TextButton(- onPressed: () => unawaited(c.refresh()),+ onPressed: () => unawaited(c.retryRead()),child: const Text('Retry'),),],diff --git a/desktop/test/super_tab_machines_test.dart b/desktop/test/super_tab_machines_test.dartindex 7adf20908..37c06ef49 100644--- a/desktop/test/super_tab_machines_test.dart+++ b/desktop/test/super_tab_machines_test.dart@@ -197,6 +197,9 @@ void main() {('MacbookPro.local', 'MacbookPro'),('Mac-mini.local', 'Mac-mini'),('build-server.LOCAL', 'build-server'),+ // A Mac's Harness Team account entry, as the backend reads it (task #3060): its Mac's name, then the label.+ ('Gray.local · Team account', 'Gray · Team account'),+ ('Ada’s Mac · Team account', 'Ada’s Mac · Team account'),]) {expect(superTabMachineName(hostname), shown);}diff --git a/desktop/test/super_tab_team_machine_test.dart b/desktop/test/super_tab_team_machine_test.dartindex 4a02fa924..c55012712 100644--- a/desktop/test/super_tab_team_machine_test.dart+++ b/desktop/test/super_tab_team_machine_test.dart@@ -144,9 +144,15 @@ void main() {find.byKey(const ValueKey('super-machine-agent-mac-a2')),findsOneWidget,);- // The agent in the team account is on the Mac, wherever its machine is named.+ // The agent in the team account is on the Mac, and says it runs in the Mac's Harness Team account wherever its+ // machine is named (roster, card, Agent details): task #3060, both read 'Gray.local' and a start picked the wrong one.final river = c.snapshot!.agent('a2')!;- expect(SuperTabAgentInfo(c, null, river).machine, 'MacBook Pro');+ expect(+ SuperTabAgentInfo(c, null, river).machine,+ 'MacBook Pro · Team account',+ );+ final own = c.snapshot!.agent('a1')!;+ expect(SuperTabAgentInfo(c, null, own).machine, 'MacBook Pro');expect(c.snapshot!.placeOf('mac-team'), 'mac');await _unmount(tester, c);},diff --git a/desktop/test/super_tab_update_required_test.dart b/desktop/test/super_tab_update_required_test.dartindex e493ca926..2c206d9bf 100644--- a/desktop/test/super_tab_update_required_test.dart+++ b/desktop/test/super_tab_update_required_test.dart@@ -1,8 +1,11 @@+import 'dart:async';+import 'package:fake_async/fake_async.dart';import 'package:flutter/material.dart';import 'package:flutter_test/flutter_test.dart';import 'package:harness/super_tabs/controller.dart';import 'package:harness/super_tabs/view.dart';+import 'package:harness/state/workspace_chrome.dart';import 'support/super_tab_fixture.dart';@@ -14,15 +17,17 @@ void main() {late ConversationServer server;late List<String> reads;var refuse = false;+ Completer<void>? hold;SuperTabController open({Duration poll = Duration.zero}) {reads = [];return SuperTabController(tabId: 'tab',accountId: 'owner',- request: (method, path, {body}) {+ request: (method, path, {body}) async {if (method == 'GET') reads.add(path);if (refuse) throw superTabUpdateRequired;+ if (hold case final pending?) await pending.future;return server.request(method, path, body: body);},save: server.save,@@ -33,6 +38,7 @@ void main() {setUp(() {server = ConversationServer();refuse = false;+ hold = null;});test('an update answer shows the update message and stops the poll', () {@@ -100,29 +106,120 @@ void main() {expect(c.accessRevoked, isFalse);});- testWidgets('the update message offers no Retry', (tester) async {- final c = open();- await c.refresh();- refuse = true;- await c.refresh();+ Future<void> show(+ WidgetTester tester,+ SuperTabController c, {+ bool web = false,+ }) async {await tester.pumpWidget(MaterialApp(- home: Scaffold(- body: SuperTabView(- controller: c,- onInvite: () {},- onAddAgent: (_) {},- onOpenTerminal: (_) {},- machineName: (_) => 'Test Mac',+ home: WorkspaceChromeScope(+ chrome: web ? WorkspaceChrome(superTabRecovers: true) : null,+ child: Scaffold(+ body: SuperTabView(+ controller: c,+ onInvite: () {},+ onAddAgent: (_) {},+ onOpenTerminal: (_) {},+ machineName: (_) => 'Test Mac',+ ),),),),);await tester.pumpAndSettle();- expect(find.text(update), findsOneWidget);- expect(find.text('Retry'), findsNothing);- await tester.pumpWidget(const SizedBox());- await c.flush();- c.dispose();- });+ }++ for (final (firstLoad, web) in [+ (true, false),+ (false, false),+ (true, true),+ ]) {+ testWidgets(+ 'Retry recovers an update refusal, first load: $firstLoad, web: $web',+ (tester) async {+ final c = open();+ if (!firstLoad) await c.refresh();+ refuse = true;+ await c.refresh();+ await show(tester, c, web: web);+ expect(find.text(update), findsOneWidget);+ expect(find.widgetWithText(TextButton, 'Retry'), findsOneWidget);+ refuse = false;+ await tester.tap(find.widgetWithText(TextButton, 'Retry'));+ await tester.pumpAndSettle();+ expect(c.updateRequired, isFalse);+ expect(c.error, isNull);+ expect(c.snapshot, isNotNull);+ expect(find.text(update), findsNothing);+ expect(+ find.byKey(const ValueKey('super-message-composer')),+ findsOneWidget,+ );+ await tester.pumpWidget(const SizedBox());+ await c.flush();+ c.dispose();+ },+ );+ }++ testWidgets(+ 'Retry preserves a real refusal and keeps automatic reads stopped',+ (tester) async {+ final c = open(poll: const Duration(seconds: 3));+ refuse = true;+ c.start();+ await show(tester, c);+ final before = reads.length;+ expect(find.widgetWithText(TextButton, 'Retry'), findsOneWidget);+ await tester.tap(find.widgetWithText(TextButton, 'Retry'));+ await tester.pumpAndSettle();+ expect(reads.length, greaterThan(before));+ expect(c.updateRequired, isTrue);+ expect(find.text(update), findsOneWidget);+ final after = reads.length;+ await tester.pump(const Duration(seconds: 30));+ expect(reads, hasLength(after));+ await tester.pumpWidget(const SizedBox());+ await c.flush();+ c.dispose();+ },+ );++ testWidgets(+ 'successful Retry resumes polling and overlapping retries share a read',+ (tester) async {+ final c = open(poll: const Duration(seconds: 3));+ c.start();+ await tester.pump();+ refuse = true;+ await c.refresh();+ await show(tester, c);+ refuse = false;+ hold = Completer<void>();+ final before = reads.where((p) => p.contains('/changes?')).length;+ final button = tester.widget<TextButton>(+ find.widgetWithText(TextButton, 'Retry'),+ );+ button.onPressed!();+ button.onPressed!();+ await tester.pump();+ expect(+ reads.where((p) => p.contains('/changes?')),+ hasLength(before + 1),+ );+ hold!.complete();+ hold = null;+ await tester.pumpAndSettle();+ expect(c.updateRequired, isFalse);+ expect(c.error, isNull);+ final recovered = c.stateReads;+ await tester.pump(const Duration(seconds: 3));+ await tester.pump();+ expect(c.stateReads, greaterThan(recovered));+ await tester.pumpWidget(const SizedBox());+ await c.flush();+ c.dispose();+ },+ );}diff --git a/docs/plans/2026-11-05-own-account-team-entry-plan.md b/docs/plans/2026-11-05-own-account-team-entry-plan.mdnew file mode 100644index 000000000..a5b9fa62a--- /dev/null+++ b/docs/plans/2026-11-05-own-account-team-entry-plan.md@@ -0,0 +1,80 @@+# Own-account work never lands in the Team account by its entry: implementation plan++> Written by the Engineer by superpowers:writing-plans and implemented by it, test first+> (superpowers:test-driven-development). No execution handoff.++**Goal:** When a Mac's owner has turned on "teammates' work runs in my own account", a teammate's work that a Harness+Team agent did not write never lands in that Mac's Harness Team account, whether the route offers it or a start names+the Team account's entry directly; and a Team account's entry never goes by the same name as its Mac. Task #3060+(Scholes, from lamp's PM Faye).++**Cause (11-04, 10:51:00Z):** a lamp start named Gray's Team account entry directly. Both of Gray's entries were named+`Gray.local`. The owner's choice (`ownAccountChoice`) is read only on the Mac's own entry (`teamMachineFor` returns+the named machine when it is the Mac with own-account work on), and nothing checked a start that named the Team entry+itself, so the server placed it as named, with no note. The route also still folded the Mac into its Team account for a+teammate's project, offering the Team entry even with the choice on.++**Architecture:**+- Backend `machines.ts`: `ownAccountTeamEntry(state, machineId, project, teamWritten)` answers the Mac's own entry when+ [machineId] is a Team account's entry whose Mac (same contributor) has own-account work on, the project is not the+ contributor's own and the code is not Team-written; else null. `TEAM_ENTRY_LABEL` (` · Team account`) and+ `teamEntryName(pool)`.+- Backend `commands.ts` `agent.start`: a start naming such a Team entry is refused (`OWN_ACCOUNT_WORK`, 409) with a+ pointer to the Mac's own entry (its name and id). Refused rather than moved: moving puts the work into a person's own+ account, with its files and sign-ins, when the start named the isolated account; a refusal changes no account+ silently and the starter picks the own entry knowingly, where the route already notes own-account work.+- Backend `model.ts` `visibleState`: every read shows a Team account's entry as `<Mac> · Team account`; the stored name+ stays the Mac's, which renames and every backend sentence read.+- CLI `routeCommand.ts`: for a teammate's project whose Mac has own-account work on (the server's `teamWork.ownAccount`)+ and whose task is not Team-written, the Team entry is folded and the Mac's own entry offered. Team-written work keeps+ the Team entry. The Team entry's own name from the read is shown, so route rows say `· Team account`.+- Desktop: rows already read the pool's `name`; the Machines list folds a Team account into its Mac's row and shows the+ Mac. `superTabMachineName` keeps the label while it drops the Mac's `.local`.++**Tech Stack:** TypeScript (backend, vitest), TypeScript (CLI, vitest), Dart/Flutter (Desktop).++**Spec:** task #3060 brief.++## Global Constraints++- Team account routing is an access boundary: two independent security reviews.+- Team-written work always goes to the Team account (audit H2); nothing here may move it to the own account.+- The owner's own project on their Mac is unchanged.+- No stored name changes: `followAccountName`/`renamedBy` keep Team entries named as their Mac.++## Review Focus++- That no path places a teammate's non-Team-written start on the Team entry while own-account work is on, and that+ Team-written work still never reaches the own account (the route fold, `agent.start`).+- That the read-time name changes no backend decision (backend reads stored names only).++## Tasks++### Task 1: a start naming the Team entry is refused with a pointer (backend)++**Files:** `backend/src/superTabs/machines.ts`, `backend/src/superTabs/commands.ts`, `backend/src/superTabs/ownAccountWork.test.ts`++- [ ] Failing tests: with own-account work on, a teammate's start naming `gray-team` is refused with `OWN_ACCOUNT_WORK`+ naming the Mac's entry; Team-written work naming `gray-team` still starts there; the owner's own project naming+ `gray-team` is unchanged; with the choice off, a start naming `gray-team` starts as before.+- [ ] Implement `ownAccountTeamEntry` and the refusal in `agent.start`.++### Task 2: the route offers the Mac's own entry (CLI)++**Files:** `cli/src/superTabs/routeCommand.ts`, `cli/src/superTabs/routeCommand.spec.ts`++- [ ] Failing tests: with `teamWork.ownAccount` on the Mac, a teammate's task offers `m1` for new agents and not+ `m1-team`; a Team-written task (`teamWritten` on the group) still offers `m1-team` and not `m1`.+- [ ] Implement the fold change.++### Task 3: a Team entry shows a distinct name (backend read, route)++**Files:** `backend/src/superTabs/model.ts`, `backend/src/superTabs/ownAccountWork.test.ts`,+`desktop/lib/super_tabs/identity.dart`, `desktop/test/super_tab_machines_test.dart`++- [ ] Failing tests: `visibleState` shows `gray-team` as `Gray's Mac · Team account` and `gray-mac` as `Gray's Mac`+ for every reader; the stored name is unchanged. The route and the CLI's status take machine names from that read,+ so they need no change of their own.+- [ ] Desktop: `superTabMachineName('Gray.local · Team account')` is `Gray · Team account` (it drops `.local` only at+ the end of a name today).+- [ ] Implement.diff --git a/docs/plans/2026-11-05-swarm-update-retry-plan.md b/docs/plans/2026-11-05-swarm-update-retry-plan.mdnew file mode 100644index 000000000..24292c440--- /dev/null+++ b/docs/plans/2026-11-05-swarm-update-retry-plan.md@@ -0,0 +1,48 @@+# Swarm update Retry implementation plan++> Implement task by task in this session, test first, with one independent review of the pull request.++**Goal:** A malformed reconnect read never permanently locks the Swarm behind Update Harness.+**Architecture:** Classify missing or invalid read formats as retryable read failures in the CLI. Keep compatibility refusals latched until an explicit Desktop Retry rechecks the server, then resume normal scheduling after recovery.+**Tech Stack:** TypeScript/Vitest; Dart/Flutter widget and controller tests.+**Spec:** Swarm task #3273, conversation 0ac53b4a9733709144f7b3c2.++## Global Constraints++- Requested by Leo through Harness. CLI + Desktop only; no backend or core changes.+- Preserve genuine HTTP 426 and higher-format update refusals.+- Tests use in-memory fixtures and fake sign-in; never touch the real CLI account.+- Run wire/read specs, Desktop controller/view tests, changed-code analysis and check-ui-style before Ready. Full component suites run in PR CI.+- Keep polling stopped while compatibility is refused. Retry performs a fresh read; overlapping retries share it.++## Review Focus++- Missing, null, string, array, fractional or older formats must not demand an update.+- A changes-read failure must retain the cursor and recover on its next valid reply.+- Retry after the first load fails must recover even without a snapshot.+- A repeated genuine refusal must keep the banner and stop background reads.+- Successful Retry must restore periodic reads; access revocation remains final.++## Task 1: Classify malformed reads++**Files:** `cli/src/superTabs/wire.ts`, `wire.spec.ts`, `swarmReads.spec.ts`.+**Interfaces:** `readable<T>(reply: unknown): T` returns format 2, throws UPDATE_REQUIRED/426 only for an integer format above 2, otherwise throws BACKEND_UNAVAILABLE/503. `backend()` preserves HTTP 426.++- [x] Add and commit parameterized malformed-format tests and first/changes recovery tests before code.+- [x] Run `npx vitest run src/superTabs/wire.spec.ts src/superTabs/swarmReads.spec.ts --maxWorkers=2`; record the expected malformed-format failures.+- [x] Implement format classification; run wire, swarmReads, hostFeed and serviceReads specs and typecheck; commit passing code.++## Task 2: Recover through explicit Retry++**Files:** `desktop/lib/super_tabs/controller.dart`, `view.dart`, `desktop/test/super_tab_update_required_test.dart`.+**Interfaces:** Add `Future<void> retryRead()` for explicit retry; background `refresh()` remains guarded. Both existing Retry buttons invoke it and are available during updateRequired, unless access is revoked.++- [x] Add and commit controller tests for no-snapshot recovery, repeated refusal, shared in-flight retry and polling recovery, plus widget tests tapping Retry with and without a snapshot.+- [x] Run the update-required test file and record failures before code.+- [x] Implement Retry to clear the compatibility latch, coalesce reads and restore scheduling; expose both Retry buttons. Run the new tests; commit passing code.+- [ ] Run affected controller/view/reading/recovery tests, changed Dart analysis and `python3 scripts/check-ui-style.py --only desktop/lib/super_tabs`.+- [ ] Record red/green evidence in the PR comment, mark Ready, and hand the stable head to the Integrator for independent review and test.++## Design++No stored data, audience or identity changes. Growth/concurrency: existing read coalescing and scheduler remain authoritative, no new queues. Read cost: one explicit retry, then existing incremental reads. Compatibility: format 2 remains unchanged, higher integer formats and HTTP 426 still require an update. Migration/rollback: none; revert the code. Failure: malformed reads retain ordinary visible retry errors. Platforms: shared CLI and Flutter logic; verify macOS locally and Linux in CI, with independent offscreen UI verification on a Team account.