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): an update request the Lead received but never answered is asked again after two hours (#2001)
0xken1500787b7c6393
diff --git a/backend/integration/superTabLiveness.test.ts b/backend/integration/superTabLiveness.test.tsindex feadba38d..dc62b8fd1 100644--- a/backend/integration/superTabLiveness.test.ts+++ b/backend/integration/superTabLiveness.test.ts@@ -608,6 +608,51 @@ describe('the delivery poll of an agent with nothing waiting', () => {expect(told.map(m => (m.source as { kind?: string }).kind)).toEqual(['update-request'])})+ // Prod, 2026-10-28: a Lead's host received an update request on 26 Oct and the Lead never answered it. Every later poll+ // took it as still pending, so the project was never asked again, its reports were never summarized, and 372 archived+ // conversations could not go quiet for two days.+ it('asks again once an update request the Lead\'s host received goes unanswered for two hours, and not before', async () => {+ const f = await swarm()+ await f.leadInbox()+ f.clock.now += 5 * MINUTE+ const requests = async () => {+ const rows = await f.timed.deliveries(host, f.tab, f.lead)+ const messages = await db.superTabMessage.findMany({ where: { id: { in: rows.map(r => r.messageId) } } })+ return rows.filter(r => (messages.find(m => m.id === r.messageId)!.source as { kind?: string }).kind === 'update-request')+ }+ const [first] = await requests()+ expect(first).toBeDefined()+ // Typed into the Lead's terminal, never answered.+ await f.timed.delivery(host, f.tab, f.lead, first!.id, { type: 'claim', claimId: 'claim' })+ await f.timed.delivery(host, f.tab, f.lead, first!.id, { type: 'ack', claimId: 'claim', receipt: 'typed', uncertain: false })+ // New reports keep coming.+ f.clock.now += MINUTE+ await f.execute({ type: 'work.status', conversationId: f.group, assignmentId: f.assignmentId, status: 'working', result: 'Halfway' }, host, f.worker)+ f.clock.now += 59 * MINUTE+ expect(await requests()).toEqual([])+ f.clock.now += 61 * MINUTE+ const again = await requests()+ expect(again).toHaveLength(1)+ expect(again[0]!.messageId).not.toBe(first!.messageId)+ })++ it('keeps holding later update requests while the first never reached the Lead\'s host, however long', async () => {+ const f = await swarm()+ await f.leadInbox()+ f.clock.now += 5 * MINUTE+ const kinds = async () => {+ const rows = await f.timed.deliveries(host, f.tab, f.lead)+ const messages = await db.superTabMessage.findMany({ where: { id: { in: rows.map(r => r.messageId) } } })+ return rows.map(r => (messages.find(m => m.id === r.messageId)!.source as { kind?: string }).kind)+ }+ expect(await kinds()).toContain('update-request')+ // Never claimed: the host is offline. New reports keep coming.+ f.clock.now += MINUTE+ await f.execute({ type: 'work.status', conversationId: f.group, assignmentId: f.assignmentId, status: 'working', result: 'Halfway' }, host, f.worker)+ f.clock.now += 3 * 60 * MINUTE+ expect((await kinds()).filter(kind => kind === 'update-request')).toHaveLength(1)+ })+it('delivers a message on the very next poll, within a second of the last one', async () => {const counted = counting()const f = await swarm({ client: counted.client })diff --git a/backend/src/superTabs/projectUpdates.ts b/backend/src/superTabs/projectUpdates.tsindex 0f9e3e735..f7fa016bf 100644--- a/backend/src/superTabs/projectUpdates.ts+++ b/backend/src/superTabs/projectUpdates.ts@@ -37,6 +37,11 @@ export function noteProjectReports(state: SuperTabState, messages: MessageDraft[/** What each dirty conversation's report reaches, by conversation: what a wake-up asks the Lead to acknowledge. */const throughOf = (groups: Conversation[]) => Object.fromEntries(groups.map(g => [g.id, g.reportSeq ?? 0]).sort(([a], [b]) => a! < b! ? -1 : 1))+/** How long an update request the Lead's host received holds later ones back while unanswered. On 26 Oct one was never+ * answered and held its project's every later request: its reports were never summarized, and 372 archived conversations+ * could not go quiet for two days (prod, 2026-10-28). One not yet received (its host offline) holds them as before. */+export const UNANSWERED_REQUEST_MS = 2 * 60 * 60_000+export function projectUpdateRequest(state: SuperTabState, target: Agent, now: number): MessageDraft | null {// An older Swarm without stored projects is one synthesized project. It keeps no report progress (noteProjectReports),// so its Lead is woken only for lost work (liveness.ts), which replaced the wake-up for workers down two hours.diff --git a/backend/src/superTabs/store.ts b/backend/src/superTabs/store.tsindex 7f7073cd9..a7142f17b 100644--- a/backend/src/superTabs/store.ts+++ b/backend/src/superTabs/store.ts@@ -19,7 +19,7 @@ import { logger } from '../utils/logger.js'import { canReadAgent, canReadGroup, canWatchAgent, groupProject, ledProject, projectOf, projectsOf, agentProjectId, readConversation, roleVersion, skillModeOf, watchingNarrowed, type ProjectVisibility } from './projects.js'import { bindSession, makeProjectPrivate } from './sessionScope.js'import { confidentialSessions, otherRegistrations, recordConfidential } from './confidential.js'-import { answersRequest, dirtyGroups, noteProjectReports, projectUpdateRequest } from './projectUpdates.js'+import { answersRequest, dirtyGroups, noteProjectReports, projectUpdateRequest, UNANSWERED_REQUEST_MS } from './projectUpdates.js'import { digestDue, digestMessageId, digestRequest, digestSince } from './digest.js'import { judgedMachines, loseTasks, sweepLiveness, SWEEP_EVERY_MS } from './liveness.js'import { archivable, archiveLine, stopIdleWorkers, stoppedMachines } from './tidy.js'@@ -2013,9 +2013,10 @@ export class SuperTabStore {let woken = falseif (update) {const progress = groupProject(state, conversation(state, update.conversationId)).progress!+ const received = this.now() - (progress.requestedAt ?? 0) < UNANSWERED_REQUEST_MS ? ['delivered'] : []const pending = progress.requestMessageId? await tx.superTabDelivery.findFirst({ where: { tabId, agentId, messageId: progress.requestMessageId,- status: { in: ['queued', 'claimed', 'uncertain', 'delivered'] } } })+ status: { in: ['queued', 'claimed', 'uncertain', ...received] } } }): nullif (!pending) {progress.requested = { ...progress.requested, ...update.source!.through as Record<string, number> }