Skip to content

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

Merge batch 11-03 b2045: #2822 #2805 #2807 #2793 #2820 #2808 #2798 (#2830)

0xken15e11e8dace3c1
diff --git a/.github/workflows/backend-cache.yml b/.github/workflows/backend-cache.yml
new file mode 100644
index 000000000..b67242c87
--- /dev/null
+++ b/.github/workflows/backend-cache.yml
@@ -0,0 +1,56 @@
+name: Prepare backend caches
+
+# PR CI's backend-integration shards restore the mongod download the Super Tab integration suite needs. A cache saved on a
+# PR is visible to that PR alone; one saved on main is visible to every PR, so main saves it, once per key.
+on:
+ push:
+ branches: [main]
+ paths:
+ - 'backend/package-lock.json'
+ - '.github/workflows/backend-cache.yml'
+ workflow_dispatch:
+
+permissions:
+ contents: read
+
+concurrency:
+ group: backend-cache-${{ github.ref }}
+ cancel-in-progress: false
+
+jobs:
+ mongod:
+ runs-on: ubuntu-latest
+ timeout-minutes: 10
+ defaults:
+ run:
+ working-directory: backend
+ steps:
+ - uses: actions/checkout@v7
+ with:
+ sparse-checkout: |
+ /backend/
+ - id: cached
+ uses: actions/cache/restore@v4
+ with:
+ path: /tmp/harness-super-tab-mongodb-binaries
+ key: super-tab-mongod-7.0.24-${{ runner.os }}-${{ runner.arch }}
+ lookup-only: true
+ - uses: actions/setup-node@v7
+ if: steps.cached.outputs.cache-hit != 'true'
+ with:
+ node-version: 22.23.2
+ cache: npm
+ cache-dependency-path: backend/package-lock.json
+ - if: steps.cached.outputs.cache-hit != 'true'
+ run: npm ci --no-audit --no-fund --ignore-scripts
+ # The version and folder the integration files use (integration/plans.test-support.ts).
+ - name: Download mongod 7.0.24
+ if: steps.cached.outputs.cache-hit != 'true'
+ run: >-
+ node -e "import('mongodb-memory-server-core').then(m => m.MongoBinary.getPath({ version: '7.0.24',
+ downloadDir: '/tmp/harness-super-tab-mongodb-binaries' })).then(p => console.log(p))"
+ - if: steps.cached.outputs.cache-hit != 'true'
+ uses: actions/cache/save@v4
+ with:
+ path: /tmp/harness-super-tab-mongodb-binaries
+ key: super-tab-mongod-7.0.24-${{ runner.os }}-${{ runner.arch }}
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 5caff6d75..723b08416 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -98,7 +98,7 @@ jobs:
.github/workflows/ci.yml .github/workflows/cli-e2e.yml .github/workflows/ci-health.yml
.github/workflows/website-checks.yml .github/workflows/experience-checks.yml
.github/workflows/authoring-browser-checks.yml .github/workflows/home-assistant-checks.yml
- .github/workflows/desktop-logging-checks.yml .github/workflows/windows.yml
+ .github/workflows/desktop-logging-checks.yml .github/workflows/windows.yml .github/workflows/backend-cache.yml
- id: select
env:
CI_SCOPE: ${{ inputs.scope || 'full' }}
@@ -431,7 +431,8 @@ jobs:
cache-dependency-path: backend/package-lock.json
- run: npm ci --no-audit --no-fund
# The tests download mongod 7.0.24 into $TMPDIR/harness-super-tab-mongodb-binaries (integration/plans.test-support.ts).
- - uses: actions/cache@v4
+ # Restore only: backend-cache.yml saves it from main, where every PR can read it; a PR's own save would be its alone.
+ - uses: actions/cache/restore@v4
with:
path: /tmp/harness-super-tab-mongodb-binaries
key: super-tab-mongod-7.0.24-${{ runner.os }}-${{ runner.arch }}
diff --git a/backend/integration/superTabBuddies.test.ts b/backend/integration/superTabBuddies.test.ts
index efee838c0..f771613fa 100644
--- a/backend/integration/superTabBuddies.test.ts
+++ b/backend/integration/superTabBuddies.test.ts
@@ -1063,6 +1063,21 @@ describe('a Buddy on its person\'s own machine outside the Swarm, through the st
await leaks('cleaned')
})
+ // Task #2441: a host report the server refused failed nothing; its person waited out the 3 minutes and never read why.
+ it('fails at once when its host\'s report is refused, and its person reads why, no one else', async () => {
+ const f = await swarm()
+ const added = await add(f, 'peer-laptop')
+ const startId = String(added.result.startId)
+ const pool = (await poolRows(f.store, peer, 'peer-laptop')).find(p => p.tabId === f.tab)!
+ await f.execute({ type: 'agent.startDispatch', startId }, peer, undefined, 'peer-laptop')
+ const reason = 'This start does not belong to this machine contribution.'
+ await f.store.observeMachine(peer, f.tab, 'peer-laptop', { generation: pool.machine.generation, resources: { cpuPercent: 10, memoryTotalBytes: 16e9,
+ memoryUsedBytes: 4e9, diskFreeBytes: 120e9, diskTotalBytes: 500e9, projectDiskFreeBytes: 120e9, deviceType: 'Laptop', chip: 'Fixture', os: 'macOS', gpuPercent: null },
+ quotas: [], tools: {}, runningHarnessIds: [], stoppedHarnessIds: [], refusedStarts: [{ startId, reason }] })
+ expect((await f.store.start(peer, f.tab, startId)).error).toBe(`Peer Laptop refused it: ${reason}`)
+ expect(JSON.stringify(await f.store.read(owner, f.tab))).not.toContain('peer-laptop')
+ })
+
it('never reaches another reader when its Buddy never launched', async () => {
const f = await swarm()
const reads = new SwarmReads(f.store)
diff --git a/backend/integration/superTabLeaderboard.test.ts b/backend/integration/superTabLeaderboard.test.ts
index a216c9a82..7002afad2 100644
--- a/backend/integration/superTabLeaderboard.test.ts
+++ b/backend/integration/superTabLeaderboard.test.ts
@@ -149,7 +149,7 @@ describe('the leaderboard read', () => {
it('details what each person shipped, a dormant group\'s too, and never a private chat\'s title', async () => {
const s = await scene()
const now = await get(`/api/super-tabs/${s.tabId}/leaderboard?projectId=lead`, peer)
- expect(score(now.body, peer.sub).details).toEqual({ shipped: [{ title: 'Fresh', prUrl: PR, mergedAt: NOW - HOUR }], unblocked: [], lent: [] })
+ expect(score(now.body, peer.sub).details).toEqual({ shipped: [{ title: 'Fresh', prUrl: PR, mergedAt: NOW - HOUR }], unblocked: [], lent: [], brought: [] })
expect(JSON.stringify(now.body.data)).not.toMatch(/Peer and PM|Hidden/)
const last = await get(`/api/super-tabs/${s.tabId}/leaderboard?projectId=lead&week=${WEEK - WEEK_MS}`, peer)
expect(score(last.body, peer.sub).details.shipped).toEqual([{ title: 'Old', prUrl: PR, mergedAt: WEEK - 2 * 86_400_000 }])
@@ -182,6 +182,9 @@ describe('the leaderboard read', () => {
const url = `/api/super-tabs/${s.tabId}/leaderboard?projectId=lead&period=30d`
const first = await get(url, peer)
expect(score(first.body, peer.sub).lent).toEqual({ machines: 1, agentMs: 30 * HOUR })
+ // The machine the person brought, through the real read: its hours for others, nothing shipped on it, its week unread (#2444).
+ expect(score(first.body, peer.sub).details.brought).toEqual([{ machineId: 'peer-mac', machineName: 'Peer Mac', shipped: 0, busyHours: 30,
+ subscriptions: [{ engine: 'claude', usedPercent: null, resetsAt: null }] }])
expect(first.body.data.byModel.find((m: { model: string }) => m.model === 'opus')).toMatchObject({ reviews: 5 })
expect((await get(url, peer)).body.data).toEqual(first.body.data)
// A week's read is as it was.
diff --git a/backend/integration/superTabLiveness.test.ts b/backend/integration/superTabLiveness.test.ts
index 17f6af5d1..3235a2ddc 100644
--- a/backend/integration/superTabLiveness.test.ts
+++ b/backend/integration/superTabLiveness.test.ts
@@ -1070,7 +1070,7 @@ describe('an agent whose task was lost', () => {
describe('a start that never runs', () => {
/** 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 launch = async (f: Awaited<ReturnType<typeof swarm>>, dispatch = true) => {
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.' },
@@ -1083,7 +1083,7 @@ describe('a start that never runs', () => {
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 })
+ if (dispatch) await onMachine({ type: 'agent.startDispatch', startId })
return { group, startId, onMachine }
}
@@ -1136,6 +1136,46 @@ describe('a start that never runs', () => {
expect((await ownerState()).starts!.find(s => s.id === startId)).not.toHaveProperty('preparing')
})
+ // Task #2441: the server refused this machine's own report for the start (its daemon log said why, nobody else did), and the
+ // start waited out the 3 minutes. Its machine now says so in its reading, and the start fails at once, with the reason.
+ const REFUSAL = 'This start does not belong to this machine contribution.'
+ it('fails a start its own machine reports refused, at once, with the refusal\'s reason', async () => {
+ const f = await swarm()
+ await f.beat(f.clock.now)
+ const { group, startId, onMachine } = await launch(f)
+ await f.observe('test-host', [f.harness.worker], { refusedStarts: [{ startId, reason: REFUSAL }] })
+ expect((await f.timed.start(host, f.tab, startId, f.lead)).error).toBe(`Worker Mac refused it: ${REFUSAL}`)
+ const told = (await f.leadInbox()).find(m => (m.source as { kind?: string }).kind === 'start-timeout')!
+ expect(told).toMatchObject({ conversationId: group })
+ expect(told.text).toMatch(/^Could not start Builder on fixture-model: its machine could not prepare or launch it\./)
+ await expect(onMachine({ type: 'agent.started', startId, harnessId: randomUUID(), configuration: config }))
+ .rejects.toMatchObject({ code: 'START_FAILED' })
+ })
+
+ it('fails an undispatched start its machine reports refused', async () => {
+ const f = await swarm()
+ await f.beat(f.clock.now)
+ const { startId } = await launch(f, false)
+ await f.observe('test-host', [f.harness.worker], { refusedStarts: [{ startId, reason: REFUSAL }] })
+ expect((await f.timed.start(host, f.tab, startId, f.lead)).error).toBe(`Worker Mac refused it: ${REFUSAL}`)
+ })
+
+ it('is not failed by another machine\'s report, never rewrites a decided start, and no reader reads the refusals', async () => {
+ const f = await swarm()
+ await f.beat(f.clock.now)
+ const { startId, onMachine } = await launch(f)
+ const refused = { refusedStarts: [{ startId, reason: REFUSAL }] }
+ await f.observe('lead-host', [f.harness.lead], refused)
+ expect((await f.timed.start(host, f.tab, startId, f.lead)).error).toBeNull()
+ const harnessId = randomUUID()
+ await onMachine({ type: 'agent.started', startId, harnessId, configuration: config })
+ await f.observe('test-host', [f.harness.worker, harnessId], refused)
+ expect(await f.timed.start(host, f.tab, startId, f.lead)).toMatchObject({ error: null, harnessId })
+ for (const reader of [owner, host]) {
+ for (const machine of (await f.timed.read(reader, f.tab)).state.machines ?? []) expect(machine.observation ?? {}).not.toHaveProperty('refusedStarts')
+ }
+ })
+
// The time checks run on the Lead's poll and on any other machine's report (store.ts).
it.each([
['the Lead\'s poll', (racing: SuperTabStore, f: Awaited<ReturnType<typeof swarm>>) => racing.deliveries(host, f.tab, f.lead)],
diff --git a/backend/src/lib/ciShards.ts b/backend/src/lib/ciShards.test-support.ts
similarity index 100%
rename from backend/src/lib/ciShards.ts
rename to backend/src/lib/ciShards.test-support.ts
diff --git a/backend/src/lib/ciShards.test.ts b/backend/src/lib/ciShards.test.ts
index 06bff4cfa..2d1480bce 100644
--- a/backend/src/lib/ciShards.test.ts
+++ b/backend/src/lib/ciShards.test.ts
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest'
-import { durationShards, readTimingHints } from './ciShards.js'
+import { durationShards, readTimingHints } from './ciShards.test-support.js'
const entry = (key: string, durationMs: number) => ({ key, durationMs, value: key })
diff --git a/backend/src/lib/productionBuild.test.ts b/backend/src/lib/productionBuild.test.ts
new file mode 100644
index 000000000..9d799d954
--- /dev/null
+++ b/backend/src/lib/productionBuild.test.ts
@@ -0,0 +1,19 @@
+import { readdirSync, readFileSync } from 'node:fs'
+import { join, relative } from 'node:path'
+import { fileURLToPath } from 'node:url'
+import { describe, expect, it } from 'vitest'
+
+// build.mjs ships every .ts under src except *.test.ts and *.test-support.ts into dist. Code that only tests or CI use
+// (anything importing Vitest) must carry one of those names, or it lands in the production build (review of #2804).
+const src = fileURLToPath(new URL('..', import.meta.url))
+const files = (dir: string): string[] => readdirSync(dir, { withFileTypes: true })
+ .flatMap(entry => entry.isDirectory() ? files(join(dir, entry.name)) : entry.name.endsWith('.ts') ? [join(dir, entry.name)] : [])
+
+describe('the production build', () => {
+ it('ships no file that imports Vitest', () => {
+ const shipped = files(src).filter(path => !path.endsWith('.test.ts') && !path.endsWith('.test-support.ts'))
+ expect(shipped.length).toBeGreaterThan(50)
+ const testOnly = shipped.filter(path => /from ['"]vitest(\/[\w-]+)?['"]/.test(readFileSync(path, 'utf8')))
+ expect(testOnly.map(path => relative(src, path))).toEqual([])
+ })
+})
diff --git a/backend/src/superTabs/commands.ts b/backend/src/superTabs/commands.ts
index 03d7bde84..972d7f080 100644
--- a/backend/src/superTabs/commands.ts
+++ b/backend/src/superTabs/commands.ts
@@ -32,6 +32,7 @@ import { cloneData } from './cloneData.js'
import { workspaceCan, type WorkspaceRole } from './workspaces.js'
import { fixedOriginal, LEDGER_WEEKS, PULL_REQUEST_URL, recordAsked, recordFix, recordDecision, recordMerged, recordPost, recordProposal, recordReview, recordRun, recordStatus,
recordReportedModel, recordVerdict } from './leaderboard/record.js'
+import { othersWorkNotice } from './othersWork.js'
import { WEEK_MS } from './leaderboard/week.js'
import { react, reactionSchema, type ReactionTarget } from './reactions.js'
import { githubRepository } from '../github/repository.js'
@@ -1741,6 +1742,8 @@ function applyCommandOnce(original: SuperTabState, actor: Actor, input: Command,
// Added as its person joined (Desktop's join): teammates' work only through its Harness Team account, for as long as
// it stays contributed. Saving its settings sends the contribution without the field, and must not drop the rule.
const teamAccountOnly = command.teamAccountOnly || state.machines.find(m => m.machineId === command.machineId)?.teamAccountOnly
+ // The week its owner was told of others' work here: saving settings again does not tell them twice (othersWork.ts).
+ const othersToldWeek = state.machines.find(m => m.machineId === command.machineId)?.othersToldWeek
// Its owner's choice of projects is its own command's (machine.projects): saving the settings keeps it.
const projects = state.machines.find(m => m.machineId === command.machineId && !m.buddyOnly)?.projects
state.machines = state.machines.filter(m => m.machineId !== command.machineId)
@@ -1750,7 +1753,8 @@ function applyCommandOnce(original: SuperTabState, actor: Actor, input: Command,
state.machines.push({ machineId: command.machineId, name: mac?.name ?? context.contribution?.machineName ?? command.name, cwd: command.cwd, engines: [...new Set(command.engines)],
maxAgents: mac?.maxAgents ?? command.maxAgents, ...(command.scope ? { scope: command.scope } : {}),
contributorId: actor.userId, membershipGeneration: contributor.generation, generation: operationId, paused,
- ...(host ? { hostMachineId: host } : {}), ...(teamAccountOnly ? { teamAccountOnly: true as const } : {}), ...(projects && !host ? { projects } : {}) })
+ ...(host ? { hostMachineId: host } : {}), ...(teamAccountOnly ? { teamAccountOnly: true as const } : {}), ...(projects && !host ? { projects } : {}),
+ ...(othersToldWeek != null ? { othersToldWeek } : {}) })
// A Mac given other slots or a new name gives its team account the same, and its pause; its own folder, engines and grant stay.
const added = state.machines.at(-1)!
for (const team of teamPoolsOf(state, added)) if (!team.removal) Object.assign(team, { name: added.name, maxAgents: added.maxAgents, paused: added.paused })
@@ -3100,6 +3104,9 @@ function applyCommandOnce(original: SuperTabState, actor: Actor, input: Command,
renewLease(group.assignment, context.now)
leadActed(group.id, 'assign')
recordRun(state, group, group.assignment, worker, context.now)
+ const others = othersWorkNotice(state, group, worker, context.now, ENGINE_NAMES[worker.configuration.engine] ?? worker.configuration.engine)
+ if (others) effects.messages.push({ id: stableId(operationId, 'others-work-notice'), conversationId: others.conversationId, author: sender,
+ replyTo: null, recipients: [], source: { kind: 'others-work-notice', machineId: others.machineId }, text: others.text })
group.checks.forEach(c => { c.evidence = null; c.passedBy = null; delete c.verdicts })
result.assignmentId = operationId
let routeNote: { decisionId: string; text: string } | null = null
diff --git a/backend/src/superTabs/leaderboard/brought.test.ts b/backend/src/superTabs/leaderboard/brought.test.ts
new file mode 100644
index 000000000..4338d6f48
--- /dev/null
+++ b/backend/src/superTabs/leaderboard/brought.test.ts
@@ -0,0 +1,132 @@
+import { describe, expect, it } from 'vitest'
+import type { ContributedMachine } from '../machines.js'
+import { createSuperTab, type Agent, type Conversation, type SuperTabState } from '../model.js'
+import type { GroupLedger, Run } from './record.js'
+import { leaderboard } from './stats.js'
+import { DAY_MS, WEEK_MS } from './week.js'
+
+// Contributor view (#2444): what each person's machines shipped and did for others, and their subscriptions' week.
+// Monday 2026-10-26 00:00 UTC; "now" is Thursday noon of that week.
+const WEEK = Date.UTC(2026, 9, 26), LAST = WEEK - WEEK_MS, NOW = WEEK + 3 * DAY_MS + 12 * 3_600_000
+const HOUR = 3_600_000
+
+function swarm(): SuperTabState {
+ const state = createSuperTab('tab', 'Pilot', { id: 'ken', email: '[email protected]' }, 'prod')
+ state.people.push(...['dee', 'diego'].map(id => ({ id, email: `${id}@example.com`, role: 'collaborator' as const, generation: 'g' })))
+ return state
+}
+function machine(machineId: string, contributorId: string, extra: Partial<ContributedMachine> = {}): ContributedMachine {
+ return { machineId, name: machineId, contributorId, membershipGeneration: 'g', generation: 'g1', cwd: '/repo', scope: 'swarm',
+ engines: ['claude'], maxAgents: 2, paused: false, ...extra }
+}
+const run = (machineId: string | undefined, at: number, extra: Partial<Run> = {}): Run =>
+ ({ assignmentId: `a-${at}-${machineId}`, engine: 'claude', model: 'opus', at, ...(machineId ? { machineId } : {}), ...extra })
+let n = 0
+function group(ledger: GroupLedger, extra: Partial<Conversation> = {}): Conversation {
+ const id = `g${++n}`
+ return { id, projectId: 'lead', title: `Group ${id}`, leadId: null, agentIds: [], archived: false, brief: 'Do it', checks: [], assignment: null,
+ lastMessageSequence: 0, requesterId: 'dee', pullRequestUrls: ['https://github.com/o/r/pull/1'], ledger, ...extra }
+}
+/** A request someone asked for that shipped at [at] on an attempt that ran on [machineId]. */
+const shippedOn = (machineId: string | undefined, at: number, ledger: GroupLedger = {}, extra: Partial<Conversation> = {}) =>
+ group({ askedAt: at - HOUR, shippedAt: at, runs: [run(machineId, at - HOUR)], ...ledger }, extra)
+const board = (state: SuperTabState, groups: Conversation[], machines = state.machines ?? []) =>
+ leaderboard({ state, groups, machines, projectId: 'lead', week: WEEK, now: NOW })
+const brought = (view: ReturnType<typeof board>, id: string) => view.people.find(p => p.personId === id)!.details.brought
+
+describe('Brought: the machines a person brought, what shipped on each, and their subscriptions\' week', () => {
+ it('lists each machine a person brought with the verified requests that shipped on it, anyone\'s, most first', () => {
+ const state = swarm()
+ state.machines = [machine('studio', 'ken', { name: 'Mac Studio', lent: [{ week: WEEK, busyMs: 31 * HOUR }] }), machine('mbp', 'ken', { name: 'MacBook Pro' })]
+ const view = board(state, [shippedOn('studio', WEEK + HOUR), shippedOn('studio', WEEK + 2 * HOUR, {}, { requesterId: 'ken' }),
+ shippedOn('studio', WEEK + 3 * HOUR, {}, { requesterId: 'diego' }),
+ // Needed a fix after merge: not verified.
+ shippedOn('mbp', WEEK + HOUR, { fixedAfterMergeAt: WEEK + DAY_MS }),
+ // Shipped last week: not this week's.
+ shippedOn('mbp', LAST + HOUR)])
+ expect(brought(view, 'ken')).toEqual([
+ { machineId: 'studio', machineName: 'Mac Studio', shipped: 3, busyHours: 31, subscriptions: [{ engine: 'claude', usedPercent: null, resetsAt: null }] },
+ { machineId: 'mbp', machineName: 'MacBook Pro', shipped: 0, busyHours: 0, subscriptions: [{ engine: 'claude', usedPercent: null, resetsAt: null }] },
+ ])
+ expect(brought(view, 'dee')).toEqual([])
+ })
+
+ it('credits the attempt the request shipped on, not a later or earlier one', () => {
+ const state = swarm()
+ state.machines = [machine('studio', 'ken'), machine('box', 'diego')]
+ const g = group({ askedAt: WEEK, shippedAt: WEEK + 2 * HOUR, runs: [run('box', WEEK), run('studio', WEEK + HOUR), run('box', WEEK + 3 * HOUR)],
+ shippedBy: { assignmentId: 'x', engine: 'claude', model: 'opus', at: WEEK + HOUR, machineId: 'studio' } })
+ const view = board(state, [g])
+ expect(brought(view, 'ken')[0]!.shipped).toBe(1)
+ expect(brought(view, 'diego')[0]!.shipped).toBe(0)
+ })
+
+ it('folds a Mac\'s Harness Team account into its Mac: one row, its time and ships added, the Mac\'s subscriptions', () => {
+ const state = swarm()
+ state.machines = [machine('studio', 'ken', { name: 'Mac Studio', lent: [{ week: WEEK, busyMs: 2 * HOUR }] }),
+ machine('studio-team', 'ken', { name: 'Mac Studio · Team', hostMachineId: 'studio', lent: [{ week: WEEK, busyMs: 3 * HOUR }] })]
+ const view = board(state, [shippedOn('studio-team', WEEK + HOUR), shippedOn('studio', WEEK + 2 * HOUR)])
+ expect(brought(view, 'ken')).toEqual([expect.objectContaining({ machineId: 'studio', machineName: 'Mac Studio', shipped: 2, busyHours: 5 })])
+ })
+
+ it('finds an older attempt\'s machine by its agent while that agent exists, and counts one it cannot place nowhere', () => {
+ const state = swarm()
+ state.machines = [machine('studio', 'ken')]
+ state.agents.push({ id: 'worker-1', name: 'Nico', machineId: 'studio', harnessId: 'h1' } as Agent)
+ const view = board(state, [shippedOn(undefined, WEEK + HOUR, { runs: [run(undefined, WEEK, { agentId: 'worker-1' })] }),
+ shippedOn(undefined, WEEK + 2 * HOUR, { runs: [run(undefined, WEEK, { agentId: 'gone' })] })])
+ expect(brought(view, 'ken')[0]!.shipped).toBe(1)
+ })
+
+ it('shows each contributed engine\'s weekly window: percent used and when it resets, or unknown', () => {
+ const state = swarm(), resets = WEEK + 6 * DAY_MS
+ state.machines = [machine('studio', 'ken', { engines: ['claude', 'codex'], observation: { receivedAt: NOW, quotas: [
+ { engine: 'claude', known: true, windows: [{ name: '5-hour', usedPercent: 90, resetsAt: NOW + HOUR }, { name: 'weekly', usedPercent: 38, resetsAt: new Date(resets).toISOString() }] },
+ { engine: 'codex', known: false, windows: [] }] } as unknown as ContributedMachine['observation'] })]
+ expect(brought(board(state, []), 'ken')[0]!.subscriptions).toEqual([
+ { engine: 'claude', usedPercent: 38, resetsAt: resets }, { engine: 'codex', usedPercent: null, resetsAt: null }])
+ })
+
+ it('reads a reset given in epoch seconds as well as milliseconds or a date', () => {
+ const state = swarm(), resets = WEEK + 6 * DAY_MS
+ state.machines = [machine('studio', 'ken', { observation: { receivedAt: NOW, quotas: [
+ { engine: 'claude', known: true, windows: [{ name: 'weekly', usedPercent: 10, resetsAt: resets / 1000 }] }] } as unknown as ContributedMachine['observation'] })]
+ expect(brought(board(state, []), 'ken')[0]!.subscriptions).toEqual([{ engine: 'claude', usedPercent: 10, resetsAt: resets }])
+ })
+
+ it('never lists a machine the reader cannot see, nor counts a group the reader was not handed', () => {
+ const state = swarm()
+ state.machines = [machine('studio', 'ken'), machine('hidden', 'ken')]
+ const view = board(state, [shippedOn('studio', WEEK + HOUR)], [state.machines[0]!])
+ expect(brought(view, 'ken').map(m => m.machineId)).toEqual(['studio'])
+ expect(brought(board(state, [], [state.machines[0]!]), 'ken')[0]!.shipped).toBe(0)
+ })
+
+ it('never counts a private chat\'s work, even one carrying a ship record', () => {
+ const state = swarm()
+ state.machines = [machine('studio', 'ken')]
+ const view = board(state, [shippedOn('studio', WEEK + HOUR, {}, { audience: { people: [{ id: 'ken', generation: 'g' }] } })])
+ expect(brought(view, 'ken')[0]!.shipped).toBe(0)
+ })
+})
+
+describe('Contributors: people whose machine ran work this period, last period, and how many kept going', () => {
+ it('counts each person once whose machine ran an attempt, requests and review steps alike', () => {
+ const state = swarm()
+ state.machines = [machine('studio', 'ken'), machine('mbp', 'ken'), machine('box', 'diego'), machine('dee-mac', 'dee')]
+ const view = board(state, [
+ group({ runs: [run('studio', WEEK + HOUR), run('mbp', WEEK + 2 * HOUR), run('studio', LAST + HOUR)] }),
+ group({ runs: [run('box', LAST + HOUR)] }),
+ group({ runs: [run('dee-mac', WEEK + HOUR)] }, { reviewOf: 'g0' }),
+ ])
+ expect(view.contributors).toEqual({ thisWeek: 2, lastWeek: 2, kept: 1 })
+ })
+
+ it('counts nothing for a private chat\'s work or a machine the reader cannot see', () => {
+ const state = swarm()
+ state.machines = [machine('studio', 'ken'), machine('box', 'diego')]
+ const view = board(state, [group({ runs: [run('studio', WEEK + HOUR)] }, { audience: { people: [{ id: 'ken', generation: 'g' }] } }),
+ group({ runs: [run('box', WEEK + HOUR)] })], [state.machines[0]!])
+ expect(view.contributors).toEqual({ thisWeek: 0, lastWeek: 0, kept: 0 })
+ })
+})
diff --git a/backend/src/superTabs/leaderboard/brought.ts b/backend/src/superTabs/leaderboard/brought.ts
new file mode 100644
index 000000000..bdcfb4c96
--- /dev/null
+++ b/backend/src/superTabs/leaderboard/brought.ts
@@ -0,0 +1,92 @@
+/**
+ * Brought: what a person's machines did for the Swarm (contributor view, #2444; PRODUCT.md Contribution, Seen). Each machine
+ * they brought that the reader may see, a Mac's Harness Team account folded into its Mac, with the verified requests that
+ * shipped on it, its busy time on other people's tasks (lent.ts), and each contributed engine's weekly window. And the
+ * period's contributors: people whose machine ran an attempt. Pure, from what the board already holds.
+ */
+import type { ContributedMachine } from '../machines.js'
+import type { Conversation, SuperTabState } from '../model.js'
+import type { Run } from './record.js'
+import { within, type Span } from './rolling.js'
+import type { BroughtMachine } from './contract.js'
+
+/** The machine an attempt ran on: recorded with it, else (an attempt from before that) its agent's while the agent exists. */
+export function runMachine(state: SuperTabState, run: Pick<Run, 'machineId' | 'agentId'>): string | undefined {
+ return run.machineId ?? (run.agentId ? state.agents.find(a => a.id === run.agentId)?.machineId : undefined)
+}
+
+/** The machine the attempt a request shipped on ran on: the one kept when it shipped, else its last attempt by then. */
+export function shippedOnMachine(state: SuperTabState, group: Conversation): string | undefined {
+ const ledger = group.ledger!
+ const shipping = ledger.shippedBy ?? (ledger.runs ?? []).filter(r => r.at <= ledger.shippedAt!).at(-1)
+ if (!shipping) return undefined
+ // A ship recorded before machines were names its attempt; that attempt's run may still say where it ran.
+ return shipping.machineId ?? runMachine(state, ledger.runs?.find(r => r.assignmentId === shipping.assignmentId) ?? {})
+}
+
+/** Verified, as far as the server knows (PRODUCT.md north star): shipped with a pull request, and no fix merged after it. */
+export const verified = (group: Conversation): boolean =>
+ group.ledger?.shippedAt != null && (group.pullRequestUrls?.length ?? 0) > 0 && group.ledger.fixedAfterMergeAt == null
+
+/** The machine a pool stands for among [machines]: a Harness Team account's Mac when the reader sees it, else itself. */
+export function homeOf(machines: readonly ContributedMachine[], machineId: string): ContributedMachine | undefined {
+ const pool = machines.find(m => m.machineId === machineId)
+ return pool?.hostMachineId ? machines.find(m => m.machineId === pool.hostMachineId) ?? pool : pool
+}
+
+/** A window's reset as epoch milliseconds: vendors give a date, epoch seconds or milliseconds. */
+function resetMs(value: string | number | null | undefined): number | null {
+ if (typeof value === 'number' && Number.isFinite(value)) return value < 1e12 ? value * 1000 : value
+ if (typeof value === 'string') {
+ const parsed = Date.parse(value)
+ return Number.isNaN(parsed) ? null : parsed
+ }
+ return null
+}
+
+/** [engine]'s weekly window from the machine's last reading: percent used and its reset (epoch ms), null when unknown. */
+export function weeklyUse(pool: ContributedMachine, engine: string): { usedPercent: number | null; resetsAt: number | null } {
+ const quota = pool.observation?.quotas?.find(q => q.engine === engine)
+ const weekly = quota?.known ? quota.windows.find(w => w.name === 'weekly') : undefined
+ return { usedPercent: weekly ? weekly.usedPercent : null, resetsAt: weekly ? resetMs(weekly.resetsAt) : null }
+}
+
+/** Each contributed engine's weekly window. */
+const subscriptions = (pool: ContributedMachine): BroughtMachine['subscriptions'] =>
+ pool.engines.map(engine => ({ engine, ...weeklyUse(pool, engine) }))
+
+/**
+ * The machines [mine] (one person's, the reader's visible ones) as Brought rows: [shipped] the verified requests whose
+ * shipping attempt ran on each, [busyMs] each pool's lent time. Most shipped first, then busiest, then by name.
+ */
+export function broughtMachines(state: SuperTabState, mine: readonly ContributedMachine[], visible: readonly ContributedMachine[],
+ shippedRequests: readonly Conversation[], span: Span, busyMs: (pool: ContributedMachine) => number): BroughtMachine[] {
+ const rows = new Map<string, BroughtMachine & { busy: number }>()
+ for (const pool of mine) {
+ const home = homeOf(visible, pool.machineId) ?? pool
+ let row = rows.get(home.machineId)
+ if (!row) rows.set(home.machineId, row = { machineId: home.machineId, machineName: home.name, shipped: 0, busyHours: 0, subscriptions: subscriptions(home), busy: 0 })
+ row.busy += busyMs(pool)
+ }
+ for (const group of shippedRequests) {
+ if (!verified(group) || !within(group.ledger!.shippedAt!, span)) continue
+ const machineId = shippedOnMachine(state, group)
+ const home = machineId ? homeOf(visible, machineId) : undefined
+ const row = home && rows.get(home.machineId)
+ if (row) row.shipped++
+ }
+ return [...rows.values()].map(({ busy, ...row }) => ({ ...row, busyHours: Math.round(busy / 3_600_000 * 10) / 10 }))
+ .sort((a, b) => b.shipped - a.shipped || b.busyHours - a.busyHours || a.machineName.localeCompare(b.machineName))
+}
+
+/** The people whose machine, among [visible], ran an attempt in [span] on one of [groups]. */
+export function contributorsIn(state: SuperTabState, groups: readonly Conversation[], visible: readonly ContributedMachine[], span: Span): Set<string> {
+ const people = new Set<string>()
+ for (const run of groups.flatMap(g => g.ledger?.runs ?? [])) {
+ if (!within(run.at, span)) continue
+ const machineId = runMachine(state, run)
+ const pool = machineId ? visible.find(m => m.machineId === machineId) : undefined
+ if (pool) people.add(pool.contributorId)
+ }
+ return people
+}
diff --git a/backend/src/superTabs/leaderboard/contract.ts b/backend/src/superTabs/leaderboard/contract.ts
index 6536eb529..706d26979 100644
--- a/backend/src/superTabs/leaderboard/contract.ts
+++ b/backend/src/superTabs/leaderboard/contract.ts
@@ -16,6 +16,20 @@ export interface PersonDetails {
unblocked: Array<{ title: string; conversationId: string; kind: UnblockKind; waitedMinutes: number }>
/** Each machine's busy agent-hours this week, to one decimal, busiest first. */
lent: Array<{ machineName: string; busyHours: number }>
+ /** Every machine the person brought that the reader may see, a Harness Team account in its Mac's row: what it did this
+ * week (contributor view, #2444). Absent from a backend before it. Supersedes [lent] for clients that read it. */
+ brought: BroughtMachine[]
+}
+
+/** One machine a person brought. `shipped`: verified requests (shipped with a PR, no fix after merge) whose shipping attempt
+ * ran on it, anyone's; `busyHours`: its agents' time on other people's tasks, to one decimal; `subscriptions`: each
+ * contributed engine's weekly window from its last reading, `usedPercent` and `resetsAt` (epoch ms) null when unknown. */
+export interface BroughtMachine {
+ machineId: string
+ machineName: string
+ shipped: number
+ busyHours: number
+ subscriptions: Array<{ engine: string; usedPercent: number | null; resetsAt: number | null }>
}
export interface PersonScore {
@@ -115,4 +129,7 @@ export interface Leaderboard {
byModel: ModelScore[]
/** The models of the 7 days up to now, most attempts first. Absent from a backend before it. */
recentModels: RecentModel[]
+ /** People whose machine ran an attempt on the groups summed, this week and last, and how many of last week's ran again
+ * this week: PRODUCT.md's contributors per week and kept next week. Counts only. Absent from a backend before it. */
+ contributors: { thisWeek: number; lastWeek: number | null; kept: number | null }
}
diff --git a/backend/src/superTabs/leaderboard/record.test.ts b/backend/src/superTabs/leaderboard/record.test.ts
index 70df809ce..c55c13d40 100644
--- a/backend/src/superTabs/leaderboard/record.test.ts
+++ b/backend/src/superTabs/leaderboard/record.test.ts
@@ -129,6 +129,14 @@ describe('when a request ships', () => {
expect(f.group(id).ledger?.shippedAt).toBe(9_000)
})
+ it('records the machine each attempt ran on, and the attempt it shipped on keeps it (contributor view, #2444)', () => {
+ const f = fixture(), id = f.create(), { worker, assignmentId } = f.assign(id)
+ f.passChecks(id, assignmentId)
+ f.status(id, assignmentId, worker, 'done', 'Merged https://github.com/o/r/pull/7')
+ expect(f.group(id).ledger?.runs?.at(-1)?.machineId).toBe('host')
+ expect(f.group(id).ledger?.shippedBy?.machineId).toBe('host')
+ })
+
it('keeps the first ship time when the same group finishes again', () => {
const f = fixture(), id = f.create()
const first = f.assign(id)
@@ -629,7 +637,7 @@ describe('the model behind each assignment, and its first review (roadmap, Dec:
const id = f.create(owner, { checks: independent })
const { assignmentId, worker } = f.assign(id)
const harnessId = f.state.agents.find(a => a.id === worker)!.harnessId
- expect(f.group(id).ledger!.runs).toEqual([{ assignmentId, engine: 'claude', model: 'opus', effort: 'high', at: 5_000, agentId: worker, harnessId }])
+ expect(f.group(id).ledger!.runs).toEqual([{ assignmentId, engine: 'claude', model: 'opus', effort: 'high', at: 5_000, agentId: worker, harnessId, machineId: 'host' }])
})
it('records no effort that names none: what Claude Code reports as auto, or a start that left the engine its own', () => {
@@ -659,7 +667,7 @@ describe('the model behind each assignment, and its first review (roadmap, Dec:
report(worker, 'gpt-6.1-sol')
report(earlier, 'gpt-6.1-sol')
expect(f.group(id).ledger!.runs).toEqual([{ assignmentId, engine: 'codex', model: 'gpt-6.1-sol', effort: 'high', at: 1_000,
- agentId: worker, harnessId: f.state.agents.find(a => a.id === worker)!.harnessId }])
+ agentId: worker, harnessId: f.state.agents.find(a => a.id === worker)!.harnessId, machineId: 'host' }])
// A task finished before its agent's first report still takes it (Scholes, 2026-10-30): the agent ran that model all along.
expect(f.group(done).ledger!.runs![0]!.model).toBe('gpt-6.1-sol')
// A model on record is never rewritten by a later report.
@@ -753,7 +761,7 @@ describe('the model behind each assignment, and its first review (roadmap, Dec:
requirements: { memoryBytes: 1, diskBytes: 1, maxCpuPercent: 80, tools: [], devices: [], quotaRequired: false } } }]
const { assignmentId } = f.assign(id, worker)
expect(f.group(id).ledger!.runs).toEqual([{ assignmentId, engine: 'claude', model: 'moonshotai/kimi-k3', effort: 'high', grid: true, at: 1_000,
- agentId: worker, harnessId: f.state.agents.find(a => a.id === worker)!.harnessId }])
+ agentId: worker, harnessId: f.state.agents.find(a => a.id === worker)!.harnessId, machineId: 'host' }])
})
// Checks are information (project instructions, phase 4): every check is a review's, whatever `independent` says.
@@ -962,7 +970,7 @@ describe('the model behind each assignment, and its first review (roadmap, Dec:
f.at(6_000)
f.passChecks(id, assignmentId)
f.status(id, assignmentId, worker, 'done', 'Shipped at rev abc.')
- const shippedBy = { assignmentId, at: 5_000, engine: 'claude', model: 'opus', effort: 'high' }
+ const shippedBy = { assignmentId, at: 5_000, engine: 'claude', model: 'opus', effort: 'high', machineId: 'host' }
expect(f.group(id).ledger!.shippedBy).toEqual(shippedBy)
// Reopened and worked again on another model: the ship stays the first attempt's.
const other = f.add('other', id)
diff --git a/backend/src/superTabs/leaderboard/record.ts b/backend/src/superTabs/leaderboard/record.ts
index 5bcd2d5cf..a1cdb3ab8 100644
--- a/backend/src/superTabs/leaderboard/record.ts
+++ b/backend/src/superTabs/leaderboard/record.ts
@@ -22,6 +22,9 @@ export interface Run extends RanOn { assignmentId: string; at: number
/** The agent and its terminal that ran it, so the model that terminal reports later fills this attempt only (record
* ReportedModel). Absent from attempts recorded before them. */
agentId?: string; harnessId?: string
+ /** The machine it ran on, so a person's card can say what their machine shipped (contributor view, #2444). Absent from
+ * attempts recorded before it; the board then finds it by the agent while that agent exists (brought.ts runMachine). */
+ machineId?: string
firstVerdicts?: Record<string, boolean>; firstReview?: boolean
/** The step up from a cheaper model this attempt is, on a task stepped up before project instructions: its attempt number and why. */
stepUp?: { attempt: number; reason: string }
@@ -69,7 +72,7 @@ export interface GroupLedger {
firstAssignedAt?: number
/** The attempt it shipped on, and what that ran on, kept from the moment it shipped: a later attempt or older attempts
* rolling off never move its model's credit (review of #2097). */
- shippedBy?: RanOn & { assignmentId: string; at: number }
+ shippedBy?: RanOn & { assignmentId: string; at: number; machineId?: string }
/** Who led the group when it shipped, null for nobody: the PM's credit, kept whoever leads it later (review of #2097). */
shippedLeadId?: string | null
/** Review verdicts by week and model, for the last LEDGER_WEEKS weeks, oldest first. */
@@ -246,7 +249,7 @@ export function waitsNow(group: Conversation): boolean {
/** An assignment records what its agent runs on (ranOn), for the board's models. */
export function recordRun(state: SuperTabState, group: Conversation, assignment: Assignment, worker: Agent, now: number): void {
const run: Run = { assignmentId: assignment.id, ...ranOn(state, worker, assignment.configuration), at: now,
- agentId: worker.id, harnessId: worker.harnessId,
+ agentId: worker.id, harnessId: worker.harnessId, machineId: assignment.execution.machineId,
...(group.stepUp ? { stepUp: { attempt: group.stepUp.attempt, reason: group.stepUp.reason } } : {}),
...(agentTarget(state, worker).launchedDefault ? { engineDefault: true as const } : {}) }
const ledger = group.ledger ??= {}
diff --git a/backend/src/superTabs/leaderboard/stats.ts b/backend/src/superTabs/leaderboard/stats.ts
index 4b8234c3a..32eea32a5 100644
--- a/backend/src/superTabs/leaderboard/stats.ts
+++ b/backend/src/superTabs/leaderboard/stats.ts
@@ -10,6 +10,7 @@ import { isBuddy, isSwarmBuddy } from '../buddies.js'
import { agentProjectId, canReadProject, projectOf } from '../projects.js'
import { firstAssignedAt, waitedOn, waitsNow, type RanOn, type Unblock } from './record.js'
import { lentIn, periodSpans, reviewsIn, weekSpan, within, type PeriodName, type Span } from './rolling.js'
+import { broughtMachines, contributorsIn } from './brought.js'
import { DAY_MS, WEEK_MS } from './week.js'
import type { AgentScore, Leaderboard, Medal, ModelScore, ModelShare, PersonDetails, PersonScore, RecentModel, WeekGoal } from './contract.js'
@@ -72,8 +73,8 @@ export function leaderboard({ state, groups, machines: visibleMachines, projectI
const score = (personId: string, span: Span) => {
const shippedHere = (landedBy.get(personId) ?? []).filter(g => within(g.ledger!.shippedAt!, span))
const answers = (answersBy.get(personId) ?? []).filter(u => within(u.at, span))
- const machines = (machinesBy.get(personId) ?? [])
- .map(m => ({ name: m.name, busyMs: lentIn(m, span, now, { projects: projectIds, unsplit: sharesBoard(personId) }) })).filter(m => m.busyMs > 0)
+ const lentOf = (m: ContributedMachine) => lentIn(m, span, now, { projects: projectIds, unsplit: sharesBoard(personId) })
+ const machines = (machinesBy.get(personId) ?? []).map(m => ({ name: m.name, busyMs: lentOf(m) })).filter(m => m.busyMs > 0)
const freedMs = sum(answers.map(u => u.waitedMs)), lentMs = sum(machines.map(m => m.busyMs))
const points = shippedHere.length * SHIPPED_POINTS + sum(answers.map(unblockPoints)) + Math.floor(lentMs / (LENT_HOURS_PER_POINT * HOUR_MS))
const details: PersonDetails = {
@@ -83,6 +84,7 @@ export function leaderboard({ state, groups, machines: visibleMachines, projectI
.map(u => ({ title: u.group.title, conversationId: u.group.id, kind: u.kind ?? 'needs_human', waitedMinutes: Math.round(u.waitedMs / 60_000) })),
lent: [...machines].sort((a, b) => b.busyMs - a.busyMs).slice(0, DETAILS_LIMIT)
.map(m => ({ machineName: m.name, busyHours: Math.round(m.busyMs / HOUR_MS * 10) / 10 })),
+ brought: broughtMachines(state, machinesBy.get(personId) ?? [], visibleMachines, shippedRequests, span, lentOf).slice(0, DETAILS_LIMIT),
}
return {
points,
@@ -106,6 +108,7 @@ export function leaderboard({ state, groups, machines: visibleMachines, projectI
return { ...entry, rank, medal: entry.points > 0 ? MEDALS[rank - 1] ?? null : null, details }
})
const shippedNow = shippedRequests.filter(g => within(g.ledger!.shippedAt!, current))
+ const ranNow = contributorsIn(state, shared, visibleMachines, current), ranBefore = previous && contributorsIn(state, shared, visibleMachines, previous)
return {
projectId, week,
...period ? { period: { name: period, start: current.start, end: now } } : {},
@@ -117,6 +120,7 @@ export function leaderboard({ state, groups, machines: visibleMachines, projectI
agents: agentScores(state, projectIds, shippedNow, visibleMachines),
byModel: modelScores(requests, shippedNow, current),
recentModels: recentModels(requests.filter(g => (g.projectId ?? 'lead') === projectId), now),
+ contributors: { thisWeek: ranNow.size, lastWeek: ranBefore?.size ?? null, kept: ranBefore ? [...ranBefore].filter(id => ranNow.has(id)).length : null },
}
}
diff --git a/backend/src/superTabs/liveness.ts b/backend/src/superTabs/liveness.ts
index f46030135..bdd37d825 100644
--- a/backend/src/superTabs/liveness.ts
+++ b/backend/src/superTabs/liveness.ts
@@ -4,7 +4,7 @@ import { failedSessionStart } from './buddySessions.js'
import { noteStartFailed } from './engineHealth.js'
import { machineOffline, sessionStopped } from './lostReason.js'
import { agentDisplayName } from './agentNames.js'
-import { askedModel, coordinatorCopy, failureNotice, failureRecipients, leadPickupSuffix, STILL_PREPARING_SUFFIX, STOPPED_REPORTING_SUFFIX, TIMED_OUT_SUFFIX } from './startFailure.js'
+import { askedModel, coordinatorCopy, failureNotice, failureRecipients, leadPickupSuffix, REFUSED_INFIX, STILL_PREPARING_SUFFIX, STOPPED_REPORTING_SUFFIX, TIMED_OUT_SUFFIX } from './startFailure.js'
import { leadOf, toLead } from './terminal.js'
import { dropIdleBuddyMachines, MACHINE_FRESH_MS } from './machines.js'
import { leadStartFailed } from './leadStart.js'
@@ -576,30 +576,51 @@ function failStalledStarts(state: SuperTabState, now: number): MessageDraft[] {
const machine = machineName(state, start.request.machineId)
start.error = `${machine}${!named ? TIMED_OUT_SUFFIX : silent ? STOPPED_REPORTING_SUFFIX : STILL_PREPARING_SUFFIX}`
// Counted as a host's failure is (commands.ts agent.startFailed); the one that suspends its engine says so once.
- const suspended = noteStartFailed(state, start, now)
- if (start.request.leadFor) return leadNotice(state, start, leadStartFailed(state, start, start.error))
- // Never a lookup that throws: these checks run inside every machine's report.
- if (start.request.buddyOf) return start.request.buddySession ? failedSessionStart(state, start) : buddyNotice(state, start)
- const group = state.conversations.find(c => c.id === start.request.conversationId)
- // Recorded in this write: once the start has ended, no later poll loads it.
- if (group) recordTaskState(state, group, now)
- if (!group) return []
- // Told to the coordinator and the agent that made it, with the model it asked for; nothing is started elsewhere (project
- // instructions, phase 4, decision 18).
- const text = `${failureNotice(start.request.name, start.error, askedModel(start), coordinatorOfGroup(state, group))}${suspended ? `\n\n${suspended}` : ''}`
- const source = { kind: 'start-timeout', startId: start.id }
- const author = failureAuthor(state, start, group)
- if (!author) return []
- const recipients = failureRecipients(start, group)
- const row = reachable(state, { id: stableId('start-timeout', start.id), conversationId: group.id, replyTo: null, recipients,
- author, text, ...(suspended && start.machineOwnerId ? { mentions: [start.machineOwnerId] } : {}), source })
- // A task with no lead, or one its lead left: its coordinator hears it in its own chat.
- const copy = coordinatorCopy(state, group, recipients)
- return copy ? [row, reachable(state, { id: stableId('start-timeout', start.id, 'coordinator'), conversationId: copy.conversationId, replyTo: null,
- recipients: [copy.coordinator], author, text, source: forRecipients(source) })] : [row]
+ return failedStartNotices(state, start, now, noteStartFailed(state, start, now))
})
}
+/**
+ * Fails at once each start that machine [machineId]'s reading names refused: the server refused that machine's own report for
+ * it, so it would otherwise wait out the 3 minutes with the reason in that machine's log alone (task #2441). Only a reading
+ * the store took from that machine's own pool names one, and only one of its starts that neither runs nor failed
+ * (machines.ts refusableStart). A refusal is no failure of its engine, so it suspends nothing.
+ */
+export function failRefusedStarts(state: SuperTabState, machineId: string, now: number): MessageDraft[] {
+ const refused = state.machines?.find(m => m.machineId === machineId)?.observation?.refusedStarts ?? []
+ return refused.flatMap(({ startId, reason }) => {
+ const start = state.starts?.find(s => s.id === startId)
+ if (!start || start.request.machineId !== machineId || start.harnessId || start.error) return []
+ start.error = `${machineName(state, machineId)}${REFUSED_INFIX}${reason}`
+ return failedStartNotices(state, start, now, null)
+ })
+}
+
+/** Who hears that [start] failed, and what they read: its Lead, its Buddy's person, or its task's coordinator and the agent
+ * that made it. [suspended]: the line saying its engine is now suspended there, if this failure suspended it. */
+function failedStartNotices(state: SuperTabState, start: AgentStart, now: number, suspended: string | null): MessageDraft[] {
+ if (start.request.leadFor) return leadNotice(state, start, leadStartFailed(state, start, start.error!))
+ // Never a lookup that throws: these checks run inside every machine's report.
+ if (start.request.buddyOf) return start.request.buddySession ? failedSessionStart(state, start) : buddyNotice(state, start)
+ const group = state.conversations.find(c => c.id === start.request.conversationId)
+ // Recorded in this write: once the start has ended, no later poll loads it.
+ if (group) recordTaskState(state, group, now)
+ if (!group) return []
+ // Told to the coordinator and the agent that made it, with the model it asked for; nothing is started elsewhere (project
+ // instructions, phase 4, decision 18).
+ const text = `${failureNotice(start.request.name, start.error!, askedModel(start), coordinatorOfGroup(state, group))}${suspended ? `\n\n${suspended}` : ''}`
+ const source = { kind: 'start-timeout', startId: start.id }
+ const author = failureAuthor(state, start, group)
+ if (!author) return []
+ const recipients = failureRecipients(start, group)
+ const row = reachable(state, { id: stableId('start-timeout', start.id), conversationId: group.id, replyTo: null, recipients,
+ author, text, ...(suspended && start.machineOwnerId ? { mentions: [start.machineOwnerId] } : {}), source })
+ // A task with no lead, or one its lead left: its coordinator hears it in its own chat.
+ const copy = coordinatorCopy(state, group, recipients)
+ return copy ? [row, reachable(state, { id: stableId('start-timeout', start.id, 'coordinator'), conversationId: copy.conversationId, replyTo: null,
+ recipients: [copy.coordinator], author, text, source: forRecipients(source) })] : [row]
+}
+
/** Who a failed start's notice is written as: its task's lead, else the agent that made the start, else its project's
* coordinator, else the Swarm's owner, so it is never left unsaid (final review). Undefined only with none of them. */
function failureAuthor(state: SuperTabState, start: AgentStart, group: Conversation): Author | undefined {
diff --git a/backend/src/superTabs/machines.ts b/backend/src/superTabs/machines.ts
index 590aa5305..1c1598eb0 100644
--- a/backend/src/superTabs/machines.ts
+++ b/backend/src/superTabs/machines.ts
@@ -48,6 +48,9 @@ export interface ContributedMachine {
lent?: import('./leaderboard/lent.js').LentWeek[]
/** The same by day, for the board's rolling periods. Only the leaderboard read gets it (model.ts visibleState). */
lentDays?: import('./leaderboard/lent.js').LentDay[]
+ /** The leaderboard week (Monday 00:00 UTC) its owner was last told someone else's work started here (othersWork.ts): once
+ * a week. On a Mac, for its Harness Team account too. Kept when the contribution is saved again. */
+ othersToldWeek?: number
/** The projects whose agents may run here, set by its owner (commands.ts machine.projects, Tony 11-03); absent: every
* project, as before. A Mac's Harness Team account keeps none of its own: it follows its Mac's (machineProjectRefusal). */
projects?: string[]
@@ -165,6 +168,11 @@ export const machineObservationSchema = z.object({ generation: z.string().max(16
* the engine), as of this report. Such a start waits past the 3 minutes while reports keep naming it (liveness.ts);
* the store keeps only this machine's own launched starts. Absent from hosts before it, whose starts get 3 minutes. */
preparingStartIds: z.array(z.string().min(1).max(160)).max(100).optional(),
+ /** The starts on this machine whose host reports the server refused, each with the refusal (cli superTabs/machines.ts): each
+ * fails at once (liveness.ts failRefusedStarts), where it waited out the 3 minutes with its reason in the machine's log alone
+ * (task #2441). The store keeps only this machine's own starts that neither run nor failed; no reader reads them. Absent from
+ * hosts before it. */
+ refusedStarts: z.array(z.object({ startId: z.string().min(1).max(160), reason: z.string().min(1).max(300) }).strict()).max(100).optional(),
/** What this host can launch beyond workers: `leadStart`, a project's Product Manager (leadStart.ts). Absent from hosts
* before it, which are never given one. */
capabilities: z.array(z.string().regex(/^[a-zA-Z]{1,40}$/)).max(16).optional(),
@@ -186,25 +194,32 @@ export type StoredReading = NonNullable<ContributedMachine['observation']>
export const preparableStart = (start: AgentStart, machineId: string): boolean =>
start.request.machineId === machineId && !!start.dispatched && !start.harnessId && !start.error
+/** A start this machine may say the server refused: one of its own that neither runs nor failed, launched or not. */
+export const refusableStart = (start: AgentStart, machineId: string): boolean =>
+ start.request.machineId === machineId && !start.harnessId && !start.error
+
/**
* What a report stores of [observation] on [pool]: progress and tokens of running sessions only (leases and attempts read
- * them), the preparing starts [preparable] allows, the contributed engines' quotas, privacy only from a team session
+ * them), the preparing starts [preparable] allows, the refused starts [refusable] allows, the contributed engines' quotas, privacy only from a team session
* (observedPrivacy), and how the machine is signed in, from the session and never from the report (lib/teamSession.ts).
* A full report and a reading-only one (DB 2.5) store the same.
*/
export function storedObservation(pool: ContributedMachine, observation: MachineObservation,
- opts: { team: boolean; now: number; preparable: (startId: string) => boolean }): StoredReading {
- const { privacy: reported, harnessProgress, harnessTokens, preparingStartIds, profiles, ...reading } = observation
+ opts: { team: boolean; now: number; preparable: (startId: string) => boolean; refusable?: (startId: string) => boolean }): StoredReading {
+ const { privacy: reported, harnessProgress, harnessTokens, preparingStartIds, refusedStarts, profiles, ...reading } = observation
const running = (id: string) => observation.runningHarnessIds.includes(id)
const progress = harnessProgress && Object.fromEntries(Object.entries(harnessProgress).filter(([id]) => running(id)))
const tokens = harnessTokens && Object.fromEntries(Object.entries(harnessTokens).filter(([id]) => running(id)))
const preparing = preparingStartIds?.filter(opts.preparable)
+ // None unless the caller can tell which starts this machine may name (refusableStart).
+ const refused = refusedStarts?.filter(r => opts.refusable?.(r.startId) ?? false)
const privacy = observedPrivacy(pool.observation?.privacy, reported, opts.team, opts.now)
const engines = contributedEngines(pool, observation)
return { ...reading, quotas: observation.quotas.filter(q => engines.includes(q.engine)), receivedAt: opts.now,
...(profiles ? { profiles: profiles.filter(p => engines.includes(p.engine)) } : {}),
sessionKind: opts.team ? 'team' : 'computer', ...(privacy ? { privacy } : {}), ...(progress ? { harnessProgress: progress } : {}),
- ...(tokens ? { harnessTokens: tokens } : {}), ...(preparing ? { preparingStartIds: preparing } : {}) }
+ ...(tokens ? { harnessTokens: tokens } : {}), ...(preparing ? { preparingStartIds: preparing } : {}),
+ ...(refused?.length ? { refusedStarts: refused } : {}) }
}
const sameSet = (a: readonly string[] = [], b: readonly string[] = []) => {
@@ -214,14 +229,15 @@ const sameSet = (a: readonly string[] = [], b: readonly string[] = []) => {
/**
* Whether [next] changes nothing a report decides from, against [previous] (DB 2.5 spec, section 1 condition 2): the same
- * running and stopped sessions, no stop proof, the same preparing starts. Progress renews leases (liveness.ts
+ * running and stopped sessions, no stop proof, no refused start, the same preparing starts. Progress renews leases (liveness.ts
* reportRenewedAt), so it also keeps its shape, and no session's progress goes back: a lease then ends no sooner than the
* last full report saw.
*/
export function readingOnly(previous: StoredReading | undefined, next: StoredReading): boolean {
// How the machine is signed in decides who may host it (store.ts teamByRecord reads the stored one): a reading from the
// other kind of session runs in full, so the full report's refusal is never skipped (review of #2378).
- if (!previous || next.stoppedReservations?.length || previous.sessionKind !== next.sessionKind) return false
+ // A refused start fails in the full report, which reads the Swarm's starts (store.ts fullReading).
+ if (!previous || next.stoppedReservations?.length || next.refusedStarts?.length || previous.sessionKind !== next.sessionKind) return false
if (!sameSet(previous.runningHarnessIds, next.runningHarnessIds) || !sameSet(previous.stoppedHarnessIds, next.stoppedHarnessIds)
|| !sameSet(previous.preparingStartIds, next.preparingStartIds)) return false
if (!previous.harnessProgress || !next.harnessProgress) return !previous.harnessProgress && !next.harnessProgress
diff --git a/backend/src/superTabs/model.ts b/backend/src/superTabs/model.ts
index 75354f085..8235ae6cd 100644
--- a/backend/src/superTabs/model.ts
+++ b/backend/src/superTabs/model.ts
@@ -601,6 +601,8 @@ export const NOTICE_READERS = {
switch: 'people',
// The machine owner's one line when another person moves a PM onto one of their non-default accounts (commands.ts agent.switchResult).
'pm-switch-notice': 'people',
+ // The machine owner's line, once a week, when someone else's work starts on their machine (othersWork.ts).
+ 'others-work-notice': 'people',
'start-timeout': 'people', 'terminal-alert': 'people', 'terminal-input': 'people',
} as const satisfies Record<string, 'people' | 'recipients' | 'agent'>
const readersOf = (kind: unknown): 'people' | 'recipients' | 'agent' =>
@@ -920,6 +922,8 @@ export function visibleState(state: SuperTabState, actor: Actor, now = Date.now(
if (pool.observation.harnessProgress) pool.observation.harnessProgress = Object.fromEntries(Object.entries(pool.observation.harnessProgress).filter(([id]) => harnesses.has(id)))
// Each attempt's tokens are read through the cost summary (costs/read.ts), never from the machine's raw counts.
delete pool.observation.harnessTokens
+ // What the server refused this machine's host is for the sweep alone (liveness.ts failRefusedStarts), never a reader.
+ delete pool.observation.refusedStarts
if (pool.observation.stoppedReservations) pool.observation.stoppedReservations = pool.observation.stoppedReservations.filter(r => harnesses.has(r.harnessId))
if (pool.observation.preparingStartIds) pool.observation.preparingStartIds = pool.observation.preparingStartIds.filter(id => visible.starts?.some(s => s.id === id))
}
diff --git a/backend/src/superTabs/othersWork.test.ts b/backend/src/superTabs/othersWork.test.ts
new file mode 100644
index 000000000..497c52a4d
--- /dev/null
+++ b/backend/src/superTabs/othersWork.test.ts
@@ -0,0 +1,95 @@
+import { describe, expect, it } from 'vitest'
+import { applyCommand, commandSchema, type Command, type CommandContext } from './commands.js'
+import type { ContributedMachine } from './machines.js'
+import { createSuperTab, type Actor, type AgentConfiguration, type SuperTabState } from './model.js'
+import { DAY_MS, WEEK_MS, weekStart } from './leaderboard/week.js'
+import { othersWorkNotice } from './othersWork.js'
+
+// Contributor view (#2444): a machine's owner hears, once a week per machine, when someone else's work starts on it.
+const owner: Extract<Actor, { kind: 'person' }> = { kind: 'person', userId: 'owner', email: '[email protected]' }
+const peer: Extract<Actor, { kind: 'person' }> = { kind: 'person', userId: 'peer', email: '[email protected]' }
+const config: AgentConfiguration = { engine: 'claude', model: 'opus', effort: 'high', contextWindow: null, engineVersion: null }
+// Thursday 2026-10-29 noon UTC.
+const NOW = Date.UTC(2026, 9, 29, 12)
+const NOTICE = 'others-work-notice'
+
+function fixture() {
+ let state: SuperTabState = createSuperTab('tab', 'Pilot', { id: 'owner', email: owner.email }, 'prod')
+ let sequence = 0, now = NOW
+ const run = (command: Command, actor: Actor = owner, context: Partial<CommandContext> = {}) => {
+ const effects = applyCommand(state, actor, command, { now, operationId: `op-${++sequence}`, ...context })
+ state = effects.state
+ return effects
+ }
+ const invited = run({ type: 'invite.create', email: peer.email, role: 'collaborator', conversationId: 'lead' })
+ run({ type: 'invite.accept', inviteId: invited.result.inviteId as string }, peer)
+ // The owner's Mac Studio, contributed, with its Claude subscription's week read.
+ const pool: ContributedMachine = { machineId: 'host', name: 'Mac Studio', contributorId: 'owner', membershipGeneration: state.people[0]!.generation,
+ generation: 'g1', cwd: '/repo', scope: 'swarm', engines: ['claude'], maxAgents: 4, paused: false,
+ observation: { receivedAt: NOW, runningHarnessIds: [], stoppedHarnessIds: [], quotas: [{ engine: 'claude', known: true, windows: [{ name: 'weekly', usedPercent: 38, resetsAt: NOW + 3 * DAY_MS }] }] } as never }
+ state.machines = [pool]
+ const add = (harnessId: string, group = 'lead', lead = false) => run({ type: 'agent.add', conversationId: group, machineId: 'host', harnessId,
+ name: harnessId, configuration: config, lead }, owner, { contribution: { machineOwnerId: 'owner', contributorId: 'owner' } }).result.agentId as string
+ const create = (actor: Actor, extra: Record<string, unknown> = {}) =>
+ run(commandSchema.parse({ type: 'conversation.create', title: 'Fix login', brief: 'Fix it.', checks: [], ...extra }), actor).result.conversationId as string
+ const assign = (id: string, worker = add(`worker-${id}`, id)) => run({ type: 'work.assign', conversationId: id, agentId: worker })
+ const told = (effects: ReturnType<typeof run>) => effects.messages.filter(m => (m.source as { kind?: string } | undefined)?.kind === NOTICE)
+ const buddyChat = () => state.conversations.find(c => c.kind === 'swarm-buddy')
+ return { run, add, create, assign, told, buddyChat, get state() { return state }, at(ms: number) { now = ms } }
+}
+
+describe('the owner hears when someone else\'s work starts on their machine', () => {
+ it('tells the owner in their own Buddy chat, naming who, the task, the machine and its week', () => {
+ const f = fixture(), id = f.create(peer)
+ const told = f.told(f.assign(id))
+ expect(told).toEqual([expect.objectContaining({ conversationId: f.buddyChat()!.id, recipients: [], source: { kind: NOTICE, machineId: 'host' },
+ text: 'peer\'s work "Fix login" started on your Mac Studio (Claude, 38% of this week used, resets in 3d). '
+ + 'Members › your card shows what it runs and ships; Manage › Machines can pause new work.' })])
+ expect(f.buddyChat()!.audience).toEqual({ people: [{ id: 'owner', generation: f.state.people[0]!.generation }] })
+ expect(f.state.machines![0]!.othersToldWeek).toBe(weekStart(NOW))
+ })
+
+ it('tells once a week per machine: not again this week, again next week', () => {
+ const f = fixture()
+ expect(f.told(f.assign(f.create(peer)))).toHaveLength(1)
+ expect(f.told(f.assign(f.create(peer)))).toHaveLength(0)
+ f.at(NOW + WEEK_MS)
+ expect(f.told(f.assign(f.create(peer)))).toHaveLength(1)
+ })
+
+ it('says nothing for the owner\'s own request, a PM\'s work or a private chat', () => {
+ const f = fixture()
+ expect(f.told(f.assign(f.create(owner)))).toHaveLength(0)
+ const pm = f.add('pm', 'lead', true)
+ expect(f.state.conversations.find(c => c.id === 'lead')!.leadId).toBe(pm)
+ expect(f.state.machines![0]!.othersToldWeek).toBeUndefined()
+ })
+
+ it('says the reset is unknown when its week was never read, and still tells', () => {
+ const f = fixture()
+ f.state.machines![0]!.observation = undefined
+ expect(f.told(f.assign(f.create(peer)))[0]!.text).toBe('peer\'s work "Fix login" started on your Mac Studio (Claude). '
+ + 'Members › your card shows what it runs and ships; Manage › Machines can pause new work.')
+ })
+
+ it('names neither the task nor its project to an owner who may not read that project', () => {
+ const f = fixture(), id = f.create(owner), worker = f.add('worker', id)
+ // The machine is the peer's, and the owner's project is private with no members: the peer may not read it.
+ f.state.machines![0]!.contributorId = 'peer'
+ f.state.projects = [{ id: 'lead', name: 'Pilot', ownerId: 'owner', leadConversationId: 'lead', visibility: 'private', members: [], updateMinutes: 5 }]
+ const group = f.state.conversations.find(c => c.id === id)!, agent = f.state.agents.find(a => a.id === worker)!
+ const told = othersWorkNotice(f.state, group, agent, NOW, 'Claude')
+ expect(told?.text).toBe('owner\'s work started on your Mac Studio (Claude, 38% of this week used, resets in 3d). '
+ + 'Members › your card shows what it runs and ships; Manage › Machines can pause new work.')
+ expect(f.state.conversations.find(c => c.id === told!.conversationId)!.audience)
+ .toEqual({ people: [{ id: 'peer', generation: f.state.people.find(p => p.id === 'peer')!.generation }] })
+ })
+
+ it('keeps the week told when the owner saves the machine\'s settings again', () => {
+ const f = fixture()
+ f.assign(f.create(peer))
+ f.run({ type: 'machine.contribute', machineId: 'host', name: 'Mac Studio', cwd: '/repo', engines: ['claude'], maxAgents: 4 } as Command, owner,
+ { contribution: { machineOwnerId: 'owner', contributorId: 'owner' } })
+ expect(f.state.machines!.find(m => m.machineId === 'host')!.othersToldWeek).toBe(weekStart(NOW))
+ })
+})
diff --git a/backend/src/superTabs/othersWork.ts b/backend/src/superTabs/othersWork.ts
new file mode 100644
index 000000000..06f54c81d
--- /dev/null
+++ b/backend/src/superTabs/othersWork.ts
@@ -0,0 +1,45 @@
+/**
+ * A machine's owner hears when someone else's work starts on it (contributor view, #2444; PRODUCT.md Contribution, Seen:
+ * "their quota is never drained without them knowing"). Once per machine per leaderboard week, in their own Buddy chat, in
+ * the server's words; the person card shows the rest. Someone else's work is what Lent counts (leaderboard/lent.ts): a
+ * task its machine's contributor did not ask for, never a PM's or a private chat's.
+ */
+import { openSwarmBuddyChat } from './buddies.js'
+import { homeOf, weeklyUse } from './leaderboard/brought.js'
+import { weekStart } from './leaderboard/week.js'
+import { isLeads, type Agent, type Conversation, type SuperTabState } from './model.js'
+import { canReadProject, groupProject, ledProject } from './projects.js'
+import { usernameOf } from './usernames.js'
+
+/** "3d", "5h", "20m": how long until [ms] from [now], as the Machines screen says a reset. */
+function until(ms: number, now: number): string {
+ const left = Math.max(0, ms - now)
+ if (left >= 86_400_000) return `${Math.floor(left / 86_400_000)}d`
+ if (left >= 3_600_000) return `${Math.floor(left / 3_600_000)}h`
+ return `${Math.max(1, Math.floor(left / 60_000))}m`
+}
+
+/**
+ * The notice for [worker] taking [group]'s work at [now], or null when it is not someone else's work on a contributed
+ * machine, or its owner was told this week. Marks the machine (its Mac, for a Harness Team account) told this week.
+ * [engineName]: how the server names the worker's engine ("Claude").
+ */
+export function othersWorkNotice(state: SuperTabState, group: Conversation, worker: Agent, now: number, engineName: string):
+ { conversationId: string; machineId: string; text: string } | null {
+ if (group.audience || isLeads(group) || ledProject(state, worker.id)) return null
+ const pool = state.machines?.find(m => m.machineId === worker.machineId)
+ if (!pool || pool.buddyOnly || group.requesterId === pool.contributorId) return null
+ const owner = state.people.find(p => p.id === pool.contributorId)
+ if (!owner) return null
+ const home = homeOf(state.machines ?? [], pool.machineId) ?? pool, week = weekStart(now)
+ if (home.othersToldWeek === week) return null
+ home.othersToldWeek = week
+ const requester = group.requesterId && (usernameOf(state, group.requesterId) ?? state.people.find(p => p.id === group.requesterId)?.email)
+ // The task's title only to an owner who reads its project: their Buddy chat is no way into a project they are not in.
+ const readable = canReadProject(state, { kind: 'person', userId: owner.id, email: owner.email }, groupProject(state, group))
+ const use = weeklyUse(home, worker.configuration.engine)
+ const used = use.usedPercent == null ? '' : `, ${Math.round(use.usedPercent)}% of this week used${use.resetsAt == null ? '' : `, resets in ${until(use.resetsAt, now)}`}`
+ return { conversationId: openSwarmBuddyChat(state, owner).id, machineId: pool.machineId,
+ text: `${requester ? `${requester}'s` : 'A teammate\'s'} work${readable ? ` "${group.title}"` : ''} started on your ${home.name} (${engineName}${used}). `
+ + 'Members › your card shows what it runs and ships; Manage › Machines can pause new work.' }
+}
diff --git a/backend/src/superTabs/projects.ts b/backend/src/superTabs/projects.ts
index 5f2af48e0..b69f54f69 100644
--- a/backend/src/superTabs/projects.ts
+++ b/backend/src/superTabs/projects.ts
@@ -370,7 +370,7 @@ export const accountOf = (agent: Pick<Agent, 'machineId' | 'machineOwnerId'>, on
/** Notices the server writes in its own words under an agent's name (security reviews of #2570): they quote no agent, task
* titles and names aside. */
-const SERVER_WORDS: ReadonlySet<unknown> = new Set(['work-stalled', 'work-resumed', 'idle', 'review-capacity', 'overlap', 'pm-switch-notice'])
+const SERVER_WORDS: ReadonlySet<unknown> = new Set(['work-stalled', 'work-resumed', 'idle', 'review-capacity', 'overlap', 'pm-switch-notice', 'others-work-notice'])
/** Whose words a row carries, for the mark of another account's (audit M3): its author's (a post, a status row, a brief, a
* route's reason); a lost task's notice, its worker's last result; none, a notice in the server's own words. A review's
* failed findings name no reviewer: they count as unknown, which is marked. */
diff --git a/backend/src/superTabs/startFailure.ts b/backend/src/superTabs/startFailure.ts
index 510fc8102..7f977d409 100644
--- a/backend/src/superTabs/startFailure.ts
+++ b/backend/src/superTabs/startFailure.ts
@@ -13,6 +13,9 @@ export const TIMED_OUT_SUFFIX = ' did not start it within 3 minutes'
/** liveness.ts writes these after a machine named the start as preparing: past its limit, or with its reports stopped. */
export const STILL_PREPARING_SUFFIX = ' was still preparing it after 15 minutes'
export const STOPPED_REPORTING_SUFFIX = ' stopped reporting while preparing it'
+/** liveness.ts failRefusedStarts writes `<machine name> refused it: <the server's refusal>`, which members read as a machine
+ * failure (publicReason); whoever made it, its coordinator and its machine's owner read the refusal (task #2441). */
+export const REFUSED_INFIX = ' refused it: '
/** liveness.ts writes this after a machine named a coordinator's start that it never took (leadStart.ts), with the name its
* project calls it. */
export const leadPickupSuffix = (name: string) => ` did not start this ${name}. Harness there may need an update.`
diff --git a/backend/src/superTabs/store.ts b/backend/src/superTabs/store.ts
index ddd2d9848..00251e7d3 100644
--- a/backend/src/superTabs/store.ts
+++ b/backend/src/superTabs/store.ts
@@ -1,5 +1,5 @@
import { writeReactionActivity, writeReplyActivity } from './activity.js'
-import { accountMachineName, expireRemovals, followAccountName, LASTING_TEAM_REFUSALS, machineContribution, machineObservationSchema, slotCounter, machineTeamWork, preparableStart, readingOnly, recordAgentPresence, renamedBy, removalPreview, startPreparing, storedObservation, swarmGridRow, teamAccountRequired, teamWorkRefusal, type MachineObservation } from './machines.js'
+import { accountMachineName, expireRemovals, followAccountName, LASTING_TEAM_REFUSALS, machineContribution, machineObservationSchema, slotCounter, machineTeamWork, preparableStart, readingOnly, refusableStart, recordAgentPresence, renamedBy, removalPreview, startPreparing, storedObservation, swarmGridRow, teamAccountRequired, teamWorkRefusal, type MachineObservation } from './machines.js'
import { readingClearsSuspensions, suspendedEngines } from './engineHealth.js'
import { BUDDY_OWN_MACHINE_REFUSAL } from './buddyContract.js'
import { createHash } from 'node:crypto'
@@ -48,7 +48,7 @@ import { digestDue, digestMessageId, digestOf, digestRequest, digestSince } from
import { moveChatMark } from './read/threadMarkSeeds.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 { failRefusedStarts, judgedMachines, loseTasks, nextLossAt, sweepForLead, sweepLiveness, SWEEP_EVERY_MS, unpurgedNotice } from './liveness.js'
import { archivable, archiveLine, archiveWaitsFor, 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'
import { groupsBy, listingDrops, quietSince, readBy, withoutHints } from './parts/indexed.js'
@@ -3091,7 +3091,9 @@ export class SuperTabStore {
// Renamed by its owner since: the full report renames it, and its Team account's pools with it (#2308).
if (renamedBy(pool, accountMachineName(host.owned))) return null
const data = structuredClone(part.data), mine = data.contribution!
- const reading = storedObservation(mine, observation, { team: isTeamSession(user), now, preparable: id => record.preparable.includes(id) })
+ // A reading naming a refused start is never only a reading (machines.ts readingOnly): the full report fails it.
+ const reading = storedObservation(mine, observation, { team: isTeamSession(user), now, preparable: id => record.preparable.includes(id),
+ refusable: () => true })
if (!readingOnly(mine.observation, reading)) return null
addLent(mine, now, record.lentCount, record.lentProjects)
mine.observation = reading
@@ -3179,7 +3181,8 @@ export class SuperTabStore {
if (!state.machines?.includes(pool)) return saved()
recordAgentPresence(state, machineId, observation.runningHarnessIds, now)
const reading = storedObservation(pool, observation, { team: isTeamSession(user), now,
- preparable: id => !!state.starts?.some(s => s.id === id && preparableStart(s, machineId)) })
+ preparable: id => !!state.starts?.some(s => s.id === id && preparableStart(s, machineId)),
+ refusable: id => !!state.starts?.some(s => s.id === id && refusableStart(s, machineId)) })
accrueLent(state, pool, now)
pool.observation = reading
// The name its owner gave it in Machines, which a rename there changes (#2308).
@@ -3200,7 +3203,9 @@ export class SuperTabStore {
}
// Its own agents lose their tasks at once (a stopped session); every 30 seconds it runs the Swarm's time checks too, so
// 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) : []]
+ // The starts the server refused this machine's own reports for fail now, with the refusal, not 3 minutes on (#2441).
+ const checked = [...failRefusedStarts(state, machineId, now), ...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).
const closedOut = removeClosedAgents(state, state.agents.filter(a => closed.includes(a.id)), now).map(a => a.id)
removedIds.push(...closedOut)
diff --git a/backend/vitest.super-tabs.ci.config.ts b/backend/vitest.super-tabs.ci.config.ts
index a5d489eb3..3e647f0f5 100644
--- a/backend/vitest.super-tabs.ci.config.ts
+++ b/backend/vitest.super-tabs.ci.config.ts
@@ -1,7 +1,7 @@
import { fileURLToPath } from 'node:url'
import { defineConfig, mergeConfig } from 'vitest/config'
import config from './vitest.super-tabs.config.js'
-import { createDurationSequencer, readTimingHintsFile } from './src/lib/ciShards.js'
+import { createDurationSequencer, readTimingHintsFile } from './src/lib/ciShards.test-support.js'
// PR CI's backend-integration job (.github/workflows/ci.yml): the Super Tab integration suite in four shards balanced by
// integration/ci-durations.json. `npx vitest run --config vitest.super-tabs.ci.config.ts --shard=N/4` reproduces shard N.
diff --git a/cli/src/lib/agentProject.spec.ts b/cli/src/lib/agentProject.spec.ts
index 12da3efce..d33b9e2db 100644
--- a/cli/src/lib/agentProject.spec.ts
+++ b/cli/src/lib/agentProject.spec.ts
@@ -3,7 +3,7 @@ import { appendFile, mkdtemp, mkdir, readFile, rm, realpath, symlink, writeFile
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { afterEach, describe, expect, it, vi } from 'vitest'
-import { agentProject, canonicalRepository, createAgentProjectReader, type AgentProject } from './agentProject.js'
+import { agentProject, aliasRepository, canonicalRepository, createAgentProjectReader, type AgentProject } from './agentProject.js'
const roots: string[] = []
afterEach(async () => { await Promise.all(roots.splice(0).map(path => rm(path, { recursive: true, force: true }))) })
@@ -260,3 +260,57 @@ describe('owning-machine project metadata', () => {
await Promise.all([first, ...rest])
})
})
+
+describe('the repository an SSH host alias stands for (task #2476)', () => {
+ /** ssh -G's answer for each alias; an unknown name resolves to itself, as ssh does. */
+ const resolver = (hosts: Record<string, string>) => vi.fn(async (alias: string) => hosts[alias] ?? alias)
+
+ it('reads an alias as the host it names, GitHub\'s SSH host as GitHub', async () => {
+ const resolve = resolver({ 'gh-work': 'GitHub.com', 'github.com-work': 'github.com', 'gh-443': 'ssh.github.com', gitserver: 'git.example.com' })
+ expect(await aliasRepository('git@gh-work:Acme/Api.git', resolve)).toBe('github.com/acme/api')
+ expect(await aliasRepository('ssh://git@gh-work/Acme/Api.git', resolve)).toBe('github.com/acme/api')
+ expect(await aliasRepository('[email protected]:Acme/Api.git', resolve)).toBe('github.com/acme/api')
+ expect(await aliasRepository('git@gh-443:Acme/Api.git', resolve)).toBe('github.com/acme/api')
+ expect(await aliasRepository('ssh://[email protected]:443/Acme/Api.git', resolve)).toBe('github.com/acme/api')
+ expect(await aliasRepository('git@gitserver:Team/Api.git', resolve)).toBe('git.example.com/Team/Api')
+ })
+
+ it('is nothing when the remote names its real host, or no host at all', async () => {
+ const resolve = resolver({ 'gh-work': 'github.com' })
+ for (const raw of [null, '', '[email protected]:Acme/Api.git', 'https://github.com/acme/api', 'https://gh-work/acme/api',
+ 'git://gh-work/acme/api', 'git@unknown-alias:acme/api.git', '/srv/git/api.git', 'file:///srv/git/api.git']) {
+ expect(await aliasRepository(raw, resolve), String(raw)).toBeNull()
+ }
+ // Only ssh reads ~/.ssh/config: an https or git:// host is never asked, and github.com never is.
+ expect(resolve.mock.calls.map(([alias]) => alias)).toStrictEqual(['unknown-alias'])
+ })
+
+ it('never asks ssh about a name it could read as an option, and survives ssh failing', async () => {
+ const resolve = vi.fn(async () => { throw new Error('ssh missing') })
+ expect(await aliasRepository('ssh://git@-oProxyCommand=x/acme/api', resolve)).toBeNull()
+ expect(resolve).not.toHaveBeenCalled()
+ expect(await aliasRepository('git@gh-work:acme/api.git', resolve)).toBeNull()
+ })
+
+ it('reports it beside the remote for a checkout cloned through an alias', async () => {
+ const root = await mkdtemp(join(tmpdir(), 'harness-v2-alias-')); roots.push(root)
+ // An ssh on PATH that answers -G as a configuration with `Host harness-test-gh-work` / `HostName github.com` would.
+ const bin = join(root, 'bin'); await mkdir(bin)
+ await writeFile(join(bin, 'ssh'), '#!/bin/sh\n[ "$2" = harness-test-gh-work ] && echo "hostname github.com" || echo "hostname $2"\n', { mode: 0o755 })
+ vi.stubEnv('PATH', `${bin}:${process.env.PATH}`)
+ try {
+ const repo = (name: string, origin: string) => {
+ const path = join(root, name)
+ execFileSync('git', ['init', '-q', '-b', 'main', path])
+ execFileSync('git', ['-C', path, 'remote', 'add', 'origin', origin])
+ return path
+ }
+ expect(await agentProject(repo('work', 'git@harness-test-gh-work:Acme/Api.git'), 100))
+ .toMatchObject({ remote: 'harness-test-gh-work/Acme/Api', repository: 'github.com/acme/api' })
+ // An alias no configuration names resolves to itself: the report keeps the remote alone.
+ const plain = await agentProject(repo('plain', 'git@harness-test-no-such-alias:Acme/Api.git'), 100)
+ expect(plain).toMatchObject({ remote: 'harness-test-no-such-alias/Acme/Api' })
+ expect(plain).not.toHaveProperty('repository')
+ } finally { vi.unstubAllEnvs() }
+ })
+})
diff --git a/cli/src/lib/agentProject.ts b/cli/src/lib/agentProject.ts
index 0418c3ab1..2bc2c9d28 100644
--- a/cli/src/lib/agentProject.ts
+++ b/cli/src/lib/agentProject.ts
@@ -3,7 +3,9 @@ import { readFile, realpath, stat } from 'node:fs/promises'
import { homedir } from 'node:os'
import { basename, dirname, isAbsolute, join, resolve } from 'node:path'
import { promisify } from 'node:util'
+import { isGitHubHost, safeSshAlias } from './githubRepository.js'
import { insideGitCheckout } from './gitProject.js'
+import { resolveHost } from './sshHosts.js'
const exec = promisify(execFile)
export type AgentProject = {
@@ -11,6 +13,9 @@ export type AgentProject = {
cwd: string
root: string | null
remote: string | null
+ /** The repository [remote] stands for when its host is an SSH alias (`git@gh-work:acme/api` is `github.com/acme/api`),
+ * so the same repo is one project on every computer (task #2476). Absent when [remote] names its real host. */
+ repository?: string
branch: string | null
/** Inside a linked worktree rather than the repository's own checkout. */
worktree?: true
@@ -35,6 +40,40 @@ export function canonicalRepository(raw: string | null): string | null {
} catch { return null }
}
+/** What `ssh -G` said each alias names, for five minutes: every agent's folder is read again each minute, and a
+ * person's SSH configuration rarely changes. At most 64 names are kept. */
+const hostCache = new Map<string, { at: number; value: Promise<string | null> }>()
+function cachedHost(alias: string): Promise<string | null> {
+ const now = Date.now()
+ const found = hostCache.get(alias)
+ if (found && now - found.at < 5 * 60_000) return found.value
+ const value = resolveHost(alias)
+ hostCache.delete(alias)
+ hostCache.set(alias, { at: now, value })
+ if (hostCache.size > 64) hostCache.delete(hostCache.keys().next().value!)
+ return value
+}
+
+/** The repository an SSH remote's host alias stands for, in [canonicalRepository]'s form: `git@gh-work:Acme/Api.git`
+ * is `github.com/acme/api` when `Host gh-work` has `HostName github.com`, and GitHub's SSH host `ssh.github.com` is
+ * GitHub. Null when the remote names its real host, is not ssh (only ssh reads ~/.ssh/config), or ssh cannot say. A
+ * name ssh could read as an option is never asked. */
+export async function aliasRepository(raw: string | null, resolve: (alias: string) => Promise<string | null> = cachedHost): Promise<string | null> {
+ const remote = canonicalRepository(raw)
+ if (!raw || !remote) return null
+ const scheme = /^([a-z][a-z0-9+.-]*):\/\//i.exec(raw.trim())?.[1]?.toLowerCase()
+ if (scheme !== undefined && scheme !== 'ssh') return null
+ const slash = remote.indexOf('/')
+ const host = remote.slice(0, slash).replace(/:\d+$/, '')
+ if (host === 'github.com' || !safeSshAlias(host)) return null
+ let named: string | null
+ try { named = (await resolve(host))?.toLowerCase() ?? null } catch { return null }
+ if (!named) return null
+ const target = isGitHubHost(named) ? 'github.com' : named
+ // The alias's port, if any, is the configuration's business, not the repository's.
+ return target === host ? null : canonicalRepository(`ssh://${target}${remote.slice(slash)}`)
+}
+
/** Bounded subprocesses, no shell, network, or repository mutation. */
async function runGit(cwd: string, args: string[]): Promise<string | null> {
// Every agent's folder is read here as it starts, and a fresh Mac's first harness runs in a
@@ -133,8 +172,9 @@ async function inspect(cwd: string): Promise<AgentProject> {
const { remote, pending } = await projectConfig(cwd, branch)
// A linked worktree is named for its repository, not its folder.
const main = common && basename(common) === '.git' ? dirname(resolve(root, common)) : root
+ const repository = await aliasRepository(remote)
return {
- name: basename(main), cwd, root, remote: canonicalRepository(remote), branch,
+ name: basename(main), cwd, root, remote: canonicalRepository(remote), ...(repository ? { repository } : {}), branch,
...(main !== root ? { worktree: true as const } : {}), ...(pending ? { branchPending: true as const } : {}),
}
} finally {
diff --git a/cli/src/superTabs/machines.spec.ts b/cli/src/superTabs/machines.spec.ts
index 08b005f9c..19ae11b34 100644
--- a/cli/src/superTabs/machines.spec.ts
+++ b/cli/src/superTabs/machines.spec.ts
@@ -831,6 +831,60 @@ describe('contributed machine executor', () => {
expect(posts().map(c => 'harnessProgress' in (c[3] as object))).toEqual([true, false, false, true, false])
})
+ // Task #2441: the backend refused this host's own reports for a start (its pool check), and the start waited out the backend's
+ // 3 minutes with the refusal in this machine's log alone. The host now names it in its next reading, and the backend fails it.
+ describe('a start whose host reports the backend refused', () => {
+ const machinePosts = (f: ReturnType<typeof fixture>) => f.backend.mock.calls
+ .filter(c => c[1] === 'POST' && String(c[2]).includes('/machines/')).map(c => c[3] as Record<string, unknown>)
+ const REFUSAL = 'This start does not belong to this machine contribution.'
+
+ it('is reported refused, with the refusal, in the next reading, and no longer once it is not pending', async () => {
+ const f = fixture()
+ f.start.mockRejectedValue(new SuperTabHostError('FORBIDDEN', REFUSAL, 403))
+ // The pass that meets the refusal reports first; the next pass names it at once.
+ await f.machine.tick()
+ expect(machinePosts(f).at(-1)).not.toHaveProperty('refusedStarts')
+ f.step(5_000); await f.machine.tick()
+ expect(machinePosts(f).at(-1)!.refusedStarts).toEqual([{ startId: 'start', reason: REFUSAL }])
+ f.pool.starts = []
+ f.advance(); await f.machine.tick()
+ f.advance(); await f.machine.tick()
+ expect(machinePosts(f).at(-1)).not.toHaveProperty('refusedStarts')
+ })
+
+ it('reports nothing for a 5xx, a timeout or a refusal that is not the backend\'s 403', async () => {
+ for (const failure of [new SuperTabHostError('GITHUB_UNAVAILABLE', 'GitHub did not answer.', 502), new Error('The operation timed out.'),
+ new SuperTabHostError('VALIDATION_ERROR', 'Bad request.', 400)]) {
+ const f = fixture()
+ f.start.mockRejectedValue(failure)
+ await f.machine.tick()
+ f.step(5_000); await f.machine.tick()
+ expect(machinePosts(f).at(-1)).not.toHaveProperty('refusedStarts')
+ }
+ })
+
+ it('keeps the refusal to 300 characters', async () => {
+ const f = fixture()
+ f.start.mockRejectedValue(new SuperTabHostError('FORBIDDEN', 'x'.repeat(400), 403))
+ await f.machine.tick()
+ f.step(5_000); await f.machine.tick()
+ expect((machinePosts(f).at(-1)!.refusedStarts as Array<{ reason: string }>)[0]!.reason).toHaveLength(300)
+ })
+
+ it('sends the reading without it to a backend that refuses the field', async () => {
+ const f = fixture()
+ f.start.mockRejectedValue(new SuperTabHostError('FORBIDDEN', REFUSAL, 403))
+ const original = f.backend.getMockImplementation()!
+ f.backend.mockImplementation(async (core, method, path, body) => {
+ if (method === 'POST' && (body as Record<string, unknown>)?.refusedStarts) throw new SuperTabHostError('VALIDATION_ERROR', 'Unrecognized key: refusedStarts', 400)
+ return original(core, method, path, body)
+ })
+ await f.machine.tick()
+ f.step(5_000); await f.machine.tick()
+ expect(machinePosts(f).slice(-2).map(post => 'refusedStarts' in post)).toEqual([true, false])
+ })
+ })
+
describe('a start this machine launched and is still preparing', () => {
const machinePosts = (f: ReturnType<typeof fixture>) => f.backend.mock.calls
.filter(c => c[1] === 'POST' && String(c[2]).includes('/machines/')).map(c => c[3] as Record<string, unknown>)
diff --git a/cli/src/superTabs/machines.ts b/cli/src/superTabs/machines.ts
index 1e8920913..afcea9a30 100644
--- a/cli/src/superTabs/machines.ts
+++ b/cli/src/superTabs/machines.ts
@@ -223,6 +223,10 @@ export class ContributedMachines {
* last pass found them. Reported so the backend waits past its 3 minutes (backend liveness.ts): Diego's Mac fetched and
* checked out a 470 MB project, and the start failed while it did (2026-10-27). */
private readonly preparing = new Set<string>()
+ /** The starts whose host reports the backend refused (a 403), with its refusal, as this machine's passes met them. Named in
+ * the next reading so the backend fails each at once (backend liveness.ts failRefusedStarts), where it waited out its 3
+ * minutes with the refusal in this log alone (task #2441). */
+ private readonly refused = new Map<string, string>()
/** Per launched start whose creation is held on a dependency, since when without a break. */
private readonly heldSince = new Map<string, number>()
/** Starts this host launched whose engine has not yet recorded its session: the agent each created, by start id. */
@@ -257,6 +261,8 @@ export class ContributedMachines {
private readinessRefusedUntil = 0
/** Until when the reading leaves out the starts it is preparing, which the backend refused. */
private preparingRefusedUntil = 0
+ /** Until when the reading leaves out the starts the backend refused, a field an older backend refuses. */
+ private refusedStartsRefusedUntil = 0
/** Whether each engine is installed and signed in, and until when that stands: one probe starts login shells and reads
* the engines' accounts, so it runs every [READINESS_MS] (a failed one again after [READINESS_RETRY_MS]). */
private engineRead: { value: ReadyEngine[] | null; until: number } | null = null
@@ -480,6 +486,7 @@ export class ContributedMachines {
for (const id of this.waiting.keys()) if (!pendingIds.has(id)) this.waiting.delete(id)
for (const id of this.refusedSince.keys()) if (!pendingIds.has(id)) this.refusedSince.delete(id)
for (const id of this.preparing) if (!pendingIds.has(id)) this.preparing.delete(id)
+ for (const id of this.refused.keys()) if (!pendingIds.has(id)) this.refused.delete(id)
for (const id of this.heldSince.keys()) if (!pendingIds.has(id)) this.heldSince.delete(id)
this.loadUnconfirmed()
for (const [id, launch] of this.unconfirmed) if (!pendingIds.has(id) && !launch.checking) void this.abandoned(id, launch)
@@ -522,12 +529,16 @@ export class ContributedMachines {
const pending = startsOf(row)
looked.push({ row, pool, pending })
const preparing = began >= this.preparingRefusedUntil ? pending.flatMap(start => this.preparing.has(String(start.id)) ? [String(start.id)] : []) : []
+ const refusedStarts = began >= this.refusedStartsRefusedUntil ? pending.flatMap(start => {
+ const reason = this.refused.get(String(start.id))
+ return reason ? [{ startId: String(start.id), reason }] : []
+ }) : []
const tools = [...new Set([...COMMON_TOOLS, ...pending.flatMap(start => {
const wanted = object(object(start.request).requirements).tools
return Array.isArray(wanted) ? wanted.filter((name): name is string => typeof name === 'string' && /^[A-Za-z0-9_.+-]{1,80}$/.test(name)) : []
})])].slice(0, 20)
const signature = JSON.stringify([row.reservations, pool.generation, [...running].sort(), [...stopped].sort(), row.paused === true || pool.paused === true,
- pending.map(start => start.id).sort(), [...preparing].sort(),
+ pending.map(start => start.id).sort(), [...preparing].sort(), refusedStarts.map(r => r.startId).sort(),
// A privacy result that changes (a home folder opened again) is sent at once, not on the next beat.
privacy ? [privacy.mode, 'passed' in privacy ? privacy.passed : null, 'item' in privacy ? privacy.item : null] : null,
typeof row.localGrid === 'string' ? modelsStamp : null])
@@ -602,6 +613,7 @@ export class ContributedMachines {
...(profiles.length ? { profiles } : {}),
...(row.capabilitiesWanted === true ? { capabilities: CAPABILITIES } : {}),
...(preparing.length ? { preparingStartIds: preparing } : {}),
+ ...(refusedStarts.length ? { refusedStarts } : {}),
...(Object.keys(uncommitted).length ? { harnessUncommitted: uncommitted } : {}),
...(Object.keys(progress).length ? { harnessProgress: progress } : {}), ...(localModels ? { localModels } : {}),
...((readyEngines || checkouts) && began >= this.readinessRefusedUntil ? { readiness } : {}),
@@ -685,6 +697,7 @@ export class ContributedMachines {
}
}
const result = await this.deps.start({ tabId: row.tabId, startId: start.id, hostDispatch: true, ...(github ? { github } : {}) }, scoped, where, this.deps.open)
+ this.refused.delete(String(start.id))
const refused = result.ok !== true && !start.dispatched && !NOT_REFUSED.has(String(result.error))
// Launched, and its creation still under way on the daemon: anything else is not preparing.
if (result.error === 'START_PENDING' && result.state === 'pending') this.preparing.add(String(start.id))
@@ -745,7 +758,12 @@ export class ContributedMachines {
}
}
// Keep its durable receipt; another start must not be starved by this failure.
- catch (error) { this.refusedSince.delete(start.id); this.noteWaiting(start.id, error instanceof Error ? error.message : String(error)) }
+ catch (error) {
+ this.refusedSince.delete(start.id)
+ // The backend refused this host's own report for it: the next reading says so, and the backend fails it with this.
+ if (error instanceof SuperTabHostError && error.status === 403) this.refused.set(String(start.id), error.message.slice(0, 300))
+ this.noteWaiting(start.id, error instanceof Error ? error.message : String(error))
+ }
} finally { launched() }
}
} catch { /* Revocation or one unavailable project cannot block another contribution. */ }
@@ -818,13 +836,14 @@ export class ContributedMachines {
/**
* One Swarm's reading through its own route, newest form first. Older backends reject the additive fields. The newest go
- * alone first (the starts it is preparing, uncommitted work, readiness, progress, then privacy): a backend that takes
- * everything else keeps the local models it reads. Their boolean-only view still safely refuses an unverified tool, and a
+ * alone first (the starts the backend refused, the starts it is preparing, uncommitted work, readiness, progress, then
+ * privacy): a backend that takes everything else keeps the local models it reads. Their boolean-only view still safely refuses an unverified tool, and a
* reading without privacy is never one a Team machine passes on. [refused]: the batch already refused the newest form.
*/
private async sendAlone({ tab, observation, localModels }: Reading, began: number, refused?: SuperTabHostError): Promise<void> {
const path = `/api/super-tabs/${tab}/machines/${this.machineId}`
- const { profiles: _profiles, ...unprofiled } = observation
+ const { refusedStarts: _refusedStarts, ...unrefused } = observation
+ const { profiles: _profiles, ...unprofiled } = unrefused
const { quotaReasons: _reasons, ...unreasoned } = unprofiled
const { harnessTokens: _tokens, ...untokened } = unreasoned
const { preparingStartIds: _preparing, ...unprepared } = untokened
@@ -836,13 +855,14 @@ export class ContributedMachines {
// A backend before `starting` refuses it: it gets the models the grid lists, as before, not none at all.
const listedOnly = localModels?.some(m => m.starting)
? [{ ...withoutPrivacy, localModels: localModels.filter(m => !m.starting) }] : []
- const attempts = [...('profiles' in observation ? [observation] : []), ...('quotaReasons' in unprofiled ? [unprofiled] : []), ...('harnessTokens' in unreasoned ? [unreasoned] : []), ...('preparingStartIds' in untokened ? [untokened] : []),
+ const attempts = [...('refusedStarts' in observation ? [observation] : []), ...('profiles' in unrefused ? [unrefused] : []), ...('quotaReasons' in unprofiled ? [unprofiled] : []), ...('harnessTokens' in unreasoned ? [unreasoned] : []), ...('preparingStartIds' in untokened ? [untokened] : []),
...('harnessUncommitted' in unprepared ? [unprepared] : []),
...('readiness' in known ? [known] : []), ready, ...('harnessProgress' in ready ? [withoutProgress] : []),
...('privacy' in withoutProgress ? [withoutPrivacy] : []), ...listedOnly,
...('toolProbeErrors' in observation || 'localModels' in observation || 'refusedModels' in observation ? [legacy] : [])]
const refuse = (attempt: Record<string, unknown>) => {
- if ('profiles' in attempt) this.profilesRefusedUntil = began + FIELD_REFUSED_MS
+ if ('refusedStarts' in attempt) this.refusedStartsRefusedUntil = began + FIELD_REFUSED_MS
+ else if ('profiles' in attempt) this.profilesRefusedUntil = began + FIELD_REFUSED_MS
else if ('quotaReasons' in attempt) this.quotaReasonsRefusedUntil = began + FIELD_REFUSED_MS
else if ('harnessTokens' in attempt) this.tokensRefusedUntil = began + FIELD_REFUSED_MS
else if ('preparingStartIds' in attempt) this.preparingRefusedUntil = began + FIELD_REFUSED_MS
diff --git a/desktop/lib/core/models.dart b/desktop/lib/core/models.dart
index fead53a53..72be82b01 100644
--- a/desktop/lib/core/models.dart
+++ b/desktop/lib/core/models.dart
@@ -1223,6 +1223,7 @@ class AgentProject {
required this.cwd,
this.root,
this.remote,
+ this.repository,
this.branch,
this.worktree = false,
this.branchPending = false,
@@ -1231,6 +1232,12 @@ class AgentProject {
final String cwd;
final String? root;
final String? remote;
+
+ /// The repository [remote] stands for when its host is an SSH alias
+ /// (`gh-work/acme/api` is `github.com/acme/api`, cli agentProject.ts
+ /// `aliasRepository`). Null when [remote] names its real host, and from an
+ /// older daemon.
+ final String? repository;
final String? branch;
/// In a linked worktree rather than the repository's own checkout.
@@ -1289,12 +1296,21 @@ class AgentProject {
cwd == other.cwd &&
root == other.root &&
remote == other.remote &&
+ repository == other.repository &&
branch == other.branch &&
worktree == other.worktree &&
branchPending == other.branchPending;
@override
- int get hashCode =>
- Object.hash(name, cwd, root, remote, branch, worktree, branchPending);
+ int get hashCode => Object.hash(
+ name,
+ cwd,
+ root,
+ remote,
+ repository,
+ branch,
+ worktree,
+ branchPending,
+ );
static AgentProject? fromJson(Object? raw) {
if (raw is! Map) return null;
@@ -1316,6 +1332,7 @@ class AgentProject {
cwd: cwd,
root: field('root'),
remote: field('remote'),
+ repository: field('repository'),
branch: field('branch', 256),
worktree: raw['worktree'] == true,
branchPending: raw['branchPending'] == true,
diff --git a/desktop/lib/notify/system_notifications.dart b/desktop/lib/notify/system_notifications.dart
index 09422435d..88fd0a562 100644
--- a/desktop/lib/notify/system_notifications.dart
+++ b/desktop/lib/notify/system_notifications.dart
@@ -30,8 +30,7 @@ class DesktopNotificationStore extends OnOffPreference {
/// and nothing told them. Asked once, whatever the answer: a second offer is a
/// nag.
class NotificationOfferStore extends OnOffPreference {
- NotificationOfferStore({super.storage})
- : super('app_notifications_offered');
+ NotificationOfferStore({super.storage}) : super('app_notifications_offered');
}
final notificationOfferStore = NotificationOfferStore();
@@ -370,13 +369,124 @@ ProcessRunner offUiIsolate([ProcessRunner run = Process.run]) =>
(executable, arguments) =>
Isolate.run(() => run(executable, arguments), debugName: executable);
+/// A `notify-send` waiting for a click: its answer once it exits, and a way to
+/// stop it.
+typedef NoticeWait = ({Future<ProcessResult> result, void Function() kill});
+
+/// Starts one waiting `notify-send`, which stops by itself after [limit].
+typedef NoticeWaiter = NoticeWait Function(
+ String executable,
+ List<String> arguments, {
+ required Duration limit,
+});
+
+/// A [NoticeWaiter] on an isolate of its own, for the reason [offUiIsolate]
+/// gives. The isolate starts the process, stops it at [limit] or when asked,
+/// and answers as [Process.run] would; a missing tool is a [ProcessException].
+NoticeWait waitOffUiIsolate(
+ String executable,
+ List<String> arguments, {
+ required Duration limit,
+}) {
+ final answers = ReceivePort();
+ final done = Completer<ProcessResult>();
+ SendPort? control;
+ var stop = false;
+ void finish() => answers.close();
+ answers.listen((message) {
+ switch (message) {
+ case SendPort port:
+ control = port;
+ if (stop) port.send(null);
+ case (int pid, int code, String out, String err):
+ done.complete(ProcessResult(pid, code, out, err));
+ finish();
+ case String error:
+ done.completeError(ProcessException(executable, arguments, error));
+ finish();
+ }
+ });
+ unawaited(
+ Isolate.spawn(_waitForNotice, (
+ answers.sendPort,
+ executable,
+ arguments,
+ limit,
+ ), debugName: executable).then<void>(
+ (_) {},
+ onError: (Object error) {
+ if (!done.isCompleted) done.completeError(error);
+ finish();
+ },
+ ),
+ );
+ return (
+ result: done.future,
+ kill: () {
+ stop = true;
+ control?.send(null);
+ },
+ );
+}
+
+Future<void> _waitForNotice(
+ (SendPort, String, List<String>, Duration) job,
+) async {
+ final (answers, executable, arguments, limit) = job;
+ final control = ReceivePort();
+ answers.send(control.sendPort);
+ try {
+ final process = await Process.start(executable, arguments);
+ var stopped = false;
+ void stop() {
+ stopped = true;
+ process.kill();
+ }
+
+ control.listen((_) => stop());
+ final out = process.stdout.transform(utf8.decoder).join();
+ final err = process.stderr.transform(utf8.decoder).join();
+ final code = await process.exitCode.timeout(
+ limit,
+ onTimeout: () {
+ stop();
+ return process.exitCode;
+ },
+ );
+ // A stopped process answers without its output: a child it left behind can hold the pipes
+ // open for as long as it runs (Linux CI, 11-03), and a stopped wait opens nothing anyway.
+ answers.send((
+ process.pid,
+ code,
+ stopped ? '' : await out,
+ stopped ? '' : await err,
+ ));
+ } on ProcessException catch (error) {
+ answers.send(error.message);
+ } finally {
+ control.close();
+ }
+}
+
/// Linux: `notify-send`, which talks to whatever notification daemon the
-/// desktop already runs. No native dependency, and no click action — the tool
-/// has none, so a click does what the desktop's own default is.
+/// desktop already runs. No native dependency. A Swarm tag's or chat's notice
+/// offers its default action and waits for it (`--action`, `--wait`, libnotify
+/// 0.7.10 and later), so a click opens that tag or chat (Diego, 2026-11-03:
+/// no click did anything). An agent's alert keeps `--replace-id` instead,
+/// which a waiting notice cannot learn, so a click on it does what the
+/// desktop's own default is.
class LinuxSystemNotifier implements SystemNotifier {
- LinuxSystemNotifier({ProcessRunner? run}) : _run = run ?? offUiIsolate();
+ LinuxSystemNotifier({ProcessRunner? run, NoticeWaiter? wait})
+ : _run = run ?? offUiIsolate(),
+ _wait =
+ wait ??
+ (run == null
+ ? waitOffUiIsolate
+ : (exe, args, {required limit}) =>
+ (result: run(exe, args), kill: () {}));
final ProcessRunner _run;
+ final NoticeWaiter _wait;
/// The daemon's id for each agent's notification, so the next one REPLACES it
/// (`--replace-id`) rather than stacking — the banner's rule.
@@ -387,6 +497,21 @@ class LinuxSystemNotifier implements SystemNotifier {
/// every notification after that is posted plainly.
bool _canReplace = true;
+ /// Whether this `notify-send` knows `--action`/`--wait`; asked once, as above.
+ bool _canAct = true;
+
+ /// The notices whose `notify-send` still waits for a click, oldest first,
+ /// each on an isolate of its own. GNOME and KDE keep an unclicked notice
+ /// until it is dismissed, so a wait would last all session (review of
+ /// #2808): each stops after [_waitLimit], and past [_maxWaiting] the oldest
+ /// stops so the newest can still be clicked. A stopped wait leaves its
+ /// notice up; only its click goes nowhere.
+ final _waits = <NoticeWait>[];
+ static const _maxWaiting = 8;
+ static const _waitLimit = Duration(minutes: 10);
+
+ void Function(String machineId, String agentId)? _onTap;
+
@override
bool get supported => true;
@@ -417,6 +542,67 @@ class LinuxSystemNotifier implements SystemNotifier {
required String machineId,
required String agentId,
}) async {
+ final opens =
+ (machineId == SystemNotifications.mentionNoticeMachine ||
+ machineId == SystemNotifications.chatNoticeMachine) &&
+ agentId.isNotEmpty;
+ if (opens && _canAct) {
+ if (_waits.length >= _maxWaiting) _waits.removeAt(0).kill();
+ final wait = _wait('notify-send', [
+ '--app-name=Harness',
+ '--action=default=Open',
+ '--wait',
+ '--',
+ title,
+ body,
+ ], limit: _waitLimit);
+ _waits.add(wait);
+ unawaited(_clicked(wait, id, title, body, machineId, agentId));
+ // Its answer comes when the notice closes; what the platform last said stands meanwhile.
+ return NotificationPermission.unknown;
+ }
+ return _post(id, title, body);
+ }
+
+ Future<void> _clicked(
+ NoticeWait wait,
+ String id,
+ String title,
+ String body,
+ String machineId,
+ String agentId,
+ ) async {
+ try {
+ final result = await wait.result;
+ if (result.exitCode == 0) {
+ // The invoked action's name, on a line of its own; nothing when the notice expired or
+ // was dismissed.
+ final lines = '${result.stdout}'.split('\n').map((l) => l.trim());
+ if (lines.contains('default')) _onTap?.call(machineId, agentId);
+ return;
+ }
+ // Stopped by a signal: its time ran out, or a newer notice took its place. Its notice is up.
+ if (result.exitCode < 0) return;
+ // A notify-send that does not KNOW the flags gives them up for good. Any other failure is
+ // the daemon's; either way the notice still goes up, plainly, and says what happened.
+ if ('${result.stderr}'.toLowerCase().contains('unknown option')) {
+ _canAct = false;
+ }
+ await _post(id, title, body);
+ } on ProcessException {
+ // No notify-send at all: the next notice goes the plain way, which reports it.
+ _canAct = false;
+ await _post(id, title, body);
+ } finally {
+ _waits.remove(wait);
+ }
+ }
+
+ Future<NotificationPermission> _post(
+ String id,
+ String title,
+ String body,
+ ) async {
List<String> args({required bool replace}) => [
'--app-name=Harness',
if (replace) '--print-id',
@@ -457,7 +643,8 @@ class LinuxSystemNotifier implements SystemNotifier {
Future<void> withdraw(String id) async => _ids.remove(id);
@override
- set onTap(void Function(String machineId, String agentId)? handler) {}
+ set onTap(void Function(String machineId, String agentId)? handler) =>
+ _onTap = handler;
}
/// The notifier for the platform this build runs on ([operatingSystem] is
@@ -564,15 +751,21 @@ class SystemNotifications {
/// `<swarm tab id>/<tag id>` ([mention]), which the click opens (swarm_screen.dart).
static const mentionNoticeMachine = '@mention';
- /// News about the ACCOUNT rather than an agent — a device joined it, a person was tagged. The same
- /// switch and the same rules as [post]; a click on it opens that device ([devicePub]) or that tag
- /// in its Swarm ([mention]) when given, else nothing.
+ /// What a Swarm chat's New messages notice puts in the `machineId` slot; the `agentId` slot holds
+ /// `<swarm tab id>/<conversation id>` ([chat]), which the click opens (swarm_screen.dart).
+ static const chatNoticeMachine = '@chat';
+
+ /// News about the ACCOUNT rather than an agent — a device joined it, a person was tagged, a chat
+ /// has new messages. The same switch and the same rules as [post]; a click on it opens that device
+ /// ([devicePub]), that tag in its Swarm ([mention]) or that chat in its Swarm ([chat]) when given,
+ /// else nothing.
void postNotice({
required String id,
required String title,
required String body,
String? devicePub,
({String tabId, String mentionId})? mention,
+ ({String tabId, String conversationId})? chat,
}) {
if (!store.value || !supported) return;
if (permission.value == NotificationPermission.unavailable) return;
@@ -585,11 +778,15 @@ class SystemNotifications {
body: body,
machineId: mention != null
? mentionNoticeMachine
+ : chat != null
+ ? chatNoticeMachine
: devicePub == null
? ''
: deviceNoticeMachine,
agentId: mention != null
? '${mention.tabId}/${mention.mentionId}'
+ : chat != null
+ ? '${chat.tabId}/${chat.conversationId}'
: devicePub ?? '',
)
.then((answer) {
diff --git a/desktop/lib/screens/swarm_screen.dart b/desktop/lib/screens/swarm_screen.dart
index 65db5f825..22a70d443 100644
--- a/desktop/lib/screens/swarm_screen.dart
+++ b/desktop/lib/screens/swarm_screen.dart
@@ -761,6 +761,16 @@ class _SwarmScreenState extends State<SwarmScreen> {
);
return;
}
+ // A chat's New messages notice carries its Swarm tab and chat: the click opens that chat.
+ if (machineId == SystemNotifications.chatNoticeMachine) {
+ final slash = agentId.indexOf('/');
+ if (slash <= 0) return;
+ await _openChatNotice(
+ agentId.substring(0, slash),
+ agentId.substring(slash + 1),
+ );
+ return;
+ }
// A device notice puts its marker where an agent's machine goes and the device's key where the
// agent goes: the click opens that device.
if (machineId == SystemNotifications.deviceNoticeMachine) {
@@ -7309,6 +7319,36 @@ class _SwarmScreenState extends State<SwarmScreen> {
controller.openNotice('mention', mentionId);
}
+ /// A chat's New messages notice: its Swarm tab comes forward on that chat,
+ /// once the person can still read it, as a tag's notice opens its tag.
+ Future<void> _openChatNotice(String tabId, String conversationId) async {
+ final name = app.superTabName(tabId);
+ if (name == null) return;
+ final loadedHere = app.superTabs.peek(tabId) == null;
+ void letGo() {
+ if (loadedHere && app.activeSwarm.superTabId != tabId) {
+ app.superTabs.release(tabId);
+ }
+ }
+
+ final SuperTabController controller;
+ try {
+ controller = await app.superTabs.open(tabId);
+ } catch (_) {
+ return;
+ }
+ // A chat held, or one the backend still gives this reader by id.
+ final readable =
+ controller.snapshot?.conversation(conversationId) != null ||
+ await controller.loadGroup(conversationId);
+ if (!mounted || !readable || controller.accessRevoked) return letGo();
+ if (_newHarness?.requestDismiss() == false) return letGo();
+ _closeNewHarness(restoreFocus: false);
+ _closeSearch(restoreFocus: false);
+ app.openSuperTab(tabId, name);
+ await controller.select(conversationId);
+ }
+
/// A row of the menu bar's Swarm section: its Swarm tab comes forward and
/// opens the tag or decision there; View all (`all`) opens the Swarm's
/// Notifications page. One no longer listed opens nothing.
diff --git a/desktop/lib/super_tabs/leaderboard/format.dart b/desktop/lib/super_tabs/leaderboard/format.dart
index 9bbf8dbb1..649d9e04f 100644
--- a/desktop/lib/super_tabs/leaderboard/format.dart
+++ b/desktop/lib/super_tabs/leaderboard/format.dart
@@ -14,6 +14,27 @@ String leaderboardDuration(int ms) {
: '${rounded.toStringAsFixed(1)} h';
}
+/// "31 h", "12.5 h", "0 h": a machine's hours for others in Brought.
+String broughtHours(double hours) {
+ final rounded = (hours * 10).round() / 10;
+ return rounded == rounded.roundToDouble()
+ ? '${rounded.round()} h'
+ : '${rounded.toStringAsFixed(1)} h';
+}
+
+/// "3d", "5h 10m", "20m", "now": how long until a subscription's week
+/// resets, as Machines says it.
+String resetsIn(DateTime when, DateTime now) {
+ final minutes = when.difference(now).inMinutes;
+ return minutes <= 0
+ ? 'now'
+ : minutes < 60
+ ? '${minutes}m'
+ : minutes < 1440
+ ? '${minutes ~/ 60}h ${minutes % 60}m'
+ : '${minutes ~/ 1440}d';
+}
+
/// Whole agent-hours, as the points count them.
String leaderboardHours(int ms) => '${(ms / _hour).round()}';
diff --git a/desktop/lib/super_tabs/leaderboard/model.dart b/desktop/lib/super_tabs/leaderboard/model.dart
index 57bfa5260..e879ecb77 100644
--- a/desktop/lib/super_tabs/leaderboard/model.dart
+++ b/desktop/lib/super_tabs/leaderboard/model.dart
@@ -236,7 +236,33 @@ class SuperTabPersonDetails {
? (item['busyHours'] as num).toDouble()
: 0.0,
),
- ];
+ ],
+ brought = json['brought'] is List
+ ? [
+ for (final item in _list(json['brought']))
+ if (_text(item['machineName']) case final machineName?)
+ (
+ machineName: machineName,
+ shipped: _int(item['shipped']),
+ busyHours: item['busyHours'] is num
+ ? (item['busyHours'] as num).toDouble()
+ : 0.0,
+ subscriptions: [
+ for (final sub in _list(item['subscriptions']))
+ if (_text(sub['engine']) case final engine?)
+ (
+ engine: engine,
+ usedPercent: sub['usedPercent'] is num
+ ? _int(sub['usedPercent'])
+ : null,
+ resetsAt: sub['resetsAt'] is num
+ ? _int(sub['resetsAt'])
+ : null,
+ ),
+ ],
+ ),
+ ]
+ : null;
/// Pull requests that merged.
final List<({String title, String? prUrl})> shipped;
@@ -250,8 +276,21 @@ class SuperTabPersonDetails {
/// Machines whose agents ran, and for how long.
final List<({String machineName, double busyHours})> lent;
+
+ /// Every machine the person brought (contributor view, #2444): the
+ /// verified requests that shipped on it, its hours on others' work, and
+ /// each subscription's weekly use and reset (null when unknown). Null from
+ /// a server before it, which shows [lent] instead.
+ final List<SuperTabBrought>? brought;
}
+typedef SuperTabBrought = ({
+ String machineName,
+ int shipped,
+ double busyHours,
+ List<({String engine, int? usedPercent, int? resetsAt})> subscriptions,
+});
+
class SuperTabWaitingPerson {
SuperTabWaitingPerson.fromJson(Map<String, dynamic> json)
: personId = json['personId'] as String? ?? '',
diff --git a/desktop/lib/super_tabs/leaderboard/person_row.dart b/desktop/lib/super_tabs/leaderboard/person_row.dart
index c89b2943d..5c58e65bb 100644
--- a/desktop/lib/super_tabs/leaderboard/person_row.dart
+++ b/desktop/lib/super_tabs/leaderboard/person_row.dart
@@ -369,6 +369,9 @@ class _LeaderboardPersonDetails extends StatefulWidget {
_LeaderboardPersonDetailsState();
}
+/// How Brought names a subscription's engine, as the Swarm's other lines do.
+const _engineNames = {'claude': 'Claude', 'codex': 'Codex'};
+
class _LeaderboardPersonDetailsState extends State<_LeaderboardPersonDetails> {
/// The newest a list shows before Show all.
static const _shown = 5;
@@ -493,13 +496,57 @@ class _LeaderboardPersonDetailsState extends State<_LeaderboardPersonDetails> {
'waited ${leaderboardDuration(unblocked.waitedMinutes * 60000)}',
),
]),
- section('Lent', 'No machines lent yet', [
- for (final lent in details.lent)
- item(
- line(superTabMachineName(lent.machineName)),
- '${leaderboardDuration((lent.busyHours * 3600000).round())} busy',
- ),
- ]),
+ // What each machine the person brought did (contributor view, #2444);
+ // a server before it says only Lent.
+ if (details.brought case final brought?)
+ section('Brought', 'No machines brought yet', [
+ for (final machine in brought)
+ Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ item(
+ line(superTabMachineName(machine.machineName)),
+ '${machine.shipped} shipped · '
+ '${broughtHours(machine.busyHours)} for others',
+ ),
+ for (final sub in machine.subscriptions)
+ Padding(
+ padding: const EdgeInsetsDirectional.only(
+ start: _gap * 2,
+ ),
+ child: item(
+ line(
+ _engineNames[sub.engine] ?? capitalized(sub.engine),
+ style: quiet,
+ ),
+ switch (sub) {
+ (
+ usedPercent: final used?,
+ resetsAt: final at?,
+ engine: _,
+ ) =>
+ '$used% used · resets in ${resetsIn(DateTime.fromMillisecondsSinceEpoch(at), clock.now())}',
+ (
+ usedPercent: final used?,
+ resetsAt: null,
+ engine: _,
+ ) =>
+ '$used% used',
+ _ => 'not read yet',
+ },
+ ),
+ ),
+ ],
+ ),
+ ])
+ else
+ section('Lent', 'No machines lent yet', [
+ for (final lent in details.lent)
+ item(
+ line(superTabMachineName(lent.machineName)),
+ '${leaderboardDuration((lent.busyHours * 3600000).round())} busy',
+ ),
+ ]),
],
);
}
diff --git a/desktop/lib/super_tabs/notifications.dart b/desktop/lib/super_tabs/notifications.dart
index fb1f88550..58b25d188 100644
--- a/desktop/lib/super_tabs/notifications.dart
+++ b/desktop/lib/super_tabs/notifications.dart
@@ -77,7 +77,8 @@ void Function(String tabId, SuperTabMention mention)? superTabMentionNotice(
/// What tells the person about a new message in a chat they set to All new
/// messages: the operating system, on Desktop only, as tags are. The notice
-/// names the chat, not its newest message.
+/// names the chat, not its newest message, and a click opens that chat in its
+/// Swarm [tabId] (Diego, 2026-11-03: it carried neither, so a click did nothing).
void Function(String tabId, SuperTabConversation group, int sequence)?
superTabChatNotice(SystemNotifications system, {bool web = kIsWeb}) => web
? null
@@ -85,6 +86,7 @@ superTabChatNotice(SystemNotifications system, {bool web = kIsWeb}) => web
id: 'harness-chat:$tabId:${group.id}:$sequence',
title: group.title,
body: 'New messages',
+ chat: (tabId: tabId, conversationId: group.id),
);
/// The reader's tags in one Swarm: Waiting and Earlier, read from the backend
diff --git a/desktop/lib/super_tabs/personal_projects.dart b/desktop/lib/super_tabs/personal_projects.dart
index 48904190f..ac4b82e32 100644
--- a/desktop/lib/super_tabs/personal_projects.dart
+++ b/desktop/lib/super_tabs/personal_projects.dart
@@ -32,10 +32,13 @@ import 'swarm_switcher.dart' show PersonalSwarm;
/// The form an agent reports its project's remote in: `host[:port]/owner/repo`
/// with no scheme, user or `.git` (the CLI's `canonicalRepository`, and
/// `canonicalGitRemote` for this computer's own reading). Every real remote
-/// arrives so; a host needs a dot and a letter-only last label, which a folder
-/// path (`/srv/api`, `./api`, `C:\api`) never has.
+/// arrives so, a clone through an SSH host alias too: its host is the alias,
+/// often with no dot (`gh-work/acme/api`, `Host gh-work`, task #2476). A host
+/// is two or more letters, digits, dots, hyphens or underscores, starting and
+/// ending with a letter or digit (the CLI's `safeSshAlias`), so a folder path
+/// (`/srv/api`, `./api`, `C:\api`, `C:/api`) never is one.
final _canonicalRemote = RegExp(
- r'^(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z]{2,}(?::\d+)?/\S+$',
+ r'^[a-z0-9][a-z0-9._-]*[a-z0-9](?::\d+)?/\S+$',
caseSensitive: false,
);
@@ -146,12 +149,19 @@ List<PersonalPane> personalPanes(AppNotifier app) {
continue;
}
if (!seen.add((pane.machineId, agentId))) continue;
- final agent = machine.agents.where((a) => a.id == agentId).firstOrNull;
+ final project = machine.agents
+ .where((a) => a.id == agentId)
+ .firstOrNull
+ ?.project;
out.add((
tab: tab,
pane: pane,
+ // The repo an SSH alias stands for first, so a clone through
+ // `Host gh-work` and one straight from GitHub are one (task #2476).
repo:
- normalizedRemote(agent?.project?.remote) ?? personalTabKey(tab.id),
+ normalizedRemote(project?.repository) ??
+ normalizedRemote(project?.remote) ??
+ personalTabKey(tab.id),
));
}
}
diff --git a/desktop/test/device_viewer_notices_test.dart b/desktop/test/device_viewer_notices_test.dart
index f764c7359..601cf1ce2 100644
--- a/desktop/test/device_viewer_notices_test.dart
+++ b/desktop/test/device_viewer_notices_test.dart
@@ -40,6 +40,7 @@ class _Posts extends SystemNotifications {
required String body,
String? devicePub,
({String tabId, String mentionId})? mention,
+ ({String tabId, String conversationId})? chat,
}) => ids.add(id);
}
diff --git a/desktop/test/super_tab_humans_test.dart b/desktop/test/super_tab_humans_test.dart
index ac13ddad1..46515d736 100644
--- a/desktop/test/super_tab_humans_test.dart
+++ b/desktop/test/super_tab_humans_test.dart
@@ -708,4 +708,73 @@ void main() {
await close(tester, controller);
},
);
+
+ group('Brought: the machines a person brought (contributor view, #2444)', () {
+ Map<String, dynamic> details(ConversationServer server, String id) =>
+ ((server.leaderboard!['people'] as List).cast<Map>().firstWhere(
+ (p) => p['personId'] == id,
+ )['details']
+ as Map)
+ .cast<String, dynamic>();
+
+ testWidgets(
+ 'shows each machine: what shipped on it, its hours for others and each subscription\'s week',
+ (tester) async {
+ final server = humansSwarm();
+ final resets = DateTime.now()
+ .add(const Duration(days: 3, hours: 2))
+ .millisecondsSinceEpoch;
+ details(server, 'owner')['brought'] = [
+ {
+ 'machineId': 'studio',
+ 'machineName': 'Mac Studio',
+ 'shipped': 5,
+ 'busyHours': 31,
+ 'subscriptions': [
+ {'engine': 'claude', 'usedPercent': 38, 'resetsAt': resets},
+ {'engine': 'codex', 'usedPercent': null, 'resetsAt': null},
+ ],
+ },
+ {
+ 'machineId': 'mbp',
+ 'machineName': 'MacBook Pro',
+ 'shipped': 0,
+ 'busyHours': 0,
+ 'subscriptions': <Map<String, dynamic>>[],
+ },
+ ];
+ final controller = await show(tester, server);
+ await tester.tap(person('owner'));
+ await tester.pumpAndSettle();
+ final dialog = find.byType(SuperTabDetailDialog);
+ Finder inDialog(String text) =>
+ find.descendant(of: dialog, matching: find.text(text));
+ expect(inDialog('Brought'), findsOneWidget);
+ expect(inDialog('Mac Studio'), findsOneWidget);
+ expect(inDialog('5 shipped · 31 h for others'), findsOneWidget);
+ expect(inDialog('Claude'), findsOneWidget);
+ expect(inDialog('38% used · resets in 3d'), findsOneWidget);
+ expect(inDialog('Codex'), findsOneWidget);
+ expect(inDialog('not read yet'), findsOneWidget);
+ expect(inDialog('MacBook Pro'), findsOneWidget);
+ expect(inDialog('0 shipped · 0 h for others'), findsOneWidget);
+ // Brought replaces Lent: the same machines, told more.
+ expect(inDialog('Lent'), findsNothing);
+ expect(tester.takeException(), isNull);
+ await close(tester, controller);
+ },
+ );
+
+ testWidgets('says so when the person brought nothing', (tester) async {
+ final server = humansSwarm();
+ details(server, 'peer')['brought'] = <Map<String, dynamic>>[];
+ final controller = await show(tester, server);
+ await tester.tap(person('peer'));
+ await tester.pumpAndSettle();
+ expect(find.text('Brought'), findsOneWidget);
+ expect(find.text('No machines brought yet'), findsOneWidget);
+ expect(find.text('Lent'), findsNothing);
+ await close(tester, controller);
+ });
+ });
}
diff --git a/desktop/test/super_tab_leaderboard_shots_test.dart b/desktop/test/super_tab_leaderboard_shots_test.dart
index 7a988debf..cbf69bdb0 100644
--- a/desktop/test/super_tab_leaderboard_shots_test.dart
+++ b/desktop/test/super_tab_leaderboard_shots_test.dart
@@ -9,6 +9,7 @@ import 'package:harness/super_tabs/view.dart';
import 'support/capture.dart';
import 'support/humans_fixture.dart';
import 'support/super_tab_fixture.dart';
+import 'support/super_tab_members.dart';
/// Set to a folder to write the Humans leaderboard's screenshots there: the
/// real right pane over the in-memory Swarm, never a backend or the live app.
@@ -66,6 +67,58 @@ void main() {
}
}, skip: shots == null);
+ testWidgets('Brought screenshots for review (contributor view, #2444)', (
+ tester,
+ ) async {
+ ConversationServer brought() {
+ final server = humansSwarm();
+ final ken = (server.leaderboard!['people'] as List)
+ .cast<Map>()
+ .firstWhere((p) => p['personId'] == 'owner');
+ final resets = DateTime.now()
+ .add(const Duration(days: 3, hours: 2))
+ .millisecondsSinceEpoch;
+ (ken['details'] as Map)['brought'] = [
+ {
+ 'machineId': 'studio',
+ 'machineName': 'Mac Studio',
+ 'shipped': 5,
+ 'busyHours': 31,
+ 'subscriptions': [
+ {'engine': 'claude', 'usedPercent': 38, 'resetsAt': resets},
+ {'engine': 'codex', 'usedPercent': null, 'resetsAt': null},
+ ],
+ },
+ {
+ 'machineId': 'mbp',
+ 'machineName': 'MacBook Pro',
+ 'shipped': 0,
+ 'busyHours': 0,
+ 'subscriptions': [
+ {
+ 'engine': 'claude',
+ 'usedPercent': 71,
+ 'resetsAt': resets + 3 * 86400000,
+ },
+ ],
+ },
+ ];
+ return server;
+ }
+
+ for (final (brightness, name) in [
+ (Brightness.light, 'light'),
+ (Brightness.dark, 'dark'),
+ ]) {
+ await showHumans(tester, brightness, swarm: brought);
+ await openSuperTabMembers(tester);
+ await tester.tap(find.byKey(const ValueKey('super-person-owner')));
+ await tester.pumpAndSettle();
+ await captureWindow(tester, shots, 'brought-$name');
+ await tester.pumpWidget(const SizedBox());
+ }
+ }, skip: shots == null);
+
testWidgets('member list and Models screenshots for review', (tester) async {
for (final (brightness, name) in [
(Brightness.light, 'light'),
diff --git a/desktop/test/super_tab_mentions_test.dart b/desktop/test/super_tab_mentions_test.dart
index 25fc83127..9bb698274 100644
--- a/desktop/test/super_tab_mentions_test.dart
+++ b/desktop/test/super_tab_mentions_test.dart
@@ -1183,6 +1183,31 @@ void main() {
]);
});
+ // Diego (11-03): the chat notice named no Swarm or chat, so the macOS
+ // runner dropped its click and Linux had nothing to open.
+ test(
+ 'a chat notice names its Swarm and chat, so a click opens it',
+ () async {
+ final notices = ShownNotices();
+ final store = DesktopNotificationStore(storage: MemoryStore());
+ await store.set(true);
+ final system = SystemNotifications(store: store, notifier: notices);
+ expect(superTabChatNotice(system, web: true), isNull);
+ superTabChatNotice(system, web: false)!(
+ 'tab-1',
+ SuperTabConversation.fromJson(
+ conversationFixture('offline', 'Offline editing'),
+ ),
+ 7,
+ );
+ await pumpEventQueue();
+ expect(notices.shown, [
+ (title: 'Offline editing', body: 'New messages'),
+ ]);
+ expect(notices.routes, [('@chat', 'tab-1/offline')]);
+ },
+ );
+
test('the client hands each new tag of an open Swarm over', () async {
final server = ConversationServer()..tag('message-1', text: 'Old');
final arrived = <String>[];
diff --git a/desktop/test/super_tab_menu_bar_notices_test.dart b/desktop/test/super_tab_menu_bar_notices_test.dart
index 999180fab..449bb0f3b 100644
--- a/desktop/test/super_tab_menu_bar_notices_test.dart
+++ b/desktop/test/super_tab_menu_bar_notices_test.dart
@@ -452,8 +452,9 @@ void main() {
}, variant: TargetPlatformVariant.only(TargetPlatform.macOS));
/// Mounts [f]'s app with its windows answering, and clicks a tag's system
- /// notice as the macOS runner sends it back.
- Future<Future<void> Function(String agentId)> clicker(
+ /// notice (or another Swarm notice, by its [machine] slot) as the macOS
+ /// runner sends it back.
+ Future<Future<void> Function(String agentId, {String machine})> clicker(
WidgetTester tester,
SuperTabLaunchFixture f,
) async {
@@ -473,14 +474,14 @@ void main() {
}
await mount(tester, f.app, nativeTabs: true);
await tester.pump();
- return (agentId) async {
+ return (
+ agentId, {
+ String machine = SystemNotifications.mentionNoticeMachine,
+ }) async {
messenger.handlePlatformMessage(
'harness/notifications',
const StandardMethodCodec().encodeMethodCall(
- MethodCall('tapped', {
- 'machineId': SystemNotifications.mentionNoticeMachine,
- 'agentId': agentId,
- }),
+ MethodCall('tapped', {'machineId': machine, 'agentId': agentId}),
),
(_) {},
);
@@ -531,6 +532,34 @@ void main() {
variant: TargetPlatformVariant.only(TargetPlatform.macOS),
);
+ // Diego (11-03): a chat's New messages notice opened nothing; it carried
+ // no Swarm or chat, so the click never reached the app.
+ testWidgets(
+ 'a click on a chat\'s New messages notification brings its Swarm tab '
+ 'forward and opens that chat',
+ (tester) async {
+ final f = SuperTabLaunchFixture(
+ connectionFactory: TwoSwarms.new,
+ systemNotifications: clicks(),
+ );
+ await tester.runAsync(() => openWithNotices(f));
+ final swarmTab = f.app.activeSwarmId;
+ f.app.newSwarm(name: 'Desktop');
+ final click = await clicker(tester, f);
+ final c = f.app.superTabs.peek(tabId)!;
+ // A chat the person can no longer read opens nothing.
+ await click('$tabId/gone', machine: '@chat');
+ expect(f.app.activeSwarmId, isNot(swarmTab));
+ await click('$tabId/offline', machine: '@chat');
+ expect(f.app.activeSwarmId, swarmTab);
+ expect(c.selectedId, 'offline');
+ await tester.pump(const Duration(seconds: 1));
+ await tester.pumpWidget(const SizedBox());
+ f.dispose();
+ },
+ variant: TargetPlatformVariant.only(TargetPlatform.macOS),
+ );
+
testWidgets(
'a click on a tag in a Swarm not loaded yet loads it, checks the tag, '
'and opens it',
diff --git a/desktop/test/super_tab_personal_projects_test.dart b/desktop/test/super_tab_personal_projects_test.dart
index 7114fd21d..f6784b6bd 100644
--- a/desktop/test/super_tab_personal_projects_test.dart
+++ b/desktop/test/super_tab_personal_projects_test.dart
@@ -22,8 +22,14 @@ import 'support/capture.dart';
/// Set to a folder to write the PR's pictures there.
final _shots = Platform.environment['PERSONAL_PROJECTS_SHOTS'];
-/// A pane's agent, in a checkout of [remote] (none for a folder).
-Agent _agent(String id, {String? remote, String cwd = '/work/x'}) => Agent(
+/// A pane's agent, in a checkout of [remote] (none for a folder), which
+/// stands for [repository] when its host is an SSH alias.
+Agent _agent(
+ String id, {
+ String? remote,
+ String? repository,
+ String cwd = '/work/x',
+}) => Agent(
id: id,
name: 'Agent $id',
engine: 'codex',
@@ -33,6 +39,7 @@ Agent _agent(String id, {String? remote, String cwd = '/work/x'}) => Agent(
cwd: cwd,
root: remote == null ? null : cwd,
remote: remote,
+ repository: repository,
),
);
@@ -254,14 +261,34 @@ void main() {
);
});
+ test('a remote through an SSH host alias is a repo too (task #2476)', () {
+ // A second GitHub account's clone (`git@gh-work:acme/api.git`, #2525):
+ // the daemon reports its alias as the host, with no dot in it.
+ expect(normalizedRemote('gh-work/acme/api'), 'gh-work/acme/api');
+ expect(normalizedRemote('GH-Work/Acme/Api'), 'gh-work/acme/api');
+ expect(normalizedRemote('gitserver:2222/team/api'), 'gitserver/team/api');
+ // `Host github.com-work` is the other common way to name one.
+ expect(
+ normalizedRemote('github.com-work/acme/api'),
+ 'github.com-work/acme/api',
+ );
+ expect(normalizedRemote('git@gh-work:Acme/Api.git'), 'gh-work/acme/api');
+ });
+
test('a folder or nothing is no repo', () {
for (final form in [
null,
'',
'/srv/git/api.git',
+ '/srv/api',
'./api',
+ '../api',
+ '.hidden/api',
'file:///srv/git/api.git',
r'C:\repos\api',
+ r'C:\api',
+ 'C:/repos/api',
+ 'c/api',
]) {
expect(normalizedRemote(form), isNull, reason: form);
}
@@ -762,6 +789,103 @@ void main() {
expect(keys[p.folder], personalTabKey('one'));
});
+ test(
+ 'a pane on an SSH alias clone joins its repo, not its tab (task #2476)',
+ () async {
+ final f = SuperTabLaunchFixture();
+ f.app.machineStates['m']!.agents = [
+ _agent('a1', remote: 'gh-work/acme/api', cwd: '/w/api'),
+ _agent('f1', cwd: '/w/notes'),
+ ];
+ _machine(f.app, 'laptop').agents = [
+ _agent('a2', remote: 'gh-work/acme/api', cwd: '/x/api'),
+ ];
+ _tab(f.app, 'one', [_pane('m', 'a1'), _pane('m', 'f1')]);
+ _tab(f.app, 'two', [_pane('laptop', 'a2')]);
+ expect(
+ [for (final e in personalPanes(f.app)) e.repo],
+ ['gh-work/acme/api', personalTabKey('one'), 'gh-work/acme/api'],
+ );
+ final c = await _personal(f);
+ await PersonalProjects.of(f.app).sync(c);
+ expect(
+ [for (final p in _commands(f)) p['command']['name']],
+ ['api', kTabProjectName],
+ );
+ final api = c.snapshot!.projects
+ .firstWhere((p) => p.name == 'api')
+ .leadConversationId;
+ // Both panes, in two tabs on two computers, are the one project's.
+ expect(
+ [
+ for (final p in PersonalProjects.of(f.app).panesFor(c, api))
+ p.agentId,
+ ],
+ ['a1', 'a2'],
+ );
+ },
+ );
+
+ test('the repo an alias stands for is the one project on every computer (task #2476)', () async {
+ final f = SuperTabLaunchFixture();
+ // This Mac cloned it through `Host gh-work`; the laptop straight from GitHub.
+ f.app.machineStates['m']!.agents = [
+ _agent(
+ 'a1',
+ remote: 'gh-work/acme/api',
+ repository: 'github.com/acme/api',
+ cwd: '/w/api',
+ ),
+ // A repository that is no remote is not believed: the remote stands.
+ _agent('a3', remote: 'gh-work/acme/web', repository: '/srv/web'),
+ ];
+ _machine(f.app, 'laptop').agents = [
+ _agent('a2', remote: 'github.com/acme/api', cwd: '/x/api'),
+ ];
+ _tab(f.app, 'one', [_pane('m', 'a1'), _pane('m', 'a3')]);
+ _tab(f.app, 'two', [_pane('laptop', 'a2')]);
+ expect(
+ [for (final e in personalPanes(f.app)) e.repo],
+ ['github.com/acme/api', 'gh-work/acme/web', 'github.com/acme/api'],
+ );
+ final c = await _personal(f);
+ await PersonalProjects.of(f.app).sync(c);
+ expect(
+ [for (final p in _commands(f)) p['operationId']],
+ [
+ personalProjectOperation('github.com/acme/api'),
+ personalProjectOperation('gh-work/acme/web'),
+ ],
+ );
+ });
+
+ test('the daemon\'s repository is read with the project', () {
+ final project = AgentProject.fromJson({
+ 'name': 'api',
+ 'cwd': '/w/api',
+ 'root': '/w/api',
+ 'remote': 'gh-work/acme/api',
+ 'repository': 'github.com/acme/api',
+ })!;
+ expect(project.repository, 'github.com/acme/api');
+ expect(
+ project,
+ isNot(
+ AgentProject.fromJson({
+ 'name': 'api',
+ 'cwd': '/w/api',
+ 'root': '/w/api',
+ 'remote': 'gh-work/acme/api',
+ }),
+ ),
+ );
+ // An older daemon sends none.
+ expect(
+ AgentProject.fromJson({'name': 'x', 'cwd': '/x'})!.repository,
+ isNull,
+ );
+ });
+
test('a renamed tab keeps its project and its name', () async {
final f = SuperTabLaunchFixture();
final p = _huyDesk(f);
diff --git a/desktop/test/system_notifications_test.dart b/desktop/test/system_notifications_test.dart
index 014be547a..9b15efe0f 100644
--- a/desktop/test/system_notifications_test.dart
+++ b/desktop/test/system_notifications_test.dart
@@ -116,7 +116,13 @@ class _ConflictApi extends ApiClient {
Future<Map<String, dynamic>?> daemonDevices() async => {
'members': <Object?>[],
'pending': <String>[],
- 'conflict': {'pub': 'holder', 'label': 'Old install', 'fingerprint': 'AAAA·BBBB', 'addedAt': 5, 'afterJoin': true},
+ 'conflict': {
+ 'pub': 'holder',
+ 'label': 'Old install',
+ 'fingerprint': 'AAAA·BBBB',
+ 'addedAt': 5,
+ 'afterJoin': true,
+ },
};
}
@@ -282,58 +288,69 @@ void main() {
// Notifications are off until somebody wants them; the one offer comes
// when an agent finished while the person was away and nothing told them.
- test('an agent that finished while away offers notifications once, on return', () async {
- os = _Recorder();
- state = AppLifecycleState.inactive;
- final app = AppNotifier(
- config: AppConfig.dev,
- authSession: AuthSession(),
- alerts: AlertSounds(
- store: AlertSoundStore(storage: _Memory()),
- channel: const MethodChannel('test/no-sound'),
- ),
- agentAlerts: AgentAlerts(store: ScreenAlertStore(storage: _Memory())),
- systemNotifications: SystemNotifications(store: store(on: false), notifier: os),
- )..lifecycle = () => state;
- addTearDown(app.dispose);
- app.notificationOfferStoreForTest = NotificationOfferStore(storage: _Memory());
- app.machines = [_machine];
- app.machineStates['m1'] = MachineState(_machine)
- ..agents = [const Agent(id: 'a1', name: 'Fix login', engine: 'codex')];
- var offers = 0;
- app.notificationOffer = () => offers++;
- app.appLifecycleChanged(AppLifecycleState.inactive);
- await finish(app);
- await Future<void>.delayed(Duration.zero);
- expect(os.shown, isEmpty);
- expect(offers, 0, reason: 'not while the person is away');
- state = AppLifecycleState.resumed;
- app.appLifecycleChanged(AppLifecycleState.resumed);
- expect(offers, 1);
- expect(app.notificationOfferStoreForTest.value, isTrue);
+ test(
+ 'an agent that finished while away offers notifications once, on return',
+ () async {
+ os = _Recorder();
+ state = AppLifecycleState.inactive;
+ final app = AppNotifier(
+ config: AppConfig.dev,
+ authSession: AuthSession(),
+ alerts: AlertSounds(
+ store: AlertSoundStore(storage: _Memory()),
+ channel: const MethodChannel('test/no-sound'),
+ ),
+ agentAlerts: AgentAlerts(store: ScreenAlertStore(storage: _Memory())),
+ systemNotifications: SystemNotifications(
+ store: store(on: false),
+ notifier: os,
+ ),
+ )..lifecycle = () => state;
+ addTearDown(app.dispose);
+ app.notificationOfferStoreForTest = NotificationOfferStore(
+ storage: _Memory(),
+ );
+ app.machines = [_machine];
+ app.machineStates['m1'] = MachineState(
+ _machine,
+ )..agents = [const Agent(id: 'a1', name: 'Fix login', engine: 'codex')];
+ var offers = 0;
+ app.notificationOffer = () => offers++;
+ app.appLifecycleChanged(AppLifecycleState.inactive);
+ await finish(app);
+ await Future<void>.delayed(Duration.zero);
+ expect(os.shown, isEmpty);
+ expect(offers, 0, reason: 'not while the person is away');
+ state = AppLifecycleState.resumed;
+ app.appLifecycleChanged(AppLifecycleState.resumed);
+ expect(offers, 1);
+ expect(app.notificationOfferStoreForTest.value, isTrue);
- state = AppLifecycleState.inactive;
- app.appLifecycleChanged(AppLifecycleState.inactive);
- await app.handleMachineEventForTest('m1', {
- 'type': 'turn_summary',
- 'agentId': 'a1',
- 'payload': {
+ state = AppLifecycleState.inactive;
+ app.appLifecycleChanged(AppLifecycleState.inactive);
+ await app.handleMachineEventForTest('m1', {
+ 'type': 'turn_summary',
'agentId': 'a1',
- 'notification': {'id': 'result-a1-2', 'kind': 'done'},
- },
- });
- app.appLifecycleChanged(AppLifecycleState.resumed);
- expect(offers, 1, reason: 'asked once, whatever the answer');
+ 'payload': {
+ 'agentId': 'a1',
+ 'notification': {'id': 'result-a1-2', 'kind': 'done'},
+ },
+ });
+ app.appLifecycleChanged(AppLifecycleState.resumed);
+ expect(offers, 1, reason: 'asked once, whatever the answer');
- await app.acceptNotificationOffer();
- expect(app.systemNotifications.store.value, isTrue);
- expect(os.authorizations, 1);
- });
+ await app.acceptNotificationOffer();
+ expect(app.systemNotifications.store.value, isTrue);
+ expect(os.authorizations, 1);
+ },
+ );
test('no offer when notifications are already on', () async {
final app = wired();
addTearDown(app.dispose);
- app.notificationOfferStoreForTest = NotificationOfferStore(storage: _Memory());
+ app.notificationOfferStoreForTest = NotificationOfferStore(
+ storage: _Memory(),
+ );
var offers = 0;
app.notificationOffer = () => offers++;
app.appLifecycleChanged(AppLifecycleState.inactive);
@@ -373,21 +390,24 @@ void main() {
expect(os.withdrawn, [SystemNotifications.idFor('m1', 'a1')]);
});
- test('reading on the dial withdraws the banner and system notification', () async {
- final app = wired();
- addTearDown(app.dispose);
- await finish(app);
- await Future<void>.delayed(Duration.zero);
- expect(app.agentAlerts.alerts, hasLength(1));
- final token = app.agentUnread.readTokenFor('m1', 'a1')!;
- await app.handleMachineEventForTest('m1', {
- 'type': 'dial_notification_read',
- 'payload': {'machineId': 'm1', 'agentId': 'a1', 'readToken': token},
- });
- expect(app.agentUnread.count, 0);
- expect(app.agentAlerts.alerts, isEmpty);
- expect(os.withdrawn, [SystemNotifications.idFor('m1', 'a1')]);
- });
+ test(
+ 'reading on the dial withdraws the banner and system notification',
+ () async {
+ final app = wired();
+ addTearDown(app.dispose);
+ await finish(app);
+ await Future<void>.delayed(Duration.zero);
+ expect(app.agentAlerts.alerts, hasLength(1));
+ final token = app.agentUnread.readTokenFor('m1', 'a1')!;
+ await app.handleMachineEventForTest('m1', {
+ 'type': 'dial_notification_read',
+ 'payload': {'machineId': 'm1', 'agentId': 'a1', 'readToken': token},
+ });
+ expect(app.agentUnread.count, 0);
+ expect(app.agentAlerts.alerts, isEmpty);
+ expect(os.withdrawn, [SystemNotifications.idFor('m1', 'a1')]);
+ },
+ );
});
group('macOS', () {
@@ -473,9 +493,15 @@ void main() {
),
(_) {},
);
- await tap({'machineId': SystemNotifications.deviceNoticeMachine, 'agentId': 'pub-1'});
+ await tap({
+ 'machineId': SystemNotifications.deviceNoticeMachine,
+ 'agentId': 'pub-1',
+ });
// A device notice with no key in it opens nothing.
- await tap({'machineId': SystemNotifications.deviceNoticeMachine, 'agentId': ''});
+ await tap({
+ 'machineId': SystemNotifications.deviceNoticeMachine,
+ 'agentId': '',
+ });
expect(taps, ['@device/pub-1']);
mac.onTap = null;
});
@@ -485,11 +511,19 @@ void main() {
test('carry the device in the click slots; an account notice without one carries nothing', () async {
final os = _Recorder();
final system = SystemNotifications(store: store(), notifier: os);
- system.postNotice(id: 'harness-device:p', title: 'New device on your account', body: 'b', devicePub: 'p');
+ system.postNotice(
+ id: 'harness-device:p',
+ title: 'New device on your account',
+ body: 'b',
+ devicePub: 'p',
+ );
system.postNotice(id: 'harness-other', title: 't', body: 'b');
await Future<void>.delayed(Duration.zero);
expect(SystemNotifications.deviceNoticeMachine, '@device');
- expect(os.shown.map((s) => (s.machineId, s.agentId)), [('@device', 'p'), ('', '')]);
+ expect(os.shown.map((s) => (s.machineId, s.agentId)), [
+ ('@device', 'p'),
+ ('', ''),
+ ]);
});
test('a device the daemon announces reaches the system, naming the device and where to remove it', () async {
@@ -506,7 +540,12 @@ void main() {
app.ownDaemonMachineIdForTest('m1');
await app.handleEventForTest('m1', {
'type': 'device_key_added',
- 'payload': {'pub': 'pub-1', 'label': 'Test iPad', 'kind': 'viewer', 'fingerprint': 'AAAA·BBBB·CCCC·DDDD'},
+ 'payload': {
+ 'pub': 'pub-1',
+ 'label': 'Test iPad',
+ 'kind': 'viewer',
+ 'fingerprint': 'AAAA·BBBB·CCCC·DDDD',
+ },
});
await Future<void>.delayed(Duration.zero);
expect(app.newDevices.single.pub, 'pub-1');
@@ -518,12 +557,23 @@ void main() {
expect((shown.machineId, shown.agentId), ('@device', 'pub-1'));
});
- Map<String, Object?> removedFrame({bool signerPending = false, bool selfRemoved = false, String pub = 'gone'}) => {
+ Map<String, Object?> removedFrame({
+ bool signerPending = false,
+ bool selfRemoved = false,
+ String pub = 'gone',
+ }) => {
'type': 'device_key_removed',
'payload': {
- 'pub': pub, 'label': 'Old iPad', 'kind': 'viewer', 'fingerprint': 'AAAA·BBBB',
- 'signer': 'signer', 'signerLabel': 'MacBook', 'signerFingerprint': 'E2FB·0DF5·5FD8·E6C7',
- 'signerPending': signerPending, 'selfRemoved': selfRemoved, 'at': 1,
+ 'pub': pub,
+ 'label': 'Old iPad',
+ 'kind': 'viewer',
+ 'fingerprint': 'AAAA·BBBB',
+ 'signer': 'signer',
+ 'signerLabel': 'MacBook',
+ 'signerFingerprint': 'E2FB·0DF5·5FD8·E6C7',
+ 'signerPending': signerPending,
+ 'selfRemoved': selfRemoved,
+ 'at': 1,
},
};
@@ -544,19 +594,34 @@ void main() {
await Future<void>.delayed(Duration.zero);
// The same device twice is one notice, the later word.
expect(app.deviceRemovals.single.signerPending, isTrue);
- expect(os.shown.map((n) => n.title), ['Device removed', 'Removed by a new device']);
- expect(os.shown.first.body, 'Old iPad was removed from your account by MacBook.');
+ expect(os.shown.map((n) => n.title), [
+ 'Device removed',
+ 'Removed by a new device',
+ ]);
+ expect(
+ os.shown.first.body,
+ 'Old iPad was removed from your account by MacBook.',
+ );
expect((os.shown.first.machineId, os.shown.first.agentId), ('', ''));
- expect((os.shown.last.machineId, os.shown.last.agentId), ('@device', 'signer'));
+ expect(
+ (os.shown.last.machineId, os.shown.last.agentId),
+ ('@device', 'signer'),
+ );
// A new device that signs itself out is its own act: not red, and nothing to open.
- await app.handleEventForTest('m1', removedFrame(signerPending: true, selfRemoved: true, pub: 'other'));
+ await app.handleEventForTest(
+ 'm1',
+ removedFrame(signerPending: true, selfRemoved: true, pub: 'other'),
+ );
expect(os.shown.last.title, 'Device signed out');
expect((os.shown.last.machineId, os.shown.last.agentId), ('', ''));
app.dismissDeviceRemoval('gone');
app.dismissDeviceRemoval('other');
expect(app.deviceRemovals, isEmpty);
// A frame that is not whole raises nothing.
- await app.handleEventForTest('m1', {'type': 'device_key_removed', 'payload': {'pub': 'x'}});
+ await app.handleEventForTest('m1', {
+ 'type': 'device_key_removed',
+ 'payload': {'pub': 'x'},
+ });
expect(app.deviceRemovals, isEmpty);
});
@@ -587,7 +652,11 @@ void main() {
systemNotifications: SystemNotifications(store: store(), notifier: os),
);
addTearDown(app.dispose);
- const relayed = Machine(machineId: 'relayed', authMode: MachineAuthMode.remote, name: 'Remote');
+ const relayed = Machine(
+ machineId: 'relayed',
+ authMode: MachineAuthMode.remote,
+ name: 'Remote',
+ );
app.machines = [_machine, relayed];
app.machineStates['m1'] = MachineState(_machine);
// The relayed machine carries a backend-supplied computer id that says it is "local": still not the daemon.
@@ -597,8 +666,20 @@ void main() {
'type': 'device_key_added',
'payload': {'pub': 'fake', 'label': 'X', 'kind': 'viewer'},
});
- await app.handleEventForTest('relayed', removedFrame(signerPending: true));
- await app.handleEventForTest('relayed', {'type': 'device_conflict', 'payload': {'pub': 'holder', 'label': 'H', 'fingerprint': 'AAAA', 'addedAt': 5, 'afterJoin': true}});
+ await app.handleEventForTest(
+ 'relayed',
+ removedFrame(signerPending: true),
+ );
+ await app.handleEventForTest('relayed', {
+ 'type': 'device_conflict',
+ 'payload': {
+ 'pub': 'holder',
+ 'label': 'H',
+ 'fingerprint': 'AAAA',
+ 'addedAt': 5,
+ 'afterJoin': true,
+ },
+ });
await Future<void>.delayed(Duration.zero);
expect(app.newDevices, isEmpty);
expect(app.deviceRemovals, isEmpty);
@@ -610,7 +691,11 @@ void main() {
});
test('a conflict frame is only a hint: the conflict is re-read from the daemon, and stays dismissed', () async {
- final app = AppNotifier(config: AppConfig.dev, authSession: AuthSession(), configStore: null);
+ final app = AppNotifier(
+ config: AppConfig.dev,
+ authSession: AuthSession(),
+ configStore: null,
+ );
addTearDown(app.dispose);
final api = _ConflictApi();
app.api = api;
@@ -620,7 +705,13 @@ void main() {
// A frame carrying a fake holder changes nothing by itself: what the daemon lists is what shows.
final frame = {
'type': 'device_conflict',
- 'payload': {'pub': 'fake', 'label': 'Fake', 'fingerprint': 'FFFF', 'addedAt': 5, 'afterJoin': true},
+ 'payload': {
+ 'pub': 'fake',
+ 'label': 'Fake',
+ 'fingerprint': 'FFFF',
+ 'addedAt': 5,
+ 'afterJoin': true,
+ },
};
await app.handleEventForTest('m1', frame);
await Future<void>.delayed(Duration.zero);
@@ -752,6 +843,191 @@ void main() {
skip: Platform.isWindows,
);
+ // Diego (11-03): on Linux no Swarm notice click did anything. notify-send
+ // reports the click on its default action while it waits (--wait).
+ group('a click on a tag or chat notice', () {
+ Future<void> notice(LinuxSystemNotifier n, String machine, String to) =>
+ n.show(
+ id: 'harness-chat:$to',
+ title: 'Offline editing',
+ body: 'New messages',
+ machineId: machine,
+ agentId: to,
+ );
+
+ test('comes back as its target', () async {
+ final n = linux(
+ (args) => args.contains('--wait')
+ ? ProcessResult(0, 0, 'default\n', '')
+ : ProcessResult(0, 0, '7\n', ''),
+ );
+ final taps = <(String, String)>[];
+ n.onTap = (machine, agent) => taps.add((machine, agent));
+ await notice(n, '@chat', 'tab-1/offline');
+ await notice(n, SystemNotifications.mentionNoticeMachine, 'tab-1/m-2');
+ await pumpEventQueue();
+ expect(ran[0], containsAll(['--action=default=Open', '--wait']));
+ expect(taps, [
+ ('@chat', 'tab-1/offline'),
+ (SystemNotifications.mentionNoticeMachine, 'tab-1/m-2'),
+ ]);
+ // An agent's alert still replaces its last one, and waits for nothing.
+ await post(n);
+ expect(ran.last, contains('--print-id'));
+ expect(ran.last, isNot(contains('--wait')));
+ });
+
+ test('closed without a click opens nothing', () async {
+ final n = linux((_) => ProcessResult(0, 0, '', ''));
+ final taps = <(String, String)>[];
+ n.onTap = (machine, agent) => taps.add((machine, agent));
+ await notice(n, '@chat', 'tab-1/offline');
+ await pumpEventQueue();
+ expect(taps, isEmpty);
+ });
+
+ test('an old notify-send without actions still shows it', () async {
+ final n = linux(
+ (args) => args.contains('--wait')
+ ? ProcessResult(0, 1, '', 'Unknown option --action')
+ : ProcessResult(0, 0, '', ''),
+ );
+ await notice(n, '@chat', 'tab-1/offline');
+ await pumpEventQueue();
+ expect(ran, hasLength(2));
+ expect(ran.last, isNot(contains('--wait')));
+ expect(ran.last, contains('Offline editing'));
+ // Asked once: the next notice goes up plainly at once.
+ await notice(n, '@chat', 'tab-1/other');
+ await pumpEventQueue();
+ expect(ran, hasLength(3));
+ expect(ran.last, isNot(contains('--wait')));
+ });
+
+ /// A fake [NoticeWaiter]: each wait stays open until the test answers it, and a kill
+ /// ends it as a signal does.
+ ({
+ LinuxSystemNotifier notifier,
+ List<Completer<ProcessResult>> open,
+ List<int> killed,
+ List<Duration> limits,
+ List<List<String>> plain,
+ })
+ waiting() {
+ final open = <Completer<ProcessResult>>[];
+ final killed = <int>[];
+ final limits = <Duration>[];
+ final plain = <List<String>>[];
+ final notifier = LinuxSystemNotifier(
+ run: (exe, args) async {
+ plain.add(args);
+ return ProcessResult(0, 0, '', '');
+ },
+ wait: (exe, args, {required limit}) {
+ final i = open.length;
+ final done = Completer<ProcessResult>();
+ open.add(done);
+ limits.add(limit);
+ return (
+ result: done.future,
+ kill: () {
+ killed.add(i);
+ if (!done.isCompleted) {
+ done.complete(ProcessResult(0, -15, '', ''));
+ }
+ },
+ );
+ },
+ );
+ return (
+ notifier: notifier,
+ open: open,
+ killed: killed,
+ limits: limits,
+ plain: plain,
+ );
+ }
+
+ // Review of #2808 (Lyra): GNOME and KDE keep an unclicked notice in their list, so a
+ // wait can last all session; once eight were stuck, no notice could be clicked again.
+ test(
+ 'past eight waiting, the oldest gives way and the newest still opens',
+ () async {
+ final w = waiting();
+ final taps = <(String, String)>[];
+ w.notifier.onTap = (machine, agent) => taps.add((machine, agent));
+ for (var i = 0; i < 9; i++) {
+ await notice(w.notifier, '@chat', 'tab-1/c$i');
+ }
+ await pumpEventQueue();
+ expect(
+ w.open,
+ hasLength(9),
+ reason: 'every notice waits for its click',
+ );
+ expect(w.killed, [0], reason: 'the oldest wait gave way');
+ expect(w.plain, isEmpty);
+ w.open[8].complete(ProcessResult(0, 0, 'default\n', ''));
+ await pumpEventQueue();
+ expect(taps, [('@chat', 'tab-1/c8')]);
+ },
+ );
+
+ test('each wait has a time limit', () async {
+ final w = waiting();
+ await notice(w.notifier, '@chat', 'tab-1/offline');
+ expect(w.limits.single, greaterThan(Duration.zero));
+ expect(w.limits.single, lessThanOrEqualTo(const Duration(minutes: 30)));
+ });
+
+ test('a wait that fails still puts its notice up, plainly', () async {
+ final plain = <List<String>>[];
+ final n = LinuxSystemNotifier(
+ run: (exe, args) async {
+ plain.add(args);
+ return ProcessResult(0, 0, '', '');
+ },
+ wait: (exe, args, {required limit}) => (
+ result: Future.value(ProcessResult(0, 1, '', 'Could not connect')),
+ kill: () {},
+ ),
+ );
+ await notice(n, '@chat', 'tab-1/offline');
+ await pumpEventQueue();
+ expect(plain, hasLength(1));
+ expect(plain.single, contains('Offline editing'));
+ });
+ });
+
+ test(
+ 'a waiting notify-send stops at its limit, or when it is stopped',
+ () async {
+ // `sleep 30; true` keeps the shell's child, as Linux's dash keeps a lone one: stopping
+ // the shell leaves the child holding its output (CI, desktop shard 3, 11-03).
+ final answered = await waitOffUiIsolate('/bin/sh', [
+ '-c',
+ 'printf default',
+ ], limit: const Duration(minutes: 1)).result;
+ expect((answered.exitCode, answered.stdout), (0, 'default'));
+ final timedOut = await waitOffUiIsolate(
+ '/bin/sh',
+ ['-c', 'sleep 30; true'],
+ limit: const Duration(milliseconds: 200),
+ ).result.timeout(const Duration(seconds: 10));
+ expect(timedOut.exitCode, isNot(0));
+ final stopped = waitOffUiIsolate('/bin/sh', [
+ '-c',
+ 'sleep 30; true',
+ ], limit: const Duration(minutes: 1));
+ stopped.kill();
+ expect(
+ (await stopped.result.timeout(const Duration(seconds: 10))).exitCode,
+ isNot(0),
+ );
+ },
+ skip: Platform.isWindows,
+ );
+
test(
'a desktop without notify-send is unavailable, not an error',
() async {
diff --git a/docs/design/2026-11-03-swarm-settings.md b/docs/design/2026-11-03-swarm-settings.md
new file mode 100644
index 000000000..cc769d22f
--- /dev/null
+++ b/docs/design/2026-11-03-swarm-settings.md
@@ -0,0 +1,225 @@
+# Settings opened from Swarm: Swarm's look, a shorter list
+
+- Date: 2026-11-03
+- Scope: the phone app only (`mobile/`). Desktop and the backend do not change. Settings opened
+ from the terminal (Find, a terminal's menu, the screens before a computer is ready) does not
+ change either.
+- Base: `origin/main` @ `f7fdd4fd5`, branch `feat/mobile-swarm-settings`
+- Prototype: [2026-11-03-swarm-settings/prototype.html](2026-11-03-swarm-settings/prototype.html).
+ Open it in a browser. It shows the lean list as built next to the first cut, with the six changes
+ numbered.
+- Status: **implemented**. Tony picked direction A ("cards like You") and asked for Settings to
+ change only when opened from Swarm, with every label kept. Dee found the first cut too long, so
+ it was shortened to the "A lean" list described here, keeping every setting.
+
+## 1. Goal
+
+Settings opened from Swarm's You should look like the app that opened it, and it should be short
+enough to scan. Every setting and every fact must stay reachable.
+
+## 2. What was wrong
+
+Paths are relative to `mobile/lib/`.
+
+1. **It looked like a terminal, not like Swarm.** Every row was in the terminal's face, and it had
+ a 34pt title under a back row. Swarm draws a 52pt top bar, sans-serif rows and a mono title only.
+2. **The account card held 11 rows** of equal weight, with no glyphs and no grouping. It read like
+ a log.
+3. **Captions were lower case** ("account", "terminal"). Swarm writes them in sentence case.
+4. **Some rows spent lines on little.** Notifications had a two-line description cut off by "…".
+ Version and Build took a row each.
+5. **It was long:** 24 rows, 10 cards and 6 captions in the first cut of A, about 2.6 screens.
+ Help (3 rows) and About (2 rows) are opened once in a while but took about a fifth of the page.
+
+**Biggest issue:** one card of 11 equal rows in the terminal's face. It did not look like the app
+that opened it, and nothing told the eye where to look.
+
+## 3. Directions
+
+| | A · Cards like You (**chosen**) | B · Folded like Home | C · Two levels |
+|---|---|---|---|
+| Idea | One page in Swarm's cards, the account split by job | Flat 44pt rows; each section folds and shows a summary | The first page keeps you and your computers; the rest opens sub-pages |
+| Strongest point | Every row stays where it was; looks exactly like You | Shortest; most like Home | Shortest first page; familiar drill-down |
+| Cost | Long (fixed by the lean pass, section 5) | Folding is unusual in Settings; full-bleed rows differ from You, where it opens from | Terminal size is one tap deeper; four more pages |
+
+**Why not B.** A Settings page that folds is something people have not seen before, and its flat
+rows would not match You, the page Settings is opened from.
+
+**Why not C.** It costs the most and makes the setting people reach for most often, terminal
+size, one tap deeper. It is still the next step if the lean list is ever not short enough.
+
+## 4. The page as built
+
+```
+‹ Settings (SwarmTopBar)
+
+[ Tony at Autonomous › (avatar 40)
+ Usage ›
+ Notifications Off ›
+ Privacy › ]
+
+[ Computers ›
+ Profile All computers › (only with 2+ computers, or one chosen)
+ Connectors ›
+ Sign in a computer ›
+ Set up Intern 3 › ] (only while Computers has no list, D9)
+
+[ Your devices ›
+ Phone name iPhone 16 › ]
+
+Terminal
+[ ~/web ❯ claude "fix the login" (live preview)
+ Font SF Mono ›
+ Size − 13 +
+ Colors Graphite ›
+ Language English › ] (D6)
+
+Appearance
+[ App colors Graphite ›
+ Text size − 14 + ]
+
+Experimental
+[ Swarm (switch) ] (D5)
+
+[ Help › (sheet: How Harness works · Try the sample · Show the tips again)
+ About 1.0.12 (80) › ] (sheet: "Version 1.0.12 (80)" · Privacy Policy)
+```
+
+In the sample, a Sample caption heads the first card, which starts with "Leave the sample";
+Notifications and Privacy are not there, and Help's sheet offers no sample to try.
+
+## 5. Decisions
+
+### D1. Only when Settings is opened from Swarm
+
+- **Why:** Settings in the terminal is the phone's own look and must stay as it is (Tony,
+ 2026-11-03). One list in two looks avoids two copies of every row's logic drifting apart.
+- **Built:** `SettingsPage(swarm: true)`, pushed by `openPhoneSettings(..., swarm: true)` from
+ Swarm's `onSettings` in `phone/phone_shell.dart`. The page wraps its list in `SettingsSwarmLook`
+ (`phone/settings_row.dart`), an `InheritedWidget` read without a dependency. Inside it,
+ `SettingsCaption`, `SettingsGroup` and `SettingsRow` draw as `SwarmCaption`, `SwarmGroup` and
+ `SwarmRow`.
+
+### D2. Swarm's parts, as You uses them
+
+- **What:** `SwarmTopBar` with `SwarmBackButton` and a 17pt mono title; sentence-case captions;
+ cards; 56pt rows in the app's face, each led by a 22pt glyph (`SwarmRowGlyph`, shared with You).
+- **Why:** You opens Settings, so the two pages should read as one app. You's private glyph became
+ the shared `SwarmRowGlyph` so both draw it the same way.
+- **Kept on purpose:** the 56pt row height and the glyphs. Shorter rows were considered: they save
+ little height, and they cost touch targets under 44pt and rows that no longer match You.
+
+### D3. Every label stays
+
+- **Why:** copy is the same on every screen of a flow (one source of words). This includes "Your
+ devices", which here means the devices signed in to the account while You ▸ Your devices means
+ computers. The clash is known and left for a naming decision.
+
+### D4. The account in three cards, with no caption
+
+- **What:** you, with Usage, Notifications and Privacy; your computers; this phone.
+- **Why:** You splits its rows into uncaptioned cards by job, and a card is what says which rows
+ belong together. The first cut had you alone in a fourth card; a card of one row cost a card's
+ gap for nothing.
+- **Cost:** none found. Each row keeps its place in reading order.
+
+### D5. One-line rows: no description under Notifications or Swarm
+
+- **Why:** On or Off says what Notifications needs to say, and its two-line description was cut
+ off anyway. Swarm's own intro page explains Swarm as it is turned on, so the switch row does
+ not need to.
+- **Cost:** the "When …" sentence and Swarm's description are no longer visible here. Both remain
+ in the terminal's Settings.
+
+### D6. Language closes Terminal's card; no Voice caption
+
+- **What:** the mic's language is the last row of the Terminal card, led by the mic glyph.
+- **Why:** a caption over a one-row card cost about 50pt for the least content on the page. In Swarm's look every row has a glyph, and the mic glyph says what the row is about
+ where the terminal's plain rows needed a caption.
+- **Cost:** this reverses an earlier decision for the terminal's Settings (see the comment above
+ the Voice caption in `phone/settings_page.dart`): someone scanning for the word "Voice" finds
+ none. The terminal's Settings keeps its Voice section.
+
+### D7. Help is one row that opens a sheet
+
+- **What:** Help opens a sheet with its three rows, in the same words: How Harness works and Try
+ the sample (doors, with chevrons) and Show the tips again (an action).
+- **Why:** all three are opened once in a while; three rows became one.
+- **Cost:** one more tap to reach each of them.
+
+### D8. About is one row with the version on it
+
+- **What:** "About 1.0.12 (80)". A tap opens a sheet titled "Version 1.0.12 (80)" with the Privacy
+ Policy.
+- **Why:** the version and the build, the figures support asks for, are visible without a tap.
+ The Privacy Policy is needed by the stores, which ask only that it be reachable from inside the
+ app.
+- **Cost:** the Privacy Policy is two taps away instead of one.
+
+### D9. Set up Intern 3 is left to Computers, except while there is no computer
+
+- **What:** the row shows only while `visibleMachines(notifier)` is empty.
+- **Why:** Computers has the same button under its list (`phone/machines_tab.dart`,
+ `machines-set-up-device`), so the row was a duplicate. But with no computer (none yet, still
+ loading, or the list could not be fetched) Computers is an empty state whose only button is Add
+ computer. Without this condition, someone whose first Harness is an Intern 3 would have had no
+ way to set it up from Swarm.
+- **Cost:** the row appears and disappears with the computer list. That is the same rule Profile
+ already follows.
+
+## 6. Numbers
+
+| | First cut of A | A lean (built) |
+|---|---|---|
+| Rows (preview included) | 24 | 20 |
+| Cards | 10 | 7 |
+| Captions | 6 | 3 |
+| Screens, prototype at 375pt | ≈2.6 | ≈2.1 |
+| Screens, Flutter at 390×844 | — | ≈2.05 (1527pt of content, 745pt visible) |
+
+## 7. Code map
+
+- `phone/settings_page.dart`:
+ - the `swarm` flag and Swarm's scaffold;
+ - `_swarmAccount` (three cards, D4 and D9);
+ - Language in the Terminal card (D6);
+ - `_helpRow` and `_showTipsAgain` (D7);
+ - `_AboutRow` (D8);
+ - no detail on Notifications or Swarm in the look (D5);
+ - a glyph on every row.
+- `phone/settings_row.dart`: `SettingsSwarmLook`, and the Swarm branch of caption, group and row
+ (`glyph` param).
+- `phone/phone_shell.dart`: Swarm's `onSettings` opens Settings with `swarm: true`.
+- `phone/usage_entry.dart`: Usage's glyph.
+- `swarm/swarm_style.dart`: `SwarmRowGlyph`, now shared; `swarm/swarm_you_page.dart` uses it.
+
+## 8. Tests
+
+- `test/phone_edge/settings_swarm_look_test.dart` covers:
+ - the top bar and the way back;
+ - glyphs, and the app's face;
+ - three captions, with no Voice, Help or About caption;
+ - the three account cards;
+ - Set up Intern 3 hidden with a computer and shown with none;
+ - Language in the Terminal card;
+ - Swarm and Notifications without a line under them;
+ - the Help sheet, including inside the sample;
+ - the About row and its sheet;
+ - the controls that stay;
+ - the terminal's look, unchanged.
+- `test/phone_edge/settings_layout_test.dart` checks for no overflow at every phone, text scale and
+ brightness. It covers Settings opened from Swarm signed in (long, emoji and right-to-left
+ names), with no computer, and inside the sample.
+- `test/phone/phone_shell_swarm_home_test.dart` checks that Settings opens with `swarm: true` from
+ You and with `swarm: false` from the terminal.
+
+## 9. Design (data)
+
+N/A because this changes layout only. Nothing is stored, synced or exposed, and every row reads and
+writes through the same stores as before.
+
+## 10. Open
+
+- Sheets (Help, About, account, Font, Colors) still draw in `PhoneSheet`'s look, the terminal's
+ face. Swarm has no sheet of its own for settings yet.
+- "Your devices" means two different things in Settings and You (D3).
diff --git a/docs/design/2026-11-03-swarm-settings/prototype.html b/docs/design/2026-11-03-swarm-settings/prototype.html
new file mode 100644
index 000000000..c633c819b
--- /dev/null
+++ b/docs/design/2026-11-03-swarm-settings/prototype.html
@@ -0,0 +1,496 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
+<title>Swarm Settings Lean</title>
+<style>
+/* Shell: a quiet review frame (header, two toggles, notes) around two interactive phones.
+ The shell follows the viewer's theme; the phones keep the app's Graphite dark palette on purpose. */
+:root{
+ --bg:#f5f5f2; --fg:#1b1b19; --muted:#5d5c56; --line:#dad9d3; --chip:#ebebe6; --mark:#2f5bea; --frame:#0d0d0d;
+ --ui:-apple-system,BlinkMacSystemFont,"SF Pro Text","Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
+ --mono:ui-monospace,"SF Mono",SFMono-Regular,Menlo,"Roboto Mono",Consolas,monospace;
+}
+@media (prefers-color-scheme: dark){:root:not([data-theme="light"]){--bg:#111110;--fg:#ecebe7;--muted:#a3a29b;--line:#2d2d2a;--chip:#1f1f1d;--mark:#7d98ff;--frame:#000;color-scheme:dark}}
+:root[data-theme="dark"]{--bg:#111110;--fg:#ecebe7;--muted:#a3a29b;--line:#2d2d2a;--chip:#1f1f1d;--mark:#7d98ff;--frame:#000;color-scheme:dark}
+body{margin:0;background:var(--bg);color:var(--fg);font:14px/1.5 var(--ui);
+ padding-left:max(16px,env(safe-area-inset-left,0px));padding-right:max(16px,env(safe-area-inset-right,0px));padding-block:20px 56px}
+.wrap{max-width:1160px;margin:0 auto}
+.top h1{font:650 17px/1.3 var(--ui);margin:0}
+.top p{margin:4px 0 0;color:var(--muted);font-size:13px;max-width:84ch}
+.top a{color:var(--mark)}
+.ctl{display:flex;flex-wrap:wrap;gap:8px 10px;align-items:center;margin:16px 0 22px;padding-bottom:16px;border-bottom:1px solid var(--line)}
+.tg{appearance:none;border:1px solid var(--line);background:none;color:var(--fg);font:500 13px var(--ui);padding:6px 12px;border-radius:999px;cursor:pointer}
+.tg:hover{border-color:var(--muted)}
+.tg[aria-pressed=true]{background:var(--fg);color:var(--bg);border-color:var(--fg)}
+.tg:focus-visible,.chg:focus-visible{outline:2px solid var(--mark);outline-offset:2px}
+.delta{font-size:13px;color:var(--muted);font-variant-numeric:tabular-nums}
+.delta b{color:var(--fg);font-weight:600}
+.duo{display:grid;grid-template-columns:auto auto minmax(0,1fr);gap:28px;align-items:start}
+.fig{margin:0;display:grid;grid-template-columns:minmax(0,1fr);gap:10px;justify-items:center;min-width:0}
+.fig figcaption{text-align:center}
+.fig .lb{display:block;font:650 14px/1.3 var(--ui)}
+.fig .st{display:block;font-size:12.5px;color:var(--muted);font-variant-numeric:tabular-nums}
+.sw-key{display:inline-block;width:9px;height:9px;border-radius:50%;margin-right:6px;vertical-align:0}
+.notes{min-width:0;display:grid;gap:20px;max-width:62ch}
+.notes h3{font:650 12px/1.3 var(--ui);letter-spacing:.06em;text-transform:uppercase;color:var(--muted);margin:0 0 8px}
+.notes p{margin:0}
+.notes .try{font-size:13px;color:var(--muted)}
+.chgs{list-style:none;margin:0;padding:0;display:grid;gap:2px}
+.chg{appearance:none;border:0;background:none;color:inherit;font:inherit;text-align:left;cursor:pointer;display:flex;gap:10px;align-items:flex-start;width:100%;padding:6px 8px;border-radius:8px}
+.chg:hover{background:var(--chip)}
+.chg[aria-pressed=true]{background:var(--chip);box-shadow:inset 0 0 0 1px var(--line)}
+.chg .n{flex:none;width:20px;height:20px;border-radius:50%;display:grid;place-items:center;font:700 11px/1 var(--ui);background:var(--fg);color:var(--bg);margin-top:1px}
+@media (max-width:1139px){.duo{grid-template-columns:auto auto;justify-content:center}.notes{grid-column:1/-1;max-width:none}}
+@media (max-width:819px){.duo{grid-template-columns:minmax(0,1fr)}}
+
+/* ───────── Phone frame + the Swarm primitives (Graphite, real sizes) ───────── */
+.phone{
+ --g:#181818; --card:#202020; --srf:#2c2c2c; --sheet:#1f1f1f; --hair:rgba(255,255,255,.1);
+ --t1:#f5f5f5; --t2:#a8a8a2; --t3:#6e6e68; --cap:#8b8b85; --blue:#2f5bea; --link:#8aa4ff;
+ --green:#3fb950; --red:#f2544b; --av:#1d5bd6;
+ width:375px;max-width:100%;height:780px;border:10px solid var(--frame);border-radius:50px;background:var(--g);color:var(--t1);
+ position:relative;overflow:hidden;display:flex;flex-direction:column;font:15px/1.35 var(--ui);box-sizing:border-box;
+ user-select:none;-webkit-user-select:none;box-shadow:0 1px 0 var(--line),0 24px 48px -24px rgba(0,0,0,.45)}
+/* Change markers: amber = the build (before), blue = the lean proposal (after) */
+#dir-a{--mk:#e3b341;--mkt:#2b1d00;--mkbg:rgba(227,179,65,.13)}
+#dir-n{--mk:#8aa4ff;--mkt:#0d1a40;--mkbg:rgba(138,164,255,.15)}
+.phone *{box-sizing:border-box}
+:where(.phone) button{appearance:none;background:none;border:0;color:inherit;font:inherit;padding:0;margin:0;cursor:pointer;text-align:left}
+.phone button:focus-visible{outline:2px solid var(--link);outline-offset:-2px;border-radius:10px}
+.phone .ic{width:20px;height:20px;flex:none;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
+.phone .t2{color:var(--t2)}.phone .t3{color:var(--t3)}.phone .g{color:var(--green)}
+.sb{height:46px;flex:none;display:flex;align-items:center;justify-content:space-between;padding:6px 28px 0 34px;font:600 15px var(--ui);position:relative}
+.sb .island{position:absolute;left:50%;top:9px;width:108px;height:30px;margin-left:-54px;background:#000;border-radius:20px}
+.sb .sbr{display:flex;gap:6px;align-items:center}
+.scr{flex:1;min-height:0;position:relative;display:flex;flex-direction:column}
+.scroll{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:none;position:relative}
+.scroll::-webkit-scrollbar{display:none}
+.hi{position:absolute;left:50%;bottom:8px;width:134px;height:5px;margin-left:-67px;border-radius:3px;background:rgba(255,255,255,.55);z-index:6;pointer-events:none}
+/* SwarmTopBar: back 4pt in, the title 4pt beside it in the terminal's face, 52pt tall */
+.bar{display:flex;align-items:center;gap:4px;min-height:52px;padding:4px 8px 4px 4px;flex:none}
+.bar .ttl{font:600 17px/1.25 var(--mono);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
+.ib{width:44px;height:44px;display:grid;place-items:center;border-radius:12px;color:var(--t1);flex:none}
+.ib:hover{background:rgba(255,255,255,.06)}.ib:active{background:rgba(255,255,255,.1)}
+.ib .ic{width:24px;height:24px}
+.av{border-radius:50%;display:grid;place-items:center;font:600 15px var(--ui);color:#fff;background:var(--av);flex:none;width:40px;height:40px}
+.stp{display:inline-flex;align-items:center;height:34px;border-radius:10px;background:var(--srf);flex:none}
+.stp button{width:40px;height:34px;display:grid;place-items:center;color:var(--t1);border-radius:10px}
+.stp button:hover:not(:disabled){background:rgba(255,255,255,.06)}
+.stp button:disabled{color:#4a4a46;cursor:default}
+.stp button .ic{width:16px;height:16px}
+.stp .v{min-width:26px;text-align:center;font:500 15px var(--ui);font-variant-numeric:tabular-nums}
+.sw{width:51px;height:31px;border-radius:16px;background:#3a3a38;position:relative;flex:none;transition:background .18s}
+.sw::after{content:"";position:absolute;top:2px;left:2px;width:27px;height:27px;border-radius:50%;background:#fff;transition:transform .18s;box-shadow:0 2px 4px rgba(0,0,0,.3)}
+.sw.on{background:var(--green)}.sw.on::after{transform:translateX(20px)}
+.pv{font-family:var(--mono);white-space:nowrap;overflow:hidden;line-height:1.2;color:var(--t1)}
+.toast{position:absolute;left:50%;bottom:44px;transform:translate(-50%,8px);background:#2c2c2c;color:var(--t1);font:500 13px var(--ui);padding:8px 14px;border-radius:999px;opacity:0;transition:opacity .15s,transform .15s;pointer-events:none;z-index:8;white-space:nowrap;max-width:92%;overflow:hidden;text-overflow:ellipsis;box-shadow:0 6px 16px rgba(0,0,0,.4)}
+.toast.show{opacity:1;transform:translate(-50%,0)}
+.scrim{position:absolute;inset:0;background:rgba(0,0,0,.5);z-index:7;opacity:0;transition:opacity .18s;pointer-events:none}
+.scrim.show{opacity:1;pointer-events:auto}
+.sheet{position:absolute;left:0;right:0;bottom:0;background:var(--sheet);border-radius:20px 20px 0 0;padding:8px 0 30px;z-index:7;transform:translateY(102%);visibility:hidden;transition:transform .22s ease,visibility 0s .22s;max-height:76%;overflow-y:auto;scrollbar-width:none}
+.sheet.show{transform:none;visibility:visible;transition:transform .22s ease,visibility 0s}
+.sheet .grab{width:36px;height:5px;border-radius:3px;background:#4a4a46;margin:0 auto 10px}
+.sheet .sh-t{font:600 13px var(--ui);color:var(--t2);padding:4px 20px 8px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
+.sheet .sh-c{font:400 13px var(--ui);color:var(--cap);padding:12px 20px 4px}
+.sheet .opt{display:flex;align-items:center;gap:14px;width:100%;min-height:50px;padding:0 20px;font-size:16px}
+.sheet button.opt:hover{background:rgba(255,255,255,.04)}.sheet button.opt:active{background:rgba(255,255,255,.08)}
+.sheet .opt .ic{color:var(--t2)}
+.sheet .opt[aria-pressed=true] .ic{color:var(--t1)}
+.sheet .opt .grow{flex:1;min-width:0}
+.sheet .opt.danger{color:var(--red)}.sheet .opt.danger .ic{color:var(--red)}
+
+/* Settings in Swarm's look: SwarmCaption, SwarmGroup, SwarmRow (both phones share it) */
+.phone .a-list{padding:0 12px 40px}
+.phone .a-cap{font:400 13px/1.3 var(--ui);color:var(--cap);padding:24px 4px 8px}
+.phone .a-card{background:var(--card);border-radius:14px;overflow:hidden}
+.phone .a-row{display:flex;align-items:center;gap:12px;width:100%;min-height:56px;padding:8px 16px;position:relative}
+.phone .a-row + .a-row,.phone .a-pv + .a-row,.phone .a-row + .a-pv{border-top:1px solid var(--hair)}
+.phone button.a-row:hover{background:rgba(255,255,255,.04)}
+.phone button.a-row:active{background:rgba(255,255,255,.08)}
+.phone .a-gl{width:32px;display:grid;place-items:center;color:var(--t2);flex:none}
+.phone .a-gl .ic{width:22px;height:22px}
+.phone .a-tx{flex:1;min-width:0;display:flex;flex-direction:column;gap:1px}
+.phone .a-tt{font-size:15.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
+.phone .a-dt{font-size:13px;color:var(--t2)}
+.phone .a-val{font-size:15px;color:var(--t2);white-space:nowrap}
+.phone .a-chev{width:18px;height:18px;color:var(--t3)}
+.phone .a-me{min-height:68px}
+.phone .a-me .a-tt{font-weight:600;font-size:16px}
+.phone .a-pv{padding:15px 16px 15px 60px}
+/* Numbered change markers: shown for every change with "Mark changes", or for one picked change */
+.phone [data-chg]::after{content:attr(data-chg);display:none;place-items:center;width:16px;height:16px;border-radius:50%;font:700 10px/1 var(--ui);background:var(--mk);color:var(--mkt)}
+.phone .a-row[data-chg]::after{position:absolute;left:2px;top:50%;margin-top:-8px}
+.phone .a-cap[data-chg]::after{margin-left:6px;vertical-align:1px}
+.duo.diff .phone [data-chg]::after,.phone [data-chg].hot::after{display:inline-grid}
+.duo.diff .phone .a-row[data-chg],.phone .a-row[data-chg].hot{box-shadow:inset 0 0 0 1.5px var(--mk)}
+.phone .a-row[data-chg].hot{background:var(--mkbg)}
+.duo.diff .phone .a-cap[data-chg],.phone .a-cap[data-chg].hot{color:var(--mk)}
+/* Whole-page view: the phone grows to its full length at half size, with a line where each screen ends */
+.marks{position:absolute;left:0;right:0;top:0;height:0;pointer-events:none;display:none}
+.mk-line{position:absolute;left:0;right:0;border-top:2px dashed rgba(138,164,255,.75)}
+.mk-line span{position:absolute;right:12px;top:6px;font:600 22px var(--ui);color:#8aa4ff;background:var(--g);padding:0 8px;border-radius:6px}
+.duo.full .phone{height:auto;zoom:.5}
+.duo.full .scr,.duo.full .scroll{flex:none;overflow:visible}
+.duo.full .marks{display:block}
+@media (max-width:1139px){.duo.full{grid-template-columns:auto auto}}
+</style>
+</head>
+<body>
+<svg width="0" height="0" style="position:absolute" aria-hidden="true" focusable="false">
+<defs>
+<symbol id="i-chev-l" viewBox="0 0 24 24"><path d="m15 18-6-6 6-6"/></symbol>
+<symbol id="i-chev-r" viewBox="0 0 24 24"><path d="m9 18 6-6-6-6"/></symbol>
+<symbol id="i-gauge" viewBox="0 0 24 24"><path d="m12 14 4-4"/><path d="M3.34 19a10 10 0 1 1 17.32 0"/></symbol>
+<symbol id="i-bell" viewBox="0 0 24 24"><path d="M10.268 21a2 2 0 0 0 3.464 0"/><path d="M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326"/></symbol>
+<symbol id="i-shield" viewBox="0 0 24 24"><path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"/></symbol>
+<symbol id="i-laptop" viewBox="0 0 24 24"><path d="M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z"/><path d="M20.054 15.987H3.946"/></symbol>
+<symbol id="i-layers" viewBox="0 0 24 24"><path d="M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z"/><path d="M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12"/><path d="M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17"/></symbol>
+<symbol id="i-plug" viewBox="0 0 24 24"><path d="M12 22v-5"/><path d="M9 8V2"/><path d="M15 8V2"/><path d="M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z"/></symbol>
+<symbol id="i-qr" viewBox="0 0 24 24"><rect width="5" height="5" x="3" y="3" rx="1"/><rect width="5" height="5" x="16" y="3" rx="1"/><rect width="5" height="5" x="3" y="16" rx="1"/><path d="M21 16h-3a2 2 0 0 0-2 2v3"/><path d="M21 21v.01"/><path d="M12 7v3a2 2 0 0 1-2 2H7"/><path d="M3 12h.01"/><path d="M12 3h.01"/><path d="M12 16v.01"/><path d="M16 12h1"/><path d="M21 12v.01"/><path d="M12 21v-1"/></symbol>
+<symbol id="i-server" viewBox="0 0 24 24"><rect width="20" height="8" x="2" y="2" rx="2"/><rect width="20" height="8" x="2" y="14" rx="2"/><path d="M6 6h.01"/><path d="M6 18h.01"/></symbol>
+<symbol id="i-devices" viewBox="0 0 24 24"><path d="M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8"/><path d="M10 19v-3.96 3.15"/><path d="M7 19h5"/><rect width="6" height="10" x="16" y="12" rx="2"/></symbol>
+<symbol id="i-phone" viewBox="0 0 24 24"><rect width="14" height="20" x="5" y="2" rx="2"/><path d="M12 18h.01"/></symbol>
+<symbol id="i-type" viewBox="0 0 24 24"><path d="M4 7V4h16v3"/><path d="M9 20h6"/><path d="M12 4v16"/></symbol>
+<symbol id="i-size" viewBox="0 0 24 24"><path d="M21 14h-5"/><path d="M16 16v-3.5a2.5 2.5 0 0 1 5 0V16"/><path d="M4.5 13h6"/><path d="m3 16 4.5-9 4.5 9"/></symbol>
+<symbol id="i-palette" viewBox="0 0 24 24"><circle cx="13.5" cy="6.5" r=".9" fill="currentColor"/><circle cx="17.5" cy="10.5" r=".9" fill="currentColor"/><circle cx="8.5" cy="7.5" r=".9" fill="currentColor"/><circle cx="6.5" cy="12.5" r=".9" fill="currentColor"/><path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z"/></symbol>
+<symbol id="i-mic" viewBox="0 0 24 24"><path d="M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"/><path d="M19 10v2a7 7 0 0 1-14 0v-2"/><path d="M12 19v3"/></symbol>
+<symbol id="i-contrast" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M12 18a6 6 0 0 0 0-12v12z"/></symbol>
+<symbol id="i-flask" viewBox="0 0 24 24"><path d="M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2"/><path d="M8.5 2h7"/><path d="M7 16h10"/></symbol>
+<symbol id="i-help" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><path d="M12 17h.01"/></symbol>
+<symbol id="i-play" viewBox="0 0 24 24"><path d="M6 3l14 9-14 9V3z"/></symbol>
+<symbol id="i-bulb" viewBox="0 0 24 24"><path d="M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"/><path d="M9 18h6"/><path d="M10 22h4"/></symbol>
+<symbol id="i-info" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/></symbol>
+<symbol id="i-file" viewBox="0 0 24 24"><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M10 9H8"/><path d="M16 13H8"/><path d="M16 17H8"/></symbol>
+<symbol id="i-minus" viewBox="0 0 24 24"><path d="M5 12h14"/></symbol>
+<symbol id="i-plus" viewBox="0 0 24 24"><path d="M5 12h14"/><path d="M12 5v14"/></symbol>
+<symbol id="i-check" viewBox="0 0 24 24"><path d="M20 6 9 17l-5-5"/></symbol>
+<symbol id="i-logout" viewBox="0 0 24 24"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/><path d="m16 17 5-5-5-5"/><path d="M21 12H9"/></symbol>
+</defs>
+</svg>
+
+<div class="wrap">
+ <header class="top">
+ <h1>Swarm · Settings — lean</h1>
+ <p>Settings opened from Swarm's You. Left: the lean list as built. Right: the first cut of direction A, before it was shortened. Both phones hold the same real content and can be tapped: change Size or Font on one and the other follows. Keys <b>1–6</b> mark one change, <b>D</b> marks them all, <b>F</b> shows each whole page. Spec: <a href="../2026-11-03-swarm-settings.md">2026-11-03-swarm-settings.md</a>.</p>
+ </header>
+
+ <div class="ctl">
+ <button class="tg" id="t-diff" aria-pressed="false">Mark changes</button>
+ <button class="tg" id="t-full" aria-pressed="false">Whole page</button>
+ <span class="delta" id="delta" aria-live="polite"></span>
+ </div>
+
+ <div class="duo" id="duo">
+ <figure class="fig">
+ <figcaption><span class="lb"><span class="sw-key" style="background:#8aa4ff"></span>A lean · as built</span><span class="st" id="st-n"></span></figcaption>
+ <div class="phone" id="dir-n"></div>
+ </figure>
+ <figure class="fig">
+ <figcaption><span class="lb"><span class="sw-key" style="background:#e3b341"></span>A · first cut</span><span class="st" id="st-a"></span></figcaption>
+ <div class="phone" id="dir-a"></div>
+ </figure>
+
+ <div class="notes">
+ <div>
+ <h3>6 changes</h3>
+ <ol class="chgs">
+ <li><button class="chg" data-chg="1" aria-pressed="false"><span class="n">1</span><span><b>Help</b>: 3 rows → 1 row that opens a sheet (How Harness works · Try the sample · Show the tips again).</span></button></li>
+ <li><button class="chg" data-chg="2" aria-pressed="false"><span class="n">2</span><span><b>About</b>: Version + Privacy Policy → 1 row "About 1.0.12 (80)"; its sheet holds the Privacy Policy.</span></button></li>
+ <li><button class="chg" data-chg="3" aria-pressed="false"><span class="n">3</span><span><b>Language</b> (the mic's) joins the Terminal card; no Voice caption.</span></button></li>
+ <li><button class="chg" data-chg="4" aria-pressed="false"><span class="n">4</span><span><b>Set up Intern 3</b> is left to Computers, which has the same button; Settings keeps it only while there is no computer.</span></button></li>
+ <li><button class="chg" data-chg="5" aria-pressed="false"><span class="n">5</span><span><b>Experimental</b>: no description line; Swarm and its switch stay.</span></button></li>
+ <li><button class="chg" data-chg="6" aria-pressed="false"><span class="n">6</span><span><b>Your name</b> joins the Usage · Notifications · Privacy card.</span></button></li>
+ </ol>
+ </div>
+ <p class="try">Tap a change to mark it on both phones: amber is where it was, blue is where it is now.</p>
+ <div>
+ <h3>Nothing lost</h3>
+ <p>Every setting and every fact is still reachable: 4 rows moved into sheets (Help's 3, the Privacy Policy); Set up Intern 3 is on Computers, and still in Settings while there is no computer (Computers is then an empty state with Add computer alone).</p>
+ </div>
+ <div>
+ <h3>Unchanged</h3>
+ <p>56pt rows, glyphs, the top bar, captions, every label. Only Settings opened from Swarm changes; Settings in the terminal keeps its own look and list.</p>
+ </div>
+ <p class="try">Try: Help and About (sheets), Size ±, the Swarm switch, your name (Sign out).</p>
+ </div>
+ </div>
+</div>
+
+<script>
+(() => {
+'use strict';
+const ic = (n, c = '') => `<svg class="ic ${c}" aria-hidden="true" focusable="false"><use href="#i-${n}"/></svg>`;
+const esc = s => String(s).replace(/[&<>"]/g, ch => ({'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;'}[ch]));
+
+/* ───── Real content (from settings_page.dart and its stores) ───── */
+const ME = {name: 'Tony at Autonomous', email: '[email protected]', initial: 'T'};
+const S = {notif: 'Off', profile: 'All computers', phone: 'iPhone 16', font: 'SF Mono', size: 13,
+ colors: 'match', lang: 'English', palette: 'Graphite', text: 14, swarm: true};
+const BOUNDS = {size: [9, 22], text: [11, 19]};
+const FONTS = ['SF Mono', 'Ubuntu Sans Mono', 'Ubuntu Mono', 'Liberation Mono'];
+const TERM = [['match', null], ['Dark', 'Dark'], ['Light', 'Light'], ['Tango', 'Tango']];
+const LANGS = ['English', 'Tiếng Việt', 'Español', 'Français', '日本語', 'Italiano'];
+const PALETTES = {Dark: ['Graphite', 'Dusk', 'Midnight', 'Slate', 'Forest', 'Ember'], Light: ['Paper', 'Mist']};
+const colorsLabel = () => S.colors === 'match' ? S.palette : S.colors;
+const VERSION = '1.0.12 (80)';
+
+const R = {
+ usage: {t: 'Usage', i: 'gauge', act: 'go:Usage'},
+ notif: {t: 'Notifications', i: 'bell', v: () => S.notif, act: 'notif'},
+ privacy: {t: 'Privacy', i: 'shield', act: 'go:Privacy'},
+ computers: {t: 'Computers', i: 'laptop', act: 'go:Computers'},
+ profile: {t: 'Profile', i: 'layers', v: () => S.profile, act: 'go:Profile picker'},
+ connectors: {t: 'Connectors', i: 'plug', act: 'go:Connectors'},
+ signin: {t: 'Sign in a computer', i: 'qr', act: 'go:QR scanner'},
+ intern: {t: 'Set up Intern 3', i: 'server', act: 'go:Set up Intern 3'},
+ devices: {t: 'Your devices', i: 'devices', act: 'go:Your devices'},
+ phonename: {t: 'Phone name', i: 'phone', v: () => S.phone, act: 'go:Phone name dialog'},
+ preview: {preview: true},
+ font: {t: 'Font', i: 'type', v: () => S.font, act: 'sheet:font'},
+ size: {t: 'Size', i: 'size', stepper: 'size'},
+ colors: {t: 'Colors', i: 'palette', v: colorsLabel, act: 'sheet:colors'},
+ lang: {t: 'Language', i: 'mic', v: () => S.lang, act: 'sheet:lang'},
+ appcolors: {t: 'App colors', i: 'contrast', v: () => S.palette, act: 'sheet:palette'},
+ text: {t: 'Text size', i: 'size', stepper: 'text'},
+ swarm: {t: 'Swarm', i: 'flask', d: 'Open your Swarms from Home or Find. Still taking shape.', sw: 'swarm'},
+ how: {t: 'How Harness works', i: 'help', act: 'go:How Harness works'},
+ sample: {t: 'Try the sample', i: 'play', act: 'go:the sample'},
+ tips: {t: 'Show the tips again', i: 'bulb', act: 'toast:The tips come back on the next harness.'},
+ version: {t: 'Version', i: 'info', v: () => VERSION, fixed: true},
+ policy: {t: 'Privacy Policy', i: 'file', act: 'go:Privacy Policy'},
+ help: {t: 'Help', i: 'help', act: 'sheet:help'},
+ about: {t: 'About', i: 'info', v: () => VERSION, act: 'sheet:about'},
+};
+
+/* ───── Builders ───── */
+const mark = (o, k) => o.marks && o.marks[k] ? ` data-chg="${o.marks[k]}"` : '';
+const stepper = k => {
+ const [lo, hi] = BOUNDS[k], v = S[k];
+ return `<span class="stp" role="group" aria-label="${k === 'size' ? 'Terminal size' : 'Text size'}">` +
+ `<button data-act="dec:${k}" aria-label="Smaller" ${v <= lo ? 'disabled' : ''}>${ic('minus')}</button>` +
+ `<span class="v" aria-live="polite">${v}</span>` +
+ `<button data-act="inc:${k}" aria-label="Larger" ${v >= hi ? 'disabled' : ''}>${ic('plus')}</button></span>`;
+};
+const preview = () => `<div class="pv a-pv" aria-hidden="true" style="font-size:${S.size}px;font-family:${esc(S.font)},var(--mono)">` +
+ `<span class="t3">~/web </span><span class="g">❯ </span>claude "fix the login"</div>`;
+const meRow = o => `<button class="a-row a-me" data-act="sheet:account"${mark(o, 'me')}><span class="av">${ME.initial}</span>` +
+ `<span class="a-tx"><span class="a-tt">${esc(ME.name)}</span><span class="a-dt">${esc(ME.email)}</span></span>${ic('chev-r', 'a-chev')}</button>`;
+
+function row(k, o) {
+ if (k === 'me') return meRow(o);
+ const r = R[k];
+ if (r.preview) return preview();
+ const m = mark(o, k);
+ const lead = `<span class="a-gl">${ic(r.i)}</span>`;
+ const det = o.detail && r.d ? `<span class="a-dt">${esc(r.d)}</span>` : '';
+ const txt = `<span class="a-tx"><span class="a-tt">${esc(r.t)}</span>${det}</span>`;
+ if (r.stepper) return `<div class="a-row"${m}>${lead}${txt}${stepper(r.stepper)}</div>`;
+ if (r.sw) return `<button class="a-row" role="switch" aria-checked="${S[r.sw]}" data-act="sw:${r.sw}"${m}>${lead}${txt}<span class="sw ${S[r.sw] ? 'on' : ''}" aria-hidden="true"></span></button>`;
+ const val = r.v ? `<span class="a-val">${esc(r.v())}</span>` : '';
+ if (r.fixed) return `<div class="a-row"${m}>${lead}${txt}${val}</div>`;
+ const act = (o.acts && o.acts[k]) || r.act;
+ return `<button class="a-row" data-act="${esc(act)}"${m}>${lead}${txt}${val}${ic('chev-r', 'a-chev')}</button>`;
+}
+const gap = h => `<div style="height:${h}px"></div>`;
+const cap = (t, n) => `<div class="a-cap"${n ? ` data-chg="${n}"` : ''}>${esc(t)}</div>`;
+const card = (rows, o) => `<div class="a-card">${rows.map(k => row(k, o)).join('')}</div>`;
+
+/* ───── The build: SettingsPage(swarm: true) as it is in the worktree ───── */
+const BUILT = {
+ marks: {me: 6, intern: 4, lang: 3, swarm: 5, how: 1, sample: 1, tips: 1, version: 2, policy: 2},
+ html() {
+ const o = {detail: true, marks: this.marks};
+ return gap(8) + card(['me'], o) +
+ [['usage', 'notif', 'privacy'], ['computers', 'profile', 'connectors', 'signin', 'intern'], ['devices', 'phonename']]
+ .map(g => gap(16) + card(g, o)).join('') +
+ cap('Terminal') + card(['preview', 'font', 'size', 'colors'], o) +
+ cap('Voice', 3) + card(['lang'], o) +
+ cap('Appearance') + card(['appcolors', 'text'], o) +
+ cap('Experimental') + card(['swarm'], o) +
+ cap('Help', 1) + card(['how', 'sample', 'tips'], o) +
+ cap('About', 2) + card(['version', 'policy'], o);
+ },
+};
+
+/* ───── The lean proposal ───── */
+const LEAN = {
+ marks: {me: 6, computers: 4, lang: 3, swarm: 5, help: 1, about: 2},
+ acts: {computers: 'go:Computers · Add computer · Set up Intern 3'},
+ html() {
+ const o = {detail: false, marks: this.marks, acts: this.acts};
+ return gap(8) + card(['me', 'usage', 'notif', 'privacy'], o) +
+ gap(16) + card(['computers', 'profile', 'connectors', 'signin'], o) +
+ gap(16) + card(['devices', 'phonename'], o) +
+ cap('Terminal') + card(['preview', 'font', 'size', 'colors', 'lang'], o) +
+ cap('Appearance') + card(['appcolors', 'text'], o) +
+ cap('Experimental') + card(['swarm'], o) +
+ gap(24) + card(['help', 'about'], o);
+ },
+};
+
+const PHONES = [['dir-n', LEAN], ['dir-a', BUILT]].map(([id, d]) => ({el: document.getElementById(id), d}));
+let hot = null; // the change number picked in the list, or null
+let full = false; // whole-page view
+
+const statusBar = () => `<div class="sb"><span>16:07</span><span class="island"></span><span class="sbr">` +
+ `<svg width="17" height="12" viewBox="0 0 17 12" aria-hidden="true"><path fill="currentColor" d="M8.5 2.6c2.3 0 4.4.9 6 2.4l1.1-1.1A10 10 0 0 0 8.5 1 10 10 0 0 0 1.4 3.9L2.5 5a8.5 8.5 0 0 1 6-2.4zm0 3.3c1.4 0 2.6.5 3.6 1.4l1.1-1.1a6.6 6.6 0 0 0-9.4 0l1.1 1.1c1-.9 2.2-1.4 3.6-1.4zm0 3.3c.5 0 1 .2 1.3.5L8.5 11 7.2 9.7c.3-.3.8-.5 1.3-.5z"/></svg>` +
+ `<svg width="27" height="13" viewBox="0 0 27 13" aria-hidden="true"><rect x=".5" y=".5" width="23" height="12" rx="3.5" fill="none" stroke="currentColor" opacity=".4"/><rect x="2" y="2" width="20" height="9" rx="2" fill="currentColor"/><path d="M25 4.5v4c.8-.3 1.3-1.1 1.3-2s-.5-1.7-1.3-2z" fill="currentColor" opacity=".4"/></svg></span></div>`;
+const mount = el => {
+ el.innerHTML = `${statusBar()}<div class="scr"><div class="bar"><button class="ib" data-act="go:You" aria-label="Back">${ic('chev-l')}</button><span class="ttl">Settings</span></div>` +
+ `<div class="scroll"><div class="a-list"></div><div class="marks" aria-hidden="true"></div></div></div>` +
+ `<div class="toast" role="status"></div><div class="scrim" data-act="close"></div><div class="sheet" role="dialog" aria-modal="true" aria-label="Choices"></div><span class="hi"></span>`;
+};
+function render(p) {
+ p.el.querySelector('.a-list').innerHTML = p.d.html();
+ applyHot(p.el);
+}
+const renderAll = () => PHONES.forEach(render);
+function applyHot(el) {
+ for (const x of el.querySelectorAll('.a-list [data-chg]')) x.classList.toggle('hot', hot !== null && x.dataset.chg === String(hot));
+}
+
+/* ───── Counts and screen lines, measured from the rendered page ───── */
+const fmt = n => n.toFixed(1);
+function measure(p) {
+ const sc = p.el.querySelector('.scroll'), list = p.el.querySelector('.a-list');
+ const H = sc.clientHeight, L = list.offsetHeight;
+ p.m = {
+ rows: list.querySelectorAll('.a-row, .a-pv').length,
+ cards: list.querySelectorAll('.a-card').length,
+ caps: list.querySelectorAll('.a-cap').length,
+ screens: L / H,
+ };
+ let lines = '';
+ for (let k = 1; k * H < L - 8; k++) lines += `<div class="mk-line" style="top:${k * H}px"><span>screen ${k + 1}</span></div>`;
+ p.el.querySelector('.marks').innerHTML = lines;
+}
+function showStats() {
+ const [n, a] = PHONES.map(p => p.m);
+ const line = m => `${m.rows} rows · ${m.cards} cards · ${m.caps} captions · ≈${fmt(m.screens)} screens`;
+ document.getElementById('st-n').textContent = line(n);
+ document.getElementById('st-a').textContent = line(a);
+ document.getElementById('delta').innerHTML =
+ `Shorter: <b>${a.rows} → ${n.rows}</b> rows · <b>${a.cards} → ${n.cards}</b> cards · <b>${a.caps} → ${n.caps}</b> captions · <b>≈${fmt(a.screens)} → ≈${fmt(n.screens)}</b> screens`;
+}
+
+/* ───── Sheets, toasts ───── */
+function toast(el, msg) {
+ const t = el.querySelector('.toast');
+ t.textContent = msg; t.classList.add('show');
+ clearTimeout(t._h); t._h = setTimeout(() => t.classList.remove('show'), 1600);
+}
+const opt = (act, label, checked, icon) =>
+ `<button class="opt" aria-pressed="${checked}" data-act="${esc(act)}">${ic(checked ? 'check' : icon)}<span>${esc(label)}</span></button>`;
+const action = k => `<button class="opt" data-act="${esc(R[k].act)}">${ic(R[k].i)}<span>${esc(R[k].t)}</span></button>`;
+function openSheet(el, kind, opener) {
+ let h = '<div class="grab"></div>';
+ if (kind === 'account') {
+ h += `<div class="sh-t">${esc(ME.email)}</div><button class="opt danger" data-act="toast:Sign out? (confirm)">${ic('logout')}<span>Sign out</span></button>`;
+ } else if (kind === 'font') {
+ h += `<div class="sh-t">Terminal font</div>` + FONTS.map(f => opt(`pick:font:${f}`, f, S.font === f, 'type')).join('');
+ } else if (kind === 'colors') {
+ h += `<div class="sh-t">Terminal colors</div>` + TERM.map(([v, l]) => opt(`pick:colors:${v}`, l ?? S.palette, S.colors === v, 'palette')).join('');
+ } else if (kind === 'lang') {
+ h += `<div class="sh-t">Language</div>` + LANGS.map(l => opt(`pick:lang:${l}`, l, S.lang === l, 'mic')).join('');
+ } else if (kind === 'palette') {
+ h += `<div class="sh-t">App colors</div>` + Object.entries(PALETTES).map(([c, list]) =>
+ `<div class="sh-c">${c}</div>` + list.map(p => opt(`pick:palette:${p}`, p, S.palette === p, 'contrast')).join('')).join('');
+ } else if (kind === 'help') {
+ h += `<div class="sh-t">Help</div>` + ['how', 'sample', 'tips'].map(action).join('');
+ } else if (kind === 'about') {
+ h += `<div class="sh-t">Version ${VERSION}</div>` + action('policy');
+ }
+ const sh = el.querySelector('.sheet');
+ sh.innerHTML = h; sh._opener = opener;
+ el.querySelector('.scrim').classList.add('show'); sh.classList.add('show');
+ setTimeout(() => (sh.querySelector('[aria-pressed=true]') || sh.querySelector('button.opt'))?.focus({preventScroll: true}), 40);
+}
+function closeSheet(el) {
+ const sh = el.querySelector('.sheet');
+ if (!sh.classList.contains('show')) return false;
+ sh.classList.remove('show'); el.querySelector('.scrim').classList.remove('show');
+ const op = sh._opener; sh._opener = null;
+ if (op && op.isConnected) op.focus({preventScroll: true});
+ return true;
+}
+
+/* ───── One click handler per phone ───── */
+const refocus = (el, a) => el.querySelector(`.a-list [data-act="${a}"]:not(:disabled)`)?.focus({preventScroll: true});
+function act(el, a, target) {
+ const [verb, ...rest] = a.split(':'); const arg = rest.join(':');
+ const fromSheet = !!target.closest('.sheet');
+ switch (verb) {
+ case 'go': if (fromSheet) closeSheet(el); return toast(el, `→ ${arg}`);
+ case 'toast': if (fromSheet) closeSheet(el); return toast(el, arg);
+ case 'notif': S.notif = S.notif === 'Off' ? 'On' : 'Off'; renderAll(); return refocus(el, a);
+ case 'sw': S[arg] = !S[arg]; renderAll(); return refocus(el, a);
+ case 'inc': case 'dec': {
+ const [lo, hi] = BOUNDS[arg];
+ S[arg] = Math.min(hi, Math.max(lo, S[arg] + (verb === 'inc' ? 1 : -1)));
+ renderAll(); return refocus(el, a);
+ }
+ case 'sheet': return openSheet(el, arg, target);
+ case 'pick': {
+ const [key, ...v] = arg.split(':'); S[key] = v.join(':');
+ const sh = el.querySelector('.sheet');
+ const sel = sh._opener?.dataset.act;
+ renderAll();
+ // The opener was re-rendered; find the new node so focus returns to it.
+ sh._opener = sel ? el.querySelector(`.a-list [data-act="${sel}"]`) : null;
+ return closeSheet(el);
+ }
+ case 'close': return closeSheet(el);
+ }
+}
+for (const p of PHONES) {
+ mount(p.el); render(p);
+ p.el.addEventListener('click', e => {
+ const t = e.target.closest('[data-act]');
+ if (!t || !p.el.contains(t) || t.disabled) return;
+ act(p.el, t.dataset.act, t);
+ });
+ p.el.addEventListener('keydown', e => {
+ if (e.key === 'Escape' && closeSheet(p.el)) e.stopPropagation();
+ });
+}
+PHONES.forEach(measure);
+showStats();
+
+/* ───── Shell: the change list and the two toggles ───── */
+const duo = document.getElementById('duo');
+const chgs = [...document.querySelectorAll('.chg')];
+function pick(n) {
+ hot = hot === n ? null : n;
+ for (const b of chgs) b.setAttribute('aria-pressed', String(Number(b.dataset.chg) === hot));
+ for (const p of PHONES) {
+ applyHot(p.el);
+ if (hot === null || full) continue;
+ // Bring the first marked row of this phone into its own scroller, not the page.
+ const first = p.el.querySelector(`.a-list [data-chg="${hot}"]`);
+ const sc = p.el.querySelector('.scroll');
+ if (!first) continue;
+ const top = first.getBoundingClientRect().top - sc.getBoundingClientRect().top + sc.scrollTop;
+ sc.scrollTo({top: Math.max(0, top - sc.clientHeight / 3), behavior: 'smooth'});
+ }
+}
+chgs.forEach(b => b.addEventListener('click', () => pick(Number(b.dataset.chg))));
+const tDiff = document.getElementById('t-diff'), tFull = document.getElementById('t-full');
+const setDiff = on => { duo.classList.toggle('diff', on); tDiff.setAttribute('aria-pressed', String(on)); };
+const setFull = on => {
+ full = on; duo.classList.toggle('full', on); tFull.setAttribute('aria-pressed', String(on));
+ if (on) for (const p of PHONES) p.el.querySelector('.scroll').scrollTop = 0;
+};
+tDiff.addEventListener('click', () => setDiff(!duo.classList.contains('diff')));
+tFull.addEventListener('click', () => setFull(!full));
+document.addEventListener('keydown', e => {
+ if (e.metaKey || e.ctrlKey || e.altKey || e.target.closest('.sheet')) return;
+ if (/^[1-6]$/.test(e.key)) pick(Number(e.key));
+ else if (e.key === 'd' || e.key === 'D') setDiff(!duo.classList.contains('diff'));
+ else if (e.key === 'f' || e.key === 'F') setFull(!full);
+});
+})();
+</script>
+</body>
+</html>
diff --git a/docs/plans/2026-11-03-contributor-view-design.md b/docs/plans/2026-11-03-contributor-view-design.md
new file mode 100644
index 000000000..b7f8cc030
--- /dev/null
+++ b/docs/plans/2026-11-03-contributor-view-design.md
@@ -0,0 +1,165 @@
+# Contributor view: what a person's machines and subscriptions did for the Swarm
+
+Task #2444, asked by [email protected] through Harness, from PRODUCT.md's Contribution section (main f7fdd4fd5, #2782):
+contributing must be **Seen**. "The contributor sees what their capacity shipped, and gets credit for it. Their quota is
+never drained without them knowing." Targets it serves: contributors per week ≥ 3 in each Swarm with two or more people,
+and contributors this week still contributing next week ≥ 80%.
+
+## What exists today (surveyed on main 68e31ef83)
+
+- **The person card** (Members panel › a person; `desktop/lib/super_tabs/leaderboard/person_row.dart`) shows the last
+ 7 days: Shipped (pull requests of requests they asked for), Unblocked (answers), and **Lent**: each of their machines'
+ busy agent-hours on other people's tasks (`leaderboard/lent.ts`). It never says what their machines *shipped*, nor
+ anything about their subscriptions.
+- **Manage › Machines** shows each machine's owner and, expanded, each subscription's tightest window
+ (`5-hour limit · resets in 2h 10m`). It never says whose work used it.
+- **The phone** shows the same leaderboard; tapping a person opens a sheet of label/value lines (`swarmPersonWeek`), its
+ `Lent` line a machine count and agent-hours.
+- **The server records** each attempt's engine and model in the group's ledger (`ledger.runs`, at most 20 per group,
+ kept 5 weeks), the attempt a request shipped on (`ledger.shippedBy`), merges and fixes after merge
+ (`fixedAfterMergeAt`), each machine's owner (`ContributedMachine.contributorId`), its subscriptions' 5-hour and weekly
+ windows (`observation.quotas`, every reader of the machine sees them), and lent busy time per week and day.
+- **Missing:** which machine an attempt ran on (a run names its agent by a hash only), anything counting contributors,
+ and any word to an owner when someone else's work starts using their machine. The closest notice is the PM-switch
+ line in the owner's Buddy chat (`pm-switch-notice`, `commands.ts` agent.switchResult).
+
+## The design
+
+Three small additions to what exists, no new collection, no new endpoint.
+
+1. **Each attempt notes its machine.** `recordRun` (`leaderboard/record.ts`) adds `machineId` (the assignment's
+ `execution.machineId`) to the run; `shippedBy` keeps it, as it keeps the rest of the run. Runs recorded before this
+ resolve their machine at read time from their agent while that agent exists (`run.agentId` → `state.agents`), and
+ otherwise count for no machine.
+2. **The leaderboard read says, per person, what they brought.** `PersonDetails.brought` lists every machine the
+ person contributed that the reader may see, a Mac's Harness Team account folded into its Mac, each with:
+ - `shipped`: verified requests in the period whose shipping attempt ran on it. Verified is PRODUCT.md's north-star
+ rule as far as the server knows it: shipped with a pull request (the board's existing rule) and no fix merged after
+ it (`fixedAfterMergeAt` absent). Anyone's requests count: this is what the capacity shipped, not what the person
+ asked.
+ - `busyHours`: the Lent time already kept (busy on other people's tasks).
+ - `subscriptions`: each engine's **weekly** window from the machine's own last reading (a Team account reads its
+ Mac's): percent used and when it resets, or unknown.
+ `Leaderboard.contributors` counts, for the period and the one before, the people whose machine ran an attempt on a
+ group the board sums (requests and review/test steps alike: PRODUCT.md's "ran work"), and how many of last period's
+ ran again this period: the two Contribution targets, read by the PM's weekly report with `scope=all`. Counts only,
+ no ids (ENGINEERING.md 8).
+3. **The owner hears when others start using their machine.** When `work.assign` gives someone else's task (Lent's
+ rule: its requester is not the machine's contributor; a PM's or private chat's work never counts) to an agent on a
+ contributed machine, and that machine's owner has not been told this week, the server posts one line in the owner's
+ own Buddy chat (`openSwarmBuddyChat`, as the PM-switch notice does) and marks the machine with the week
+ (`ContributedMachine.othersToldWeek`). Once per machine per week (Monday 00:00 UTC, the board's week) keeps it a
+ notice, not a feed; the person card shows the rest.
+
+### Mockups (from the real screens)
+
+Desktop and web, Members › a person's card (today's card with **Lent** replaced by **Brought**; the heading, Shipped and
+Unblocked unchanged):
+
+```
+┌─────────────────────────────────────────────────────────────┐
+│ (◉) ken15 👑 424 points │
+│ 111 shipped · 40 unblocked · 411 hours │
+│ │
+│ Shipped 12 │
+│ Fix login on web │
+│ ... │
+│ Unblocked 4 │
+│ Pick the release day waited 2 h │
+│ │
+│ Brought 2 │
+│ Mac Studio 5 shipped · 31 h for others │
+│ Claude 38% used · resets in 3d │
+│ Codex not read yet │
+│ MacBook Pro 0 shipped · 0 h for others │
+│ Claude 71% used · resets in 6d │
+│ │
+│ Manage people Edit profile │
+└─────────────────────────────────────────────────────────────┘
+```
+
+Empty: `Brought` with `No machines brought yet`. From a server without `brought`, the card keeps today's **Lent**.
+
+Phone, Leaderboard › a person (today's sheet of lines; the `Lent` line becomes one line per machine brought):
+
+```
+ ken15 ✕
+ Points 424 last 7 days · place 1
+ Shipped 12 asks landed · median 3 h to ship
+ Unblocked 4 answered · 2 h of agent time freed
+ Mac Studio 5 shipped · 31 h for others
+ Claude 38% used, resets in 3d
+ MacBook Pro 0 shipped · 0 h for others
+ Claude 71% used, resets in 6d
+ Streak 3 days shipping
+```
+
+The owner's Buddy chat (Desktop, web, phone), once per machine per week:
+
+```
+ Wren · Your Buddy
+ ─────────────────────────────────────────────────────────────
+ Swarm diego's work "Fix login" started on your Mac Studio
+ (Claude, 38% of this week used, resets in 3d). Members ›
+ your card shows what it runs and ships; Manage › Machines
+ can pause new work.
+```
+
+The line names the task's title only when the owner may read its project; otherwise it says "diego's work". Engines
+are named as the Swarm's other lines name them ("Claude", "Codex").
+
+## Checked against PRODUCT.md
+
+- Contribution, **Seen**: what the capacity shipped (Brought › shipped), credit (it sits in the person's card beside
+ their points), never drained unknowingly (the weekly notice, and the weekly quota in the card).
+- Targets: contributors per week and kept next week are measured from recorded attempts (`contributors`).
+- Anti-goals: no customer data hidden or changed; nothing exposed (see Audience); no feature for people talking to people.
+- What matters most, 5 (Contribution): this is that work.
+
+## Checked against ENGINEERING.md
+
+- 1 Simple: extends the leaderboard read and the attempt record; no switch, no setting.
+- 2 Nothing left behind: `Lent` details stay only for clients released before this (Compatibility); the card's Lent
+ section is replaced by Brought, kept for an older server's answer until 2026-12-03.
+- 3 Correct: each behavior test first (plan).
+- 4 Fast: the leaderboard read is not a hot path; it does no new query (Read cost). `work.assign` adds an in-memory
+ check and at most one message a week per machine.
+- 5 Data: Design section below.
+- 6 Failures are seen: a notice that cannot reach a Buddy chat still records nothing silently (Failure).
+- 7 Secure: the server decides what each reader sees (Audience).
+- 8 Measurable: `contributors` counts.
+- 9 Architecture: TypeScript and the shared Flutter code; the phone's vendored copy changes in step.
+- 10 Platforms: below.
+- 11 Readable: copy follows the Naming System ("Brought", "for others", Buddy, Swarm).
+
+## Design (docs/feature-design-rules.md)
+
+1. **Growth:** `run.machineId` is one string on a run that already exists (≤ 20 runs per group, kept 5 weeks).
+ `othersToldWeek` is one number per contributed machine, replaced weekly, deleted with the machine. The notice is a
+ Buddy chat message, kept and deleted as that chat's messages are. Nothing new otherwise.
+2. **Concurrency:** the notice and its mark are written by the `work.assign` command in the same commit as the
+ assignment; the mark makes that commit also write the machine part, guarded by the version it read (parts/commit.ts).
+ Two assigns, or an assign and the machine's own report, racing in the week's first notice conflict on that part and
+ one retries, as every conflicting command does; the retry sees the mark and posts nothing (at most one line). Only
+ the week's first such assign per machine writes the machine part, so reports and assigns rarely meet.
+3. **Read cost:** the leaderboard read already loads the groups and visible machines it sums; `brought` and
+ `contributors` are computed from them in memory, O(runs) ≤ 20 × groups. The response grows by ≤ 20 machines per
+ person, a few hundred bytes. No new query, so no index; nothing polls.
+4. **Scale:** at 10x (70 people, 200 machines, 2,000 groups) the in-memory pass is 40,000 runs, well under a
+ millisecond per thousand; the first metric to warn is the leaderboard read's duration in the request log.
+5. **Compatibility:** old clients ignore `brought`, `contributors` and the new notice kind's source (they show its text,
+ as any unknown kind). New clients on an old server see no `brought` and keep showing Lent. Readers of `Run` and
+ `shippedBy` (models, recent models, model share, ship credit) key by engine, model, effort and time; an extra
+ `machineId` changes none of them (searched: `ledger.runs`, `shippedBy` in `backend/src`).
+6. **Migration and rollback:** none. Old runs resolve by agent or count for no machine. A rollback leaves
+ `machineId` and `othersToldWeek` unread; the previous release ignores both.
+7. **Audience:** `brought` lists only the machines the reader's `visibleState` keeps (Buddy-only machines hidden) and
+ counts only groups the reader may read (the read hands in no other); subscriptions come from the same readings every
+ reader of the machine already sees. The notice goes to the machine's owner alone, in their own Buddy chat, and names
+ a task title or project only when `canReadProject` lets the owner read it; the requester's name is a Swarm member's.
+8. **Identity:** N/A because nothing runs as anyone: the server writes the notice in its own words (listed with the
+ PM-switch notice as server words, so no agent's words are marked as another account's).
+9. **Failure:** a machine with no reading shows its subscriptions as unknown ("not read yet"); an owner with no Buddy
+ chat gets one opened (as the PM-switch notice does); a run with no machine counts nowhere rather than guessing.
+10. **Platforms:** Desktop (macOS, Windows, Linux) and web share the card; the phone app (iOS, Android) shows the lines in
+ its person sheet; the Buddy chat notice reaches all three. The CLI shows nothing new.
diff --git a/docs/plans/2026-11-03-contributor-view-plan.md b/docs/plans/2026-11-03-contributor-view-plan.md
new file mode 100644
index 000000000..05c758c09
--- /dev/null
+++ b/docs/plans/2026-11-03-contributor-view-plan.md
@@ -0,0 +1,165 @@
+# Contributor view Implementation Plan
+
+> Worked by this project's instructions (Engineer role): design and plan first in a draft pull request, then each task
+> test first (failing test committed before its code), one independent Review step and a Test step on the pull request.
+> Steps use checkbox (`- [ ]`) syntax for tracking.
+
+**Goal:** Each person's card (Desktop, web, phone) shows the machines they brought, the verified requests that shipped
+on each in the period, the hours each spent on others' work and each subscription's weekly use and reset; the owner is
+told once a week per machine when someone else's work starts on it; the leaderboard counts the week's contributors.
+
+**Architecture:** Each attempt records its machine in the group's ledger (`Run.machineId`). The leaderboard read
+(`leaderboard/stats.ts`) derives `details.brought` per person and `contributors` from the groups and visible machines
+it already loads. `work.assign` posts a once-a-week notice in the machine owner's Buddy chat and marks the machine
+(`ContributedMachine.othersToldWeek`). Clients render `brought` in the person card (Desktop/web) and person sheet
+(phone), falling back to Lent from an older server.
+
+**Tech Stack:** TypeScript, Prisma/MongoDB, vitest (backend); Flutter 3.47.2 (desktop/, mobile/).
+
+**Spec:** [2026-11-03-contributor-view-design.md](2026-11-03-contributor-view-design.md) (task #2444 brief in the PR body).
+
+## Global Constraints
+
+- PR body first line: "Requested by [email protected] through Harness."
+- Numbers only from what the server records; no new collection, endpoint or query (design, Read cost).
+- A person sees only what they may read: `brought` from the reader's visible machines and readable groups; the notice
+ names a task title or project only when its owner may read the project.
+- Verified = shipped with a pull request and no `fixedAfterMergeAt`.
+- Weekly window only for subscriptions (`observation.quotas[].windows[name === 'weekly']`); a Team account reads its
+ Mac's (`hostMachineId`).
+- Copy: section `Brought`, empty `No machines brought yet`, `N shipped · H h for others`, `<Engine> <P>% used · resets
+ in <d>` / `not read yet`; phone lines `<machine> N shipped · H h for others` then `Claude P% used, resets in <d>`.
+- Notice once per machine per week (Monday 00:00 UTC, `weekStart`), source kind `others-work-notice`.
+- Before Ready: red/green evidence in a PR comment, full Super Tab integration suite, `python3 scripts/check-ui-style.py
+ --only desktop/lib/super_tabs`, screenshots light and dark. Desktop tests use a memory store and a fake sign-in.
+
+## Review Focus
+
+- A request shipped on a Team account attempt credits the Team account's Mac, folded into one Brought row. (Task 2 test.)
+- A machine the reader cannot see (Buddy-only, or a private project's) never appears in anyone's Brought, and a group
+ the reader cannot read never counts. (Task 2 test.)
+- A request whose PR needed a fix after merge does not count as shipped on the machine. (Task 2 test.)
+- The owner's own request, a PM's assignment or a private chat's never notifies; a second teammate assign the same week
+ never notifies again; a new week does. (Task 3 tests.)
+- The notice to an owner who cannot read the project names neither its title nor the project. (Task 3 test.)
+
+---
+
+### Task 1: An attempt records its machine
+
+**Files:**
+- Modify: `backend/src/superTabs/leaderboard/record.ts` (`Run`, `recordRun`)
+- Test: `backend/src/superTabs/leaderboard/record.test.ts`
+
+**Interfaces:**
+- Produces: `Run.machineId?: string` (absent on runs recorded before); `GroupLedger.shippedBy` carries it.
+
+- [x] **Step 1: Write the failing test** `records the machine each attempt ran on, and the shipping attempt keeps it`:
+ assign a worker on machine `m1`, mark done; expect `ledger.runs.at(-1).machineId === 'm1'` and
+ `ledger.shippedBy.machineId === 'm1'`.
+- [x] **Step 2: Run** `cd backend && npm test -- src/superTabs/leaderboard/record.test.ts`; expect FAIL (undefined).
+- [x] **Step 3: Implement**: `recordRun` adds `machineId: assignment.execution.machineId`.
+- [x] **Step 4: Run** the same; expect PASS.
+- [x] **Step 5: Commit** test then code.
+
+### Task 2: The leaderboard says what each person brought, and counts contributors
+
+**Files:**
+- Modify: `backend/src/superTabs/leaderboard/contract.ts` (`PersonDetails.brought`, `Leaderboard.contributors`)
+- Modify: `backend/src/superTabs/leaderboard/stats.ts` (new `brought`, `contributors` helpers in a new file below)
+- Create: `backend/src/superTabs/leaderboard/brought.ts`
+- Test: `backend/src/superTabs/leaderboard/brought.test.ts`, `stats.test.ts` (contract shape)
+
+**Interfaces:**
+- Consumes: `Run.machineId` (Task 1).
+- Produces (contract):
+ - `PersonDetails.brought: Array<{ machineId: string; machineName: string; shipped: number; busyHours: number;
+ subscriptions: Array<{ engine: string; usedPercent: number | null; resetsAt: number | null }> }>`, most shipped, then
+ busiest, then name; at most `DETAILS_LIMIT`.
+ - `Leaderboard.contributors: { thisWeek: number; lastWeek: number | null; kept: number | null }`.
+- Produces (code): `runMachine(state: SuperTabState, run: Pick<Run, 'machineId' | 'agentId'>): string | undefined`;
+ `shippedOnMachine(group: Conversation, state: SuperTabState): string | undefined` (shippedBy's machine, else the last run
+ before shipping); `homeOf(machines: ContributedMachine[], machineId: string): ContributedMachine | undefined` (a Team
+ pool's Mac); `contributorsIn(state, groups, machines, span): Set<string>`.
+
+- [x] **Step 1: Write the failing tests** in `brought.test.ts`:
+ - `lists each machine a person brought with what shipped on it`: two machines of `ken`, three shipped requests (any
+ requester) whose runs ran on `m1`, one on `m2` with `fixedAfterMergeAt` → `[{machineId:'m1', shipped:3, …}, {machineId:'m2', shipped:0, …}]`.
+ - `folds a Team account into its Mac`: a run on the Team pool `t1` (`hostMachineId: 'm1'`) → counted on `m1`, one row.
+ - `resolves an older run's machine from its agent`: run without `machineId`, `agentId` of an agent on `m1` → `m1`.
+ - `shows each subscription's weekly window`: quotas Claude weekly `usedPercent 38, resetsAt T` and Codex unknown →
+ `[{engine:'claude', usedPercent:38, resetsAt:T}, {engine:'codex', usedPercent:null, resetsAt:null}]`.
+ - `never lists a machine the reader cannot see`: a machine not in `machines` input is absent.
+ - `counts contributors this period, last period and kept`: runs on ken's machine both periods, diego's last only →
+ `{ thisWeek: 1, lastWeek: 2, kept: 1 }`.
+- [x] **Step 2: Run** `npm test -- src/superTabs/leaderboard/brought.test.ts`; expect FAIL (module missing).
+- [x] **Step 3: Implement** `brought.ts`; `stats.ts` sets `details.brought` from `machinesBy.get(personId)` (busyHours
+ from the `lentIn` it already computes) and `contributors` from `contributorsIn` over `shared` groups.
+- [x] **Step 4: Run** brought and stats tests; expect PASS. Run `npm test -- src/superTabs/leaderboard` for regressions.
+- [x] **Step 5: Commit** test then code.
+
+### Task 3: The owner hears when others' work starts on their machine
+
+**Files:**
+- Create: `backend/src/superTabs/othersWork.ts`
+- Modify: `backend/src/superTabs/commands.ts` (`work.assign`, after `recordRun`)
+- Modify: `backend/src/superTabs/machines.ts` (`ContributedMachine.othersToldWeek?: number`)
+- Modify: `backend/src/superTabs/model.ts` (`NOTICE_READERS['others-work-notice'] = 'people'`),
+ `backend/src/superTabs/projects.ts` (`SERVER_WORDS` adds it)
+- Test: `backend/src/superTabs/othersWork.test.ts`; `backend/src/superTabs/commands.test.ts` (assign path)
+
+**Interfaces:**
+- Produces: `othersWorkNotice(state: SuperTabState, group: Conversation, worker: Agent, now: number): { conversationId: string; text: string; machineId: string } | null`
+ — null when not someone else's work (Lent's rule), already told this week, a PM's or private chat's; otherwise marks
+ `pool.othersToldWeek = weekStart(now)`.
+- Text: `${who}'s work${title ? ` "${title}"` : ''} started on your ${machine} (${engine}${quota ? `, ${quota}` : ''}). Members › your card shows what it runs and ships; Manage › Machines can pause new work.`
+ where `quota` is `${P}% of this week used, resets in ${d}`, absent when unknown.
+
+- [x] **Step 1: Write the failing tests**: `tells the owner once a week when someone else's task starts on their machine`
+ (second assign same week: none; next week: one), `says nothing for the owner's own request, a PM or a private chat`,
+ `names the task only when the owner may read its project`, and in `commands.test.ts`
+ `work.assign posts the others-work notice in the machine owner's Buddy chat` (message source kind, conversation is the
+ owner's Buddy chat, machine part has `othersToldWeek`).
+- [x] **Step 2: Run** `npm test -- src/superTabs/othersWork.test.ts src/superTabs/commands.test.ts -t others`; expect FAIL.
+- [x] **Step 3: Implement** `othersWork.ts`; in `work.assign` push the message with id `stableId(operationId, 'others-work-notice')`,
+ author `sender`, source `{ kind: 'others-work-notice', machineId }`.
+- [x] **Step 4: Run** the same; expect PASS; then the full Super Tab integration suite
+ (`npm run test:integration:super-tabs` or the repo's documented command) under the shared suite lock.
+- [x] **Step 5: Commit** test then code.
+
+### Task 4: Desktop and web show Brought in the person card
+
+**Files:**
+- Modify: `desktop/lib/super_tabs/leaderboard/model.dart` (`SuperTabPersonDetails.brought`, nullable for an older server)
+- Modify: `desktop/lib/super_tabs/leaderboard/person_row.dart` (`_LeaderboardPersonDetails`: Brought replaces Lent when present)
+- Test: `desktop/test/super_tab_humans_test.dart` (group "Brought", beside the card's other tests); screenshots in `super_tab_leaderboard_shots_test.dart`
+
+**Interfaces:**
+- Consumes: the `brought` contract (Task 2).
+- Produces: `SuperTabBrought { machineId, machineName, shipped, busyHours, subscriptions: List<({String engine, int? usedPercent, int? resetsAt})> }`.
+
+- [x] **Step 1: Write the failing tests**: `the card lists each machine brought with what it shipped and its weekly use`
+ (finds `Brought`, `Mac Studio`, `5 shipped · 31 h for others`, `Claude`, `38% used · resets in 3d`, `not read yet`);
+ `with nothing brought it says so` (`No machines brought yet`); `from an older server it keeps Lent` (no `brought` key → `Lent`).
+- [x] **Step 2: Run** `flutter test test/super_tab_humans_test.dart --plain-name Brought`; expect FAIL.
+- [x] **Step 3: Implement** parsing and the section, reusing the card's `section`/`item`/`line` helpers and `superTabMachineName`.
+- [x] **Step 4: Run** it and `flutter test test/super_tab_leaderboard*_test.dart test/super_tab_roster*_test.dart`; expect PASS.
+ Run the style check. Capture light and dark card screenshots.
+- [x] **Step 5: Commit** test then code.
+
+### Task 5: The phone shows Brought in the person sheet
+
+**Files:**
+- Modify: `mobile/lib/swarm/swarm_leaderboard_reader.dart` (`SwarmScore.brought`, `swarmPersonWeek`)
+- Test: `mobile/test/swarm/swarm_leaderboard_test.dart` (group "Brought")
+
+**Interfaces:**
+- Consumes: the `brought` contract (Task 2).
+
+- [x] **Step 1: Write the failing test** `the person sheet has a line per machine brought`: `swarmPersonWeek(score)`
+ contains `('Mac Studio', '5 shipped · 31 h for others\nClaude 38% used, resets in 3d\nCodex not read yet')` and no `Lent` line; from a
+ score without `brought` it keeps `Lent`.
+- [x] **Step 2: Run** `flutter test test/swarm/swarm_leaderboard_test.dart --plain-name Brought` in mobile/; expect FAIL.
+- [x] **Step 3: Implement** parsing and the lines.
+- [x] **Step 4: Run** it and `flutter test test/swarm/swarm_leaderboard*_test.dart`; expect PASS. Capture a screenshot.
+- [x] **Step 5: Commit** test then code.
diff --git a/docs/plans/2026-11-03-refused-host-start-fails-plan.md b/docs/plans/2026-11-03-refused-host-start-fails-plan.md
new file mode 100644
index 000000000..673793b5d
--- /dev/null
+++ b/docs/plans/2026-11-03-refused-host-start-fails-plan.md
@@ -0,0 +1,125 @@
+# A start whose host reports are refused fails at once: implementation plan
+
+> Way of working: this project's instructions (Engineer role). The Engineer implements it task by task, each failing
+> test committed before its code, and one Review step on the pull request. Steps use checkbox (`- [ ]`) syntax.
+
+**Goal:** when the server refuses a host's report for a start on that host's machine, the start fails at once, and the
+refusal's reason is on the start for those who may read it. Today it waits silently until the 3-minute timeout
+("<machine> did not start it within 3 minutes"), and the reason exists only in that machine's daemon log.
+
+**Architecture:** the host already tells the server, in its machine reading, which starts it is preparing
+(`preparingStartIds`), and the liveness sweep acts on that. A new reading field does the same for refusals:
+`refusedStarts: [{ startId, reason }]`. The CLI host loop records each start whose host-route call the backend refused
+with a 403, and sends it in its next reading. The backend keeps only this machine's own undecided starts, as it does for
+preparing ones, and the sweep (liveness.ts `failStalledStarts`) fails each one named there at once. No access check
+changes: only a reading the store already accepts for this machine's pool (its contributor, its generation) can name a
+start, and only a start on that machine that has neither started nor failed. That is what the host could already do with
+`agent.startFailed` while its reports pass, and what the timeout does anyway three minutes later.
+
+**Tech Stack:** TypeScript; backend Fastify + Prisma on MongoDB (Vitest integration on MongoMemoryReplSet); CLI host
+(Vitest specs).
+
+**Spec:** task #2441 brief, as River narrowed it (2026-11-03 10:4x UTC): "a host report refused after dispatch fails the
+start at once and shows the refusal's reason in the app. Keep the access check unchanged." The access check's own cause
+waits for the affected Mac's daemon log and becomes its own fix.
+
+## Global Constraints
+
+- PR body first line: "Requested by [email protected] through Harness."
+- No access check changes (`poolHostActor`, `contribution`, `hostFor` untouched).
+- Swarm code stays out of `cli/src/core`.
+- Members who are neither the start's maker, its coordinator nor its machine's owner read `publicReason`, never the raw
+ refusal (startFailure.ts); no reader ever reads a machine's `refusedStarts`.
+- An older backend refuses the new field: the CLI sends that Swarm's reading without it, as for every field before it.
+
+## Design
+
+- Growth: nothing new is stored beyond the latest reading: at most 100 entries, reason at most 300 characters, replaced by
+ each reading, and filtered to this machine's undecided starts.
+- Concurrency: the reading's existing write (one machine part per Swarm); the sweep runs in it, as for preparing starts.
+- Read cost: no new reads. A changed refusal set makes that reading a full report (`readingOnly`), as a changed preparing
+ set does; an unchanged one stays a fast reading.
+- Scale 10x: bounded per reading; the sweep is already linear in the Swarm's starts.
+- Compatibility: an older CLI never sends the field (its starts time out as before). A newer CLI to an older backend:
+ the field is refused and dropped for FIELD_REFUSED_MS (cli machines.ts `sendAlone`).
+- Migration + rollback: none; the field is optional. Rollback: release the previous backend, which refuses the field;
+ the CLI then drops it.
+- Audience: the server enforces it. Readers' copies of machine readings drop `refusedStarts` (model.ts visibility), and
+ the start's raw error is read only by `readsRawReason`.
+- Identity: a machine names only starts on itself, through its own pool's reading.
+- Failure: this change is the failure becoming visible; a refusal the CLI cannot report (the reading itself refused)
+ still ends at the timeout, as today.
+- Platforms: backend; CLI on macOS, Linux and Windows (host loop only).
+
+## Review Focus
+
+1. A reading from another machine naming the start: ignored (Task 1 test).
+2. A start that already started, or already failed: never failed again or rewritten (Task 1 test).
+3. A refusal for a start before dispatch: fails it too, at once (Task 1 test).
+4. A transient failure (timeout, 5xx, network): never reported as refused (Task 2 test).
+5. A Buddy on its person's own machine outside the Swarm: its person reads the refusal (Task 1 test).
+
+---
+
+### Task 1: the backend fails a start its own machine reports refused
+
+**Files:**
+- Modify: `backend/src/superTabs/machines.ts` (schema field `refusedStarts`, `storedObservation`, `readingOnly`)
+- Modify: `backend/src/superTabs/liveness.ts` (`failStalledStarts`)
+- Modify: `backend/src/superTabs/startFailure.ts` (`REFUSED_INFIX`)
+- Modify: `backend/src/superTabs/model.ts` (readers' copies drop `refusedStarts`)
+- Test: `backend/integration/superTabLiveness.test.ts`, `backend/integration/superTabBuddies.test.ts`
+
+**Interfaces:**
+- Produces: `machineObservationSchema.refusedStarts?: Array<{ startId: string (1..160); reason: string (1..300) }>` (max 100,
+ strict objects). Stored only for starts where `start.request.machineId === machineId && !start.harnessId && !start.error`.
+- Produces: `export const REFUSED_INFIX = ' refused it: '`; the start's error is `${machineName}${REFUSED_INFIX}${reason}`.
+
+- [ ] **Step 1: failing tests**
+ - superTabLiveness: `fails a start its own machine reports refused, at once, with the refusal's reason`: launch,
+ observe `test-host` with `refusedStarts: [{ startId, reason: 'This start does not belong to this machine contribution.' }]`
+ → the Lead's start read has error `Worker Mac refused it: This start does not belong to this machine contribution.`;
+ the Lead's inbox has the `start-timeout` notice `Could not start Builder on fixture-model: its machine could not
+ prepare or launch it. …`; a later `agent.started` is refused `START_FAILED`.
+ - superTabLiveness: `is not failed by another machine's report, never rewrites a decided start, and no reader reads the
+ refusals`: `lead-host` names the start → no error; a started start named by `test-host` keeps no error; the owner's
+ read has no `refusedStarts` on any machine.
+ - superTabLiveness: `fails an undispatched start its machine reports refused`.
+ - superTabBuddies: `a Buddy on its person's own machine outside the Swarm fails at once when its host's report is
+ refused, and its person reads why`: buddy.create with setup on `peer-laptop`, dispatch, observe with
+ `refusedStarts` → peer's read of the start has the raw error; the owner's read does not list the machine.
+- [ ] **Step 2: run red:** `cd backend && npm run test:super-tabs -- integration/superTabLiveness.test.ts integration/superTabBuddies.test.ts -t refused`
+ Expected: FAIL (the schema refuses `refusedStarts`).
+- [ ] **Step 3: commit the red tests.**
+- [ ] **Step 4: implement** as the Interfaces say; in `failStalledStarts`, before the timeout checks, a start with no
+ `harnessId` and no `error` named in its own machine's fresh reading fails with the same notices the timeout writes
+ (`noteStartFailed`, lead/Buddy/session/task notice).
+- [ ] **Step 5: run green**, then `npm run typecheck`.
+- [ ] **Step 6: commit.**
+
+### Task 2: the CLI host reports the starts the backend refused
+
+**Files:**
+- Modify: `cli/src/superTabs/machines.ts` (host loop records refusals; reading field; `sendAlone` fallback)
+- Test: `cli/src/superTabs/machines.spec.ts`
+
+**Interfaces:**
+- Consumes: Task 1's `refusedStarts` field.
+- Produces: a host-route call for a start that throws, or answers, a backend 403 records `{ startId, reason: message }`
+ (reason cut to 300 characters); the next reading of that Swarm carries it while the start is still pending there.
+
+- [ ] **Step 1: failing tests** (machines.spec.ts):
+ - `reports a dispatched start whose host report the backend refused, with the refusal, in its next reading`
+ - `reports nothing for a timeout or a 5xx, and drops a start once it is no longer pending`
+ - `sends the reading without refusedStarts to a backend that refuses the field`
+- [ ] **Step 2: run red:** `cd cli && npx vitest run src/superTabs/machines.spec.ts -t refused`
+- [ ] **Step 3: commit the red tests.**
+- [ ] **Step 4: implement.**
+- [ ] **Step 5: run green**, then `npm run typecheck` in cli.
+- [ ] **Step 6: commit.**
+
+### Task 3: before Ready
+
+- [ ] Full Super Tab integration suite (`npm run test:super-tabs`), backend typecheck; CLI `test:orchestrator` coverage
+ gate if it covers machines.ts.
+- [ ] Red/green evidence as a PR comment; mark Ready; one Review step by Routing (access checks unchanged, River).
diff --git a/mobile/lib/phone/phone_shell.dart b/mobile/lib/phone/phone_shell.dart
index 4be22528a..d0f928c6f 100644
--- a/mobile/lib/phone/phone_shell.dart
+++ b/mobile/lib/phone/phone_shell.dart
@@ -587,7 +587,7 @@ class _PhoneShellState extends State<PhoneShell> with WidgetsBindingObserver {
),
swarm: (_) => SwarmTabsPage(
onSettings: (context) =>
- openPhoneSettings(context, widget.notifier),
+ openPhoneSettings(context, widget.notifier, swarm: true),
),
),
),
diff --git a/mobile/lib/phone/settings_page.dart b/mobile/lib/phone/settings_page.dart
index 2a9092970..2b7399bb6 100644
--- a/mobile/lib/phone/settings_page.dart
+++ b/mobile/lib/phone/settings_page.dart
@@ -14,11 +14,14 @@ import 'package:harness_mobile/notify/system_notices.dart';
import 'package:harness_mobile/settings/experimental_features.dart';
import 'package:harness_mobile/measurement/product_measurement.dart';
import 'package:harness_mobile/shared/widgets/app_dialog.dart';
+import 'package:harness_mobile/shared/theme/app_space.dart';
import 'package:harness_mobile/shared/theme/app_theme.dart';
import 'package:harness_mobile/shared/theme/appearance_prefs_store.dart';
import 'package:harness_mobile/shared/theme/color_palette.dart';
import 'package:harness_mobile/state/app_state.dart';
import 'package:harness_mobile/swarm/swarm_start.dart' show SwarmIntroPage;
+import 'package:harness_mobile/swarm/swarm_style.dart'
+ show SwarmAvatar, SwarmBackButton, SwarmCaption, SwarmRowGlyph, SwarmTopBar;
import 'package:harness_mobile/terminal/terminal_font_store.dart';
import 'package:harness_mobile/terminal/terminal_theme_store.dart';
@@ -26,6 +29,7 @@ import 'add_device/add_device_page.dart';
import 'approve_sign_in.dart';
import 'connectors_page.dart';
import 'devices_page.dart';
+import 'machine_index.dart' show visibleMachines;
import 'machine_profile_picker.dart';
import 'machines_tab.dart';
import 'out_of_sight.dart';
@@ -85,10 +89,16 @@ class SettingsPage extends StatelessWidget {
required this.notifier,
this.large = true,
this.experiments,
+ this.swarm = false,
});
final AppNotifier notifier;
+ /// Drawn as Swarm's pages are ([SettingsSwarmLook]): opened from Swarm's You. Swarm's top bar
+ /// then stands in for the big title, whatever [large] says, and the list is Swarm's shorter one —
+ /// every setting still there, fewer rows and captions (`docs/design/2026-11-03-swarm-settings.md`).
+ final bool swarm;
+
/// What Experimental switches: [experimentalFeaturesStore] unless a test hands in its own, so a
/// tap there never writes to the developer's own state file.
final ExperimentalFeaturesStore? experiments;
@@ -105,6 +115,33 @@ class SettingsPage extends StatelessWidget {
builder: (context) {
AppTheme.watch(context);
final tty = Tty.of(context);
+ final body = _Body(
+ notifier: notifier,
+ experiments: experiments ?? experimentalFeaturesStore,
+ );
+ // In the app's face, as Swarm's pages are; only the bar's title is the terminal's.
+ if (swarm) {
+ return Scaffold(
+ backgroundColor: tty.ground,
+ body: SafeArea(
+ bottom: false,
+ child: SettingsSwarmLook(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ SwarmTopBar(
+ leading: SwarmBackButton(
+ onPressed: () => Navigator.of(context).maybePop(),
+ ),
+ title: 'Settings',
+ ),
+ Expanded(child: body),
+ ],
+ ),
+ ),
+ ),
+ );
+ }
return Scaffold(
backgroundColor: tty.ground,
body: SafeArea(
@@ -147,12 +184,7 @@ class SettingsPage extends StatelessWidget {
weight: FontWeight.w600,
),
),
- Expanded(
- child: _Body(
- notifier: notifier,
- experiments: experiments ?? experimentalFeaturesStore,
- ),
- ),
+ Expanded(child: body),
],
),
),
@@ -181,111 +213,58 @@ class _Body extends StatelessWidget {
MediaQuery.paddingOf(context).bottom + 24,
),
children: [
- SettingsCaption(_sample(context) == null ? 'Account' : 'Sample'),
- // Who you are, what you have used, the computers you reach and what they call this phone —
- // one group, so no row stands alone under a heading that only repeats it.
+ if (SettingsSwarmLook.of(context))
+ ..._swarmAccount(context)
+ else ...[
+ SettingsCaption(_sample(context) == null ? 'Account' : 'Sample'),
+ // Who you are, what you have used, the computers you reach and what they call this phone —
+ // one group, so no row stands alone under a heading that only repeats it.
+ SettingsGroup(
+ children: [
+ _accountRow(context),
+ // ⚠️ Usage sits right under the account, above everything that is set once and left
+ // alone, and that is deliberate: it is the only row here anybody opens twice.
+ // No Stats row: counters this app keeps about itself are nobody's daily question.
+ buildUsageSettingsRow(context, notifier),
+ ?_privacyRow(context),
+ _computersRow(context),
+ ?_profileRow(context),
+ _connectorsRow(context),
+ _signInRow(context),
+ _addDeviceRow(context),
+ _devicesRow(context),
+ // Under Your devices: a new device on the account is one of the two things a notice
+ // says.
+ ?_notificationsRow(context),
+ // The name those computers show when this phone takes a harness over — which makes it
+ // a fact about the account's computers, not about how the terminal looks.
+ _PhoneNameRow(notifier: notifier),
+ ],
+ ),
+ ],
+ const SettingsCaption('Terminal'),
SettingsGroup(
children: [
- _accountRow(context),
- // ⚠️ Usage sits right under the account, above everything that is set once and left
- // alone, and that is deliberate: it is the only row here anybody opens twice.
- // No Stats row: counters this app keeps about itself are nobody's daily question.
- buildUsageSettingsRow(context, notifier),
- if (_sample(context) == null)
- SettingsRow(title: 'Privacy', onTap: () => Navigator.of(context).push(
- phoneRoute((_) => PrivacyPage(request: ({bool? enabled}) async {
- final value = await notifier.productUsageSettings(enabled: enabled);
- // Set here by the person: it also settles an opt-out made before sign-in.
- notifier.productMeasurement.savedChoice(value, explicit: enabled != null);
- await notifier.productMeasurement.setupChoiceSaved;
- return value;
- }, feedback: notifier.api.productUsageFeedback)),
- )),
- // The computers this phone reaches — here rather than a menu of their own: linking one is
- // a once-a-while errand, and Find already reaches every agent on them.
- // Each computer's sheet there holds what the account can do to it — try it again, rename
- // it, take it off the account (`machine_actions.dart`).
- SettingsRow(
- title: 'Computers',
- onTap: () {
- notifier.productMeasurement.screenOpened(
- PhoneScreen.computers,
- ScreenOpening.button,
- );
- Navigator.of(context).push(
- phoneRoute(
- (_) => MachinesTab(
- notifier: notifier,
- large: false,
- fromSettings: true,
- ),
- ),
- );
- },
- ),
- // Which computer's tabs this phone shows — the desktop's Profiles. Beside Computers: it
- // is a choice among them, and changes nothing on any of them. Only once there IS a choice
- // — two computers or more — or one is already made, so it can be undone.
- if (notifier.machines.length > 1 || notifier.machineProfileId != null)
- SettingsRow(
- key: const Key('settings-profile'),
- title: 'Profile',
- value: machineProfileLabel(notifier),
- onTap: () =>
- unawaited(showMachineProfilePicker(context, notifier)),
- ),
- // The services those computers' agents use (Linear, GitHub…), signed in to from here.
- SettingsRow(
- key: const Key('settings-connectors'),
- title: 'Connectors',
- onTap: () => Navigator.of(context).push(
- phoneRoute((_) => ConnectorsPage(notifier: notifier)),
- ),
- ),
- // Every device signed in to the account — each trusted by the others because of that, so
- // this is where one that is not yours is seen and taken out.
- // A computer showing its sign-in QR (`harness login --qr`, or the web app's "Scan with your
- // phone"): this phone approves it with its own account.
- SettingsRow(
- key: const Key('settings-sign-in-computer'),
- title: 'Sign in a computer',
- onTap: () => unawaited(signInAComputer(context, notifier)),
- ),
- // A Harness with no screen (a box, a mini PC): onto the person's Wi-Fi and signed in to
- // this account through its setup hotspot.
- SettingsRow(
- key: const Key('settings-add-device'),
- title: 'Set up Intern 3',
- onTap: () => Navigator.of(context).push(
- phoneRoute((_) => AddDevicePage(notifier: notifier)),
- ),
- ),
- SettingsRow(
- title: 'Your devices',
- value: notifier.newDevices.isEmpty ? null : '${notifier.newDevices.length} new',
- onTap: () => Navigator.of(context).push(
- phoneRoute((_) => DevicesPage(notifier: notifier)),
- ),
- ),
- // Under Your devices: a new device on the account is one of the two things a notice says.
- // Not in the sample, whose notices go nowhere.
- if (_sample(context) == null) _NotificationsRow(notifier: notifier),
- // The name those computers show when this phone takes a harness over — which makes it a
- // fact about the account's computers, not about how the terminal looks.
- _PhoneNameRow(notifier: notifier),
+ _FontPreview(),
+ _FontRow(),
+ _SizeRow(),
+ _TerminalThemeRow(),
+ // In Swarm's look the mic's language closes Terminal's card instead of a Voice section
+ // of its own: there every row leads with a glyph, and the mic's says what the row is
+ // about where the plain rows below needed a caption to.
+ // See docs/design/2026-11-03-swarm-settings.md.
+ if (SettingsSwarmLook.of(context)) _VoiceLanguageRow(),
],
),
- const SettingsCaption('Terminal'),
- SettingsGroup(
- children: [_FontPreview(), _FontRow(), _SizeRow(), _TerminalThemeRow()],
- ),
// ⚠️ **Its own section, not a row under Terminal.** The rows above answer
// what the pane LOOKS like — face, size, colours. This one answers what the mic HEARS, which is
// the other half of the terminal and the one people go looking for when
// the transcript comes back in the wrong language. Under a Terminal
- // caption it read as another thing about the type.
- const SettingsCaption('Voice'),
- SettingsGroup(children: [_VoiceLanguageRow()]),
+ // caption it read as another thing about the type. (Swarm's look aside, above.)
+ if (!SettingsSwarmLook.of(context)) ...[
+ const SettingsCaption('Voice'),
+ SettingsGroup(children: [_VoiceLanguageRow()]),
+ ],
const SettingsCaption('Appearance'),
SettingsGroup(children: [_PaletteRow(), _TextSizeRow()]),
// The desktop's Labs ▸ Experimental, and in the same place: after how the app looks, before
@@ -297,52 +276,239 @@ class _Body extends StatelessWidget {
_ExperimentRow(experiment: experiment, store: experiments),
],
),
- const SettingsCaption('Help'),
- SettingsGroup(
- children: [
- SettingsRow(
- title: 'How Harness works',
- onTap: () => unawaited(openHowItWorks(context)),
- ),
- // The offline sample, from inside the real app too — to show somebody, or to try a
- // gesture without touching a real harness. Not offered inside the sample itself.
- if (_sample(context) == null)
+ // Help's three rows and About's two are each one row in Swarm's look, opening a sheet of
+ // them: all five are opened once in a while, and as rows they were a fifth of the page.
+ if (SettingsSwarmLook.of(context)) ...[
+ const SizedBox(height: AppSpace.xl),
+ SettingsGroup(children: [_helpRow(context), const _AboutRow()]),
+ ] else ...[
+ const SettingsCaption('Help'),
+ SettingsGroup(
+ children: [
SettingsRow(
- title: 'Try the sample',
- onTap: () => unawaited(openSampleMode(context)),
+ title: 'How Harness works',
+ glyph: LucideIcons.circleHelp300,
+ onTap: () => unawaited(openHowItWorks(context)),
),
- SettingsRow(
- title: 'Show the tips again',
- onTap: () {
- unawaited(FocusHintsSeen.shared.forget());
- ScaffoldMessenger.maybeOf(context)?.showSnackBar(
- const SnackBar(
- content: Text('The tips come back on the next harness.'),
- ),
- );
- },
- ),
- ],
- ),
- const SettingsCaption('About'),
- SettingsGroup(
- children: [
- const _VersionRow(),
- const _BuildRow(),
- // The stores want the policy reachable from inside the app — see [kPrivacyPolicyUrl].
- SettingsRow(
- title: 'Privacy Policy',
- onTap: () => unawaited(openPrivacyPolicy(context)),
- ),
- ],
- ),
+ // The offline sample, from inside the real app too — to show somebody, or to try a
+ // gesture without touching a real harness. Not offered inside the sample itself.
+ if (_sample(context) == null)
+ SettingsRow(
+ title: 'Try the sample',
+ glyph: LucideIcons.play300,
+ onTap: () => unawaited(openSampleMode(context)),
+ ),
+ SettingsRow(
+ title: 'Show the tips again',
+ glyph: LucideIcons.lightbulb300,
+ onTap: () => _showTipsAgain(context),
+ ),
+ ],
+ ),
+ const SettingsCaption('About'),
+ SettingsGroup(
+ children: [
+ const _VersionRow(),
+ const _BuildRow(),
+ // The stores want the policy reachable from inside the app — see [kPrivacyPolicyUrl].
+ SettingsRow(
+ title: 'Privacy Policy',
+ glyph: LucideIcons.fileText300,
+ onTap: () => unawaited(openPrivacyPolicy(context)),
+ ),
+ ],
+ ),
+ ],
],
);
+ void _showTipsAgain(BuildContext context) {
+ unawaited(FocusHintsSeen.shared.forget());
+ ScaffoldMessenger.maybeOf(context)?.showSnackBar(
+ const SnackBar(content: Text('The tips come back on the next harness.')),
+ );
+ }
+
+ /// Help's rows as one, in Swarm's look: the same three, in the same words, in a sheet. Each
+ /// runs after the sheet has closed ([PhoneSheetAction.onTap]), so on this page's context.
+ Widget _helpRow(BuildContext context) => SettingsRow(
+ key: const ValueKey('settings-help'),
+ title: 'Help',
+ glyph: LucideIcons.circleHelp300,
+ onTap: () => showPhoneSheet(
+ context,
+ title: 'Help',
+ actions: [
+ PhoneSheetAction(
+ icon: LucideIcons.circleHelp300,
+ label: 'How Harness works',
+ chevron: true,
+ onTap: () => unawaited(openHowItWorks(context)),
+ ),
+ if (_sample(context) == null)
+ PhoneSheetAction(
+ icon: LucideIcons.play300,
+ label: 'Try the sample',
+ chevron: true,
+ onTap: () => unawaited(openSampleMode(context)),
+ ),
+ PhoneSheetAction(
+ icon: LucideIcons.lightbulb300,
+ label: 'Show the tips again',
+ onTap: () => _showTipsAgain(context),
+ ),
+ ],
+ ),
+ );
+
/// The sample this page is in, or null in the real app — see `lib/demo/sample_mode.dart`.
SampleSession? _sample(BuildContext context) =>
SampleMode.maybeOf(context) ?? SampleMode.ofNotifier(notifier);
+ /// The account's rows as Swarm splits You's, in cards with no caption (prototype A lean,
+ /// 2026-11-03, `docs/design/2026-11-03-swarm-settings.md`): you and what you use and hear of;
+ /// your computers; this phone.
+ List<Widget> _swarmAccount(BuildContext context) => [
+ if (_sample(context) != null)
+ const SwarmCaption('Sample', first: true)
+ else
+ const SizedBox(height: AppSpace.s),
+ SettingsGroup(
+ children: [
+ _accountRow(context),
+ buildUsageSettingsRow(context, notifier),
+ ?_notificationsRow(context),
+ ?_privacyRow(context),
+ ],
+ ),
+ const SizedBox(height: AppSpace.l),
+ SettingsGroup(
+ children: [
+ _computersRow(context),
+ ?_profileRow(context),
+ _connectorsRow(context),
+ _signInRow(context),
+ // ⚠️ Only while Computers has no list. Its Set up Intern 3 sits under the list
+ // (`machines_tab.dart` `_ConnectBar`), and with no computer — none yet, still loading, or
+ // not fetched — that page is an empty state whose one button is Add computer. Somebody
+ // whose first Harness is an Intern 3 would have had no way to set it up from here.
+ if (visibleMachines(notifier).isEmpty) _addDeviceRow(context),
+ ],
+ ),
+ const SizedBox(height: AppSpace.l),
+ SettingsGroup(
+ children: [_devicesRow(context), _PhoneNameRow(notifier: notifier)],
+ ),
+ ];
+
+ /// Not in the sample.
+ Widget? _privacyRow(BuildContext context) => _sample(context) != null
+ ? null
+ : SettingsRow(
+ title: 'Privacy',
+ glyph: LucideIcons.shield300,
+ onTap: () => Navigator.of(context).push(
+ phoneRoute(
+ (_) => PrivacyPage(
+ request: ({bool? enabled}) async {
+ final value = await notifier.productUsageSettings(
+ enabled: enabled,
+ );
+ // Set here by the person: it also settles an opt-out made before sign-in.
+ notifier.productMeasurement.savedChoice(
+ value,
+ explicit: enabled != null,
+ );
+ await notifier.productMeasurement.setupChoiceSaved;
+ return value;
+ },
+ feedback: notifier.api.productUsageFeedback,
+ ),
+ ),
+ ),
+ );
+
+ /// The computers this phone reaches — here rather than a menu of their own: linking one is a
+ /// once-a-while errand, and Find already reaches every agent on them.
+ /// Each computer's sheet there holds what the account can do to it — try it again, rename it,
+ /// take it off the account (`machine_actions.dart`).
+ Widget _computersRow(BuildContext context) => SettingsRow(
+ title: 'Computers',
+ glyph: LucideIcons.laptop300,
+ onTap: () {
+ notifier.productMeasurement.screenOpened(
+ PhoneScreen.computers,
+ ScreenOpening.button,
+ );
+ Navigator.of(context).push(
+ phoneRoute(
+ (_) => MachinesTab(notifier: notifier, large: false, fromSettings: true),
+ ),
+ );
+ },
+ );
+
+ /// Which computer's tabs this phone shows — the desktop's Profiles. Beside Computers: it is a
+ /// choice among them, and changes nothing on any of them. Only once there IS a choice — two
+ /// computers or more — or one is already made, so it can be undone.
+ Widget? _profileRow(BuildContext context) =>
+ notifier.machines.length > 1 || notifier.machineProfileId != null
+ ? SettingsRow(
+ key: const Key('settings-profile'),
+ title: 'Profile',
+ glyph: LucideIcons.layers300,
+ value: machineProfileLabel(notifier),
+ onTap: () => unawaited(showMachineProfilePicker(context, notifier)),
+ )
+ : null;
+
+ /// The services those computers' agents use (Linear, GitHub…), signed in to from here.
+ Widget _connectorsRow(BuildContext context) => SettingsRow(
+ key: const Key('settings-connectors'),
+ title: 'Connectors',
+ glyph: LucideIcons.plug300,
+ onTap: () => Navigator.of(context).push(
+ phoneRoute((_) => ConnectorsPage(notifier: notifier)),
+ ),
+ );
+
+ /// A computer showing its sign-in QR (`harness login --qr`, or the web app's "Scan with your
+ /// phone"): this phone approves it with its own account.
+ Widget _signInRow(BuildContext context) => SettingsRow(
+ key: const Key('settings-sign-in-computer'),
+ title: 'Sign in a computer',
+ glyph: LucideIcons.qrCode300,
+ onTap: () => unawaited(signInAComputer(context, notifier)),
+ );
+
+ /// A Harness with no screen (a box, a mini PC): onto the person's Wi-Fi and signed in to this
+ /// account through its setup hotspot.
+ Widget _addDeviceRow(BuildContext context) => SettingsRow(
+ key: const Key('settings-add-device'),
+ title: 'Set up Intern 3',
+ glyph: LucideIcons.server300,
+ onTap: () => Navigator.of(context).push(
+ phoneRoute((_) => AddDevicePage(notifier: notifier)),
+ ),
+ );
+
+ /// Every device signed in to the account — each trusted by the others because of that, so this
+ /// is where one that is not yours is seen and taken out.
+ Widget _devicesRow(BuildContext context) => SettingsRow(
+ title: 'Your devices',
+ glyph: LucideIcons.monitorSmartphone300,
+ value: notifier.newDevices.isEmpty
+ ? null
+ : '${notifier.newDevices.length} new',
+ onTap: () => Navigator.of(context).push(
+ phoneRoute((_) => DevicesPage(notifier: notifier)),
+ ),
+ );
+
+ /// Not in the sample, whose notices go nowhere.
+ Widget? _notificationsRow(BuildContext context) =>
+ _sample(context) == null ? _NotificationsRow(notifier: notifier) : null;
+
/// Who is signed in — or, in sample mode, which has no account to show or sign out of, the
/// way back out of it.
Widget _accountRow(BuildContext context) {
@@ -351,6 +517,7 @@ class _Body extends StatelessWidget {
return SettingsRow(
key: const ValueKey('settings-leave-sample'),
title: 'Leave the sample',
+ glyph: LucideIcons.logOut300,
onTap: () => sample.leave(),
);
}
@@ -462,10 +629,18 @@ class _SigningOut extends StatelessWidget {
}
}
-/// Settings over the current page — the page Find and a terminal's menu push.
-void openPhoneSettings(BuildContext context, AppNotifier notifier) => unawaited(
- Navigator.of(context)
- .push(phoneRoute((_) => SettingsPage(notifier: notifier, large: false))),
+/// Settings over the current page — the page Find and a terminal's menu push, and Swarm's You
+/// ([swarm], in Swarm's look).
+void openPhoneSettings(
+ BuildContext context,
+ AppNotifier notifier, {
+ bool swarm = false,
+}) => unawaited(
+ Navigator.of(context).push(
+ phoneRoute(
+ (_) => SettingsPage(notifier: notifier, large: false, swarm: swarm),
+ ),
+ ),
);
/// Settings, at the top right of the screens a phone stands on before it can reach any harness:
@@ -523,6 +698,10 @@ class _Avatar extends StatelessWidget {
final source = (user?.name?.trim().isNotEmpty ?? false)
? user!.name!.trim()
: (user?.email ?? '');
+ // Swarm's round mark, in the colour Swarm gives this account on every screen.
+ if (SettingsSwarmLook.of(context)) {
+ return SwarmAvatar(id: user?.id ?? source, name: source, size: 40);
+ }
// ⚠️ The first CHARACTER, not the first code unit: a name that opens with an emoji starts on
// half of a surrogate pair, and a lone half is a string the text engine refuses — it threw,
// and took the whole Settings page down with it.
@@ -572,6 +751,7 @@ class _VoiceLanguageRow extends StatelessWidget {
// already said Voice, and a row that repeats its own section reads as
// though there were a second kind of language further down.
title: 'Language',
+ glyph: LucideIcons.mic300,
value: voiceLanguageName(code),
onTap: () => unawaited(showVoiceLanguagePicker(context)),
);
@@ -656,7 +836,9 @@ class _NotificationsRowState extends State<_NotificationsRow>
return SettingsRow(
key: const ValueKey('settings-notifications'),
title: 'Notifications',
- detail: 'When $noticesWhen.',
+ glyph: LucideIcons.bell300,
+ // On or Off says it in Swarm's look, which keeps its rows to one line.
+ detail: SettingsSwarmLook.of(context) ? null : 'When $noticesWhen.',
value: switch (_on) {
true => 'On',
false => 'Off',
@@ -698,7 +880,10 @@ class _ExperimentRow extends StatelessWidget {
child: SettingsRow(
key: ValueKey('settings-experiment-${experiment.id}'),
title: experiment.label,
- detail: experiment.description,
+ glyph: LucideIcons.flaskConical300,
+ // Swarm's look keeps its rows to one line; what Swarm is, its own intro page says as it
+ // is turned on.
+ detail: SettingsSwarmLook.of(context) ? null : experiment.description,
trailing: Switch.adaptive(
value: on,
activeTrackColor: Tty.of(context).green,
@@ -727,6 +912,7 @@ class _PhoneNameRow extends StatelessWidget {
key: const ValueKey('settings-phone-name'),
// What the row sets, not what it is about: "This phone · Phone" read as a heading.
title: 'Phone name',
+ glyph: LucideIcons.smartphone300,
value: notifier.phoneClientDescriptor().name,
onTap: () => unawaited(
showAppDialog<void>(
@@ -821,7 +1007,15 @@ class _FontPreview extends StatelessWidget {
);
return ExcludeSemantics(
child: Padding(
- padding: const EdgeInsets.fromLTRB(13, 14, 13, 14),
+ // In Swarm's look the line starts where the rows' titles do, after their glyphs.
+ padding: EdgeInsets.fromLTRB(
+ SettingsSwarmLook.of(context)
+ ? AppSpace.l + SwarmRowGlyph.width + AppSpace.m
+ : 13,
+ 14,
+ 13,
+ 14,
+ ),
child: Text.rich(
TextSpan(
children: [
@@ -849,6 +1043,7 @@ class _FontRow extends StatelessWidget {
AppTheme.watch(context);
return SettingsRow(
title: 'Font',
+ glyph: LucideIcons.type300,
value: terminalFontStore.family.label,
onTap: () => showPhoneSheet(
context,
@@ -881,6 +1076,7 @@ class _SizeRow extends StatelessWidget {
final size = terminalFontStore.size;
return SettingsRow(
title: 'Size',
+ glyph: LucideIcons.aLargeSmall300,
trailing: SettingsStepper(
value: size.toStringAsFixed(0),
// The bounds are the store's own, so a lit + that does nothing is impossible.
@@ -913,6 +1109,7 @@ class _TerminalThemeRow extends StatelessWidget {
: option.label;
return SettingsRow(
title: 'Colors',
+ glyph: LucideIcons.palette300,
value: label(choice),
onTap: () => showPhoneSheet(
context,
@@ -961,6 +1158,7 @@ class _PaletteRow extends StatelessWidget {
// "App colors", beside the terminal's own "Colors": both read Graphite by default, and
// two rows with one value looked like the same setting twice.
title: 'App colors',
+ glyph: LucideIcons.contrast300,
value: prefs.palette.label,
onTap: () => showPhoneSheet(
context,
@@ -994,6 +1192,7 @@ class _TextSizeRow extends StatelessWidget {
final size = prefs.uiSize;
return SettingsRow(
title: 'Text size',
+ glyph: LucideIcons.aLargeSmall300,
trailing: SettingsStepper(
value: size.toStringAsFixed(0),
onDecrease: size > AppearancePrefs.uiSizeMin
@@ -1022,6 +1221,55 @@ class _VersionRow extends StatelessWidget {
);
}
+/// About as one row, as Settings opened from Swarm has it: "About 1.0.12 (80)", the version and
+/// the build together — short enough that the build is not lost to an ellipsis, which is why the
+/// phone's own look gives it a row of its own ([_BuildRow]). A tap opens a sheet that names them
+/// again over the Privacy Policy, the stores' required link (see [kPrivacyPolicyUrl]).
+class _AboutRow extends StatefulWidget {
+ const _AboutRow();
+
+ @override
+ State<_AboutRow> createState() => _AboutRowState();
+}
+
+class _AboutRowState extends State<_AboutRow> {
+ /// Read once for the row, not once per build: the list rebuilds on every [AppNotifier]
+ /// notification, and a new future each time would flash the row empty (see [_BuildRow._info]).
+ /// [PackageInfo] keeps what the platform said, so a row built again asks no channel.
+ late final Future<String> _label = () async {
+ final version = await runningAppVersion();
+ final build = (await PackageInfo.fromPlatform()).buildNumber;
+ return build.isEmpty ? version : '$version ($build)';
+ }();
+
+ @override
+ Widget build(BuildContext context) => FutureBuilder<String>(
+ future: _label,
+ builder: (context, snapshot) {
+ AppTheme.watch(context);
+ final label = snapshot.data ?? '';
+ return SettingsRow(
+ key: const ValueKey('settings-about'),
+ title: 'About',
+ glyph: LucideIcons.info300,
+ value: label,
+ onTap: () => showPhoneSheet(
+ context,
+ title: label.isEmpty ? 'Version' : 'Version $label',
+ actions: [
+ PhoneSheetAction(
+ icon: LucideIcons.fileText300,
+ label: 'Privacy Policy',
+ chevron: true,
+ onTap: () => unawaited(openPrivacyPolicy(context)),
+ ),
+ ],
+ ),
+ );
+ },
+ );
+}
+
/// The build behind the version — `buildNumber` from the bundle, and the store's own identifier.
///
/// Version alone is not enough to name a phone build. Two TestFlight builds and two Play internal
diff --git a/mobile/lib/phone/settings_row.dart b/mobile/lib/phone/settings_row.dart
index 264bafff1..deb6dbbfe 100644
--- a/mobile/lib/phone/settings_row.dart
+++ b/mobile/lib/phone/settings_row.dart
@@ -1,7 +1,11 @@
import 'package:flutter/material.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
+import 'package:harness_mobile/shared/theme/app_space.dart';
import 'package:harness_mobile/shared/theme/app_theme.dart';
+import 'package:harness_mobile/shared/theme/app_type.dart';
+import 'package:harness_mobile/swarm/swarm_row.dart';
+import 'package:harness_mobile/swarm/swarm_style.dart';
/// The pieces a phone settings list is built from — the grouped inset list every phone OS uses,
/// rather than the desktop's `SettingRow` (a raised block with a fixed-width control on the right,
@@ -44,6 +48,22 @@ const double _rowGlyph = 18;
const double _rowGlyphGap = 12;
const double _nestedPadding = _rowPadding + _rowGlyph + _rowGlyphGap;
+/// Draws the settings pieces under it as Swarm's pages draw theirs: a caption in sentence case
+/// ([SwarmCaption]), a card ([SwarmGroup]) of Swarm's rows ([SwarmRow]), each led by its
+/// [SettingsRow.glyph]. Settings opened from Swarm's You stands under it (prototype A, 2026-11-03);
+/// opened from a terminal or Find, it keeps the phone's own look.
+class SettingsSwarmLook extends InheritedWidget {
+ const SettingsSwarmLook({super.key, required super.child});
+
+ /// Whether [context] stands under one. Read without depending on it: a page wears one look for
+ /// as long as it is open.
+ static bool of(BuildContext context) =>
+ context.getInheritedWidgetOfExactType<SettingsSwarmLook>() != null;
+
+ @override
+ bool updateShouldNotify(SettingsSwarmLook oldWidget) => false;
+}
+
/// A caption over a run of rows.
class SettingsCaption extends StatelessWidget {
const SettingsCaption(this.text, {super.key});
@@ -53,6 +73,7 @@ class SettingsCaption extends StatelessWidget {
@override
Widget build(BuildContext context) {
AppTheme.watch(context);
+ if (SettingsSwarmLook.of(context)) return SwarmCaption(text);
return Padding(
// 22 above, 8 below: the caption belongs to the group under it, so it sits much closer to
// that group than to the one it follows. Equal gaps either side would leave every caption
@@ -82,6 +103,7 @@ class SettingsGroup extends StatelessWidget {
@override
Widget build(BuildContext context) {
AppTheme.watch(context);
+ if (SettingsSwarmLook.of(context)) return SwarmGroup(children: children);
return Container(
// Full width, so a card is as wide as the list lets it be rather than as wide as its widest
// row happens to need. Belt and braces with the `stretch` below: the alignment makes the rows
@@ -126,6 +148,7 @@ class SettingsRow extends StatelessWidget {
this.detail,
this.value,
this.leading,
+ this.glyph,
this.trailing,
this.onTap,
this.destructive = false,
@@ -141,6 +164,10 @@ class SettingsRow extends StatelessWidget {
final Widget? leading;
+ /// What the row leads with under [SettingsSwarmLook], as You's rows lead with theirs; [leading]
+ /// wins over it. The phone's own look draws none.
+ final IconData? glyph;
+
/// A control that changes the setting without leaving the page — a stepper. Mutually exclusive
/// with [value] in practice; if both are given, this wins and no chevron is drawn.
final Widget? trailing;
@@ -164,6 +191,7 @@ class SettingsRow extends StatelessWidget {
@override
Widget build(BuildContext context) {
AppTheme.watch(context);
+ if (SettingsSwarmLook.of(context)) return _swarmRow(context);
final titleColor = destructive
? AppPalette.dangerFill
: AppPalette.textPrimary;
@@ -295,6 +323,70 @@ class SettingsRow extends StatelessWidget {
child: InkWell(onTap: onTap, child: row),
);
}
+
+ /// The row as Swarm draws one ([SwarmRow]): the glyph, the title in the app's face, the
+ /// value in secondary ink before the chevron, as You's "Change ›" is.
+ Widget _swarmRow(BuildContext context) {
+ assert(
+ !destructive && !nested,
+ "Swarm's rows have no destructive or nested form",
+ );
+ final detail = this.detail;
+ final value = this.value;
+ final glyph = this.glyph;
+ return SwarmRow(
+ leading: leading ?? (glyph == null ? null : SwarmRowGlyph(glyph)),
+ title: title,
+ detail: detail == null
+ ? null
+ : Text(
+ detail,
+ maxLines: detailLines,
+ // As the phone's own look: an ellipsis with no line limit still cuts to one line.
+ overflow: detailLines == null
+ ? TextOverflow.clip
+ : TextOverflow.ellipsis,
+ style: AppType.caption(
+ color: AppPalette.textSecondary,
+ height: 1.35,
+ ),
+ ),
+ trailing:
+ trailing ??
+ (value == null
+ ? null
+ : ConstrainedBox(
+ // Half the row at most, so a long value ellipsises rather than crushing the
+ // title — see the phone's own look above.
+ constraints: BoxConstraints(
+ maxWidth: MediaQuery.sizeOf(context).width / 2,
+ ),
+ child: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Flexible(
+ child: Text(
+ value,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ textAlign: TextAlign.end,
+ style: AppType.label(color: AppPalette.textSecondary),
+ ),
+ ),
+ if (onTap != null) ...[
+ const SizedBox(width: AppSpace.xs),
+ Icon(
+ LucideIcons.chevronRight300,
+ size: 18,
+ color: AppPalette.textFaint,
+ ),
+ ],
+ ],
+ ),
+ )),
+ onTap: onTap,
+ );
+ }
}
/// − value + in a recessed well. A null callback greys its side out, so a control at its limit
diff --git a/mobile/lib/phone/usage_entry.dart b/mobile/lib/phone/usage_entry.dart
index bcf1ad47b..41f7b44da 100644
--- a/mobile/lib/phone/usage_entry.dart
+++ b/mobile/lib/phone/usage_entry.dart
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
+import 'package:lucide_icons_flutter/lucide_icons.dart';
import 'package:harness_mobile/state/app_state.dart';
import 'package:harness_mobile/usage/usage_summary.dart';
@@ -28,6 +29,7 @@ Widget buildUsageSettingsRow(
valueListenable: lastUsageSummary,
builder: (context, summary, _) => SettingsRow(
title: 'Usage',
+ glyph: LucideIcons.gauge300,
// Nothing until something has been read: a dash was a dead word on the row.
value: summary,
onTap: () =>
diff --git a/mobile/lib/swarm/swarm_conversation_page.dart b/mobile/lib/swarm/swarm_conversation_page.dart
index 83470ce7e..1b0cb102e 100644
--- a/mobile/lib/swarm/swarm_conversation_page.dart
+++ b/mobile/lib/swarm/swarm_conversation_page.dart
@@ -1236,14 +1236,14 @@ class _SwarmConversationPageState extends State<SwarmConversationPage>
),
);
- /// The back button, then the chat's name and its project under it — or,
- /// while the chat is not known yet ([title] null), placeholders of their
- /// size — and [action] at its end.
+ /// The back button, then the chat's name and [subtitle] under it — its
+ /// project, or its Swarm — or, while the chat is not known yet ([title]
+ /// null), placeholders of their size — and [action] at its end.
Widget _header(
BuildContext context,
Tty tty, {
required String? title,
- String? project,
+ String? subtitle,
Widget? action,
SwarmBuddyMark? mark,
}) => Padding(
@@ -1272,6 +1272,7 @@ class _SwarmConversationPageState extends State<SwarmConversationPage>
Expanded(
child: _switchOnTitle(
title,
+ subtitle,
title == null
? Column(
key: const ValueKey('swarm-header-placeholder'),
@@ -1300,9 +1301,10 @@ class _SwarmConversationPageState extends State<SwarmConversationPage>
weight: FontWeight.w600,
),
),
- if (project != null)
+ if (subtitle != null)
Text(
- project,
+ subtitle,
+ key: const ValueKey('swarm-subtitle'),
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: swarmChatText(
@@ -1330,13 +1332,14 @@ class _SwarmConversationPageState extends State<SwarmConversationPage>
/// The Buddy tab's title, with several Swarms to switch between: a tap on
/// it opens the switcher, as Home's title does (Tony, 2026-11-03); the
- /// menu's Swarm row stays. [words] alone otherwise.
- Widget _switchOnTitle(String? title, Widget words) {
+ /// menu's Swarm row stays, and a screen reader hears [subtitle] with the
+ /// title. [words] alone otherwise.
+ Widget _switchOnTitle(String? title, String? subtitle, Widget words) {
final swarm = widget.swarmSwitch;
if (!widget.tabRoot || swarm == null || title == null) return words;
return Semantics(
button: true,
- label: '$title. Switch Swarm',
+ label: '${subtitle == null ? title : '$title, $subtitle'}. Switch Swarm',
excludeSemantics: true,
onTap: swarm.open,
child: InkWell(
@@ -1376,7 +1379,7 @@ class _SwarmConversationPageState extends State<SwarmConversationPage>
title: view.known || c.state == SwarmChatState.lost
? view.title
: null,
- project: view.project,
+ subtitle: view.project ?? view.swarm,
mark: widget.tabRoot ? swarmBuddyMark(c.reader) : null,
// The person's own Buddy chat: its Notifications, Rename Buddy,
// Remove Buddy. Any other chat: its Notifications (the desktop's
@@ -2477,6 +2480,7 @@ class _ChatView {
required this.known,
required this.title,
required this.project,
+ required this.swarm,
required this.canPost,
required this.archived,
required this.old,
@@ -2521,6 +2525,15 @@ class _ChatView {
.where((p) => p.id == group?.projectId)
.firstOrNull
?.name;
+ // The person's one Buddy chat for the Swarm is in no project: its
+ // Swarm's name stands under it instead, the Swarm the Buddy tab switches
+ // between (Tony, 11-03).
+ final swarm = buddyProject == swarmBuddyKey
+ ? session.inbox.swarms
+ .where((s) => s.id == reader.tabId)
+ .firstOrNull
+ ?.name
+ : null;
// Only the person's own Buddy chat holds decisions, its project's, as
// Desktop shows them above it; every other chat leaves them to Activity
// (Dee, 11-01: they blocked the project chat). A chat not open to the
@@ -2549,6 +2562,7 @@ class _ChatView {
? 'Old chat'
: buddy ?? group.label,
project: buddy != null && project != null ? '#$project' : project,
+ swarm: swarm,
canPost: c.canPost,
archived: group?.archived ?? false,
old: old,
@@ -2593,6 +2607,10 @@ class _ChatView {
final bool known;
final String title;
final String? project;
+
+ /// The Swarm's name, under the person's one Buddy chat for it; null for any
+ /// other chat.
+ final String? swarm;
final bool canPost, archived;
/// An older Buddy chat, kept to read ([swarmIsOldBuddyChat]).
@@ -2654,6 +2672,7 @@ class _ChatView {
other.known == known &&
other.title == title &&
other.project == project &&
+ other.swarm == swarm &&
other.canPost == canPost &&
other.archived == archived &&
other.old == old &&
@@ -2672,6 +2691,7 @@ class _ChatView {
known,
title,
project,
+ swarm,
canPost,
archived,
old,
diff --git a/mobile/lib/swarm/swarm_leaderboard_reader.dart b/mobile/lib/swarm/swarm_leaderboard_reader.dart
index 5dab278cc..909a0c705 100644
--- a/mobile/lib/swarm/swarm_leaderboard_reader.dart
+++ b/mobile/lib/swarm/swarm_leaderboard_reader.dart
@@ -107,7 +107,32 @@ class SwarmScore {
final String name when name.isNotEmpty => name,
_ => null,
},
- prevWeekPoints = _optional(json['prevWeekPoints']);
+ prevWeekPoints = _optional(json['prevWeekPoints']),
+ brought = switch (_map(json['details'])['brought']) {
+ final List<Object?> machines => [
+ for (final machine in machines.whereType<Map<String, dynamic>>())
+ if (machine['machineName'] case final String name)
+ (
+ machineName: name,
+ shipped: _int(machine['shipped']),
+ busyHours: machine['busyHours'] is num
+ ? (machine['busyHours'] as num).toDouble()
+ : 0.0,
+ subscriptions: [
+ for (final sub
+ in (machine['subscriptions'] as List? ?? const [])
+ .whereType<Map<String, dynamic>>())
+ if (sub['engine'] case final String engine)
+ (
+ engine: engine,
+ usedPercent: _optional(sub['usedPercent']),
+ resetsAt: _optional(sub['resetsAt']),
+ ),
+ ],
+ ),
+ ],
+ _ => null,
+ };
final String personId;
@@ -130,6 +155,67 @@ class SwarmScore {
/// The same scoring for the time before; null from a server before it, and
/// for Last 30d, which has no comparison.
final int? prevWeekPoints;
+
+ /// Every machine the person brought (contributor view, #2444): the verified
+ /// requests that shipped on it, its hours for others, and each
+ /// subscription's weekly use and reset. Null from a server before it, which
+ /// shows Lent instead.
+ final List<
+ ({
+ String machineName,
+ int shipped,
+ double busyHours,
+ List<({String engine, int? usedPercent, int? resetsAt})> subscriptions,
+ })
+ >?
+ brought;
+}
+
+/// How Brought names a subscription's engine, as the Swarm's other lines do.
+const _engineNames = {'claude': 'Claude', 'codex': 'Codex'};
+
+/// "31 h", "12.5 h", "0 h".
+String _broughtHours(double hours) {
+ final rounded = (hours * 10).round() / 10;
+ return rounded == rounded.roundToDouble()
+ ? '${rounded.round()} h'
+ : '${rounded.toStringAsFixed(1)} h';
+}
+
+/// "3d", "5h 10m", "20m", "now": until a subscription's week resets.
+String _resetsIn(int at, DateTime now) {
+ final minutes = DateTime.fromMillisecondsSinceEpoch(at)
+ .difference(now)
+ .inMinutes;
+ return minutes <= 0
+ ? 'now'
+ : minutes < 60
+ ? '${minutes}m'
+ : minutes < 1440
+ ? '${minutes ~/ 60}h ${minutes % 60}m'
+ : '${minutes ~/ 1440}d';
+}
+
+/// A machine's Brought lines: what shipped and its hours for others, then each
+/// subscription's week.
+List<(String, String)> _broughtLines(SwarmScore score, DateTime now) {
+ final brought = score.brought!;
+ if (brought.isEmpty) return [('Brought', 'No machines brought yet')];
+ return [
+ for (final machine in brought)
+ (
+ machine.machineName,
+ [
+ '${machine.shipped} shipped · ${_broughtHours(machine.busyHours)} for others',
+ for (final sub in machine.subscriptions)
+ '${_engineNames[sub.engine] ?? sub.engine} ${switch (sub) {
+ (usedPercent: final used?, resetsAt: final at?, engine: _) => '$used% used, resets in ${_resetsIn(at, now)}',
+ (usedPercent: final used?, resetsAt: null, engine: _) => '$used% used',
+ _ => 'not read yet',
+ }}',
+ ].join('\n'),
+ ),
+ ];
}
/// "6 min" under an hour, then hours with one decimal unless whole: "3 h",
@@ -319,7 +405,7 @@ class SwarmLeaderboardReader extends ChangeNotifier {
/// A person's week as the desktop's `LeaderboardPersonWeek` words it: the
/// points and place, what landed, what they answered, what they lent, and
/// their streak.
-List<(String, String)> swarmPersonWeek(SwarmScore score) {
+List<(String, String)> swarmPersonWeek(SwarmScore score, {DateTime? now}) {
String median(int? ms, String what) =>
ms == null ? '' : ' · median ${swarmDuration(ms)}$what';
return [
@@ -343,13 +429,16 @@ List<(String, String)> swarmPersonWeek(SwarmScore score) {
: '${score.unblocked} answered${median(score.medianAnswerMs, '')}'
' · ${swarmDuration(score.unblockedMs)} of agent time freed',
),
- (
- 'Lent',
- score.lentMachines == 0
- ? 'Nothing lent yet'
- : '${_plural(score.lentMachines, 'machine')}'
- ' · ${swarmHours(score.lentMs)} agent-hours',
- ),
+ if (score.brought != null)
+ ..._broughtLines(score, now ?? DateTime.now())
+ else
+ (
+ 'Lent',
+ score.lentMachines == 0
+ ? 'Nothing lent yet'
+ : '${_plural(score.lentMachines, 'machine')}'
+ ' · ${swarmHours(score.lentMs)} agent-hours',
+ ),
(
'Streak',
score.streakDays == 0
diff --git a/mobile/lib/swarm/swarm_style.dart b/mobile/lib/swarm/swarm_style.dart
index d63df9b7d..d5dc119d8 100644
--- a/mobile/lib/swarm/swarm_style.dart
+++ b/mobile/lib/swarm/swarm_style.dart
@@ -395,6 +395,22 @@ class SwarmGroup extends StatelessWidget {
}
}
+/// A row's glyph ([SwarmRow.leading]): You's rows, Settings' when opened from
+/// Swarm. In a 32-point box so the titles of a card line up.
+class SwarmRowGlyph extends StatelessWidget {
+ const SwarmRowGlyph(this.icon, {super.key});
+
+ static const double width = 32;
+
+ final IconData icon;
+
+ @override
+ Widget build(BuildContext context) => SizedBox(
+ width: width,
+ child: Icon(icon, size: 22, color: AppPalette.textSecondary),
+ );
+}
+
/// A row on its way, in the shape of the row it stands for: a mark at its
/// left, a bar for its title and a longer one for the line under it, each as
/// tall as the line it stands for ([SkeletonText]), so nothing moves when the
diff --git a/mobile/lib/swarm/swarm_you_page.dart b/mobile/lib/swarm/swarm_you_page.dart
index a8088222a..a57217c31 100644
--- a/mobile/lib/swarm/swarm_you_page.dart
+++ b/mobile/lib/swarm/swarm_you_page.dart
@@ -228,7 +228,7 @@ class SwarmYouPage extends StatelessWidget {
children: [
SwarmRow(
key: const ValueKey('swarm-you-username'),
- leading: const _Glyph(LucideIcons.atSign300),
+ leading: const SwarmRowGlyph(LucideIcons.atSign300),
// How the Swarm tags them, as the server keeps it; nothing of a
// Swarm before it is read, or once it is taken away.
title: me?.username ?? 'Username',
@@ -242,7 +242,7 @@ class SwarmYouPage extends StatelessWidget {
children: [
SwarmRow(
key: const ValueKey('swarm-you-models'),
- leading: const _Glyph(LucideIcons.cpu300),
+ leading: const SwarmRowGlyph(LucideIcons.cpu300),
title: 'Your models',
detail: switch (_models(inbox, swarms)) {
null => null,
@@ -253,7 +253,7 @@ class SwarmYouPage extends StatelessWidget {
),
SwarmRow(
key: const ValueKey('swarm-you-devices'),
- leading: const _Glyph(LucideIcons.laptop300),
+ leading: const SwarmRowGlyph(LucideIcons.laptop300),
title: 'Your devices',
detail: switch (_devices(computers)) {
null => null,
@@ -268,7 +268,7 @@ class SwarmYouPage extends StatelessWidget {
children: [
SwarmRow(
key: const ValueKey('swarm-you-settings'),
- leading: const _Glyph(LucideIcons.settings300),
+ leading: const SwarmRowGlyph(LucideIcons.settings300),
title: 'Settings',
onTap: switch (onSettings) {
final settings? => () => settings(context),
@@ -395,7 +395,7 @@ class _Status extends StatelessWidget {
final me = this.me;
Widget row(String title, {required bool known}) => SwarmRow(
leading: SizedBox(
- width: _Glyph.width,
+ width: SwarmRowGlyph.width,
child: Center(
child: Container(
width: 10,
@@ -441,18 +441,3 @@ class _Change extends StatelessWidget {
);
}
}
-
-/// A row's glyph, in a 32-point box so the titles line up.
-class _Glyph extends StatelessWidget {
- const _Glyph(this.icon);
-
- static const double width = 32;
-
- final IconData icon;
-
- @override
- Widget build(BuildContext context) => SizedBox(
- width: width,
- child: Icon(icon, size: 22, color: AppPalette.textSecondary),
- );
-}
diff --git a/mobile/test/phone/phone_shell_swarm_home_test.dart b/mobile/test/phone/phone_shell_swarm_home_test.dart
index 79dedc651..92b76b7a5 100644
--- a/mobile/test/phone/phone_shell_swarm_home_test.dart
+++ b/mobile/test/phone/phone_shell_swarm_home_test.dart
@@ -175,6 +175,11 @@ void main() {
await youTo(tester, 'swarm-you-settings');
expect(find.byType(SettingsPage), findsOneWidget);
+ expect(
+ tester.widget<SettingsPage>(find.byType(SettingsPage)).swarm,
+ isTrue,
+ reason: "drawn as Swarm's pages are",
+ );
await tester.binding.handlePopRoute();
await frames(tester);
@@ -244,6 +249,11 @@ void main() {
// The terminal's Settings (its menu, Find), as the person reaches it.
openPhoneSettings(tester.element(find.byType(AgentHome)), app);
await frames(tester);
+ expect(
+ tester.widget<SettingsPage>(find.byType(SettingsPage)).swarm,
+ isFalse,
+ reason: "the terminal's Settings keeps the phone's own look",
+ );
await tapSwarmSwitch(tester);
await tester.tap(find.text('Turn on Swarm'));
await frames(tester);
diff --git a/mobile/test/phone_edge/settings_layout_test.dart b/mobile/test/phone_edge/settings_layout_test.dart
index 7e2836e8c..54cf3f267 100644
--- a/mobile/test/phone_edge/settings_layout_test.dart
+++ b/mobile/test/phone_edge/settings_layout_test.dart
@@ -20,8 +20,9 @@ void main() {
Brightness brightness, {
bool large = true,
bool sample = false,
+ bool swarm = false,
}) async {
- final page = SettingsPage(notifier: app, large: large);
+ final page = SettingsPage(notifier: app, large: large, swarm: swarm);
await tester.pumpWidget(
phoneApp(
sample ? SampleMode(session: FakeSample(app), child: page) : page,
@@ -52,6 +53,24 @@ void main() {
await pumpSettings(tester, app, scale, brightness);
});
});
+
+ testWidgets('signed in with a $label name, opened from Swarm', (
+ tester,
+ ) async {
+ await expectNoLayoutErrors(tester, (scale, brightness) async {
+ final app = edgeApp(machineName: longMachine);
+ addTearDown(app.dispose);
+ app.currentUser = CurrentUserProfile(id: 'u', name: name, email: email);
+ await pumpSettings(
+ tester,
+ app,
+ scale,
+ brightness,
+ large: false,
+ swarm: true,
+ );
+ });
+ });
}
testWidgets('pushed from a terminal, with no machines', (tester) async {
@@ -69,4 +88,37 @@ void main() {
await pumpSettings(tester, app, scale, brightness, sample: true);
});
});
+
+ // Swarm's look draws Set up Intern 3 only with no computer, and Leave the sample in the first
+ // card beside Usage: both are rows the signed-in cases above never draw there.
+ testWidgets('opened from Swarm, with no machines', (tester) async {
+ await expectNoLayoutErrors(tester, (scale, brightness) async {
+ final app = edgeApp(noMachines: true);
+ addTearDown(app.dispose);
+ await pumpSettings(
+ tester,
+ app,
+ scale,
+ brightness,
+ large: false,
+ swarm: true,
+ );
+ });
+ });
+
+ testWidgets('opened from Swarm, inside the sample', (tester) async {
+ await expectNoLayoutErrors(tester, (scale, brightness) async {
+ final app = edgeApp();
+ addTearDown(app.dispose);
+ await pumpSettings(
+ tester,
+ app,
+ scale,
+ brightness,
+ large: false,
+ sample: true,
+ swarm: true,
+ );
+ });
+ });
}
diff --git a/mobile/test/phone_edge/settings_swarm_look_test.dart b/mobile/test/phone_edge/settings_swarm_look_test.dart
new file mode 100644
index 000000000..110395644
--- /dev/null
+++ b/mobile/test/phone_edge/settings_swarm_look_test.dart
@@ -0,0 +1,405 @@
+import 'package:flutter/material.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness_mobile/core/models.dart';
+import 'package:harness_mobile/demo/sample_mode.dart';
+import 'package:harness_mobile/phone/settings_page.dart';
+import 'package:harness_mobile/phone/settings_row.dart';
+import 'package:harness_mobile/phone/tty.dart';
+import 'package:harness_mobile/settings/experimental_features.dart';
+import 'package:harness_mobile/state/app_state.dart';
+import 'package:harness_mobile/swarm/swarm_row.dart';
+import 'package:harness_mobile/swarm/swarm_style.dart';
+import 'package:lucide_icons_flutter/lucide_icons.dart';
+import 'package:package_info_plus/package_info_plus.dart';
+
+import '../voice_fakes.dart' show MemoryKeyValueStore;
+import 'edge_fixture.dart';
+
+/// Settings opened from Swarm's You wears Swarm's pages (prototype A lean, 2026-11-03,
+/// `docs/design/2026-11-03-swarm-settings.md`): Swarm's top bar, sentence-case captions, cards of
+/// Swarm rows each led by a glyph, in the app's face; the account's rows in three cards;
+/// Notifications and Swarm with no line under them; Language in Terminal's card; Help and About
+/// one row each, opening a sheet of what they held. Opened from anywhere else, it keeps the
+/// phone's own look.
+///
+/// No choice is made in any sheet or stepper: those write through stores whose home is the real
+/// state file (see `settings_behavior_test.dart`).
+void main() {
+ setUpAll(
+ () => PackageInfo.setMockInitialValues(
+ appName: 'Harness',
+ packageName: 'ai.autonomous.harness',
+ version: '1.2.3',
+ buildNumber: '456',
+ buildSignature: '',
+ ),
+ );
+
+ Future<AppNotifier> openSettings(
+ WidgetTester tester, {
+ required bool swarm,
+ bool noMachines = false,
+ bool sample = false,
+ }) async {
+ setPhone(tester, largePhone);
+ final app = edgeApp(noMachines: noMachines)
+ ..currentUser = const CurrentUserProfile(
+ id: 'u',
+ name: 'Ada Lovelace',
+ email: '[email protected]',
+ );
+ final page = SettingsPage(
+ notifier: app,
+ large: false,
+ swarm: swarm,
+ experiments: ExperimentalFeaturesStore(storage: MemoryKeyValueStore()),
+ );
+ await tester.pumpWidget(
+ phoneApp(
+ Builder(
+ builder: (context) => TextButton(
+ onPressed: () => Navigator.of(context).push(
+ MaterialPageRoute<void>(
+ builder: (_) => sample
+ ? SampleMode(session: FakeSample(app), child: page)
+ : page,
+ ),
+ ),
+ child: const Text('open'),
+ ),
+ ),
+ ),
+ );
+ await tester.tap(find.text('open'));
+ await frames(tester);
+ return app;
+ }
+
+ Future<void> close(WidgetTester tester, AppNotifier app) async {
+ await tester.pumpWidget(const SizedBox());
+ await tester.pump(const Duration(seconds: 3));
+ app.dispose();
+ await tester.pump(const Duration(seconds: 30));
+ }
+
+ /// Scrolls the list until [finder] is built and on screen.
+ Future<void> reveal(WidgetTester tester, Finder finder) async {
+ await tester.scrollUntilVisible(
+ finder,
+ 200,
+ scrollable: find.byType(Scrollable).last,
+ );
+ await tester.pump();
+ }
+
+ Finder rowOf(String title) =>
+ find.ancestor(of: find.text(title), matching: find.byType(SwarmRow));
+ Finder cardOf(String title) =>
+ find.ancestor(of: find.text(title), matching: find.byType(SwarmGroup));
+ Finder inCard(String card, String row) =>
+ find.descendant(of: cardOf(card), matching: find.text(row));
+ Finder captioned(String text) =>
+ find.descendant(of: find.byType(SwarmCaption), matching: find.text(text));
+
+ /// Taps where no sheet reaches, which takes the open one down.
+ Future<void> dismissSheet(WidgetTester tester) async {
+ await tester.tapAt(const Offset(20, 80));
+ await frames(tester);
+ }
+
+ /// The face [text] is drawn in, after every default above it is merged in.
+ String? faceOf(WidgetTester tester, String text) => tester
+ .widget<RichText>(
+ find
+ .descendant(of: find.text(text), matching: find.byType(RichText))
+ .first,
+ )
+ .text
+ .style
+ ?.fontFamily;
+
+ String terminalFace(WidgetTester tester) =>
+ Tty.of(tester.element(find.byType(SettingsPage))).fontFamily;
+
+ group('opened from Swarm', () {
+ testWidgets("Swarm's top bar: back and the title on one line, no "
+ 'display-size title under it', (tester) async {
+ final app = await openSettings(tester, swarm: true);
+
+ expect(
+ find.descendant(
+ of: find.byType(SettingsPage),
+ matching: find.byType(SwarmTopBar),
+ ),
+ findsOneWidget,
+ );
+ expect(find.text('Settings'), findsOneWidget, reason: 'one title');
+
+ await tester.tap(find.byKey(const ValueKey('tty-back')));
+ await frames(tester, count: 8);
+ expect(find.byType(SettingsPage), findsNothing);
+ await close(tester, app);
+ });
+
+ testWidgets("Swarm's rows, in the app's face, each led by its glyph", (
+ tester,
+ ) async {
+ final app = await openSettings(tester, swarm: true);
+
+ // Top to bottom, as the list goes: it builds only what it shows.
+ for (final (title, glyph) in [
+ ('Usage', LucideIcons.gauge300),
+ ('Notifications', LucideIcons.bell300),
+ ('Privacy', LucideIcons.shield300),
+ ('Computers', LucideIcons.laptop300),
+ ('Connectors', LucideIcons.plug300),
+ ('Sign in a computer', LucideIcons.qrCode300),
+ ('Your devices', LucideIcons.monitorSmartphone300),
+ ('Phone name', LucideIcons.smartphone300),
+ ('Font', LucideIcons.type300),
+ ('Size', LucideIcons.aLargeSmall300),
+ ('Colors', LucideIcons.palette300),
+ ('Language', LucideIcons.mic300),
+ ('App colors', LucideIcons.contrast300),
+ ('Text size', LucideIcons.aLargeSmall300),
+ ('Swarm', LucideIcons.flaskConical300),
+ ('Help', LucideIcons.circleHelp300),
+ ('About', LucideIcons.info300),
+ ]) {
+ await reveal(tester, find.text(title));
+ expect(rowOf(title), findsOneWidget, reason: title);
+ expect(
+ find.descendant(of: rowOf(title), matching: find.byIcon(glyph)),
+ findsOneWidget,
+ reason: '$title leads with its glyph',
+ );
+ }
+ expect(
+ faceOf(tester, 'About'),
+ isNot(terminalFace(tester)),
+ reason: "the app's face, not the terminal's",
+ );
+ await close(tester, app);
+ });
+
+ testWidgets('three captions, in sentence case, as Swarm writes them: '
+ 'no Voice, Help or About', (tester) async {
+ final app = await openSettings(tester, swarm: true);
+
+ for (final caption in ['Terminal', 'Appearance', 'Experimental']) {
+ await reveal(tester, captioned(caption));
+ expect(find.text(caption.toLowerCase()), findsNothing);
+ }
+ await reveal(tester, find.text('About'));
+ expect(find.text('Voice'), findsNothing);
+ expect(captioned('Help'), findsNothing, reason: 'a row, not a caption');
+ expect(captioned('About'), findsNothing, reason: 'a row, not a caption');
+ expect(find.text('Account'), findsNothing, reason: 'cards, no caption');
+ expect(find.text('account'), findsNothing);
+ await close(tester, app);
+ });
+
+ testWidgets("the account's rows stand in three cards: you and what you "
+ 'use, your computers, this phone', (tester) async {
+ final app = await openSettings(tester, swarm: true);
+
+ for (final row in ['Usage', 'Notifications', 'Privacy']) {
+ expect(inCard('Ada Lovelace', row), findsOneWidget, reason: row);
+ }
+ expect(inCard('Usage', 'Computers'), findsNothing);
+
+ await reveal(tester, find.text('Sign in a computer'));
+ for (final row in ['Connectors', 'Sign in a computer']) {
+ expect(inCard('Computers', row), findsOneWidget, reason: row);
+ }
+ expect(inCard('Computers', 'Your devices'), findsNothing);
+
+ await reveal(tester, find.text('Phone name'));
+ expect(inCard('Your devices', 'Phone name'), findsOneWidget);
+ await close(tester, app);
+ });
+
+ testWidgets('Set up Intern 3 is left to Computers, whose list has it', (
+ tester,
+ ) async {
+ final app = await openSettings(tester, swarm: true);
+
+ await reveal(tester, find.text('Phone name'));
+ expect(find.text('Set up Intern 3'), findsNothing);
+ await close(tester, app);
+ });
+
+ testWidgets('with no computer, Set up Intern 3 stays: Computers is then '
+ 'an empty state with Add computer alone', (tester) async {
+ final app = await openSettings(tester, swarm: true, noMachines: true);
+
+ await reveal(tester, find.text('Set up Intern 3'));
+ expect(inCard('Computers', 'Set up Intern 3'), findsOneWidget);
+ expect(
+ find.descendant(
+ of: rowOf('Set up Intern 3'),
+ matching: find.byIcon(LucideIcons.server300),
+ ),
+ findsOneWidget,
+ );
+ await close(tester, app);
+ });
+
+ testWidgets("Language closes Terminal's card, under its mic", (
+ tester,
+ ) async {
+ final app = await openSettings(tester, swarm: true);
+
+ await reveal(tester, find.text('Language'));
+ expect(inCard('Font', 'Language'), findsOneWidget);
+ expect(inCard('Font', 'Colors'), findsOneWidget);
+ expect(inCard('Font', 'App colors'), findsNothing);
+ await close(tester, app);
+ });
+
+ testWidgets('Swarm says its name and its switch, with no line under it', (
+ tester,
+ ) async {
+ final app = await openSettings(tester, swarm: true);
+
+ await reveal(tester, find.text('Swarm'));
+ expect(rowOf('Swarm'), findsOneWidget);
+ expect(find.text(PhoneExperiment.swarm.description), findsNothing);
+ await close(tester, app);
+ });
+
+ testWidgets("Help is one row; its sheet holds Help's three", (
+ tester,
+ ) async {
+ final app = await openSettings(tester, swarm: true);
+
+ await reveal(tester, find.text('Help'));
+ for (final row in [
+ 'How Harness works',
+ 'Try the sample',
+ 'Show the tips again',
+ ]) {
+ expect(find.text(row), findsNothing, reason: '$row: not on the page');
+ }
+ expect(inCard('Help', 'About'), findsOneWidget, reason: 'one card');
+
+ await tester.tap(find.text('Help'));
+ await frames(tester);
+ for (final row in [
+ 'How Harness works',
+ 'Try the sample',
+ 'Show the tips again',
+ ]) {
+ expect(find.text(row), findsOneWidget, reason: '$row: in the sheet');
+ }
+ await dismissSheet(tester);
+ expect(find.text('How Harness works'), findsNothing);
+ await close(tester, app);
+ });
+
+ testWidgets('inside the sample, Help offers no sample to try', (
+ tester,
+ ) async {
+ final app = await openSettings(tester, swarm: true, sample: true);
+
+ expect(captioned('Sample'), findsOneWidget);
+ expect(inCard('Leave the sample', 'Usage'), findsOneWidget);
+ await reveal(tester, find.text('Help'));
+ await tester.tap(find.text('Help'));
+ await frames(tester);
+ expect(find.text('How Harness works'), findsOneWidget);
+ expect(find.text('Show the tips again'), findsOneWidget);
+ expect(find.text('Try the sample'), findsNothing);
+ await dismissSheet(tester);
+ await close(tester, app);
+ });
+
+ testWidgets('Notifications says on or off, with no line under it', (
+ tester,
+ ) async {
+ final app = await openSettings(tester, swarm: true);
+
+ expect(rowOf('Notifications'), findsOneWidget);
+ expect(find.textContaining('a harness finishes'), findsNothing);
+ await close(tester, app);
+ });
+
+ testWidgets('About is one row with the version and the build; its sheet '
+ 'holds the Privacy Policy', (tester) async {
+ final app = await openSettings(tester, swarm: true);
+
+ await reveal(tester, find.text('1.2.3 (456)'));
+ expect(
+ find.descendant(of: rowOf('About'), matching: find.text('1.2.3 (456)')),
+ findsOneWidget,
+ );
+ expect(find.text('Build'), findsNothing);
+ expect(find.text('Version'), findsNothing);
+ expect(find.text('Privacy Policy'), findsNothing);
+
+ await tester.tap(find.text('About'));
+ await frames(tester);
+ expect(find.text('Version 1.2.3 (456)'), findsOneWidget);
+ expect(find.text('Privacy Policy'), findsOneWidget);
+ await dismissSheet(tester);
+ expect(find.text('Privacy Policy'), findsNothing);
+ await close(tester, app);
+ });
+
+ testWidgets("its controls stay: the account's sheet, Size's stepper, "
+ "Swarm's switch", (tester) async {
+ final app = await openSettings(tester, swarm: true);
+
+ await tester.tap(find.text('Ada Lovelace'));
+ await frames(tester);
+ expect(find.text('Sign out'), findsOneWidget);
+ await dismissSheet(tester);
+
+ await reveal(tester, find.text('Size'));
+ expect(
+ find.descendant(
+ of: rowOf('Size'),
+ matching: find.byType(SettingsStepper),
+ ),
+ findsOneWidget,
+ );
+ await reveal(tester, find.text('Swarm'));
+ expect(
+ find.descendant(of: rowOf('Swarm'), matching: find.byType(Switch)),
+ findsOneWidget,
+ );
+ await close(tester, app);
+ });
+ });
+
+ testWidgets("opened from anywhere else, it keeps the phone's own look", (
+ tester,
+ ) async {
+ final app = await openSettings(tester, swarm: false);
+
+ expect(find.byType(SwarmTopBar), findsNothing);
+ expect(find.byType(SwarmRow), findsNothing);
+ expect(find.text('account'), findsOneWidget);
+ expect(faceOf(tester, 'Usage'), terminalFace(tester));
+ expect(find.textContaining('a harness finishes'), findsOneWidget);
+ expect(find.text('Set up Intern 3'), findsOneWidget);
+ await reveal(tester, find.text('voice'));
+ expect(find.text('Language'), findsOneWidget);
+ await reveal(tester, find.text(PhoneExperiment.swarm.description));
+ for (final row in [
+ 'How Harness works',
+ 'Try the sample',
+ 'Show the tips again',
+ ]) {
+ await reveal(tester, find.text(row));
+ }
+ await reveal(tester, find.text('Build'));
+ await frames(tester);
+ expect(find.text('456'), findsOneWidget);
+ expect(find.text('Version'), findsOneWidget);
+ expect(find.text('Privacy Policy'), findsOneWidget);
+ expect(find.text('about'), findsOneWidget, reason: 'a caption');
+ expect(find.text('Help'), findsNothing, reason: 'no row of that name');
+ await close(tester, app);
+ });
+}
diff --git a/mobile/test/swarm/swarm_buddy_tab_test.dart b/mobile/test/swarm/swarm_buddy_tab_test.dart
index cb3a6d595..8e686a557 100644
--- a/mobile/test/swarm/swarm_buddy_tab_test.dart
+++ b/mobile/test/swarm/swarm_buddy_tab_test.dart
@@ -234,6 +234,37 @@ void main() {
expect(find.text('not started'), findsNothing);
});
+ testWidgets('the Swarm it is in stands under its name, with one Swarm '
+ 'too', (tester) async {
+ await pump(tester, backend());
+ await openTab(tester);
+
+ expect(tester.widget<Text>(key('swarm-subtitle')).data, 'Swarm $tab');
+ expect(
+ tester.getTopLeft(key('swarm-subtitle')).dy,
+ greaterThan(tester.getBottomLeft(key('swarm-title')).dy - 1),
+ reason: 'under the title, not beside it',
+ );
+ });
+
+ testWidgets('a Swarm renamed meanwhile shows its new name', (tester) async {
+ final fake = backend();
+ final host = await pump(tester, fake);
+ await openTab(tester);
+ expect(tester.widget<Text>(key('swarm-subtitle')).data, 'Swarm $tab');
+
+ fake.routes['/api/super-tabs/list'] = (_) => {
+ 'tabs': [
+ {'id': tab, 'name': 'autonomous.ai', 'ownerId': me},
+ ],
+ 'next': null,
+ };
+ await host.session!.inbox.refresh();
+ await settle(tester);
+
+ expect(tester.widget<Text>(key('swarm-subtitle')).data, 'autonomous.ai');
+ });
+
testWidgets('a post goes to the one chat, saying the app knows one Buddy, '
'as the desktop does', (tester) async {
final fake = backend();
@@ -479,6 +510,16 @@ void main() {
);
});
+ testWidgets('an old chat names its project under its title, not the '
+ 'Swarm', (tester) async {
+ await pump(tester, withOld());
+ await openTab(tester);
+ await openOld(tester);
+
+ expect(tester.widget<Text>(key('swarm-subtitle')).data, 'Mobile');
+ expect(find.text('Swarm $tab'), findsNothing);
+ });
+
testWidgets('Open Buddy leads back to the one chat', (tester) async {
await pump(tester, withOld());
await openTab(tester);
@@ -645,6 +686,32 @@ void main() {
semantics.dispose();
});
+ testWidgets('the Swarm under the title is the one shown, follows a '
+ 'switch, and is said with the title', (tester) async {
+ final semantics = tester.ensureSemantics();
+ await pump(tester, two(mineMoved: 10, otherMoved: 20));
+ await openTab(tester);
+ expect(find.text('In the second Swarm'), findsOneWidget);
+ expect(tester.widget<Text>(key('swarm-subtitle')).data, 'Swarm $other');
+ expect(
+ find.bySemanticsLabel(RegExp(', Swarm $other\\. Switch Swarm\$')),
+ findsOneWidget,
+ );
+
+ await tester.tap(key('swarm-buddy-title-switch'));
+ await settle(tester);
+ await tester.tap(find.text('Swarm $tab'));
+ await settle(tester);
+
+ expect(find.text('In the first Swarm'), findsOneWidget);
+ expect(tester.widget<Text>(key('swarm-subtitle')).data, 'Swarm $tab');
+ expect(
+ find.bySemanticsLabel(RegExp('^Wren, Swarm $tab\\. Switch Swarm\$')),
+ findsOneWidget,
+ );
+ semantics.dispose();
+ });
+
testWidgets('a chat moving elsewhere does not take the tab there', (
tester,
) async {
diff --git a/mobile/test/swarm/swarm_leaderboard_test.dart b/mobile/test/swarm/swarm_leaderboard_test.dart
index 67b55e41a..debd95747 100644
--- a/mobile/test/swarm/swarm_leaderboard_test.dart
+++ b/mobile/test/swarm/swarm_leaderboard_test.dart
@@ -391,4 +391,66 @@ void main() {
});
});
});
+
+ group('Brought: the machines a person brought (contributor view, #2444)', () {
+ final now = DateTime.utc(2026, 11, 3, 12);
+ SwarmScore score(Object? brought) => SwarmScore.fromJson({
+ 'personId': 'ken',
+ 'points': 13,
+ 'rank': 1,
+ 'shipped': {'count': 1},
+ 'unblocked': {'count': 0, 'agentMs': 0},
+ 'lent': {'machines': 1, 'agentMs': 31 * 3600000},
+ 'streakDays': 0,
+ 'details': {'brought': ?brought},
+ });
+
+ test('puts a line per machine in place of Lent: what shipped, hours for others and each subscription\'s week', () {
+ final resets = now
+ .add(const Duration(days: 3, hours: 2))
+ .millisecondsSinceEpoch;
+ final lines = swarmPersonWeek(
+ score([
+ {
+ 'machineId': 'studio',
+ 'machineName': 'Mac Studio',
+ 'shipped': 5,
+ 'busyHours': 31,
+ 'subscriptions': [
+ {'engine': 'claude', 'usedPercent': 38, 'resetsAt': resets},
+ {'engine': 'codex', 'usedPercent': null, 'resetsAt': null},
+ ],
+ },
+ {
+ 'machineId': 'mbp',
+ 'machineName': 'MacBook Pro',
+ 'shipped': 0,
+ 'busyHours': 0,
+ 'subscriptions': <Object>[],
+ },
+ ]),
+ now: now,
+ );
+ expect(
+ lines,
+ contains((
+ 'Mac Studio',
+ '5 shipped · 31 h for others\nClaude 38% used, resets in 3d\nCodex not read yet',
+ )),
+ );
+ expect(lines, contains(('MacBook Pro', '0 shipped · 0 h for others')));
+ expect(lines.map((l) => l.$1), isNot(contains('Lent')));
+ });
+
+ test('says so when the person brought nothing', () {
+ final lines = swarmPersonWeek(score(<Object>[]), now: now);
+ expect(lines, contains(('Brought', 'No machines brought yet')));
+ expect(lines.map((l) => l.$1), isNot(contains('Lent')));
+ });
+
+ test('keeps Lent from a server before Brought', () {
+ final lines = swarmPersonWeek(score(null), now: now);
+ expect(lines.map((l) => l.$1), contains('Lent'));
+ });
+ });
}
diff --git a/scripts/ci-plan.py b/scripts/ci-plan.py
index e3efd8090..689d5e1b9 100644
--- a/scripts/ci-plan.py
+++ b/scripts/ci-plan.py
@@ -491,6 +491,7 @@ def read_gate(client, run):
reused = check_reused_records(receipt.get("reused", {}), suites, receipt["source_sha"], receipt["event"])
# Every job this planner requires must have run and passed (checked above for each listed job). A receipt may list more:
# the merge helper runs from main, so a PR that adds a CI job brings jobs main does not know yet (#2804, batch #2815).
+ # Only adding works: a PR that removes or renames a job main requires still fails here until main has the change.
required = receipt["required_jobs"]
if (required != sorted(set(required))
or not {"process-checks"} | set().union(*(JOBS[name] for name in set(suites) - set(reused))) <= set(required)):
diff --git a/scripts/tests/test_ci_plan.py b/scripts/tests/test_ci_plan.py
index 712569834..5df07f5a2 100644
--- a/scripts/tests/test_ci_plan.py
+++ b/scripts/tests/test_ci_plan.py
@@ -25,6 +25,21 @@ class SelectionTests(unittest.TestCase):
self.assertNotIn("backend-integration", others)
self.assertNotIn("backend", planner.NOT_READ)
+ def test_pr_integration_shards_restore_a_mongod_cache_that_main_saves(self):
+ # A cache a PR saves is visible to that PR only; one saved on main is visible to every PR (review of #2804).
+ workflows = Path(__file__).resolve().parents[2] / ".github/workflows"
+ ci = (workflows / "ci.yml").read_text()
+ job = re.search(r"(?m)^ backend-integration:\n((?:(?: .*)?\n)+)", ci).group(1)
+ self.assertIn("actions/cache/restore@", job)
+ self.assertNotRegex(job, r"actions/cache(/save)?@")
+ key = re.search(r"(?m)^\s+key: (super-tab-mongod-.+)$", job).group(1)
+ saver = (workflows / "backend-cache.yml").read_text()
+ self.assertRegex(saver, r"(?ms)^on:.*^ push:\n branches: \[main\]")
+ self.assertIn("actions/cache/save@", saver)
+ self.assertIn(f"key: {key}", saver)
+ self.assertIn("path: /tmp/harness-super-tab-mongodb-binaries", job)
+ self.assertIn("path: /tmp/harness-super-tab-mongodb-binaries", saver)
+
def test_docs_workflows_scripts_and_unknown_paths_need_only_process_checks(self):
for path in ["docs/guide.md", "README.md", "docs/images/poster.png", "scripts/ci-plan.py",
".github/workflows/ci.yml", "Makefile", "store/tools/runtimes.sh", "surprise.py"]:
@@ -970,6 +985,14 @@ class GitHubEvidenceTests(unittest.TestCase):
receipt["results"]["backend-new-shards"] = "failure"
with self.assertRaisesRegex(ValueError, "inconsistent"):
self.evidence.passed_gate(self.head)
+ # A duplicate or unsorted list is refused: the subset check alone would let one through (review of #2817).
+ for index, edit in enumerate([lambda jobs: sorted(jobs + [jobs[0]]), lambda jobs: list(reversed(jobs))]):
+ with self.subTest(index=index):
+ self.github.add_run(14 + index, self.head, self.tree, ["mobile", "backend"])
+ receipt = self.github.receipts[14 + index]
+ receipt["required_jobs"] = edit(receipt["required_jobs"])
+ with self.assertRaisesRegex(ValueError, "does not run every suite"):
+ self.evidence.passed_gate(self.head)
def test_a_failed_latest_check_is_not_rescued_by_an_older_pass(self):
self.github.add_run(12, self.head, self.tree, ["mobile"], conclusion="failure")