The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
Merge batch 11-07 train-0930: #3534 (#3544)
harness-for-autonomous[bot]e2e441a4be2d
diff --git a/backend/src/superTabs/commands.test.ts b/backend/src/superTabs/commands.test.tsindex 493a18398..75d2f602c 100644--- a/backend/src/superTabs/commands.test.ts+++ b/backend/src/superTabs/commands.test.ts@@ -1,7 +1,7 @@import { describe, expect, it } from 'vitest'import { groupProject } from './projects.js'import { storeOldLeads } from './leads.test-support.js'-import { applyCommand, assertUniqueMessageIds, commandSchema, LOOP_NOTICE_AT, swarmGridName, withoutCredentials, WORDS, type Command, type CommandContext } from './commands.js'+import { applyCommand, tasksNamedIn, assertUniqueMessageIds, commandSchema, LOOP_NOTICE_AT, swarmGridName, withoutCredentials, WORDS, type Command, type CommandContext } from './commands.js'import { CREDENTIAL_MARKER, type CredentialKind } from './credentials.js'import { readsRawReason } from './startFailure.js'import { sweepLiveness } from './liveness.js'@@ -2805,6 +2805,76 @@ describe('cancelling work', () => {expect(f.state.conversations.find(c => c.id === 'lead')!.archived).toBe(false)})})++ // A duplicate, or work folded or split into others, names those tasks in its reason: it leaves people's Tasks and is kept+ // (task #4462).+ describe('naming where its work goes on', () => {+ const task = (f: ReturnType<typeof fixture>, id: string) => f.state.conversations.find(c => c.id === id)!+ it('reads the task numbers a reason says the work goes on in, never itself, a pull request or a mere mention', () => {+ expect(tasksNamedIn('Duplicate of #4421', 4420)).toEqual([4421])+ expect(tasksNamedIn('Being done inside #4445.', 4455)).toEqual([4445])+ expect(tasksNamedIn('Accepted and split by area: #4465, #4466 to #4468', 4464)).toEqual([4465, 4466, 4468])+ expect(tasksNamedIn('Folded into #12 and #12 (this is #7)', 7)).toEqual([12])+ expect(tasksNamedIn('Duplicate: merged in PR #3529 and pull request #3530', 1)).toEqual([])+ for (const reason of ['Not needed', 'Waiting on #4434', 'Not needed; see #4400 for context']) expect(tasksNamedIn(reason, 1)).toEqual([])+ expect(tasksNamedIn(`Split into ${Array.from({ length: 20 }, (_, i) => `#${i + 100}`).join(' ')}`, 1)).toHaveLength(10)+ // The phrase goes with the numbers after it in its own sentence (review 2 of #3534).+ expect(tasksNamedIn('Duplicate of #4421; waiting on #4434', 1)).toEqual([4421])+ expect(tasksNamedIn('A duplicate. Waiting on #4434 anyway', 1)).toEqual([])+ expect(tasksNamedIn('Merged #3471', 1)).toEqual([])+ })+ it('links an unassigned proposal or live work to the real tasks it names, and keeps it', () => {+ const f = fixture(), dup = f.group(), real = f.group(), plain = f.group(), other = f.group()+ f.run({ type: 'work.cancel', conversationId: dup, assignmentId: 'current', reason: `Split into #${task(f, real).number} and #${task(f, other).number}` })+ f.run({ type: 'work.cancel', conversationId: plain, assignmentId: 'current', reason: `Waiting on #${task(f, real).number}` })+ expect(task(f, dup)).toMatchObject({ foldedInto: [real, other], archived: true })+ expect(task(f, plain).foldedInto).toBeUndefined()+ const { f: g, group, leadActor, cancel } = active(), inside = g.group()+ g.run({ ...cancel, reason: `Being done inside #${task(g, inside).number}` } as Command, leadActor)+ expect(task(g, group)).toMatchObject({ foldedInto: [inside], assignment: { status: 'cancelled' } })+ })+ it('names only a task the Swarm knows in its project: never one missing, the project chat, a step or a private chat', () => {+ const f = fixture(), dup = f.group(), step = f.group(), secret = f.group()+ Object.assign(task(f, step), { reviewOf: secret })+ Object.assign(task(f, secret), { audience: { people: [] } })+ const numbers = [task(f, step).number, task(f, secret).number, task(f, 'lead').number, 999].filter(n => n != null).map(n => `#${n}`)+ f.run({ type: 'work.cancel', conversationId: dup, assignmentId: 'current', reason: `Duplicate of ${numbers.join(', ')}` })+ expect(task(f, dup)).toMatchObject({ archived: true })+ expect(task(f, dup).foldedInto).toBeUndefined()+ })+ it('links a task cancelled before, once, changing nothing else', () => {+ const f = fixture(), dup = f.group(), real = f.group(), later = f.group()+ f.run({ type: 'work.cancel', conversationId: dup, assignmentId: 'current', reason: 'Duplicate' })+ const before = structuredClone(task(f, dup))+ const link = { type: 'work.cancel', conversationId: dup, assignmentId: 'current', reason: `Duplicate of #${task(f, real).number}` } as Command+ const effects = f.run(link)+ expect(task(f, dup)).toEqual({ ...before, foldedInto: [real] })+ expect(effects.messages.map(m => [m.text, m.source])).toEqual([[`owner noted where this task's work goes on: Duplicate of #${task(f, real).number}.`, { kind: 'system' }]])+ expect(f.run({ ...link, reason: `Duplicate of #${task(f, later).number}` } as Command).messages).toHaveLength(0)+ expect(task(f, dup).foldedInto).toEqual([real])+ // Naming no task, a closed one stays closed, as before.+ expect(() => f.run({ ...link, reason: 'Duplicate' } as Command)).toThrow(expect.objectContaining({ code: 'ARCHIVED' }))+ // Naming one the Swarm does not hold now (mistyped, or quiet for a day), it says which (review 2 of #3534).+ const unknown = f.group()+ f.run({ type: 'work.cancel', conversationId: unknown, assignmentId: 'current', reason: 'Duplicate' })+ expect(() => f.run({ ...link, conversationId: unknown, reason: 'Duplicate of #999' } as Command))+ .toThrow(expect.objectContaining({ code: 'FOLD_TARGET', message: expect.stringContaining('#999') }))+ expect(task(f, unknown).foldedInto).toBeUndefined()+ const { f: g, group, leadActor, cancel } = active(), other = g.group()+ g.run(cancel, leadActor)+ g.run({ ...cancel, reason: `Duplicate of #${task(g, other).number}` } as Command, leadActor)+ expect(task(g, group)).toMatchObject({ foldedInto: [other], assignment: { status: 'cancelled', result: 'Duplicate of another task' } })+ })+ it('never marks finished work, and lets only who may cancel work link it', () => {+ const { f, group, leadActor, assignmentId, cancel } = active(), real = f.group()+ const reason = `Duplicate of #${task(f, real).number}`+ expect(() => f.run({ ...cancel, reason } as Command, peer)).toThrow(expect.objectContaining({ code: 'FORBIDDEN' }))+ expect(task(f, group).foldedInto).toBeUndefined()+ Object.assign(task(f, group), { archived: true, assignment: { ...task(f, group).assignment!, status: 'done' } })+ expect(() => f.run({ type: 'work.cancel', conversationId: group, assignmentId, reason }, leadActor)).toThrow()+ expect(task(f, group).foldedInto).toBeUndefined()+ })+ })})it('allows routing directly to the awaiting worker without first keeping it', () => {diff --git a/backend/src/superTabs/commands.ts b/backend/src/superTabs/commands.tsindex 3bf50a7c4..42eeacab9 100644--- a/backend/src/superTabs/commands.ts+++ b/backend/src/superTabs/commands.ts@@ -1059,6 +1059,28 @@ function proposalRequester(state: SuperTabState, project: SwarmProject, personId/** Who may cancel a lost or stopped task, and a live one (work.cancel), for the refusals that name them. */const WHO_CANCELS_ENDED = 'Only the person who asked for this task, its project\'s owner, the Swarm owner or an agent of this project can cancel it.'const WHO_CANCELS_LIVE = 'Only an agent of this project or the Swarm owner can cancel work in progress. Ask the project\'s coordinator.'+/** The task numbers a cancel's reason says its work goes on in ("Duplicate of #4421", "Being done inside #4445", "Split into+ * #4465 to #4468"; task #4462). A mere mention ("Waiting on #4434"), a pull request's number ("PR #12") and its own name none. */+export function tasksNamedIn(reason: string, self: number | undefined): number[] {+ // Each sentence or clause on its own: its numbers count once its phrase came before them (review 2 of #3534).+ const named = reason.split(/;|[.!?]\s+/).flatMap(clause => {+ const phrase = /\b(duplicates?|dup(e)?|inside|into|split|same as|covered by|part of|replaced by|superseded by)\b/i.exec(clause)+ return phrase ? [...clause.slice(phrase.index).matchAll(/(?<!\b(?:PR|pull request)\s*)#([1-9][0-9]{0,8})\b/gi)].map(m => Number(m[1])) : []+ }).filter(n => n !== self)+ return [...new Set(named)].slice(0, 10)+}++/** The tasks of [group]'s project its cancel's reason says its work goes on in, as the Swarm knows them now: a number that+ * names no task there (mistyped, a chat, a step, a private conversation) links nothing (review of #3534). */+function goesOnIn(state: SuperTabState, group: Conversation, reason: string): { ids: string[]; unknown: number[] } {+ const isTask = (c: Conversation) => !c.kind && !c.audience && !c.reviewOf && c.id !== groupProject(state, c).leadConversationId+ if (!isTask(group)) return { ids: [], unknown: [] }+ const project = groupProject(state, group).id+ const found = tasksNamedIn(reason, group.number).map(number => ({ number, task: state.conversations.find(c => c.number === number && c.id !== group.id+ && isTask(c) && groupProject(state, c).id === project) }))+ return { ids: found.flatMap(f => f.task ? [f.task.id] : []), unknown: found.flatMap(f => f.task ? [] : [f.number]) }+}+function open(state: SuperTabState, conversationId: string) {const group = conversation(state, conversationId)if (group.archived) fail('ARCHIVED', 'Reopen this conversation before changing its work.')@@ -4946,10 +4968,24 @@ function applyCommandOnce(original: SuperTabState, actor: Actor, input: Command,}case 'work.cancel': {projectChatWork(command.conversationId)- const group = open(state, command.conversationId)+ const group = conversation(state, command.conversationId)const assignment = group.assignmentconst project = groupProject(state, group)const allowed = projectAgent(state, actor, project.id) || (actor.kind === 'person' && actor.userId === state.ownerId)+ const { ids: goesOn, unknown } = goesOnIn(state, group, command.reason)+ // A task cancelled before with no task named, cancelled again with the one its work goes on in, takes that link and+ // nothing else: so the duplicates closed before #4462 leave people's Tasks too.+ const closed = assignment?.status === 'cancelled' || group.archived && !assignment+ if (closed && (goesOn.length || unknown.length)) {+ if (!allowed) fail('FORBIDDEN', WHO_CANCELS_LIVE, 403)+ if (group.foldedInto) break+ // Its whole point is the link: one it cannot make is said, by number (review 2 of #3534).+ if (!goesOn.length) fail('FOLD_TARGET', `No task ${unknown.map(n => `#${n}`).join(', ')} of this project is open to link to: check the number. A task quiet for a day cannot be checked.`, 400)+ group.foldedInto = goesOn+ message(group.id, `${who} noted where this task's work goes on: ${command.reason.replace(/[.\s]+$/, '')}.`, [], null, SYSTEM_ROW)+ break+ }+ if (group.archived) open(state, group.id)// A task nobody was ever assigned, such as a review nobody was free for, has no assignment to name: whoever may cancel// work cancels it by "current", and it archives with the reason (Ken, 2026-10-30: 28 reviews waited for a Reviewer with// no way out). So does a linked task (reviewOf) whose agent stopped or finished, by "current" or that ended attempt's id@@ -4959,6 +4995,7 @@ function applyCommandOnce(original: SuperTabState, actor: Actor, input: Command,&& (command.assignmentId === 'current' || command.assignmentId === assignment.id)if ((unassigned || reviewEnded) && allowed && group.id !== project.leadConversationId && !group.kind && !group.audience) {message(group.id, `${who} cancelled this task: ${command.reason.replace(/[.\s]+$/, '')}.`, [], null, CANCEL_ROW)+ if (goesOn.length) group.foldedInto = goesOn// Its line is a report the coordinator acknowledges first, so the sweep puts it to sleep later (sweeps.ts), as for any archive.group.archived = trueendStepsOf(group, `${group.title} was archived.`, true)@@ -4981,6 +5018,7 @@ function applyCommandOnce(original: SuperTabState, actor: Actor, input: Command,const gone = assignment.status === 'reconciling' || lost || stoppedassignment.status = 'cancelled'assignment.result = command.reason+ if (goesOn.length) group.foldedInto = goesOnif (!lost && !stopped) finishWorker(state, assignment.agentId)// Its steps' work ends with it; finished ones stay until it archives (task steps design; final review, finding 2).endStepsOf(group, `${group.title} was cancelled.`, false)diff --git a/backend/src/superTabs/model.ts b/backend/src/superTabs/model.tsindex b87aca6fe..b564ef9b3 100644--- a/backend/src/superTabs/model.ts+++ b/backend/src/superTabs/model.ts@@ -511,6 +511,9 @@ export interface Conversation {lostAttempt?: { id: string; agentId: string; machineId?: string; engine?: string }/** Counts reaction changes here (reactions.ts), so readers see a new reaction on an older message. */reactionSeq?: number+ /** The tasks its work goes on in, as its cancel's reason names them (commands.ts goesOnIn, task #4462): a duplicate, or+ * work folded or split into others. It leaves people's Tasks feeds and stays in its project's archived list, which can open them. */+ foldedInto?: string[]/** A durable proposal on this card (#3817); retained when its accepted work becomes a task. */proposal?: import('./proposalCards.js').ProposalRecord/** A Buddy chat's owner messages its Buddy already proposed for (buddies.ts): each asks once. */diff --git a/backend/src/superTabs/parts/light.test.ts b/backend/src/superTabs/parts/light.test.tsindex 97328586a..d59d1ad05 100644--- a/backend/src/superTabs/parts/light.test.ts+++ b/backend/src/superTabs/parts/light.test.ts@@ -46,6 +46,7 @@ const conversation: Required<Conversation> = {checks: [],codePullRequestUrls: [],dormant: false,+ foldedInto: ['f'],handOutLane: 'Desktop',heardAt: 0,hold: { kind: 'requester' },diff --git a/backend/src/superTabs/parts/light.ts b/backend/src/superTabs/parts/light.tsindex b88d89569..306838203 100644--- a/backend/src/superTabs/parts/light.ts+++ b/backend/src/superTabs/parts/light.ts@@ -77,6 +77,7 @@ export const GROUP_FIELDS = {'chatLimits','checks','codePullRequestUrls',+ 'foldedInto','handOutLane','heardAt','hold',diff --git a/backend/src/superTabs/read/feedIds.ts b/backend/src/superTabs/read/feedIds.tsindex 6e5f1abd7..43f0745c5 100644--- a/backend/src/superTabs/read/feedIds.ts+++ b/backend/src/superTabs/read/feedIds.ts@@ -1,7 +1,7 @@import type { PrismaClient } from '@prisma/client'import type { Conversation } from '../model.js'-type FeedFields = Pick<Conversation, 'kind' | 'audience' | 'reviewOf' | 'requesterId' | 'taskApproval' | 'proposal' | 'assignment'>+type FeedFields = Pick<Conversation, 'kind' | 'audience' | 'reviewOf' | 'requesterId' | 'taskApproval' | 'proposal' | 'assignment' | 'foldedInto'>/** A person at one membership, as an approval or a proposal names them: a later membership of the same account matches none. */export const askedKey = (personId: string, generation: string): string => `${personId}:${generation}`@@ -11,10 +11,10 @@ export const askedKey = (personId: string, generation: string): string => `${per* reader's: who asked (the approver or proposal senders at their membership, else the requester), the login its agent runs* under, which outlives the agent, and the agent doing it or suggested for it. Stored as the conversation's indexed `feedIds`* on every write (parts/write.ts extracted), so a page is one read of the reader's keys and own agents. A conversation that- * is no task, and a proposal merged into another, names nobody.+ * is no task, a proposal merged into another, and a task closed into another (foldedInto), names nobody.*/export function feedIdsOf(group: FeedFields): string[] {- if (group.kind || group.audience || group.reviewOf || group.proposal?.mergedInto) return []+ if (group.kind || group.audience || group.reviewOf || group.proposal?.mergedInto || group.foldedInto) return []const approval = group.taskApprovalconst asked = approval ? [askedKey(approval.personId, approval.generation)]: group.proposal ? group.proposal.senders.map(s => askedKey(s.personId, s.generation)) : [group.requesterId]diff --git a/backend/src/superTabs/read/personalTasks.test.ts b/backend/src/superTabs/read/personalTasks.test.tsindex f39bddb3b..f6ad82812 100644--- a/backend/src/superTabs/read/personalTasks.test.ts+++ b/backend/src/superTabs/read/personalTasks.test.ts@@ -1,6 +1,7 @@import { describe, expect, it } from 'vitest'import { personalTasksFor, personalTasksPage } from './personalTasks.js'-import { readerView } from './views.js'+import { feedIdsOf } from './feedIds.js'+import { groupView, readerView } from './views.js'import { fullSwarm, NOW, owner, peer, outsider } from './fixture.test-support.js'import * as parts from '../parts/index.js'import type { Actor } from '../model.js'@@ -139,6 +140,17 @@ describe('personal Tasks summaries', () => {const merged = { ...declined, data: { ...declined.data!, proposal: { ...proposal, mergedInto: 'other' } } } as typeof rowexpect(personalTasksFor([merged], s.view(), peer)).toMatchObject({ upserts: [], removed: [row.key] })})+ it('leaves out a proposal or task folded into another, and keeps the real task (task #4462)', () => {+ const s = scene(), row = s.stored.groups.find(g => g.key === s.f.web)!, real = s.stored.groups.find(g => g.key === s.f.secretGroup)!+ const folded = { ...row, data: { ...row.data!, assignment: null, archived: true, foldedInto: [real.key] } }+ expect(personalTasksFor([folded, real], s.view(), peer)).toMatchObject({ upserts: [{ id: real.key }], removed: [row.key] })+ // No page reads it: its stored keys name nobody (read/feedIds.ts).+ expect(feedIdsOf(folded.data)).toEqual([])+ expect(feedIdsOf(real.data!)).not.toEqual([])+ // History still finds it: the project's archived list reads by project, not by these keys, and its view names the real+ // task, for its card to open (review of #3534).+ expect(groupView(folded.data, new Set())).toMatchObject({ id: row.key, archived: true, foldedInto: [real.key] })+ })it('never leaks a hidden project, private chat, hidden agent or stale membership proposal', () => {const s = scene(), row = s.stored.groups.find(g => g.key === s.f.secretGroup)!const hidden = s.f.state.agents.find(a => a.projectId === s.f.secret)diff --git a/backend/src/superTabs/read/personalTasks.ts b/backend/src/superTabs/read/personalTasks.tsindex 9594cfdd7..d813f355f 100644--- a/backend/src/superTabs/read/personalTasks.ts+++ b/backend/src/superTabs/read/personalTasks.ts@@ -77,7 +77,7 @@ function summary(part: Part, reader: Reader): PersonalTask | 'gone' | null {// reader's login, closed since (read/feedIds.ts).const worker = group.assignment?.agentId ?? approval?.suggestedAgentIdconst own = asked || (!!worker && reader.agents.has(worker)) || group.assignment?.execution?.contributorId === member.id- if (part.deleted || group.proposal?.mergedInto || !own) return 'gone'+ if (part.deleted || group.proposal?.mergedInto || group.foldedInto || !own) return 'gone'const agent = view.parts.agents.find(a => a.key === worker)?.dataconst asker = group.requesterId ? view.state.people.find(p => p.id === group.requesterId) : undefinedconst askerName = asker && (asker.name ?? asker.username)diff --git a/cli/src/lib/swarmToolSheets.ts b/cli/src/lib/swarmToolSheets.tsindex cd46e377b..5ea15f725 100644--- a/cli/src/lib/swarmToolSheets.ts+++ b/cli/src/lib/swarmToolSheets.ts@@ -95,7 +95,7 @@ const ENTRIES: readonly SheetEntry[] = [T('- `{"type":"work.status"', '`work.status` {conversationId, assignmentId "current", status, result}: working (a note), review (revision and PR link, once per head), done (revision, evidence, links), blocked (why), needs_human (one question), stopped.'),T('- `needs_human` may carry', '`needs_human` may carry `ask` {personId, options 2-5, recommended, unblocks}; keep working on your recommendation until `decisions --answered` shows the answer.', 'engineer', 'ertg'),T('- `{"type":"work.check"', '`work.check` {conversationId, assignmentId, checkId, passed, evidence, head, base} records one acceptance check at the PR head (whole commit id) and base branch you read.', 'engineer', 'ert'),- T('- `{"type":"work.cancel"', '`work.cancel` {conversationId, assignmentId, reason} cancels a task.', 'pm', 'p'),+ T('- `{"type":"work.cancel"', '`work.cancel` {conversationId, assignmentId, reason} cancels a task; a duplicate, or work folded or split into others, says where it goes on ("Duplicate of #N") and leaves people\'s Tasks.', 'pm', 'p'),T('- `{"type":"agent.release"', '`agent.release` {agentId, keep|stop} records keep, or asks to stop, a finished agent.', 'pm', 'pe'),T('- `{"type":"proposal.close"', '`proposal.close` {projectId, messageId, reason} closes an answered Buddy proposal.', 'pm', 'p'),T('- `{"type":"conversation.merged"', '`conversation.merged` {conversationId, pullRequestUrl} records a merge; a task is Done only after it.', 'pm', 'p'),@@ -225,7 +225,7 @@ const SOURCE: Readonly<Record<string, string>> = {"- `{\"type\":\"work.status\"": "9caeb6a2c480","- `needs_human` may carry": "e030311bd45d","- `{\"type\":\"work.check\"": "dc82fbb4eb9b",- "- `{\"type\":\"work.cancel\"": "5c9eb034a478",+ "- `{\"type\":\"work.cancel\"": "e53886524c5f","- `{\"type\":\"agent.release\"": "231cacbc9b60","- `{\"type\":\"proposal.close\"": "f0fcba7d14b9","- `{\"type\":\"conversation.merged\"": "4ff068d0f513",diff --git a/cli/src/lib/swarmTools.ts b/cli/src/lib/swarmTools.tsindex f8290133b..99d0917dc 100644--- a/cli/src/lib/swarmTools.ts+++ b/cli/src/lib/swarmTools.ts@@ -68,7 +68,7 @@ Task and group commands:- \`{"type":"work.status","conversationId":"GROUP","assignmentId":"current","status":"working","result":null}\` is your status for the Swarm. status: \`working\` (result: a one-line note of what is done and next), \`review\` (ready for review; result: the revision and pull request link, sent once per new head), \`done\` (result: exact revision, evidence, deliverable links), \`blocked\` (result: why, and what would unblock you), \`needs_human\` (result: one short question), \`stopped\`. Set working again once it moves. \`done\` and \`stopped\` carry the session's token totals.- \`needs_human\` may carry \`"ask":{"personId":"PERSON","options":["A","B"],"recommended":0,"unblocks":"what the answer unblocks"}\`: 2 to 5 options, opened as a decision for that person. Keep working on your recommendation, marked provisional, until a notice says it was answered; then read the answer with \`decisions --answered\`. The notice carries none of it.- \`{"type":"work.check","conversationId":"GROUP","assignmentId":"current","checkId":"CHECK","passed":true,"evidence":"command run, revision, result","head":"SHA","base":"BRANCH"}\` records an acceptance check at the PR head and base you read.-- \`{"type":"work.cancel","conversationId":"GROUP","assignmentId":"current","reason":"one short sentence"}\` cancels a task.+- \`{"type":"work.cancel","conversationId":"GROUP","assignmentId":"current","reason":"one short sentence"}\` cancels a task. A duplicate, or work folded or split into others, says where it goes on ("Duplicate of #N", "Split into #N and #M") and leaves people's Tasks.- \`{"type":"agent.release","agentId":"AGENT","decision":"keep|stop"}\` records keep or requests stop of an agent whose work is finished; wait for its machine to confirm a stop.- \`{"type":"proposal.close","projectId":"PROJECT","messageId":"PROPOSAL","reason":"built in #N, declined or duplicate"}\` closes a Buddy's proposal still listed as open though answered or built (before threads, or opened as a task without its proposalMessageId): it leaves the open list for good, its reason kept, and posts nothing in the chat. The project's coordinator, or a person who reads the project.- \`{"type":"conversation.merged","conversationId":"GROUP","pullRequestUrl":"https://github.com/OWNER/REPOSITORY/pull/NUMBER","mergedAt":"optional ISO time"}\` records a group's pull request as merged; its requester's request counts as shipped from then.diff --git a/cli/src/superTabs/service.ts b/cli/src/superTabs/service.tsindex 3ad04108c..7d27b2d21 100644--- a/cli/src/superTabs/service.ts+++ b/cli/src/superTabs/service.ts@@ -105,7 +105,7 @@ const HELP = {{ type: 'conversation.agent', conversationId: 'GROUP', agentId: 'AGENT', present: true, lead: false },{ type: 'work.priority', conversationId: 'GROUP', priority: 'P0' },{ type: 'work.define', conversationId: 'GROUP', task: { goal: 'What to deliver', changes: 'What changes', constraints: 'What must stay true', owns: ['Paths or code areas'] }, checks: [{ description: 'Observable acceptance evidence', independent: false }] },- { type: 'work.cancel', conversationId: 'GROUP', assignmentId: 'current', reason: 'Why the task is cancelled, in one short sentence' },+ { type: 'work.cancel', conversationId: 'GROUP', assignmentId: 'current', reason: 'Why the task is cancelled, in one short sentence; a duplicate names the task its work goes on in, as Duplicate of #N, and leaves people\'s Tasks' },{ type: 'conversation.merged', conversationId: 'GROUP', pullRequestUrl: 'https://github.com/OWNER/REPOSITORY/pull/NUMBER', mergedAt: 'Optional ISO time of a merge recorded later' },{ type: 'agent.release', agentId: 'AGENT', decision: 'keep|stop' },{ type: 'instructions.save', projectId: 'PROJECT', baseRevision: 3, text: 'The whole new document', summary: 'One line, up to 200 characters', askedBy: 'PERSON' },diff --git a/docs/plans/2026-11-07-tasks-folded-duplicates-plan.md b/docs/plans/2026-11-07-tasks-folded-duplicates-plan.mdnew file mode 100644index 000000000..d95788584--- /dev/null+++ b/docs/plans/2026-11-07-tasks-folded-duplicates-plan.md@@ -0,0 +1,74 @@+# Tasks feed: duplicates leave it — Plan (task #4462)++**Goal:** A proposal or task closed as a duplicate of, or folded or split into, another task leaves the person's Tasks+feed; the real task stays; the closed one is kept and still readable, and names the real task.++**Architecture:** The rule is the PM's own words (River, in the task): a task cancelled with a reason that says its work+goes on in another task ("Duplicate of #4421", "Being done inside #4445", "split… #4465 … #4468") points there.+`work.cancel` reads those numbers from its reason (`tasksNamedIn`: only after a phrase such as duplicate, inside, into+or split in the same sentence; never the task itself or "PR #N"; at most 10), keeps those that are tasks of the same project the+Swarm holds now (`goesOnIn`: not a chat, a step or a private conversation; a mistyped number links nothing), and stores their+ids as `foldedInto`. The feed treats `foldedInto` as it already treats a merged proposal (`proposal.mergedInto`): the row's+indexed `feedIds` is empty, so no page reads it, and a change poll sends its id as removed. History is the project's+archived list, which reads by project, not by the feed's keys: it still lists the task, and its view carries `foldedInto`+for a client to open the real task. A task cancelled before this ships (the existing duplicates, such as #4420 into #4421)+is cancelled again by the PM with a reason naming the real task: it takes the link and nothing else changes; a number it cannot find is refused by name. No data is+deleted. A cancel whose reason names no task stays.++**Limits:** a command holds only the Swarm's awake conversations, so a real task already quiet (done or cancelled and idle+for a day) cannot be checked and links nothing; the task then stays in Tasks, as today. Opening the real task from the+archived list is a Desktop change, proposed separately (this machine has no Flutter to test it).++**Why not `proposal.merge`:** it refuses every card on Review mode (`TASK_APPROVAL_REQUIRED`) and needs an undecided+proposal as its target, so the PM closed these with a plain cancel.++**Tech Stack:** TypeScript backend (`backend/src/superTabs`), vitest; the CLI's command help (`cli/src/superTabs/service.ts`).++**Spec:** task #4462's brief and River's rule in its conversation.++This plan is implemented test first by the Engineer, task by task (test-driven development); there is no execution+hand-off.++## Global Constraints++- Server-enforced audience unchanged: only who may cancel the task marks it; nothing new is exposed.+- Read only what changed: no new read; the change poll carries the marked row, the page read never sees it.+- Never delete data: the conversation, its messages and its proposal stay; it stays in the archived list.+- Compatibility: no new command field; older CLIs and clients work as before.++## Design++- growth: at most 10 ids per conversation, deleted with it.+- concurrency: the conversation's own write, as `work.cancel` today.+- read cost: none added; `feedIds` is recomputed on the write the command already makes.+- scale: unchanged per Swarm; the feed reads fewer rows.+- compatibility: backend first; Desktop needs no change (it drops removed ids already).+- migration and rollback: no migration; the PM cancels the existing duplicates again with the real task named. Rollback+ leaves an unread field, and those cards show again.+- audience: unchanged, server-enforced.+- identity: N/A because no login is involved.+- failure: a reason naming no task leaves the task as it was; a closed one stays refused as before (`ARCHIVED`).+- platforms: backend (Linux) and the CLI's help text.++## Review Focus++- A marked task never appears in a page or a change poll; the real task still does.+- The already-closed path changes only `foldedInto` and adds one line (not a cancel row, so the scorecard counts no second+ close), is idempotent, and is refused on done work and for whoever may not cancel.+- `tasksNamedIn` false positives: "PR #N" and the task's own number name nothing.++## Task 1: the feed leaves out a marked task++**Files:** `backend/src/superTabs/model.ts`, `backend/src/superTabs/read/feedIds.ts`, `backend/src/superTabs/read/personalTasks.ts`,+`backend/src/superTabs/read/personalTasks.test.ts`, `backend/src/superTabs/parts/light.ts`++- [x] Test: a row with `foldedInto` is removed from a change poll and has empty `feedIds`; the real task is still listed.+- [x] Watch it fail; code `feedIdsOf` and `summary` to treat `foldedInto` as `proposal.mergedInto`; run `src/superTabs/read`.++## Task 2: `work.cancel` reads where the work goes on++**Files:** `backend/src/superTabs/commands.ts`, `backend/src/superTabs/commands.test.ts`, `cli/src/superTabs/service.ts`++- [x] Tests: `tasksNamedIn`; an unassigned and an assigned cancel naming a task are marked, one naming none is not; a task+ cancelled before takes the link once with nothing else changed; done work and someone who may not cancel are refused.+- [x] Watch them fail; code it; say it in the CLI's command help; run the commands, read and parts tests.