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.

fix(super-tabs): let a project's Lead record the owner's rules (#1594)

0xken15f3f0a05b1d3b
diff --git a/backend/integration/superTabs.test.ts b/backend/integration/superTabs.test.ts
index a539cc23d..96bff3b4a 100644
--- a/backend/integration/superTabs.test.ts
+++ b/backend/integration/superTabs.test.ts
@@ -794,6 +794,23 @@ describe('Super Tabs on a real Mongo replica set', () => {
const ownRow = await run(tab, { type: 'rule.set', rule: { kind: 'preferIdle' }, text: 'Reuse idle agents.' })
await expect(run(tab, rule(ownRow.result.messageId as string), host, lead)).rejects.toMatchObject({ code: 'OWNER_MESSAGE_REQUIRED' })
})
+ it('lets a project\'s Lead record and remove a rule from the owner\'s message in that project\'s chat', async () => {
+ // Backend v1.3.14 refused it: a Swarm of projects has no 'lead' chat.
+ const tab = (await store.create(owner, randomUUID(), 'Projects')).id
+ const { projectId, conversationId: chat } = (await run(tab, { type: 'project.create', name: 'App', visibility: 'public', brief: '' })).result as { projectId: string; conversationId: string }
+ await run(tab, { type: 'project.delete', projectId: 'lead' })
+ const lead = (await run(tab, { type: 'agent.add', conversationId: chat, machineId: 'test-host', harnessId: randomUUID(),
+ name: 'Lead', configuration: config, lead: true })).result.agentId as string
+ const said = (await run(tab, { ...message('Only use this Mac.'), conversationId: chat } as Command)).result.messageId as string
+ const askedIn = { conversationId: chat, messageId: said }
+ const ruleId = (await run(tab, { type: 'rule.set', rule: { kind: 'machines', machineIds: ['test-host'] }, text: 'Only this Mac.', askedIn }, host, lead)).result.ruleId as string
+ expect((await store.read(owner, tab)).state.rules).toEqual([expect.objectContaining({ text: 'Only this Mac.', askedIn, addedBy: `agent:${lead}` })])
+ await run(tab, { type: 'rule.remove', ruleId, askedIn }, host, lead)
+ expect((await store.read(owner, tab)).state).not.toHaveProperty('rules')
+ const rows = (await store.messages(owner, tab, chat, {})).messages.filter(m => m.source).map(m => m.text)
+ expect(rows).toEqual(['Rule added: Only this Mac.', 'Rule removed: Only this Mac.'])
+ expect((await store.read(owner, tab)).state.projects!.map(p => p.id)).toEqual([projectId])
+ })
it('closes the replying agent\'s own deliveries of a message as answered, and nobody else\'s', async () => {
const { tab, lead } = await fixture()
const helper = (await run(tab, { type: 'agent.add', conversationId: 'lead', machineId: 'test-host', harnessId: randomUUID(),
@@ -1553,7 +1570,7 @@ describe('the owner\'s Lead machine joins its Swarm', () => {
const machineId = `owner-mac-${randomUUID()}`
await db.machine.create({ data: { machineId, userId: owner.sub, apiKey: `fixture-${machineId}`, managerId: 'fixture', autonomousEnv: 'prod', authMode: 'remote' } })
const tab = (await store.create(owner, randomUUID(), 'Own machine')).id
- await run(tab, { type: 'agent.add', conversationId: 'lead', machineId, harnessId: randomUUID(), name: 'Lead', configuration: config, lead: true })
+ const lead = (await run(tab, { type: 'agent.add', conversationId: 'lead', machineId, harnessId: randomUUID(), name: 'Lead', configuration: config, lead: true })).result.agentId as string
expect((await store.hostTabs(owner, machineId)).map(r => r.joinSwarm)).toEqual([true])
const request = { conversationId: 'lead', machineId, engine: 'codex', name: 'Builder', cwd: '/repo', worktree: true,
requirements: { memoryBytes: 0, diskBytes: 0, maxCpuPercent: 100, tools: [], devices: [], quotaRequired: false } }
@@ -1574,7 +1591,11 @@ describe('the owner\'s Lead machine joins its Swarm', () => {
expect(joined.starts!.find(s => s.id === abandoned)!.error).toBe('Abandoned before it started.')
expect(joined.starts!.find(s => s.id === inFlight)!.error).toBe('Launch refused.')
expect(joined.starts!.find(s => s.id === dispatched)!.error).toBeNull()
- expect((await store.messages(owner, tab, 'lead', {})).messages.at(-1)!.text).toBe('Builder never started and will not start now. Start it again if still needed.')
+ const notice = (await store.messages(owner, tab, 'lead', {})).messages.at(-1)!
+ expect(notice.text).toBe('Builder never started and will not start now. Start it again if still needed.')
+ // The notice is written in the owner's name, but the system wrote it: a Lead cannot quote it as the owner asking.
+ await expect(run(tab, { type: 'rule.set', rule: { kind: 'preferIdle' }, text: 'Idle first.', askedIn: { conversationId: 'lead', messageId: notice.id } },
+ owner, lead)).rejects.toMatchObject({ code: 'OWNER_MESSAGE_REQUIRED' })
const added = joined.machines!.find(m => m.machineId === machineId)!
expect(added).toMatchObject({ contributorId: owner.sub, maxAgents: 3, scope: 'swarm', cwd: '/swarm' })
expect((await store.hostTabs(owner, machineId)).map(r => r.joinSwarm)).toEqual([false, false])
diff --git a/backend/src/superTabs/commands.test.ts b/backend/src/superTabs/commands.test.ts
index fec0b59af..9091a08dd 100644
--- a/backend/src/superTabs/commands.test.ts
+++ b/backend/src/superTabs/commands.test.ts
@@ -1275,6 +1275,86 @@ describe('the owner\'s rules', () => {
})
})
+describe('the owner\'s rules in a Swarm of projects', () => {
+ // Backend v1.3.14: once the original 'lead' project is gone, every Lead rule.set failed NOT_FOUND.
+ const said = (patch: Record<string, unknown> = {}) => ({ askedIn: { author: { kind: 'person', id: 'owner', name: owner.email, membershipGeneration: 'tab' },
+ source: false, createdAt: 1000, ...patch } }) as Partial<CommandContext>
+ function projects() {
+ const f = fixture(); f.invite()
+ const app = f.run({ type: 'project.create', name: 'App', visibility: 'public', brief: '' }).result.conversationId as string
+ const site = f.run({ type: 'project.create', name: 'Site', visibility: 'public', brief: '' }).result.conversationId as string
+ f.run({ type: 'project.delete', projectId: 'lead' })
+ const agentActor = (agentId: string): Actor => ({ kind: 'agent', agentId, machineOwnerId: 'host-owner' })
+ return { ...f, get state() { return f.state }, app, site, lead: agentActor(f.add('app-lead', 'owner', app, true)),
+ worker: agentActor(f.add('app-worker', 'owner', app)), siteLead: agentActor(f.add('site-lead', 'owner', site, true)) }
+ }
+ const machines = (conversationId: string, messageId = 'm1') => ({ type: 'rule.set', rule: { kind: 'machines', machineIds: ['m1'] }, text: 'Only m1.',
+ askedIn: { conversationId, messageId } }) as Command
+
+ it('lets a project\'s Lead set a rule by quoting the owner in that project\'s chat, and posts the row there', () => {
+ const f = projects()
+ const added = f.run(machines(f.app), f.lead, said())
+ expect(f.state.rules).toEqual([expect.objectContaining({ rule: { kind: 'machines', machineIds: ['m1'] }, askedIn: { conversationId: f.app, messageId: 'm1' },
+ addedBy: `agent:${f.lead.kind === 'agent' && f.lead.agentId}` })])
+ expect(added.messages).toEqual([expect.objectContaining({ conversationId: f.app, text: 'Rule added: Only m1.', source: { kind: 'rule' } })])
+ const removed = f.run({ type: 'rule.remove', ruleId: added.result.ruleId as string, askedIn: { conversationId: f.app, messageId: 'm2' } }, f.lead, said())
+ expect(f.state).not.toHaveProperty('rules')
+ expect(removed.messages).toEqual([expect.objectContaining({ conversationId: f.app, text: 'Rule removed: Only m1.', source: { kind: 'rule' } })])
+ })
+ it('posts the owner\'s own rule rows in the quoted project, or else in a remaining Lead chat', () => {
+ const f = projects()
+ expect(f.run(machines(f.site)).messages[0]!.conversationId).toBe(f.site)
+ expect(f.run({ type: 'rule.set', rule: { kind: 'preferIdle' }, text: 'Idle first.' }).messages[0]!.conversationId).toBe(f.app)
+ })
+ it('refuses another project\'s Lead, a worker, a collaborator, a system row and an old message', () => {
+ const f = projects()
+ expect(() => f.run(machines(f.app), f.siteLead, said())).toThrow('unavailable')
+ expect(() => f.run(machines(f.app), f.worker, said())).toThrow('Only the Swarm owner')
+ expect(() => f.run(machines(f.app), peer, said({ author: { kind: 'person', id: 'peer' } }))).toThrow('Only the Swarm owner')
+ expect(() => f.run(machines(f.app), f.lead, said({ source: true }))).toThrow('quote a chat message the owner wrote')
+ expect(() => f.run(machines(f.app), f.lead, said({ createdAt: 1000 - 24 * 3_600_000 - 1 }))).toThrow('quote a chat message the owner wrote')
+ expect(f.state).not.toHaveProperty('rules')
+ })
+ it('tells each project\'s Lead chat which of its starts were abandoned when the machine joins', () => {
+ const f = projects()
+ const start = (id: string, conversationId: string, name: string) => ({ id, request: { conversationId, machineId: 'mac', name }, error: null })
+ f.state.starts = [start('s1', f.app, 'Builder'), start('s2', f.site, 'Writer'), start('s3', f.app, 'Reviewer')] as never
+ const joined = f.run({ type: 'machine.contribute', machineId: 'mac', name: 'Mac', cwd: '/swarm', engines: ['codex'], maxAgents: 2 },
+ owner, { contribution: { machineOwnerId: 'owner', contributorId: 'owner' }, abandonedStartIds: ['s1', 's2', 's3'] })
+ expect(joined.messages.map(m => [m.conversationId, m.text])).toEqual([
+ [f.app, 'Builder, Reviewer never started and will not start now. Start them again if still needed.'],
+ [f.site, 'Writer never started and will not start now. Start it again if still needed.']])
+ expect(new Set(joined.messages.map(m => m.id)).size).toBe(2)
+ })
+})
+
+it('marks every row the system writes in the owner\'s name, so a Lead cannot quote it as the owner asking for a rule', () => {
+ const f = fixture(); f.invite()
+ const rows: { text: string; source?: unknown }[] = []
+ const run = (command: Command, context: Partial<CommandContext> = {}) => { const effects = f.run(command, owner, context); rows.push(...effects.messages); return effects }
+ f.add('lead', 'owner', 'lead', true)
+ const group = run({ type: 'conversation.create', title: 'Drafts', brief: 'Save drafts.', checks: [{ description: 'Saved.', independent: false }] }).result.conversationId as string
+ const worker = f.add('worker', 'owner', group)
+ run({ type: 'work.define', conversationId: group, brief: 'Save drafts offline.', checks: [{ description: 'Saved.', independent: false }] })
+ const assignmentId = run({ type: 'work.assign', conversationId: group, agentId: worker }).result.assignmentId as string
+ run({ type: 'work.status', conversationId: group, assignmentId, status: 'blocked', result: 'Waiting.' })
+ run({ type: 'delivery.resolve', deliveryId: 'd1', resolution: 'received' },
+ { delivery: { id: 'd1', conversationId: group, agentId: worker, messageId: 'm1', text: 'Earlier.' } })
+ run({ type: 'delivery.resolve', deliveryId: 'd2', resolution: 'resend' },
+ { delivery: { id: 'd2', conversationId: group, agentId: worker, messageId: 'm2', text: 'Earlier.' } })
+ run({ type: 'work.cancel', conversationId: group, assignmentId, reason: 'Obsolete.' })
+ run({ type: 'agent.remove', agentId: worker })
+ const start = (id: string) => ({ id, actorKey: 'person:owner', contributorId: 'owner', membershipGeneration: f.state.people[0]!.generation,
+ request: { conversationId: 'lead', machineId: 'mac', name: 'Builder' }, error: null })
+ f.state.starts = [start('s1'), start('s2')] as never
+ run({ type: 'agent.startFailed', startId: 's1', error: 'Launch refused.' })
+ run({ type: 'machine.contribute', machineId: 'mac', name: 'Mac', cwd: '/swarm', engines: ['codex'], maxAgents: 2 },
+ { contribution: { machineOwnerId: 'owner', contributorId: 'owner' }, abandonedStartIds: ['s2'] })
+ expect(rows.map(r => r.text)).toEqual(expect.arrayContaining(['Builder never started and will not start now. Start it again if still needed.',
+ 'Could not start Builder: Launch refused.', 'owner removed worker from the Swarm.']))
+ expect(rows.filter(r => !r.source).map(r => r.text)).toEqual([])
+})
+
describe('the owner\'s rules, after review', () => {
const set = (rule: Record<string, unknown>, text = 'Rule.') => ({ type: 'rule.set', rule, text } as Command)
const request = (patch: Record<string, unknown> = {}) => ({ conversationId: 'lead', machineId: 'machine', engine: 'claude', model: 'opus', effort: 'high', name: 'Builder',
diff --git a/backend/src/superTabs/commands.ts b/backend/src/superTabs/commands.ts
index 257dc61d9..b551f6fd4 100644
--- a/backend/src/superTabs/commands.ts
+++ b/backend/src/superTabs/commands.ts
@@ -245,6 +245,9 @@ export function applyCommand(original: SuperTabState, actor: Actor, input: Comma
}
/** Rows the system writes for rules; a Lead cannot quote one as the owner asking. Names, not emails, in the text. */
const RULE_ROW = { kind: 'rule' }
+ /** Any other row the system writes in the actor's name. Without a source, a notice written as the owner read as the owner
+ * asking, and a Lead could quote it to change rules (review of #1594). Only `message.send` and an initial message stay plain. */
+ const SYSTEM_ROW = { kind: 'system' }
const who = sender.kind === 'person' ? sender.name.split('@')[0]! : sender.name
/** A hard rule refuses an agent, unless it carries out what a person chose by hand. A person is not blocked: the
* command goes through and the group is told. */
@@ -255,11 +258,14 @@ export function applyCommand(original: SuperTabState, actor: Actor, input: Comma
result.warnings = [why]
effects.messages.push({ id: stableId(operationId, 'rule'), conversationId, author: sender, text: `${done} anyway. ${why}`, replyTo: null, recipients: [], source: RULE_ROW })
}
- /** Only the owner changes rules, or the tab's Lead quoting a chat message the owner wrote in the last day (review of
- * #1586: any owner row, a rule row included, could otherwise be quoted at any time). One message may ask for several rules. */
- const ruleChange = (askedIn: { conversationId: string; messageId: string } | undefined) => {
- if (actor.kind === 'person' && actor.userId === state.ownerId) return
- if (actor.kind !== 'agent' || conversation(state, 'lead').leadId !== actor.agentId) {
+ /** Only the owner changes rules, or the Lead of the quoted chat's project quoting a message the owner wrote there in the
+ * last day (review of #1586: any owner row, a rule row included, could otherwise be quoted at any time). One message may
+ * ask for several rules. Returns the Lead chat that hears the change: the quoted project's, else a remaining one. A Swarm
+ * of projects has no 'lead' chat; on backend v1.3.14 looking for it refused every Lead's rule. */
+ const ruleChange = (askedIn: { conversationId: string; messageId: string } | undefined): string | null => {
+ const leadChat = askedIn ? groupProject(state, conversation(state, askedIn.conversationId)).leadConversationId : inviteLanding(state)
+ if (actor.kind === 'person' && actor.userId === state.ownerId) return leadChat
+ if (actor.kind !== 'agent' || !leadChat || conversation(state, leadChat).leadId !== actor.agentId) {
fail('OWNER_REQUIRED', 'Only the Swarm owner, or the Lead passing on the owner\'s request, changes rules.', 403)
}
const asked = askedIn && context.askedIn
@@ -267,6 +273,7 @@ export function applyCommand(original: SuperTabState, actor: Actor, input: Comma
|| context.now - asked.createdAt > RULE_MESSAGE_MS) {
fail('OWNER_MESSAGE_REQUIRED', 'Only the Swarm owner sets rules; quote a chat message the owner wrote in the last day asking for this change.', 403)
}
+ return leadChat
}
const openDecision = (): RouteDecision => {
const decision = context.routeDecision ?? fail('NOT_FOUND', 'This routing decision is unavailable.', 404)
@@ -388,10 +395,16 @@ export function applyCommand(original: SuperTabState, actor: Actor, input: Comma
// Mac that day) and refused every contribution. Those finish as failed; a dispatched or recent start still blocks.
const abandoned = (state.starts ?? []).filter(s => context.abandonedStartIds?.includes(s.id))
for (const start of abandoned) start.error = 'Abandoned before it started.'
- // One command records one message, so the Lead's conversation hears it once, whichever groups asked.
- const names = [...new Set(abandoned.map(s => s.request.name))]
- if (names.length && state.conversations.some(c => c.id === 'lead')) {
- message('lead', `${names.join(', ')} never started and will not start now. Start ${names.length > 1 ? 'them' : 'it'} again if still needed.`)
+ // Each project's Lead chat hears once about its own starts, whichever of its groups asked.
+ const byLeadChat = new Map<string, Set<string>>()
+ for (const start of abandoned) {
+ const group = state.conversations.find(c => c.id === start.request.conversationId)
+ const leadChat = group && groupProject(state, group).leadConversationId
+ if (leadChat && state.conversations.some(c => c.id === leadChat)) byLeadChat.set(leadChat, (byLeadChat.get(leadChat) ?? new Set()).add(start.request.name))
+ }
+ for (const [leadChat, names] of byLeadChat) {
+ effects.messages.push({ id: stableId(operationId, leadChat), conversationId: leadChat, author: sender, replyTo: null, recipients: [], source: SYSTEM_ROW,
+ text: `${[...names].join(', ')} never started and will not start now. Start ${names.size > 1 ? 'them' : 'it'} again if still needed.` })
}
if (state.starts?.some(s => s.request.machineId === command.machineId && (!s.harnessId || (s.poolGeneration && !s.poolSettled)) && !s.error)) fail('STARTS_PENDING', 'Reconcile pending starts before changing this contribution.')
state.machines = state.machines.filter(m => m.machineId !== command.machineId)
@@ -422,22 +435,22 @@ export function applyCommand(original: SuperTabState, actor: Actor, input: Comma
else delete state.routingPolicy
break
case 'rule.set': {
- ruleChange(command.askedIn)
+ const leadChat = ruleChange(command.askedIn)
// There is one machines list; a new one replaces it.
const rules = (state.rules ?? []).filter(r => command.rule.kind !== 'machines' || r.rule.kind !== 'machines')
if (rules.length >= MAX_RULES) fail('RULES_FULL', `This Swarm has ${MAX_RULES} rules. Remove one first.`)
state.rules = [...rules, { id: operationId, rule: command.rule, text: command.text, askedBy: state.ownerId,
askedIn: command.askedIn ?? null, addedBy: actorKey(actor), createdAt: new Date(context.now).toISOString() }]
result.ruleId = operationId
- message('lead', `Rule added: ${command.text}`, [], null, RULE_ROW)
+ if (leadChat) message(leadChat, `Rule added: ${command.text}`, [], null, RULE_ROW)
break
}
case 'rule.remove': {
- ruleChange(command.askedIn)
+ const leadChat = ruleChange(command.askedIn)
const rule = state.rules?.find(r => r.id === command.ruleId) ?? fail('NOT_FOUND', 'This Swarm has no such rule.', 404)
state.rules = state.rules!.filter(r => r.id !== rule.id)
if (!state.rules.length) delete state.rules
- message('lead', `Rule removed: ${rule.text}`, [], null, RULE_ROW)
+ if (leadChat) message(leadChat, `Rule removed: ${rule.text}`, [], null, RULE_ROW)
break
}
case 'conversation.create': {
@@ -465,7 +478,7 @@ export function applyCommand(original: SuperTabState, actor: Actor, input: Comma
})
result.conversationId = operationId
result.number = number
- if (brief) message(operationId, brief)
+ if (brief) message(operationId, brief, [], null, SYSTEM_ROW)
break
}
case 'conversation.rename':
@@ -591,14 +604,14 @@ export function applyCommand(original: SuperTabState, actor: Actor, input: Comma
if (!start.poolGeneration || !start.harnessId || start.error) fail('START_PENDING', 'This contributed start is not ready to settle.')
if (!start.poolSettled) message(start.request.conversationId, command.warning
? `${start.request.name}: ${command.warning}`
- : `${start.request.name} is ready for an assignment.`)
+ : `${start.request.name} is ready for an assignment.`, [], null, SYSTEM_ROW)
start.poolSettled = true
break
}
if (command.type === 'agent.startFailed') {
if (start.harnessId) fail('ALREADY_STARTED', 'This agent already started.')
start.error = command.error
- message(start.request.conversationId, `Could not start ${start.request.name}: ${command.error}`)
+ message(start.request.conversationId, `Could not start ${start.request.name}: ${command.error}`, [], null, SYSTEM_ROW)
break
}
if (start.error) fail('START_FAILED', 'This start failed. Use a new start request.')
@@ -621,7 +634,7 @@ export function applyCommand(original: SuperTabState, actor: Actor, input: Comma
result.agentId = agentId
message(group.id, start.poolGeneration
? `${start.request.name} joined. Preparing its model.`
- : `${start.request.name} joined. Ready for an assignment.`)
+ : `${start.request.name} joined. Ready for an assignment.`, [], null, SYSTEM_ROW)
break
}
case 'agent.configuration': {
@@ -706,7 +719,7 @@ export function applyCommand(original: SuperTabState, actor: Actor, input: Comma
// One person can withdraw an agent from several groups. Each notice needs its own durable message ID.
effects.messages.push({ id: stableId(operationId, 'agent-removed', group.id), conversationId: group.id,
author: sender, text: `${sender.name.split('@')[0]} removed ${target.displayName ?? target.name} from the Swarm.${task}`,
- replyTo: null, recipients: lead ? [lead] : [] })
+ replyTo: null, recipients: lead ? [lead] : [], source: SYSTEM_ROW })
}
break
}
@@ -804,11 +817,11 @@ export function applyCommand(original: SuperTabState, actor: Actor, input: Comma
if (command.resolution === 'resend') {
open(state, group.id)
if (!group.agentIds.includes(target.id)) fail('INVALID_RECIPIENT', 'This agent is no longer in the conversation.', 400)
- message(group.id, delivery.text, [target.id], delivery.messageId, undefined, delivery.attachments)
+ message(group.id, delivery.text, [target.id], delivery.messageId, SYSTEM_ROW, delivery.attachments)
} else {
message(group.id, command.resolution === 'received'
? `Checked ${target.name}’s terminal and confirmed the earlier instruction was received.`
- : `Dismissed the delivery warning for ${target.name}. This does not stop work already received.`, [], delivery.messageId)
+ : `Dismissed the delivery warning for ${target.name}. This does not stop work already received.`, [], delivery.messageId, SYSTEM_ROW)
}
result.deliveryId = delivery.id
result.resolution = command.resolution
@@ -880,7 +893,7 @@ export function applyCommand(original: SuperTabState, actor: Actor, input: Comma
if (command.task) group.task = command.task
else delete group.task
group.checks = command.checks.map((c, i) => ({ ...c, id: stableId(operationId, String(i)), evidence: null, passedBy: null }))
- message(group.id, group.brief)
+ message(group.id, group.brief, [], null, SYSTEM_ROW)
break
}
case 'work.assign': {
@@ -924,7 +937,7 @@ export function applyCommand(original: SuperTabState, actor: Actor, input: Comma
personChose = !override && decision.override?.by === 'person'
}
ruled(agentTarget(state, worker), group.id, `${who} assigned ${worker.name}`, personChose)
- message(group.id, `${group.brief}\n\nAcceptance checks:\n${group.checks.map(c => `- ${c.description}`).join('\n')}`, [worker.id])
+ message(group.id, `${group.brief}\n\nAcceptance checks:\n${group.checks.map(c => `- ${c.description}`).join('\n')}`, [worker.id], null, SYSTEM_ROW)
if (routeNote) effects.messages.push({ id: stableId(operationId, 'route-override'), conversationId: group.id, author: sender,
text: routeNote.text, replyTo: null, recipients: [], source: { kind: 'route-override', decisionId: routeNote.decisionId, by: 'lead' } })
break
@@ -953,7 +966,7 @@ export function applyCommand(original: SuperTabState, actor: Actor, input: Comma
// Ready for review also wakes the group's Reviewers, whoever marked it.
const reviewers = command.status !== 'review' ? [] : group.agentIds.filter(id => id !== lead &&
(actor.kind !== 'agent' || id !== actor.agentId) && state.agents.some(a => a.id === id && agentRole(a) === 'reviewer' && a.workDecision !== 'stop'))
- message(group.id, `${label}${command.result ? `\n\n${command.result}` : ''}`, [...(tellLead ? [lead] : []), ...reviewers])
+ message(group.id, `${label}${command.result ? `\n\n${command.result}` : ''}`, [...(tellLead ? [lead] : []), ...reviewers], null, SYSTEM_ROW)
}
break
}
@@ -975,7 +988,7 @@ export function applyCommand(original: SuperTabState, actor: Actor, input: Comma
assignment.result = command.reason
finishWorker(state, assignment.agentId, group)
message(group.id, `${isLead ? 'The Lead' : 'The tab owner'} cancelled this task: ${command.reason.replace(/[.\s]+$/, '')}.${gone ? '' : ' Stop working on it.'}`,
- gone ? [] : [assignment.agentId])
+ gone ? [] : [assignment.agentId], null, SYSTEM_ROW)
break
}
case 'work.check': {