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
Merge batch 11-06 train-0819: #3389 (#3394)
harness-for-autonomous[bot]1a35cfacd593
diff --git a/backend/src/superTabs/model.ts b/backend/src/superTabs/model.tsindex e036b2218..9919c74d7 100644--- a/backend/src/superTabs/model.ts+++ b/backend/src/superTabs/model.ts@@ -421,6 +421,10 @@ export interface Conversation {* reaching the coordinator in another chat of the project (parts/commit.ts). The built-in wake asks the coordinator to save* what it was taught only after one (pmSchedule.ts; task #3022). Absent until then. */heardAt?: number+ /** When a person last talked with each agent here, by agent id (parts/commit.ts): `person`, their last message that reached+ * it; `answer`, its own post to people after that one. An agent a person is chatting with is never idle (tidy.ts idleSince,+ * task #3816). Ids and times only, the last hour; hidden from readers. Absent until a person talks with an agent here. */+ talkedAt?: Record<string, { person: number; answer?: number }>/** Linked GitHub pull requests, including links older than the latest message page. Absent in older snapshots. */pullRequestUrls?: string[]/** The pull requests its own code is in, which GitHub's push read covers for its Team-written mark (teamWritten.ts, task@@ -1152,7 +1156,7 @@ export function visibleState(state: SuperTabState, actor: Actor, now = Date.now(// A read never hands out the cleanup records it just applied (read/hostRows.ts delivers them to the machine's host).delete visible.machineCleanupsdelete visible.parkedConversations- for (const group of visible.conversations) delete group.chatLimits+ for (const group of visible.conversations) { delete group.chatLimits; delete group.talkedAt }numberConversations(visible)delete visible.retiredConversationNumberdelete visible.groupCounterdiff --git a/backend/src/superTabs/parts/commit.ts b/backend/src/superTabs/parts/commit.tsindex d0a5f0766..cc5af061a 100644--- a/backend/src/superTabs/parts/commit.ts+++ b/backend/src/superTabs/parts/commit.ts@@ -101,6 +101,25 @@ function toCoordinator(state: SuperTabState, group: Conversation, message: Messareturn !!coordinator && message.recipients.includes(coordinator)}+/** How long a chat remembers that a person talked with an agent there: well past the 15 minutes an idle agent waits. */+export const TALKED_KEEP_MS = 60 * 60_000++/** Who a person talked with in [group] (task #3816): each agent a person's message reaches (`person`), and that agent's first+ * post to people after it (`answer`): a post to no agent, once per person's message, so an agent never keeps itself or another+ * agent from idling (review of #3389). Who wrote and whom it reached, never the words; a system row or notice marks nobody.+ * Entries older than TALKED_KEEP_MS go first, before this message is read, so an old one never comes back. */+function markTalked(group: Conversation, message: MessageDraft, now: number): void {+ if (message.source || !group.talkedAt && message.author.kind !== 'person') return+ const talked = Object.fromEntries(Object.entries(group.talkedAt ?? {})+ .filter(([, at]) => now - Math.max(at.person, at.answer ?? 0) <= TALKED_KEEP_MS))+ if (message.author.kind === 'person') for (const id of message.recipients) talked[id] = { person: now }+ else if (message.author.kind === 'agent' && !message.recipients.length) {+ const entry = talked[message.author.id]+ if (entry && (entry.answer === undefined || entry.answer < entry.person)) talked[message.author.id] = { ...entry, answer: now }+ }+ if (group.talkedAt || Object.keys(talked).length) group.talkedAt = talked+}+/*** Numbers each message in its conversation (design section 1.1 D4): the conversation's counter moves by one per message, in* draft order. A shown message is the conversation's latest and wakes a dormant one; an agent-only notice is numbered but@@ -120,6 +139,7 @@ export function numberMessages(state: SuperTabState, messages: MessageDraft[], nif (message.author.kind === 'person' && !message.source) group.lastPersonSequence = sequence}if (toCoordinator(state, group, message)) group.heardAt = now+ markTalked(group, message, now)group.lastActivityAt = new Date(now).toISOString()delete group.dormant}diff --git a/backend/src/superTabs/parts/light.test.ts b/backend/src/superTabs/parts/light.test.tsindex 6d06b1326..5c4e72ef3 100644--- a/backend/src/superTabs/parts/light.test.ts+++ b/backend/src/superTabs/parts/light.test.ts@@ -83,6 +83,7 @@ const conversation: Required<Conversation> = {step: 'Review',stepIds: [],stepUp: { attempt: 2, floor: 2, reason: 'r', at: 1, carry: '' },+ talkedAt: { w: { person: 1, answer: 2 } },task: { goal: '', changes: '', constraints: '', owns: [] },teamWritten: true,teamWrittenBy: { kind: 'assigned' },diff --git a/backend/src/superTabs/parts/light.ts b/backend/src/superTabs/parts/light.tsindex 00417521e..626130572 100644--- a/backend/src/superTabs/parts/light.ts+++ b/backend/src/superTabs/parts/light.ts@@ -105,6 +105,7 @@ export const GROUP_FIELDS = {'step','stepIds','stepUp',+ 'talkedAt','teamWritten','teamWrittenBy',],diff --git a/backend/src/superTabs/parts/talked.test.ts b/backend/src/superTabs/parts/talked.test.tsnew file mode 100644index 000000000..b11c654fe--- /dev/null+++ b/backend/src/superTabs/parts/talked.test.ts@@ -0,0 +1,65 @@+import { describe, expect, it } from 'vitest'+import type { Conversation, MessageDraft, SuperTabState } from '../model.js'+import { numberMessages, TALKED_KEEP_MS } from './commit.js'++// Task #3816 (hieule, 11-06): an agent a person is chatting with is never idle. Who talked with whom is counted from who+// wrote and whom it reached, never from the words, on the chat written to (as heard.test.ts counts the coordinator's).+describe('when a person last talked with an agent in a chat', () => {+ const person: MessageDraft['author'] = { kind: 'person', id: 'owner', name: 'owner', membershipGeneration: 'g' }+ const as = (id: string): MessageDraft['author'] => ({ kind: 'agent', id, name: id, membershipGeneration: 'g' })+ const draft = (id: string, author: MessageDraft['author'], extra: Partial<MessageDraft> = {}): MessageDraft =>+ ({ id, conversationId: 'chat', author, text: id, replyTo: null, recipients: [], ...extra })+ const swarm = (): SuperTabState => ({ version: 1, id: 'tab', name: 'Swarm', ownerId: 'owner', environment: 'prod', paused: false,+ invitations: [], people: [], agents: [], conversations: [{ id: 'chat', projectId: 'p1', title: 'Chat', leadId: 'pm',+ agentIds: ['pm', 'eng', 'other'], archived: false, brief: '', checks: [], assignment: null, lastMessageSequence: 0 } as Conversation],+ projects: [{ id: 'p1', name: 'lamp', ownerId: 'owner', leadConversationId: 'lead', visibility: 'public', members: [], updateMinutes: 5 }] } as unknown as SuperTabState)+ const chat = (state: SuperTabState) => state.conversations[0]!++ it('marks each agent a person\'s message reaches, then that agent\'s own answers in the same chat', () => {+ const state = swarm()+ numberMessages(state, [draft('p1', person, { recipients: ['eng'] })], 10)+ expect(chat(state).talkedAt).toEqual({ eng: { person: 10 } })+ numberMessages(state, [draft('a1', as('eng'))], 20)+ expect(chat(state).talkedAt).toEqual({ eng: { person: 10, answer: 20 } })+ })++ // Review of #3389: one person's message once made every later post of that agent here count, its posts to other agents too,+ // so two agents talking kept each other from idling for good.+ it('counts one answer per person\'s message, and never a post to an agent', () => {+ const state = swarm()+ numberMessages(state, [draft('p1', person, { recipients: ['eng'] })], 10)+ numberMessages(state, [draft('a1', as('eng'), { recipients: ['other'] })], 20)+ expect(chat(state).talkedAt).toEqual({ eng: { person: 10 } })+ numberMessages(state, [draft('a2', as('eng'))], 30)+ numberMessages(state, [draft('a3', as('eng'))], 40)+ expect(chat(state).talkedAt).toEqual({ eng: { person: 10, answer: 30 } })+ numberMessages(state, [draft('p2', person, { recipients: ['eng'] })], 50)+ numberMessages(state, [draft('a4', as('eng'))], 60)+ expect(chat(state).talkedAt).toEqual({ eng: { person: 50, answer: 60 } })+ })++ it('never brings back an entry older than an hour: it is dropped before the post is read', () => {+ const state = swarm()+ numberMessages(state, [draft('p1', person, { recipients: ['eng'] })], 10)+ numberMessages(state, [draft('a1', as('eng'))], 10 + TALKED_KEEP_MS + 1)+ expect(chat(state).talkedAt).toEqual({})+ })++ it('marks nobody for a person\'s message that reaches no agent, an agent nobody talked with, a system row or a notice', () => {+ const state = swarm()+ numberMessages(state, [+ draft('p1', person),+ draft('a1', as('other')),+ draft('s1', person, { source: { kind: 'system' }, recipients: ['eng'] }),+ draft('n1', as('pm'), { source: { kind: 'agent-only' }, recipients: ['eng'] }),+ ], 30)+ expect(chat(state).talkedAt).toBeUndefined()+ })++ it('keeps only the last hour, so the record stays small', () => {+ const state = swarm()+ numberMessages(state, [draft('p1', person, { recipients: ['eng'] })], 10)+ numberMessages(state, [draft('p2', person, { recipients: ['pm'] })], 10 + TALKED_KEEP_MS + 1)+ expect(chat(state).talkedAt).toEqual({ pm: { person: 10 + TALKED_KEEP_MS + 1 } })+ })+})diff --git a/backend/src/superTabs/read/contract.ts b/backend/src/superTabs/read/contract.tsindex 417ca1f25..5a55b93c6 100644--- a/backend/src/superTabs/read/contract.ts+++ b/backend/src/superTabs/read/contract.ts@@ -37,7 +37,7 @@ export type AgentView = Omit<Agent, 'downNamed' | 'downSince' | 'limitedUntil' |export interface Audience { people: Array<{ id: string; generation: string }> }/** A conversation with its own message counter (`lastMessageSequence` and message sequences compare within one group).* `dormant` is set only on a dormant group fetched on demand; `audience` only on a private conversation. */-export type GroupView = Omit<Conversation, 'chatLimits' | 'messageSeq' | 'reportSeq' | 'dormant' | 'lastActivityAt' | 'audience' | 'ledger' | 'proposals'> & {+export type GroupView = Omit<Conversation, 'chatLimits' | 'talkedAt' | 'messageSeq' | 'reportSeq' | 'dormant' | 'lastActivityAt' | 'audience' | 'ledger' | 'proposals'> & {/** A task's lane, as the crew dispatch hands it out (dispatch.ts laneOf: its PM's, else its owned paths'), null when no* lane owns its paths; absent on a chat or a step. From the group alone, so a change read's changed tasks keep every lane's* count whole on the reader's side (task #3400). Absent from an older backend. */diff --git a/backend/src/superTabs/read/views.ts b/backend/src/superTabs/read/views.tsindex 768250dc2..02372ca35 100644--- a/backend/src/superTabs/read/views.ts+++ b/backend/src/superTabs/read/views.ts@@ -69,7 +69,7 @@ export const envelope = <T>(part: Pick<Part, 'key' | 'version' | 'changedAt'>, d/** A group as readers get it: its message counter, a dormant flag only when dormant, never the store's bookkeeping or the* leaderboard's (the leaderboard read sums it), except when it shipped. */export function groupView(group: Conversation, seenMachines: ReadonlySet<string>): GroupView {- const { messageSeq, reportSeq: _report, lastActivityAt: _activity, ledger, proposals: _proposals, owed: _owed, answered: _answered, chatLimits: _chatLimits, pulse: _pulse, dormant, audience, ...rest } = withSeenRequirement(group, seenMachines)+ const { messageSeq, reportSeq: _report, lastActivityAt: _activity, ledger, proposals: _proposals, owed: _owed, answered: _answered, chatLimits: _chatLimits, talkedAt: _talkedAt, pulse: _pulse, dormant, audience, ...rest } = withSeenRequirement(group, seenMachines)// A Buddy chat names its owner instead of an audience: an app from before Buddies takes a private chat of the reader// alone for their Chat with PM, and would send what they write for the PM to their Buddy instead (buddies.ts).const readers = isBuddyChat(group) ? { buddyOwnerId: audience!.people[0]!.id } : audience ? { audience } : {}diff --git a/backend/src/superTabs/tidy.test.ts b/backend/src/superTabs/tidy.test.tsindex 2e239d148..0d5ff823f 100644--- a/backend/src/superTabs/tidy.test.ts+++ b/backend/src/superTabs/tidy.test.ts@@ -116,6 +116,28 @@ describe('idle agents', () => {// Swarm autonomous-harness, 2026-10-29: an agent started by hand in a busy chat never got a task, and every message there// kept it idle. Messages in a group without active work are about others' work: it is idle from its start.+ // Task #3816 (hieule, 11-06): two agents he was chatting with in his panel dropped to "Kept (closed)" every 5 to 10+ // minutes. An agent the Swarm started that never had a task was idle from its start alone: a person talking with it never+ // renewed it.+ it('never keeps or stops an agent a person talked with in the last 15 minutes, and still does one nobody talked to', () => {+ const started = { creationId: 'c', sessionId: 's', createdAt: iso(START - MINUTE) }+ const talked = worker({ startedSession: started })+ const quiet = worker({ id: 'q', harnessId: 'hq', displayName: 'Quinn', startedSession: started })+ const reviewer = worker({ id: 'r', harnessId: 'hr', displayName: 'Ash', roleName: 'Reviewer', startedSession: started })+ const chat = group({ id: 'g2', agentIds: ['w', 'q', 'r'], assignment: null, talkedAt: { w: { person: at - 6 * MINUTE, answer: at - 5 * MINUTE }, r: { person: at - 5 * MINUTE } } })+ const state = swarm({ agents: [talked, quiet, reviewer], groups: [chat] })+ const agentOf = (id: string) => state.agents.find(a => a.id === id)!+ const rows = idleNotices(state, 'lead', at, new Set())+ expect(rows.map(row => (row.source as { agentId: string }).agentId)).toEqual(['q'])+ expect(agentOf('q').workDecision).toBe('stop')+ expect(agentOf('w').workDecision).toBeUndefined()+ expect(agentOf('r').workDecision).toBeUndefined()+ // Fifteen minutes after the person's last word, it is idle like any other.+ idleNotices(state, 'lead', at + 10 * MINUTE, new Set())+ expect(agentOf('w').workDecision).toBe('stop')+ expect(agentOf('r').workDecision).toBe('keep')+ })+it('tells of an agent that never had a task 15 minutes after its start, however busy a finished group it sits in is', () => {const chatty = group({ assignment: done({ agentId: 'other' }), agentIds: ['L', 'other', 'w'], lastActivityAt: iso(at - MINUTE) })expect(idleNotices(swarm({ groups: [chatty] }), 'lead', at, new Set())).toEqual([expect.objectContaining({ source: { kind: 'idle', agentId: 'w' } })])diff --git a/backend/src/superTabs/tidy.ts b/backend/src/superTabs/tidy.tsindex 37fec49d9..a55ee0262 100644--- a/backend/src/superTabs/tidy.ts+++ b/backend/src/superTabs/tidy.ts@@ -29,10 +29,12 @@ export const groupsOf = (state: SuperTabState, target: Agent): Conversation[] =>* groups. An agent the Swarm started that never had an assignment (no task of its own, never lost one) only sits in its* groups, whose messages are about others' work: it is idle from its start or keep (Swarm autonomous-harness, 2026-10-29:* one sat idle 18+ minutes, its time renewed by every message in a busy chat). One a person added by hand has no start of- * record, so its groups' messages count, from the one it joined in. Undefined when nothing tells when. */+ * record, so its groups' messages count, from the one it joined in. A person talking with it counts either way: an agent+ * a person is chatting with is never idle (hieule, 11-06, task #3816). Undefined when nothing tells when. */export function idleSince(target: Agent, groups: Conversation[]): number | undefined {const worked = !!target.lostTask || groups.some(g => g.assignment?.agentId === target.id) || !target.startedSession- const seen = [time(target.startedSession?.createdAt), target.keptAt, ...(worked ? groups : []).flatMap(g => [time(g.lastActivityAt),+ const seen = [time(target.startedSession?.createdAt), target.keptAt, ...groups.flatMap(g => [g.talkedAt?.[target.id]?.person, g.talkedAt?.[target.id]?.answer]),+ ...(worked ? groups : []).flatMap(g => [time(g.lastActivityAt),...g.assignment?.agentId === target.id ? [g.assignment.progressAt, g.assignment.lost?.at] : []])].filter((t): t is number => t !== undefined && Number.isFinite(t))return seen.length ? Math.max(...seen) : undefineddiff --git a/docs/plans/2026-11-06-chatting-not-idle-plan.md b/docs/plans/2026-11-06-chatting-not-idle-plan.mdnew file mode 100644index 000000000..efd66a624--- /dev/null+++ b/docs/plans/2026-11-06-chatting-not-idle-plan.md@@ -0,0 +1,41 @@+# An agent a person is chatting with is never idle: Implementation Plan++> Written by the project's Engineer by the writing-plans skill; implemented task by task, test first. The review step on+> the pull request is its one independent review.++**Goal:** An agent with no task that a person is talking with is never kept or stopped as idle (hieule, 11-06, task #3816).+One nobody talks to still is, after 15 minutes.++**Architecture:** When a message is numbered (`parts/commit.ts numberMessages`, where `heardAt` is set), its conversation+records, per agent, when a person last talked with it there (`Conversation.talkedAt`). A person's message stamps each agent+it reaches, and that agent's own later posts in the same chat stamp it too: its answers. It counts who wrote and whom the+message reached, never the words. `tidy.ts idleSince` adds the time, so a busy chat about others' work still renews nobody.+The map keeps one hour of entries and is hidden from every reader, like `chatLimits`.++**Tech Stack:** TypeScript, vitest.++**Spec:** task #3816's brief and Guide2's trace (tidy.ts idleNotices and idleSince).++## Global Constraints+- Idle stop still works for an agent nobody talks to. Crew rules are unchanged.+- No content is stored: agent ids and times only.++## Design+- growth: entries older than an hour drop on the chat's next write, so it holds at most the agents talked with in the last hour.+- concurrency: written in the message's own commit, on the conversation part that commit already writes.+- read cost: none new. The tidy pass already loads the groups it reads, and readers never get it.+- scale: one small map per active chat, so 10x chats means 10x small maps. The part size warns first.+- compatibility: an optional field. Old readers never see it, and an old part without it reads as "nobody talked".+- migration and rollback: none. Reverting ignores the field.+- audience: hidden from every view (read/contract.ts, read/views.ts, model.ts visibleState, parts/light.ts).+- identity: N/A because it records only which agent a message reached.+- failure: N/A because a missing entry falls back to today's rule (start or keep).+- platforms: backend only.++## Review Focus+- A person's message that reaches no agent, a system row or a notice: marks nobody.+- An agent posting in a busy chat nobody addressed it in: still idle from its start.+- A talked-to Reviewer or Tester: not kept while the chat goes on, and kept 15 minutes after.++### Task 1: record the talk (`parts/commit.ts`, `model.ts`); tested in `parts/talked.test.ts`+### Task 2: count it (`tidy.ts idleSince`); tested in `tidy.test.ts`; hide it from readers