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
fix(backend): a task lost again after it resumed gets new notice ids (#2033)
0xken15f4d98ae0c0ac
diff --git a/backend/integration/superTabLiveness.test.ts b/backend/integration/superTabLiveness.test.tsindex dc62b8fd1..92b4062e5 100644--- a/backend/integration/superTabLiveness.test.ts+++ b/backend/integration/superTabLiveness.test.ts@@ -218,6 +218,41 @@ describe('work that loses its owner', () => {expect((await f.leadInbox()).map(m => m.text)).toContain(`${await f.name(f.worker)} resumed its task after its usage limit reset.`)})+ // 2026-10-28: a resumed task keeps its id. When its session then stopped, the second loss wrote the first loss's notice+ // ids again: the machine's report and the Lead's poll each failed on the duplicate from then on, so the machine looked+ // offline and nothing reached the Lead.+ it('is lost again after it resumed, and its machine\'s report and its Lead\'s poll still go through', async () => {+ const f = await swarm()+ const lostAt = f.clock.now+ await f.execute({ type: 'agent.alert', agentId: f.worker, alert: 'limit', active: true, resetAt: new Date(f.clock.now + 30 * MINUTE).toISOString() }, host, f.worker)+ f.clock.now += 30 * MINUTE+ await f.execute({ type: 'work.resume', conversationId: f.group, assignmentId: f.assignmentId, lostAt }, host, f.worker)+ await f.leadInbox()+ f.clock.now += MINUTE+ await f.observe('test-host', [], { stoppedHarnessIds: [f.harness.worker] })+ expect(await f.assignment()).toMatchObject({ id: f.assignmentId, status: 'lost', lost: { reason: 'its session on Worker Mac stopped', at: f.clock.now } })+ expect((await f.lostRows()).filter(m => m.recipientIds.includes(f.lead))).toHaveLength(2)+ expect((await f.leadInbox()).filter(m => (m.source as { kind?: string }).kind === 'work-lost').at(-1)!.text)+ .toContain('lost its task "Ship the parser": its session on Worker Mac stopped.')+ })++ // The stuck Swarm of that day: its first loss's notices were written under the old ids, named by the task alone. Its next+ // check writes the loss under new ids, and the Lead and the worker each receive their notice.+ it('heals a resumed task whose first loss was written under the old notice ids', async () => {+ const f = await swarm()+ for (const id of [stableId('work-lost', f.assignmentId), stableId('work-lost', f.assignmentId, 'agent')]) {+ await db.superTabMessage.create({ data: { id, tabId: f.tab, conversationId: f.group, sequence: 1, author: { kind: 'agent', id: f.lead },+ text: 'The first loss', replyTo: null, recipientIds: [], mentions: [] } })+ }+ f.clock.now += MINUTE+ await f.observe('test-host', [], { stoppedHarnessIds: [f.harness.worker] })+ expect(await f.assignment()).toMatchObject({ id: f.assignmentId, status: 'lost', lost: { reason: 'its session on Worker Mac stopped' } })+ expect((await f.leadInbox()).map(m => m.text)).toContain(`${await f.name(f.worker)} lost its task "Ship the parser": its session on Worker Mac stopped. `+ + 'Last progress 1 minute ago. Last result: none. Assign it to another agent now, or cancel it.')+ expect(await db.superTabDelivery.count({ where: { tabId: f.tab, agentId: f.worker,+ messageId: stableId('work-lost', f.assignmentId, String(f.clock.now), 'agent') } })).toBe(1)+ })+// #1757 review, 2: a receipt replays the first answer, so it never says who holds the task now; the host's assignment// rows do (cli superTabs/limitResume.ts reads them before typing).it('replays a resume whose answer was lost even after a takeover, while its host\'s assignment rows no longer list it', async () => {diff --git a/backend/src/superTabs/liveness.ts b/backend/src/superTabs/liveness.tsindex 86d50ff55..161489d16 100644--- a/backend/src/superTabs/liveness.ts+++ b/backend/src/superTabs/liveness.ts@@ -136,8 +136,10 @@ function loseTask(state: SuperTabState, group: Conversation, worker: Agent, reas+ (resumeAt ? `It resumes by itself when its limit resets at ${resumeAt.slice(11, 16)} UTC, unless you hand it on first. `+ 'If another account or engine has allowance now, assign it there now with its branch and last progress note, or cancel it.': 'Assign it to another agent now, or cancel it.')- return [...toLead(state, worker, { id: stableId('work-lost', assignment.id), conversationId: group.id, author: sender, replyTo: null, recipients: [], text: wake, source }),- { id: stableId('work-lost', assignment.id, 'agent'), conversationId: group.id, author: sender, replyTo: null, recipients: [worker.id], source,+ // Named by the loss, not the task: a task resumed after a usage limit keeps its id and can be lost again (2026-10-28).+ const loss = String(now)+ return [...toLead(state, worker, { id: stableId('work-lost', assignment.id, loss), conversationId: group.id, author: sender, replyTo: null, recipients: [], text: wake, source }),+ { id: stableId('work-lost', assignment.id, loss, 'agent'), conversationId: group.id, author: sender, replyTo: null, recipients: [worker.id], source,text: `Your task "${group.title}" moved: ${reason}. Stop working on it; your status and results for it are no longer accepted.` }].map(row => reachable(state, row))}