Skip to content

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.

Merge batch 11-07 train-0053: #3349 (#3482)

harness-for-autonomous[bot]f01f38f81970
diff --git a/backend/src/superTabs/steps.ts b/backend/src/superTabs/steps.ts
index 1674f4a23..24dd6854e 100644
--- a/backend/src/superTabs/steps.ts
+++ b/backend/src/superTabs/steps.ts
@@ -76,8 +76,11 @@ export function taskOwner(state: SuperTabState, step: Conversation): string | nu
/** Whether [agentId] has held steps only, never a task, in the groups loaded, and a task one of them checks has not ended: a
* Reviewer or Tester the instructions keep while the work it checked is open, whatever its role is called, so its idle time
* is no news for the coordinator. Once each of those tasks is done or cancelled it is idle as any agent is, whether or not
- * the task is archived yet (Diego, 2026-11-02: one sat unseen under a finished, unarchived task, holding a slot and quota). */
+ * the task is archived yet (Diego, 2026-11-02: one sat unseen under a finished, unarchived task, holding a slot and quota).
+ * Open tasks are always loaded; a missing parent can be dormant and must not hold idle handling. Unlike taskEnded's
+ * archive guard, this decision needs no proof that an absent task ended (Diego, 2026-11-06). */
export const checksOpenWork = (state: SuperTabState, groups: readonly Conversation[], agentId: string): boolean => {
const held = groups.filter(g => g.assignment?.agentId === agentId)
- return held.length > 0 && held.every(isStep) && held.some(step => !taskEnded(state, step))
+ return held.length > 0 && held.every(isStep) && held.some(step => state.conversations.some(task =>
+ task.id === step.reviewOf && !['done', 'cancelled'].includes(task.assignment?.status ?? '')))
}
diff --git a/backend/src/superTabs/tidy.test.ts b/backend/src/superTabs/tidy.test.ts
index 0d5ff823f..27d4893ba 100644
--- a/backend/src/superTabs/tidy.test.ts
+++ b/backend/src/superTabs/tidy.test.ts
@@ -177,6 +177,48 @@ describe('idle agents', () => {
expect(idleNotices(state, 'lead', at + MINUTE, new Set())).toEqual([])
})
+ // The job is a Review step; legacy agents need not have a configured Reviewer role.
+ it('reports a step-only Reviewer idle once its done task sleeps', () => {
+ const review = group({ id: 'r1', reviewOf: 'g1', step: 'Review' })
+ const state = swarm({ groups: [review] })
+ state.tidy = false
+ const rows = idleNotices(state, 'lead', START + 25 * 60 * MINUTE, new Set())
+ expect(rows).toEqual([expect.objectContaining({ source: { kind: 'idle', agentId: 'w' } })])
+ expect(target(state).workDecision).toBe('stop')
+ expect(idleNotices(state, 'lead', START + 26 * 60 * MINUTE, new Set())).toEqual([])
+ })
+
+ it.each(['done', 'cancelled'] as const)('reports the same step-only agent idle with its %s task still loaded', status => {
+ const parent = group({ agentIds: ['L', 'other'], assignment: done({ agentId: 'other', status }) })
+ const state = swarm({ groups: [parent, group({ id: 'r1', reviewOf: 'g1', step: 'Review' })] })
+ expect(idleNotices(state, 'lead', START + 25 * 60 * MINUTE, new Set()))
+ .toEqual([expect.objectContaining({ source: { kind: 'idle', agentId: 'w' } })])
+ })
+
+ it.each(['Reviewer', 'Tester'])('keeps a configured %s once its finished step has an unloaded parent', roleName => {
+ const state = swarm({ agents: [worker({ roleName })], groups: [group({ id: 'r1', reviewOf: 'g1', step: 'Review' })] })
+ expect(idleNotices(state, 'lead', START + 25 * 60 * MINUTE, new Set())).toEqual([])
+ expect(target(state).workDecision).toBe('keep')
+ expect(target(state).releaseId).toBeUndefined()
+ })
+
+ it('keeps a step-only agent while any loaded parent is open', () => {
+ const state = swarm({ groups: [
+ group({ agentIds: ['L', 'other'], assignment: done({ agentId: 'other', status: 'review' }) }),
+ group({ id: 'r1', reviewOf: 'g1', step: 'Review' }),
+ group({ id: 'r2', reviewOf: 'sleeping', step: 'Test' }),
+ ] })
+ expect(idleNotices(state, 'lead', START + 25 * 60 * MINUTE, new Set())).toEqual([])
+ expect(target(state).workDecision).toBeUndefined()
+ })
+
+ it('keeps an Engineer with its own open task and a finished step whose parent is unloaded', () => {
+ const state = swarm({ groups: [group({ assignment: done({ status: 'review' }) }),
+ group({ id: 'r1', reviewOf: 'sleeping', step: 'Review' })] })
+ expect(idleNotices(state, 'lead', START + 25 * 60 * MINUTE, new Set())).toEqual([])
+ expect(target(state).workDecision).toBeUndefined()
+ })
+
it('does not stop anyone while paused, and does not close a manually shared session', () => {
const paused = swarm({ groups: [] })
paused.paused = true
@@ -199,6 +241,17 @@ describe('idle agents', () => {
describe('which finished groups archive', () => {
const quiet = START + ARCHIVE_QUIET_MS
+
+ it('never archives a finished step whose parent is open or absent from loaded state', () => {
+ const review = group({ id: 'r1', reviewOf: 'g1', step: 'Review' })
+ const state = swarm({ groups: [review] })
+ expect(archivable(state, review, START + 25 * 60 * MINUTE)).toBe(false)
+ const parent = group({ assignment: done({ agentId: 'other', status: 'working' }) })
+ state.conversations.push(parent)
+ expect(archivable(state, review, START + 25 * 60 * MINUTE)).toBe(false)
+ parent.assignment!.status = 'done'
+ expect(archivable(state, review, START + 25 * 60 * MINUTE)).toBe(true)
+ })
it('is a group whose task is done or cancelled and that has been quiet for 30 minutes', () => {
const state = swarm()
expect(archivable(state, state.conversations[1]!, quiet)).toBe(true)
diff --git a/docs/plans/2026-11-06-dormant-step-idle-plan.md b/docs/plans/2026-11-06-dormant-step-idle-plan.md
new file mode 100644
index 000000000..087315607
--- /dev/null
+++ b/docs/plans/2026-11-06-dormant-step-idle-plan.md
@@ -0,0 +1,44 @@
+# Dormant Step Idle Reporting Implementation Plan
+
+> Implement natively, task by task, with tests committed and observed failing before production code, followed by one independent PR review.
+
+**Goal:** Let a finished step's agent reach routine idle handling after its done task becomes dormant and drops out of loaded state.
+
+**Architecture:** Change only `checksOpenWork`'s idle decision to require a loaded, unfinished parent. Keep `taskEnded` fail-closed for archival and review closing. All open tasks are loaded; dormant finished tasks can be absent.
+
+**Tech Stack:** TypeScript, Vitest, existing Super Tab state model.
+
+**Spec:** Swarm task #3729, conversation `4a7374c7ebf53a5ea5692d79` (Diego's 11-06 report).
+
+## Global Constraints
+
+- The archive pass never takes a step whose task is open.
+- The Engineer's own idle reporting is unchanged.
+- Preserve routine idle decisions: role-configured Reviewers/Testers are kept; other non-crew idle agents receive host-confirmed stop and an informational row.
+- No schema, query, index, dependency or client changes.
+
+## Review Focus
+
+- Dormant finished parent absent after 25 hours: its finished step must not hold its agent busy.
+- Loaded done or cancelled parent: same idle outcome as the absent-parent case.
+- Loaded open parent: keep the step-only agent available and refuse to archive its steps.
+- Missing parent: permit idle handling but keep archive and review closing fail-closed.
+- Agents holding their own open task: retain current idle protection even if they also hold steps.
+
+## Task 1: Distinguish idle handling from archive safety
+
+**Files:**
+- Modify: `backend/src/superTabs/steps.ts`
+- Test: `backend/src/superTabs/tidy.test.ts`
+
+**Interfaces:**
+- Consumes: `SuperTabState.conversations` and loaded groups held by an agent.
+- Preserves: `checksOpenWork(state, groups, agentId): boolean`; `taskEnded` and all callers retain their signatures.
+
+- [x] Add `reports a step-only Reviewer idle once its done task sleeps`: a legacy role agent assigned only a finished Review step receives one idle row at 25 hours with the parent absent. Loaded done/cancelled controls produce the same row; tidying off does not suppress it.
+- [x] Add configured Reviewer/Tester controls: absent finished parent reaches routine keep handling without a stop.
+- [x] Add open-parent and missing-parent archive controls; own-task Engineer control remains unchanged.
+- [x] Commit tests and run `npm --prefix backend test -- src/superTabs/tidy.test.ts`; observe absent-parent cases fail because no idle decision occurs.
+- [x] In `checksOpenWork`, only consider a parent still open if it is loaded and `taskEnded` is false. Explain why idle can infer absence while archive cannot.
+- [x] Run tidy, steps, sweeps, liveness and commands unit tests plus backend typecheck. Full backend and four Super Tab integration shards run in ready PR CI.
+- [x] Commit production fix, push, record red/green evidence, mark ready and request the independent review through task status (handoff actions follow this commit).