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
Swarm: a Reviewer waiting on the Engineer's fix keeps its linked review task (Diego) (#2487)
0xken154594cc1ad636
diff --git a/backend/integration/superTabLiveness.test.ts b/backend/integration/superTabLiveness.test.tsindex f72c35656..bb69b712d 100644--- a/backend/integration/superTabLiveness.test.ts+++ b/backend/integration/superTabLiveness.test.ts@@ -690,6 +690,101 @@ describe('work waiting for its review', () => {})})+// Diego, 2026-11-01: a Reviewer checks and posts in the build's group, which never renewed its own review task, so after a+// normal fix round of ~31 minutes that task was lost, its Lead woken and the Reviewer told to stop with its verdict refused.+// Review of #2487: it follows the Reviewer, never the Engineer, so an idle Reviewer is still lost.+describe('a review task while its build is back with the Engineer', () => {+ /** Review task "Review: Ship the parser" (reviewOf the build) assigned to a Reviewer on the worker's machine, which is also+ * in the build's group, as a Reviewer is to check and post there. */+ async function reviewing() {+ const f = await swarm()+ const review = String((await f.execute({ type: 'conversation.create', title: 'Review: Ship the parser', brief: 'Review it', reviewOf: f.group,+ checks: [{ description: 'Verdict', independent: false }] })).result.conversationId)+ const reviewer = await f.add(review, 'test-host', f.harness.other, 'Reviewer')+ const part = await db.swarmAgent.findFirstOrThrow({ where: { tabId: f.tab, key: reviewer } })+ await db.swarmAgent.update({ where: { id: part.id }, data: { data: { ...part.data as object, role: 'reviewer' } } })+ await f.execute({ type: 'conversation.agent', conversationId: f.group, agentId: reviewer, present: true, lead: false })+ const verdict = String((await f.execute({ type: 'work.assign', conversationId: review, agentId: reviewer })).result.assignmentId)+ const waitFrom = f.clock.now+ const asReviewer = (command: Command) => f.execute(command, host, reviewer)+ const engineer = (status: 'working' | 'review', result: string) =>+ f.execute({ type: 'work.status', conversationId: f.group, assignmentId: f.assignmentId, status, result }, host, f.worker)+ /** Both machines report and the Lead polls each minute: the Engineer's screen changes and it sends a "working" heartbeat+ * every 4 minutes; the Reviewer's screen stays still. */+ const minutes = async (count: number, { heartbeats = true }: { heartbeats?: boolean } = {}) => {+ for (let minute = 1; minute <= count; minute++) {+ f.clock.now += MINUTE+ if (heartbeats && minute % 4 === 0) await engineer('working', 'Working: awaiting review')+ await f.observe('lead-host', [f.harness.lead])+ await f.observe('test-host', [f.harness.worker, f.harness.other],+ { harnessProgress: { [f.harness.worker]: f.clock.now - 10_000, [f.harness.other]: waitFrom } })+ await f.leadInbox()+ }+ }+ /** The Reviewer's machine reports at [at], its screen still since the wait began: a report loses its own agents' tasks+ * at once, while the Lead's poll may answer quietly within 30 seconds of its last full one. */+ const reviewerReport = async (at: number) => {+ f.clock.now = at+ await f.observe('test-host', [f.harness.worker, f.harness.other], { harnessProgress: { [f.harness.worker]: at, [f.harness.other]: waitFrom } })+ }+ const task = async () => (await f.timed.read(owner, f.tab)).state.conversations.find(c => c.id === review)!.assignment!+ const lost = async () => (await f.lostRows()).filter(m => (m.source as { assignmentId?: string }).assignmentId === verdict)+ const buildCheck = async () => (await f.timed.read(owner, f.tab)).state.conversations.find(c => c.id === f.group)!.checks[0]!.id+ const requestChanges = async () => asReviewer({ type: 'work.check', conversationId: f.group, assignmentId: f.assignmentId, checkId: await buildCheck(),+ passed: false, evidence: 'Two findings' })+ return { ...f, review, reviewer, verdict, waitFrom, minutes, task, lost, asReviewer, engineer, requestChanges, reviewerReport }+ }++ it('keeps it from its verdict asking for changes through a 35-minute fix round, and gives it 30 minutes from the next Ready', async () => {+ const f = await reviewing()+ await f.requestChanges()+ expect(await f.task()).toMatchObject({ status: 'working', changesRequestedAt: f.waitFrom, leaseUntil: f.waitFrom + 5 * MINUTE })+ await f.minutes(35)+ expect(await f.task()).toMatchObject({ status: 'working' })+ expect(await f.lost()).toEqual([])+ await f.engineer('review', 'Ready for review: PR #7 at 5a0d3f2')+ const ready = f.clock.now+ expect((await f.task()).changesRequestedAt).toBeUndefined()+ await f.minutes(30, { heartbeats: false })+ expect(await f.task()).toMatchObject({ status: 'working' })+ expect(await f.lost()).toEqual([])+ await f.reviewerReport(ready + 30 * MINUTE + 1)+ expect(await f.task()).toMatchObject({ status: 'lost', lost: { reason: 'no progress for 30 minutes' } })+ expect(await f.lost()).not.toEqual([])+ })++ it('is lost after 30 minutes when its Reviewer sits idle, though the Engineer keeps sending "working" heartbeats', async () => {+ const f = await reviewing()+ await f.minutes(30)+ expect(await f.task()).toMatchObject({ status: 'working' })+ await f.reviewerReport(f.waitFrom + 30 * MINUTE + 1)+ expect(await f.task()).toMatchObject({ status: 'lost', lost: { reason: 'no progress for 30 minutes' } })+ })++ it('is renewed by its own Reviewer\'s post in the build\'s group', async () => {+ const f = await reviewing()+ await f.minutes(28)+ await f.asReviewer({ type: 'message.send', conversationId: f.group, text: 'Still reading the parser changes.', replyTo: null, recipientIds: [f.worker] })+ const posted = f.clock.now+ expect(await f.task()).toMatchObject({ leaseUntil: posted + 5 * MINUTE, progressAt: posted })+ await f.minutes(5)+ expect(await f.task()).toMatchObject({ status: 'working' })+ await f.reviewerReport(posted + 5 * MINUTE + 1)+ expect(await f.task()).toMatchObject({ status: 'lost', lost: { reason: 'no progress for 5 minutes' } })+ })++ it('still loses it to time once its build is cancelled after its verdict', async () => {+ const f = await reviewing()+ await f.requestChanges()+ await f.minutes(10)+ await f.execute({ type: 'work.cancel', conversationId: f.group, assignmentId: f.assignmentId, reason: 'Not needed' })+ await f.minutes(20, { heartbeats: false })+ expect(await f.task()).toMatchObject({ status: 'working' })+ await f.reviewerReport(f.waitFrom + 30 * MINUTE + 1)+ expect(await f.task()).toMatchObject({ status: 'lost', lost: { reason: 'no progress for 30 minutes' } })+ })+})+// Review of #2275: the review-capacity notice took the command's own message id, which the Ready for review row already had,// so the real write hit a duplicate key and rolled the whole status back: no Builder could hand over during a quota shortage.describe('a Ready for review while no new agent can start', () => {diff --git a/backend/src/superTabs/commands.ts b/backend/src/superTabs/commands.tsindex 27958b717..c4cf8a3a7 100644--- a/backend/src/superTabs/commands.ts+++ b/backend/src/superTabs/commands.ts@@ -16,7 +16,7 @@ import { MAX_ATTACHMENTS, type Attachment } from './attachments.js'import { checkMentions, MAX_MENTIONS, namedIn, saysName, textTags, withTags, type MentionTarget } from './mentions.js'import { answerDecision, askDecisions, checkAsker, decisionChoices, decisionQuestion, MAX_OPEN_DECISIONS, MAX_QUESTIONS, type DecisionTarget } from './decisions.js'import { leadOf, TERMINAL_KEYS, terminalAlert, terminalRequest, terminalResult, toLead, type TerminalRequest } from './terminal.js'-import { leadNoticeRows, loseTasks, recordTaskState, renewLease, renewOwnTask, restartQuietTime, waitingForReview } from './liveness.js'+import { changesRequested, leadNoticeRows, loseTasks, recordTaskState, renewLease, renewOwnTask, restartQuietTime, revisionReady, waitingForReview } from './liveness.js'import { DELETED_SWARM_COMMANDS, isPersonalSwarm, notThere, SWARM_DELETE_GRACE_MS } from './deletion.js'import { ABANDONED, askedModel, coordinatorCopy, failureNotice, failureRecipients, MACHINE_REMOVED } from './startFailure.js'import { noteStartFailed, noteStartSucceeded, resumeEngine } from './engineHealth.js'@@ -2551,7 +2551,7 @@ export function applyCommand(original: SuperTabState, actor: Actor, input: Comma// Its project on the row itself, so the row hides once its person loses that project (buddySessions.ts lostProjectRow).if (session?.inSession) Object.assign(effects.messages.at(-1)!, { buddySession: true, ...(session.project ? { buddyProject: session.project } : {}) })recordPost(state, group, actor, { replyTo: command.replyTo, text, reply: context.reply, openTags: context.openTags }, context.now)- if (actor.kind === 'agent') renewOwnTask(group, actor.agentId, context.now)+ if (actor.kind === 'agent') renewOwnTask(state, group, actor.agentId, context.now)leadActed(group.id, 'post')break}@@ -2799,9 +2799,11 @@ export function applyCommand(original: SuperTabState, actor: Actor, input: Commaif (shipped) effects.messages.push(shipped)}}- if (actor.kind === 'agent') renewOwnTask(group, actor.agentId, context.now)+ if (actor.kind === 'agent') renewOwnTask(state, group, actor.agentId, context.now)// The time it waited for its review never counts, whoever moved it on.if (waited && activeWork(group) && !waitingForReview(assignment)) restartQuietTime(assignment, context.now)+ // A Ready ends its Reviewer's wait for this revision: the review counts its quiet time from now (liveness.ts revisionReady).+ if (activeWork(group) && waitingForReview(assignment)) revisionReady(state, group, context.now)break}case 'work.cancel': {@@ -2891,7 +2893,9 @@ export function applyCommand(original: SuperTabState, actor: Actor, input: Commagroup.assignment.reviewFoundAt = context.nowrestartQuietTime(group.assignment, context.now)}- if (actor.kind === 'agent') renewOwnTask(group, actor.agentId, context.now)+ // Its Reviewer's verdict asking for changes: its own review task waits for the new revision (liveness.ts waitingForRevision).+ if (!command.passed && !byAssignee && actor.kind === 'agent') changesRequested(state, group, actor.agentId, context.now)+ if (actor.kind === 'agent') renewOwnTask(state, group, actor.agentId, context.now)break}}diff --git a/backend/src/superTabs/liveness.test.ts b/backend/src/superTabs/liveness.test.tsindex d4abe584f..26af04773 100644--- a/backend/src/superTabs/liveness.test.ts+++ b/backend/src/superTabs/liveness.test.ts@@ -1,6 +1,6 @@import { describe, expect, it } from 'vitest'import type { AgentStart, Assignment, SuperTabState } from './model.js'-import { LEASE_MS, loseTasks, nextLossAt, QUIET_RUNNING_MS, sweepForLead, sweepLiveness, waitingForReview } from './liveness.js'+import { changesRequested, LEASE_MS, loseTasks, nextLossAt, QUIET_RUNNING_MS, renewOwnTask, revisionReady, sweepForLead, sweepLiveness, waitingForReview } from './liveness.js'import { MACHINE_FRESH_MS, startPreparing } from './machines.js'import { split } from './parts/index.js'@@ -83,6 +83,121 @@ describe('a task waiting for review', () => {})})+describe('a review task while its build is back with the Engineer', () => {+ // Diego, 2026-11-01: a Reviewer checks and posts in the build's group, which never renewed its own linked task, so after a+ // normal fix round of ~31 minutes the review task was lost, its Lead woken and the Reviewer told to stop. Review of #2487: it+ // follows the Reviewer, never the Engineer, so an idle Reviewer is still lost.+ const asked = 1_000_000+ /** Review task r1 (reviewOf g1) held by Reviewer w on Mac, which reports it running with no screen change since [asked];+ * build g1 held by Engineer e on Studio, both machines reporting at [at]. */+ const reviewing = (at: number, build: Partial<Assignment> = {}, buildPatch: Record<string, unknown> = {}, review: Partial<Assignment> = { changesRequestedAt: asked }) => {+ const report = (h: string) => ({ runningHarnessIds: [h], stoppedHarnessIds: [], receivedAt: at, harnessProgress: { [h]: asked } })+ return { id: 't',+ agents: [{ id: 'w', machineId: 'm', harnessId: 'h', machineOwnerId: 'o', contributorId: 'p', membershipGeneration: 'g', name: 'Reviewer' },+ { id: 'e', machineId: 'm2', harnessId: 'h2', machineOwnerId: 'o', contributorId: 'p', membershipGeneration: 'g', name: 'Builder' }],+ people: [{ id: 'p', email: '[email protected]', role: 'owner', generation: 'g' }],+ machines: [{ machineId: 'm', name: 'Mac', observation: report('h') }, { machineId: 'm2', name: 'Studio', observation: report('h2') }],+ conversations: [{ id: 'lead', title: 'Lead', leadId: null, agentIds: [], archived: false, brief: '', checks: [], assignment: null, lastMessageSequence: 0 },+ { id: 'g1', title: 'Build', leadId: null, agentIds: ['e', 'w'], archived: false, brief: 'Do it', checks: [], lastMessageSequence: 0,+ assignment: assignment({ id: 'b1', agentId: 'e', execution: { machineId: 'm2', harnessId: 'h2', machineOwnerId: 'o' },+ leaseUntil: at + LEASE_MS, progressAt: at, ...build }), ...buildPatch },+ { id: 'r1', title: 'Review: Build', leadId: null, agentIds: ['w'], archived: false, brief: 'Review it', checks: [], lastMessageSequence: 0, reviewOf: 'g1',+ assignment: assignment({ id: 'r', leaseUntil: asked + LEASE_MS, progressAt: asked, ...review }) }],+ } as unknown as SuperTabState+ }+ const group = (state: SuperTabState, id: string) => state.conversations.find(c => c.id === id)!+ const review = (state: SuperTabState) => group(state, 'r1').assignment!+ const sweep = (state: SuperTabState, now: number) => {+ const rows = sweepLiveness(state, now).filter(row => row.source?.kind === 'work-lost' && row.source.assignmentId === 'r')+ return { status: review(state).status, lost: rows.length > 0 }+ }+ const later = asked + 35 * MINUTE++ it('keeps its task through 35 quiet minutes after its verdict asked for changes, while the build is in progress, blocked or asking a person', () => {+ for (const status of ['working', 'blocked', 'needs_human'] as const) expect(sweep(reviewing(later, { status }), later)).toEqual({ status: 'working', lost: false })+ // Nor is it the next loss its machine's reports wait for.+ expect(nextLossAt(reviewing(later), 'm')).toBeUndefined()+ })++ it('is lost after 30 quiet minutes with no verdict asking for changes, though its Engineer keeps working and sending heartbeats', () => {+ // The Engineer's "working" heartbeats renew the build every few minutes; the Reviewer sits idle.+ const idle = (at: number) => reviewing(at, { status: 'working', result: 'Working: awaiting review', progressAt: at, leaseUntil: at + LEASE_MS }, {}, {})+ expect(sweep(idle(asked + QUIET_RUNNING_MS), asked + QUIET_RUNNING_MS)).toEqual({ status: 'working', lost: false })+ expect(nextLossAt(idle(asked + 26 * MINUTE), 'm')).toBe(asked + QUIET_RUNNING_MS)+ const lost = idle(asked + QUIET_RUNNING_MS + 1)+ expect(sweep(lost, asked + QUIET_RUNNING_MS + 1)).toEqual({ status: 'lost', lost: true })+ expect(review(lost).lost?.reason).toBe('no progress for 30 minutes')+ // The build waiting for review again, with the Reviewer idle since: lost the same way.+ expect(sweep(reviewing(later, { status: 'review', result: 'Ready for review at abc1234' }, {}, {}), later)).toEqual({ status: 'lost', lost: true })+ })++ it('still loses its task to time once its build is cancelled, finished, lost, archived, unloaded or in another project', () => {+ for (const status of ['cancelled', 'done', 'lost'] as const) expect(sweep(reviewing(later, { status }), later)).toEqual({ status: 'lost', lost: true })+ expect(sweep(reviewing(later, {}, { archived: true }), later)).toEqual({ status: 'lost', lost: true })+ expect(sweep(reviewing(later, {}, { projectId: 'other', agentIds: ['e'] }), later)).toEqual({ status: 'lost', lost: true })+ const asleep = reviewing(later)+ asleep.conversations = asleep.conversations.filter(c => c.id !== 'g1')+ expect(sweep(asleep, later)).toEqual({ status: 'lost', lost: true })+ expect(nextLossAt(reviewing(later, { status: 'cancelled' }), 'm')).toBe(asked + QUIET_RUNNING_MS)+ })++ it('still loses its task at once when its session stops, its machine goes offline, it hits a limit or its model keeps failing', () => {+ const stopped = reviewing(later)+ stopped.machines![0]!.observation!.stoppedHarnessIds = ['h']+ expect(sweep(stopped, later)).toEqual({ status: 'lost', lost: true })+ const offline = reviewing(later - 3 * MINUTE)+ sweep(offline, later)+ expect(review(offline)).toMatchObject({ status: 'lost', lost: { reason: 'its machine Mac has been offline for 2 minutes' } })+ const limited = reviewing(later)+ Object.assign(limited.agents[0]!, { alerting: ['limit'], limitedUntil: new Date(later + 60 * MINUTE).toISOString() })+ expect(sweep(limited, later)).toEqual({ status: 'lost', lost: true })+ const failing = reviewing(later)+ Object.assign(failing.agents[0]!, { alerting: ['model'] })+ expect(sweep(failing, later)).toEqual({ status: 'lost', lost: true })+ })++ it('has 30 minutes from the build\'s next Ready, so the end of the wait does not lose it', () => {+ const ready = (at: number) => {+ const state = reviewing(at, { status: 'review', result: 'Ready for review at abc1234', progressAt: later })+ revisionReady(state, group(state, 'g1'), later)+ return state+ }+ expect(review(ready(later))).toMatchObject({ progressAt: later, leaseUntil: later + QUIET_RUNNING_MS })+ expect(review(ready(later)).changesRequestedAt).toBeUndefined()+ expect(sweep(ready(later + QUIET_RUNNING_MS), later + QUIET_RUNNING_MS)).toEqual({ status: 'working', lost: false })+ expect(nextLossAt(ready(later + MINUTE), 'm')).toBe(later + QUIET_RUNNING_MS)+ const quiet = ready(later + QUIET_RUNNING_MS + 1)+ expect(sweep(quiet, later + QUIET_RUNNING_MS + 1)).toEqual({ status: 'lost', lost: true })+ expect(review(quiet).lost?.reason).toBe('no progress for 30 minutes')+ })++ it('is renewed and marked only by its own Reviewer acting in the build, never by the Engineer, another agent or another project', () => {+ const state = reviewing(asked, {}, {}, {})+ // A second linked task, a Tester's, and a linked task of another project naming the same build.+ state.agents.push({ ...structuredClone(state.agents[0]!), id: 't2', harnessId: 'h3', name: 'Tester' })+ state.conversations.push({ ...structuredClone(group(state, 'r1')), id: 's1', assignment: assignment({ id: 's', agentId: 't2', leaseUntil: 1, progressAt: 1 }) },+ { ...structuredClone(group(state, 'r1')), id: 'x1', projectId: 'other', assignment: assignment({ id: 'x', agentId: 'w', leaseUntil: 1, progressAt: 1 }) })+ const build = group(state, 'g1')+ renewOwnTask(state, build, 'e', later)+ expect(review(state)).toMatchObject({ leaseUntil: asked + LEASE_MS, progressAt: asked })+ expect(build.assignment).toMatchObject({ leaseUntil: later + LEASE_MS, progressAt: later })+ renewOwnTask(state, build, 'w', later + MINUTE)+ expect(review(state)).toMatchObject({ leaseUntil: later + MINUTE + LEASE_MS, progressAt: later + MINUTE })+ expect(group(state, 's1').assignment).toMatchObject({ leaseUntil: 1, progressAt: 1 })+ expect(group(state, 'x1').assignment).toMatchObject({ leaseUntil: 1, progressAt: 1 })+ // The build's lease is its Engineer's own, untouched by the Reviewer.+ expect(build.assignment).toMatchObject({ leaseUntil: later + LEASE_MS, progressAt: later })+ changesRequested(state, build, 'w', later)+ expect(review(state).changesRequestedAt).toBe(later)+ expect(group(state, 's1').assignment!.changesRequestedAt).toBeUndefined()+ expect(group(state, 'x1').assignment!.changesRequestedAt).toBeUndefined()+ // A cancelled build marks nothing.+ const cancelled = reviewing(asked, { status: 'cancelled' }, {}, {})+ changesRequested(cancelled, group(cancelled, 'g1'), 'w', later)+ expect(review(cancelled).changesRequestedAt).toBeUndefined()+ })+})+describe('a worker whose task is lost', () => {it('is marked lost in the same write that loses its task, so routing keeps it out after a cancel or reassignment', () => {const state = swarm(assignment({ leaseUntil: 1 })), now = 1 + LEASE_MS + 1@@ -336,11 +451,27 @@ describe('the state of each task, and the Lead woken when one stalls', () => {task(state).reviewOf = 'g0'state.conversations.push({ ...structuredClone(task(state)), id: 'g0', number: 6, title: 'Build', reviewOf: undefined,assignment: assignment({ id: 'a0', agentId: 'L', status: 'working', progressAt: NOW }) })+ // Its verdict asked for changes.+ task(state).assignment!.changesRequestedAt = NOW - 3 * 60 * MINUTEexpect(wakes(sweepForLead(state, NOW))).toEqual([])expect(task(state).liveness).toEqual({ state: 'waiting', why: 'revision', since: NOW - 3 * 60 * MINUTE })- state.conversations.find(c => c.id === 'g0')!.assignment!.status = 'review'+ const build = state.conversations.find(c => c.id === 'g0')!+ build.assignment!.status = 'review'+ revisionReady(state, build, NOW)+ // Its quiet time runs from when the build came back, not from the Reviewer's last post before the fix round.+ const at = (now: number) => (state.machines![0]!.observation!.receivedAt = now, now)+ expect(wakes(sweepForLead(state, at(NOW + 29 * MINUTE)))).toEqual([])+ expect(wakes(sweepForLead(state, at(NOW + 30 * MINUTE)))).toHaveLength(1)+ expect(task(state).liveness).toEqual({ state: 'quiet', why: 'silent', since: NOW })+ })++ it('turns quiet when it reviews a build in progress without having asked for changes: an Engineer\'s work keeps no idle Reviewer', () => {+ const state = project({ progressAt: NOW - 30 * MINUTE })+ task(state).reviewOf = 'g0'+ state.conversations.push({ ...structuredClone(task(state)), id: 'g0', number: 6, title: 'Build', reviewOf: undefined,+ assignment: assignment({ id: 'a0', agentId: 'L', status: 'working', result: 'Working: awaiting review', progressAt: NOW }) })expect(wakes(sweepForLead(state, NOW))).toHaveLength(1)- expect(task(state).liveness).toMatchObject({ state: 'quiet', why: 'silent' })+ expect(task(state).liveness).toEqual({ state: 'quiet', why: 'silent', since: NOW - 30 * MINUTE })})it('is orphaned at once when its agent was removed or is gone, and wakes the Lead once', () => {diff --git a/backend/src/superTabs/liveness.ts b/backend/src/superTabs/liveness.tsindex 303ce4f0e..20b0bf95d 100644--- a/backend/src/superTabs/liveness.ts+++ b/backend/src/superTabs/liveness.ts@@ -92,6 +92,48 @@ export function restartQuietTime(assignment: Assignment, now: number): void {assignment.leaseUntil = Math.max(assignment.leaseUntil ?? 0, now + QUIET_RUNNING_MS)}+/** The build a linked task (reviewOf) reviews, while that build is active work of the same project and not archived. Only+ * a loaded build counts: an active one is always loaded, by a machine's report (parts/load.ts loadObserved reads running+ * groups) as by the Lead's poll. A cancelled, finished, lost, archived or asleep build reviews nothing. */+function reviewedBuild(state: SuperTabState, group: Conversation): Conversation | undefined {+ if (!group.reviewOf) return undefined+ const build = state.conversations.find(c => c.id === group.reviewOf)+ return build && !build.archived && activeWork(build) && (build.projectId ?? 'lead') === (group.projectId ?? 'lead') ? build : undefined+}++/** The active linked tasks (reviewOf [build]) its own [agentId] holds: the Reviewer's or Tester's task for that build. */+function ownLinkedTasks(state: SuperTabState, build: Conversation, agentId: string): Conversation[] {+ return state.conversations.filter(c => c.reviewOf === build.id && activeWork(c) && c.assignment!.agentId === agentId+ && reviewedBuild(state, c) === build)+}++/** A linked task waits for the new revision from its own Reviewer's verdict asking for changes until the build's next Ready,+ * while that build is still active, so its quiet time does not count then (Diego, 2026-11-01: a Reviewer waiting on a normal+ * fix round of ~31 minutes lost its task, its Lead was woken and its verdict refused). It follows the Reviewer, never the+ * Engineer: an Engineer's own posts or "working" heartbeats keep no idle Reviewer (review of #2487). */+export function waitingForRevision(state: SuperTabState, group: Conversation): boolean {+ return group.assignment?.changesRequestedAt !== undefined && !!reviewedBuild(state, group)+}++/** [agentId]'s verdict in [build] asked for changes (a failed check by someone other than its assignee): its own linked task+ * waits for the new revision (waitingForRevision). Written in that command's own write, with the linked task's group. */+export function changesRequested(state: SuperTabState, build: Conversation, agentId: string, now: number): void {+ for (const linked of ownLinkedTasks(state, build, agentId)) {+ linked.assignment!.changesRequestedAt = now+ recordTaskState(state, linked, now)+ }+}++/** [build] is ready for review again: each linked task that waited for this revision counts its quiet time from now, so the end+ * of the wait does not lose it, as an Engineer whose review found problems does (restartQuietTime). */+export function revisionReady(state: SuperTabState, build: Conversation, now: number): void {+ for (const linked of state.conversations.filter(c => c.reviewOf === build.id && activeWork(c) && c.assignment!.changesRequestedAt !== undefined)) {+ delete linked.assignment!.changesRequestedAt+ restartQuietTime(linked.assignment!, now)+ recordTaskState(state, linked, now)+ }+}+/** The active assignments held by workers, not by a Lead, and not already being reconciled after their agent left. */function workerTasks(state: SuperTabState): Array<{ group: Conversation; assignment: Assignment; worker: Agent }> {return state.conversations.filter(activeWork).flatMap(group => {@@ -102,9 +144,11 @@ function workerTasks(state: SuperTabState): Array<{ group: Conversation; assignm})}-/** The worker's own status, check or message in its task's group renews its lease. */-export function renewOwnTask(group: Conversation, agentId: string, now: number): void {+/** The worker's own status, check or message in its task's group renews its lease. A Reviewer or Tester checks and posts in+ * the build's group, so there it renews its own linked task (reviewOf), never another agent's. */+export function renewOwnTask(state: SuperTabState, group: Conversation, agentId: string, now: number): void {if (activeWork(group) && group.assignment!.agentId === agentId) renewLease(group.assignment!, now)+ for (const linked of ownLinkedTasks(state, group, agentId)) renewLease(linked.assignment!, now)}/** The last time its machine's reports renewed a worker's lease: a report listing it running with recent progress renews at@@ -144,7 +188,8 @@ function limitReason(worker: Agent, now: number): string | null {/** The earliest time a task held by a worker on [machineId] may be lost to its lease running out, as lostReason reads it now,* or undefined when none can. Reports that keep its session running with progress no older can only move it later. */export function nextLossAt(state: SuperTabState, machineId: string): number | undefined {- const ends = workerTasks(state).filter(({ worker, assignment }) => worker.machineId === machineId && !waitingForReview(assignment))+ const ends = workerTasks(state)+ .filter(({ group, worker, assignment }) => worker.machineId === machineId && !waitingForReview(assignment) && !waitingForRevision(state, group)).map(({ group, assignment, worker }) => leaseEnd(group, assignment, reportRenewedAt(state, worker))).filter((end): end is number => end !== undefined)return ends.length ? Math.min(...ends) : undefined@@ -160,7 +205,7 @@ function lostReason(state: SuperTabState, group: Conversation, worker: Agent, as// Its host alerts only after ten minutes of retries without an answer (cli superTabs/terminal.ts MODEL_WAIT_MS), so a// short burst of failures that recovers never gets here.if (worker.alerting?.includes('model')) return 'its model keeps failing'- if (waitingForReview(assignment)) return null+ if (waitingForReview(assignment) || waitingForRevision(state, group)) return nullconst end = leaseEnd(group, assignment, reportRenewedAt(state, worker))if (end !== undefined && now > end) {const progress = lastProgress(state, worker, assignment)@@ -318,9 +363,9 @@ export function taskLiveness(state: SuperTabState, group: Conversation, now: num}if (assignment.status === 'review') return reviewWait(state, group, progress, now)if (assignment.status === 'blocked') return { state: 'waiting', why: 'blocked', since: progress }- // A review whose build is back with its Engineer waits for the new revision.- const build = group.reviewOf ? state.conversations.find(c => c.id === group.reviewOf) : undefined- if (build && activeWork(build) && build.assignment!.status !== 'review') return { state: 'waiting', why: 'revision', since: progress }+ // A review whose verdict asked for changes waits for the new revision; once it is ready, its quiet time runs from then+ // (revisionReady restarts its progress).+ if (waitingForRevision(state, group)) return { state: 'waiting', why: 'revision', since: progress }return now - progress >= TASK_QUIET_MS ? { state: 'quiet', why: 'silent', since: progress } : null}// Only unfinished starts are loaded, with those that ended in this same write.diff --git a/backend/src/superTabs/model.ts b/backend/src/superTabs/model.tsindex b7efe05ba..55a0bd545 100644--- a/backend/src/superTabs/model.ts+++ b/backend/src/superTabs/model.ts@@ -217,6 +217,9 @@ export interface Assignment {/** When someone else's verdict found problems in a working hand-off of the older built-in skills, which then stops waiting* for its review (liveness.ts waitingForReview). Its next status clears it. */reviewFoundAt?: number+ /** On a linked task (reviewOf): when its own Reviewer's verdict in the build asked for changes. Its quiet time does not count+ * until the build's next Ready clears it (liveness.ts waitingForRevision). */+ changesRequestedAt?: number/** A two-review task's hand-overs and reviewers' verdicts, from the automatic reviews (#2382) before project instructions;* never written since (phase 4: the server opens and counts no review), kept on older rows. */handoffs?: numberdiff --git a/backend/src/superTabs/parts/light.test.ts b/backend/src/superTabs/parts/light.test.tsindex c4547186f..2bd0d6f82 100644--- a/backend/src/superTabs/parts/light.test.ts+++ b/backend/src/superTabs/parts/light.test.ts@@ -8,7 +8,7 @@ import { FINISHED, GROUP_FIELDS } from './light.js'* here, and the test below until light.ts either projects it or names it as unread by reads (review of #1745). */const assignment: Required<Assignment> = {id: 'w', agentId: 'a', status: 'working', configuration: { engine: 'codex', model: null, effort: null, contextWindow: null, engineVersion: null },- execution: { machineId: 'm', harnessId: 'h', machineOwnerId: 'o' }, result: null, recordingProgress: { at: 1, revision: 1 }, leaseUntil: 1, progressAt: 1, askedOf: 'p', reviewFoundAt: 1,+ execution: { machineId: 'm', harnessId: 'h', machineOwnerId: 'o' }, result: null, recordingProgress: { at: 1, revision: 1 }, leaseUntil: 1, progressAt: 1, askedOf: 'p', reviewFoundAt: 1, changesRequestedAt: 1,handoffs: 1, verdicts: [{ by: 'agent:r', passed: true, handoff: 1, review: 'g' }], lost: { reason: 'r', at: 1 },}const conversation: Required<Conversation> = {diff --git a/backend/src/superTabs/parts/light.ts b/backend/src/superTabs/parts/light.tsindex 597166db1..5e162266b 100644--- a/backend/src/superTabs/parts/light.ts+++ b/backend/src/superTabs/parts/light.ts@@ -28,7 +28,7 @@ export const GROUP_FIELDS = {'assignment.lost'],whenRunning: ['title', 'task.owns', 'assignment.execution', 'assignment.result'],unread: ['number', 'brief', 'reviewOf', 'reviewStamp', 'checks', 'lastMessageSequence', 'lastMainSequence', 'pullRequestUrls', 'cards', 'messageSeq', 'reportSeq', 'lastActivityAt', 'lostAttempt', 'requesterId', 'ledger', 'reactionSeq', 'proposals', 'buddyName', 'buddySessions', 'buddyDownTold', 'liveness', 'leadAction', 'stepUp',- 'assignment.configuration', 'assignment.recordingProgress', 'assignment.leaseUntil', 'assignment.progressAt', 'assignment.askedOf', 'assignment.reviewFoundAt',+ 'assignment.configuration', 'assignment.recordingProgress', 'assignment.leaseUntil', 'assignment.progressAt', 'assignment.askedOf', 'assignment.reviewFoundAt', 'assignment.changesRequestedAt','assignment.handoffs', 'assignment.verdicts'],} as constconst LIGHT_GROUP = {