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-07 kA0937: #3473 #3477 #3481 #3492 (#3501)

0xken158f8c89350d4f
diff --git a/backend/src/superTabs/boardRights.test.ts b/backend/src/superTabs/boardRights.test.ts
index ac2f3fac1..14b36ce96 100644
--- a/backend/src/superTabs/boardRights.test.ts
+++ b/backend/src/superTabs/boardRights.test.ts
@@ -244,6 +244,17 @@ describe('pause and resume', () => {
expect(lines(f, id).join('\n')).toMatch(/paused[\s\S]*Wait for the release[\s\S]*resumed/i)
})
+ // Review of #3310 at c91dc2489 (task #3595): a pause reason was stored and posted as written. A person's text is redacted.
+ it('redacts a credential in a pause reason, in the task and its line', () => {
+ const f = boardFixture()
+ const id = task(f)
+ const token = ['ghp', 'Q7mZ2xK9pL4vR8nT1wB6yC3dF5hJ0aE2sG7u'].join('_')
+ f.run({ type: 'work.pause', conversationId: id, paused: true, reason: `Rotate ${token} first` })
+ expect(group(f, id).paused!.reason).toContain('[credential removed]')
+ expect(JSON.stringify(f.state)).not.toContain(token)
+ expect(lines(f, id).join('\n')).not.toContain(token)
+ })
+
it('refuses a member, the PM and any other agent, in every project', () => {
const f = boardFixture()
const id = task(f)
diff --git a/backend/src/superTabs/commands.test.ts b/backend/src/superTabs/commands.test.ts
index ecc03e9ea..493a18398 100644
--- a/backend/src/superTabs/commands.test.ts
+++ b/backend/src/superTabs/commands.test.ts
@@ -1,7 +1,7 @@
import { describe, expect, it } from 'vitest'
import { groupProject } from './projects.js'
import { storeOldLeads } from './leads.test-support.js'
-import { applyCommand, assertUniqueMessageIds, commandSchema, LOOP_NOTICE_AT, swarmGridName, withoutCredentials, type Command, type CommandContext } from './commands.js'
+import { applyCommand, assertUniqueMessageIds, commandSchema, LOOP_NOTICE_AT, swarmGridName, withoutCredentials, WORDS, type Command, type CommandContext } from './commands.js'
import { CREDENTIAL_MARKER, type CredentialKind } from './credentials.js'
import { readsRawReason } from './startFailure.js'
import { sweepLiveness } from './liveness.js'
@@ -4464,6 +4464,136 @@ describe('credentials in Swarm chat', () => {
})
})
+// Task #4340: WORDS listed only the older commands, so these were stored, and copied, as typed.
+describe('credentials in every command', () => {
+ const github = ['ghp', 'Fixture0Token1Not2Real3Value4abcdefgh'].join('_')
+ /** A command holding [value] at [path] (`[]` an item of a list), with only what withoutCredentials reads. */
+ const holding = (type: string, path: string, value: string): Command => {
+ const command: Record<string, unknown> = { type }
+ let holder = command
+ const keys = path.split('.')
+ keys.forEach((key, i) => {
+ const many = key.endsWith('[]'), name = many ? key.slice(0, -2) : key, last = i === keys.length - 1
+ const next = last ? value : {}
+ holder[name] = many ? [next] : next
+ holder = next as Record<string, unknown>
+ })
+ return command as unknown as Command
+ }
+ const at = (command: unknown, path: string): unknown => path.split('.').reduce<unknown>((value, key) => {
+ const many = key.endsWith('[]'), item = (value as Record<string, unknown>)[many ? key.slice(0, -2) : key]
+ return many ? (item as unknown[])[0] : item
+ }, command)
+
+ it.each([
+ ['proposal.decide', 'reason'], ['proposal.decide', 'task.changes'], ['proposal.decide', 'checks[].description'],
+ ['proposal.ask', 'question'], ['proposal.ask', 'defaultAnswer'], ['proposal.answer', 'text'], ['proposal.merge', 'reason'],
+ ['proposal.create', 'text'], ['proposal.create', 'evidence[]'], ['buddy.propose', 'why'], ['buddy.propose', 'evidence[]'],
+ ['decision.ask', 'questions[].question'], ['decision.ask', 'questions[].options[]'], ['decision.ask', 'questions[].unblocks'],
+ ['decision.answer', 'note'], ['work.status', 'ask.options[]'], ['work.status', 'ask.unblocks'], ['work.pause', 'reason'],
+ ['person.tell', 'text'], ['agent.new', 'name'], ['agent.new', 'projectName'], ['buddy.create', 'name'], ['buddy.create', 'setup.name'],
+ ['member.name', 'name'], ['member.username', 'username'], ['agent.add', 'roleName'], ['agent.start', 'request.roleName'],
+ ['project.role.set', 'role.name'], ['project.roles.create', 'roles[].name'], ['crew.add', 'lane'], ['work.lane', 'lane'],
+ ['swarm.delete', 'name'], ['tab.routingPolicy', 'policy.notes'],
+ ['rules.set', 'rules.machines[].why'], ['rules.set', 'rules.crew[].names[]'], ['conversation.create', 'step'],
+ ['conversation.create', 'task.requires.access[]'], ['route.record', 'decision.context.missing[]'], ['agent.screenResult', 'error'],
+ ])('removes a credential from %s %s', (type, path) => {
+ const removed: CredentialKind[] = []
+ expect(at(withoutCredentials(holding(type, path, `see ${github}`), removed), path)).toBe(`see ${CREDENTIAL_MARKER}`)
+ expect(removed).toEqual(['github'])
+ })
+
+ /** Strings that are not words people read, or that must reach their reader exactly, each with why. Anything else a
+ * command takes as a string is in WORDS: a new command's text fails the walk below until it is listed in one of the two. */
+ const NOT_WORDS: readonly (readonly [why: string, fields: readonly string[]])[] = [
+ // agent.input: the host types the exact text and terminal.ts redacts its chat row. A screen goes, exact, only to the agent that asked.
+ ['A terminal\'s exact text', ['agent.input text', 'agent.screenResult text', 'agent.inputResult text']],
+ ['A role\'s skill text, read only by its project\'s owner, Lead and hosts', ['project.role.set role.text', 'project.roles.create roles[].text',
+ 'project.roles.reset roles[].text']],
+ // A token here fails the launch rather than reaching anyone.
+ ['A lab\'s engine, model, effort or grid, passed to its CLI or matched to a list', [
+ 'agent.add configuration.engine', 'agent.add configuration.model', 'agent.add configuration.effort', 'agent.add configuration.engineVersion',
+ 'agent.add launchRefused.model', 'agent.add launchRefused.effort',
+ ...['agent.configuration', 'agent.rebind', 'agent.started', 'agent.startSettled'].flatMap(type =>
+ ['engine', 'model', 'effort', 'engineVersion'].map(field => `${type} configuration.${field}`)),
+ 'agent.new engine', 'agent.new model', 'buddy.create engine', 'buddy.create model', 'buddy.create setup.engines[]', 'buddy.engine engine',
+ 'buddy.model gridModel', 'lead.start engine', 'lead.start model', 'lead.start effort', 'lead.switch engine', 'lead.switch model',
+ 'lead.switch effort', 'machine.contribute engines[]', 'machine.engineResume engine', 'localModels.status grid',
+ 'agent.start request.engine', 'agent.start request.model', 'agent.start request.effort', 'agent.start request.permissionMode',
+ 'agent.start request.gridModel', 'agent.start request.gridName', 'agent.start request.requirements.tools[]',
+ 'route.modelResult model', 'route.modelResult effort', 'route.record decision.assessment.model', 'route.record decision.assessment.kind',
+ 'route.record decision.candidates[].model', 'route.record decision.candidates[].effort', 'route.record decision.candidates[].gridModel',
+ 'route.record decision.candidates[].gridName', 'rule.set rule.model', 'rule.set rule.taskKind',
+ 'tab.routingPolicy policy.models[].model', 'tab.routingPolicy policy.models[].effort', 'tab.routingPolicy policy.localModels.models[].model',
+ 'tab.routingPolicy policy.priorOverrides[].model',
+ ...['project.role.set role', 'project.roles.create roles[]', 'project.roles.reset roles[]'].flatMap(role =>
+ [`${role}.defaults.model`, `${role}.defaults.effort`])]],
+ // A repository URL that holds a credential is refused by its schema.
+ ['A folder a host opens, or a URL or ref held to its shape', ['agent.add project.cwd', 'agent.add project.repositoryUrl',
+ 'agent.new repositoryUrl', 'agent.start request.cwd', 'agent.start request.codexHome', 'agent.start request.branchRef',
+ 'agent.start request.requirements.devices[]', 'buddy.create setup.cwd', 'lead.start branchRef', 'lead.start repositoryUrl',
+ 'machine.contribute cwd', 'project.repository repositoryUrl', 'tab.project project.cwd', 'tab.project project.repositoryUrl',
+ 'conversation.create task.requires.devices[]', 'work.define task.requires.devices[]', 'proposal.decide task.requires.devices[]',
+ 'conversation.merged pullRequestUrl', 'conversation.merged fixes', 'conversation.unlink pullRequestUrl', 'work.check head', 'work.check base']],
+ ['An id, an account key, a time or a time zone', ['agent.add roleId', 'agent.rebind profileId', 'agent.start request.roleId',
+ 'machine.access entryId', 'process.confirm noteId', 'project.closeTab tabOperation', 'project.role.remove roleId', 'project.role.set role.id',
+ 'project.roles.create roles[].id', 'project.roles.reset roles[].id', 'proposal.create projectId', 'route.override candidateId',
+ 'route.record decision.candidates[].id', 'route.record decision.pick', 'route.record decision.candidates[].fit.account', 'work.assign roleId',
+ 'work.queue hold.personId', 'work.status hold.personId', 'rules.set rules.instructionApprovals.topDeciderId',
+ 'rules.set rules.instructionApprovals.people[].accountIds[]', 'member.timeZone timeZone', 'project.digest timeZone', 'project.digest time',
+ 'work.queue notBefore', 'rules.set rules.releaseWindow.start', 'rules.set rules.releaseWindow.end', 'rules.set rules.releaseWindow.timeZone',
+ 'rules.set rules.releasePace.backendPause.start', 'rules.set rules.releasePace.backendPause.end', 'rules.set rules.machines[].away.windows[][]',
+ 'rules.set rules.machines[].away.timeZone']],
+ ['The address an invitation goes to, which its person signs in with', ['invite.create email']],
+ // Redacting first would hide the token from that refusal and store the marker instead.
+ ['Refused outright when it looks like a secret (machineAccess.ts ACCESS_SECRET)', ['machine.access name', 'machine.access note', 'machine.access check']],
+ ['Written by the server; the command\'s value is dropped (route.record)', ['route.record decision.stepUp.reason', 'route.record decision.sameEngine']],
+ ]
+
+ /** Every string a command takes, as `type path`, but ids and ISO times (shapes no credential fits). */
+ const strings = (): string[] => {
+ const found: string[] = []
+ const ID = /^[A-Za-z0-9_-]+$/.source
+ const walk = (schema: { _zod: { def: Record<string, any> } }, type: string, path: string): void => {
+ const def = schema._zod.def
+ switch (def.type) {
+ case 'object': for (const [key, field] of Object.entries(def.shape)) if (key !== 'type' || path) walk(field as never, type, path ? `${path}.${key}` : key); return
+ case 'array': return walk(def.element, type, `${path}[]`)
+ case 'tuple': return def.items.forEach((item: never) => walk(item, type, `${path}[]`))
+ case 'record': return walk(def.valueType, type, `${path}{}`)
+ case 'optional': case 'nullable': case 'default': case 'readonly': return walk(def.innerType, type, path)
+ case 'pipe': return walk(def.in._zod.def.type === 'transform' ? def.out : def.in, type, path)
+ case 'union': return def.options.forEach((option: never) => walk(option, type, path))
+ case 'lazy': return walk(def.getter(), type, path)
+ case 'string': {
+ const checks: { format?: string; pattern?: RegExp }[] = (def.checks ?? []).map((check: { _zod: { def: object } }) => check._zod.def)
+ const patterns = checks.map(check => check.pattern?.source).filter(Boolean)
+ const time = [def.format, ...checks.map(check => check.format)].some(format => format === 'datetime' || format === 'date')
+ if (time || (patterns.length === 1 && patterns[0] === ID)) return
+ return void found.push(`${type} ${path}`)
+ }
+ case 'enum': case 'literal': case 'number': case 'int': case 'boolean': case 'null': case 'undefined': return
+ default: throw new Error(`The walk does not read a ${def.type} (${type} ${path}): teach it.`)
+ }
+ }
+ for (const option of (commandSchema as unknown as { _zod: { def: { options: { _zod: { def: Record<string, any> } }[] } } })._zod.def.options) {
+ walk(option, option._zod.def.shape.type._zod.def.values[0], '')
+ }
+ return [...new Set(found)]
+ }
+
+ it('walks every command: each string is in WORDS or named, with why, as not words', () => {
+ const exempt = NOT_WORDS.flatMap(([, fields]) => fields)
+ const covered = new Set([...Object.entries(WORDS).flatMap(([type, paths]) => paths!.map(path => `${type} ${path}`)), ...exempt])
+ const all = strings()
+ expect(all.length).toBeGreaterThan(200)
+ expect(all.filter(field => !covered.has(field))).toEqual([])
+ // Nothing listed is stale or listed twice.
+ expect([...covered].filter(field => !all.includes(field))).toEqual([])
+ expect(exempt.filter(field => Object.entries(WORDS).some(([type, paths]) => paths!.some(path => `${type} ${path}` === field)))).toEqual([])
+ })
+})
+
describe('lost work (liveness.ts)', () => {
/** A Lead, and a group with two workers, the first assigned; the clock is at 1000 in every command. */
const lostFixture = () => {
diff --git a/backend/src/superTabs/commands.ts b/backend/src/superTabs/commands.ts
index ca1d0b53b..b1f135c46 100644
--- a/backend/src/superTabs/commands.ts
+++ b/backend/src/superTabs/commands.ts
@@ -1,4 +1,4 @@
-import { authorizeTaskApproval, pendingTaskApproval, personalApprovalCommand, requireTaskApproval, stageTaskApproval } from './taskApproval.js'
+import { authorizeTaskApproval, pendingTaskApproval, personalApprovalCommand, reopenTaskApproval, requireTaskApproval, stageTaskApproval, undecidedProposal } from './taskApproval.js'
import type { PullRequestFilesRead } from './pullRequestFiles.js'
import { legacyProposalId, migrateLegacyProposals, type LegacyProposalAsk, pmAcceptsMessage, applyProposalAction, authorizeProposalAction, authorizePersonProposal, cardPriority, createPersonProposal, createProposalCard, proposalCreateSchema, proposalFields, proposalRoot } from './proposalCards.js'
import { pulseProjectOf, recordPulse, owe, settleDeleted, settleReaction, settleReply, settleRequest } from './pulse.js'
@@ -515,31 +515,52 @@ export type Command = z.infer<typeof commandSchema>
export const operationSchema = z.object({ operationId: id, command: commandSchema }).strict()
/** The words in each command that people and agents read in the Swarm: messages, briefs and tasks, results, evidence,
- * reasons, errors and names. `[]` is each item of a list. Not `agent.input`: its host types the exact text, and only its
- * chat row is redacted (terminal.ts). Not a role's skill text, which only its project's owner, Lead and hosts read. */
-const WORDS: Partial<Record<Command['type'], readonly string[]>> = {
+ * reasons, errors and names. `[]` is each item of a list. Every other string a command takes is listed, with why, as not
+ * words in commands.test.ts, whose walk of commandSchema fails on a string in neither (task #4340). */
+export const WORDS: Partial<Record<Command['type'], readonly string[]>> = {
'message.send': ['text'],
// An edit is a new text in a row everyone reads: cleaned as a send is (security review 2 of #2967).
'message.edit': ['text'],
- 'buddy.propose': ['text', 'title', 'goal', 'scope'],
+ 'buddy.propose': ['text', 'title', 'goal', 'scope', 'why', 'doneWhen', 'evidence[]'],
+ 'proposal.create': ['title', 'text', 'goal', 'why', 'doneWhen', 'evidence[]'],
'member.status': ['status.text'],
- 'agent.add': ['name', 'initialMessage'],
+ 'member.name': ['name'],
+ // A username with a credential in it then fails its shape and is refused (usernames.ts).
+ 'member.username': ['username'],
+ 'agent.add': ['name', 'initialMessage', 'roleName'],
+ 'agent.new': ['name', 'projectName'],
+ 'buddy.create': ['name', 'setup.name'],
'agent.rename': ['name'],
- 'crew.add': ['role'],
- 'agent.start': ['request.name', 'overrideReason'],
+ 'crew.add': ['role', 'lane'],
+ 'work.lane': ['lane'],
+ 'agent.start': ['request.name', 'request.roleName', 'overrideReason'],
'agent.startFailed': ['error'],
'agent.switchResult': ['error'],
+ 'agent.screenResult': ['error'],
+ 'agent.inputResult': ['error'],
'buddy.modelResult': ['error'],
'agent.switchHandoff': ['note'],
'agent.startSettled': ['warning'],
- 'conversation.create': ['title', 'brief', 'noRequesterReason', 'task.goal', 'task.changes', 'task.constraints', 'task.owns[]', 'task.review.focus', 'checks[].description'],
+ 'conversation.create': ['title', 'brief', 'noRequesterReason', 'step', 'task.goal', 'task.changes', 'task.constraints', 'task.owns[]',
+ 'task.requires.access[]', 'task.review.focus', 'checks[].description'],
'conversation.rename': ['title'],
'buddy.rename': ['name'],
'proposal.close': ['reason'],
+ // A proposal's ruling reaches its people's Buddy chats, its questions and answers its card (review of #3310 at c91dc2489).
+ 'proposal.decide': ['reason', 'task.goal', 'task.changes', 'task.constraints', 'task.owns[]', 'task.requires.access[]', 'task.review.focus',
+ 'checks[].description'],
+ 'proposal.ask': ['question', 'defaultAnswer'],
+ 'proposal.answer': ['text'],
+ 'proposal.merge': ['reason'],
+ 'work.pause': ['reason'],
+ 'decision.ask': ['questions[].question', 'questions[].options[]', 'questions[].unblocks'],
+ 'decision.answer': ['note'],
+ 'person.tell': ['text'],
'task.reject': ['reason'],
- 'work.define': ['brief', 'task.goal', 'task.changes', 'task.constraints', 'task.owns[]', 'task.review.focus', 'checks[].description'],
+ 'work.define': ['brief', 'task.goal', 'task.changes', 'task.constraints', 'task.owns[]', 'task.requires.access[]', 'task.review.focus',
+ 'checks[].description'],
'work.assign': ['overrideReason'],
- 'work.status': ['result'],
+ 'work.status': ['result', 'ask.options[]', 'ask.unblocks'],
'work.cancel': ['reason'],
'conversation.unlink': ['reason'],
'work.check': ['evidence'],
@@ -550,12 +571,21 @@ const WORDS: Partial<Record<Command['type'], readonly string[]>> = {
'note.add': ['text'],
'project.coordinatorName': ['name'],
'rule.set': ['text'],
- 'rules.set': ['summary'],
+ 'rules.set': ['summary', 'rules.instructionApprovals.people[].name', 'rules.reviews.rows[].area', 'rules.reviews.rows[].paths[]',
+ 'rules.reviews.test[].where', 'rules.reviews.test[].paths[]', 'rules.reviews.untested[]', 'rules.caps[].name', 'rules.paths[].name',
+ 'rules.paths[].path', 'rules.crew[].role', 'rules.crew[].names[]', 'rules.lanes[].name', 'rules.lanes[].owns[]', 'rules.machines[].why',
+ 'rules.machines[].first.lanes[]'],
+ 'project.role.set': ['role.name'],
+ 'project.roles.create': ['roles[].name'],
+ 'project.roles.reset': ['roles[].name'],
+ 'tab.routingPolicy': ['policy.notes'],
'route.record': ['decision.assessment.why', 'decision.why', 'decision.excluded[].title', 'decision.excluded[].reason',
- 'decision.candidates[].title', 'decision.candidates[].label'],
+ 'decision.candidates[].title', 'decision.candidates[].label', 'decision.context.missing[]'],
'route.override': ['reason'],
'tab.rename': ['name'],
'machine.contribute': ['name'],
+ // Compared with the Swarm's name, which its rename cleaned the same way.
+ 'swarm.delete': ['name'],
'localModels.status': ['error'],
}
@@ -1843,7 +1873,7 @@ function applyCommandOnce(original: SuperTabState, actor: Actor, input: Command,
* caller trying candidates in turn (openReviewSteps) catches the refusal and tries the next. */
const assignRefusal = (group: Conversation, worker: Agent, suggestion = false) => {
if (!suggestion) requireTaskApproval(group, worker.id)
- if (!suggestion && group.proposal && !['accept', 'reshape'].includes(group.proposal.decision?.kind ?? '')) fail('PROPOSAL_UNDECIDED', 'The PM must accept or reshape this proposal before assigning work.', 409)
+ if (!suggestion && undecidedProposal(group)) fail('PROPOSAL_UNDECIDED', 'The PM must accept or reshape this proposal before assigning work.', 409)
if (state.starts?.some(s => s.poolGeneration && !s.poolSettled && s.request.machineId === worker.machineId && s.harnessId === worker.harnessId)) {
fail('START_PENDING', 'Wait for the host to finish this agent’s launch and model selection.')
}
@@ -2872,8 +2902,10 @@ function applyCommandOnce(original: SuperTabState, actor: Actor, input: Command,
const mirror = state.conversations.find(c => c.id === legacyProposalId(project.id, proposal.messageId))
if (mirror?.proposal?.mergedInto) fail('PROPOSAL_DECIDED', 'This proposal already became a task.', 409)
if (mirror?.taskApproval) {
- if (requesterId !== mirror.taskApproval.personId) fail('TASK_APPROVAL_FORBIDDEN', 'Keep the proposal’s requesting person.', 403)
- created.taskApproval = { ...mirror.taskApproval }
+ const { personId, generation } = mirror.taskApproval
+ if (requesterId !== personId) fail('TASK_APPROVAL_FORBIDDEN', 'Keep the proposal’s requesting person.', 403)
+ // The person approves this task as the PM shaped it: never the card's decision or chosen agent (#4249).
+ created.taskApproval = { personId, generation, state: 'proposal', createdAt: context.now }
}
if (mirror?.proposal) { mirror.proposal.mergedInto = created.id; mirror.archived = true }
}
@@ -4552,6 +4584,7 @@ function applyCommandOnce(original: SuperTabState, actor: Actor, input: Command,
group.briefAt = context.now
stampLane(group, (context.projectRules?.rules ?? SEED_RULES).lanes)
group.checks = storedChecks(command.checks, operationId)
+ reopenTaskApproval(group)
message(group.id, group.brief, [], null, SYSTEM_ROW)
bindTaskCard(group, effects.messages.at(-1)!)
break
@@ -4581,6 +4614,8 @@ function applyCommandOnce(original: SuperTabState, actor: Actor, input: Command,
approval.state = 'proposal'
delete approval.decidedAt
} else {
+ if (command.type === 'task.approve' && undecidedProposal(group))
+ fail('PROPOSAL_UNDECIDED', 'Approve the task once the PM has accepted or reshaped this proposal.', 409)
approval.state = command.type === 'task.approve' ? 'approved' : 'rejected'
approval.decidedAt = context.now
if (command.type === 'task.reject') approval.reason = command.reason
diff --git a/backend/src/superTabs/proposalCards.test.ts b/backend/src/superTabs/proposalCards.test.ts
index 893c853d5..33248ff24 100644
--- a/backend/src/superTabs/proposalCards.test.ts
+++ b/backend/src/superTabs/proposalCards.test.ts
@@ -5,6 +5,7 @@ import { type Actor, type Conversation, type SuperTabState } from './model.js'
import { queueSiblings } from './taskQueue.js'
import { groupView } from './read/views.js'
import { GROUP_FIELDS } from './parts/light.js'
+import { CREDENTIAL_MARKER } from './credentials.js'
const words = 'Keep edits offline until the connection returns.'
const proposal = { title: 'Offline edits', text: words, goal: 'Keep drafts', why: 'People lose offline work',
@@ -287,6 +288,31 @@ describe('PM decisions and card questions', () => {
})
})
+// Task #4340: a ruling's reason was stored and copied to the proposer's Buddy chat as typed.
+describe('credentials in proposal words', () => {
+ // Assembled at run time from obviously fake parts, never a credential-shaped literal.
+ const token = ['ghp', 'Fixture0Token1Not2Real3Value4abcdefgh'].join('_')
+
+ it('removes a token from a proposal, its questions, answers, merges and ruling, in the card and in every copy', () => {
+ const f = fixture(), buddy: Actor = { kind: 'agent', agentId: f.buddy, machineOwnerId: `${owner.userId}-machine` }
+ const id = f.create(peer, { title: `Rotate ${token}`, text: `Calls fail with ${token}`, goal: `Drop ${token}`, why: `Leaked ${token}`,
+ doneWhen: `No ${token} left`, evidence: [`Log shows ${token}`] }).result.conversationId
+ f.card(id).proposal!.senders[0]!.buddyId = f.buddy
+ const sent = [f.run(ask(id, { question: `Is ${token} yours?`, defaultAnswer: `Rotate ${token}` }), f.pm)]
+ sent.push(f.run({ type: 'proposal.answer', conversationId: id, questionId: sent[0]!.result.questionId, text: `Yes, ${token}` }, buddy))
+ sent.push(f.run({ type: 'proposal.merge', conversationId: f.create(owner).result.conversationId, intoConversationId: id, reason: `Same as ${token}` }, f.pm))
+ const ruled = f.run(decide(id, 'accept', { reason: `Rotate ${token} first`, task: { ...acceptedTask, changes: `Remove ${token}` },
+ checks: [{ description: `No ${token} in logs`, independent: false }] }), f.pm)
+ // Both proposers hear the ruling in their Buddy chats, in its cleaned words.
+ const notices = ruled.messages.filter(m => m.source?.kind === 'proposal-notice')
+ expect(notices.map(m => m.text)).toEqual([0, 1].map(() => `Rotate ${CREDENTIAL_MARKER}: accept. Rotate ${CREDENTIAL_MARKER} first`))
+ expect(f.card(id).proposal!.decision!.reason).toBe(`Rotate ${CREDENTIAL_MARKER} first`)
+ expect(f.card(id).proposal!.questions[0]!.answer!.text).toBe(`Yes, ${CREDENTIAL_MARKER}`)
+ expect(JSON.stringify([...sent, ruled].map(e => e.messages))).not.toContain(token)
+ expect(JSON.stringify(f.state)).not.toContain(token)
+ })
+})
+
describe('proposal time and delivery boundaries', () => {
it('applies a default exactly at the deadline once, preserving a later answer as discussion', async () => {
const { advanceProposalCards } = await import('./proposalCards.js')
@@ -366,3 +392,20 @@ describe('proposal time and delivery boundaries', () => {
expect(pmAcceptsMessage(f.state, f.lead, undefined)).toBe(true)
})
})
+
+// Review of #3310 at c91dc2489 (task #3595): a person's answer on a card was stored as written. Refusing an agent's text there
+// is #3310's (its AGENT_TEXT list); this is the redaction every command's words get (task #4340).
+describe('a credential in proposal text', () => {
+ // Assembled at run time, as agentSecrets.test.ts does, so the repository holds nothing a scanner takes for a secret.
+ const token = ['ghp', 'Q7mZ2xK9pL4vR8nT1wB6yC3dF5hJ0aE2sG7u'].join('_')
+ const leaked = `Here it is: ${token} (for the deploy)`
+
+ it('is redacted in a person\'s answer', () => {
+ const f = fixture(), id = f.create().result.conversationId
+ const qid = f.run(ask(id), f.pm).result.questionId
+ const answered = f.run({ type: 'proposal.answer', conversationId: id, questionId: qid, text: leaked }, peer)
+ expect(f.card(id).proposal!.questions[0]!.answer!.text).toContain('[credential removed]')
+ expect(JSON.stringify(f.state)).not.toContain(token)
+ expect(JSON.stringify(answered.messages)).not.toContain(token)
+ })
+})
diff --git a/backend/src/superTabs/proposalCards.ts b/backend/src/superTabs/proposalCards.ts
index 89332f62c..f53b6b78c 100644
--- a/backend/src/superTabs/proposalCards.ts
+++ b/backend/src/superTabs/proposalCards.ts
@@ -1,4 +1,4 @@
-import { stageTaskApproval } from './taskApproval.js'
+import { reopenTaskApproval, stageTaskApproval } from './taskApproval.js'
import { steers } from './boardRights.js'
import { expireProposalQuestion } from './proposalClock.js'
export { advanceProposalCards, proposalDueAt } from './proposalClock.js'
@@ -212,6 +212,8 @@ export function applyProposalAction(state: SuperTabState, actor: Actor, command:
card.checks = command.checks.map((check, i) => ({ id: stableId(operationId, 'check', String(i)), description: check.description, independent: check.independent ?? false, evidence: null, passedBy: null, verdicts: [] }))
stampLane(card)
recordAsked(card, card.requesterId, now)
+ // The person approves the task the PM shaped: an approval stored before this decision never carries over.
+ reopenTaskApproval(card)
}
card.proposal.decision = { kind: command.decision, reason: command.reason, at: now, by: sender.id,
...(command.decision === 'later' ? { revisitAt: command.revisitAt } : {}) }
diff --git a/backend/src/superTabs/read/personalTasks.test.ts b/backend/src/superTabs/read/personalTasks.test.ts
index edc66de30..dbb6bee33 100644
--- a/backend/src/superTabs/read/personalTasks.test.ts
+++ b/backend/src/superTabs/read/personalTasks.test.ts
@@ -21,11 +21,15 @@ function scene() {
}
describe('personal Tasks summaries', () => {
+ // An undecided or Later proposal is not yet a task the person can approve (#4249).
it.each([
[undefined, false, false],
- [undefined, true, false],
+ [undefined, 'undecided', false],
['proposal', false, true],
- ['proposal', true, true],
+ ['proposal', 'undecided', false],
+ ['proposal', 'later', false],
+ ['proposal', 'accept', true],
+ ['proposal', 'reshape', true],
['approved', false, false],
['rejected', false, false],
] as const)('exposes approval capability for decision %s with Buddy proposal %s as %s', (decision, proposal, canApprove) => {
@@ -34,7 +38,8 @@ describe('personal Tasks summaries', () => {
if (decision) data.taskApproval = { ...data.taskApproval!, state: decision }
else delete data.taskApproval
if (proposal) data.proposal = { version: 1, text: 'Keep drafts', goal: 'Drafts', why: 'Loss', doneWhen: 'Returns', evidence: ['Repro'], priority: 'P2',
- createdAt: NOW, questions: [], senders: [{ personId: peer.userId, generation: s.f.state.people.find(p => p.id === peer.userId)!.generation }] }
+ createdAt: NOW, questions: [], senders: [{ personId: peer.userId, generation: s.f.state.people.find(p => p.id === peer.userId)!.generation }],
+ ...proposal === 'undecided' ? {} : { decision: { kind: proposal, reason: 'PM', at: NOW, by: 'lead' } } }
for (const reset of [true, false])
expect(personalTasksFor([row], s.view(), peer, reset)!.upserts).toEqual([expect.objectContaining({ id: row.key, canApprove })])
})
diff --git a/backend/src/superTabs/read/personalTasks.ts b/backend/src/superTabs/read/personalTasks.ts
index ac46d1a7f..91d3d6524 100644
--- a/backend/src/superTabs/read/personalTasks.ts
+++ b/backend/src/superTabs/read/personalTasks.ts
@@ -1,7 +1,7 @@
import type { Actor, Conversation } from '../model.js'
import type { Part } from '../parts/types.js'
import { canReadGroup, groupProject } from '../projects.js'
-import type { ApprovalMode } from '../taskApproval.js'
+import { undecidedProposal, type ApprovalMode } from '../taskApproval.js'
import type { AgentView } from './contract.js'
import type { ReaderView } from './views.js'
@@ -52,7 +52,7 @@ export function personalTasksFor(changed: readonly Part[], view: ReaderView, act
const status = approval?.state === 'proposal' || approval?.state === 'rejected' ? approval.state
: group.assignment?.status ?? (group.proposal && !['accept', 'reshape'].includes(group.proposal.decision?.kind ?? '') ? 'proposal' : 'planned')
out.upserts.push({ id: group.id, version: part.version, at: part.changedAt, projectId: project.id, projectName: project.name,
- title: group.title, status, suggested: !group.assignment && !!approval?.suggestedAgentId, canApprove: approval?.state === 'proposal',
+ title: group.title, status, suggested: !group.assignment && !!approval?.suggestedAgentId, canApprove: approval?.state === 'proposal' && !undecidedProposal(group),
agent: worker ? { id: worker.id, name: worker.displayName ?? worker.name, ...worker.avatar ? { avatar: worker.avatar } : {} } : null,
...approval?.reason ? { reason: approval.reason } : {} })
}
diff --git a/backend/src/superTabs/taskApproval.test.ts b/backend/src/superTabs/taskApproval.test.ts
index 7e044c72e..a6f2ad7d9 100644
--- a/backend/src/superTabs/taskApproval.test.ts
+++ b/backend/src/superTabs/taskApproval.test.ts
@@ -176,22 +176,78 @@ describe('personal approval enforced before work', () => {
expect(f.state.conversations.filter(c => !c.archived && c.requesterId === peer.userId && (c.task || c.proposal))).toHaveLength(1)
expect(() => f.runCommand(input, f.pm, { proposal })).toThrow()
})
- it('keeps a chosen agent binding when the person approves before PM preparation', () => {
+ it('refuses approving an undecided or Later proposal; the person approves the task the PM shaped (#4249)', () => {
const f = fixture(); f.mode('review'); f.propose()
const card = f.state.conversations.find(c => c.proposal)!
f.runCommand({ type: 'task.suggest', conversationId: card.id, agentId: f.candidate })
- f.runCommand({ type: 'task.approve', conversationId: card.id })
+ expect(() => f.runCommand({ type: 'task.approve', conversationId: card.id })).toThrow(expect.objectContaining({ code: 'PROPOSAL_UNDECIDED' }))
+ expect(f.card(card.id).taskApproval?.state).toBe('proposal')
f.runCommand({ type: 'proposal.decide', conversationId: card.id, decision: 'accept', reason: 'Build', task,
checks: [{ description: 'Restores drafts' }] }, f.pm)
+ expect(() => f.runCommand({ type: 'work.assign', conversationId: card.id, agentId: f.candidate }, f.pm))
+ .toThrow(expect.objectContaining({ code: 'TASK_APPROVAL_REQUIRED' }))
+ f.runCommand({ type: 'task.approve', conversationId: card.id })
expect(() => f.runCommand({ type: 'work.assign', conversationId: card.id, agentId: f.other }, f.pm)).toThrow()
f.runCommand({ type: 'work.assign', conversationId: card.id, agentId: f.candidate }, f.pm)
expect(f.card(card.id).assignment?.agentId).toBe(f.candidate)
})
+ it('refuses approving a proposal the PM marked Later (#4249)', () => {
+ const f = fixture(); f.mode('review'); f.propose()
+ const card = f.state.conversations.find(c => c.proposal)!
+ f.runCommand({ type: 'proposal.decide', conversationId: card.id, decision: 'later', reason: 'Next week', revisitAt: NOW + 86_400_000 }, f.pm)
+ expect(() => f.runCommand({ type: 'task.approve', conversationId: card.id })).toThrow(expect.objectContaining({ code: 'PROPOSAL_UNDECIDED' }))
+ })
+ it.each(['accept', 'reshape'])('a stored approval from before the decision does not carry over to the task the PM shapes on %s (#4249)', decision => {
+ const f = fixture(); f.mode('review'); f.propose()
+ const card = f.state.conversations.find(c => c.proposal)!
+ // Approved while undecided, as a server before this fix allowed.
+ f.edit(s => Object.assign(s.conversations.find(c => c.id === card.id)!.taskApproval!,
+ { state: 'approved', decidedAt: NOW, suggestedAgentId: f.candidate }))
+ f.runCommand({ type: 'proposal.decide', conversationId: card.id, decision, reason: 'Bigger', task: { ...task, changes: 'Persist drafts and sync them' },
+ checks: [{ description: 'Restores drafts' }] }, f.pm)
+ expect(f.card(card.id).taskApproval).toMatchObject({ state: 'proposal', suggestedAgentId: f.candidate })
+ expect(f.card(card.id).taskApproval?.decidedAt).toBeUndefined()
+ expect(() => f.runCommand({ type: 'work.assign', conversationId: card.id, agentId: f.candidate }, f.pm))
+ .toThrow(expect.objectContaining({ code: 'TASK_APPROVAL_REQUIRED' }))
+ f.runCommand({ type: 'task.approve', conversationId: card.id })
+ f.runCommand({ type: 'work.assign', conversationId: card.id, agentId: f.candidate }, f.pm)
+ expect(f.card(card.id).assignment?.agentId).toBe(f.candidate)
+ })
+ it('a new scope for an approved, unstarted task goes back to its person (#4249, security review 1)', () => {
+ const f = fixture(); f.mode('review'); const id = f.create()
+ f.runCommand({ type: 'task.suggest', conversationId: id, agentId: f.candidate }, f.pm)
+ f.runCommand({ type: 'task.approve', conversationId: id })
+ f.runCommand({ type: 'work.define', conversationId: id, task: { ...task, changes: 'Persist drafts and rewrite sync' },
+ checks: [{ description: 'Restores and syncs drafts' }] }, f.pm)
+ expect(f.card(id).taskApproval).toMatchObject({ state: 'proposal', suggestedAgentId: f.candidate })
+ expect(f.card(id).taskApproval?.decidedAt).toBeUndefined()
+ expect(() => f.runCommand({ type: 'work.assign', conversationId: id, agentId: f.candidate }, f.pm))
+ .toThrow(expect.objectContaining({ code: 'TASK_APPROVAL_REQUIRED' }))
+ f.runCommand({ type: 'task.approve', conversationId: id })
+ f.runCommand({ type: 'work.assign', conversationId: id, agentId: f.candidate }, f.pm)
+ expect(f.card(id).assignment?.agentId).toBe(f.candidate)
+ })
+ it('a converted older proposal gets a fresh approval, never the card’s decision (#4249)', () => {
+ const f = fixture(false); f.mode('review'); const sent = f.propose()
+ const row = sent.messages.find(m => m.source?.kind === 'buddy-proposal')!
+ const mirror = f.state.conversations.find(c => c.taskApproval && c.proposal)!
+ f.edit(s => Object.assign(s.conversations.find(c => c.id === mirror.id)!.taskApproval!,
+ { state: 'approved', decidedAt: NOW, suggestedAgentId: f.candidate }))
+ const id = f.runCommand({ type: 'conversation.create', title: 'Prepared', task: { ...task, changes: 'A different scope' }, priority: 'P2',
+ proposalMessageId: row.id, checks: [{ description: 'Restores drafts' }] }, f.pm,
+ { proposal: { id: row.id, conversationId: row.conversationId, author: row.author, source: row.source ?? null } }).result.conversationId
+ expect(f.card(id).taskApproval).toMatchObject({ state: 'proposal', personId: peer.userId })
+ expect(f.card(id).taskApproval?.suggestedAgentId).toBeUndefined()
+ expect(f.card(id).taskApproval?.decidedAt).toBeUndefined()
+ expect(() => f.runCommand({ type: 'work.assign', conversationId: id, agentId: f.candidate }, f.pm))
+ .toThrow(expect.objectContaining({ code: 'TASK_APPROVAL_REQUIRED' }))
+ })
it('cannot merge an approved Review proposal and lose its chosen agent or requester', () => {
const f = fixture(); f.mode('review'); f.propose()
const card = f.state.conversations.find(c => c.proposal)!
f.runCommand({ type: 'task.suggest', conversationId: card.id, agentId: f.candidate })
- f.runCommand({ type: 'task.approve', conversationId: card.id })
+ // Approved while undecided, as a server before #4249 allowed.
+ f.edit(s => Object.assign(s.conversations.find(c => c.id === card.id)!.taskApproval!, { state: 'approved', decidedAt: NOW }))
const target = f.runCommand({ type: 'proposal.create', projectId: 'lead', title: 'Other', text: 'Other', goal: 'Other', why: 'Other',
doneWhen: 'Other', evidence: ['Reproduction'], priority: 'P2' }, owner).result.conversationId
expect(() => f.runCommand({ type: 'proposal.merge', conversationId: card.id, intoConversationId: target, reason: 'Same' }, f.pm)).toThrow()
diff --git a/backend/src/superTabs/taskApproval.ts b/backend/src/superTabs/taskApproval.ts
index 4d2e9cc34..cdbb520b4 100644
--- a/backend/src/superTabs/taskApproval.ts
+++ b/backend/src/superTabs/taskApproval.ts
@@ -22,6 +22,15 @@ export function stageTaskApproval(state: SuperTabState, group: Conversation, now
personId: member.id, generation: member.generation, state: 'proposal', createdAt: now,
}
}
+/** A proposal the PM has not accepted or reshaped is not yet a task its person can approve (#4249): Later is undecided too. */
+export const undecidedProposal = (group: Conversation): boolean =>
+ !!group.proposal && !['accept', 'reshape'].includes(group.proposal.decision?.kind ?? '')
+/** A task whose scope changed goes back to its person: an approval is of the work as it was shown (#4249). */
+export function reopenTaskApproval(group: Conversation): void {
+ if (group.taskApproval?.state !== 'approved') return
+ group.taskApproval.state = 'proposal'
+ delete group.taskApproval.decidedAt
+}
export function requireTaskApproval(group: Conversation, agentId?: string | null): void {
if (group.taskApproval && group.taskApproval.state !== 'approved')
fail('TASK_APPROVAL_REQUIRED', 'The person who requested this task must approve it before work starts.', 409)
diff --git a/desktop/lib/super_tabs/backlog.dart b/desktop/lib/super_tabs/backlog.dart
index 9dabdabea..11fb3b01c 100644
--- a/desktop/lib/super_tabs/backlog.dart
+++ b/desktop/lib/super_tabs/backlog.dart
@@ -126,6 +126,7 @@ List<SuperTabConversation> superTabProjectTasks(
]))
if (g.id != project.leadConversationId &&
!g.isBuddyChat &&
+ !g.isAgentChat &&
!c.hiddenByBuddies(g))
g,
];
diff --git a/desktop/lib/super_tabs/buddy_rows.dart b/desktop/lib/super_tabs/buddy_rows.dart
index 85af99ba5..c49bd34e6 100644
--- a/desktop/lib/super_tabs/buddy_rows.dart
+++ b/desktop/lib/super_tabs/buddy_rows.dart
@@ -1,3 +1,5 @@
+import 'dart:math' as math;
+
import 'package:flutter/material.dart';
import '../shared/theme/app_icons.dart';
@@ -5,6 +7,7 @@ import '../shared/theme/app_theme.dart' as grid;
import '../widgets/desktop_chrome.dart';
import 'buddy_chat.dart';
import 'identity.dart';
+import 'model.dart';
import 'section_heading.dart';
/// A sidebar count of what is for the reader, such as the tags waiting in
@@ -50,6 +53,7 @@ class SuperTabBuddyRow extends StatelessWidget {
required this.name,
required this.tooltip,
required this.onTap,
+ this.agent,
this.project,
this.selected = false,
this.unread = false,
@@ -65,6 +69,10 @@ class SuperTabBuddyRow extends StatelessWidget {
final String? agentId;
final String name;
+ /// An agent in My agents: the row wears its face, picture or pattern, as
+ /// its chat, cards and Tasks pane draw it (audit finding 6 of task #4211).
+ final SuperTabAgent? agent;
+
/// The project's name, shown when the Swarm has several.
final String? project;
final bool selected, unread;
@@ -120,13 +128,21 @@ class SuperTabBuddyRow extends StatelessWidget {
SizedBox(
width: _column,
child: Center(
- child: SuperTabAvatar(
- identity: agentId == null
- ? 'buddy:$name'
- : 'agent:$agentId',
- name: name,
- size: 20,
- ),
+ child: switch (agent) {
+ final agent? => SuperTabAvatar.agent(
+ agent,
+ name: name,
+ size: 20,
+ engineBadge: false,
+ ),
+ null => SuperTabAvatar(
+ identity: agentId == null
+ ? 'buddy:$name'
+ : 'agent:$agentId',
+ name: name,
+ size: 20,
+ ),
+ },
),
),
Expanded(
@@ -140,62 +156,77 @@ class SuperTabBuddyRow extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
- Row(
- children: [
- Flexible(
- child: Text(
- name,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- // Unread is the name in bold, no dot (Dee, 2026-10-29).
- style:
- DesktopChrome.control(
- medium: selected,
- color: color,
- ).copyWith(
- fontWeight: unread
- ? grid.AppFont.semibold
- : null,
- ),
- ),
- ),
- if (crownKey case final crownKey?) ...[
- const SizedBox(width: 4),
- Icon(
- AppIcons.crown,
- key: crownKey,
- size: AppIcons.metadataSize,
- color: color,
- ),
- ],
- if (project case final project?) ...[
- const SizedBox(width: 8),
- Flexible(
- child: Text(
- '($project)',
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: DesktopChrome.metadata(
- color: grid.SidebarInk.muted(context),
+ // The name keeps its whole width first; the
+ // project and note after it take what is left
+ // (at the left pane's 180 a Buddy read "Bu… no…").
+ LayoutBuilder(
+ builder: (context, box) => Row(
+ children: [
+ ConstrainedBox(
+ constraints: BoxConstraints(
+ maxWidth: math.max(
+ 0,
+ box.maxWidth -
+ (crownKey == null
+ ? 0
+ : 4 + AppIcons.metadataSize) -
+ 8 * [project, note].nonNulls.length,
),
),
- ),
- ],
- // A quiet note yields first at large text sizes.
- if (note case final note?) ...[
- const SizedBox(width: 8),
- Flexible(
child: Text(
- note,
+ name,
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: DesktopChrome.metadata(
- color: grid.SidebarInk.muted(context),
- ),
+ // Unread is the name in bold, no dot (Dee, 2026-10-29).
+ style:
+ DesktopChrome.control(
+ medium: selected,
+ color: color,
+ ).copyWith(
+ fontWeight: unread
+ ? grid.AppFont.semibold
+ : null,
+ ),
),
),
+ if (crownKey case final crownKey?) ...[
+ const SizedBox(width: 4),
+ Icon(
+ AppIcons.crown,
+ key: crownKey,
+ size: AppIcons.metadataSize,
+ color: color,
+ ),
+ ],
+ if (project case final project?) ...[
+ const SizedBox(width: 8),
+ Flexible(
+ child: Text(
+ '($project)',
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: DesktopChrome.metadata(
+ color: grid.SidebarInk.muted(context),
+ ),
+ ),
+ ),
+ ],
+ // A quiet note yields first at large text sizes.
+ if (note case final note?) ...[
+ const SizedBox(width: 8),
+ Flexible(
+ child: Text(
+ note,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: DesktopChrome.metadata(
+ color: grid.SidebarInk.muted(context),
+ ),
+ ),
+ ),
+ ],
],
- ],
+ ),
),
if (detail case final detail?)
Row(
diff --git a/desktop/lib/super_tabs/composer_tags.dart b/desktop/lib/super_tabs/composer_tags.dart
index c8ba3fbfa..b4357c762 100644
--- a/desktop/lib/super_tabs/composer_tags.dart
+++ b/desktop/lib/super_tabs/composer_tags.dart
@@ -70,6 +70,10 @@ List<SuperTabComposerChoice> superTabTagChoices(
if (snapshot == null) return const [];
final project = snapshot.projectFor(group.id);
bool reads(SuperTabPerson person) => switch (group) {
+ // A person's chat with an agent of theirs: they and the agent alone read
+ // it (backend projects.ts readsAgentChat), with or without an audience
+ // sent, so nobody else is offered (audit finding 12 of task #4211).
+ _ when group.isAgentChat => false,
SuperTabConversation(:final audience?) => audience.contains(person.id),
_ when group.buddyOwnerId != null => person.id == group.buddyOwnerId,
_ =>
diff --git a/desktop/lib/super_tabs/decisions_page.dart b/desktop/lib/super_tabs/decisions_page.dart
index 4891221a2..681e0cd37 100644
--- a/desktop/lib/super_tabs/decisions_page.dart
+++ b/desktop/lib/super_tabs/decisions_page.dart
@@ -2,6 +2,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
+import '../shared/theme/app_icons.dart';
import '../shared/theme/app_theme.dart' as grid;
import '../shared/widgets/app_dialog.dart';
import '../shared/widgets/skeleton.dart';
@@ -9,12 +10,14 @@ import '../widgets/desktop_chrome.dart';
import '../widgets/laid_out_list.dart';
import 'activity.dart';
import 'activity_rows.dart';
+import 'backlog.dart';
import 'decisions.dart';
import 'decisions_view.dart' show quietDecisionAction;
import 'model.dart';
import 'page_rows.dart';
import 'prompt_lines.dart';
import 'reminders.dart';
+import 'task_groups.dart';
/// Decisions, the sidebar's first page (anh Dee, 11-05, task #2996): what
/// waits on the reader's answer, as Needs you listed it. Due reminders lead,
@@ -158,7 +161,8 @@ class _DecisionsPageState extends State<SuperTabDecisionsPage> {
}
}
- List<Widget> _rows() {
+ /// The page's rows; null once read with nothing waiting on the reader.
+ List<Widget>? _rows() {
final a = _activity;
// Until the decisions are read the list is not known: neither "nothing"
// nor a count. A failed read says so above, with Retry.
@@ -219,28 +223,7 @@ class _DecisionsPageState extends State<SuperTabDecisionsPage> {
),
]);
}();
- if (due.isEmpty && waiting.isEmpty && decided.isEmpty) {
- final handled = a.handledToday;
- final name = a.coordinatorFor(handled);
- return [
- superTabPageEmpty(
- 'Nothing needs you',
- handled.isEmpty
- ? null
- : '$name handled ${handled.length} for you today',
- handled.isEmpty
- ? null
- : quietDecisionAction(
- key: const ValueKey('super-activity-handled'),
- label: 'See what',
- onPressed: () =>
- setState(() => _handledShown = !_handledShown),
- ),
- ),
- if (_handledShown && handled.isNotEmpty)
- for (final d in handled) _handledRow(d),
- ];
- }
+ if (due.isEmpty && waiting.isEmpty && decided.isEmpty) return null;
return [
?bar,
// A reminder the reader set is theirs to answer: it leads, above the
@@ -257,6 +240,84 @@ class _DecisionsPageState extends State<SuperTabDecisionsPage> {
];
}
+ /// Nothing waits on the reader (audit finding 14, task #4211): a calm
+ /// all-clear in the middle of the page, with how much of the work is moving
+ /// and what the PM handled today one click away.
+ Widget _allClear() {
+ final a = _activity;
+ final handled = a.handledToday;
+ final moving = _moving();
+ return LayoutBuilder(
+ builder: (context, box) => SingleChildScrollView(
+ child: ConstrainedBox(
+ constraints: BoxConstraints(minHeight: box.maxHeight),
+ child: Center(
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Icon(
+ AppIcons.circleCheck,
+ size: 24,
+ color: DesktopChrome.muted,
+ ),
+ superTabPageEmpty(
+ 'All clear',
+ 'Your crew has what it needs',
+ moving == 0
+ ? null
+ : Padding(
+ padding: const EdgeInsets.only(
+ top: grid.AppDesktop.listRowGap * 2,
+ ),
+ child: Text(
+ '$moving ${moving == 1 ? 'task' : 'tasks'} moving',
+ style: DesktopChrome.metadata(),
+ ),
+ ),
+ ),
+ if (handled.isNotEmpty) ...[
+ Text(
+ '${a.coordinatorFor(handled)} handled ${handled.length} '
+ 'for you today',
+ textAlign: TextAlign.center,
+ style: DesktopChrome.control(color: DesktopChrome.muted),
+ ),
+ quietDecisionAction(
+ key: const ValueKey('super-activity-handled'),
+ label: 'See what',
+ onPressed: () =>
+ setState(() => _handledShown = !_handledShown),
+ ),
+ if (_handledShown)
+ for (final d in handled) _handledRow(d),
+ ],
+ ],
+ ),
+ ),
+ ),
+ ),
+ );
+ }
+
+ /// How many tasks the reader can see are moving: those in a Board's Working
+ /// column, so open, handed to an agent and not yet done.
+ int _moving() {
+ final c = _activity.controller;
+ final now = widget.now();
+ var moving = 0;
+ for (final project in c.snapshot?.projects ?? const <SuperTabProject>[]) {
+ for (final task in superTabProjectTasks(c, project)) {
+ final place = superTabTaskPlaceOf(
+ task,
+ readerId: c.accountId,
+ now: now,
+ );
+ if (place?.column == SuperTabTaskColumn.working) moving++;
+ }
+ }
+ return moving;
+ }
+
Widget _handledRow(SuperTabDecision d) {
final choice = d.choice;
return Padding(
@@ -473,17 +534,28 @@ class _DecisionsPageState extends State<SuperTabDecisionsPage> {
grid.AppTheme.watch(context);
final a = _activity;
final error = a.decisions.error ?? a.reminders.error;
+ final retry = error == null
+ ? null
+ : superTabPageError(error, () {
+ unawaited(a.decisions.load());
+ unawaited(a.reminders.load());
+ });
+ final rows = _rows();
+ if (rows == null) {
+ // The page's key either way, which its places look for.
+ return Column(
+ key: const ValueKey('super-decisions-list'),
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ ?retry,
+ Expanded(child: _allClear()),
+ ],
+ );
+ }
return LaidOutListView(
key: const ValueKey('super-decisions-list'),
padding: const EdgeInsets.only(bottom: grid.AppDesktop.groupGap),
- children: [
- if (error != null)
- superTabPageError(error, () {
- unawaited(a.decisions.load());
- unawaited(a.reminders.load());
- }),
- ..._rows(),
- ],
+ children: [?retry, ...rows],
);
},
);
diff --git a/desktop/lib/super_tabs/leaderboard/weekly_page.dart b/desktop/lib/super_tabs/leaderboard/weekly_page.dart
index 1f4face9c..d2fe83bb2 100644
--- a/desktop/lib/super_tabs/leaderboard/weekly_page.dart
+++ b/desktop/lib/super_tabs/leaderboard/weekly_page.dart
@@ -23,6 +23,9 @@ class SuperTabWeeklyLeaderboardPage extends StatefulWidget {
class _WeeklyBoardState extends State<SuperTabWeeklyLeaderboardPage> {
static const _rowHeight = 56.0;
+
+ /// The places that carry a mark, as their mark says them.
+ static const _places = {1: 'one', 2: 'two', 3: 'three'};
SuperTabLeaderboard? _board;
String? _error;
Object? _stamp;
@@ -251,55 +254,87 @@ class _WeeklyBoardState extends State<SuperTabWeeklyLeaderboardPage> {
final person = c.snapshot?.people
.where((p) => p.id == score.personId)
.firstOrNull;
- return _line([
- SizedBox(
- width: 40,
- child: score.rank == 1 && score.points > 0
- ? Icon(
- AppIcons.trophy,
- size: 18,
- color: grid.AppPalette.swarmAccent,
- )
- : Text(
+ // By account, never by name: two teammates can share one.
+ final own = score.personId == c.accountId;
+ return _line(
+ key: ValueKey('weekly-row-${score.personId}'),
+ own: own,
+ [
+ SizedBox(
+ width: 40,
+ child: Row(
+ children: [
+ Text(
'${score.rank}',
style: DesktopChrome.metadata(
color: DesktopChrome.muted,
),
),
- ),
- Expanded(
- child: Row(
- children: [
- if (person != null)
- SuperTabAvatar.person(person, size: 28),
- const SizedBox(width: 10),
- Expanded(
- child: Text(
- score.displayName ??
- person?.shownName ??
- 'Teammate',
- key: ValueKey(
- 'weekly-person-${score.personId}',
+ // The top three's mark sits beside their place,
+ // never in place of it (Team and celebration,
+ // design system); the numeral says which.
+ if (_places[score.rank] case final place?
+ when score.points > 0) ...[
+ const SizedBox(width: 4),
+ Icon(
+ AppIcons.trophy,
+ size: 14,
+ color: score.rank == 1
+ ? grid.AppPalette.swarmAccent
+ : DesktopChrome.muted,
+ semanticLabel:
+ 'Number $place ${score.spanName}',
),
- overflow: TextOverflow.ellipsis,
- style: DesktopChrome.text(
- medium: score.rank == 1 && score.points > 0,
+ ],
+ ],
+ ),
+ ),
+ Expanded(
+ child: Row(
+ children: [
+ if (person != null)
+ SuperTabAvatar.person(person, size: 28),
+ const SizedBox(width: 10),
+ Flexible(
+ child: Text(
+ score.displayName ??
+ person?.shownName ??
+ 'Teammate',
+ key: ValueKey(
+ 'weekly-person-${score.personId}',
+ ),
+ overflow: TextOverflow.ellipsis,
+ style: DesktopChrome.text(
+ medium: score.rank == 1 && score.points > 0,
+ ),
),
),
- ),
- ],
+ if (own) ...[
+ const SizedBox(width: 8),
+ Text(
+ 'You',
+ style: DesktopChrome.metadata(
+ color: DesktopChrome.muted,
+ ),
+ ),
+ ],
+ ],
+ ),
),
- ),
- _cell('${score.shipped}', strong: true),
- _cell('${score.accepted}'),
- _cell('${score.unblocked}'),
- _cell('${score.streakDays}d'),
- _cell(
- '${score.agentsBrought}',
- key: ValueKey('weekly-agents-${score.personId}'),
- ),
- _cell('${score.points}', strong: true),
- ]);
+ _cell('${score.shipped}', strong: true),
+ _cell('${score.accepted}'),
+ _cell('${score.unblocked}'),
+ // No streak is no number, not "0d".
+ _cell(
+ score.streakDays == 0 ? '–' : '${score.streakDays}d',
+ ),
+ _cell(
+ '${score.agentsBrought}',
+ key: ValueKey('weekly-agents-${score.personId}'),
+ ),
+ _cell('${score.points}', strong: true),
+ ],
+ );
},
),
),
@@ -331,12 +366,21 @@ class _WeeklyBoardState extends State<SuperTabWeeklyLeaderboardPage> {
),
);
- Widget _line(List<Widget> children, {bool heading = false}) => Container(
+ /// A row of the table; the reader's [own] wears the selected-row fill
+ /// (Numbers and rankings, design system).
+ Widget _line(
+ List<Widget> children, {
+ Key? key,
+ bool heading = false,
+ bool own = false,
+ }) => Container(
+ key: key,
height: heading ? 36 : _rowHeight,
padding: const EdgeInsets.symmetric(
horizontal: DesktopChrome.panelPadding / 2,
),
decoration: BoxDecoration(
+ color: own ? grid.AppSurface.selectedFill : null,
border: Border(bottom: BorderSide(color: grid.AppPalette.divider)),
),
child: Row(children: children),
diff --git a/desktop/lib/super_tabs/model.dart b/desktop/lib/super_tabs/model.dart
index 932f0e245..f733713be 100644
--- a/desktop/lib/super_tabs/model.dart
+++ b/desktop/lib/super_tabs/model.dart
@@ -384,10 +384,14 @@ class SuperTabConversation {
: id = _text(row, 'id'),
// A group from before projects belongs to the first; a person's one
// Buddy chat for the Swarm belongs to none (spec
- // 2026-10-31-one-buddy-per-swarm).
+ // 2026-10-31-one-buddy-per-swarm), and so does a person's chat with
+ // one of their own agents (v3, #4116): it is not a task of the first
+ // project (audit #4211, finding 3).
projectId =
row['projectId'] as String? ??
- (row['kind'] == 'swarm-buddy' ? '' : 'lead'),
+ (row['kind'] == 'swarm-buddy' || row['kind'] == 'agent-chat'
+ ? ''
+ : 'lead'),
kind = row['kind'] as String?,
buddyOwnerId = row['buddyOwnerId'] as String?,
buddyName = row['buddyName'] as String?,
diff --git a/desktop/lib/super_tabs/pane_layout.dart b/desktop/lib/super_tabs/pane_layout.dart
index 0597e79f2..6ddc9564e 100644
--- a/desktop/lib/super_tabs/pane_layout.dart
+++ b/desktop/lib/super_tabs/pane_layout.dart
@@ -20,7 +20,6 @@ class SuperTabPaneLayout extends StatefulWidget {
this.right,
this.storage,
this.rightDefault = rightWidth,
- this.rightMinimum = rightWidth,
this.rightFixed = false,
this.over,
});
@@ -45,6 +44,11 @@ class SuperTabPaneLayout extends StatefulWidget {
/// The Desktop's right pane, the Tasks pane: a fixed width, the middle taking the rest (River, Swarm v3).
static const boardRightWidth = 340.0;
+ /// Two Board columns: what the fixed layout's middle keeps while the side
+ /// panes can give, the left pane first, then the Tasks pane down to
+ /// [rightWidth]. At 900 the middle showed one and a half columns (#4211).
+ static const boardCenterWidth = 560.0;
+
/// The roster drawer's share of a narrow window at most. On a phone it filled the screen, leaving no
/// veil to tap, so closing it was hard (owner, 2026-10-23).
static const drawerMaxFraction = 0.7;
@@ -63,10 +67,8 @@ class SuperTabPaneLayout extends StatefulWidget {
/// width, saved, wins): [threadWidth] while it shows a thread.
final double rightDefault;
- /// The narrowest the right pane goes, before text scaling.
- final double rightMinimum;
-
- /// The right pane is always [rightDefault] wide: no divider, and a width saved earlier is not used.
+ /// The right pane is [rightDefault] wide, narrower only to keep [boardCenterWidth] in the middle: no divider, and
+ /// a width saved earlier is not used.
final bool rightFixed;
/// Drawn over the left and centre panes, leaving the right one as it is:
@@ -149,21 +151,30 @@ class _SuperTabPaneLayoutState extends State<SuperTabPaneLayout> {
final width = constraints.maxWidth;
final scale = MediaQuery.textScalerOf(context);
final hasLeft = widget.left != null, hasRight = widget.right != null;
- final centerMin = math.min(scale.scale(360), width);
+ final fixed = widget.rightFixed;
+ final centerMin = math.min(
+ math.max(
+ scale.scale(360),
+ fixed ? SuperTabPaneLayout.boardCenterWidth : 0,
+ ),
+ width,
+ );
// Text scaling widens the side panes only while the Board keeps its
// floor: the chat's scaled minimum gives back first, down to its own
// 420, then projects, down to 180 (reviews of #3863). The centre then
// yields before either side pane: a side's minimum wins over the room
// the centre's own preference asks for.
var leftMin = hasLeft ? scale.scale(_leftBase) : 0.0;
- var rightMin = hasRight ? scale.scale(widget.rightMinimum) : 0.0;
+ var rightMin = hasRight
+ ? scale.scale(SuperTabPaneLayout.rightWidth)
+ : 0.0;
var short =
leftMin +
rightMin +
math.min(SuperTabPaneLayout.boardFloor, width) -
width;
if (hasRight && short > 0) {
- final give = math.min(short, rightMin - widget.rightMinimum);
+ final give = math.min(short, rightMin - SuperTabPaneLayout.rightWidth);
rightMin -= give;
short -= give;
}
@@ -172,16 +183,27 @@ class _SuperTabPaneLayoutState extends State<SuperTabPaneLayout> {
}
double limit(double value, double floor, double ceiling) =>
value.clamp(floor, math.max(floor, ceiling)).toDouble();
+ // A fixed right pane keeps its width until the left pane is at its
+ // minimum: the left pane gives back first.
final left = hasLeft
- ? math.min(width, limit(_left, leftMin, width - centerMin - rightMin))
+ ? math.min(
+ width,
+ limit(
+ _left,
+ leftMin,
+ width -
+ centerMin -
+ (fixed
+ ? math.max(rightMin, widget.rightDefault)
+ : rightMin),
+ ),
+ )
: 0.0;
final right = hasRight
? math.min(
width - left,
limit(
- widget.rightFixed
- ? widget.rightDefault
- : _right ?? widget.rightDefault,
+ fixed ? widget.rightDefault : _right ?? widget.rightDefault,
rightMin,
width - centerMin - left,
),
diff --git a/desktop/lib/super_tabs/project_sidebar.dart b/desktop/lib/super_tabs/project_sidebar.dart
index f9f9e63b9..58ccb9e9b 100644
--- a/desktop/lib/super_tabs/project_sidebar.dart
+++ b/desktop/lib/super_tabs/project_sidebar.dart
@@ -672,6 +672,7 @@ class ProjectSidebar extends StatelessWidget {
return SuperTabBuddyRow(
key: ValueKey('super-agent-${agent.id}'),
agentId: agent.id,
+ agent: agent,
name: name,
tooltip: chat == null ? '$name · no chat yet' : name,
crownKey: superTabAgentIsPm(snapshot, agent)
diff --git a/desktop/lib/super_tabs/quick_switcher.dart b/desktop/lib/super_tabs/quick_switcher.dart
index 73befbdc3..442c720e9 100644
--- a/desktop/lib/super_tabs/quick_switcher.dart
+++ b/desktop/lib/super_tabs/quick_switcher.dart
@@ -16,6 +16,7 @@ import 'detail_dialog.dart';
import 'dialog_scope.dart';
import 'identity.dart';
import 'model.dart';
+import 'my_agents.dart';
import 'profile_sheet.dart';
import '../widgets/laid_out_list.dart';
@@ -220,9 +221,23 @@ bool _readable(SuperTabController c, SuperTabConversation? g) {
if (c.hiddenByBuddies(g)) return false;
if (g.isBuddyChat) return g.buddyOwnerId == c.accountId;
if (g.audience != null && !g.audience!.contains(c.accountId)) return false;
+ // A person's chat with one of their own agents is in no project (v3).
+ if (g.isAgentChat) return g.agentIds.isNotEmpty;
return c.snapshot?.projects.any((p) => p.id == g.projectId) == true;
}
+/// The chat each of the person's own agents (My agents, but the Buddy and PMs, whose chats are listed as they are) opens
+/// by its agent, so every agent is found by name and opens its chat as in My agents (audit #4211, finding 11).
+Map<String, SuperTabAgent> _agentChats(SuperTabController c) {
+ final s = c.snapshot;
+ if (s == null) return const {};
+ return {
+ for (final a in superTabMyAgents(s, c.accountId))
+ if (a.buddyOf == null && !superTabAgentIsPm(s, a))
+ if (superTabAgentChat(s, a) case final chat?) chat.id: a,
+ };
+}
+
class _Destination {
_Destination(
this.id,
@@ -232,7 +247,8 @@ class _Destination {
this.person,
this.agent,
this.unread = false,
- }) : search = '$title $detail'.toLowerCase();
+ String alsoSearch = '',
+ }) : search = '$title $detail $alsoSearch'.toLowerCase();
final String id, title, detail, search;
final SuperTabConversation? conversation;
final SuperTabPerson? person;
@@ -244,19 +260,30 @@ List<_Destination> _destinations(SuperTabController c) {
final s = c.snapshot;
if (c.accessRevoked || s == null) return [];
final projects = {for (final p in s.projects) p.id: p};
+ final agentChats = _agentChats(c);
return [
for (final g in s.conversations)
if (_readable(c, g))
_Destination(
'conversation:${g.id}',
- s.isProjectLead(g.id) ? projects[g.projectId]!.name : g.label,
+ g.isAgentChat && agentChats[g.id] != null
+ ? s.agentName(agentChats[g.id]!.id)
+ : s.isProjectLead(g.id)
+ ? projects[g.projectId]!.name
+ : g.label,
g.isBuddyChat
? 'Your Buddy'
+ : g.isAgentChat
+ ? 'Your agent'
: s.isProjectLead(g.id)
? 'Project chat'
: projects[g.projectId]?.name ?? '',
conversation: g,
unread: c.unread(g),
+ // A task chat is also found by the name of the agent whose chat it is in My agents.
+ alsoSearch: agentChats[g.id] == null
+ ? ''
+ : s.agentName(agentChats[g.id]!.id),
),
for (final p in s.people)
_Destination(
@@ -266,7 +293,8 @@ List<_Destination> _destinations(SuperTabController c) {
person: p,
),
for (final a in s.teamAgents)
- if (projects.containsKey(a.projectId))
+ if (projects.containsKey(a.projectId) &&
+ !agentChats.values.any((mine) => mine.id == a.id))
_Destination(
'agent:${a.id}',
s.agentName(a.id),
diff --git a/desktop/lib/super_tabs/task_card.dart b/desktop/lib/super_tabs/task_card.dart
index 0324f61b7..b952177c0 100644
--- a/desktop/lib/super_tabs/task_card.dart
+++ b/desktop/lib/super_tabs/task_card.dart
@@ -45,6 +45,7 @@ class SuperTabTaskCard extends StatefulWidget {
required this.unread,
required this.activity,
required this.onOpen,
+ this.markLabel,
this.priority,
this.lane,
this.titleLines = 2,
@@ -68,6 +69,10 @@ class SuperTabTaskCard extends StatefulWidget {
final Key? noteKey;
final bool needsYou, unread;
final HarnessActivity activity;
+
+ /// What the activity mark means when its activity's own word is too broad ("In review" for a needs-input mark):
+ /// its tooltip and what a screen reader hears; null says the activity's word.
+ final String? markLabel;
final VoidCallback onOpen;
final SuperTabTaskPriority? priority;
@@ -131,14 +136,7 @@ class _SuperTabTaskCardState extends State<SuperTabTaskCard> {
if (w.priority case final priority?) 'Priority ${priority.badge}',
w.caption,
?w.note,
- if (!w.needsYou)
- switch (w.activity) {
- HarnessActivity.starting => 'Queued',
- HarnessActivity.needsInput => 'Waiting on a person',
- HarnessActivity.offline => 'Blocked or agent lost',
- HarnessActivity.done => 'Shipped',
- _ => w.activity.label,
- },
+ if (!w.needsYou) _markWord,
if (w.unread) 'New replies',
for (final chip in w.chips) chip.label,
?w.facts.pullRequest,
@@ -338,19 +336,34 @@ class _SuperTabTaskCardState extends State<SuperTabTaskCard> {
static const _agentSize = SuperTabAvatar.rowSize;
static const _requesterSize = 18.0;
- Widget _mark() => ListenableBuilder(
- listenable: Listenable.merge([terminalThemeStore, appearancePrefsStore]),
- builder: (context, _) => ActivityMark(
- activity: widget.activity,
- color: activityColor(
- widget.activity,
- terminalThemeFor(
- grid.AppTheme.surfacePalette,
- terminalThemeStore.value,
+ /// The card's state in words: the mark's tooltip and the screen reader's.
+ String get _markWord =>
+ widget.markLabel ??
+ switch (widget.activity) {
+ HarnessActivity.starting => 'Queued',
+ HarnessActivity.needsInput => 'Waiting on a person',
+ HarnessActivity.offline => 'Blocked or agent lost',
+ HarnessActivity.done => 'Shipped',
+ _ => widget.activity.label,
+ };
+
+ // A bare glyph says nothing until it is named (finding 13 of #4211): the card's word, not the terminal's.
+ Widget _mark() => Tooltip(
+ message: _markWord,
+ child: ListenableBuilder(
+ listenable: Listenable.merge([terminalThemeStore, appearancePrefsStore]),
+ builder: (context, _) => ActivityMark(
+ activity: widget.activity,
+ color: activityColor(
+ widget.activity,
+ terminalThemeFor(
+ grid.AppTheme.surfacePalette,
+ terminalThemeStore.value,
+ ),
+ color: appearancePrefsStore.value.prompt.color,
),
- color: appearancePrefsStore.value.prompt.color,
+ tooltip: false,
),
- tooltip: false,
),
);
diff --git a/desktop/lib/super_tabs/tasks/personal_tasks_pane.dart b/desktop/lib/super_tabs/tasks/personal_tasks_pane.dart
index 2d5b82b13..2b83530bf 100644
--- a/desktop/lib/super_tabs/tasks/personal_tasks_pane.dart
+++ b/desktop/lib/super_tabs/tasks/personal_tasks_pane.dart
@@ -92,7 +92,12 @@ class _TasksPaneState extends State<SuperTabPersonalTasksPane> {
context: context,
builder: (context) => StatefulBuilder(
builder: (context, update) => AlertDialog(
- title: const Text('Reject task'),
+ // Names the task, so the person knows which one they turn down.
+ title: Text(
+ 'Reject “${task.title}”?',
+ maxLines: 3,
+ overflow: TextOverflow.ellipsis,
+ ),
content: TextField(
key: const ValueKey('task-reject-reason'),
controller: reason,
@@ -398,6 +403,10 @@ class _TasksPaneState extends State<SuperTabPersonalTasksPane> {
.isBuddy
? task.agentId
: null,
+ // The row's own text size: a dropdown's default is
+ // larger and bolder than the task titles around it.
+ style: DefaultTextStyle.of(context)
+ .style,
decoration: const InputDecoration(
labelText: 'Suggested agent',
isDense: true,
diff --git a/desktop/lib/super_tabs/tasks_view.dart b/desktop/lib/super_tabs/tasks_view.dart
index d66eeeace..88f2ce57b 100644
--- a/desktop/lib/super_tabs/tasks_view.dart
+++ b/desktop/lib/super_tabs/tasks_view.dart
@@ -1,6 +1,5 @@
import 'dart:async';
import 'dart:convert';
-import 'dart:math' as math;
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@@ -68,6 +67,9 @@ class SuperTabTasksView extends StatefulWidget {
/// The least a Board column takes (task #3869): the columns share the pane's width, and below this the Board scrolls.
static const minColumnWidth = 240.0;
+ /// An empty Board column's width (finding 5 of #4211): a slim lane of its name, turned, over its 0.
+ static const slimColumnWidth = 40.0;
+
static String storageKey(String accountId) =>
'super-tab-tasks-view/$accountId';
@@ -75,6 +77,9 @@ class SuperTabTasksView extends StatefulWidget {
State<SuperTabTasksView> createState() => _SuperTabTasksViewState();
}
+/// Where a Board column sits in its row, from the row's start.
+typedef _Span = ({SuperTabTaskColumn column, double left, double right});
+
/// How the Tasks view lays its cards out, kept by its name.
enum _Layout { board, list, members }
@@ -445,11 +450,14 @@ class _SuperTabTasksViewState extends State<SuperTabTasksView> {
static const _searchWidth = 220.0;
static const _columnGap = grid.AppDesktop.groupGap;
+ /// A Board lane's name is its bold title, as Trello's (task #3787).
+ static TextStyle get _laneTitle =>
+ DesktopChrome.control(color: DesktopChrome.foreground)
+ .copyWith(fontWeight: grid.AppFont.semibold);
+
Widget _heading(SuperTabTaskColumn column, int count, {bool? folded}) {
- // A Board lane's name is its bold title, as Trello's (task #3787).
final style = folded == null
- ? DesktopChrome.control(color: DesktopChrome.foreground)
- .copyWith(fontWeight: grid.AppFont.semibold)
+ ? _laneTitle
: DesktopChrome.control(medium: true);
final row = Row(
children: [
@@ -638,6 +646,11 @@ class _SuperTabTasksViewState extends State<SuperTabTasksView> {
task?.requesterId ??
task?.proposal?.senderIds.firstOrNull ??
entry.proposal?.personId;
+ final activity = _activity(entry);
+ final review =
+ task?.assignment?['status'] == 'review' ||
+ task?.liveness?['state'] == 'waiting' &&
+ task?.liveness?['why'] == 'review';
return SuperTabTaskCard(
key: ValueKey('super-task-card-$id'),
// A legacy marker is the badge now: the title drops it.
@@ -652,7 +665,11 @@ class _SuperTabTasksViewState extends State<SuperTabTasksView> {
priority: superTabEntryPriority(entry),
needsYou: entry.needsYou,
unread: task != null && widget.controller.unreadShown(task),
- activity: _activity(entry),
+ activity: activity,
+ // A review waits as a person's answer does, under the same mark: its tooltip says which (finding 13 of #4211).
+ markLabel: activity == HarnessActivity.needsInput && review
+ ? 'In review'
+ : null,
titleLines: list ? 1 : 3,
// What a merged task waits on, and how long a done one has waited, are
// what the card is for: they wrap however long, never cut off (tasks
@@ -700,52 +717,167 @@ class _SuperTabTasksViewState extends State<SuperTabTasksView> {
);
}
- /// The Board: each column a neutral panel, all of one width that shares the
- /// pane (task #3869), never under [SuperTabTasksView.minColumnWidth]. Below
- /// it the row scrolls sideways under a scrollbar that stays in view, which a
- /// mouse drags; a trackpad swipe and shift with the wheel scroll it too. Each
- /// column scrolls its own cards.
+ /// The Board: each column a neutral panel, those with cards all of one
+ /// width that shares the pane (task #3869), never under
+ /// [SuperTabTasksView.minColumnWidth]; an empty one a slim lane (finding 5
+ /// of #4211). Below the minimum the row scrolls sideways under a scrollbar
+ /// that stays in view, which a mouse drags; a trackpad swipe and shift with
+ /// the wheel scroll it too; and a pill at each edge names the columns out of
+ /// view there. Each column scrolls its own cards.
Widget _boardView(
Map<SuperTabTaskColumn, List<SuperTabTaskEntry>> shown,
DateTime now,
) => LayoutBuilder(
builder: (context, box) {
const edge = grid.AppDesktop.groupGap;
- final count = SuperTabTaskColumn.values.length;
- final share =
- (box.maxWidth - 2 * edge - (count - 1) * _columnGap) / count;
- final width = math.max(SuperTabTasksView.minColumnWidth, share);
- return Scrollbar(
- key: const ValueKey('super-tasks-board-scrollbar'),
- controller: _boardScroll,
- thumbVisibility: share < SuperTabTasksView.minColumnWidth,
- child: SingleChildScrollView(
- key: const ValueKey('super-tasks-board'),
- controller: _boardScroll,
- scrollDirection: Axis.horizontal,
- padding: const EdgeInsets.only(
- left: edge,
- right: edge,
- bottom: grid.AppDesktop.groupGap,
- ),
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: [
- for (final column in SuperTabTaskColumn.values) ...[
- if (column != SuperTabTaskColumn.values.first)
- const SizedBox(width: _columnGap),
- SizedBox(
- width: width,
- child: _panel(column, shown[column]!, now),
+ final width = _fullWidth(box.maxWidth, [
+ for (final column in SuperTabTaskColumn.values) shown[column]!.isEmpty,
+ ]);
+ // Where each column sits in the row, for the pills.
+ final spans = <_Span>[];
+ var x = edge;
+ for (final column in SuperTabTaskColumn.values) {
+ final w = shown[column]!.isEmpty
+ ? SuperTabTasksView.slimColumnWidth
+ : width;
+ spans.add((column: column, left: x, right: x + w));
+ x += w + _columnGap;
+ }
+ final overflow = spans.last.right + edge > box.maxWidth + .5;
+ return Stack(
+ children: [
+ Positioned.fill(
+ child: Scrollbar(
+ key: const ValueKey('super-tasks-board-scrollbar'),
+ controller: _boardScroll,
+ thumbVisibility: overflow,
+ child: SingleChildScrollView(
+ key: const ValueKey('super-tasks-board'),
+ controller: _boardScroll,
+ scrollDirection: Axis.horizontal,
+ padding: const EdgeInsets.only(
+ left: edge,
+ right: edge,
+ bottom: grid.AppDesktop.groupGap,
),
- ],
- ],
+ child: Row(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ for (final span in spans) ...[
+ if (span.column != SuperTabTaskColumn.values.first)
+ const SizedBox(width: _columnGap),
+ SizedBox(
+ width: span.right - span.left,
+ child: shown[span.column]!.isEmpty
+ ? _slimLane(span.column)
+ : _panel(span.column, shown[span.column]!, now),
+ ),
+ ],
+ ],
+ ),
+ ),
+ ),
),
- ),
+ if (overflow)
+ ListenableBuilder(
+ listenable: _boardScroll,
+ builder: (context, _) => _offView(spans, shown, box.maxWidth),
+ ),
+ ],
);
},
);
+ /// The width the Board's columns with cards share in a [view] that wide,
+ /// [empty] saying which are slim lanes: all of it when they fit at
+ /// [SuperTabTasksView.minColumnWidth] or more; else as many whole columns
+ /// as fit at rest, the lanes after the last of them included, so none is
+ /// cut mid-word until the reader scrolls (finding 5 of #4211).
+ static double _fullWidth(double view, List<bool> empty) {
+ const edge = grid.AppDesktop.groupGap;
+ var width = SuperTabTasksView.minColumnWidth;
+ var full = 0, slim = 0;
+ for (final (i, isEmpty) in empty.indexed) {
+ isEmpty ? slim++ : full++;
+ if (full == 0 || i + 1 < empty.length && empty[i + 1]) continue;
+ final share =
+ (view -
+ 2 * edge -
+ slim * SuperTabTasksView.slimColumnWidth -
+ (full + slim - 1) * _columnGap) /
+ full;
+ if (share < SuperTabTasksView.minColumnWidth) break;
+ width = share;
+ }
+ return width;
+ }
+
+ /// The pills over the Board's bottom corners: each names, with its count,
+ /// every column with cards out of view at its edge, and pressed scrolls
+ /// the nearest of them into view.
+ Widget _offView(
+ List<_Span> spans,
+ Map<SuperTabTaskColumn, List<SuperTabTaskEntry>> shown,
+ double view,
+ ) {
+ const edge = grid.AppDesktop.groupGap;
+ final at = _boardScroll.hasClients ? _boardScroll.offset : 0.0;
+ final left = [
+ for (final span in spans)
+ if (span.left < at - .5) span,
+ ];
+ final right = [
+ for (final span in spans)
+ if (span.right > at + view + .5) span,
+ ];
+ void scrollTo(double offset) => unawaited(
+ _boardScroll.animateTo(
+ offset.clamp(0, _boardScroll.position.maxScrollExtent),
+ duration: const Duration(milliseconds: 250),
+ curve: Curves.easeOut,
+ ),
+ );
+
+ Widget? pill(String side, List<_Span> off, VoidCallback onPressed) {
+ final named = [
+ for (final span in off)
+ if (shown[span.column]!.isNotEmpty)
+ '${span.column.label} ${shown[span.column]!.length}',
+ ];
+ if (named.isEmpty) return null;
+ return ConstrainedBox(
+ constraints: BoxConstraints(
+ maxWidth: (view / 2 - edge).clamp(0, double.infinity),
+ ),
+ child: DesktopPill(
+ key: ValueKey('super-tasks-board-more-$side'),
+ label: named.join(' · '),
+ icon: side == 'left' ? AppIcons.chevronLeft : null,
+ menu: side == 'right',
+ menuIcon: AppIcons.chevronRight,
+ surfaceColor: DesktopChrome.surface,
+ semanticHint: 'Scrolls them into view',
+ onPressed: onPressed,
+ ),
+ );
+ }
+
+ final back = pill(
+ 'left',
+ left,
+ () => scrollTo(left.last.right + edge - view),
+ );
+ final more = pill('right', right, () => scrollTo(right.first.left - edge));
+ // Above the scrollbar, in from the edge as the columns are.
+ const bottom = grid.AppDesktop.groupGap + grid.AppDesktop.controlGap;
+ return Stack(
+ children: [
+ if (back != null) Positioned(left: edge, bottom: bottom, child: back),
+ if (more != null) Positioned(right: edge, bottom: bottom, child: more),
+ ],
+ );
+ }
+
/// A lane's tint, as Trello's lists (anh Dee, task #3787): a step off the
/// page, darker in light under white cards and darker in dark under lifted
/// ones, with no rim or shadow.
@@ -786,8 +918,8 @@ class _SuperTabTasksViewState extends State<SuperTabTasksView> {
),
);
- /// Said, not left blank: a column with nothing in it reads as one still
- /// loading (task #2948).
+ /// Said, not left blank: Members' Unassigned with nothing in it reads as one
+ /// still loading (task #2948).
static Widget _noTasks() => Padding(
padding: const EdgeInsets.symmetric(vertical: grid.AppDesktop.groupGap),
child: Text(
@@ -797,6 +929,36 @@ class _SuperTabTasksViewState extends State<SuperTabTasksView> {
),
);
+ /// An empty column of the Board (finding 5 of #4211): a slim lane, its name
+ /// turned to read downwards over its 0, as Trello folds a list, so the
+ /// columns with cards get the width. A card arriving opens it again.
+ Widget _slimLane(SuperTabTaskColumn column) => DecoratedBox(
+ key: ValueKey('super-tasks-column-${column.name}'),
+ decoration: BoxDecoration(
+ color: _laneFill,
+ borderRadius: BorderRadius.circular(grid.AppCard.radius),
+ ),
+ child: Padding(
+ key: ValueKey('super-tasks-heading-${column.name}'),
+ padding: const EdgeInsets.symmetric(vertical: grid.AppDesktop.controlGap),
+ child: Column(
+ children: [
+ RotatedBox(
+ quarterTurns: 1,
+ child: Text(
+ column.label,
+ maxLines: 1,
+ softWrap: false,
+ style: _laneTitle,
+ ),
+ ),
+ const SizedBox(height: grid.AppDesktop.controlGap),
+ Text('0', style: DesktopChrome.metadata()),
+ ],
+ ),
+ ),
+ );
+
/// One column of the Board.
Widget _panel(
SuperTabTaskColumn column,
@@ -805,9 +967,7 @@ class _SuperTabTasksViewState extends State<SuperTabTasksView> {
) => _framed(
ValueKey('super-tasks-column-${column.name}'),
_heading(column, entries.length),
- entries.isEmpty
- ? _noTasks()
- : column == SuperTabTaskColumn.nextUp
+ column == SuperTabTaskColumn.nextUp
? _nextUp(entries, now)
: LaidOutListView.builder(
padding: _laneInset,
diff --git a/desktop/lib/super_tabs/view.dart b/desktop/lib/super_tabs/view.dart
index 80c2370db..e1f7dbeba 100644
--- a/desktop/lib/super_tabs/view.dart
+++ b/desktop/lib/super_tabs/view.dart
@@ -6299,10 +6299,8 @@ class _SuperTabViewState extends State<SuperTabView>
: !boardLayout && thread == null && !chatBeside
? SuperTabPaneLayout.rightWidth
: SuperTabPaneLayout.threadWidth,
- // The Desktop's right pane is a fixed 340, the Tasks pane's: the middle takes the rest (River, Swarm v3).
- rightMinimum: boardLayout
- ? SuperTabPaneLayout.boardRightWidth
- : SuperTabPaneLayout.rightWidth,
+ // The Desktop's right pane is the Tasks pane's 340, giving back only to keep two Board columns
+ // in a small window (River, Swarm v3; #4211).
rightFixed: boardLayout,
// Over the chat, beside an open thread, as in Slack.
over: wide ? viewer : null,
diff --git a/desktop/test/super_tab_agent_chat_not_task_test.dart b/desktop/test/super_tab_agent_chat_not_task_test.dart
new file mode 100644
index 000000000..d1309a50a
--- /dev/null
+++ b/desktop/test/super_tab_agent_chat_not_task_test.dart
@@ -0,0 +1,119 @@
+import 'dart:io';
+
+import 'package:flutter/material.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/shared/theme/app_theme.dart' as grid;
+import 'package:harness/super_tabs/backlog.dart';
+import 'package:harness/super_tabs/view.dart';
+
+import 'super_tab_activity_lists_test.dart' show swarm;
+import 'support/capture.dart';
+import 'support/memory_key_value_store.dart';
+import 'support/super_tab_fixture.dart';
+
+/// Audit #4211, finding 3: an agent's own chat is never a task card. The server
+/// sends a v3 agent chat with no project; Desktop filed it under the first
+/// project, so "Kestrel P2" sat in Next up on that project's Board.
+void main() {
+ test(
+ 'an agent\'s own chat is in no project and is not a Board task',
+ () async {
+ final server = swarm();
+ (server.state['conversations'] as List).add({
+ ...conversationFixture('agent-chat-kestrel', 'Kestrel'),
+ 'kind': 'agent-chat',
+ 'agentIds': ['kestrel'],
+ });
+ final c = server.controller(
+ account: 'owner',
+ initial: {'tabId': 'tab', 'accountId': 'owner', 'selectedId': 'lead'},
+ );
+ addTearDown(c.dispose);
+ await c.refresh();
+ final snapshot = c.snapshot!;
+ final chat = snapshot.conversation('agent-chat-kestrel')!;
+ expect(chat.isAgentChat, isTrue);
+ expect(chat.projectId, '');
+ final project = snapshot.projects.first;
+ final titles = [
+ for (final g in superTabProjectTasks(c, project)) g.label,
+ ];
+ expect(titles, isNot(contains('Kestrel')));
+ // The project's real task is still listed.
+ expect(titles, contains('Windows credential fix'));
+ expect(
+ c.projectConversations(project.id).map((g) => g.id),
+ isNot(contains('agent-chat-kestrel')),
+ );
+ },
+ );
+
+ final shots = Platform.environment['HARNESS_AGENT_CHAT_SHOTS'];
+ setUpAll(() => loadCaptureFonts(shots));
+ for (final brightness in Brightness.values) {
+ testWidgets(
+ 'a project\'s Board has no card for an agent\'s chat: ${brightness.name}',
+ (tester) async {
+ await tester.binding.setSurfaceSize(const Size(1500, 900));
+ addTearDown(() => tester.binding.setSurfaceSize(null));
+ final previous = grid.AppTheme.brightness.value;
+ grid.AppTheme.brightness.value = brightness;
+ addTearDown(() => grid.AppTheme.brightness.value = previous);
+ final server = swarm();
+ (server.state['conversations'] as List).add({
+ ...conversationFixture('agent-chat-kestrel', 'Kestrel'),
+ 'kind': 'agent-chat',
+ 'agentIds': ['kestrel'],
+ });
+ final c = server.controller(
+ account: 'owner',
+ initial: {
+ 'tabId': 'tab',
+ 'projectsGroupOpen': true,
+ 'accountId': 'owner',
+ 'selectedId': 'lead',
+ },
+ );
+ await tester.runAsync(c.refresh);
+ await tester.pumpWidget(
+ MaterialApp(
+ debugShowCheckedModeBanner: false,
+ theme: grid.buildAppTheme(brightness: brightness),
+ home: Scaffold(
+ body: SuperTabView(
+ controller: c,
+ onInvite: () {},
+ onAddAgent: (_) {},
+ onOpenTerminal: (_) {},
+ machineName: (_) => 'Mac Studio',
+ paneStore: MemoryKeyValueStore(),
+ board: true,
+ ),
+ ),
+ ),
+ );
+ await tester.pumpAndSettle();
+ await tester.tap(find.byKey(const ValueKey('super-group-lead')));
+ await tester.pumpAndSettle();
+ expect(find.byKey(const ValueKey('super-tasks-lead')), findsOneWidget);
+ // The project's own task is a card; the agent's chat is not.
+ expect(
+ find.byKey(const ValueKey('super-task-card-offline')),
+ findsOneWidget,
+ );
+ expect(
+ find.byKey(const ValueKey('super-task-card-agent-chat-kestrel')),
+ findsNothing,
+ );
+ await captureWindow(
+ tester,
+ shots,
+ 'board-no-agent-chat-card-${brightness.name}',
+ );
+ await tester.pumpWidget(const SizedBox());
+ c.dispose();
+ await tester.pump(const Duration(seconds: 5));
+ },
+ );
+ }
+}
diff --git a/desktop/test/super_tab_agent_face_shots_test.dart b/desktop/test/super_tab_agent_face_shots_test.dart
new file mode 100644
index 000000000..9a0151295
--- /dev/null
+++ b/desktop/test/super_tab_agent_face_shots_test.dart
@@ -0,0 +1,43 @@
+// Audit findings 6 and 12 of task #4211: My agents with each agent's face, and @ in an agent's own chat, for the PR's
+// pictures, light and dark. Writes nothing unless HARNESS_SUPER_TAB_CAPTURE names a folder.
+import 'dart:io';
+
+import 'package:flutter/material.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/shared/theme/app_theme.dart' as grid;
+
+import 'super_tab_agent_face_test.dart' show showAgentFaces;
+import 'super_tab_private_mention_test.dart' show privateMentionSwarm;
+import 'support/capture.dart';
+
+final shots = Platform.environment['HARNESS_SUPER_TAB_CAPTURE'];
+
+void main() {
+ setUpAll(() => loadCaptureFonts(shots));
+
+ for (final brightness in Brightness.values) {
+ for (final scene in ['agent-faces', 'private-mention']) {
+ testWidgets('$scene (${brightness.name})', (tester) async {
+ final previous = grid.AppTheme.brightness.value;
+ grid.AppTheme.brightness.value = brightness;
+ addTearDown(() => grid.AppTheme.brightness.value = previous);
+ final c = await showAgentFaces(
+ tester,
+ privateMentionSwarm(),
+ selectedId: 'agent-chat-kestrel',
+ brightness: brightness,
+ );
+ if (scene == 'private-mention') {
+ final composer = find.byKey(const ValueKey('super-message-composer'));
+ await tester.tap(composer);
+ await tester.enterText(composer, 'Please check @');
+ await tester.pump();
+ }
+ await captureWindow(tester, shots, '$scene-${brightness.name}');
+ await tester.pumpWidget(const SizedBox());
+ await tester.runAsync(c.flush);
+ c.dispose();
+ });
+ }
+ }
+}
diff --git a/desktop/test/super_tab_agent_face_test.dart b/desktop/test/super_tab_agent_face_test.dart
new file mode 100644
index 000000000..90f87555d
--- /dev/null
+++ b/desktop/test/super_tab_agent_face_test.dart
@@ -0,0 +1,193 @@
+import 'package:flutter/material.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/shared/theme/app_theme.dart' as grid;
+import 'package:harness/super_tabs/avatar_art.dart';
+import 'package:harness/super_tabs/controller.dart';
+import 'package:harness/super_tabs/profile_model.dart';
+import 'package:harness/super_tabs/view.dart';
+import 'package:harness/widgets/engine_identity.dart';
+
+import 'super_tab_activity_lists_test.dart' show swarm;
+import 'support/super_tab_fixture.dart';
+
+Map<String, dynamic> _agent(String id, String name) => {
+ 'id': id,
+ 'projectId': 'lead',
+ 'name': name,
+ 'displayName': name,
+ 'machineId': 'host',
+ 'harnessId': 'session',
+ 'contributorId': 'owner',
+ 'configuration': {'engine': 'codex'},
+ 'myAgent': true,
+};
+
+/// The reader's agents in My agents: Kestrel, a Regular agent with no picture
+/// (its pattern) talking in its own chat, and Orion, the project's PM, wearing
+/// a picture.
+ConversationServer agentFaceSwarm() {
+ final server = swarm();
+ server.state['agents'] = [
+ {
+ ..._agent('kestrel', 'Kestrel'),
+ 'kind': 'regular',
+ 'chatId': 'agent-chat-kestrel',
+ },
+ {
+ ..._agent('orion', 'Orion'),
+ 'kind': 'pm',
+ 'chatId': 'lead',
+ 'avatar': {'kind': 'preset', 'key': 'owl'},
+ },
+ ];
+ final groups = (server.state['conversations'] as List)
+ .cast<Map<String, dynamic>>();
+ groups.firstWhere((g) => g['id'] == 'lead')
+ ..['leadId'] = 'orion'
+ ..['agentIds'] = ['orion'];
+ groups.add({
+ ...conversationFixture('agent-chat-kestrel', 'Kestrel'),
+ 'kind': 'agent-chat',
+ 'agentIds': ['kestrel'],
+ });
+ server.append(
+ 'Please look at the build.',
+ conversationId: 'agent-chat-kestrel',
+ );
+ server.messages.last['author'] = {
+ 'kind': 'person',
+ 'id': 'owner',
+ 'name': '[email protected]',
+ };
+ server.append(
+ 'On it: the build fails on the lint step, fixing now.',
+ conversationId: 'agent-chat-kestrel',
+ );
+ server.messages.last['author'] = {
+ 'kind': 'agent',
+ 'id': 'kestrel',
+ 'name': 'Kestrel',
+ };
+ server.append('The plan for this week.');
+ server.messages.last['author'] = {
+ 'kind': 'agent',
+ 'id': 'orion',
+ 'name': 'Orion',
+ };
+ return server;
+}
+
+/// The Desktop's window on [server], [selectedId] open in the middle.
+Future<SuperTabController> showAgentFaces(
+ WidgetTester tester,
+ ConversationServer server, {
+ required String selectedId,
+ Brightness brightness = Brightness.light,
+}) async {
+ final c = server.controller(
+ account: 'owner',
+ initial: {'tabId': 'tab', 'accountId': 'owner', 'selectedId': selectedId},
+ );
+ await tester.runAsync(c.refresh);
+ await tester.binding.setSurfaceSize(const Size(1500, 800));
+ addTearDown(() => tester.binding.setSurfaceSize(null));
+ await tester.pumpWidget(
+ MaterialApp(
+ debugShowCheckedModeBanner: false,
+ theme: grid.buildAppTheme(brightness: brightness),
+ home: Scaffold(
+ body: SuperTabView(
+ controller: c,
+ onInvite: () {},
+ onAddAgent: (_) {},
+ onOpenTerminal: (_) {},
+ machineName: (_) => 'Mac Studio',
+ board: true,
+ ),
+ ),
+ ),
+ );
+ for (var i = 0; i < 3; i++) {
+ await tester.runAsync(
+ () => Future<void>.delayed(const Duration(milliseconds: 30)),
+ );
+ await tester.pump(const Duration(milliseconds: 50));
+ }
+ return c;
+}
+
+/// Audit finding 6 of task #4211: My agents drew each agent as a letter while
+/// the chat, the Board and the Tasks pane drew its face. One face everywhere.
+void main() {
+ Finder key(String k) => find.byKey(ValueKey(k));
+
+ /// What a face draws: whose, its picture, and the pattern in its place.
+ String look(SuperTabAvatarFace face) =>
+ '${face.identity} pattern=${face.pattern} picture=${switch (face.picture) {
+ SuperTabPresetAvatar(:final key) => key,
+ _ => null,
+ }}';
+
+ SuperTabAvatarFace rowFace(WidgetTester tester, String agent) =>
+ tester.widget<SuperTabAvatarFace>(
+ find.descendant(
+ of: key('super-agent-$agent'),
+ matching: find.byType(SuperTabAvatarFace),
+ ),
+ );
+
+ /// The faces drawn for [agent] outside My agents: its messages' avatars.
+ Set<String> elsewhere(WidgetTester tester, String agent) => {
+ for (final face in tester.widgetList<SuperTabAvatarFace>(
+ find.byWidgetPredicate(
+ (w) => w is SuperTabAvatarFace && w.identity == 'agent:$agent',
+ ),
+ ))
+ look(face),
+ };
+
+ Future<void> end(WidgetTester tester, SuperTabController c) async {
+ await tester.pumpWidget(const SizedBox());
+ await tester.runAsync(c.flush);
+ c.dispose();
+ }
+
+ testWidgets('an agent in My agents wears the face its chat shows, not an '
+ 'initial', (tester) async {
+ final c = await showAgentFaces(
+ tester,
+ agentFaceSwarm(),
+ selectedId: 'agent-chat-kestrel',
+ );
+ final face = rowFace(tester, 'kestrel');
+ expect(face.pattern, isTrue, reason: 'its pattern, not the letter K');
+ expect(elsewhere(tester, 'kestrel'), {look(face)});
+ // The face alone: the row draws no engine badge.
+ expect(
+ find.descendant(
+ of: key('super-agent-kestrel'),
+ matching: find.byType(EngineMark),
+ ),
+ findsNothing,
+ );
+ await end(tester, c);
+ });
+
+ testWidgets('an agent with a picture wears it in My agents too', (
+ tester,
+ ) async {
+ final c = await showAgentFaces(
+ tester,
+ agentFaceSwarm(),
+ selectedId: 'lead',
+ );
+ final face = rowFace(tester, 'orion');
+ expect(face.picture, isA<SuperTabPresetAvatar>());
+ expect(elsewhere(tester, 'orion'), {look(face)});
+ expect(
+ find.descendant(of: key('super-agent-orion'), matching: find.text('🦉')),
+ findsOneWidget,
+ );
+ await end(tester, c);
+ });
+}
diff --git a/desktop/test/super_tab_board_fit_shots_test.dart b/desktop/test/super_tab_board_fit_shots_test.dart
new file mode 100644
index 000000000..cf3df8f5e
--- /dev/null
+++ b/desktop/test/super_tab_board_fit_shots_test.dart
@@ -0,0 +1,142 @@
+// Audit finding 5 of task #4211 (task #4251): a 1500×860 window, its Board's middle about 860 wide, with Proposal
+// empty and several Shipped, for the PR's pictures, light and dark. Writes nothing unless HARNESS_SUPER_TAB_CAPTURE
+// names a folder.
+import 'dart:io';
+
+import 'package:flutter/material.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/shared/theme/app_theme.dart' as grid;
+import 'package:harness/super_tabs/view.dart';
+
+import 'super_tab_activity_lists_test.dart' show swarm;
+import 'super_tab_tasks_view_test.dart' show taskFixture;
+import 'support/capture.dart';
+import 'support/memory_key_value_store.dart';
+
+final shots = Platform.environment['HARNESS_SUPER_TAB_CAPTURE'];
+
+/// Two Next up, three Working (one in review), one Done, one Merged waiting for its release and five Shipped.
+List<Map<String, dynamic>> _tasks() {
+ final now = DateTime.now();
+ return [
+ taskFixture('hotfix', 'Sign-in loops forever after a token refresh', 30),
+ taskFixture('lanes', 'Document the crew lanes', 31),
+ taskFixture(
+ 'composer',
+ 'Composer keeps its draft across tabs',
+ 32,
+ status: 'working',
+ agent: 'kestrel',
+ pullRequest: 3790,
+ ),
+ taskFixture(
+ 'rename',
+ 'Rename a Swarm from the phone',
+ 33,
+ status: 'review',
+ agent: 'kestrel',
+ pullRequest: 3772,
+ liveness: {'state': 'waiting', 'why': 'review', 'since': 1},
+ ),
+ taskFixture(
+ 'repair',
+ 'Repair the release notes',
+ 34,
+ status: 'done',
+ agent: 'kestrel',
+ pullRequest: 3773,
+ ),
+ taskFixture(
+ 'fit',
+ 'Board fits the middle',
+ 35,
+ status: 'done',
+ agent: 'kestrel',
+ pullRequest: 3774,
+ merged: true,
+ releasing: ['desktop'],
+ ),
+ for (final (i, title) in [
+ 'CLI retries a lost upload once',
+ 'Phone shows who is typing',
+ 'Release notes name every part',
+ 'Machines list sorts by load',
+ 'Invite link expires in a week',
+ ].indexed)
+ taskFixture(
+ 'shipped-$i',
+ title,
+ 40 + i,
+ status: 'done',
+ agent: 'kestrel',
+ pullRequest: 3700 + i,
+ merged: true,
+ shippedAt: now.subtract(Duration(hours: i + 1)),
+ ),
+ ];
+}
+
+void main() {
+ setUpAll(() => loadCaptureFonts(shots));
+
+ for (final brightness in Brightness.values) {
+ testWidgets('Board fits a 1500×860 window (${brightness.name})', (
+ tester,
+ ) async {
+ if (shots == null) return;
+ await tester.binding.setSurfaceSize(const Size(1500, 860));
+ addTearDown(() => tester.binding.setSurfaceSize(null));
+ final previous = grid.AppTheme.brightness.value;
+ grid.AppTheme.brightness.value = brightness;
+ addTearDown(() => grid.AppTheme.brightness.value = previous);
+ final server = swarm();
+ final conversations = (server.state['conversations'] as List)
+ .cast<Map<String, dynamic>>();
+ conversations.removeWhere((g) => g['id'] == 'offline');
+ conversations.addAll(_tasks());
+ final c = server.controller(
+ account: 'owner',
+ initial: {
+ 'tabId': 'tab',
+ 'projectsGroupOpen': true,
+ 'accountId': 'owner',
+ 'selectedId': 'lead',
+ },
+ );
+ await tester.runAsync(c.refresh);
+ await tester.pumpWidget(
+ MaterialApp(
+ debugShowCheckedModeBanner: false,
+ theme: grid.buildAppTheme(brightness: brightness),
+ builder: (context, child) => MediaQuery(
+ data: MediaQuery.of(context).copyWith(disableAnimations: true),
+ child: child!,
+ ),
+ home: Scaffold(
+ body: SuperTabView(
+ controller: c,
+ onInvite: () {},
+ onAddAgent: (_) {},
+ onOpenTerminal: (_) {},
+ machineName: (_) => 'Mac Studio',
+ paneStore: MemoryKeyValueStore(),
+ board: true,
+ ),
+ ),
+ ),
+ );
+ await tester.pumpAndSettle();
+ await tester.tap(find.byKey(const ValueKey('super-group-lead')));
+ await tester.pumpAndSettle();
+ expect(
+ find.byKey(const ValueKey('super-tasks-board-more-right')),
+ findsOneWidget,
+ );
+ expect(tester.takeException(), isNull);
+ await captureWindow(tester, shots, 'board-fit-1500-${brightness.name}');
+ await tester.pumpWidget(const SizedBox());
+ c.dispose();
+ await tester.pump(const Duration(seconds: 5));
+ });
+ }
+}
diff --git a/desktop/test/super_tab_board_fit_test.dart b/desktop/test/super_tab_board_fit_test.dart
new file mode 100644
index 000000000..637fafc0f
--- /dev/null
+++ b/desktop/test/super_tab_board_fit_test.dart
@@ -0,0 +1,261 @@
+import 'package:flutter/material.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/shared/theme/app_theme.dart' as grid;
+import 'package:harness/super_tabs/controller.dart';
+import 'package:harness/super_tabs/tasks_view.dart';
+
+import 'super_tab_tasks_view_test.dart' show taskFixture, tasksServer;
+import 'support/memory_key_value_store.dart';
+import 'support/super_tab_fixture.dart';
+
+/// Audit findings 5 and 13 of task #4211 (task #4251): in a 1500 window the
+/// Board's middle is about 860 wide. An empty column is a slim lane, the rest
+/// share the width in whole columns, a pill names the columns out of view, and
+/// a card's mark says what it means.
+
+final _now = DateTime(2026, 11, 4, 9);
+
+Finder _key(String k) => find.byKey(ValueKey(k));
+Finder _column(String name) => _key('super-tasks-column-$name');
+final _board = _key('super-tasks-board');
+
+/// No proposal, two Next up, three Working (one in review), one Done, one
+/// Merged waiting for its release and five Shipped.
+ConversationServer _server() {
+ final server = tasksServer();
+ server.proposals['lead'] = <Map<String, dynamic>>[];
+ (server.state['conversations'] as List).addAll(<Map<String, dynamic>>[
+ taskFixture(
+ 'review',
+ 'Rename a Swarm from the phone',
+ 20,
+ requester: 'tony',
+ status: 'review',
+ pullRequest: 3772,
+ liveness: {'state': 'waiting', 'why': 'review', 'since': 1},
+ ),
+ taskFixture(
+ 'repair',
+ 'Repair the release notes',
+ 21,
+ requester: 'scholes',
+ status: 'done',
+ pullRequest: 3773,
+ ),
+ taskFixture(
+ 'releasing',
+ 'Board fits the middle',
+ 22,
+ requester: 'owner',
+ status: 'done',
+ pullRequest: 3774,
+ merged: true,
+ releasing: ['desktop'],
+ ),
+ for (var i = 0; i < 4; i++)
+ taskFixture(
+ 'shipped-$i',
+ 'Shipped task $i',
+ 30 + i,
+ requester: 'ken',
+ status: 'done',
+ pullRequest: 3780 + i,
+ merged: true,
+ shippedAt: _now.subtract(Duration(hours: i + 1)),
+ ),
+ ]);
+ return server;
+}
+
+Future<SuperTabController> _show(
+ WidgetTester tester,
+ ConversationServer server, {
+ double width = 860,
+}) async {
+ await tester.binding.setSurfaceSize(Size(width, 860));
+ addTearDown(() => tester.binding.setSurfaceSize(null));
+ final c = server.controller();
+ await c.refresh();
+ await tester.pumpWidget(
+ MaterialApp(
+ theme: grid.buildAppTheme(brightness: Brightness.light),
+ builder: (context, child) => MediaQuery(
+ data: MediaQuery.of(context).copyWith(disableAnimations: true),
+ child: child!,
+ ),
+ home: Scaffold(
+ body: SuperTabTasksView(
+ controller: c,
+ project: c.snapshot!.projects.single,
+ storage: MemoryKeyValueStore(),
+ needsHuman: (_) => 0,
+ onOpenTask: (_) {},
+ onOpenProposal: (_) {},
+ onOpenMessage: (_, _) {},
+ now: () => _now,
+ ),
+ ),
+ ),
+ );
+ await tester.pumpAndSettle();
+ return c;
+}
+
+Future<void> _close(WidgetTester tester, SuperTabController c) async {
+ await tester.pumpWidget(const SizedBox());
+ await c.flush();
+ c.dispose();
+}
+
+const _names = ['proposals', 'nextUp', 'working', 'done', 'merged', 'shipped'];
+
+/// Whether every column that starts inside the Board's view ends inside it.
+void _expectWhole(WidgetTester tester) {
+ final view = tester.getRect(_board);
+ for (final name in _names) {
+ final rect = tester.getRect(_column(name));
+ if (rect.right <= view.left + .5 || rect.left >= view.right - .5) continue;
+ expect(rect.left, greaterThanOrEqualTo(view.left - .5), reason: name);
+ expect(rect.right, lessThanOrEqualTo(view.right + .5), reason: name);
+ }
+}
+
+void main() {
+ testWidgets('an empty column is a slim lane with its name and 0, no '
+ '"No tasks" panel', (tester) async {
+ final c = await _show(tester, _server());
+ expect(
+ tester.getSize(_column('proposals')).width,
+ SuperTabTasksView.slimColumnWidth,
+ );
+ expect(
+ find.descendant(
+ of: _column('proposals'),
+ matching: find.text('No tasks'),
+ ),
+ findsNothing,
+ );
+ final heading = _key('super-tasks-heading-proposals');
+ expect(
+ find.descendant(of: heading, matching: find.text('Proposal')),
+ findsOneWidget,
+ );
+ expect(
+ find.descendant(of: heading, matching: find.text('0')),
+ findsOneWidget,
+ );
+ await _close(tester, c);
+ });
+
+ testWidgets('a slim lane that gets a task is a full column at once', (
+ tester,
+ ) async {
+ final server = tasksServer();
+ final c = await _show(tester, server, width: 1500);
+ expect(
+ tester.getSize(_column('done')).width,
+ SuperTabTasksView.slimColumnWidth,
+ );
+ (server.state['conversations'] as List).add(
+ taskFixture('repair', 'Repair the release notes', 21, status: 'done'),
+ );
+ await c.refresh();
+ await tester.pumpAndSettle();
+ expect(
+ tester.getSize(_column('done')).width,
+ greaterThanOrEqualTo(SuperTabTasksView.minColumnWidth),
+ );
+ expect(
+ find.descendant(
+ of: _column('done'),
+ matching: _key('super-task-card-repair'),
+ ),
+ findsOneWidget,
+ );
+ await _close(tester, c);
+ });
+
+ testWidgets('in an 860 middle every column in view is whole, never under '
+ 'the least width', (tester) async {
+ final c = await _show(tester, _server());
+ _expectWhole(tester);
+ for (final name in _names.skip(1)) {
+ expect(
+ tester.getSize(_column(name)).width,
+ greaterThanOrEqualTo(SuperTabTasksView.minColumnWidth),
+ reason: name,
+ );
+ }
+ expect(tester.getTopLeft(_column('done')).dx, lessThan(860));
+ await _close(tester, c);
+ });
+
+ testWidgets('a pill names the columns out of view and scrolls them in', (
+ tester,
+ ) async {
+ final c = await _show(tester, _server());
+ final more = _key('super-tasks-board-more-right');
+ expect(
+ find.descendant(of: more, matching: find.text('Merged 1 · Shipped 5')),
+ findsOneWidget,
+ );
+ expect(_key('super-tasks-board-more-left'), findsNothing);
+ await tester.tap(more);
+ await tester.pumpAndSettle();
+ final view = tester.getRect(_board);
+ for (final name in ['merged', 'shipped']) {
+ final rect = tester.getRect(_column(name));
+ expect(rect.left, greaterThanOrEqualTo(view.left), reason: name);
+ expect(rect.right, lessThanOrEqualTo(view.right), reason: name);
+ }
+ expect(more, findsNothing, reason: 'nothing is out of view on the right');
+ // The columns now out of view on the left are named there.
+ final back = _key('super-tasks-board-more-left');
+ expect(
+ find.descendant(of: back, matching: find.textContaining('Next up 2')),
+ findsOneWidget,
+ );
+ await tester.tap(back);
+ await tester.pumpAndSettle();
+ expect(tester.getTopLeft(_column('nextUp')).dx, greaterThanOrEqualTo(0));
+ await _close(tester, c);
+ });
+
+ testWidgets('Mine keeps the fit: what it empties turns slim', (tester) async {
+ final c = await _show(tester, _server());
+ await tester.tap(_key('super-tasks-mine'));
+ await tester.pumpAndSettle();
+ // Only the owner's two asks are left, in Working and Merged.
+ for (final name in ['proposals', 'nextUp', 'done', 'shipped']) {
+ expect(
+ tester.getSize(_column(name)).width,
+ SuperTabTasksView.slimColumnWidth,
+ reason: name,
+ );
+ }
+ _expectWhole(tester);
+ expect(_key('super-tasks-board-more-right'), findsNothing);
+ await _close(tester, c);
+ });
+
+ testWidgets("a card's mark names its state in a tooltip", (tester) async {
+ final c = await _show(tester, _server(), width: 2400);
+ for (final (card, word) in [
+ ('review', 'In review'),
+ ('tag', 'Working'),
+ ('test-copy', 'Waiting on a person'),
+ ('preview', 'Queued'),
+ ('shipped-0', 'Shipped'),
+ ]) {
+ expect(
+ find.descendant(
+ of: _key('super-task-card-$card'),
+ matching: find.byTooltip(word),
+ ),
+ findsOneWidget,
+ reason: card,
+ );
+ }
+ await _close(tester, c);
+ });
+}
diff --git a/desktop/test/super_tab_board_layout_test.dart b/desktop/test/super_tab_board_layout_test.dart
index 1ba9a12c7..32e711259 100644
--- a/desktop/test/super_tab_board_layout_test.dart
+++ b/desktop/test/super_tab_board_layout_test.dart
@@ -353,14 +353,16 @@ void main() {
await _settle(tester);
expectFixedPanes(tester);
expect(_key('super-tasks-lead'), findsOneWidget);
- expect(tester.getSize(_key('super-right-pane')).width, 340);
+ // The Tasks pane gives back to its minimum so the Board keeps room (#4211).
+ expect(tester.getSize(_key('super-right-pane')).width, 280);
expect(tester.takeException(), isNull);
await end(tester, c);
},
);
testWidgets(
- 'the right pane stays 340 whatever width was saved, and has no divider',
+ 'the right pane keeps its width whatever width was saved, and has no '
+ 'divider',
(tester) async {
final store = MemoryKeyValueStore()
..values[SuperTabPaneLayout.storageKey] =
@@ -372,7 +374,8 @@ void main() {
expect(_key('super-resize-right'), findsNothing);
await tester.binding.setSurfaceSize(const Size(880, 900));
await _settle(tester);
- expect(tester.getSize(_key('super-right-pane')).width, 340);
+ // At the window minimum the Tasks pane is at its own minimum (#4211).
+ expect(tester.getSize(_key('super-right-pane')).width, 280);
expectFixedPanes(tester);
expect(tester.takeException(), isNull);
await end(tester, c);
@@ -446,7 +449,7 @@ void main() {
final right = tester.getSize(_key('super-right-pane')).width;
final center = tester.getSize(_key('super-center-pane')).width;
expect(left, greaterThanOrEqualTo(180));
- expect(right, greaterThanOrEqualTo(340));
+ expect(right, greaterThanOrEqualTo(SuperTabPaneLayout.rightWidth));
expect(center, greaterThanOrEqualTo(280));
expect(left + center + right, closeTo(width, 0.01));
// The Board itself is drawn, not an empty centre.
diff --git a/desktop/test/super_tab_buddy_row_fit_test.dart b/desktop/test/super_tab_buddy_row_fit_test.dart
new file mode 100644
index 000000000..58b4fc1d2
--- /dev/null
+++ b/desktop/test/super_tab_buddy_row_fit_test.dart
@@ -0,0 +1,48 @@
+// Task #4251 (Mac test of #3481): at the left pane's 180 minimum, a row's name stays whole and its quiet note gives
+// way, never "Bu… no…".
+import 'package:flutter/material.dart';
+import 'package:flutter/rendering.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/shared/theme/app_theme.dart' as grid;
+import 'package:harness/super_tabs/buddy_rows.dart';
+
+void main() {
+ Future<void> row(WidgetTester t, {required String note}) => t.pumpWidget(
+ MaterialApp(
+ theme: grid.buildAppTheme(brightness: Brightness.light),
+ home: Scaffold(
+ body: Align(
+ alignment: Alignment.topLeft,
+ child: SizedBox(
+ width: 180,
+ child: SuperTabBuddyRow(
+ agentId: null,
+ name: 'Buddy',
+ note: note,
+ tooltip: 'Your Buddy',
+ onTap: () {},
+ ),
+ ),
+ ),
+ ),
+ ),
+ );
+
+ bool cut(WidgetTester t, String text) =>
+ t.renderObject<RenderParagraph>(find.text(text)).didExceedMaxLines;
+
+ testWidgets('the name stays whole and the note gives way at 180', (
+ t,
+ ) async {
+ await row(t, note: 'not started');
+ expect(cut(t, 'Buddy'), isFalse);
+ expect(t.takeException(), isNull);
+ });
+
+ testWidgets('a long note is cut, the name is not', (t) async {
+ await row(t, note: 'not started on any of your computers yet');
+ expect(cut(t, 'Buddy'), isFalse);
+ expect(cut(t, 'not started on any of your computers yet'), isTrue);
+ expect(t.takeException(), isNull);
+ });
+}
diff --git a/desktop/test/super_tab_decisions_empty_test.dart b/desktop/test/super_tab_decisions_empty_test.dart
new file mode 100644
index 000000000..c9b43e6f9
--- /dev/null
+++ b/desktop/test/super_tab_decisions_empty_test.dart
@@ -0,0 +1,72 @@
+// Audit finding 14 (task #4211): with every decision answered, Decisions is a
+// calm all-clear in the middle of the page, saying how much of the crew's
+// work is moving, not a small line at the top of a blank page.
+import 'package:flutter/material.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/super_tabs/activity.dart';
+
+import 'super_tab_activity_lists_test.dart' show swarm;
+import 'super_tab_pages_test.dart' show loaded, show;
+import 'support/super_tab_fixture.dart';
+
+/// [count] tasks of the project an agent works on.
+ConversationServer withMoving(int count) {
+ final server = swarm()..followedThreads = null;
+ final conversations = server.state['conversations'] as List;
+ for (var i = 0; i < count; i++) {
+ conversations.add(<String, dynamic>{
+ ...conversationFixture('moving-$i', 'Moving task $i'),
+ 'projectId': 'lead',
+ 'agentIds': ['kestrel'],
+ 'assignment': {'id': 'm$i', 'agentId': 'kestrel', 'status': 'working'},
+ });
+ }
+ // Done and waiting to merge, and not yet handed out: neither is moving.
+ conversations
+ ..add(<String, dynamic>{
+ ...conversationFixture('finished', 'Finished task'),
+ 'projectId': 'lead',
+ 'agentIds': ['kestrel'],
+ 'assignment': {'id': 'f', 'agentId': 'kestrel', 'status': 'done'},
+ })
+ ..add(<String, dynamic>{
+ ...conversationFixture('queued', 'Queued task'),
+ 'projectId': 'lead',
+ });
+ return server;
+}
+
+void main() {
+ for (final brightness in Brightness.values) {
+ testWidgets('nothing to decide is an all-clear in the middle, with the '
+ 'tasks moving (${brightness.name})', (tester) async {
+ final SuperTabActivity activity = await loaded(tester, withMoving(4));
+ await show(tester, activity, brightness: brightness);
+ expect(find.text('Nothing needs you'), findsNothing);
+ final title = find.text('All clear');
+ expect(title, findsOneWidget);
+ expect(find.text('Your crew has what it needs'), findsOneWidget);
+ expect(find.text('4 tasks moving'), findsOneWidget);
+ // In the middle of the page, not at its top.
+ final page = tester.getRect(find.byType(Scaffold));
+ final at = tester.getCenter(title);
+ expect((at.dx - page.center.dx).abs(), lessThan(4));
+ expect((at.dy - page.center.dy).abs(), lessThan(page.height / 8));
+ expect(tester.takeException(), isNull);
+ });
+ }
+
+ testWidgets('one task moving says so in the singular', (tester) async {
+ await show(tester, await loaded(tester, withMoving(1)));
+ expect(find.text('1 task moving'), findsOneWidget);
+ });
+
+ testWidgets('with nothing moving the all-clear leaves the count out', (
+ tester,
+ ) async {
+ await show(tester, await loaded(tester, withMoving(0)));
+ expect(find.text('All clear'), findsOneWidget);
+ expect(find.text('Your crew has what it needs'), findsOneWidget);
+ expect(find.textContaining('moving'), findsNothing);
+ });
+}
diff --git a/desktop/test/super_tab_decisions_leaderboard_shots_test.dart b/desktop/test/super_tab_decisions_leaderboard_shots_test.dart
new file mode 100644
index 000000000..aa4d20ee2
--- /dev/null
+++ b/desktop/test/super_tab_decisions_leaderboard_shots_test.dart
@@ -0,0 +1,67 @@
+// Audit findings 14 and 15 (task #4251): the all-clear Decisions and the
+// weekly Leaderboard with the reader second, for the PR's pictures, light and
+// dark. Writes nothing unless HARNESS_SUPER_TAB_CAPTURE names a folder.
+import 'dart:io';
+
+import 'package:flutter/material.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/shared/theme/app_theme.dart' as grid;
+import 'package:harness/super_tabs/decisions_page.dart';
+
+import 'super_tab_decisions_empty_test.dart' show withMoving;
+import 'super_tab_leaderboard_you_test.dart' show secondPlace;
+import 'super_tab_pages_test.dart' show loaded;
+import 'super_tab_weekly_leaderboard_test.dart' show showBoard;
+import 'support/capture.dart';
+
+final shots = Platform.environment['HARNESS_SUPER_TAB_CAPTURE'];
+
+void main() {
+ setUpAll(() => loadCaptureFonts(shots));
+
+ for (final brightness in Brightness.values) {
+ testWidgets('all-clear Decisions in ${brightness.name}', (tester) async {
+ await tester.binding.setSurfaceSize(const Size(900, 640));
+ addTearDown(() => tester.binding.setSurfaceSize(null));
+ // The app's own ink follows the theme it is drawn in.
+ grid.AppTheme.brightness.value = brightness;
+ addTearDown(() => grid.AppTheme.brightness.value = Brightness.dark);
+ final activity = await loaded(tester, withMoving(4));
+ await tester.pumpWidget(
+ MaterialApp(
+ debugShowCheckedModeBanner: false,
+ theme: grid.buildAppTheme(brightness: brightness),
+ home: Scaffold(
+ body: SuperTabDecisionsPage(
+ activity: activity,
+ onOpenConversation: (_) {},
+ ),
+ ),
+ ),
+ );
+ await tester.pumpAndSettle();
+ expect(find.text('All clear'), findsOneWidget);
+ await captureWindow(
+ tester,
+ shots,
+ 'decisions-all-clear-${brightness.name}',
+ );
+ });
+
+ testWidgets('Leaderboard with the reader second in ${brightness.name}', (
+ tester,
+ ) async {
+ // The test's namesake (another person called Dee) proves You follows
+ // the account; the picture shows the plain board.
+ final server = secondPlace();
+ (server.leaderboard!['people'] as List)
+ .cast<Map<String, dynamic>>()
+ .firstWhere((p) => p['personId'] == 'scholes')['displayName'] =
+ 'Scholes';
+ await showBoard(tester, server, brightness: brightness);
+ await tester.pumpAndSettle();
+ expect(find.text('You'), findsOneWidget);
+ await captureWindow(tester, shots, 'leaderboard-you-${brightness.name}');
+ });
+ }
+}
diff --git a/desktop/test/super_tab_decisions_test.dart b/desktop/test/super_tab_decisions_test.dart
index 2a35f9f59..415730091 100644
--- a/desktop/test/super_tab_decisions_test.dart
+++ b/desktop/test/super_tab_decisions_test.dart
@@ -396,7 +396,7 @@ void main() {
await showView(tester, swarm());
await tester.tap(notificationsEntry());
await tester.pumpAndSettle();
- expect(find.text('Nothing needs you'), findsOneWidget);
+ expect(find.text('All clear'), findsOneWidget);
});
});
diff --git a/desktop/test/super_tab_leaderboard_you_test.dart b/desktop/test/super_tab_leaderboard_you_test.dart
new file mode 100644
index 000000000..ed764c007
--- /dev/null
+++ b/desktop/test/super_tab_leaderboard_you_test.dart
@@ -0,0 +1,99 @@
+// Audit finding 15 (task #4211): the reader finds themselves on the weekly
+// Leaderboard (their row filled and saying "You"), a week with no streak reads
+// a dash, and the top three each carry a mark beside their place.
+import 'package:flutter/material.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/shared/theme/app_theme.dart' as grid;
+import 'package:harness/super_tabs/leaderboard/weekly_page.dart';
+
+import 'super_tab_weekly_leaderboard_test.dart' show showBoard, weeklySwarm;
+import 'support/super_tab_fixture.dart';
+
+/// The weekly board with the reader, Dee (`peer`), second; a teammate is
+/// also called Dee, so only the account says which row is the reader's.
+ConversationServer secondPlace() {
+ final server = weeklySwarm();
+ final people = (server.leaderboard!['people'] as List)
+ .cast<Map<String, dynamic>>();
+ final dee = people.removeAt(0)..['rank'] = 2;
+ people.first
+ ..['rank'] = 1
+ ..['points'] = 34;
+ people.insert(1, dee);
+ people.firstWhere((p) => p['personId'] == 'scholes')['displayName'] = 'Dee';
+ return server;
+}
+
+Finder _row(String id) => find.byKey(ValueKey('weekly-row-$id'));
+
+Finder _in(String id, Finder what) =>
+ find.descendant(of: _row(id), matching: what);
+
+Color? _fill(WidgetTester tester, String id) =>
+ (tester.widget<Container>(_row(id)).decoration as BoxDecoration?)?.color;
+
+void main() {
+ testWidgets('the reader\'s row is filled and says You, found by account', (
+ tester,
+ ) async {
+ await showBoard(tester, secondPlace());
+ await tester.pumpAndSettle();
+ expect(_in('peer', find.text('You')), findsOneWidget);
+ expect(find.text('You'), findsOneWidget);
+ expect(_fill(tester, 'peer'), grid.AppSurface.selectedFill);
+ for (final other in ['tony', 'owner', 'scholes']) {
+ expect(_fill(tester, other), isNot(grid.AppSurface.selectedFill));
+ }
+ expect(tester.takeException(), isNull);
+ });
+
+ testWidgets('You follows the signed-in account to a new controller', (
+ tester,
+ ) async {
+ final server = secondPlace();
+ await showBoard(tester, server);
+ await tester.pumpAndSettle();
+ final ken = server.controller(
+ account: 'owner',
+ initial: {'tabId': 'tab', 'accountId': 'owner', 'selectedId': 'lead'},
+ );
+ addTearDown(ken.dispose);
+ await ken.refresh();
+ await tester.pumpWidget(
+ MaterialApp(
+ theme: grid.buildAppTheme(brightness: Brightness.light),
+ home: Scaffold(body: SuperTabWeeklyLeaderboardPage(controller: ken)),
+ ),
+ );
+ await tester.pumpAndSettle();
+ expect(_in('owner', find.text('You')), findsOneWidget);
+ expect(_in('peer', find.text('You')), findsNothing);
+ expect(_fill(tester, 'owner'), grid.AppSurface.selectedFill);
+ });
+
+ testWidgets('a week with no streak reads a dash, not 0d', (tester) async {
+ await showBoard(tester, secondPlace());
+ await tester.pumpAndSettle();
+ expect(find.text('0d'), findsNothing);
+ expect(_in('scholes', find.text('–')), findsOneWidget);
+ expect(_in('tony', find.text('2d')), findsOneWidget);
+ });
+
+ testWidgets('the top three carry a mark beside their place, said in words', (
+ tester,
+ ) async {
+ await showBoard(tester, secondPlace());
+ await tester.pumpAndSettle();
+ final marks = find.byType(Icon);
+ for (final (id, place, words) in [
+ ('tony', '1', 'Number one this week'),
+ ('peer', '2', 'Number two this week'),
+ ('owner', '3', 'Number three this week'),
+ ]) {
+ expect(tester.widget<Icon>(_in(id, marks)).semanticLabel, words);
+ // The place is still its numeral, beside the mark.
+ expect(_in(id, find.text(place)), findsWidgets);
+ }
+ expect(_in('scholes', marks), findsNothing);
+ });
+}
diff --git a/desktop/test/super_tab_pages_test.dart b/desktop/test/super_tab_pages_test.dart
index 9be0875e9..2e56f3ba3 100644
--- a/desktop/test/super_tab_pages_test.dart
+++ b/desktop/test/super_tab_pages_test.dart
@@ -275,7 +275,7 @@ void main() {
}
await withClock(Clock.fixed(_now), () async {
await show(tester, await loaded(tester, server));
- expect(find.text('Nothing needs you'), findsOneWidget);
+ expect(find.text('All clear'), findsOneWidget);
expect(
find.text('Product Manager handled 2 for you today'),
findsOneWidget,
@@ -416,7 +416,7 @@ void main() {
final hold = server.holdDecisions = Completer<void>();
await show(tester, await _unread(tester, server));
expect(_key('super-activity-skeleton'), findsOneWidget);
- expect(find.text('Nothing needs you'), findsNothing);
+ expect(find.text('All clear'), findsNothing);
await tester.runAsync(() async {
hold.complete();
await Future<void>.delayed(const Duration(milliseconds: 80));
@@ -427,8 +427,8 @@ void main() {
});
});
- testWidgets('a failed decisions read says so with Retry, not "Nothing '
- 'needs you"', (tester) async {
+ testWidgets('a failed decisions read says so with Retry, not "All '
+ 'clear"', (tester) async {
await withClock(Clock.fixed(_now), () async {
final server = swarm()..followedThreads = null;
server.ask(['Late?']);
@@ -438,7 +438,7 @@ void main() {
find.text('Could not load decisions. Try again.'),
findsOneWidget,
);
- expect(find.text('Nothing needs you'), findsNothing);
+ expect(find.text('All clear'), findsNothing);
expect(_key('super-activity-skeleton'), findsNothing);
server.failDecisions = false;
await _tapSending(tester, find.text('Retry'));
@@ -453,7 +453,7 @@ void main() {
final server = swarm()..followedThreads = null;
final activity = await loaded(tester, server);
await show(tester, activity, brightness: brightness);
- expect(find.text('Nothing needs you'), findsOneWidget);
+ expect(find.text('All clear'), findsOneWidget);
expect(_key('super-activity-decide-all'), findsNothing);
});
}
diff --git a/desktop/test/super_tab_pane_minimums_shots_test.dart b/desktop/test/super_tab_pane_minimums_shots_test.dart
new file mode 100644
index 000000000..b57e48ddd
--- /dev/null
+++ b/desktop/test/super_tab_pane_minimums_shots_test.dart
@@ -0,0 +1,129 @@
+// Task #4251 (findings 8 and 10 of #4211): the Board layout in a 900-wide window and the Reject dialog, for the
+// PR's pictures, light and dark. Writes nothing unless HARNESS_SUPER_TAB_CAPTURE names a folder.
+import 'dart:io';
+
+import 'package:flutter/material.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/shared/theme/app_theme.dart' as grid;
+import 'package:harness/super_tabs/tasks/personal_tasks_pane.dart';
+import 'package:harness/super_tabs/view.dart';
+import 'package:harness/super_tabs/zone_time.dart';
+
+import 'super_tab_activity_lists_test.dart' show swarm;
+import 'super_tab_personal_tasks_pane_test.dart' show TasksFixture;
+import 'super_tab_personal_tasks_test.dart' show task;
+import 'support/capture.dart';
+import 'support/memory_key_value_store.dart';
+import 'support/super_tab_fixture.dart';
+
+final shots = Platform.environment['HARNESS_SUPER_TAB_CAPTURE'];
+
+void main() {
+ setUpAll(() async {
+ await superTabLoadZones();
+ await loadCaptureFonts(shots);
+ });
+
+ for (final brightness in Brightness.values) {
+ testWidgets('the Board layout at 900 wide in ${brightness.name}', (
+ tester,
+ ) async {
+ if (shots == null) return;
+ final previous = grid.AppTheme.brightness.value;
+ grid.AppTheme.brightness.value = brightness;
+ addTearDown(() => grid.AppTheme.brightness.value = previous);
+ await tester.binding.setSurfaceSize(const Size(900, 700));
+ addTearDown(() => tester.binding.setSurfaceSize(null));
+ final server = swarm();
+ (server.state['conversations'] as List).add({
+ ...conversationFixture('buddy-owner-lead', 'Buddy'),
+ 'kind': 'buddy',
+ 'projectId': 'lead',
+ 'buddyOwnerId': 'owner',
+ 'agentIds': <String>[],
+ });
+ server.append(
+ 'What shall we work on?',
+ conversationId: 'buddy-owner-lead',
+ );
+ final c = server.controller(
+ account: 'owner',
+ initial: {
+ 'tabId': 'tab',
+ 'projectsGroupOpen': true,
+ 'accountId': 'owner',
+ 'selectedId': 'buddy-owner-lead',
+ },
+ );
+ await tester.runAsync(c.refresh);
+ await tester.pumpWidget(
+ MaterialApp(
+ debugShowCheckedModeBanner: false,
+ theme: grid.buildAppTheme(brightness: brightness),
+ home: Scaffold(
+ body: SuperTabView(
+ controller: c,
+ onInvite: () {},
+ onAddAgent: (_) {},
+ onOpenTerminal: (_) {},
+ machineName: (_) => 'Mac Studio',
+ paneStore: MemoryKeyValueStore(),
+ board: true,
+ ),
+ ),
+ ),
+ );
+ await tester.pumpAndSettle();
+ await tester.tap(find.byKey(const ValueKey('super-group-lead')));
+ await tester.pumpAndSettle();
+ expect(tester.takeException(), isNull);
+ await captureWindow(tester, shots, 'board-900-${brightness.name}');
+ await tester.pumpWidget(const SizedBox());
+ c.dispose();
+ await tester.pump(const Duration(seconds: 5));
+ });
+
+ testWidgets('the Reject dialog in ${brightness.name}', (t) async {
+ if (shots == null) return;
+ final f = TasksFixture();
+ addTearDown(f.controller.dispose);
+ f.mode = 'review';
+ f.rows
+ ..clear()
+ ..add({
+ ...task('second', 1, 30),
+ 'title': 'Add the project export',
+ 'projectName': 'Desktop',
+ });
+ await f.controller.refresh();
+ t.view.physicalSize = const Size(440, 560);
+ t.view.devicePixelRatio = 1;
+ addTearDown(t.view.reset);
+ final previous = grid.AppTheme.brightness.value;
+ grid.AppTheme.brightness.value = brightness;
+ addTearDown(() => grid.AppTheme.brightness.value = previous);
+ await t.pumpWidget(
+ MaterialApp(
+ debugShowCheckedModeBanner: false,
+ theme: grid.buildAppTheme(brightness: brightness),
+ home: Scaffold(
+ body: SuperTabPersonalTasksPane(
+ controller: f.controller,
+ onOpenTask: (_) {},
+ ),
+ ),
+ ),
+ );
+ await t.pumpAndSettle();
+ await t.tap(find.text('Add the project export'));
+ await t.pumpAndSettle();
+ await captureWindow(t, shots, 'tasks-open-row-${brightness.name}');
+ await t.tap(find.text('Reject'));
+ await t.pumpAndSettle();
+ expect(t.takeException(), isNull);
+ await captureWindow(t, shots, 'reject-dialog-${brightness.name}');
+ await t.tap(find.text('Cancel'));
+ await t.pumpAndSettle();
+ });
+ }
+}
diff --git a/desktop/test/super_tab_pane_minimums_test.dart b/desktop/test/super_tab_pane_minimums_test.dart
new file mode 100644
index 000000000..26e31511e
--- /dev/null
+++ b/desktop/test/super_tab_pane_minimums_test.dart
@@ -0,0 +1,42 @@
+// Task #4251 (finding 8 of #4211): in a small window the Board keeps two columns while the side panes can give:
+// the left pane gives back first, then the Tasks pane down to its own minimum.
+import 'package:flutter/material.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/super_tabs/pane_layout.dart';
+
+import 'support/memory_key_value_store.dart';
+
+Finder _key(String k) => find.byKey(ValueKey(k));
+
+void main() {
+ for (final (width, left, center, right) in [
+ (1500.0, 300.0, 860.0, 340.0),
+ (1100.0, 200.0, 560.0, 340.0),
+ (1040.0, 180.0, 560.0, 300.0),
+ (900.0, 180.0, 440.0, 280.0),
+ (880.0, 180.0, 420.0, 280.0),
+ ]) {
+ testWidgets('the Board layout at $width wide is '
+ '$left | $center | $right', (tester) async {
+ await tester.binding.setSurfaceSize(Size(width, 800));
+ addTearDown(() => tester.binding.setSurfaceSize(null));
+ await tester.pumpWidget(
+ MaterialApp(
+ home: SuperTabPaneLayout(
+ storage: MemoryKeyValueStore(),
+ onLeave: () {},
+ rightFixed: true,
+ rightDefault: SuperTabPaneLayout.boardRightWidth,
+ left: const ColoredBox(color: Colors.black),
+ right: const ColoredBox(color: Colors.black),
+ center: const ColoredBox(color: Colors.white),
+ ),
+ ),
+ );
+ await tester.pumpAndSettle();
+ expect(tester.getSize(_key('super-left-pane')).width, left);
+ expect(tester.getSize(_key('super-center-pane')).width, center);
+ expect(tester.getSize(_key('super-right-pane')).width, right);
+ });
+ }
+}
diff --git a/desktop/test/super_tab_private_mention_test.dart b/desktop/test/super_tab_private_mention_test.dart
new file mode 100644
index 000000000..43539e79f
--- /dev/null
+++ b/desktop/test/super_tab_private_mention_test.dart
@@ -0,0 +1,80 @@
+import 'package:flutter/material.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/super_tabs/controller.dart';
+
+import 'super_tab_agent_face_test.dart' show agentFaceSwarm, showAgentFaces;
+import 'support/super_tab_fixture.dart';
+
+/// The Swarm of the agent faces, with people to tag: Ken, who set his name,
+/// and Dee, who did not.
+ConversationServer privateMentionSwarm() {
+ final server = agentFaceSwarm();
+ server.state['people'] = [
+ {'id': 'owner', 'email': '[email protected]', 'role': 'owner'},
+ {
+ 'id': 'ken',
+ 'email': '[email protected]',
+ 'role': 'collaborator',
+ 'name': 'Ken Tran',
+ },
+ {'id': 'dee', 'email': '[email protected]', 'role': 'collaborator'},
+ ];
+ return server;
+}
+
+/// Audit finding 12 of task #4211: in Kestrel's own chat, which only its
+/// person reads, @ offered every person in the Swarm. It offers the agent.
+void main() {
+ final composer = find.byKey(const ValueKey('super-message-composer'));
+ final picker = find.byKey(const ValueKey('super-composer-completions'));
+
+ List<String> offered(WidgetTester tester) => [
+ for (final tile in tester.widgetList<ListTile>(
+ find.descendant(of: picker, matching: find.byType(ListTile)),
+ ))
+ (tile.title as Text).data!,
+ ];
+
+ Future<void> type(WidgetTester tester, String text) async {
+ await tester.tap(composer);
+ await tester.enterText(composer, text);
+ await tester.pump();
+ }
+
+ Future<void> end(WidgetTester tester, SuperTabController c) async {
+ await tester.pumpWidget(const SizedBox());
+ await tester.runAsync(c.flush);
+ c.dispose();
+ }
+
+ testWidgets('in an agent\'s own chat @ offers that agent and no people', (
+ tester,
+ ) async {
+ final c = await showAgentFaces(
+ tester,
+ privateMentionSwarm(),
+ selectedId: 'agent-chat-kestrel',
+ );
+ await type(tester, 'Please check @');
+ expect(offered(tester), ['Kestrel']);
+ await type(tester, 'Please check @ke');
+ expect(offered(tester), ['Kestrel']);
+ await end(tester, c);
+ });
+
+ // A PM's chat is its project's chat (backend agentKind.ts agentChatId):
+ // shared, so it keeps its people.
+ testWidgets('in a project chat, its PM\'s chat too, @ still offers people '
+ 'by the name they show', (tester) async {
+ final c = await showAgentFaces(
+ tester,
+ privateMentionSwarm(),
+ selectedId: 'lead',
+ );
+ await type(tester, 'Please check @');
+ expect(offered(tester).take(2), ['Ken Tran', 'dee']);
+ await type(tester, 'Please check @ke');
+ expect(offered(tester), ['Ken Tran']);
+ await end(tester, c);
+ });
+}
diff --git a/desktop/test/super_tab_prompt_waits_test.dart b/desktop/test/super_tab_prompt_waits_test.dart
index 324cd2218..edf6345e0 100644
--- a/desktop/test/super_tab_prompt_waits_test.dart
+++ b/desktop/test/super_tab_prompt_waits_test.dart
@@ -156,7 +156,7 @@ void main() {
await tester.pumpAndSettle();
expect(_key('super-activity-row-prompt:wren'), findsNothing);
expect(activity.needsCount, 0);
- expect(find.text('Nothing needs you'), findsOneWidget);
+ expect(find.text('All clear'), findsOneWidget);
});
});
diff --git a/desktop/test/super_tab_quick_switcher_test.dart b/desktop/test/super_tab_quick_switcher_test.dart
index 82fb6224d..ece6d0cc7 100644
--- a/desktop/test/super_tab_quick_switcher_test.dart
+++ b/desktop/test/super_tab_quick_switcher_test.dart
@@ -601,6 +601,66 @@ void main() {
final shots = Platform.environment['SWARM_QUICK_SWITCHER_SHOTS'];
setUpAll(() => loadCaptureFonts(shots));
+
+ for (final brightness in Brightness.values) {
+ testWidgets(
+ 'finds a Regular agent by name and opens its own chat (audit #4211, 11): ${brightness.name}',
+ (tester) async {
+ final previous = grid.AppTheme.brightness.value;
+ grid.AppTheme.brightness.value = brightness;
+ addTearDown(() => grid.AppTheme.brightness.value = previous);
+ final (f, c) = await setup(tester);
+ // A v3 Regular agent: no project, its person's chat with it named by the server.
+ (f.connection.server.state['agents'] as List).add({
+ 'id': 'wren',
+ 'name': 'Builder',
+ 'displayName': 'Wren',
+ 'projectId': '',
+ 'machineId': 'm1',
+ 'harnessId': 'wren-harness',
+ 'contributorId': c.accountId,
+ 'kind': 'regular',
+ 'chatId': 'agent-chat-wren',
+ 'configuration': {'engine': 'claude', 'model': 'opus'},
+ });
+ (f.connection.server.state['conversations'] as List).add({
+ ...conversationFixture('agent-chat-wren', 'Wren'),
+ 'kind': 'agent-chat',
+ 'agentIds': ['wren'],
+ });
+ f.connection.server.revision++;
+ await c.refresh();
+ await tester.pump();
+ await open(tester);
+ final query = find.byKey(const ValueKey('swarm-quick-query'));
+ await tester.enterText(query, 'Wren');
+ await tester.pump();
+ expect(
+ find.byKey(
+ const ValueKey('swarm-quick-conversation:agent-chat-wren'),
+ ),
+ findsOneWidget,
+ );
+ // One row for the agent, and picking it opens its chat, not a details card.
+ expect(
+ find.byKey(const ValueKey('swarm-quick-agent:wren')),
+ findsNothing,
+ );
+ expect(find.text('Your agent'), findsOneWidget);
+ await captureWindow(
+ tester,
+ shots,
+ 'cmdk-agent-found-${brightness.name}',
+ );
+ await key(tester, LogicalKeyboardKey.enter);
+ await tester.pumpAndSettle();
+ expect(c.selectedId, 'agent-chat-wren');
+ await close(tester, f, c);
+ },
+ variant: TargetPlatformVariant.only(TargetPlatform.macOS),
+ );
+ }
+
for (final brightness in Brightness.values) {
testWidgets(
'switcher in ${brightness.name}, empty state and enlarged type',
diff --git a/desktop/test/super_tab_reject_dialog_test.dart b/desktop/test/super_tab_reject_dialog_test.dart
new file mode 100644
index 000000000..0cd0adeed
--- /dev/null
+++ b/desktop/test/super_tab_reject_dialog_test.dart
@@ -0,0 +1,88 @@
+// Task #4251 (finding 10 of #4211): Reject's dialog names the task, and the open row's agent picker reads at the
+// row's own text size.
+import 'package:flutter/material.dart';
+import 'package:flutter/rendering.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/super_tabs/tasks/personal_tasks_pane.dart';
+import 'package:harness/super_tabs/zone_time.dart';
+
+import 'super_tab_personal_tasks_pane_test.dart' show TasksFixture;
+
+void main() {
+ setUpAll(superTabLoadZones);
+
+ Future<TasksFixture> mount(WidgetTester t, String title) async {
+ final f = TasksFixture();
+ addTearDown(f.controller.dispose);
+ f.rows.last['title'] = title;
+ await f.controller.refresh();
+ await t.pumpWidget(
+ MaterialApp(
+ home: Scaffold(
+ body: SizedBox(
+ width: 340,
+ child: SuperTabPersonalTasksPane(
+ controller: f.controller,
+ onOpenTask: (_) {},
+ ),
+ ),
+ ),
+ ),
+ );
+ await t.tap(find.text(title));
+ await t.pump();
+ return f;
+ }
+
+ TextStyle drawn(WidgetTester t, Finder text) =>
+ t.renderObject<RenderParagraph>(text).text.style!;
+
+ testWidgets('the Reject dialog names the task', (t) async {
+ await mount(t, 'Add the project export');
+ await t.tap(find.text('Reject'));
+ await t.pumpAndSettle();
+ expect(
+ find.descendant(
+ of: find.byType(AlertDialog),
+ matching: find.text('Reject “Add the project export”?'),
+ ),
+ findsOneWidget,
+ );
+ expect(find.text('Reject task'), findsOneWidget, reason: 'the button');
+ });
+
+ testWidgets('a long title wraps in the dialog without overflowing', (
+ t,
+ ) async {
+ final title = 'Add the project export ${'with every column ' * 12}';
+ await mount(t, title);
+ await t.tap(find.text('Reject'));
+ await t.pumpAndSettle();
+ final heading = find.descendant(
+ of: find.byType(AlertDialog),
+ matching: find.textContaining('Reject “Add the project export'),
+ );
+ expect(heading, findsOneWidget);
+ expect(t.takeException(), isNull);
+ });
+
+ testWidgets("the suggested-agent picker uses the row's text style", (
+ t,
+ ) async {
+ await mount(t, 'Add the project export');
+ final picker = find.byKey(const ValueKey('task-agent-new'));
+ final choice = find.descendant(of: picker, matching: find.byType(Text));
+ final title = drawn(t, find.text('Add the project export'));
+ // The field's label is its own; the chosen agent's name is the row's size.
+ final name = choice
+ .evaluate()
+ .map((e) => e.widget as Text)
+ .firstWhere((w) => w.data != 'Suggested agent');
+ final agent = drawn(
+ t,
+ find.descendant(of: picker, matching: find.text(name.data!)).first,
+ );
+ expect(agent.fontSize, title.fontSize);
+ expect(agent.fontWeight, title.fontWeight);
+ });
+}
diff --git a/desktop/test/super_tab_tasks_view_test.dart b/desktop/test/super_tab_tasks_view_test.dart
index 8b7677345..48a538505 100644
--- a/desktop/test/super_tab_tasks_view_test.dart
+++ b/desktop/test/super_tab_tasks_view_test.dart
@@ -282,10 +282,17 @@ void main() {
'merged',
'shipped',
]) {
- // 1400 is under six minimums, so each takes the least a column does (task #3869).
+ // Done and Merged are empty, slim lanes (finding 5 of #4211); the four
+ // with cards share what is left of 1400.
expect(
tester.getSize(_column(name)).width,
- SuperTabTasksView.minColumnWidth,
+ name == 'done' || name == 'merged'
+ ? SuperTabTasksView.slimColumnWidth
+ : (1400 -
+ 2 * grid.AppDesktop.groupGap -
+ 2 * SuperTabTasksView.slimColumnWidth -
+ 5 * grid.AppDesktop.groupGap) /
+ 4,
reason: name,
);
final panel = tester.widget<DecoratedBox>(_column(name));
@@ -568,6 +575,24 @@ void main() {
'shipped',
];
final board = find.byKey(const ValueKey('super-tasks-board'));
+ // A card in every column, so none is a slim lane.
+ ConversationServer full() {
+ final server = tasksServer();
+ (server.state['conversations'] as List).addAll(<Map<String, dynamic>>[
+ taskFixture('repair', 'Repair the notes', 20, status: 'done'),
+ taskFixture(
+ 'releasing',
+ 'Waits for its release',
+ 21,
+ status: 'done',
+ pullRequest: 2871,
+ merged: true,
+ releasing: ['desktop'],
+ ),
+ ]);
+ return server;
+ }
+
List<double> widths(WidgetTester tester) => [
for (final name in names) tester.getSize(_column(name)).width,
];
@@ -581,7 +606,7 @@ void main() {
testWidgets(
'at $width the six columns are equal and reach the pane\'s edge',
(tester) async {
- final c = await _show(tester, tasksServer(), size: Size(width, 900));
+ final c = await _show(tester, full(), size: Size(width, 900));
final all = widths(tester);
expect(
all.every((w) => (w - all.first).abs() < .5),
@@ -603,16 +628,22 @@ void main() {
);
}
+ // Whole columns at rest, not six at the minimum with the fifth cut
+ // mid-word (finding 5 of #4211).
testWidgets(
- 'at 1280 they keep their minimum and the Board scrolls sideways',
+ 'at 1280 as many whole columns as fit share it and the Board scrolls '
+ 'sideways',
(tester) async {
- final c = await _show(
- tester,
- tasksServer(),
- size: const Size(1280, 900),
- );
+ final c = await _show(tester, full(), size: const Size(1280, 900));
final all = widths(tester);
- expect(all.every((w) => (w - 240).abs() < .5), isTrue, reason: '$all');
+ expect(
+ all.every((w) => (w - all.first).abs() < .5),
+ isTrue,
+ reason: '$all',
+ );
+ expect(all.first, greaterThanOrEqualTo(240));
+ expect(tester.getTopRight(_column('done')).dx, lessThanOrEqualTo(1280));
+ expect(tester.getTopLeft(_column('merged')).dx, greaterThan(1279.5));
expect(position(tester).maxScrollExtent, greaterThan(0));
await _close(tester, c);
},
@@ -901,30 +932,26 @@ void main() {
await _close(tester, c);
});
- testWidgets('an empty column says No tasks in the caption color', (
+ // A slim lane says it is empty with its 0, not a full panel saying No tasks
+ // (finding 5 of #4211).
+ testWidgets('an empty column is a slim lane saying 0 in the caption color', (
tester,
) async {
final c = await _show(tester, tasksServer());
- final empty = find.descendant(
- of: _column('done'),
- matching: find.text('No tasks'),
- );
- expect(empty, findsOneWidget);
- expect(
- find.descendant(of: _column('merged'), matching: find.text('No tasks')),
- findsOneWidget,
- );
- expect(
- tester.widget<Text>(empty).style?.color,
- grid.AppPalette.textSecondary,
- );
- for (final name in ['proposals', 'nextUp', 'working', 'shipped']) {
+ for (final name in ['done', 'merged']) {
+ expect(
+ tester.getSize(_column(name)).width,
+ SuperTabTasksView.slimColumnWidth,
+ reason: name,
+ );
+ final zero = find.descendant(of: _column(name), matching: find.text('0'));
expect(
- find.descendant(of: _column(name), matching: find.text('No tasks')),
- findsNothing,
+ tester.widget<Text>(zero).style?.color,
+ grid.AppPalette.textSecondary,
reason: name,
);
}
+ expect(find.text('No tasks'), findsNothing);
await _close(tester, c);
});
diff --git a/docs/plans/2026-11-07-proposal-approval-bypass-plan.md b/docs/plans/2026-11-07-proposal-approval-bypass-plan.md
new file mode 100644
index 000000000..b21713449
--- /dev/null
+++ b/docs/plans/2026-11-07-proposal-approval-bypass-plan.md
@@ -0,0 +1,62 @@
+# A person approves the task the PM shaped, never an undecided proposal: implementation plan
+
+> Written by the project's Engineer way of working (project instructions, Engineer): plan first, then each task test first,
+> the failing test committed before its code. No Execution Handoff.
+
+**Goal:** task #4249 (from the v3 flows audit #4212, finding 16; River for anh Dee). A member in Review could approve a
+Buddy proposal before the PM decided it; the PM then accepted or reshaped it (or converted the older chat proposal into a
+task) with a different scope, and the approval carried over, so the PM could assign any work the person never saw.
+
+**Architecture:** the approval belongs to the task the PM shaped, after it exists.
+
+- `taskApproval.ts`: `undecidedProposal(group)` is true while a proposal card has no accept or reshape. `task.approve` on
+ such a card is refused with `PROPOSAL_UNDECIDED` (a Later card is undecided too). Reject and suggest stay as they are.
+- `proposalCards.ts` `proposal.decide` accept or reshape: an approval already `approved` (stored before this fix) goes back
+ to `proposal`, without its decision time, so the person approves the shaped task. A chosen agent stays as the suggestion.
+- `commands.ts` conversion of an older chat proposal: the new task's approval is the same person and membership, freshly
+ staged (`proposal`, no suggestion, created now), never a copy of the card's decision.
+- `read/personalTasks.ts`: `canApprove` is false on an undecided proposal, so the Tasks row offers no Approve.
+
+**Tech Stack:** TypeScript backend, vitest.
+
+**Spec:** the audit finding (task #4212, finding 16): "an undecided proposal can't be approved. Approval is for the task the
+PM shaped." Brief: "A task in Review needs its own approval of the agent shown, after it exists."
+
+## Global Constraints
+
+- Owns `backend/src/superTabs/` only. No schema, collection or index change: `taskApproval` is an existing field.
+- The server enforces it; the client's Approve only follows `canApprove`.
+- Never read or print a secret or login.
+
+## Review Focus
+
+- Data stored before the fix: a card already `approved` while undecided must not let the PM assign after accept or reshape.
+- A Later card: Approve is refused and not offered.
+- The older chat proposal converted into a task: an approved or suggested mirror gives the task a fresh `proposal` approval.
+- Auto approve members: nothing changes (no approval is staged).
+- After accept, the person approves once and the PM assigns the agent shown, as today.
+
+---
+
+### Task 1: Approval only of a decided proposal, and never carried over
+
+**Files:**
+- Modify: `backend/src/superTabs/taskApproval.ts`, `backend/src/superTabs/commands.ts`, `backend/src/superTabs/proposalCards.ts`,
+ `backend/src/superTabs/read/personalTasks.ts`
+- Test: `backend/src/superTabs/taskApproval.test.ts`, `backend/src/superTabs/read/personalTasks.test.ts`
+
+**Interfaces:**
+- Produces: `undecidedProposal(group: Conversation): boolean` in `taskApproval.ts`.
+
+- [ ] **Step 1: Write the failing tests**
+ - `taskApproval.test.ts`: "refuses approving an undecided or Later proposal; the person approves the task the PM shaped"
+ (replaces "keeps a chosen agent binding when the person approves before PM preparation", which asserted the bypass);
+ "a stored approval from before the decision does not carry over to the task the PM shapes" for accept and reshape;
+ "a converted older proposal gets a fresh approval, never the card's decision".
+ - `read/personalTasks.test.ts`: the capability table gives `canApprove` false for an undecided or Later proposal and true
+ once it is accepted or reshaped.
+- [ ] **Step 2: Run them and see them fail**
+ Run: `cd backend && npx vitest run src/superTabs/taskApproval.test.ts src/superTabs/read/personalTasks.test.ts`
+- [ ] **Step 3: Implement** the four changes above.
+- [ ] **Step 4: Run them and see them pass**, with the tests of the code that imports what changed.
+- [ ] **Step 5: Commit**
diff --git a/docs/plans/2026-11-07-redact-every-command-plan.md b/docs/plans/2026-11-07-redact-every-command-plan.md
new file mode 100644
index 000000000..313c54a23
--- /dev/null
+++ b/docs/plans/2026-11-07-redact-every-command-plan.md
@@ -0,0 +1,75 @@
+# Redact every command's words (task #4340) Implementation Plan
+
+> Written by the Engineer by the project's way of working: superpowers writing-plans, then each task test first
+> (test-driven-development), one pull request.
+
+**Goal:** A credential typed into any command's free text is removed before it is stored or copied, as it already is for
+messages and tasks; a new command that adds free text fails a test until it is covered or exempted with a reason.
+
+**Architecture:** `withoutCredentials` (commands.ts) already cleans every command at the one entry, `applyCommandOnce`,
+before any handler reads it; copies (Buddy chats, notices, card rows) are made from that cleaned command. The gap is the
+`WORDS` table, which lists only older commands. Add the missing paths; a test walks `commandSchema` and fails on any
+string field that is neither in `WORDS` nor in its commented exemption list.
+
+**Tech Stack:** TypeScript, zod 4 (schema walk through `_zod.def`), vitest.
+
+**Spec:** Task #4340's brief, from Auditflow's delta review of #3310. Head start: Cleanup's 3b854228b and b1ae7dbd9 on
+#3310, taken for their redaction half (pause reason, a person's card answer, the proposal commands in `WORDS`). Their
+refusal of an agent's text in those commands needs #3310's `AGENT_TEXT` list, which main lacks, and stays on #3310.
+
+## Verification (schema walk on main cbdcc6f06)
+
+Missing from `WORDS`, each stored or copied as written:
+
+| Command | Fields |
+|---|---|
+| `proposal.decide` | `reason` (also copied to the proposer's Buddy chat), the accepted task's words, `checks[].description` |
+| `proposal.ask` | `question`, `defaultAnswer` |
+| `proposal.answer` | `text` |
+| `proposal.merge` | `reason` |
+| `proposal.create` | `title`, `text`, `goal`, `why`, `doneWhen`, `evidence[]` |
+| `buddy.propose` | `why`, `doneWhen`, `evidence[]` (the rest was listed) |
+| `decision.ask` | `questions[].question`, `options[]`, `unblocks` |
+| `decision.answer` | `note` |
+| `work.status` | `ask.options[]`, `ask.unblocks` |
+| `work.pause` | `reason` |
+| `person.tell` | `text` |
+| `agent.screenResult`, `agent.inputResult` | `error` |
+| Names | `agent.new`, `buddy.create`, `member.name`, `member.username`, role names, `roleName`, lanes, `swarm.delete` name |
+| Settings prose | `tab.routingPolicy` `policy.notes`, `rules.set` rule names and reasons, `conversation.create` `step`, `task.requires.access[]` |
+
+Exempt, each with its reason in the test: terminal text (`agent.input`, screen results), a role's skill text, launch
+settings (engine, model, effort, grid), folder paths, URLs and refs checked by shape, ids and times, an invite's email,
+`machine.access` words (refused outright when they look like a secret), and fields the server writes itself (`stepUp.reason`, `sameEngine`).
+
+## Global Constraints
+
+- Never post or log a real secret: tests assemble fake token shapes at run time.
+- Backend only. No data migration: stored rows stay as they are; new writes are clean.
+
+## Design
+
+N/A because nothing new is stored, synced or exposed: the same fields are stored, with credentials removed.
+
+## Task 1: Proposal words are clean, in the card and the Buddy chat
+
+**Files:** `backend/src/superTabs/commands.ts`, `proposalCards.test.ts`
+
+- [ ] Test: a token in a proposal, a ruling's reason, a question, an answer and a merge reason is absent from the state
+ and from every message, the proposer's Buddy chat included.
+- [ ] Run it: fails. Add the proposal commands to `WORDS`. Passes.
+
+## Task 2: Every other gap
+
+**Files:** `backend/src/superTabs/commands.ts`, `commands.test.ts`
+
+- [ ] Test: `withoutCredentials` cleans each listed field of `decision.ask`, `decision.answer`, `work.status`,
+ `work.pause`, `person.tell` and the names and settings above.
+- [ ] Run it: fails. Add them to `WORDS`. Passes.
+
+## Task 3: The next command cannot slip
+
+**Files:** `backend/src/superTabs/commands.ts` (export `WORDS`), `commands.test.ts`
+
+- [ ] Test: walk `commandSchema`; every string field is in `WORDS` or a commented exemption; every `WORDS` path exists.
+- [ ] Run it on main: fails, naming the gaps. After tasks 1–2: passes.
diff --git a/docs/plans/2026-11-07-v3-desktop-polish-plan.md b/docs/plans/2026-11-07-v3-desktop-polish-plan.md
new file mode 100644
index 000000000..0a1144e4f
--- /dev/null
+++ b/docs/plans/2026-11-07-v3-desktop-polish-plan.md
@@ -0,0 +1,119 @@
+# v3 Desktop polish from the audit implementation plan
+
+> Implemented natively, plan task by plan task, each failing test committed before its code; one independent review of
+> the pull request. No execution handoff: the Engineer implements it.
+
+**Goal:** Fix the eight Desktop findings task #4251 takes from the v3 audit (#4211: 5, 6, 8, 10, 12, 13, 14, 15) so
+the Board fits, every agent has one face, small windows keep a usable middle, and the empty and personal moments feel
+good.
+
+**Architecture:** Each finding is a local change in `desktop/lib/super_tabs/`, tested through the widget a person sees
+(widget tests with a memory store and fake sign-in). The four plan tasks touch disjoint files and run in parallel.
+
+**Tech Stack:** Flutter/Dart, the existing Super Tab widgets and fixtures, `test/support/capture.dart` for light and
+dark pictures.
+
+**Spec:** the findings as posted in task #4211 (Auditdesk, 2026-11-07), and the brief of task #4251.
+
+## Global Constraints
+
+- Owns `desktop/lib/super_tabs/` only; no backend, contract or data change.
+- Verify each finding on main first; a finding that does not reproduce says why in the pull request.
+- Test first: each test fails on main and passes with the change; the commit history shows the order.
+- Light and dark pictures of every changed screen, through `HARNESS_SUPER_TAB_CAPTURE`.
+- Follow the desktop design system; names and copy per docs/naming-system.md; no new setting or switch.
+- Never read or print a secret or a login; tests use the memory store and a fake sign-in.
+- macOS, Linux and Windows share these widgets; nothing here starts a process.
+
+## Review Focus
+
+- Board at 1500 px with Proposal empty and many Shipped: no column cut mid-word at rest, and hidden columns are named.
+- A column that fills while it is collapsed opens again at once (no stale slim lane).
+- At the 880 px window minimum the middle keeps at least one whole Board column and the Tasks pane stays usable.
+- @ in a shared project chat still offers people; only an agent's own private chat drops them.
+- Leaderboard "You" follows the signed-in account after an org or account switch, never a name match.
+
+## Design
+
+N/A because nothing is stored, synced or exposed: each change reads the snapshot the widget already holds.
+
+---
+
+### Task 1: Board fits the middle (findings 5 and 13)
+
+**Files:**
+- Modify: `desktop/lib/super_tabs/tasks_view.dart` (`_boardView`, `_panel`, `_card`)
+- Modify: `desktop/lib/super_tabs/task_card.dart` (`_mark`)
+- Test: `desktop/test/super_tab_board_fit_test.dart`, shots in `desktop/test/super_tab_board_fit_shots_test.dart`
+
+**Interfaces:**
+- Produces: `SuperTabTasksView.slimColumnWidth` (an empty column's width); `SuperTabTaskCard.markLabel` (String?, the
+ mark's tooltip).
+
+- [ ] Write the failing test: an empty column draws as a slim lane (its name and 0, no "No tasks" panel) of
+ `slimColumnWidth`; with the middle 860 wide, every column that starts on screen ends on screen (whole columns at
+ rest), and a pill at the edge names the columns out of view with their counts and scrolls them in when pressed.
+- [ ] Write the failing test: a card in review shows its mark with the tooltip "In review"; other states name theirs
+ ("Waiting on a person", "Working", "Queued", "Blocked or agent lost", "Shipped", "Failed").
+- [ ] Run them on main and watch them fail; commit the tests.
+- [ ] Implement: empty columns become slim lanes; the rest share what is left, never under `minColumnWidth`, and when
+ they overflow their width rounds so a whole number fits; the edge pill; the card mark's tooltip.
+- [ ] Run the new tests and `test/super_tab_board_layout_test.dart`, `test/super_tab_board_cards_test.dart`,
+ `test/super_tab_tasks_view_test.dart`; commit; light and dark pictures at 1500×860.
+
+### Task 2: One face per agent, @ in a private chat (findings 6 and 12)
+
+**Files:**
+- Modify: `desktop/lib/super_tabs/buddy_rows.dart` (`SuperTabBuddyRow` takes the agent), `project_sidebar.dart`
+ (`_agentRow` passes it)
+- Modify: `desktop/lib/super_tabs/composer_tags.dart` (`superTabTagChoices`)
+- Test: `desktop/test/super_tab_agent_face_test.dart`, `desktop/test/super_tab_private_mention_test.dart`
+
+**Interfaces:**
+- Produces: `SuperTabBuddyRow.agent` (SuperTabAgent?): when set, the row draws `SuperTabAvatar.agent` (its picture or
+ pattern, no engine badge), the same face the chat, cards and Tasks pane draw.
+
+- [ ] Write the failing test: an agent in My agents draws the same `SuperTabAvatarFace` (picture and pattern) as its
+ chat's message avatar, not an initial.
+- [ ] Write the failing test: in an agent's own chat (the conversation its `chatId` names) @ offers that agent and no
+ people; in a project chat it still offers people, by display name.
+- [ ] Run them on main and watch them fail; commit the tests.
+- [ ] Implement both; run the new tests and the existing `super_tab_completions_test.dart`, `super_tab_avatar_test.dart`
+ and sidebar tests; commit; light and dark pictures of the left pane and the @ list.
+
+### Task 3: Small windows and the reject dialog (findings 8 and 10)
+
+**Files:**
+- Modify: `desktop/lib/super_tabs/pane_layout.dart` (a Board-layout middle minimum), `view.dart` (the Tasks pane's
+ minimum becomes `rightWidth`)
+- Modify: `desktop/lib/super_tabs/tasks/personal_tasks_pane.dart` (reject dialog, suggested-agent picker)
+- Test: `desktop/test/super_tab_pane_minimums_test.dart`, `desktop/test/super_tab_reject_dialog_test.dart`
+
+**Interfaces:**
+- Produces: `SuperTabPaneLayout.boardCenterWidth` (560): what the Board layout's middle keeps before the side panes
+ give back; the left pane gives back first (to 180), then the Tasks pane (340 to 280).
+
+- [ ] Write the failing test: Board layout at 1100 and 900 (and the 880 window minimum): the middle is at least
+ `boardCenterWidth` while the sides can give, the left pane narrows before the Tasks pane, and the Tasks pane is
+ never under 280; at 1500 the sides keep 300 and 340.
+- [ ] Write the failing test: Reject's dialog title names the task ("Reject “Add the project export”?") and the
+ suggested-agent picker uses the row's text style.
+- [ ] Run them on main and watch them fail; commit the tests.
+- [ ] Implement both; run the new tests and `super_tab_pane_layout*`, `super_tab_personal_tasks*` tests; commit; light
+ and dark pictures at 900 wide and of the dialog.
+
+### Task 4: An empty Decisions that feels like a win, and you on the Leaderboard (findings 14 and 15)
+
+**Files:**
+- Modify: `desktop/lib/super_tabs/decisions_page.dart` (its empty state)
+- Modify: `desktop/lib/super_tabs/leaderboard/person_row.dart`, `leaderboard/weekly_page.dart`,
+ `leaderboard/format.dart` as needed
+- Test: `desktop/test/super_tab_decisions_empty_test.dart`, `desktop/test/super_tab_leaderboard_you_test.dart`
+
+- [ ] Write the failing test: with nothing to decide, Decisions shows a centred all-clear ("All clear" and "Your crew
+ has what it needs") with how many tasks are moving, in place of the small line at the top.
+- [ ] Write the failing test: the signed-in person's Leaderboard row is highlighted and says "You"; a zero streak
+ reads "–", not "0d"; ranks 2 and 3 carry a medal mark as rank 1 carries its trophy.
+- [ ] Run them on main and watch them fail; commit the tests.
+- [ ] Implement both; run the new tests and the existing decisions and leaderboard tests; commit; light and dark
+ pictures of both pages.