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
Name the machine and owner when an agent waits on a screen question (#1540)
0xken155402a40f556b
diff --git a/backend/integration/superTabs.test.ts b/backend/integration/superTabs.test.tsindex 1817519d4..368af8002 100644--- a/backend/integration/superTabs.test.ts+++ b/backend/integration/superTabs.test.ts@@ -564,6 +564,37 @@ describe('Super Tabs on a real Mongo replica set', () => {expect((await store.messages(owner, tab, 'lead', {})).messages[1]!.author).toMatchObject({ displayName })})+ it('names the machine and its owner for a question on screen and sends the notice to the Lead, once', async () => {+ const { tab, lead } = await fixture()+ await db.user.update({ where: { id: host.sub }, data: { name: 'Huy' } })+ await db.machine.update({ where: { machineId: 'test-host' }, data: { name: 'MacBookPro2021' } })+ const worker = (await run(tab, { type: 'agent.add', conversationId: 'lead', machineId: 'test-host', harnessId: randomUUID(), name: 'Release builder',+ configuration: config, lead: false })).result.agentId as string+ const displayName = (await store.read(owner, tab)).state.agents.find(a => a.id === worker)!.displayName!+ await run(tab, { type: 'message.send', conversationId: 'lead', text: 'Please start.', replyTo: null, recipientIds: [worker] })+ const delivery = (await store.deliveries(host, tab, worker))[0]!+ await store.delivery(host, tab, worker, delivery.id, { type: 'claim', claimId: 'claim' })+ expect(await store.delivery(host, tab, worker, delivery.id, { type: 'hold', claimId: 'claim', reason: 'team_waiting_user' })).toEqual({ noticed: true })+ expect(await store.delivery(host, tab, worker, delivery.id, { type: 'hold', claimId: 'claim', reason: 'team_waiting_user' })).toEqual({ noticed: false })+ const notices = (await store.messages(owner, tab, 'lead', {})).messages.filter(m => m.source?.kind === 'delivery-hold')+ expect(notices).toHaveLength(1)+ expect(notices[0]).toMatchObject({ author: { id: worker }, recipientIds: [lead],+ text: expect.stringContaining(`${displayName} is on MacBookPro2021. Only Huy (owner of that machine) can answer it.`) })+ expect(notices[0]!.text).not.toContain(owner.email)+ // An owner with no name is left out, never replaced by an email address.+ await db.user.update({ where: { id: host.sub }, data: { name: null } })+ const second = await fixture()+ const quiet = (await run(second.tab, { type: 'agent.add', conversationId: 'lead', machineId: 'test-host', harnessId: randomUUID(), name: 'Quiet builder',+ configuration: config, lead: false })).result.agentId as string+ await run(second.tab, { type: 'message.send', conversationId: 'lead', text: 'Please start.', replyTo: null, recipientIds: [quiet] })+ const held = (await store.deliveries(host, second.tab, quiet))[0]!+ await store.delivery(host, second.tab, quiet, held.id, { type: 'claim', claimId: 'claim' })+ await store.delivery(host, second.tab, quiet, held.id, { type: 'hold', claimId: 'claim', reason: 'team_waiting_user' })+ const text = (await store.messages(owner, second.tab, 'lead', {})).messages.find(m => m.source?.kind === 'delivery-hold')!.text+ expect(text).toContain('is on MacBookPro2021.')+ expect(text).not.toMatch(/Only|@/)+ })+it('stores the current delivery hold and its first time even after the compatibility notice exists', async () => {const { tab, lead } = await fixture()let now = Date.now()diff --git a/backend/src/superTabs/holdNotice.test.ts b/backend/src/superTabs/holdNotice.test.tsindex 8bce61924..12f3650bc 100644--- a/backend/src/superTabs/holdNotice.test.ts+++ b/backend/src/superTabs/holdNotice.test.ts@@ -12,6 +12,17 @@ describe('holdNoticeText', () => {expect(holdNoticeText('Lead', 'team_waiting_draft')).toContain("There is unsent text in Lead's input box.")})+ it('names the machine and its owner only for a question on screen, and only what is known', () => {+ const host = { machine: 'MacBookPro2021', owner: 'Huy' }+ expect(holdNoticeText('Release builder', 'team_waiting_user', host))+ .toContain('Release builder is on MacBookPro2021. Only Huy (owner of that machine) can answer it. It stays queued')+ expect(holdNoticeText('Release builder', 'team_waiting_user', { machine: null, owner: 'Huy' }))+ .toContain('waiting. Release builder is showing a question or menu that needs a person to answer it. Only Huy (owner of the machine it runs on) can answer it.')+ expect(holdNoticeText('Release builder', 'team_waiting_user', { machine: null, owner: null })).not.toContain('owner')+ expect(holdNoticeText('Release builder', 'team_waiting_user')).not.toContain(' on ')+ expect(holdNoticeText('Release builder', 'team_waiting_draft', host)).not.toContain('Huy')+ })+it('rejects a reason it has no words for', () => {expect(holdReason.safeParse('team_waiting_busy').success).toBe(false)})diff --git a/backend/src/superTabs/holdNotice.ts b/backend/src/superTabs/holdNotice.tsindex 6494708d5..ca7630cdd 100644--- a/backend/src/superTabs/holdNotice.ts+++ b/backend/src/superTabs/holdNotice.ts@@ -16,6 +16,14 @@ const WHY: Record<HoldReason, (name: string) => string> = {team_waiting_control: name => `Someone else is using ${name}'s terminal right now.`,}+/** Where the waiting agent runs and who owns that machine: the only person who can reach the screen. Either may be unknown. */+export interface HoldHost { machine: string | null; owner: string | null }+/** The one notice a conversation gets about a delivery that has waited over 30 seconds (2026-10-21: minutes, unexplained). */-export const holdNoticeText = (agentName: string, reason: HoldReason): string =>- `A message for ${agentName} is waiting. ${WHY[reason](agentName)} It stays queued and goes in by itself as soon as that clears.`+export const holdNoticeText = (agentName: string, reason: HoldReason, host?: HoldHost): string => {+ // A question on screen is answered at that machine, so name it and its owner; never anyone who cannot reach it.+ const where = reason === 'team_waiting_user' && host+ ? `${host.machine ? ` ${agentName} is on ${host.machine}.` : ''}${host.owner ? ` Only ${host.owner} (owner of ${host.machine ? 'that' : 'the'} machine${host.machine ? '' : ' it runs on'}) can answer it.` : ''}`+ : ''+ return `A message for ${agentName} is waiting. ${WHY[reason](agentName)}${where} It stays queued and goes in by itself as soon as that clears.`+}diff --git a/backend/src/superTabs/store.ts b/backend/src/superTabs/store.tsindex 6a3a5ed8b..7e2faa05c 100644--- a/backend/src/superTabs/store.ts+++ b/backend/src/superTabs/store.ts@@ -910,13 +910,25 @@ export class SuperTabStore {const sender = author(state, { kind: 'agent', agentId: waiting.id, machineOwnerId: waiting.machineOwnerId })const revision = row.revision + 1if (!notice) group.lastMessageSequence = revision+ // The Lead gets it too, like a host-stop notice; a waiting Lead has no one above it to tell.+ const lead = group.leadId && group.leadId !== waiting.id && group.agentIds.includes(group.leadId) ? group.leadId : null+ const host = !notice && reason === 'team_waiting_user' ? await this.holdHost(tx, state, waiting) : undefinedawait tx.superTab.update({ where: { id: row.id, revision: row.revision }, data: { revision, state: json(state) } })- if (!notice) await this.writeMessages(tx, row.id, state, [{ id, conversationId: group.id, replyTo: null, recipients: [],+ if (!notice) await this.writeMessages(tx, row.id, state, [{ id, conversationId: group.id, replyTo: null, recipients: lead ? [lead] : [],source: { kind: 'delivery-hold', messageId: delivery.messageId, deliveryId: delivery.id, agentId: delivery.agentId },- text: holdNoticeText(sender.displayName ?? sender.name, reason), author: sender }], revision)+ text: holdNoticeText(sender.displayName ?? sender.name, reason, host), author: sender }], revision)return { noticed: !notice }}+ /** The machine's name and its owner's name for a hold notice; left out when unknown rather than guessed. */+ private async holdHost(tx: Transaction, state: SuperTabState, waiting: Agent) {+ const contributed = state.machines?.find(m => m.machineId === waiting.machineId)?.name+ const machine = contributed ?? (await tx.machine.findFirst({ where: { machineId: waiting.machineId, userId: waiting.machineOwnerId },+ select: { name: true, hostname: true } }).then(m => m?.name ?? m?.hostname ?? null))+ const owner = await tx.user.findUnique({ where: { id: waiting.machineOwnerId }, select: { name: true } })+ return { machine: machine?.trim() || null, owner: owner?.name?.trim() || null }+ }+/** Only the recorded execution host may attest that the actual session/attempt has stopped. */async stopped(user: AuthUser, tabId: string, assignmentId: string, receipt: string) {return transaction(this.db, async tx => {