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-04 b0845: #2875 #2867 #2872 #2874 (#2877)

0xken15ee42e5121b81
diff --git a/backend/integration/ci-durations.json b/backend/integration/ci-durations.json
index 7dddb5c9e..a06d45442 100644
--- a/backend/integration/ci-durations.json
+++ b/backend/integration/ci-durations.json
@@ -42,6 +42,7 @@
"integration/superTabMachineNames.test.ts": 1500,
"integration/superTabMachineRemovals.test.ts": 900,
"integration/superTabMachineReports.test.ts": 20300,
+ "integration/superTabDigestHour.test.ts": 1500,
"integration/superTabMessagePages.test.ts": 1500,
"integration/superTabMigration.test.ts": 1000,
"integration/superTabNamedReads.test.ts": 1000,
diff --git a/backend/integration/noDefaultDigest.test-support.ts b/backend/integration/noDefaultDigest.test-support.ts
new file mode 100644
index 000000000..d6dfcabe2
--- /dev/null
+++ b/backend/integration/noDefaultDigest.test-support.ts
@@ -0,0 +1,24 @@
+// Setup of the Super Tab integration runner (vitest.super-tabs.config.ts): a project's default morning digest stays off.
+// It is due from 08:00 to 09:00 Vietnam time (digest.ts), so on the real clock every Lead's poll in that hour got one more
+// message, and tests that count them failed daily, whatever the pull request (superTabDigestHour.test.ts). A digest a test
+// sets with project.digest still comes; a test about the default calls wantDefaultDigest() and sets its own clock.
+import { beforeEach, vi } from 'vitest'
+import { ledProject, type SwarmProject } from '../src/superTabs/projects.js'
+
+const wanted = vi.hoisted(() => ({ default: false }))
+export const wantDefaultDigest = (): void => { wanted.default = true }
+beforeEach(() => { wanted.default = false })
+
+const off = (project: SwarmProject) => !project.digest && !wanted.default
+
+vi.mock('../src/superTabs/digest.js', async original => {
+ const real = await original<typeof import('../src/superTabs/digest.js')>()
+ return {
+ ...real,
+ digestDue: (...args: Parameters<typeof real.digestDue>) => off(args[0]) ? null : real.digestDue(...args),
+ digestRequest: (...args: Parameters<typeof real.digestRequest>) => {
+ const project = ledProject(args[0], args[1].id)
+ return project && off(project) ? null : real.digestRequest(...args)
+ },
+ }
+})
diff --git a/backend/integration/superTabBuddies.test.ts b/backend/integration/superTabBuddies.test.ts
index f771613fa..f5f4d3c02 100644
--- a/backend/integration/superTabBuddies.test.ts
+++ b/backend/integration/superTabBuddies.test.ts
@@ -214,7 +214,7 @@ describe('a Buddy through the store', () => {
const sent = await propose()
const row = await db.superTabMessage.findFirstOrThrow({ where: { tabId: f.tab, id: String(sent.result.messageId) } })
expect(row).toMatchObject({ conversationId: 'lead', recipientIds: [], author: { kind: 'person', id: peer.sub },
- source: { kind: 'buddy-proposal', personId: peer.sub, buddyId: agentId, ownerMessageId: ask }, text: "Let's build: Offline sync" })
+ source: { kind: 'buddy-proposal', personId: peer.sub, buddyId: agentId, ownerMessageId: ask }, text: 'Offline sync' })
const details = await db.superTabMessage.findFirstOrThrow({ where: { tabId: f.tab, thread: row.id, replyTo: row.id } })
expect(details).toMatchObject({ author: { kind: 'agent', id: agentId }, recipientIds: [f.lead],
text: 'Goal: Offline sync\nScope: Desktop only\nPriority: normal' })
@@ -821,6 +821,20 @@ describe('a Buddy hears how its person\'s requests go, unasked (Diego, 10-29)',
expect((await f.store.messages(peer, f.tab, group, {}, agentId)).messages.map(m => m.id)).toContain(notice.id)
})
+ it('links the proposal when the PM names its details, the reply it was delivered; a reply of its own stays refused (Scholes, 11-04)', async () => {
+ const { f, proposal, pm } = await proposed()
+ const details = await db.superTabMessage.findFirstOrThrow({ where: { tabId: f.tab, replyTo: proposal } })
+ const open = (proposalMessageId: string) => f.execute({ type: 'conversation.create', projectId: 'lead', title: 'Offline sync', brief: 'Desktop keeps edits offline.',
+ checks: [{ description: 'Edits survive a restart', independent: false }], proposalMessageId }, owner, f.lead)
+ const answer = String((await pm('Taking it.', { replyTo: proposal })).result.messageId)
+ await expect(open(answer)).rejects.toMatchObject({ code: 'PROPOSAL_UNKNOWN' })
+ const created = await open(details.id)
+ const stored = (await f.store.read(owner, f.tab)).state.conversations.find(c => c.id === String(created.result.conversationId))!
+ expect(stored.requesterId).toBe(peer.sub)
+ expect(stored.cards?.line).toMatchObject({ messageId: proposal, conversationId: 'lead' })
+ expect((await db.swarmGroup.findFirstOrThrow({ where: { tabId: f.tab, key: stored.id } })).data).toMatchObject({ ledger: { proposal: { messageId: proposal } } })
+ })
+
it('is told of work the PM opens from its proposal without naming anyone: the proposal\'s person is its requester (groups #294, #327)', async () => {
const { f, agentId, proposal, heard } = await proposed()
const created = await f.execute({ type: 'conversation.create', projectId: 'lead', title: 'Offline sync', brief: 'Desktop keeps edits offline.',
diff --git a/backend/integration/superTabDigestHour.test.ts b/backend/integration/superTabDigestHour.test.ts
new file mode 100644
index 000000000..71eefa1c7
--- /dev/null
+++ b/backend/integration/superTabDigestHour.test.ts
@@ -0,0 +1,57 @@
+import { randomUUID } from 'node:crypto'
+import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest'
+import type { MongoMemoryReplSet } from 'mongodb-memory-server-core'
+import type { PrismaClient } from '@prisma/client'
+import type { AuthUser } from '../src/lib/ssoAuth.js'
+import { SuperTabStore } from '../src/superTabs/store.js'
+import type { Command } from '../src/superTabs/commands.js'
+import { planDatabase } from './plans.test-support.js'
+
+// Every project keeps a default morning digest, due from 08:00 to 09:00 Vietnam time (digest.ts), and the suite's stores run
+// on the real clock. In that hour each Lead's poll got one more message, and ten tests of superTabs and superTabMessagePages
+// failed on every pull request (#2871, #2872). This runs what they assert on that clock at 08:30.
+const EIGHT_THIRTY_VIETNAM = Date.UTC(2026, 10, 4, 1, 30)
+const owner: AuthUser = { sub: '500000000000000000000001', email: '[email protected]', autonomousEnv: 'prod', role: 'user' }
+const host: AuthUser = { sub: '500000000000000000000003', email: '[email protected]', autonomousEnv: 'prod', role: 'user' }
+const config = { engine: 'codex', model: 'fixture-model', effort: 'high', contextWindow: 200000, engineVersion: 'fixture' }
+let replica: MongoMemoryReplSet
+let db: PrismaClient
+
+beforeAll(async () => {
+ ({ replica, db } = await planDatabase('swarm_digest_hour_test'))
+ for (const user of [owner, host]) await db.user.create({ data: { id: user.sub, externalId: `fixture-${user.sub}`, email: user.email, autonomousEnv: 'prod' } })
+ await db.machine.create({ data: { machineId: 'test-host', userId: host.sub, apiKey: 'fixture-only', managerId: 'fixture', autonomousEnv: 'prod', authMode: 'remote' } })
+ await db.machineShare.create({ data: { machineId: 'test-host', ownerId: host.sub, autonomousEnv: 'prod', emails: [owner.email] } })
+})
+afterAll(async () => {
+ await db?.$disconnect()
+ await replica?.stop()
+})
+// Only Date: the database's drivers keep their real timers.
+beforeEach(() => { vi.useFakeTimers({ toFake: ['Date'], now: EIGHT_THIRTY_VIETNAM }) })
+afterEach(() => { vi.useRealTimers() })
+
+describe('the suite at 08:30 Vietnam time, on the clock a store takes by default', () => {
+ async function fixture() {
+ // Made under the fake clock: a store keeps the Date.now it was built with.
+ const store = new SuperTabStore(db)
+ const tab = (await store.create(owner, randomUUID(), 'Digest hour')).id
+ const run = (command: Command) => store.execute(owner, tab, { operationId: randomUUID(), command })
+ const lead = String((await run({ type: 'agent.add', conversationId: 'lead', machineId: 'test-host', harnessId: randomUUID(), name: 'Lead',
+ configuration: config, lead: true })).result.agentId)
+ return { store, tab, run, lead }
+ }
+
+ it("adds nothing to a Lead's poll or its chat", async () => {
+ const { store, tab, lead } = await fixture()
+ expect(await store.deliveries(host, tab, lead)).toEqual([])
+ const rows = await db.superTabMessage.findMany({ where: { tabId: tab, conversationId: 'lead' } })
+ expect(rows.filter(m => (m.source as { kind?: string } | null)?.kind === 'digest-request')).toEqual([])
+ })
+
+ it('leaves a message to the Lead the only one it is given', async () => {
+ const { store, tab, run, lead } = await fixture()
+ const sent = await run({ type: 'message.send', conversationId: 'lead', text: 'Hello', replyTo: null, recipientIds: [lead] })
+ expect((await store.deliveries(host, tab, lead)).map(d => d.messageId)).toEqual([sent.result.messageId])
+ })
+})
diff --git a/backend/integration/superTabIndexes.test.ts b/backend/integration/superTabIndexes.test.ts
index a2803afcb..2c1f08930 100644
--- a/backend/integration/superTabIndexes.test.ts
+++ b/backend/integration/superTabIndexes.test.ts
@@ -6,7 +6,7 @@ import { tmpdir } from 'node:os'
import { afterAll, beforeAll, describe, expect, it } from 'vitest'
import { MongoMemoryReplSet } from 'mongodb-memory-server-core'
import { PrismaClient } from '@prisma/client'
-import { inConversationOrder, pageDeliveries, pageReactions, pageThreads } from '../src/superTabs/pageReads.js'
+import { inConversationOrder, noteBackfilled, pageDeliveries, pageReactions, pageThreads, refreshThreads } from '../src/superTabs/pageReads.js'
import { costRows } from '../src/superTabs/costs/read.js'
import { readEvidence } from '../src/superTabs/evidence/store.js'
import { recentDecisions } from '../src/superTabs/routeDecisions.js'
@@ -169,6 +169,30 @@ describe('message page reads', () => {
expect(profile).toEqual({ plans: ['IXSCAN { tabId: 1, conversationId: 1, thread: 1, sequence: 1 }'], docsExamined: 505, returned: 1 })
})
+ it('says where an ask stands from the real rows, summed up in the database and from a stored summary alike', async () => {
+ const s = richSwarm()
+ const chat = { ...s.state.conversations.find(c => c.id === s.web)!, leadId: 'pm' }
+ const person = { kind: 'person' as const, id: owner.userId, name: owner.userId, membershipGeneration: 'gen' }
+ const agent = (id: string) => ({ kind: 'agent' as const, id, name: id, membershipGeneration: 'gen' })
+ const row = (id: string, thread: string, sequence: number, author: object, source?: object) => ({ id, tabId: 'ASK', conversationId: 'chat', thread, sequence,
+ author, text: 'x', recipientIds: [], mentions: [], createdAt: new Date(T0 + sequence * 1000), ...source ? { source } : {} })
+ await db.superTabMessage.createMany({ data: [
+ row('asked', 'asked', 1, person, { kind: 'buddy-proposal' }), row('asked-1', 'asked', 2, agent('buddy')),
+ row('declined', 'declined', 3, person, { kind: 'buddy-proposal' }), row('declined-1', 'declined', 4, agent('buddy')), row('declined-2', 'declined', 5, agent('pm')),
+ row('own', 'own', 6, person), row('own-1', 'own', 7, agent('pm'), { kind: 'system', ask: 'on-it' }),
+ row('merged', 'merged', 8, person), row('merged-1', 'merged', 9, agent('pm'), { kind: 'system', ask: 'on-it' }),
+ row('merged-2', 'merged', 10, agent('pm'), { kind: 'system', ask: 'shipped' }), row('merged-3', 'merged', 11, person),
+ row('plain', 'plain', 12, person), row('plain-1', 'plain', 13, agent('pm')),
+ ] })
+ const roots = ['asked', 'declined', 'own', 'merged', 'plain']
+ const asks = async () => Object.fromEntries(threadSummaries(s.state, chat, await pageThreads(db, 'ASK', 'chat', roots)).map(t => [t.id, t.ask]))
+ const expected = { asked: 'proposal', declined: undefined, own: 'on-it', merged: 'shipped', plain: undefined }
+ expect(await asks()).toEqual(expected)
+ await refreshThreads(db, 'ASK', 'chat', roots)
+ noteBackfilled('ASK')
+ expect(await asks()).toEqual(expected)
+ })
+
it('reads a page of reactions through the tabId+messageId index, examining only the reactions it returns', async () => {
const [rows, profile] = await profiled('SuperTabReaction', () => pageReactions(db, 'A', PAGE))
expect(rows).toHaveLength(200)
diff --git a/backend/integration/superTabProfile.test.ts b/backend/integration/superTabProfile.test.ts
index 848c81400..5c6caf2e2 100644
--- a/backend/integration/superTabProfile.test.ts
+++ b/backend/integration/superTabProfile.test.ts
@@ -516,7 +516,7 @@ describe('the ship moment', () => {
expect(rows.filter(m => (m.source as { kind?: string } | null)?.kind === 'ship')).toEqual([])
const lines = rows.filter(m => (m.source as { kind?: string } | null)?.kind === 'task-line')
expect(lines).toHaveLength(1)
- expect(lines[0]).toMatchObject({ text: "Let's build: Avatars", recipientIds: [], source: { taskId: group } })
+ expect(lines[0]).toMatchObject({ text: 'Avatars', recipientIds: [], source: { taskId: group } })
const merges = rows.filter(m => m.thread === lines[0]!.id && m.text.startsWith('Merged'))
expect(merges).toEqual([expect.objectContaining({ text: 'Merged: PR #7. Ships in the next release.', recipientIds: [] })])
expect(await db.superTabDelivery.count({ where: { tabId: tab, messageId: { in: [lines[0]!.id, merges[0]!.id] } } })).toBe(0)
diff --git a/backend/integration/superTabRead.test.ts b/backend/integration/superTabRead.test.ts
index 8ebb16656..7680589cc 100644
--- a/backend/integration/superTabRead.test.ts
+++ b/backend/integration/superTabRead.test.ts
@@ -329,6 +329,46 @@ describe('dormant groups on demand (design 4.5)', () => {
})
})
+describe('what a reader can tell of a task\'s merge (task #2558)', () => {
+ const post = async (tabId: string, command: Record<string, unknown>, as: AuthUser, asAgentId: string) => {
+ const response = await app.inject({ method: 'POST', url: `/api/super-tabs/${tabId}/commands`, headers: { authorization: `Bearer ${as.sub}` },
+ payload: { operationId: randomUUID(), command, asAgentId } })
+ return { status: response.statusCode, body: response.json() as unknown }
+ }
+ // Backlog sorts on these: shippedAt says only that the task reached Done; a pull request card's mergedAt says it merged.
+ it('a Done task with an open pull request reads as shipped with no merge, and only a recorded merge sets one', async () => {
+ const s = await scene()
+ clock = Date.now()
+ const pullRequest = 'https://github.com/example/app/pull/7'
+ const read = async () => (await get(`/api/super-tabs/${s.tabId}/groups/${s.web}`)).body.data.group.data
+ const { assignment } = await read()
+ const done = await post(s.tabId, { type: 'work.status', conversationId: s.web, assignmentId: assignment.id, status: 'done',
+ result: `Ready: ${pullRequest}` }, owner, s.worker)
+ expect(done.status, JSON.stringify(done.body)).toBe(200)
+ const unmerged = await read()
+ expect(unmerged.shippedAt).toEqual(expect.any(Number))
+ expect(unmerged.pullRequestUrls).toEqual([pullRequest])
+ expect(unmerged.cards?.pullRequests?.some((card: { mergedAt?: number }) => card.mergedAt !== undefined) ?? false).toBe(false)
+ const merged = await post(s.tabId, { type: 'conversation.merged', conversationId: s.web, pullRequestUrl: pullRequest }, owner, s.lead)
+ expect(merged.status, JSON.stringify(merged.body)).toBe(200)
+ const card = (await read()).cards.pullRequests.find((c: { url: string }) => c.url === pullRequest)
+ expect(card.mergedAt).toEqual(expect.any(Number))
+ })
+
+ it('a merge recorded on a batch pull request makes a merged card on the task, whatever became of its own', async () => {
+ const s = await scene()
+ clock = Date.now()
+ const [own, batch] = ['https://github.com/example/app/pull/7', 'https://github.com/example/app/pull/8']
+ const read = async () => (await get(`/api/super-tabs/${s.tabId}/groups/${s.web}`)).body.data.group.data
+ const { assignment } = await read()
+ await post(s.tabId, { type: 'work.status', conversationId: s.web, assignmentId: assignment.id, status: 'done', result: `Ready: ${own}` }, owner, s.worker)
+ await post(s.tabId, { type: 'conversation.merged', conversationId: s.web, pullRequestUrl: batch }, owner, s.lead)
+ const cards = (await read()).cards.pullRequests as Array<{ url: string; mergedAt?: number }>
+ expect(cards.find(c => c.url === batch)?.mergedAt).toEqual(expect.any(Number))
+ expect(cards.find(c => c.url === own)?.mergedAt).toBeUndefined()
+ })
+})
+
describe('a dormant group\'s required machines', () => {
it('names to each reader only the machines that reader sees, in the dormant list and read by id', async () => {
const s = await scene((f, ids) => {
diff --git a/backend/integration/superTabSwarmBuddy.test.ts b/backend/integration/superTabSwarmBuddy.test.ts
index bb13c899e..e1eb6b2fd 100644
--- a/backend/integration/superTabSwarmBuddy.test.ts
+++ b/backend/integration/superTabSwarmBuddy.test.ts
@@ -153,7 +153,7 @@ describe('the one Buddy sends a proposal to a project its person reads (Scholes,
const sent = String((await propose(f, chat, await ask(f, chat), f.web.projectId, main)).result.messageId)
const row = await db.superTabMessage.findFirstOrThrow({ where: { tabId: f.tab, id: sent } })
expect(row).toMatchObject({ conversationId: f.web.conversationId, recipientIds: [], author: { kind: 'person', id: peer.sub },
- source: { kind: 'buddy-proposal', personId: peer.sub }, text: "Let's build: Offline sync" })
+ source: { kind: 'buddy-proposal', personId: peer.sub }, text: 'Offline sync' })
// The full proposal is the root's first reply, from the Buddy: the one row the PM is woken for.
const details = await db.superTabMessage.findFirstOrThrow({ where: { tabId: f.tab, thread: sent, replyTo: sent } })
expect(details).toMatchObject({ conversationId: f.web.conversationId, recipientIds: [f.pms.web], text: 'Goal: Offline sync\nScope: Web only\nPriority: normal' })
diff --git a/backend/integration/superTabTaskLines.test.ts b/backend/integration/superTabTaskLines.test.ts
index 052d3b882..2e44e5f55 100644
--- a/backend/integration/superTabTaskLines.test.ts
+++ b/backend/integration/superTabTaskLines.test.ts
@@ -10,7 +10,7 @@ import type { AuthUser } from '../src/lib/ssoAuth.js'
import { SuperTabStore } from '../src/superTabs/store.js'
import type { Command } from '../src/superTabs/commands.js'
-// Plain chat (task #2294; docs/plans/2026-11-03-plain-chat-work-plan.md): each task is one ordinary "Let's build" message in
+// Plain chat (task #2294; docs/plans/2026-11-03-plain-chat-work-plan.md): each task is one ordinary message, its title alone, in
// its project chat, never edited, with the PM's replies in its thread as it moves, none for its steps, and a private
// project's only for that project's readers. Through the store and a fresh loopback replica set, as the people's apps read it.
let replica: MongoMemoryReplSet
@@ -65,10 +65,10 @@ describe('a task\'s one message in its project chat', () => {
const P = await s.add('Coordinator', 'lead', true)
const T = String((await s.as(P)({ type: 'conversation.create', title: 'Offline drafts', requesterId: owner.sub, brief: 'Keep drafts.', checks: [] })).result.conversationId)
const first = await s.page('lead')
- expect(first.lines).toEqual([expect.objectContaining({ text: "Let's build: Offline drafts", recipientIds: [] })])
+ expect(first.lines).toEqual([expect.objectContaining({ text: 'Offline drafts', recipientIds: [] })])
const root = first.lines[0]!.id
const readThread = () => store.messages(owner, s.tab, 'lead', { thread: root })
- expect((await readThread()).messages.map(m => m.text)).toEqual(["Let's build: Offline drafts", 'Keep drafts.'])
+ expect((await readThread()).messages.map(m => m.text)).toEqual(['Offline drafts', 'Keep drafts.'])
const E = await s.add('Engineer', T)
const assignmentId = String((await s.as(P)({ type: 'work.assign', conversationId: T, agentId: E })).result.assignmentId)
await s.as(E)({ type: 'work.status', conversationId: T, assignmentId, status: 'working', result: 'Started.' })
@@ -83,7 +83,7 @@ describe('a task\'s one message in its project chat', () => {
await s.as(P)({ type: 'conversation.merged', conversationId: T, pullRequestUrl: pr })
await s.as(P)({ type: 'conversation.merged', conversationId: T, pullRequestUrl: pr })
const thread = await readThread()
- expect(thread.messages.map(m => m.text)).toEqual(["Let's build: Offline drafts", 'Keep drafts.', expect.stringMatching(/^On it: \S+ is building it\.$/),
+ expect(thread.messages.map(m => m.text)).toEqual(['Offline drafts', 'Keep drafts.', expect.stringMatching(/^On it: \S+ is building it\.$/),
'Ready for review: PR #7', 'Merged: PR #7. Ships in the next release.'])
expect(thread.messages.filter(m => m.id !== root).every(m => m.thread === root && m.replyTo === root && (m.author as { id: string }).id === P
&& m.recipientIds.length === 0)).toBe(true)
@@ -124,7 +124,7 @@ describe('a task\'s one message in its project chat', () => {
const reviewing = String((await s.as(E)({ type: 'work.assign', conversationId: R, agentId: V })).result.assignmentId)
await s.as(V)({ type: 'work.status', conversationId: R, assignmentId: reviewing, status: 'done', result: 'Ready to merge: Yes.' })
const { lines } = await s.page('lead')
- expect(lines.map(l => [l.source?.taskId, l.text])).toEqual([[T, "Let's build: Offline drafts"]])
+ expect(lines.map(l => [l.source?.taskId, l.text])).toEqual([[T, 'Offline drafts']])
})
it('shows a private project\'s task line only to that project\'s readers', async () => {
@@ -137,7 +137,7 @@ describe('a task\'s one message in its project chat', () => {
await s.as(E)({ type: 'work.status', conversationId: T, assignmentId, status: 'working', result: 'Started.' })
const mine = await s.page(created.conversationId)
- expect(mine.lines.map(l => [l.source?.taskId, l.text])).toEqual([[T, "Let's build: Hidden work"]])
+ expect(mine.lines.map(l => [l.source?.taskId, l.text])).toEqual([[T, 'Hidden work']])
const lineId = mine.lines[0]!.id
// A Swarm member outside the project: no line on the chats they read, and neither the private chat nor the line by id.
expect((await s.page('lead', peer)).lines).toEqual([])
diff --git a/backend/integration/superTabs.test.ts b/backend/integration/superTabs.test.ts
index 7e5f05613..b0d24b280 100644
--- a/backend/integration/superTabs.test.ts
+++ b/backend/integration/superTabs.test.ts
@@ -32,6 +32,7 @@ import { ensurePartExpiry, sweepSwarms } from '../src/superTabs/sweeps.js'
import { assignmentRows, poolRows, rosterRows } from './hostRows.test-support.js'
import { recipientShare } from '../src/routes/harnessShares.js'
import { beforeFirstWrite } from './interleave.test-support.js'
+import { wantDefaultDigest } from './noDefaultDigest.test-support.js'
// A fresh loopback replica set, created here. This suite never reads DATABASE_URL or an existing database.
let replica: MongoMemoryReplSet
@@ -847,6 +848,7 @@ describe('private swarm projects on the real control API', () => {
// Quiet project chats (Dee, 2026-10-31): a work group's change of state wakes the coordinator at most once every 15 minutes,
// an ordinary message never; its report sets the project's status card and posts nothing; the digest is on by default.
it('wakes the coordinator only on work changes, at most every 15 minutes, and keeps its report in the status card', async () => {
+ wantDefaultDigest()
// 14:00 in Vietnam: the default digest starts tomorrow at 08:00.
let now = Date.UTC(2026, 9, 31, 7, 0)
const timed = new SuperTabStore(db, () => now)
@@ -867,7 +869,7 @@ describe('private swarm projects on the real control API', () => {
const polls = await Promise.all(Array.from({ length: 3 }, () => updates()))
const ids = new Set(polls.flat().map(d => d.id))
expect(ids.size).toBe(1)
- // After the row naming who added the Lead (#2207), and the task's "Let's build" message with its brief in its thread (#2294).
+ // After the row naming who added the Lead (#2207), and the task's message with its brief in its thread (#2294).
expect((await chat()).map(m => (m.source as Record<string, unknown>)?.kind)).toEqual(['system', 'task-line', 'system', 'update-request'])
await execute({ ...message('New evidence'), conversationId: group } as Command)
now += 900_000
@@ -1252,8 +1254,8 @@ describe('Super Tabs on a real Mongo replica set', () => {
const event = { turnId: randomUUID(), kind: 'prompt' as const, previousEventId: null,
text: 'Change this implementation', truncated: false, interrupted: false }
const typed = await store.native.append(host, tab, contextId, event) as { eventId: string }
- // Besides the rows naming who added each agent (#2207), only the task's own "Let's build" message (#2294).
- expect((await store.messages(owner, tab, 'lead', {})).messages.filter(m => !memberRow(m)).map(m => m.text)).toEqual(["Let's build: Implementation"])
+ // Besides the rows naming who added each agent (#2207), only the task's own message (#2294).
+ expect((await store.messages(owner, tab, 'lead', {})).messages.filter(m => !memberRow(m)).map(m => m.text)).toEqual(['Implementation'])
expect((await store.messages(owner, tab, group, {})).messages.filter(m => !memberRow(m))).toHaveLength(1)
expect(await store.deliveries(host, tab, worker)).toEqual([])
// A typed prompt names no one (project instructions, phase 4): the coordinator hears only of a gap on the task.
diff --git a/backend/src/superTabs/buddies.test.ts b/backend/src/superTabs/buddies.test.ts
index 64bc03967..5fffd93dc 100644
--- a/backend/src/superTabs/buddies.test.ts
+++ b/backend/src/superTabs/buddies.test.ts
@@ -552,7 +552,7 @@ describe('a Buddy\'s proposal to the PM', () => {
expect(root).toMatchObject({ conversationId: f.app.conversationId, recipients: [], replyTo: null,
author: { kind: 'person', id: 'peer', name: '[email protected]', membershipGeneration: 'first' },
source: { kind: 'buddy-proposal', personId: 'peer', buddyId: 'buddy', ownerMessageId: 'ask' },
- text: "Let's build: Sync edits made offline" })
+ text: 'Sync edits made offline' })
expect(details).toMatchObject({ conversationId: f.app.conversationId, recipients: [f.pm], replyTo: root!.id, thread: root!.id,
author: { kind: 'agent', id: 'buddy' },
text: 'Goal: Sync edits made offline\nScope: Desktop drafts only; no phone yet\nPriority: high' })
@@ -569,7 +569,7 @@ describe('a Buddy\'s proposal to the PM', () => {
const command = commandSchema.parse({ type: 'buddy.propose', conversationId: f.chat, ownerMessageId: 'ask', ...proposal, goal, ...(title ? { title } : {}) })
const posted = f.run(command, buddy, { proposalAsk: { id: 'ask', conversationId: f.chat, source: false, createdAt: 900,
author: { kind: 'person', id: 'peer', name: 'peer', membershipGeneration: 'first' } } })
- expect(posted.messages[0]!.text).toBe(`Let's build: ${name}`)
+ expect(posted.messages[0]!.text).toBe(name)
})
it('refuses empty and overlong explicit names before posting', () => {
diff --git a/backend/src/superTabs/buddyNews.test.ts b/backend/src/superTabs/buddyNews.test.ts
index f0083cc84..d52d8b25f 100644
--- a/backend/src/superTabs/buddyNews.test.ts
+++ b/backend/src/superTabs/buddyNews.test.ts
@@ -36,9 +36,10 @@ function setup() {
audience: { people: [{ id: 'peer', generation: 'first' }] } }
state.conversations.push(chat)
/** peer's Buddy sends their proposal; the store reads the ask it names. */
- const propose = () => run({ type: 'buddy.propose', conversationId: chat.id, ownerMessageId: 'ask', ...proposal }, agentActor('buddy'),
+ const proposed = () => run({ type: 'buddy.propose', conversationId: chat.id, ownerMessageId: 'ask', ...proposal }, agentActor('buddy'),
{ proposalAsk: { id: 'ask', conversationId: chat.id, source: false, createdAt: 900,
- author: { kind: 'person', id: 'peer', name: 'peer', membershipGeneration: 'first' } } }).messages[0]!
+ author: { kind: 'person', id: 'peer', name: 'peer', membershipGeneration: 'first' } } }).messages
+ const propose = () => proposed()[0]!
/** The PM's post in the project chat, replying to [root] or to a reply in [root]'s thread, as the store loads that reply. */
const pmPost = (text: string, extra: { replyTo?: MessageDraft; root?: MessageDraft; mentions?: string[] } = {}, actor: Actor = agentActor(pm)) => {
const reply = extra.replyTo && { id: extra.replyTo.id, conversationId: extra.replyTo.conversationId, author: extra.replyTo.author, createdAt: 900,
@@ -46,7 +47,7 @@ function setup() {
return run({ type: 'message.send', conversationId: app.conversationId, text, recipientIds: [], replyTo: extra.replyTo?.id ?? null,
...(extra.mentions ? { mentions: extra.mentions } : {}) }, actor, reply ? { reply } : {}).messages.at(-1)!
}
- return { run, add, app, pm, chat: chat.id, propose, pmPost, get state() { return state } }
+ return { run, add, app, pm, chat: chat.id, proposed, propose, pmPost, get state() { return state } }
}
describe('which Buddy a project-chat message reaches (Diego, 10-29)', () => {
@@ -227,6 +228,42 @@ describe('work the PM opens from a Buddy\'s proposal without naming anyone (grou
}
})
+ describe('named by its details, the first reply and the row the PM is delivered (Scholes, 11-04)', () => {
+ /** The row the store loads for the named reply, with the row it replies to. */
+ const loaded = (reply: MessageDraft, root: MessageDraft) => ({ proposal: { id: reply.id, conversationId: reply.conversationId, author: reply.author,
+ source: reply.source ?? null, root: { id: root.id, conversationId: root.conversationId, author: root.author, source: root.source ?? null } } })
+ const open = (f: ReturnType<typeof setup>, reply: MessageDraft, root: MessageDraft) => f.run({ type: 'conversation.create', projectId: f.app.projectId,
+ title: 'Offline edits', brief: 'Save edits offline.', checks: [{ description: 'Tests pass', independent: false }], proposalMessageId: reply.id } as Command,
+ agentActor(f.pm), loaded(reply, root))
+
+ it('links the proposal itself: its person asked, its row is the task\'s only line, its Buddy is credited', () => {
+ const f = setup(), [root, details] = f.proposed() as [MessageDraft, MessageDraft]
+ const created = open(f, details, root)
+ const group = f.state.conversations.find(c => c.id === created.result.conversationId)!
+ expect(group.requesterId).toBe('peer')
+ expect(group.ledger?.proposal).toEqual({ buddyId: 'buddy', messageId: root.id })
+ expect(group.cards?.line).toMatchObject({ messageId: root.id, conversationId: f.app.conversationId })
+ expect(created.messages.filter(m => m.conversationId === f.app.conversationId)).toEqual([])
+ })
+
+ it('refuses any other reply in its thread, and the Buddy\'s reply under anything but its own proposal: nothing opens', () => {
+ const f = setup(), [root, details] = f.proposed() as [MessageDraft, MessageDraft]
+ const before = f.state.conversations.length
+ const wrongs: Array<[MessageDraft, MessageDraft]> = [
+ [{ ...details, author: { ...details.author, id: f.pm } }, root],
+ [{ ...details, author: { kind: 'person', id: 'peer', name: 'peer', membershipGeneration: 'first' } }, root],
+ [{ ...details, source: { kind: 'route' } }, root],
+ [details, { ...root, source: { kind: 'route', personId: 'peer', buddyId: 'buddy' } }],
+ [details, { ...root, source: { ...root.source, buddyId: 'other-buddy' } }],
+ [details, { ...root, conversationId: f.chat }],
+ ]
+ for (const [reply, under] of wrongs) {
+ expect(() => open(f, reply, under), JSON.stringify([reply, under])).toThrow('Name a Buddy\'s proposal posted in this project\'s chat, or leave the proposal out.')
+ }
+ expect(f.state.conversations.length).toBe(before)
+ })
+ })
+
it('credits nobody from a proposal posted in another project\'s chat, a private chat or by anyone but a Buddy: refused alike, nothing opened', () => {
const f = setup(), sent = f.propose()
const web = f.run({ type: 'project.create', name: 'Web', visibility: 'public', brief: '' }).result as { projectId: string; conversationId: string }
diff --git a/backend/src/superTabs/catchUp.ts b/backend/src/superTabs/catchUp.ts
index 8b6cf9075..884d9e95c 100644
--- a/backend/src/superTabs/catchUp.ts
+++ b/backend/src/superTabs/catchUp.ts
@@ -43,7 +43,7 @@ const authorOf = (row: CatchUpRow) => (row.author ?? {}) as RowAuthor
const kindOf = (row: CatchUpRow) => (row.source as { kind?: unknown } | null)?.kind
/** A row of the chat itself: top-level, from before threads, or a reply also sent to the chat (threads.ts). */
const inMainStream = (row: CatchUpRow) => !row.thread || row.thread === row.id || !!row.alsoInChat
-/** A "Let's build" root the server posted in its person's name (taskLine.ts, buddy.propose): not their own writing. */
+/** A task's root the server posted in its person's name (taskLine.ts, buddy.propose): not their own writing. */
const POSTED_FOR_AUTHOR = new Set<unknown>(['task-line', 'buddy-proposal'])
const own = (row: CatchUpRow, personId: string) => authorOf(row).kind === 'person' && authorOf(row).id === personId
&& !POSTED_FOR_AUTHOR.has(kindOf(row))
diff --git a/backend/src/superTabs/commands.ts b/backend/src/superTabs/commands.ts
index 2c0d7ea97..6f8235556 100644
--- a/backend/src/superTabs/commands.ts
+++ b/backend/src/superTabs/commands.ts
@@ -402,6 +402,8 @@ export function withoutCredentials(command: Command, removed: CredentialKind[]):
return copy
}
+/** A message row a group names as its proposal, as the store loads it. */
+interface ProposalRow { id: string; conversationId: string; author: Author; source: Record<string, unknown> | null }
export interface CommandContext {
operationId: string
now: number
@@ -441,7 +443,9 @@ export interface CommandContext {
* store (buddies.ts chosenBuddyName): a command loads only the chats it names. */
buddyNames?: import('./buddies.js').ChosenBuddyName[]
/** The proposal a new group names as its origin (conversation.create proposalMessageId), loaded from this tab by the store. */
- proposal?: { id: string; conversationId: string; author: Author; source: Record<string, unknown> | null }
+ proposal?: ProposalRow & {
+ /** When the named row is a reply with no source of its own: the row it replies to (proposalNamed). */
+ root?: ProposalRow }
/** The chat message a new group names as its request (conversation.create requestMessageId), loaded from this tab by the store. */
request?: { id: string; conversationId: string; author: Author; source: unknown; replyTo: string | null }
/** The message a Buddy's proposal names as its owner's request, loaded from this tab by the store. */
@@ -712,9 +716,15 @@ function askedByOf(state: SuperTabState, project: SwarmProject, personId: string
}
return member.id
}
+/** The proposal a group names. The PM is delivered the reply holding its details, not its root, so naming that reply means the
+ * proposal (Scholes, 11-04): only the Buddy's own reply under its own proposal does; proposalOf judges the root it returns. */
+function proposalNamed(named: CommandContext['proposal']): ProposalRow | undefined {
+ const root = named?.root
+ return root && !named.source && named.author.kind === 'agent' && named.author.id === root.source?.buddyId ? root : named
+}
/** The Buddy whose proposal a new group comes from: the message must be a Buddy's proposal posted in the project's chat. Its
* row is the Swarm's own (buddy.propose), so a Buddy removed since still earns for it. */
-function proposalOf(state: SuperTabState, project: SwarmProject, proposal: CommandContext['proposal']): { buddyId: string; messageId: string; personId?: string } {
+function proposalOf(state: SuperTabState, project: SwarmProject, proposal: ProposalRow | undefined): { buddyId: string; messageId: string; personId?: string } {
const author = proposal?.author
const buddyId = author?.kind === 'agent' ? author.id : typeof proposal?.source?.buddyId === 'string' ? proposal.source.buddyId : undefined
const buddy = buddyId ? state.agents.find(a => a.id === buddyId) : undefined
@@ -1978,7 +1988,7 @@ function applyCommandOnce(original: SuperTabState, actor: Actor, input: Command,
if (command.step && isStep(reviewed)) fail('STEP_OF_STEP', 'A step belongs to a task, not to another step.', 400)
}
// Who asked: the person named, else the one a Buddy's proposal was sent for, else a person opening it themselves.
- const proposal = command.proposalMessageId ? proposalOf(state, project, context.proposal) : undefined
+ const proposal = command.proposalMessageId ? proposalOf(state, project, proposalNamed(context.proposal)) : undefined
if (command.requestMessageId && (command.proposalMessageId || command.reviewOf || command.audience)) {
fail('INVALID_REQUEST', 'A request message opens a task of its own: leave out proposalMessageId, reviewOf and audience.', 400)
}
@@ -2285,7 +2295,7 @@ function applyCommandOnce(original: SuperTabState, actor: Actor, input: Command,
chat.proposals = [...chat.proposals ?? [], command.ownerMessageId].slice(-MAX_PROPOSAL_ASKS)
const project = readProject(state, actor, command.projectId ?? agentProjectId(state, self)), home = conversation(state, project.leadConversationId)
const name = owner.email.split('@')[0]!
- message(home.id, `Let's build: ${proposalTitle(command)}`, [], null,
+ message(home.id, proposalTitle(command), [], null,
{ kind: 'buddy-proposal', personId: owner.id, buddyId: self.id, ownerMessageId: command.ownerMessageId })
const root = effects.messages.at(-1)!
root.author = { kind: 'person', id: owner.id, name: owner.email, membershipGeneration: owner.generation }
diff --git a/backend/src/superTabs/pageReads.ts b/backend/src/superTabs/pageReads.ts
index 92cd8aa0c..08587d0c7 100644
--- a/backend/src/superTabs/pageReads.ts
+++ b/backend/src/superTabs/pageReads.ts
@@ -202,10 +202,14 @@ export async function deliveredCopies(tx: Transaction, tabId: string, rows: Read
export interface ThreadReply { thread: string; id: string; author: Author; mentions: string[]; sequence: number; createdAt: Date; agentOnly: boolean; routing: boolean
count?: number
/** A reply in a Buddy thread session's thread (buddySessions.ts), which the main Buddy never counts. */
- session?: boolean }
+ session?: boolean
+ /** Its source's kind, and what it says for its task's row (threads.ts). */
+ kind?: unknown
+ ask?: import('./taskLine.js').TaskAsk }
/** The rows of one thread that every reader sees or skips alike: one author, and one kind of row (agentOnly, routingRow). */
-interface ThreadPart { thread: string; root: boolean; kind?: unknown; only?: unknown; to: boolean; session?: boolean | null }
+interface ThreadPart { thread: string; root: boolean; kind?: unknown; only?: unknown; to: boolean; session?: boolean | null
+ ask?: import('./taskLine.js').TaskAsk }
/** One row of a part, by its place in the thread. */
interface ThreadPlace { s: number; i: string; at: unknown; author: Author; slot?: number }
/** What the database sums up of some threads' rows (threadFacet), as it returns it: the same whoever reads. */
@@ -224,7 +228,7 @@ export interface ThreadFacet {
*/
export async function threadFacet(tx: Transaction, tabId: string, conversationId: string, roots: string[]): Promise<ThreadFacet> {
const root = { $eq: ['$_id', '$thread'] }
- const part = { thread: '$thread', root, kind: '$source.kind', only: '$source.recipientsOnly',
+ const part = { thread: '$thread', root, kind: '$source.kind', only: '$source.recipientsOnly', ask: '$source.ask',
to: { $gt: [{ $size: { $ifNull: ['$recipientIds', []] } }, 0] }, author: { kind: '$author.kind', id: '$author.id' },
session: { $eq: ['$buddySession', true] } }
// (sequence, id) lead each place, so the database's min and max order rows as threadReplies sorts them (ids are ASCII).
@@ -253,7 +257,8 @@ export async function threadReplies(tx: Transaction, tabId: string, { parts, men
const row = (key: ThreadPart, at: ThreadPlace) => {
let kept = rows.get(at.i)
if (!kept) rows.set(at.i, kept = { thread: key.thread, id: at.i, author: at.author, mentions: [], sequence: at.s, createdAt: new Date(ms(at.at)),
- agentOnly: hidden(key), routing: routingRow({ kind: key.kind }), ...(key.session ? { session: true } : {}), count: 0, slots: [] })
+ agentOnly: hidden(key), routing: routingRow({ kind: key.kind }), ...(key.session ? { session: true } : {}), kind: key.kind,
+ ...(key.ask ? { ask: key.ask } : {}), count: 0, slots: [] })
return kept
}
for (const p of parts) {
diff --git a/backend/src/superTabs/store.ts b/backend/src/superTabs/store.ts
index bd3ac7a69..eccccdd82 100644
--- a/backend/src/superTabs/store.ts
+++ b/backend/src/superTabs/store.ts
@@ -1562,10 +1562,13 @@ export class SuperTabStore {
}
if (command.type === 'conversation.create' && command.proposalMessageId) {
// By id within this tab: the proposal a new group comes from (leaderboard/record.ts recordProposal).
- const proposal = await tx.superTabMessage.findFirst({ where: { id: command.proposalMessageId, tabId },
- select: { id: true, conversationId: true, author: true, source: true } })
- if (proposal) context.proposal = { id: proposal.id, conversationId: proposal.conversationId, author: proposal.author as unknown as Author,
- source: proposal.source as Record<string, unknown> | null }
+ const fields = { id: true, conversationId: true, author: true, source: true } as const
+ const proposal = await tx.superTabMessage.findFirst({ where: { id: command.proposalMessageId, tabId }, select: { ...fields, replyTo: true } })
+ // A reply with no source may be the proposal's details: the row it replies to is what commands.ts proposalNamed judges.
+ const root = proposal?.replyTo && !proposal.source ? await tx.superTabMessage.findFirst({ where: { id: proposal.replyTo, tabId }, select: fields }) : null
+ const row = (found: NonNullable<typeof root>) => ({ id: found.id, conversationId: found.conversationId, author: found.author as unknown as Author,
+ source: found.source as Record<string, unknown> | null })
+ if (proposal) context.proposal = { ...row(proposal), ...root ? { root: row(root) } : {} }
}
if (command.type === 'conversation.create' && command.requestMessageId) {
// By id within this tab: the person's chat message the new group answers (commands.ts requestOf checks where it is).
diff --git a/backend/src/superTabs/taskLine.test.ts b/backend/src/superTabs/taskLine.test.ts
index f9d501480..05eff68ad 100644
--- a/backend/src/superTabs/taskLine.test.ts
+++ b/backend/src/superTabs/taskLine.test.ts
@@ -37,7 +37,7 @@ describe('ordinary task messages and progress replies', () => {
const id = created.result.conversationId as string
const [root] = f.lines(created)
expect(root).toMatchObject({ conversationId: 'lead', author: { kind: 'person', id: 'owner', name: '[email protected]' },
- text: "Let's build: Offline drafts", replyTo: null, recipients: [], source: { kind: TASK_LINE_KIND, taskId: id } })
+ text: 'Offline drafts', replyTo: null, recipients: [], source: { kind: TASK_LINE_KIND, taskId: id } })
expect(created.messages.filter(m => m.thread === root!.id)).toEqual([expect.objectContaining({ text: 'Keep drafts.',
replyTo: root!.id, conversationId: 'lead' })])
expect(f.task(id).cards?.line?.messageId).toBe(root!.id)
@@ -46,7 +46,7 @@ describe('ordinary task messages and progress replies', () => {
it('uses the project PM when no requester is named, never the machine owner', () => {
const f = fixture()
const created = f.run({ type: 'conversation.create', title: 'Offline drafts', brief: 'Keep drafts.', checks: [] }, f.as(f.pm))
- expect(f.lines(created)[0]).toMatchObject({ author: { kind: 'agent', id: f.pm }, text: "Let's build: Offline drafts" })
+ expect(f.lines(created)[0]).toMatchObject({ author: { kind: 'agent', id: f.pm }, text: 'Offline drafts' })
})
const thread = (effects: CommandEffects, root: string) => effects.messages.filter(m => m.thread === root).map(m => m.text)
@@ -83,13 +83,60 @@ describe('ordinary task messages and progress replies', () => {
expect(thread(f.status(id, builder, 'review', 'Ready.'), root)).toEqual(['Ready for review.'])
})
+ // What each reply means for the task's row in the chat (threads.ts), so the tag outlives the task's own group.
+ describe('marks each reply with what it means for the row', () => {
+ const marks = (effects: CommandEffects, root: string) => effects.messages.filter(m => m.thread === root)
+ .map(m => (m.source as { ask?: string } | undefined)?.ask)
+
+ it('is on it from the brief to the merge, then shipped', () => {
+ const f = fixture(), first = f.run({ type: 'conversation.create', title: 'Offline drafts', brief: 'Keep drafts.', checks: [] } as Command)
+ const id = first.result.conversationId as string, root = f.task(id).cards!.line!.messageId
+ expect(marks(first, root)).toEqual(['on-it'])
+ const builder = f.add('Kai', id)
+ expect(marks(f.run({ type: 'work.assign', conversationId: id, agentId: builder }), root)).toEqual(['on-it'])
+ expect(marks(f.status(id, builder, 'review', `Ready: ${PR}`), root)).toEqual(['on-it'])
+ expect(marks(f.status(id, builder, 'done', `Checks passed: ${PR}`), root)).toEqual([])
+ expect(marks(f.run({ type: 'conversation.merged', conversationId: id, pullRequestUrl: PR }), root)).toEqual(['shipped'])
+ })
+
+ it('closes on a cancel, and on a task finished with no pull request', () => {
+ const cancelled = fixture(), a = cancelled.group(), rootA = cancelled.task(a).cards!.line!.messageId, kai = cancelled.add('Kai', a)
+ cancelled.run({ type: 'work.assign', conversationId: a, agentId: kai })
+ expect(marks(cancelled.run({ type: 'work.cancel', conversationId: a, assignmentId: cancelled.task(a).assignment!.id, reason: 'Not needed.' }), rootA))
+ .toEqual(['closed'])
+ const done = fixture(), b = done.group(), rootB = done.task(b).cards!.line!.messageId, lee = done.add('Lee', b)
+ done.run({ type: 'work.assign', conversationId: b, agentId: lee })
+ expect(marks(done.status(b, lee, 'done', 'Answered in the thread.'), rootB)).toEqual(['closed'])
+ })
+
+ it('tags the person\'s own message a task was opened from', () => {
+ const f = fixture(), generation = f.state.people[0]!.generation
+ const request = { id: 'ask', conversationId: 'lead', author: { kind: 'person' as const, id: 'owner', name: owner.email, membershipGeneration: generation },
+ source: null, replyTo: null }
+ const id = f.run({ type: 'conversation.create', title: 'Who answered', brief: 'Show who answered.', checks: [], requestMessageId: 'ask' } as Command,
+ f.as(f.pm), { request } as Partial<CommandContext>).result.conversationId as string
+ const builder = f.add('Kai', id)
+ expect(marks(f.run({ type: 'work.assign', conversationId: id, agentId: builder }), 'ask')).toEqual(['on-it'])
+ })
+
+ it('says shipped for a merge recorded with no card, which otherwise leaves the row on it', () => {
+ const f = fixture(), id = f.group(), root = f.task(id).cards!.line!.messageId, builder = f.add('Kai', id)
+ f.run({ type: 'work.assign', conversationId: id, agentId: builder })
+ f.status(id, builder, 'done', `Checks passed: ${PR}`)
+ delete f.task(id).cards!.pullRequests
+ const merged = f.run({ type: 'conversation.merged', conversationId: id, pullRequestUrl: PR })
+ expect(thread(merged, root)).toEqual(['Merged: PR #7. Ships in the next release.'])
+ expect(marks(merged, root)).toEqual(['shipped'])
+ })
+ })
+
it('reports each newly merged pull request once, including a second pull request for the same task', () => {
const f = fixture(), id = f.group(), root = f.task(id).cards!.line!.messageId
const second = 'https://github.com/example/app/pull/8'
for (const [url, n] of [[PR, 7], [second, 8]] as const) {
const merged = f.run({ type: 'conversation.merged', conversationId: id, pullRequestUrl: url })
expect(merged.messages.filter(m => m.thread === root)).toEqual([expect.objectContaining({ text: `Merged: PR #${n}. Ships in the next release.`,
- source: { kind: 'system' } })])
+ source: { kind: 'system', ask: 'shipped' } })])
expect(thread(f.run({ type: 'conversation.merged', conversationId: id, pullRequestUrl: url }), root)).toEqual([])
}
})
@@ -198,6 +245,6 @@ describe('ordinary task messages and progress replies', () => {
f.run({ type: 'work.assign', conversationId: id, agentId: builder })
delete f.task(id).cards
expect(f.lines(f.run({ type: 'message.send', conversationId: 'lead', text: 'Hello.', replyTo: null, recipientIds: [] }))).toEqual([])
- expect(f.lines(f.status(id, builder, 'review', 'Ready.'))[0]!.text).toBe("Let's build: Offline drafts")
+ expect(f.lines(f.status(id, builder, 'review', 'Ready.'))[0]!.text).toBe('Offline drafts')
})
})
diff --git a/backend/src/superTabs/taskLine.ts b/backend/src/superTabs/taskLine.ts
index 707971408..48184b672 100644
--- a/backend/src/superTabs/taskLine.ts
+++ b/backend/src/superTabs/taskLine.ts
@@ -47,12 +47,24 @@ function pullRequests(urls: readonly string[]): string {
const PULL_REQUEST = /https:\/\/github\.com\/[^\s/]+\/[^\s/]+\/pull\/\d+/g
+/** What a task's reply says for its row in the chat (threads.ts): the group leaves the apps once it archives, and this stays. */
+export type TaskAsk = 'on-it' | 'shipped' | 'closed'
+
+function taskAsk(group: Conversation): TaskAsk {
+ if (group.ledger?.mergedAt != null) return 'shipped'
+ const status = group.assignment?.status
+ if (status === 'cancelled' || status === 'stopped') return 'closed'
+ return status === 'done' && !group.pullRequestUrls?.length && !group.cards?.pullRequests?.length ? 'closed' : 'on-it'
+}
+
/** The thread's reply for what changed in [group] in this command, in the words Dee approved (2026-11-03), or none. */
function progress(state: SuperTabState, effects: CommandEffects, group: Conversation, previous: Conversation | undefined, pm: string): string | null {
const cards = group.cards?.pullRequests
const merged = cards?.length ? cards.filter(card => card.mergedAt !== undefined
&& previous?.cards?.pullRequests?.find(was => was.url === card.url)?.mergedAt === undefined).map(card => card.url) : []
if (merged.length) return `Merged: ${pullRequests(merged)}. Ships in the next release.`
+ // A merge with no card to mark is still the merge: its row has no other way to say it shipped.
+ if (group.ledger?.mergedAt != null && previous?.ledger?.mergedAt == null) return `Merged: ${pullRequests(group.pullRequestUrls ?? [])}. Ships in the next release.`
const assignment = group.assignment
const was = previous?.assignment
// Most tasks did not move in this command: they say nothing, and nothing more is read for them.
@@ -120,7 +132,7 @@ function moved(state: SuperTabState, effects: CommandEffects, group: Conversatio
const pm = chat.leadId && coordinator.kind === 'agent' && coordinator.id === chat.leadId ? coordinator.displayName ?? coordinator.name : 'the PM'
const reply = (id: string, words: string) => {
const root = group.cards!.line!.messageId
- effects.messages.push({ id, conversationId: chat.id, author: coordinator, text: words, replyTo: root, thread: root, recipients: [], source: { kind: 'system' } })
+ effects.messages.push({ id, conversationId: chat.id, author: coordinator, text: words, replyTo: root, thread: root, recipients: [], source: { kind: 'system', ask: taskAsk(group) } })
}
if (!line) {
const proposal = group.ledger?.proposal
@@ -131,7 +143,7 @@ function moved(state: SuperTabState, effects: CommandEffects, group: Conversatio
const requester = state.people.find(p => p.id === group.requesterId)
effects.messages.push({ id: root, conversationId: chat.id,
author: requester ? { kind: 'person', id: requester.id, name: requester.email, membershipGeneration: requester.generation } : coordinator,
- text: `Let's build: ${group.title}`, replyTo: null, recipients: [], source: { kind: TASK_LINE_KIND, ...fields(group) } })
+ text: group.title, replyTo: null, recipients: [], source: { kind: TASK_LINE_KIND, ...fields(group) } })
if (group.brief) reply(stableId(operationId, 'task-details', group.id), group.brief)
}
} else if (previous && previous.brief !== group.brief && group.brief) reply(stableId(operationId, 'task-details', group.id), group.brief)
diff --git a/backend/src/superTabs/threads.test.ts b/backend/src/superTabs/threads.test.ts
index 11f08790a..9e4da7ea4 100644
--- a/backend/src/superTabs/threads.test.ts
+++ b/backend/src/superTabs/threads.test.ts
@@ -41,4 +41,45 @@ describe('thread summaries', () => {
expect(threadSummaries(s.state, web, [reply('a', 'a', 0, agent('lead')), reply('b', 'b', 1, agent('lead')),
reply('a', 'a-1', 2, agent('ghost'), { agentOnly: true }), reply('b', 'b-1', 3, agent('a1'))]).map(t => t.id)).toEqual(['b'])
})
+
+ // Dee, 2026-11-04 (#2552): the state after the time, on the row of an ask.
+ describe('where an ask stands', () => {
+ const chat = { ...web, leadId: 'pm' }
+ const proposal = { kind: 'buddy-proposal' }, details = reply('p', 'p-1', 1, agent('buddy'))
+ const root = reply('p', 'p', 0, person(owner.userId), proposal)
+ const ask = (...rows: ThreadReply[]) => threadSummaries(s.state, chat, rows)[0]!.ask
+
+ it('is a proposal until the PM replies in its thread', () => {
+ expect(ask(root, details)).toBe('proposal')
+ expect(ask(root, details, reply('p', 'p-2', 2, person(peer.userId)))).toBe('proposal')
+ })
+
+ it('is no state after the PM\'s reply with no task, however many others replied since', () => {
+ expect(ask(root, details, reply('p', 'p-2', 2, agent('pm')))).toBeUndefined()
+ expect(ask(root, details, reply('p', 'p-2', 2, agent('pm')), reply('p', 'p-3', 3, agent('a1')), reply('p', 'p-4', 4, agent('a2')),
+ reply('p', 'p-5', 5, agent('a3')))).toBeUndefined()
+ })
+
+ it('does not take an agent-only note from the PM for a reply', () => {
+ expect(ask(root, details, reply('p', 'p-2', 2, agent('pm'), { agentOnly: true }))).toBe('proposal')
+ })
+
+ it('follows the task\'s newest mark, on any root', () => {
+ const own = reply('p', 'p', 0, person(owner.userId))
+ expect(ask(root, details, reply('p', 'p-2', 2, agent('pm'), { ask: 'on-it' }))).toBe('on-it')
+ expect(ask(own, reply('p', 'p-1', 1, agent('pm'), { ask: 'on-it' }))).toBe('on-it')
+ expect(ask(own, reply('p', 'p-1', 1, agent('pm'), { ask: 'on-it' }), reply('p', 'p-2', 2, agent('pm'), { ask: 'shipped' }),
+ reply('p', 'p-3', 3, person(peer.userId)))).toBe('shipped')
+ })
+
+ it('is no state once the task closed, and back on it when the task resumes', () => {
+ const closed = reply('p', 'p-2', 2, agent('pm'), { ask: 'closed' })
+ expect(ask(root, details, closed)).toBeUndefined()
+ expect(ask(root, details, closed, reply('p', 'p-3', 3, agent('pm'), { ask: 'on-it' }))).toBe('on-it')
+ })
+
+ it('leaves a plain thread with none', () => {
+ expect(ask(reply('p', 'p', 0, person(owner.userId)), reply('p', 'p-1', 1, agent('pm')))).toBeUndefined()
+ })
+ })
})
diff --git a/backend/src/superTabs/threads.ts b/backend/src/superTabs/threads.ts
index 29b2bc881..4175ef220 100644
--- a/backend/src/superTabs/threads.ts
+++ b/backend/src/superTabs/threads.ts
@@ -1,6 +1,7 @@
import type { Author, Conversation, SuperTabState } from './model.js'
import type { ThreadReply } from './pageReads.js'
import { canReadGroup } from './projects.js'
+import type { TaskAsk } from './taskLine.js'
/** What a page says about one thread: the line under its root, and who it marks unread for. */
export interface ThreadSummary {
@@ -12,6 +13,16 @@ export interface ThreadSummary {
authors: Author[]
/** People who wrote in the thread or were tagged in it, in order of first appearance. */
people: string[]
+ /** Where the ask at its root stands: the row's tag in the chat (Dee, 2026-11-04). */
+ ask?: Exclude<TaskAsk, 'closed'> | 'proposal'
+}
+
+/** A task's newest mark decides (taskLine.ts). With none, a Buddy's proposal is an ask until the PM has answered it. */
+function askOf(group: Conversation, root: string, thread: ThreadReply[]): ThreadSummary['ask'] {
+ const mark = thread.findLast(row => row.ask)?.ask
+ if (mark) return mark === 'closed' ? undefined : mark
+ const asked = thread.some(row => row.id === root && row.kind === 'buddy-proposal')
+ return asked && !thread.some(row => row.id !== root && row.author.kind === 'agent' && row.author.id === group.leadId) ? 'proposal' : undefined
}
/** Summaries of the threads in `rows` (pageThreads, oldest first), roots with no reply left out; a row counts as `count`
@@ -36,6 +47,8 @@ export function threadSummaries(state: SuperTabState, group: Conversation, rows:
.filter(person => readable({ kind: 'person', id: person }))
const authors = [...new Map(replies.toReversed().map(row => [`${row.author.kind}:${row.author.id}`, row.author])).values()]
.filter(readable).slice(0, 3)
- return [{ id, replies: replies.reduce((sum, row) => sum + (row.count ?? 1), 0), lastSequence: last.sequence, lastAt: last.createdAt, authors, people }]
+ const ask = askOf(group, id, thread)
+ return [{ id, replies: replies.reduce((sum, row) => sum + (row.count ?? 1), 0), lastSequence: last.sequence, lastAt: last.createdAt, authors, people,
+ ...(ask ? { ask } : {}) }]
})
}
diff --git a/backend/vitest.super-tabs.config.ts b/backend/vitest.super-tabs.config.ts
index 35ad8d7db..f13304bfc 100644
--- a/backend/vitest.super-tabs.config.ts
+++ b/backend/vitest.super-tabs.config.ts
@@ -7,6 +7,6 @@ export default defineConfig({ test: { include: ['integration/superTabs.test.ts',
'integration/superTabObserver.test.ts', 'integration/productUsageConflicts.test.ts', 'integration/productUsageReceipts.test.ts', 'integration/schemaRelease.test.ts', 'integration/superTabBuddies.test.ts', 'integration/superTabNotAvailable.test.ts',
'integration/superTabBuddyProbes.test.ts', 'integration/superTabBuddySessions.test.ts', 'integration/superTabSwarmBuddy.test.ts', 'integration/superTabCosts.test.ts', 'integration/harnessSharesList.test.ts', 'integration/harnessSharesIndexPlan.test.ts', 'integration/atlasSnapshot.test.ts', 'integration/queryStats.test.ts',
'integration/superTabEvidence.test.ts', 'integration/superTabAttemptModels.test.ts', 'integration/superTabNamedReads.test.ts', 'integration/swarmSweepPlans.test.ts', 'integration/workerIndexPlans.test.ts', 'integration/superTabReflection.test.ts',
- 'integration/superTabMessagePages.test.ts', 'integration/superTabDeliveryCompaction.test.ts', 'integration/superTabNoticeDigest.test.ts', 'integration/superTabCommandLoads.test.ts', 'integration/superTabThreads.test.ts', 'integration/superTabMachineRemovals.test.ts',
- 'integration/superTabInstructions.test.ts', 'integration/superTabWorkflow.test.ts', 'integration/superTabTaskLines.test.ts', 'integration/superTabDeletion.test.ts', 'integration/communityReports.test.ts', 'integration/superTabMachineNames.test.ts', 'integration/superTabTagsClear.test.ts', 'integration/swarmAgentTombstones.test.ts', 'integration/superTabPullRequestEvents.test.ts'], hookTimeout: 120000, testTimeout: 30000, setupFiles: ['integration/cacheOn.test-support.ts', 'src/lib/noRedis.test-support.ts'],
+ 'integration/superTabMessagePages.test.ts', 'integration/superTabDeliveryCompaction.test.ts', 'integration/superTabNoticeDigest.test.ts', 'integration/superTabDigestHour.test.ts', 'integration/superTabCommandLoads.test.ts', 'integration/superTabThreads.test.ts', 'integration/superTabMachineRemovals.test.ts',
+ 'integration/superTabInstructions.test.ts', 'integration/superTabWorkflow.test.ts', 'integration/superTabTaskLines.test.ts', 'integration/superTabDeletion.test.ts', 'integration/communityReports.test.ts', 'integration/superTabMachineNames.test.ts', 'integration/superTabTagsClear.test.ts', 'integration/swarmAgentTombstones.test.ts', 'integration/superTabPullRequestEvents.test.ts'], hookTimeout: 120000, testTimeout: 30000, setupFiles: ['integration/noDefaultDigest.test-support.ts', 'integration/cacheOn.test-support.ts', 'src/lib/noRedis.test-support.ts'],
fileParallelism: false, env: { NODE_ENV: 'test', HARNESS_CREDENTIAL_ENCRYPTION_KEY: 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=' } } })
diff --git a/cli/src/lib/swarmSkills.spec.ts b/cli/src/lib/swarmSkills.spec.ts
index 7cc5b3c35..527744c2d 100644
--- a/cli/src/lib/swarmSkills.spec.ts
+++ b/cli/src/lib/swarmSkills.spec.ts
@@ -115,7 +115,7 @@ describe('built-in Swarm skills', () => {
// The requests section (Lead's ruling for v2 G, the human leaderboard, 2026-10-27): the Lead's alone, in both modes, in a
// section of its own so other groups' edits to the Lead text merge cleanly.
const update = '- Codex\'s "Update available" screen on a worker is dismissed with Esc alone, never a number and Enter (on a misread row that runs the update) and never as a question for the owner. The host does it for Swarm agents when the screen is exactly that prompt; if one still waits on it, press Esc yourself.\n'
- const requests = '## Requests and Done\n- When you open a group for a person\'s request, asked in the project chat or proposed by their Buddy on their behalf, name them as its requester: requesterId on conversation.create, or conversation.requester for a group already open. It records only that they asked, never what they wrote. Name the message it came from as well: proposalMessageId for their Buddy\'s proposal, requestMessageId for their own message in the project chat. That message stays the task\'s one message in the chat; without one, the Swarm posts "Let\'s build: <title>" as them. The Swarm replies in its thread at each change, so you post no progress there.\n- Right after you merge a group\'s pull request, record it: conversation.merged with the group and the PR link, and mergedAt for a merge you record later. The leaderboard counts the request as shipped at the merge, even if its work is lost or cancelled afterwards. Mark a group Done only after its pull request has merged.\n\n'
+ const requests = '## Requests and Done\n- When you open a group for a person\'s request, asked in the project chat or proposed by their Buddy on their behalf, name them as its requester: requesterId on conversation.create, or conversation.requester for a group already open. It records only that they asked, never what they wrote. Name the message it came from as well: proposalMessageId for their Buddy\'s proposal, requestMessageId for their own message in the project chat. That message stays the task\'s one message in the chat; without one, the Swarm posts the title as them, marked as a task. The Swarm replies in its thread at each change, so you post no progress there.\n- Right after you merge a group\'s pull request, record it: conversation.merged with the group and the PR link, and mergedAt for a merge you record later. The leaderboard counts the request as shipped at the merge, even if its work is lost or cancelled afterwards. Mark a group Done only after its pull request has merged.\n\n'
// Last in the Default Lead text, which has no red flags: after a blank line, ending the text.
const requestsLast = `\n${requests.trimEnd()}\n`
// The shared-machine rules (Ken, 2026-10-28): the Builder's and the Reviewer's alone, in both modes, in a section of their
diff --git a/cli/src/lib/swarmSkills.ts b/cli/src/lib/swarmSkills.ts
index 9b001b243..7765d1013 100644
--- a/cli/src/lib/swarmSkills.ts
+++ b/cli/src/lib/swarmSkills.ts
@@ -174,7 +174,7 @@ For large work, post the group plan and get the owner's ok before assigning; onc
- When a group's pull request merges, react 🚀 to the message that assigned its work.
## Requests and Done
-- When you open a group for a person's request, asked in the project chat or proposed by their Buddy on their behalf, name them as its requester: requesterId on conversation.create, or conversation.requester for a group already open. It records only that they asked, never what they wrote. Name the message it came from as well: proposalMessageId for their Buddy's proposal, requestMessageId for their own message in the project chat. That message stays the task's one message in the chat; without one, the Swarm posts "Let's build: <title>" as them. The Swarm replies in its thread at each change, so you post no progress there.
+- When you open a group for a person's request, asked in the project chat or proposed by their Buddy on their behalf, name them as its requester: requesterId on conversation.create, or conversation.requester for a group already open. It records only that they asked, never what they wrote. Name the message it came from as well: proposalMessageId for their Buddy's proposal, requestMessageId for their own message in the project chat. That message stays the task's one message in the chat; without one, the Swarm posts the title as them, marked as a task. The Swarm replies in its thread at each change, so you post no progress there.
- Right after you merge a group's pull request, record it: conversation.merged with the group and the PR link, and mergedAt for a merge you record later. The leaderboard counts the request as shipped at the merge, even if its work is lost or cancelled afterwards. Mark a group Done only after its pull request has merged.
## Red flags
@@ -495,7 +495,7 @@ When the project owner asks in chat to switch this project's skills (Default or
- When a group's pull request merges, react 🚀 to the message that assigned its work.
## Requests and Done
-- When you open a group for a person's request, asked in the project chat or proposed by their Buddy on their behalf, name them as its requester: requesterId on conversation.create, or conversation.requester for a group already open. It records only that they asked, never what they wrote. Name the message it came from as well: proposalMessageId for their Buddy's proposal, requestMessageId for their own message in the project chat. That message stays the task's one message in the chat; without one, the Swarm posts "Let's build: <title>" as them. The Swarm replies in its thread at each change, so you post no progress there.
+- When you open a group for a person's request, asked in the project chat or proposed by their Buddy on their behalf, name them as its requester: requesterId on conversation.create, or conversation.requester for a group already open. It records only that they asked, never what they wrote. Name the message it came from as well: proposalMessageId for their Buddy's proposal, requestMessageId for their own message in the project chat. That message stays the task's one message in the chat; without one, the Swarm posts the title as them, marked as a task. The Swarm replies in its thread at each change, so you post no progress there.
- Right after you merge a group's pull request, record it: conversation.merged with the group and the PR link, and mergedAt for a merge you record later. The leaderboard counts the request as shipped at the merge, even if its work is lost or cancelled afterwards. Mark a group Done only after its pull request has merged.
`,
dev: `---
@@ -660,7 +660,7 @@ You are one person's Buddy. Your start note says which: their one Buddy for ever
- Write the goal, the scope and a priority (low, normal or high) from what you agreed. Put in only what your owner wants sent; anything private stays in your chat.
- Send it with harness super-tab --tab TAB propose OPERATION_ID '{"conversationId":"CHAT","ownerMessageId":"MESSAGE","projectId":"PROJECT","title":"Short name (at most 80 characters)","goal":"...","scope":"...","priority":"normal"}', where MESSAGE is the id of your owner's message asking you to send it and PROJECT is the project's id from status (a session in one project leaves projectId out). One message sends one proposal, to one project.
- To hand the PM a plan, spec, log or screenshot, attach it, up to 5 files of 10 MB each: add --attach PATH for a file inside your folder (as your owner's one Buddy, inside that project's folder under projects/), and "attachmentIds":["ID"] in the JSON for a file your owner sent in your chat (its id is on their message). Attach only what your owner wants sent; nothing from anywhere else.
-- The Swarm posts it in the project chat as one plain message from your owner, "Let's build: <title>", with your full proposal as the first reply in its thread, for the PM. Tell your owner it went; the PM answers in the project chat.
+- The Swarm posts it in the project chat as one plain message from your owner, reading the title alone, with your full proposal as the first reply in its thread, for the PM. Tell your owner it went; the PM answers in the project chat.
## Tell your owner how it goes
- The Swarm hands you, unasked, the project-chat lines that answer your owner's proposals, tag your owner, or say work they requested shipped, and a notice when work they requested is assigned. Nothing else of the project, and nothing once your owner stops reading it.
diff --git a/desktop/lib/super_tabs/backlog.dart b/desktop/lib/super_tabs/backlog.dart
index 9771252a9..ece842b0a 100644
--- a/desktop/lib/super_tabs/backlog.dart
+++ b/desktop/lib/super_tabs/backlog.dart
@@ -22,6 +22,15 @@ enum SuperTabBacklogGroup {
/// reshape of Scholes's ask, task #2551).
const superTabBacklogShippedWindow = Duration(days: 7);
+/// Whether [task] has shipped (task #2558): a recorded merge of any of its pull
+/// requests (a batch's counts, its own closed), or Done with none to merge. Its
+/// `shippedAt` alone cannot say: the server sets that at the first Done.
+bool _shipped(SuperTabConversation task, Object? status) =>
+ task.cards.pullRequests.any((card) => card.merged) ||
+ (status == 'done' &&
+ task.cards.pullRequests.isEmpty &&
+ task.pullRequestUrls.isEmpty);
+
/// Which group [task] is listed in at [now]; null for one that is not listed:
/// cancelled, closed without shipping, or shipped before the window. A wait on
/// a person is "Waiting on someone", as the sidebar's groups read it
@@ -30,14 +39,22 @@ SuperTabBacklogGroup? superTabBacklogGroupOf(
SuperTabConversation task,
DateTime now,
) {
- if (task.shippedAt case final shipped?) {
- return now.difference(shipped) > superTabBacklogShippedWindow
- ? null
- : SuperTabBacklogGroup.shipped;
+ final status = task.assignment?['status'];
+ final at = task.shippedAt;
+ final inWindow =
+ at != null && now.difference(at) <= superTabBacklogShippedWindow;
+ if (at != null && _shipped(task, status)) {
+ if (inWindow) return SuperTabBacklogGroup.shipped;
+ // Past the window, unless it is back at work.
+ if (task.closed || status == 'done') return null;
+ }
+ // Quiet for a day is still waiting for its merge; archived is over.
+ if (task.closed) {
+ return !task.archived && status == 'done' && inWindow
+ ? SuperTabBacklogGroup.readyToMerge
+ : null;
}
- if (task.closed) return null;
final assignment = task.assignment;
- final status = assignment?['status'];
final liveness = task.liveness;
final wait = liveness?['state'] == 'waiting' ? liveness!['why'] : null;
if (status == 'cancelled') return null;
diff --git a/desktop/lib/super_tabs/controller.dart b/desktop/lib/super_tabs/controller.dart
index acb8fd836..bf1dfda05 100644
--- a/desktop/lib/super_tabs/controller.dart
+++ b/desktop/lib/super_tabs/controller.dart
@@ -4011,8 +4011,8 @@ class SuperTabController extends ChangeNotifier {
}
}
- /// Closed tasks read for the Backlog that shipped since the read's window
- /// began, by id. Kept here so an open of the tab reads nothing again: a task
+ /// Closed tasks read for the Backlog whose `shippedAt` falls in the read's
+ /// window, by id; the Backlog places them, as some wait for their merge. Kept here so an open of the tab reads nothing again: a task
/// that closes later is one this reader holds, and [snapshot] keeps it. They
/// join no snapshot, which is built again on every change, and no project's
/// "Closed" count.
diff --git a/desktop/lib/super_tabs/message_row.dart b/desktop/lib/super_tabs/message_row.dart
index 232ed2d9b..dcac96de1 100644
--- a/desktop/lib/super_tabs/message_row.dart
+++ b/desktop/lib/super_tabs/message_row.dart
@@ -154,14 +154,20 @@ class SuperTabMessageRow extends StatefulWidget {
/// the rows shown (view.dart).
static const groupLimit = 20;
+ static bool _untagged(SuperTabMessage _) => false;
+
/// The messages that join the one above them under its header: like Slack,
/// one sender's messages within five minutes of each other, whatever their
/// length (Huy, 2026-11-03, #2419), up to [groupLimit] to a group.
- static Set<String> consecutiveUpdates(List<SuperTabMessage> messages) {
+ static Set<String> consecutiveUpdates(
+ List<SuperTabMessage> messages, {
+ bool Function(SuperTabMessage) tagged = _untagged,
+ }) {
final joined = <String>{};
var first = 0;
for (var i = 1; i < messages.length; i++) {
- if (i - first < groupLimit && groupsWith(messages[i], messages[i - 1])) {
+ if (i - first < groupLimit &&
+ groupsWith(messages[i], messages[i - 1], tagged: tagged)) {
joined.add(messages[i].id);
} else {
first = i;
@@ -173,15 +179,19 @@ class SuperTabMessageRow extends StatefulWidget {
/// Whether [current] joins [previous]'s header: the same sender, within five
/// minutes on the same day. In the chat, a thread reply shown there stands
/// on its own with its Replied in thread line; [inThread], replies group. A
- /// line that draws its own row has no header to share, on either side.
+ /// line that draws its own row has no header to share, on either side, and
+ /// a [tagged] row's header is where its tag shows.
static bool groupsWith(
SuperTabMessage current,
SuperTabMessage? previous, {
bool inThread = false,
+ bool Function(SuperTabMessage) tagged = _untagged,
}) {
if (previous == null ||
current.drawsOwnRow ||
previous.drawsOwnRow ||
+ tagged(current) ||
+ tagged(previous) ||
// A message that started a session stands on its own, with its line.
current.sessionRoot ||
previous.sessionRoot ||
@@ -481,6 +491,11 @@ class _SuperTabMessageRowState extends State<SuperTabMessageRow> {
style: SwarmType.time(context),
),
),
+ if (widget.thread?.askTag case final tag?)
+ Text(
+ tag,
+ style: SwarmType.time(context),
+ ),
],
),
),
diff --git a/desktop/lib/super_tabs/model.dart b/desktop/lib/super_tabs/model.dart
index 6146f3b8c..ef4b5b809 100644
--- a/desktop/lib/super_tabs/model.dart
+++ b/desktop/lib/super_tabs/model.dart
@@ -476,7 +476,8 @@ class SuperTabConversation {
/// task, and from a server that does not say.
final String? requesterId;
- /// When it shipped (its first Done); null until it has, and from a server
+ /// Its first Done, or its merge once one is recorded: not proof that it merged
+ /// (a pull request card's `merged` is); null until then, and from a server
/// that does not say.
final DateTime? shippedAt;
final Map<String, dynamic>? assignment;
@@ -1281,7 +1282,8 @@ class SuperTabDelivery {
class SuperTabThread {
/// A thread with no reply yet: a session's, started from the main chat.
SuperTabThread.empty(this.id)
- : replies = 0,
+ : ask = null,
+ replies = 0,
lastSequence = 0,
lastAt = null,
authors = const [],
@@ -1289,6 +1291,7 @@ class SuperTabThread {
SuperTabThread.fromJson(Map<String, dynamic> row)
: id = _text(row, 'id'),
+ ask = row['ask'] as String?,
replies = (row['replies'] as num).toInt(),
lastSequence = (row['lastSequence'] as num).toInt(),
lastAt = DateTime.tryParse(row['lastAt'] as String? ?? ''),
@@ -1299,9 +1302,21 @@ class SuperTabThread {
(row['people'] as List? ?? const []).whereType<String>(),
);
final String id;
+
+ /// Where the ask at its root stands (backend threads.ts).
+ final String? ask;
final int replies, lastSequence;
final DateTime? lastAt;
+ /// What its root's row says after the time; null for a message that is no
+ /// ask, and for a state this app does not know.
+ String? get askTag => switch (ask) {
+ 'proposal' => '✋ Proposal',
+ 'on-it' => '● On it',
+ 'shipped' => '✓ Shipped',
+ _ => null,
+ };
+
/// The newest distinct reply authors, newest first: the first wrote the
/// last reply.
final List<Map<String, dynamic>> authors;
@@ -1310,11 +1325,28 @@ class SuperTabThread {
final List<String> people;
}
+/// The source kinds of a task's root in the project chat.
+const _taskRootKinds = {'task-line', 'buddy-proposal'};
+
+/// What a task's root posted before #2867 reads ahead of its title. Stored rows
+/// keep it, so this stays for as long as rows from before 2026-11-04 are kept.
+const _oldTaskRootPrefix = "Let's build: ";
+
+String _messageText(Map<String, dynamic> row) {
+ final text = _text(row, 'text');
+ return _taskRootKinds.contains(
+ superTabMap(row['source'] ?? const {})['kind'],
+ ) &&
+ text.startsWith(_oldTaskRootPrefix)
+ ? text.substring(_oldTaskRootPrefix.length)
+ : text;
+}
+
class SuperTabMessage {
SuperTabMessage.fromJson(Map<String, dynamic> row)
: id = _text(row, 'id'),
conversationId = _text(row, 'conversationId'),
- text = _text(row, 'text'),
+ text = _messageText(row),
replyTo = row['replyTo'] as String?,
thread = row['thread'] as String?,
alsoInChat = row['alsoInChat'] == true,
@@ -1389,11 +1421,10 @@ class SuperTabMessage {
SuperTabRoute? get route => SuperTabRoute.fromSource(source);
bool get routeOverride => source['kind'] == 'route-override';
- /// A "Let's build" root the server posted in its person's name (plain chat,
- /// #2294): theirs to read, not their own writing, so it reads nothing
- /// before it and is unread for them as anyone else's message is.
- bool get postedForAuthor =>
- source['kind'] == 'task-line' || source['kind'] == 'buddy-proposal';
+ /// A task's root the server posted in its person's name (plain chat, #2294):
+ /// theirs to read, not their own writing, so it reads nothing before it and
+ /// is unread for them as anyone else's message is.
+ bool get postedForAuthor => _taskRootKinds.contains(source['kind']);
/// The agent a "waiting at a prompt" note is about; null for any other row.
String? get promptAlertAgentId =>
diff --git a/desktop/lib/super_tabs/view.dart b/desktop/lib/super_tabs/view.dart
index 0eae28378..ac28bf613 100644
--- a/desktop/lib/super_tabs/view.dart
+++ b/desktop/lib/super_tabs/view.dart
@@ -3374,22 +3374,30 @@ class _SuperTabViewState extends State<SuperTabView>
/// [SuperTabMessageRow.groupLimit] to a group. Groups are counted from the
/// list's dividing row both ways, so a page read in above regroups none of
/// the rows already shown.
- static Set<String> _joined(
- List<SuperTabMessage> messages,
- SuperTabMessage? split,
- ) {
+ Set<String> _joined(List<SuperTabMessage> messages, SuperTabMessage? split) {
+ bool tagged(SuperTabMessage m) =>
+ c.thread(m.conversationId, m.id)?.askTag != null;
final at = split == null
? -1
: messages.indexWhere((m) => superTabMessageOrder(m, split) >= 0);
- if (at <= 0) return SuperTabMessageRow.consecutiveUpdates(messages);
- final joined = SuperTabMessageRow.consecutiveUpdates(messages.sublist(at));
+ if (at <= 0) {
+ return SuperTabMessageRow.consecutiveUpdates(messages, tagged: tagged);
+ }
+ final joined = SuperTabMessageRow.consecutiveUpdates(
+ messages.sublist(at),
+ tagged: tagged,
+ );
// Above it, upward: each group, newest first, keeps the name on its
// oldest row.
var group = [at - 1];
for (var i = at - 2; i >= -1; i--) {
if (i >= 0 &&
group.first - i < SuperTabMessageRow.groupLimit &&
- SuperTabMessageRow.groupsWith(messages[i + 1], messages[i])) {
+ SuperTabMessageRow.groupsWith(
+ messages[i + 1],
+ messages[i],
+ tagged: tagged,
+ )) {
group.add(i);
continue;
}
diff --git a/desktop/test/super_tab_backlog_shots_test.dart b/desktop/test/super_tab_backlog_shots_test.dart
index 33f43fda3..c586f4b5c 100644
--- a/desktop/test/super_tab_backlog_shots_test.dart
+++ b/desktop/test/super_tab_backlog_shots_test.dart
@@ -118,11 +118,22 @@ void main() {
'personId': 'scholes',
'since': now,
},
- if (state == 5) 'shippedAt': now,
+ if (state >= 4) 'shippedAt': now,
if (state > 0)
'pullRequestUrls': [
'https://github.com/autonomous-ai/openharness/pull/${number + 400}',
],
+ if (state == 5)
+ 'cards': {
+ 'pullRequests': [
+ {
+ 'url':
+ 'https://github.com/autonomous-ai/openharness/pull/${number + 400}',
+ 'messageId': 'card-$number',
+ 'mergedAt': now,
+ },
+ ],
+ },
});
number++;
}
@@ -156,6 +167,16 @@ void main() {
'pullRequestUrls': [
'https://github.com/autonomous-ai/openharness/pull/${2600 + i}',
],
+ 'cards': {
+ 'pullRequests': [
+ {
+ 'url':
+ 'https://github.com/autonomous-ai/openharness/pull/${2600 + i}',
+ 'messageId': 'card-$i',
+ 'mergedAt': shipped,
+ },
+ ],
+ },
},
]);
}
diff --git a/desktop/test/super_tab_backlog_test.dart b/desktop/test/super_tab_backlog_test.dart
index 0c619cea0..e39fd7e79 100644
--- a/desktop/test/super_tab_backlog_test.dart
+++ b/desktop/test/super_tab_backlog_test.dart
@@ -153,6 +153,107 @@ void main() {
}
});
+ group('Shipped means merged, as the server tells it (task #2558)', () {
+ final at = DateTime.fromMillisecondsSinceEpoch(now);
+ const day = 86400000;
+ const own = 'https://github.com/acme/app/pull/7';
+ const batch = 'https://github.com/acme/app/pull/8';
+
+ /// A task as the read path answers it (backend superTabRead.test.ts): the
+ /// first Done sets shippedAt; only a recorded merge sets a card's mergedAt.
+ SuperTabBacklogGroup? placed(
+ String status, {
+ int? shippedAt = now,
+ List<String> urls = const [own],
+ List<Map<String, dynamic>>? cards,
+ bool archived = false,
+ bool dormant = false,
+ }) => superTabBacklogGroupOf(
+ SuperTabConversation.fromJson({
+ ...conversationFixture('work', 'A task'),
+ 'assignment': working(status),
+ 'shippedAt': ?shippedAt,
+ 'pullRequestUrls': urls,
+ 'cards': {
+ 'pullRequests':
+ cards ??
+ [
+ for (final url in urls) {'url': url, 'messageId': 'm-$url'},
+ ],
+ },
+ if (archived) 'archived': true,
+ if (dormant) 'dormant': true,
+ }),
+ at,
+ );
+ Map<String, dynamic> merged(String url, {int at = now}) => {
+ 'url': url,
+ 'messageId': 'm-$url',
+ 'mergedAt': at,
+ };
+
+ test('a Done task with an open pull request is Ready to merge', () {
+ expect(placed('done'), SuperTabBacklogGroup.readyToMerge);
+ });
+
+ test('a Done task whose link has no card yet is Ready to merge', () {
+ expect(
+ placed('done', cards: const []),
+ SuperTabBacklogGroup.readyToMerge,
+ );
+ });
+
+ test('a task whose pull request merged is Shipped', () {
+ expect(
+ placed('done', cards: [merged(own)]),
+ SuperTabBacklogGroup.shipped,
+ );
+ });
+
+ test('a merge recorded on a batch pull request counts, its own closed', () {
+ expect(
+ placed(
+ 'done',
+ urls: const [own, batch],
+ cards: [
+ {'url': own, 'messageId': 'm1'},
+ merged(batch),
+ ],
+ ),
+ SuperTabBacklogGroup.shipped,
+ );
+ });
+
+ test('a Done task with no pull request has nothing to merge: Shipped', () {
+ expect(placed('done', urls: const []), SuperTabBacklogGroup.shipped);
+ });
+
+ test('Ready to merge stays after a day quiet, while its window lasts', () {
+ expect(placed('done', dormant: true), SuperTabBacklogGroup.readyToMerge);
+ expect(placed('done', dormant: true, shippedAt: now - 8 * day), isNull);
+ });
+
+ test('an archived task whose pull request never merged is not listed', () {
+ expect(placed('done', archived: true), isNull);
+ });
+
+ test('work back on after its first Done goes by its state', () {
+ expect(placed('working'), SuperTabBacklogGroup.working);
+ expect(placed('working', urls: const []), SuperTabBacklogGroup.working);
+ });
+
+ test('merged long ago and back at work is listed as Working', () {
+ expect(
+ placed(
+ 'working',
+ shippedAt: now - 8 * day,
+ cards: [merged(own, at: now - 8 * day)],
+ ),
+ SuperTabBacklogGroup.working,
+ );
+ });
+ });
+
group('Shipped looks back 7 days, and a closed task only counts shipped', () {
final at = DateTime.fromMillisecondsSinceEpoch(now);
const day = 86400000;
@@ -326,6 +427,12 @@ void main() {
'liveness': ?liveness,
'shippedAt': ?shippedAt,
if (pr != null) 'pullRequestUrls': [pr],
+ if (pr != null && shippedAt != null)
+ 'cards': {
+ 'pullRequests': [
+ {'url': pr, 'messageId': 'card-$id', 'mergedAt': shippedAt},
+ ],
+ },
};
conversations.addAll(<Map<String, dynamic>>[
{...conversationFixture('api-chat', 'api'), 'projectId': 'api'},
@@ -698,6 +805,40 @@ void main() {
expect(c.snapshot!.conversation('recent'), isNull);
});
+ testWidgets('a quiet Done task with an open pull request is Ready to '
+ 'merge, read as the closed list answers it', (tester) async {
+ final server = swarm();
+ server.parts.clock = now;
+ add(server, [
+ {
+ ...archived('waiting', 90),
+ 'archived': false,
+ 'dormant': true,
+ 'pullRequestUrls': ['https://github.com/acme/app/pull/90'],
+ 'cards': {
+ 'pullRequests': [
+ {
+ 'url': 'https://github.com/acme/app/pull/90',
+ 'messageId': 'card-90',
+ },
+ ],
+ },
+ },
+ ]);
+ await show(tester, server, today: at);
+ expect(row('waiting'), findsOneWidget);
+ expect(
+ tester.getTopLeft(row('waiting')).dy,
+ lessThan(tester.getTopLeft(header(SuperTabBacklogGroup.shipped)).dy),
+ );
+ expect(
+ tester.getTopLeft(row('waiting')).dy,
+ greaterThan(
+ tester.getTopLeft(header(SuperTabBacklogGroup.readyToMerge)).dy,
+ ),
+ );
+ });
+
testWidgets('it reads on through every page of the last 7 days', (
tester,
) async {
diff --git a/desktop/test/super_tab_message_grouping_test.dart b/desktop/test/super_tab_message_grouping_test.dart
index 269c1806d..0c9ba38ff 100644
--- a/desktop/test/super_tab_message_grouping_test.dart
+++ b/desktop/test/super_tab_message_grouping_test.dart
@@ -83,6 +83,24 @@ void main() {
};
group('the rule', () {
+ // Its header is where its tag shows (#2552), and a message after it is not
+ // part of that ask.
+ test('a tagged row stands on its own, on either side', () {
+ final messages = [
+ message(1, start),
+ message(2, start.add(const Duration(minutes: 1))),
+ message(3, start.add(const Duration(minutes: 2))),
+ message(4, start.add(const Duration(minutes: 3))),
+ ];
+ expect(
+ SuperTabMessageRow.consecutiveUpdates(
+ messages,
+ tagged: (m) => m.id == 'm2',
+ ),
+ {'m4'},
+ );
+ });
+
test('one sender within five minutes groups at any length', () {
final long = List.filled(40, 'A long report line.').join(' ');
final messages = [
diff --git a/desktop/test/super_tab_plain_work_shots_test.dart b/desktop/test/super_tab_plain_work_shots_test.dart
index 7503da5d4..4f3525e2c 100644
--- a/desktop/test/super_tab_plain_work_shots_test.dart
+++ b/desktop/test/super_tab_plain_work_shots_test.dart
@@ -17,7 +17,7 @@ final shots = Platform.environment['SUPER_TAB_PLAIN_WORK_SHOTS'];
/// Plain chat proposals and tasks (task #2294) as the PR shows them, in both
/// appearances: the project chat with a Buddy's proposal and a task the PM
-/// opened, each one ordinary "Let's build" message, and the proposal's thread
+/// opened, each one ordinary message with its tag, and the proposal's thread
/// with its details and the PM's replies, in the server's own words.
void main() {
setUpAll(() async {
@@ -32,6 +32,12 @@ void main() {
final bytes = ByteData.sublistView(await File(font.$2).readAsBytes());
await (FontLoader(font.$1)..addFont(Future.value(bytes))).load();
}
+ // The sans stack's last face, standing in for the fallback a Mac does by
+ // itself: a widget test has no such registry.
+ final emoji = ByteData.sublistView(
+ await File('/System/Library/Fonts/Apple Color Emoji.ttc').readAsBytes(),
+ );
+ await (FontLoader('Arial')..addFont(Future.value(emoji))).load();
});
const diego = {'kind': 'person', 'id': 'owner', 'name': '[email protected]'};
@@ -151,6 +157,27 @@ void main() {
minutesAgo: 39,
source: {'kind': 'system'},
);
+ // Each state of an ask, as Dee's mockup shows them (#2552).
+ server.threadAsks['message-1'] = 'shipped';
+ server.threadAsks['message-6'] = 'on-it';
+ say(
+ "Desktop chat: in a task with steps, your next message reads as the step agent's",
+ diego,
+ minutesAgo: 30,
+ source: {'kind': 'buddy-proposal', 'personId': 'owner'},
+ );
+ say(
+ 'Goal: the next message keeps its own name.',
+ buddy,
+ thread: 'message-9',
+ minutesAgo: 30,
+ );
+ server.threadAsks['message-9'] = 'proposal';
+ say(
+ 'sidebar looks heavy, can we make it lighter?',
+ diego,
+ minutesAgo: 10,
+ );
final c = server.controller();
addTearDown(c.dispose);
await c.refresh();
@@ -179,7 +206,7 @@ void main() {
c.select('offline');
await tester.pumpAndSettle();
expect(
- find.text("Let's build: Hub reports hide an item from everyone"),
+ find.text('Hub reports hide an item from everyone'),
findsOneWidget,
);
// Replies stay in their threads, out of the chat.
diff --git a/desktop/test/super_tab_task_line_test.dart b/desktop/test/super_tab_task_line_test.dart
index 916db921e..98d69b14c 100644
--- a/desktop/test/super_tab_task_line_test.dart
+++ b/desktop/test/super_tab_task_line_test.dart
@@ -1,10 +1,12 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/widgets/engine_identity.dart';
import 'package:harness/super_tabs/identity.dart';
import 'package:harness/super_tabs/message_row.dart';
import 'package:harness/super_tabs/message_text.dart';
import 'package:harness/super_tabs/ship_row.dart';
import 'package:harness/super_tabs/model.dart';
+import 'package:harness/super_tabs/swarm_type.dart';
import 'package:harness/super_tabs/thread_panel.dart';
import 'package:harness/super_tabs/unread_line.dart';
@@ -109,10 +111,7 @@ void main() {
);
expect(avatar.identity, 'person:requester');
expect(
- find.descendant(
- of: row,
- matching: find.text("Let's build: Offline drafts"),
- ),
+ find.descendant(of: row, matching: find.text('Offline drafts')),
findsOneWidget,
);
expect(find.byKey(const ValueKey('super-proposal-label')), findsNothing);
@@ -264,6 +263,195 @@ void main() {
expect(find.text('Built by'), findsOneWidget);
});
+ // Dee, 2026-11-04 (#2552): an ask's row reads as its title alone, with where
+ // it stands after the time; older rows still carry the old prefix.
+ group('an ask row', () {
+ for (final kind in ['task-line', 'buddy-proposal']) {
+ for (final text in ["Let's build: Offline drafts", 'Offline drafts']) {
+ testWidgets('$kind "$text" shows the title alone', (tester) async {
+ final server = _server(kind);
+ server.messages.first
+ ..['text'] = text
+ ..['reactions'] = <dynamic>[];
+ await showView(tester, server);
+ expect(
+ find.descendant(
+ of: _row('root'),
+ matching: find.text('Offline drafts'),
+ ),
+ findsOneWidget,
+ );
+ expect(find.textContaining("Let's build"), findsNothing);
+ });
+ }
+ }
+
+ for (final (ask, tag) in [
+ ('proposal', '✋ Proposal'),
+ ('on-it', '● On it'),
+ ('shipped', '✓ Shipped'),
+ ]) {
+ testWidgets('$ask shows $tag after the time, in its muted style', (
+ tester,
+ ) async {
+ final server = _server('buddy-proposal')..threadAsks['root'] = ask;
+ await showView(tester, server);
+ final shown = find.descendant(
+ of: _row('root'),
+ matching: find.text(tag),
+ );
+ expect(shown, findsOneWidget);
+ expect(
+ tester.widget<Text>(shown).style,
+ SwarmType.time(tester.element(shown)),
+ );
+ final time = find.descendant(
+ of: _row('root'),
+ matching: find.textContaining(RegExp(r'^\d+:\d\d')),
+ );
+ expect(
+ tester.getTopLeft(time).dx,
+ lessThan(tester.getTopLeft(shown).dx),
+ );
+ expect(
+ tester.getTopLeft(find.text('dee')).dx,
+ lessThan(tester.getTopLeft(time).dx),
+ );
+ });
+ }
+
+ testWidgets('has no tag once the PM has replied with no task', (
+ tester,
+ ) async {
+ await showView(tester, _server('buddy-proposal'));
+ for (final tag in ['✋ Proposal', '● On it', '✓ Shipped', 'Task']) {
+ expect(
+ find.descendant(of: _row('root'), matching: find.textContaining(tag)),
+ findsNothing,
+ );
+ }
+ });
+
+ testWidgets('tags a person\'s own message a task was opened from', (
+ tester,
+ ) async {
+ final server = _server('task-line');
+ server.messages.first.remove('source');
+ server.threadAsks['root'] = 'on-it';
+ await showView(tester, server);
+ expect(
+ find.descendant(of: _row('root'), matching: find.text('● On it')),
+ findsOneWidget,
+ );
+ });
+
+ testWidgets('a message that is no ask keeps its words and has no tag', (
+ tester,
+ ) async {
+ final server = _server('task-line');
+ server.messages.add({
+ 'id': 'plain',
+ 'conversationId': 'lead',
+ 'thread': 'plain',
+ 'sequence': 3,
+ 'text': "Let's build: a shed",
+ 'createdAt': '2026-11-03T09:30:00Z',
+ 'author': {
+ 'kind': 'person',
+ 'id': 'requester',
+ 'name': '[email protected]',
+ },
+ });
+ await showView(tester, server);
+ expect(find.text("Let's build: a shed"), findsOneWidget);
+ expect(
+ find.descendant(
+ of: _row('plain'),
+ matching: find.textContaining('On it'),
+ ),
+ findsNothing,
+ );
+ });
+
+ testWidgets('an agent\'s engine mark stays between its name and the time', (
+ tester,
+ ) async {
+ final server = _server('task-line')..threadAsks['root'] = 'on-it';
+ (server.state['agents'] as List).add({
+ 'id': 'pm',
+ 'name': 'Lead',
+ 'displayName': 'River',
+ 'machineId': 'mac',
+ 'harnessId': 'pm',
+ 'contributorId': 'owner',
+ 'configuration': {'engine': 'claude'},
+ });
+ server.messages.first['author'] = {
+ 'kind': 'agent',
+ 'id': 'pm',
+ 'name': 'Lead',
+ };
+ await showView(tester, server);
+ double left(Finder within) => tester.getTopLeft(within).dx;
+ final name = find.descendant(
+ of: _row('root'),
+ matching: find.text('River'),
+ );
+ final mark = find.descendant(
+ of: _row('root'),
+ matching: find.byType(EngineMark),
+ );
+ final tag = find.descendant(
+ of: _row('root'),
+ matching: find.text('● On it'),
+ );
+ expect(left(name), lessThan(left(mark)));
+ expect(left(mark), lessThan(left(tag)));
+ });
+
+ testWidgets('keeps its header when the same person wrote just before', (
+ tester,
+ ) async {
+ final server = _server('task-line')..threadAsks['root'] = 'on-it';
+ server.messages.insert(0, {
+ 'id': 'before',
+ 'conversationId': 'lead',
+ 'thread': 'before',
+ 'sequence': 0,
+ 'text': 'A word first',
+ 'createdAt': '2026-11-03T08:59:00Z',
+ 'author': {
+ 'kind': 'person',
+ 'id': 'requester',
+ 'name': '[email protected]',
+ },
+ });
+ await showView(tester, server);
+ expect(
+ find.descendant(of: _row('root'), matching: find.text('● On it')),
+ findsOneWidget,
+ );
+ expect(
+ find.descendant(of: _row('root'), matching: find.text('dee')),
+ findsOneWidget,
+ );
+ });
+
+ testWidgets('has no tag at the head of its own thread', (tester) async {
+ final server = _server('task-line')..threadAsks['root'] = 'on-it';
+ final c = await showView(tester, server);
+ c.openThread('root');
+ await tester.pumpAndSettle();
+ expect(
+ find.descendant(
+ of: _row('root', thread: true),
+ matching: find.text('● On it'),
+ ),
+ findsNothing,
+ );
+ });
+ });
+
testWidgets('plain proposal and task thread screenshot fixture', (
tester,
) async {
diff --git a/desktop/test/support/super_tab_fixture.dart b/desktop/test/support/super_tab_fixture.dart
index c04de566f..391763178 100644
--- a/desktop/test/support/super_tab_fixture.dart
+++ b/desktop/test/support/super_tab_fixture.dart
@@ -439,6 +439,10 @@ class ConversationServer {
/// Messages per page, as the backend pages them.
int messagePage = 100;
+ /// Where the ask at each thread's root stands, by root: what the backend's
+ /// summaries say (threads.ts).
+ final threadAsks = <String, String>{};
+
/// Whether messages are written with threads, as backends from threads on
/// write them (backend threads.ts).
bool threads = false;
@@ -798,6 +802,7 @@ class ConversationServer {
case final thread when thread.length > 1)
{
'id': root,
+ 'ask': ?threadAsks[root],
'replies': thread.length - 1,
'lastSequence': thread.last['sequence'],
'lastAt': thread.last['createdAt'],
diff --git a/docs/plans/2026-11-04-ask-row-tag-plan.md b/docs/plans/2026-11-04-ask-row-tag-plan.md
new file mode 100644
index 000000000..2d5e51fa8
--- /dev/null
+++ b/docs/plans/2026-11-04-ask-row-tag-plan.md
@@ -0,0 +1,114 @@
+# Ask row tag Implementation Plan
+
+> **For agentic workers:** Follow the project Engineer workflow: plan first in a draft PR; implement task by task with a committed failing test before its passing code; one independent review step on the pull request.
+
+**Goal:** The project chat shows one row per ask, with its state after the time: `✋ Proposal`, `● On it` or `✓ Shipped`. "Let's build:" is gone, older rows included. Strengthens "Tell the PM what you want, and your crew ships it": a person sees where their ask stands without opening anything.
+
+**Architecture:** The server marks each reply it posts for a task with what that reply means for the task (`source.ask`), and the thread summary every chat page already carries gains `ask`, worked out from those marks and from who replied. Clients draw the tag from the summary. Summaries arrive with each reply, so the tag moves without a new read or poll.
+
+**Tech Stack:** TypeScript, MongoDB aggregation, Vitest; Flutter/Dart Desktop and phone.
+
+**Spec:** Task #2552 in Super Tab conversation 99ff470b7cab4420ba3da737 (Dee, 2026-11-04; updated brief from River the same day).
+
+## Why a server field
+
+The brief asks for server fields only if the apps lack the data. They lack it: a finished task leaves the set of groups the apps hold (it archives 30 minutes after going quiet, and goes dormant within a day), so a client lookup would drop `✓ Shipped` soon after the merge. A plain message or proposal row also names no task, and only the task names the row.
+
+## Global Constraints
+
+- Look, as Dee approved:
+
+ ```
+ (D) diego 06:36 ✋ Proposal
+ Desktop chat: in a task with steps, your next message reads as the step agent's
+
+ (R) River PM 02:15 ● On it
+ I'm fixing the CI check that timed out on every batch tonight.
+
+ (S) scholes 05:10 ✓ Shipped
+ Backlog: Mine shows nothing and doesn't say why
+ ```
+
+ The tag is in the time's muted style. What follows the name stays: the role badge on the phone, the engine mark on Desktop. A message that is no ask has no tag.
+- States of a row:
+ - `✋ Proposal`: a Buddy proposal with no task's reply in its thread, until the PM replies. After a PM reply with no task (a No or a Later), no tag.
+ - `● On it`: a task's reply is the newest mark in its thread, and the task is open.
+ - `✓ Shipped`: the task's pull request merged.
+ - No tag: the task was cancelled or stopped, or finished with no pull request.
+- A task opened from someone's own message tags that message. No new row (already so: `cards.line` names it, and its replies go in its thread).
+- Only a row whose source kind is `task-line` or `buddy-proposal` loses a leading `Let's build: `. A person's own message that says it keeps it.
+- A tagged row keeps its header: it never groups under the message before it, and nothing groups under it.
+- Desktop tests use a memory store and a fake sign-in. No build on a phone. No Swarm code in cli/src/core.
+- PR body begins `Requested by [email protected] through Harness.`
+
+## Design
+
+- Growth: one short word on replies the server already posts, and on the thread summary they already refresh. Both go with their message.
+- Concurrency: written in the command's existing transaction, as the replies are.
+- Read cost: no new query. The thread facet groups by one more key, adding at most three parts to a task's thread. A page's summaries read as before.
+- Scale: 10x tasks means 10x marks on the same rows; the first warning is the thread facet's time, which the existing read measures watch.
+- Compatibility: an older client ignores both fields and shows the title alone with no tag. A new client on an older backend shows no tag. Stored summaries without the key read as unmarked until their thread's next reply rewrites them.
+- Migration + rollback: no migration, and stored rows are not rewritten. An older row has no marks, so it shows no tag, except a Buddy proposal the PM has not answered. An open task's row gains its tag at its next reply. Rolling back leaves the extra source field unread.
+- Audience: the summary is computed for rows the reader may already see; hidden replies are skipped before it, as they are for the reply count.
+- Identity: a mark is written by the server only; no command takes `source` from a sender.
+- Failure: a merge recorded with no card used to post no reply, which would leave a row at `● On it`. It now posts the Merged reply. A task that finishes with its pull request closed unmerged has no reply, so its row stays `● On it`; cancelling the task clears it.
+- Platforms: backend, CLI skill text; macOS, Linux, Windows and web through Desktop's shared Flutter code; iOS and Android through the phone app.
+
+## Project chat's own rows
+
+Checked for the brief's item 4: the Swarm has written no ship row since plain chat (`ship.ts`: "No longer written"), and a task's route lines and notices go in the task's own conversation. What the project chat still gets at the top level (the digest, overlap alerts, machine removals, review capacity, instructions and routing lines) is about the project, not one task's shipping, so nothing moves.
+
+## Review Focus
+
+- `threadSummaries`' state rules, including a thread with more than three authors and hidden replies.
+- `✓ Shipped` holds after the task archives, since it reads only the thread.
+- The strip is limited to the two source kinds.
+
+## Task 1: Backend posts the title alone (done)
+
+- [x] Tests, then `taskLine.ts` and `commands.ts`.
+
+## Task 2: Backend marks a task's replies
+
+**Files:** `backend/src/superTabs/taskLine.ts`, `backend/src/superTabs/taskLine.test.ts`
+
+**Interfaces:** every reply `moved` posts has `source: { kind: 'system', ask: 'on-it' | 'shipped' | 'closed' }`. A first recorded merge with no card posts the Merged reply.
+
+- [x] Write failing tests; commit; watch them fail.
+- [x] Implement; commit; watch them pass.
+
+## Task 3: Thread summaries carry the state
+
+**Files:** `backend/src/superTabs/threads.ts`, `backend/src/superTabs/threads.test.ts`, `backend/src/superTabs/pageReads.ts`
+
+**Interfaces:** `ThreadSummary.ask?: 'proposal' | 'on-it' | 'shipped'`; `ThreadReply` gains `kind` and `ask`; the facet's part key gains `ask`.
+
+- [x] Write failing tests for each state, the PM's reply, a hidden reply and a plain thread; commit; watch them fail.
+- [x] Implement; commit; watch them pass.
+
+## Task 4: Desktop draws the tag
+
+**Files:** `desktop/lib/super_tabs/model.dart`, `desktop/lib/super_tabs/message_row.dart`, `desktop/lib/super_tabs/view.dart`, their tests. Drops the interim `· Task`.
+
+**Interfaces:** `SuperTabThread.ask` and `askTag`; `consecutiveUpdates` and `groupsWith` take a `tagged` test.
+
+- [x] Write failing tests: each state; no tag after a PM reply (no `ask` in the summary); a plain message; the engine mark unchanged; a tagged row keeps its header. Commit; watch them fail.
+- [x] Implement; commit; watch them pass.
+
+## Task 5: Phone draws the tag
+
+**Files:** `mobile/lib/swarm/model.dart`, `mobile/lib/swarm/swarm_message_row.dart`, `mobile/lib/swarm/swarm_conversation.dart`, `mobile/lib/swarm/swarm_conversation_page.dart`, their tests. Drops the interim `· Task`.
+
+**Interfaces:** as Desktop; `_sameThread` compares `ask`, so a moved tag redraws.
+
+- [x] Write the same failing tests, with the role badge in place of the engine mark; commit; watch them fail.
+- [x] Implement; commit; watch them pass.
+
+## Task 6: Skill text (done)
+
+- [x] The Buddy and PM skills say the Swarm posts the title.
+
+## Task 7: Screenshots and evidence
+
+- [x] Light and dark screenshots of the project chat on phone and Desktop, committed then removed, and embedded in the PR.
+- [x] Red/green evidence in a PR comment.
diff --git a/mobile/lib/swarm/model.dart b/mobile/lib/swarm/model.dart
index 5fbef0a95..a048fea7a 100644
--- a/mobile/lib/swarm/model.dart
+++ b/mobile/lib/swarm/model.dart
@@ -1252,6 +1252,7 @@ class SuperTabDelivery {
class SuperTabThread {
SuperTabThread.fromJson(Map<String, dynamic> row)
: id = _text(row, 'id'),
+ ask = row['ask'] as String?,
replies = (row['replies'] as num).toInt(),
lastSequence = (row['lastSequence'] as num).toInt(),
lastAt = DateTime.tryParse(row['lastAt'] as String? ?? ''),
@@ -1262,6 +1263,18 @@ class SuperTabThread {
(row['people'] as List? ?? const []).whereType<String>(),
);
final String id;
+
+ /// Where the ask at its root stands (backend threads.ts).
+ final String? ask;
+
+ /// What its root's row says after the time; null for a message that is no
+ /// ask, and for a state this app does not know.
+ String? get askTag => switch (ask) {
+ 'proposal' => '✋ Proposal',
+ 'on-it' => '● On it',
+ 'shipped' => '✓ Shipped',
+ _ => null,
+ };
final int replies, lastSequence;
final DateTime? lastAt;
@@ -1273,11 +1286,28 @@ class SuperTabThread {
final List<String> people;
}
+/// The source kinds of a task's root in the project chat.
+const _taskRootKinds = {'task-line', 'buddy-proposal'};
+
+/// What a task's root posted before #2867 reads ahead of its title. Stored rows
+/// keep it, so this stays for as long as rows from before 2026-11-04 are kept.
+const _oldTaskRootPrefix = "Let's build: ";
+
+String _messageText(Map<String, dynamic> row) {
+ final text = _text(row, 'text');
+ return _taskRootKinds.contains(
+ superTabMap(row['source'] ?? const {})['kind'],
+ ) &&
+ text.startsWith(_oldTaskRootPrefix)
+ ? text.substring(_oldTaskRootPrefix.length)
+ : text;
+}
+
class SuperTabMessage {
SuperTabMessage.fromJson(Map<String, dynamic> row)
: id = _text(row, 'id'),
conversationId = _text(row, 'conversationId'),
- text = _text(row, 'text'),
+ text = _messageText(row),
replyTo = row['replyTo'] as String?,
thread = row['thread'] as String?,
alsoInChat = row['alsoInChat'] == true,
@@ -1343,11 +1373,10 @@ class SuperTabMessage {
SuperTabRoute? get route => SuperTabRoute.fromSource(source);
bool get routeOverride => source['kind'] == 'route-override';
- /// A "Let's build" root the server posted in its person's name (plain chat,
- /// #2294): theirs to read, not their own writing, so it reads nothing
- /// before it and is unread for them as anyone else's message is.
- bool get postedForAuthor =>
- source['kind'] == 'task-line' || source['kind'] == 'buddy-proposal';
+ /// A task's root the server posted in its person's name (plain chat, #2294):
+ /// theirs to read, not their own writing, so it reads nothing before it and
+ /// is unread for them as anyone else's message is.
+ bool get postedForAuthor => _taskRootKinds.contains(source['kind']);
/// The agent a "waiting at a prompt" note is about; null for any other row.
String? get promptAlertAgentId =>
diff --git a/mobile/lib/swarm/swarm_conversation.dart b/mobile/lib/swarm/swarm_conversation.dart
index e19ce74f8..9660080dd 100644
--- a/mobile/lib/swarm/swarm_conversation.dart
+++ b/mobile/lib/swarm/swarm_conversation.dart
@@ -1211,6 +1211,7 @@ class SwarmConversation extends ChangeNotifier
/// What a thread's line draws, the same in [a] as in [b].
static bool _sameThread(SuperTabThread a, SuperTabThread b) =>
a.replies == b.replies &&
+ a.ask == b.ask &&
a.lastSequence == b.lastSequence &&
a.lastAt == b.lastAt &&
listEquals(
diff --git a/mobile/lib/swarm/swarm_conversation_page.dart b/mobile/lib/swarm/swarm_conversation_page.dart
index 9a508763d..b6bff2a4d 100644
--- a/mobile/lib/swarm/swarm_conversation_page.dart
+++ b/mobile/lib/swarm/swarm_conversation_page.dart
@@ -1838,6 +1838,11 @@ class _SwarmConversationPageState extends State<SwarmConversationPage>
_held.value,
answered.join(','),
_lineAt,
+ // A reply can move a row's tag, and so its grouping, with no new row.
+ [
+ for (final m in messages)
+ if (c.thread(m.id)?.askTag != null) m.id,
+ ].join(','),
);
if (from != _madeFrom) {
// Read back: the messages after the newest shown then wait below, and
@@ -1858,6 +1863,7 @@ class _SwarmConversationPageState extends State<SwarmConversationPage>
shown,
asks,
hasOlder: c.hasOlder,
+ tagged: (m) => c.thread(m.id)?.askTag != null,
lineAt: _lineAt,
).reversed.toList();
// Every message read, for the quotes.
@@ -1975,6 +1981,7 @@ class _SwarmConversationPageState extends State<SwarmConversationPage>
name: name,
look: look,
role: role,
+ askTag: line?.askTag,
pm: coordinator,
mentions: view.mentions,
tagged: tagged.keys.toList(),
@@ -2756,9 +2763,10 @@ List<_Entry> _timeline(
List<SuperTabMessage> messages,
List<SwarmDecisionNeed> asks, {
required bool hasOlder,
+ required bool Function(SuperTabMessage) tagged,
String? lineAt,
}) {
- final grouped = swarmGroupedMessages(messages);
+ final grouped = swarmGroupedMessages(messages, tagged: tagged);
final oldest = messages.map((m) => m.createdAt).nonNulls.firstOrNull;
bool before(DateTime? asked, DateTime? at) =>
asked != null && at != null && asked.isBefore(at);
@@ -2868,8 +2876,13 @@ String swarmDayLabel(DateTime day, DateTime now) {
/// before: the same author within five minutes on the same day, short, with
/// no question, line break or reply, and at most three to a run — the
/// desktop's `SuperTabMessageRow.groupsWith`.
-Set<String> swarmGroupedMessages(List<SuperTabMessage> messages) {
+Set<String> swarmGroupedMessages(
+ List<SuperTabMessage> messages, {
+ bool Function(SuperTabMessage)? tagged,
+}) {
bool joins(SuperTabMessage current, SuperTabMessage previous) {
+ // A tagged row's header is where its tag shows.
+ if (tagged != null && (tagged(current) || tagged(previous))) return false;
bool plain(SuperTabMessage m) =>
m.source['kind'] != 'ship' &&
m.route == null &&
diff --git a/mobile/lib/swarm/swarm_message_row.dart b/mobile/lib/swarm/swarm_message_row.dart
index 9444e900a..9495f8671 100644
--- a/mobile/lib/swarm/swarm_message_row.dart
+++ b/mobile/lib/swarm/swarm_message_row.dart
@@ -254,6 +254,7 @@ class SwarmMessageRow extends StatelessWidget {
required this.name,
required this.look,
required this.role,
+ this.askTag,
this.pm = false,
required this.mentions,
this.tagged = const [],
@@ -286,6 +287,9 @@ class SwarmMessageRow extends StatelessWidget {
final SwarmLook look;
final String? role;
+ /// Where the ask it is stands, after the time; null for any other message.
+ final String? askTag;
+
/// Its author is its project's coordinator ([SuperTabSnapshot.isLead]),
/// whatever its role is called: it wears manager blue.
final bool pm;
@@ -417,6 +421,12 @@ class SwarmMessageRow extends StatelessWidget {
'${two(at.hour)}:${two(at.minute)}',
style: tty.style(color: AppPalette.textFaint, size: 12.5),
),
+ tag: askTag == null
+ ? null
+ : Text(
+ askTag!,
+ style: tty.style(color: AppPalette.textFaint, size: 12.5),
+ ),
),
body: [
if (lit) SizedBox(key: ValueKey('swarm-lit-${message.id}')),
@@ -520,7 +530,7 @@ class SwarmMessageRow extends StatelessWidget {
}
/// A message's first line: who, in what role, then [trailing] — its time,
-/// or how its post is going.
+/// or how its post is going — and [tag], where the ask it is stands.
class SwarmMessageHeader extends StatelessWidget {
const SwarmMessageHeader({
super.key,
@@ -528,12 +538,13 @@ class SwarmMessageHeader extends StatelessWidget {
required this.agent,
this.role,
this.trailing,
+ this.tag,
});
final String name;
final bool agent;
final String? role;
- final Widget? trailing;
+ final Widget? trailing, tag;
@override
Widget build(BuildContext context) {
@@ -552,6 +563,7 @@ class SwarmMessageHeader extends StatelessWidget {
),
if (role case final role?) SwarmRoleBadge(role),
?trailing,
+ ?tag,
],
);
}
diff --git a/mobile/test/swarm/swarm_conversation_test.dart b/mobile/test/swarm/swarm_conversation_test.dart
index e1e19e2b5..c87153717 100644
--- a/mobile/test/swarm/swarm_conversation_test.dart
+++ b/mobile/test/swarm/swarm_conversation_test.dart
@@ -1159,6 +1159,12 @@ void main() {
c.keepThreads([line('m1', 4, 6)]);
expect(c.thread('m1')?.replies, 4);
expect(told, 1);
+ // Its tag draws from the line too, so a changed state is a change.
+ c.keepThreads([
+ {...line('m1', 4, 6), 'ask': 'shipped'},
+ ]);
+ expect(c.thread('m1')?.askTag, '✓ Shipped');
+ expect(told, 2);
});
test('a chat the person can no longer read forgets its thread lines and '
diff --git a/mobile/test/swarm/swarm_special_rows_test.dart b/mobile/test/swarm/swarm_special_rows_test.dart
index a94006573..069e0a3ee 100644
--- a/mobile/test/swarm/swarm_special_rows_test.dart
+++ b/mobile/test/swarm/swarm_special_rows_test.dart
@@ -325,10 +325,8 @@ void main() {
'thread': 'p2',
};
await show(tester, backend([root]));
- expect(
- textOf(tester, 'p2'),
- contains("Let's build: Activity read fix"),
- );
+ expect(textOf(tester, 'p2'), contains('Activity read fix'));
+ expect(textOf(tester, 'p2'), isNot(contains("Let's build")));
expect(textOf(tester, 'p2'), isNot(contains('Proposal from ')));
expect(
find.byKey(const ValueKey('swarm-proposal-label')),
diff --git a/mobile/test/swarm/swarm_task_line_shots_test.dart b/mobile/test/swarm/swarm_task_line_shots_test.dart
index 7275e927b..a5f694fef 100644
--- a/mobile/test/swarm/swarm_task_line_shots_test.dart
+++ b/mobile/test/swarm/swarm_task_line_shots_test.dart
@@ -34,7 +34,9 @@ void main() {
await File('/System/Library/Fonts/Apple Color Emoji.ttc').readAsBytes(),
);
// Flutter widget tests have no OS fallback font registry.
- for (final family in ['Apple Color Emoji', 'Arial']) {
+ // Named here as the sans and mono stacks' last faces, standing in for the
+ // fallback a device does by itself.
+ for (final family in ['Apple Color Emoji', 'Arial', 'Courier New']) {
await (FontLoader(family)..addFont(Future.value(emoji))).load();
}
final manifest =
@@ -125,7 +127,7 @@ void main() {
boundary: boundary,
theme: buildAppTheme(brightness: palette.brightness),
);
- expect(find.text("Let's build: Offline drafts"), findsOneWidget);
+ expect(find.text('Offline drafts'), findsOneWidget);
await capture(boundary, 'task-chat-${palette.brightness.name}');
await tester.tap(find.byKey(const ValueKey('swarm-thread-line-line-1')));
await tester.pumpAndSettle();
@@ -137,4 +139,115 @@ void main() {
await tester.pumpWidget(const SizedBox());
}
}, skip: shots == null || !Platform.isMacOS);
+
+ // Dee's approved mockup (2026-11-04, #2552): one tag after the time.
+ testWidgets('the project chat with each state of an ask', (tester) async {
+ final paletteBefore = AppTheme.palette.value;
+ final brightnessBefore = AppTheme.brightness.value;
+ addTearDown(() {
+ AppTheme.palette.value = paletteBefore;
+ AppTheme.brightness.value = brightnessBefore;
+ });
+ Map<String, Object?> person(String name) => {
+ 'kind': 'person',
+ 'id': name,
+ 'name': '[email protected]',
+ };
+ Map<String, dynamic> row(
+ String id,
+ int sequence,
+ Map<String, Object?> author,
+ String text, [
+ String? kind,
+ ]) => {
+ ...taskLine(id: id, sequence: sequence),
+ 'text': text,
+ 'thread': id,
+ 'author': author,
+ 'source': kind == null ? null : {'kind': kind},
+ };
+ final river = {'kind': 'agent', 'id': 'agent-lead', 'name': 'River'};
+ final rows = [
+ row(
+ 'pm',
+ 1,
+ river,
+ "I'm fixing the CI check that timed out on every batch tonight.",
+ ),
+ row(
+ 'shipped',
+ 5,
+ person('scholes'),
+ "Backlog: Mine shows nothing and doesn't say why",
+ 'task-line',
+ ),
+ row(
+ 'open',
+ 9,
+ person('diego'),
+ 'Desktop chat: a message after a Routed-to line loses its name and avatar',
+ 'task-line',
+ ),
+ row(
+ 'proposal',
+ 13,
+ person('diego'),
+ "Desktop chat: in a task with steps, your next message reads as the step agent's",
+ 'buddy-proposal',
+ ),
+ row(
+ 'plain',
+ 17,
+ person('huy'),
+ 'sidebar looks heavy, can we make it lighter?',
+ ),
+ ];
+ Map<String, Object?> summary(String id, int replies, [String? ask]) => {
+ 'id': id,
+ 'ask': ?ask,
+ 'replies': replies,
+ 'lastSequence': 30,
+ 'lastAt': DateTime.utc(2026, 11, 2, 18).toIso8601String(),
+ 'authors': [river],
+ 'people': <Object>[],
+ };
+ for (final palette in [HarnessPalette.graphite, HarnessPalette.paper]) {
+ AppTheme.palette.value = palette;
+ AppTheme.brightness.value = palette.brightness;
+ final fake = taskLineBackend(rows, target: false);
+ fake.routes['/api/super-tabs/$tab/conversations/$leadChat/messages'] =
+ (_) => {
+ 'messages': rows.reversed.toList(),
+ 'threads': [
+ summary('pm', 3, 'on-it'),
+ summary('shipped', 6, 'shipped'),
+ summary('open', 4, 'on-it'),
+ summary('proposal', 2, 'proposal'),
+ summary('plain', 1),
+ ],
+ 'next': null,
+ };
+ final boundary = GlobalKey();
+ await pumpTaskChat(
+ tester,
+ fake,
+ boundary: boundary,
+ theme: buildAppTheme(brightness: palette.brightness),
+ );
+ expect(find.text('✋ Proposal'), findsOneWidget);
+ expect(find.text('● On it'), findsNWidgets(2));
+ expect(find.text('✓ Shipped'), findsOneWidget);
+ await tester.runAsync(() async {
+ final image =
+ await (boundary.currentContext!.findRenderObject()!
+ as RenderRepaintBoundary)
+ .toImage(pixelRatio: 3);
+ final png = await image.toByteData(format: ui.ImageByteFormat.png);
+ await File('$shots/ask-tags-${palette.brightness.name}.png')
+ .writeAsBytes(png!.buffer.asUint8List());
+ image.dispose();
+ });
+ await tester.pumpWidget(const SizedBox());
+ }
+ }, skip: shots == null || !Platform.isMacOS);
}
diff --git a/mobile/test/swarm/swarm_task_line_test.dart b/mobile/test/swarm/swarm_task_line_test.dart
index fd4e994c4..dedbfb98e 100644
--- a/mobile/test/swarm/swarm_task_line_test.dart
+++ b/mobile/test/swarm/swarm_task_line_test.dart
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:harness_mobile/notify/system_notices.dart';
import 'package:harness_mobile/settings/experimental_features.dart';
+import 'package:harness_mobile/shared/theme/app_theme.dart';
import 'package:harness_mobile/swarm/model.dart';
import 'package:harness_mobile/swarm/swarm_conversation_page.dart';
import 'package:harness_mobile/swarm/swarm_message_row.dart';
@@ -45,6 +46,7 @@ FakeSwarm taskLineBackend(
List<Map<String, dynamic>> page, {
bool target = true,
List<Map<String, dynamic>>? replies,
+ String? ask,
}) {
final fake = FakeSwarm();
final root = page.firstWhere(
@@ -71,6 +73,7 @@ FakeSwarm taskLineBackend(
];
final summary = {
'id': rootId,
+ 'ask': ?ask,
'replies': thread.length,
'lastSequence': 3,
'authors': <Object>[],
@@ -183,6 +186,7 @@ Future<void> pumpRow(
double width = 390,
double scale = 1,
VoidCallback? onReply,
+ String? askTag,
}) async {
await tester.binding.setSurfaceSize(Size(width, 844));
addTearDown(() => tester.binding.setSurfaceSize(null));
@@ -205,6 +209,7 @@ Future<void> pumpRow(
: 'River',
look: (picture: null, status: null),
role: 'PM',
+ askTag: askTag,
readerId: readerId,
mentions: SwarmMentions(const []),
grouped: false,
@@ -247,7 +252,7 @@ void main() {
expect(avatar.name, 'Dee');
expect(avatar.id, me);
expect(avatar.agent, isFalse);
- expect(find.text("Let's build: Offline drafts"), findsOneWidget);
+ expect(find.text('Offline drafts'), findsOneWidget);
expect(find.text('Old metadata title'), findsNothing);
await tester.tap(find.byKey(const ValueKey('swarm-reply-line-1')));
expect(replies, 1);
@@ -315,7 +320,7 @@ void main() {
);
expect(find.text('1 reply'), findsOneWidget);
if (openWith == 'Reply') {
- await tester.tap(find.text("Let's build: Offline drafts"));
+ await tester.tap(find.text('Offline drafts'));
await tester.pumpAndSettle();
expect(find.text('Reply in thread'), findsOneWidget);
await tester.tap(find.byKey(const ValueKey('swarm-reply-line-1')));
@@ -373,7 +378,7 @@ void main() {
expect(find.text('Shipped: task-1'), findsOneWidget);
});
- test('task source follows ordinary same-author grouping', () {
+ test('a task root with no tag follows ordinary same-author grouping', () {
final line = taskLine(sequence: 1);
final normal = {
...taskLine(id: 'normal', sequence: 2),
@@ -388,4 +393,159 @@ void main() {
{'normal'},
);
});
+
+ // Its header is where its tag shows (#2552), and a message after it is not
+ // part of that ask.
+ test('a tagged row stands on its own, on either side', () {
+ Map<String, dynamic> plain(String id, int sequence) => {
+ ...taskLine(id: id, sequence: sequence),
+ 'source': {'kind': 'message'},
+ 'text': 'A normal message',
+ };
+ expect(
+ swarmGroupedMessages(
+ [
+ plain('m1', 1),
+ plain('m2', 2),
+ plain('m3', 3),
+ plain('m4', 4),
+ ].map(SuperTabMessage.fromJson).toList(),
+ tagged: (m) => m.id == 'm2',
+ ),
+ {'m4'},
+ );
+ });
+
+ // Dee, 2026-11-04 (#2552): an ask's row reads as its title alone, with where
+ // it stands after the time; older rows still carry the old prefix.
+ group('an ask row', () {
+ for (final kind in ['task-line', 'buddy-proposal']) {
+ for (final text in ["Let's build: Offline drafts", 'Offline drafts']) {
+ testWidgets('$kind "$text" shows the title alone', (tester) async {
+ await pumpRow(tester, {
+ ...taskLine(),
+ 'text': text,
+ 'source': {'kind': kind},
+ });
+ expect(find.text('Offline drafts'), findsOneWidget);
+ expect(find.textContaining("Let's build"), findsNothing);
+ });
+ }
+ }
+
+ test('a state this app does not know draws no tag', () {
+ SuperTabThread thread(Object? ask) => SuperTabThread.fromJson({
+ 'id': 'root',
+ 'replies': 1,
+ 'lastSequence': 2,
+ 'ask': ask,
+ });
+ expect(thread('someday').askTag, isNull);
+ expect(thread(null).askTag, isNull);
+ });
+
+ for (final (ask, tag) in [
+ ('proposal', '✋ Proposal'),
+ ('on-it', '● On it'),
+ ('shipped', '✓ Shipped'),
+ ]) {
+ testWidgets('$ask shows $tag after the time in the project chat', (
+ tester,
+ ) async {
+ final root = {
+ ...taskLine(),
+ 'text': 'Offline drafts',
+ 'author': {'kind': 'person', 'id': me, 'name': 'Dee'},
+ 'thread': 'line-1',
+ 'source': {'kind': 'buddy-proposal'},
+ };
+ await pumpTaskChat(tester, taskLineBackend([root], ask: ask));
+ final shown = find.text(tag);
+ expect(shown, findsOneWidget);
+ expect(tester.widget<Text>(shown).style?.color, AppPalette.textFaint);
+ final time = find.textContaining(RegExp(r'^\d\d:\d\d$'));
+ expect(
+ tester.getTopLeft(time).dx,
+ lessThan(tester.getTopLeft(shown).dx),
+ );
+ });
+ }
+
+ testWidgets('has no tag once the PM has replied with no task', (
+ tester,
+ ) async {
+ final root = {
+ ...taskLine(),
+ 'text': 'Offline drafts',
+ 'author': {'kind': 'person', 'id': me, 'name': 'Dee'},
+ 'thread': 'line-1',
+ 'source': {'kind': 'buddy-proposal'},
+ };
+ await pumpTaskChat(tester, taskLineBackend([root]));
+ for (final tag in ['Proposal', 'On it', 'Shipped', 'Task']) {
+ expect(find.textContaining(tag), findsNothing);
+ }
+ });
+
+ testWidgets('tags a person\'s own message a task was opened from', (
+ tester,
+ ) async {
+ final root = {
+ ...taskLine(),
+ 'text': 'can we save drafts offline?',
+ 'author': {'kind': 'person', 'id': me, 'name': 'Dee'},
+ 'thread': 'line-1',
+ 'source': null,
+ };
+ await pumpTaskChat(tester, taskLineBackend([root], ask: 'on-it'));
+ expect(find.text('● On it'), findsOneWidget);
+ });
+
+ testWidgets('a message that is no ask keeps its words and has no tag', (
+ tester,
+ ) async {
+ await pumpRow(tester, {
+ ...taskLine(),
+ 'text': "Let's build: a shed",
+ 'source': {'kind': 'message'},
+ });
+ expect(find.text("Let's build: a shed"), findsOneWidget);
+ expect(find.textContaining('On it'), findsNothing);
+ });
+
+ testWidgets('the role badge stays after the name, before the tag', (
+ tester,
+ ) async {
+ await pumpRow(tester, {
+ ...taskLine(),
+ 'text': 'Offline drafts',
+ }, askTag: '● On it');
+ double left(Finder within) => tester.getTopLeft(within).dx;
+ final badge = find.byType(SwarmRoleBadge);
+ expect(left(find.text('River')), lessThan(left(badge)));
+ expect(left(badge), lessThan(left(find.text('● On it'))));
+ });
+
+ testWidgets('keeps its header when the same person wrote just before', (
+ tester,
+ ) async {
+ final author = {'kind': 'person', 'id': me, 'name': 'Dee'};
+ final before = {
+ ...taskLine(id: 'before', sequence: 1),
+ 'text': 'A word first',
+ 'author': author,
+ 'source': {'kind': 'message'},
+ };
+ final root = {
+ ...taskLine(sequence: 2),
+ 'text': 'Offline drafts',
+ 'author': author,
+ 'thread': 'line-1',
+ 'source': {'kind': 'buddy-proposal'},
+ };
+ await pumpTaskChat(tester, taskLineBackend([before, root], ask: 'on-it'));
+ expect(find.text('● On it'), findsOneWidget);
+ expect(find.text('dee'), findsNWidgets(2));
+ });
+ });
}