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.

Integration tests hold for a reset after their own clock, not a time that has passed (#3914) (#3413)

harness-for-autonomous[bot]e1b13d20581d
diff --git a/backend/integration/holds.test-support.ts b/backend/integration/holds.test-support.ts
new file mode 100644
index 000000000..4fd727576
--- /dev/null
+++ b/backend/integration/holds.test-support.ts
@@ -0,0 +1,6 @@
+/**
+ * A hold that waits for a quota reset an hour after [now], the clock of the store the test writes through (heldReason.ts refuses
+ * a reset time that has passed). Task #3914: a fixed time, 2026-11-06T09:00Z, passed on the day and turned main's integration
+ * tests red; a time read off the test's own clock never expires before the test that sends it.
+ */
+export const quotaReset = (now = Date.now()) => ({ kind: 'reset' as const, what: 'quota' as const, at: new Date(now + 3_600_000).toISOString() })
diff --git a/backend/integration/superTabActivity.test.ts b/backend/integration/superTabActivity.test.ts
index 110e627a2..3f1caa523 100644
--- a/backend/integration/superTabActivity.test.ts
+++ b/backend/integration/superTabActivity.test.ts
@@ -31,6 +31,7 @@ import { fcmSender } from '../src/push/fcm.js'
import { registerPushDevice } from '../src/push/devices.js'
import { quietRepeats } from '../src/push/repeats.js'
import { NOW, outsider as outsiderActor, owner as ownerActor, peer as peerActor, swarm } from '../src/superTabs/read/fixture.test-support.js'
+import { quotaReset } from './holds.test-support.js'
// A fresh loopback replica set, created here. This suite never reads DATABASE_URL or an existing database.
let replica: MongoMemoryReplSet
@@ -453,7 +454,7 @@ describe('Phone push: who each push type reaches, and what it carries (task #324
const s = await scene()
const state = (await store.read(owner, s.tabId)).state as unknown as SuperTabState
const assignmentId = state.conversations.find(c => c.id === s.web)!.assignment!.id
- const notices = await pushed(() => run(s.tabId, { type: 'work.status', conversationId: s.web, assignmentId, status: 'needs_human', hold: { kind: 'reset', what: 'quota', at: '2026-11-06T09:00:00.000Z' },
+ const notices = await pushed(() => run(s.tabId, { type: 'work.status', conversationId: s.web, assignmentId, status: 'needs_human', hold: quotaReset(),
result: 'Ship it behind a flag?', ask: { personId: peer.sub, options: ['Behind a flag', 'To everyone'], recommended: 0, unblocks: 'The release' } } as Command,
owner, s.worker))
expect(notices.map(n => [n.personId, n.key.split(':')[0], n.title, n.link.includes('/decision/'), n.quiet === true]))
diff --git a/backend/integration/superTabBuddies.test.ts b/backend/integration/superTabBuddies.test.ts
index c4e005aac..33da42364 100644
--- a/backend/integration/superTabBuddies.test.ts
+++ b/backend/integration/superTabBuddies.test.ts
@@ -18,6 +18,7 @@ import type { Command } from '../src/superTabs/commands.js'
import { poolRows, rosterRows } from './hostRows.test-support.js'
import { SwarmReads } from '../src/superTabs/read/service.js'
import { beforeFirstWrite } from './interleave.test-support.js'
+import { quotaReset } from './holds.test-support.js'
// Buddies end to end through the store (buddies.ts): a person adds one on their own Swarm machine, its host starts it, they
// talk to it alone, and it sends their proposal to the PM. A fresh loopback replica set, created here.
@@ -256,7 +257,7 @@ describe('a Buddy through the store', () => {
configuration: config, lead: false })).result.agentId)
const assignmentId = String((await f.execute({ type: 'work.assign', conversationId: group, agentId: builder })).result.assignmentId)
await f.execute({ type: 'message.send', conversationId: group, text: 'Opened https://github.com/acme/app/pull/12', replyTo: null, recipientIds: [] }, owner, builder)
- await f.execute({ type: 'work.status', conversationId: group, assignmentId, status: 'needs_human', hold: { kind: 'reset', what: 'quota', at: '2026-11-06T09:00:00.000Z' }, result: 'Ship it behind a flag?' }, owner, builder)
+ await f.execute({ type: 'work.status', conversationId: group, assignmentId, status: 'needs_human', hold: quotaReset(), result: 'Ship it behind a flag?' }, owner, builder)
await f.execute({ type: 'decision.ask', conversationId: group, personId: peer.sub, questions: [{ question: 'Ship it behind a flag?',
options: ['Behind a flag', 'To everyone'], recommended: 0, unblocks: 'The release' }] }, owner, f.lead)
await f.execute({ type: 'decision.ask', conversationId: group, personId: owner.sub, questions: [{ question: 'Which week?',
diff --git a/backend/integration/superTabLeaderboard.test.ts b/backend/integration/superTabLeaderboard.test.ts
index 7c87e8c90..53dc8e9cf 100644
--- a/backend/integration/superTabLeaderboard.test.ts
+++ b/backend/integration/superTabLeaderboard.test.ts
@@ -17,6 +17,7 @@ import type { SuperTabState } from '../src/superTabs/model.js'
import { WEEK_MS, weekStart } from '../src/superTabs/leaderboard/week.js'
import { writeLegacySwarm } from '../scripts/swarm-parts/legacy.js'
import { NOW, outsider as outsiderActor, owner as ownerActor, peer as peerActor, swarm } from '../src/superTabs/read/fixture.test-support.js'
+import { quotaReset } from './holds.test-support.js'
// A fresh loopback replica set, created here. This suite never reads DATABASE_URL or an existing database.
let replica: MongoMemoryReplSet
@@ -66,7 +67,7 @@ async function scene(before?: (state: SuperTabState) => void) {
const worker = s.add('worker-harness', waiting)
s.run({ type: 'work.assign', conversationId: waiting, agentId: worker })
s.run({ type: 'work.status', conversationId: waiting, assignmentId: s.state.conversations.find(c => c.id === waiting)!.assignment!.id,
- status: 'needs_human', hold: { kind: 'reset', what: 'quota', at: '2026-11-06T09:00:00.000Z' }, result: 'Flag?' }, { kind: 'agent', agentId: worker, machineOwnerId: `${owner.sub}-machine` })
+ status: 'needs_human', hold: quotaReset(), result: 'Flag?' }, { kind: 'agent', agentId: worker, machineOwnerId: `${owner.sub}-machine` })
s.edit(state => {
const done = { id: 'done', agentId: worker, status: 'done' as const, result: PR, configuration: state.agents[0]!.configuration,
execution: { machineId: 'host', harnessId: 'h', machineOwnerId: owner.sub } }
diff --git a/backend/integration/superTabNoticeDigest.test.ts b/backend/integration/superTabNoticeDigest.test.ts
index e897391c8..f74c02c95 100644
--- a/backend/integration/superTabNoticeDigest.test.ts
+++ b/backend/integration/superTabNoticeDigest.test.ts
@@ -17,6 +17,7 @@ import { revokeNativeContexts } from '../src/superTabs/native.js'
import { stableId, type MessageDraft, type SuperTabState } from '../src/superTabs/model.js'
import { logger } from '../src/utils/logger.js'
import { plan, profiled, reads } from './plans.test-support.js'
+import { quotaReset } from './holds.test-support.js'
// Ken, 2026-11-02 (docs/plans/2026-11-02-pm-notice-digest-design.md): the server's routine notices to a project's coordinator
// go in one message at most every 5 minutes; what someone waits on still goes at once. A fresh loopback replica set, created here.
@@ -824,7 +825,7 @@ describe('a step\'s Stuck, skills notices and quiet alerts', () => {
reviewOf: orphan })).result.conversationId)
const reviewer = await f.add(step, 'test-host', 'Reviewer')
const assignmentId = String((await f.execute({ type: 'work.assign', conversationId: step, agentId: reviewer })).result.assignmentId)
- await f.execute({ type: 'work.status', conversationId: step, assignmentId, status: 'blocked', hold: { kind: 'reset', what: 'quota', at: '2026-11-06T09:00:00.000Z' }, result: 'Needs the owner\'s account' }, host, reviewer)
+ await f.execute({ type: 'work.status', conversationId: step, assignmentId, status: 'blocked', hold: quotaReset(f.clock.now), result: 'Needs the owner\'s account' }, host, reviewer)
const row = await statusRow(f.tab, step, 'Stuck')
expect(row.recipientIds).toEqual([f.lead])
expect((await deliveryOf(row.id, f.lead)).status).toBe('queued')
diff --git a/backend/integration/superTabRead.test.ts b/backend/integration/superTabRead.test.ts
index 755959ac0..096dde250 100644
--- a/backend/integration/superTabRead.test.ts
+++ b/backend/integration/superTabRead.test.ts
@@ -29,6 +29,7 @@ import { writeLegacySwarm } from '../scripts/swarm-parts/legacy.js'
import { NOW, outsider as outsiderActor, owner as ownerActor, peer as peerActor, swarm } from '../src/superTabs/read/fixture.test-support.js'
import { PROFILE_STAGES, profileEntry, type ProfileEntry } from './bench/profile.js'
import { profiledReads } from './profiledReads.test-support.js'
+import { quotaReset } from './holds.test-support.js'
// A fresh loopback replica set, created here. This suite never reads DATABASE_URL or an existing database.
let replica: MongoMemoryReplSet
@@ -832,7 +833,7 @@ describe('decisions asked of one person (v2)', () => {
const s = await scene(withoutPm)
clock = Date.now()
const assignmentId = (await get(`/api/super-tabs/${s.tabId}/parts`, owner)).body.data.groups.find((g: { key: string }) => g.key === s.web).data.assignment.id
- const needs = await post(s.tabId, { type: 'work.status', conversationId: s.web, assignmentId, status: 'needs_human', hold: { kind: 'reset', what: 'quota', at: '2026-11-06T09:00:00.000Z' }, result: 'Ship to everyone?',
+ const needs = await post(s.tabId, { type: 'work.status', conversationId: s.web, assignmentId, status: 'needs_human', hold: quotaReset(), result: 'Ship to everyone?',
ask: { personId: peer.sub, options: ['Behind a flag', 'To everyone'], recommended: 0, unblocks: 'Turning it on' } }, owner, s.worker)
expect(needs.status, JSON.stringify(needs.body)).toBe(200)
const [open] = await decisions(s.tabId, peer)
@@ -930,7 +931,7 @@ describe('decisions asked of one person (v2)', () => {
const s = await scene(withoutPm)
clock = Date.now()
const assignmentId = (await get(`/api/super-tabs/${s.tabId}/parts`, owner)).body.data.groups.find((g: { key: string }) => g.key === s.web).data.assignment.id
- await post(s.tabId, { type: 'work.status', conversationId: s.web, assignmentId, status: 'needs_human', hold: { kind: 'reset', what: 'quota', at: '2026-11-06T09:00:00.000Z' }, result: 'Ship to everyone?',
+ await post(s.tabId, { type: 'work.status', conversationId: s.web, assignmentId, status: 'needs_human', hold: quotaReset(), result: 'Ship to everyone?',
ask: { personId: peer.sub, options: ['Behind a flag', 'To everyone'], recommended: 0, unblocks: 'Turning it on' } }, owner, s.worker)
await writeGroup(s.tabId, s.web, Date.now(), group => { group.dormant = true })
const first = (await get(`/api/super-tabs/${s.tabId}/parts`, peer)).body.data
@@ -1270,7 +1271,7 @@ describe('decisions asked of one person (v2)', () => {
projectId: 'lead', conversationId: s.web, assignmentId, personId: peer.sub, askerAgentId: s.worker, question: `Question ${i + 1}?`,
options: ['Behind a flag', 'To everyone'], recommended: 0, unblocks: 'The release', createdAt: new Date() })) })
const before = (await assignment()).leaseUntil as number
- const needs = await post(s.tabId, { type: 'work.status', conversationId: s.web, assignmentId, status: 'needs_human', hold: { kind: 'reset', what: 'quota', at: '2026-11-06T09:00:00.000Z' }, result: 'Ship how?',
+ const needs = await post(s.tabId, { type: 'work.status', conversationId: s.web, assignmentId, status: 'needs_human', hold: quotaReset(), result: 'Ship how?',
ask: { personId: peer.sub, options: ['Behind a flag', 'To everyone'], recommended: 0, unblocks: 'The release' } }, owner, s.worker)
expect(needs.status, JSON.stringify(needs.body)).toBe(200)
const notAsked = `Not asked peer: 20 decisions you asked them are still open, and at most 20 can be. Wait for answers before asking more.`
@@ -1282,7 +1283,7 @@ describe('decisions asked of one person (v2)', () => {
expect(notice).toMatchObject({ text: `Needs a human\n\nShip how?\n\n${notAsked}`, recipientIds: [s.lead] })
expect(await db.superTabDecision.count({ where: { tabId: s.tabId, askerAgentId: s.worker } })).toBe(20)
// A repeat of one still open is that decision again, so it is asked as before.
- const repeat = await post(s.tabId, { type: 'work.status', conversationId: s.web, assignmentId, status: 'needs_human', hold: { kind: 'reset', what: 'quota', at: '2026-11-06T09:00:00.000Z' }, result: 'Question 1?',
+ const repeat = await post(s.tabId, { type: 'work.status', conversationId: s.web, assignmentId, status: 'needs_human', hold: quotaReset(), result: 'Question 1?',
ask: { personId: peer.sub, options: ['Behind a flag', 'To everyone'], recommended: 0, unblocks: 'The release' } }, owner, s.worker)
expect(repeat.body.data.result.notAsked).toBeUndefined()
expect((await db.superTabMessage.findFirst({ where: { tabId: s.tabId, conversationId: s.web }, orderBy: { sequence: 'desc' } }))!.text)
@@ -1313,7 +1314,7 @@ describe('decisions asked of one person (v2)', () => {
const [other] = (await post(s.tabId, { type: 'decision.ask', conversationId: s.web, personId: peer.sub,
questions: [{ ...question('Ship how?'), options: ['Today', 'Next week'] }] }, owner, s.lead)).body.data.result.decisionIds as string[]
const assignmentId = (await get(`/api/super-tabs/${s.tabId}/parts`, owner)).body.data.groups.find((g: { key: string }) => g.key === s.web).data.assignment.id
- expect((await post(s.tabId, { type: 'work.status', conversationId: s.web, assignmentId, status: 'needs_human', hold: { kind: 'reset', what: 'quota', at: '2026-11-06T09:00:00.000Z' }, result: 'Ship how?',
+ expect((await post(s.tabId, { type: 'work.status', conversationId: s.web, assignmentId, status: 'needs_human', hold: quotaReset(), result: 'Ship how?',
ask: { personId: peer.sub, options: ['Behind a flag', 'To everyone'], recommended: 0, unblocks: 'The release' } }, owner, s.worker)).status).toBe(200)
const open = await decisions(s.tabId, peer)
// The worker's same question is the PM's crew need (crewNeeds.ts, task #3404): it opens nothing for peer.
diff --git a/backend/integration/superTabTeam.test.ts b/backend/integration/superTabTeam.test.ts
index ae8277648..4563b8c03 100644
--- a/backend/integration/superTabTeam.test.ts
+++ b/backend/integration/superTabTeam.test.ts
@@ -17,6 +17,7 @@ import { roleVersion } from '../src/superTabs/projects.js'
import { assignmentRows, poolRows, rosterRows } from './hostRows.test-support.js'
import { logger } from '../src/utils/logger.js'
import { MemoryAttachmentStore } from '../src/superTabs/attachments.js'
+import { quotaReset } from './holds.test-support.js'
// A team session (docs/plans/2026-10-24-swarm-team-account.md, Task 1) is the owner's account signed in on a second
// macOS user of the owner's Mac. In a Swarm it may host its own machine and speak as the agents running there, and
@@ -817,7 +818,7 @@ describe('a teammate\'s work and the machines that take it', () => {
await store.observeMachine(person, f.tab, 'personal-mac', reading(generation))
expect((await rosterRows(store, person, 'personal-mac')).find(r => r.tabId === f.tab && r.agent.id === old)).toMatchObject({ stopRequested: false })
expect(await assignmentRows(store, person, 'personal-mac')).toContainEqual({ tabId: f.tab, assignmentId: 'assigned-before', harnessId: 'before-release' })
- await run(f.tab, { type: 'work.status', conversationId: f.teamGroup, assignmentId: 'assigned-before', status: 'blocked', hold: { kind: 'reset', what: 'quota', at: '2026-11-06T09:00:00.000Z' }, result: 'Needs a token.' }, person, old)
+ await run(f.tab, { type: 'work.status', conversationId: f.teamGroup, assignmentId: 'assigned-before', status: 'blocked', hold: quotaReset(), result: 'Needs a token.' }, person, old)
await run(f.tab, { type: 'message.send', conversationId: f.teamGroup, text: 'Here it is.', replyTo: null, recipientIds: [old] })
expect(await db.superTabDelivery.count({ where: { tabId: f.tab, agentId: old } })).toBeGreaterThan(0)
await run(f.tab, { type: 'work.cancel', conversationId: f.teamGroup, assignmentId: 'assigned-before', reason: 'Moving it to the Team machine.' })
diff --git a/backend/integration/superTabs.test.ts b/backend/integration/superTabs.test.ts
index 8bbc97109..137f18f5c 100644
--- a/backend/integration/superTabs.test.ts
+++ b/backend/integration/superTabs.test.ts
@@ -37,6 +37,7 @@ import { beforeFirstWrite } from './interleave.test-support.js'
import { wantDefaultDigest } from './noDefaultDigest.test-support.js'
import { startMessageReachStats } from '../src/superTabs/messageReachStats.js'
import { plan as planOf, profiled, reads } from './plans.test-support.js'
+import { quotaReset } from './holds.test-support.js'
// A fresh loopback replica set, created here. This suite never reads DATABASE_URL or an existing database.
let replica: MongoMemoryReplSet
@@ -2453,9 +2454,9 @@ describe('Super Tabs on a real Mongo replica set', () => {
const assignmentId = (await run(tab, { type: 'work.assign', conversationId: group, agentId: worker })).result.assignmentId as string
const row = async () => (await rosterRows(store, host, 'test-host')).find(t => t.tabId === tab && t.agent.id === worker)!
expect(await row()).toMatchObject({ tabName: 'Pilot', attention: null })
- await run(tab, { type: 'work.status', conversationId: group, assignmentId, status: 'blocked', hold: { kind: 'reset', what: 'quota', at: '2026-11-06T09:00:00.000Z' }, result: 'No access to staging.' } as Command, host, worker)
+ await run(tab, { type: 'work.status', conversationId: group, assignmentId, status: 'blocked', hold: quotaReset(), result: 'No access to staging.' } as Command, host, worker)
expect((await row()).attention).toEqual({ assignmentId, status: 'blocked', result: 'No access to staging.' })
- await run(tab, { type: 'work.status', conversationId: group, assignmentId, status: 'needs_human', hold: { kind: 'reset', what: 'quota', at: '2026-11-06T09:00:00.000Z' }, result: null } as Command, host, worker)
+ await run(tab, { type: 'work.status', conversationId: group, assignmentId, status: 'needs_human', hold: quotaReset(), result: null } as Command, host, worker)
expect((await row()).attention).toEqual({ assignmentId, status: 'needs_human', result: null })
await run(tab, { type: 'work.status', conversationId: group, assignmentId, status: 'working', result: null } as Command, host, worker)
expect((await row()).attention).toBeNull()
@@ -4717,7 +4718,7 @@ describe('leaderboard credits written by the store (leaderboard/record.ts)', ()
const worker = (await run(tab, { type: 'agent.add', conversationId: group, machineId: 'test-host', harnessId: randomUUID(),
name: 'Builder', configuration: config, lead: false })).result.agentId as string
const assignmentId = (await run(tab, { type: 'work.assign', conversationId: group, agentId: worker })).result.assignmentId as string
- const ask = { type: 'work.status', conversationId: group, assignmentId, status: 'needs_human', hold: { kind: 'reset', what: 'quota', at: '2026-11-06T09:00:00.000Z' }, result: 'Ship how?',
+ const ask = { type: 'work.status', conversationId: group, assignmentId, status: 'needs_human', hold: quotaReset(), result: 'Ship how?',
ask: { personId: peer.sub, options: ['Behind a flag', 'To everyone'], recommended: 0, unblocks: 'The release' } } as Command
await run(tab, ask, host, worker)
await run(tab, { type: 'work.status', conversationId: group, assignmentId, status: 'working', result: null } as Command, host, worker)