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
Swarm: the dead legacyState is removed by itself after a release (DB roadmap 0.2) (#2174)
0xken152dc66b079c7b
diff --git a/backend/integration/superTabLegacyDrop.test.ts b/backend/integration/superTabLegacyDrop.test.tsindex f4f0a1c8c..fa981e294 100644--- a/backend/integration/superTabLegacyDrop.test.ts+++ b/backend/integration/superTabLegacyDrop.test.ts@@ -3,12 +3,14 @@ import { execFile } from 'node:child_process'import { promisify } from 'node:util'import { join } from 'node:path'import { tmpdir } from 'node:os'-import { afterAll, beforeAll, describe, expect, it } from 'vitest'+import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest'import { MongoMemoryReplSet } from 'mongodb-memory-server-core'import { PrismaClient } from '@prisma/client'import * as parts from '../src/superTabs/parts/index.js'import { migrateSwarm } from '../src/superTabs/migration/migrate.js'import { dropLegacyStates } from '../src/superTabs/migration/dropLegacy.js'+import { dropLegacyUntilDone, startLegacyDrop } from '../src/superTabs/migration/dropLegacyJob.js'+import { SuperTabStore } from '../src/superTabs/store.js'import { writeLegacySwarm } from '../scripts/swarm-parts/legacy.js'import { NOW, richSwarm } from '../src/superTabs/read/fixture.test-support.js'@@ -63,11 +65,24 @@ describe('removing the old state migrated Swarms keep (Stability 2.1)', () => {await legacySwarm()for (const apply of [false, true]) {- expect(await dropLegacyStates(db, { apply })).toEqual({ ok: false, swarms: 2, unmigrated: 1, kept: 1, keptBytes: OLD_STATE_BYTES, removed: 0, batches: 0, writeErrors: 0 })+ expect(await dropLegacyStates(db, { apply })).toEqual({ ok: false, swarms: 2, unmigrated: 1, kept: 0, keptBytes: 0, removed: 0, batches: 0, writeErrors: 0, done: false })}expect(await kept(migrated)).toEqual(OLD_STATE)})+ it('sums the kept old states only when it may remove them: a refused run reads no old state', async () => {+ await empty()+ await migratedSwarm()+ await legacySwarm()+ const commands: string[] = []+ const watching = new Proxy(db, { get: (target, key) => key === '$runCommandRaw'+ ? (command: object) => { commands.push(Object.keys(command)[0]!); return target.$runCommandRaw(command as never) }+ : Reflect.get(target, key, target) }) as PrismaClient++ expect(await dropLegacyStates(watching, { apply: true })).toMatchObject({ ok: false, kept: 0, keptBytes: 0 })+ expect(commands).toEqual(['count', 'count'])+ })+it('counts a Swarm whose row predates the format field as not migrated', async () => {await empty()await migratedSwarm()@@ -82,7 +97,7 @@ describe('removing the old state migrated Swarms keep (Stability 2.1)', () => {const [first, second] = [await migratedSwarm(), await migratedSwarm()]await db.superTab.create({ data: { id: `tab-${randomUUID()}`, ownerId: 'owner', autonomousEnv: 'prod', format: 2, state: { version: 2 } } })- expect(await dropLegacyStates(db)).toEqual({ ok: true, swarms: 3, unmigrated: 0, kept: 2, keptBytes: 2 * OLD_STATE_BYTES, removed: 0, batches: 0, writeErrors: 0 })+ expect(await dropLegacyStates(db)).toEqual({ ok: true, swarms: 3, unmigrated: 0, kept: 2, keptBytes: 2 * OLD_STATE_BYTES, removed: 0, batches: 0, writeErrors: 0, done: false })expect([await kept(first), await kept(second)]).toEqual([OLD_STATE, OLD_STATE])})@@ -93,7 +108,7 @@ describe('removing the old state migrated Swarms keep (Stability 2.1)', () => {await db.$runCommandRaw({ collMod: 'SuperTab', validator: { legacyState: { $exists: true } }, validationAction: 'error' })try {expect(await dropLegacyStates(db, { apply: true, batch: 1 })).toEqual({ ok: true, swarms: 2, unmigrated: 0, kept: 2, keptBytes: 2 * OLD_STATE_BYTES,- removed: 0, batches: 1, writeErrors: 1 })+ removed: 0, batches: 1, writeErrors: 1, done: false })} finally {await db.$runCommandRaw({ collMod: 'SuperTab', validator: {}, validationLevel: 'off' })}@@ -108,11 +123,154 @@ describe('removing the old state migrated Swarms keep (Stability 2.1)', () => {parts: await db.$transaction(tx => parts.loadAll(tx, id)) })))const before = await snapshot()- expect(await dropLegacyStates(db, { apply: true, batch: 2 })).toEqual({ ok: true, swarms: 3, unmigrated: 0, kept: 3, keptBytes: 3 * OLD_STATE_BYTES, removed: 3, batches: 2, writeErrors: 0 })+ expect(await dropLegacyStates(db, { apply: true, batch: 2 })).toEqual({ ok: true, swarms: 3, unmigrated: 0, kept: 3, keptBytes: 3 * OLD_STATE_BYTES, removed: 3, batches: 2, writeErrors: 0, done: true })expect(await db.$runCommandRaw({ count: 'SuperTab', query: { legacyState: { $exists: true } } })).toMatchObject({ n: 0 })expect(await Promise.all(ids.map(kept))).toEqual([null, null, null])expect(await snapshot()).toEqual(before)// Run again, it finds nothing left.- expect(await dropLegacyStates(db, { apply: true })).toEqual({ ok: true, swarms: 3, unmigrated: 0, kept: 0, keptBytes: 0, removed: 0, batches: 0, writeErrors: 0 })+ expect(await dropLegacyStates(db, { apply: true })).toEqual({ ok: true, swarms: 3, unmigrated: 0, kept: 0, keptBytes: 0, removed: 0, batches: 0, writeErrors: 0, done: true })+ })++ it('pauses after every batch, so a large backlog never holds the database for long', async () => {+ await empty()+ await Promise.all([migratedSwarm(), migratedSwarm(), migratedSwarm()])+ let pauses = 0++ const report = await dropLegacyStates(db, { apply: true, batch: 1, pause: async () => { pauses++ } })++ expect(report).toMatchObject({ removed: 3, batches: 3, done: true })+ expect(pauses).toBe(3)+ })++ it('does not call a refused run done, so a runner keeps trying', async () => {+ await empty()+ await migratedSwarm()+ await db.$runCommandRaw({ collMod: 'SuperTab', validator: { legacyState: { $exists: true } }, validationLevel: 'strict', validationAction: 'error' })+ try {+ expect(await dropLegacyStates(db, { apply: true })).toMatchObject({ writeErrors: 1, done: false })+ } finally {+ await db.$runCommandRaw({ collMod: 'SuperTab', validator: {}, validationLevel: 'off' })+ }+ }, 10_000)+})++describe('the automatic removal after a release', () => {+ const noWait = async () => {}++ it('removes every old state in small batches and stops, with nothing to remove left', async () => {+ await empty()+ const ids = [await migratedSwarm(), await migratedSwarm(), await migratedSwarm()]+ const logs: Array<Record<string, unknown>> = []++ const report = await dropLegacyUntilDone(db, { batch: 2, pause: noWait, wait: noWait, log: line => logs.push(line) })++ expect(report).toMatchObject({ removed: 3, batches: 2, done: true })+ expect(await Promise.all(ids.map(kept))).toEqual([null, null, null])+ // Counts and sizes only: nothing that names a Swarm.+ expect(logs).toEqual([expect.objectContaining({ removed: 3, kept: 3, done: true })])+ expect(JSON.stringify(logs)).not.toContain(ids[0])+ })++ it('does nothing and stops at once when no Swarm keeps an old state', async () => {+ await empty()+ await db.superTab.create({ data: { id: `tab-${randomUUID()}`, ownerId: 'owner', autonomousEnv: 'prod', format: 2, state: { version: 2 } } })+ let waits = 0++ expect(await dropLegacyUntilDone(db, { wait: async () => { waits++ } })).toMatchObject({ removed: 0, batches: 0, done: true })+ expect(waits).toBe(0)+ })++ it('waits while a Swarm is still in one row and removes once it is split, without ever removing before', async () => {+ await empty()+ const migrated = await migratedSwarm()+ const old = await legacySwarm()+ const seen: Array<unknown> = []++ const report = await dropLegacyUntilDone(db, { pause: noWait, wait: async () => {+ seen.push(await kept(migrated))+ expect((await migrateSwarm(db, old, { now: () => NOW })).ok).toBe(true)+ } })++ expect(seen).toEqual([OLD_STATE])+ expect(report).toMatchObject({ ok: true, done: true })+ // The Swarm migrated meanwhile keeps its own old state too, and loses it in the same run.+ expect([await kept(migrated), await kept(old)]).toEqual([null, null])+ })++ it('retries after the database throws, then finishes', async () => {+ await empty()+ const swarm = await migratedSwarm()+ let tries = 0+ const flaky = new Proxy(db, { get(target, key, receiver) {+ if (key === '$runCommandRaw' && tries++ === 0) return async () => { throw new Error('connection reset') }+ return Reflect.get(target, key, receiver)+ } })+ const logs: Array<Record<string, unknown>> = []++ expect(await dropLegacyUntilDone(flaky, { pause: noWait, wait: noWait, log: line => logs.push(line) })).toMatchObject({ removed: 1, done: true })+ expect(await kept(swarm)).toBeNull()+ expect(logs[0]).toEqual({ failed: 'connection reset' })+ })++ it('stops between runs when asked to', async () => {+ await empty()+ await migratedSwarm()+ await legacySwarm()+ const control = new AbortController()+ let waits = 0++ await dropLegacyUntilDone(db, { signal: control.signal, wait: async () => { if (++waits === 2) control.abort() } })++ expect(waits).toBe(2)+ })++ it('stops after the write in flight when asked, leaving the rest alone', async () => {+ await empty()+ const [first, second] = [await migratedSwarm(), await migratedSwarm()]+ const control = new AbortController()++ const report = await dropLegacyUntilDone(db, { batch: 1, signal: control.signal, pause: async () => control.abort(), wait: async () => {} })++ expect(report).toMatchObject({ removed: 1, batches: 1, done: false })+ expect([await kept(first), await kept(second)].filter(state => state === null)).toHaveLength(1)+ })++ it('runs by itself once started', async () => {+ await empty()+ const ids = [await migratedSwarm(), await migratedSwarm()]++ const stop = startLegacyDrop(db, 0)+ try {+ await vi.waitFor(async () => expect(await Promise.all(ids.map(kept))).toEqual([null, null]), { timeout: 10_000 })+ } finally {+ stop()+ }+ })++ it('stops in the middle of a backlog when asked, leaving the rest alone', async () => {+ await empty()+ const ids = [await migratedSwarm(), await migratedSwarm(), await migratedSwarm()]+ const removed = async () => (await Promise.all(ids.map(kept))).filter(state => state === null).length++ const stop = startLegacyDrop(db, 0, 1)+ await vi.waitFor(async () => expect(await removed()).toBeGreaterThan(0), { timeout: 10_000 })+ stop()+ // The pause between writes is cut short by the stop, and no further write follows it.+ const atStop = await removed()+ await new Promise(resolve => setTimeout(resolve, 1_000))++ expect(atStop).toBeLessThan(3)+ expect(await removed()).toBeLessThanOrEqual(atStop + 1)+ expect(await removed()).toBeLessThan(3)+ })++ it('never loads a kept old state into the rows the store and the host poll read', async () => {+ await empty()+ const tabId = await migratedSwarm()+ const user = { sub: (await db.superTab.findUniqueOrThrow({ where: { id: tabId } })).ownerId, email: '[email protected]', autonomousEnv: 'prod', role: 'user' } as const++ const row = await new SuperTabStore(db).row(db, user, tabId)++ expect(Object.keys(row).sort()).toEqual(['format', 'id', 'ownerId', 'revision'])})})diff --git a/backend/integration/superTabRead.test.ts b/backend/integration/superTabRead.test.tsindex 9d6cda6a7..5088aa309 100644--- a/backend/integration/superTabRead.test.ts+++ b/backend/integration/superTabRead.test.ts@@ -1156,6 +1156,32 @@ describe('what a read costs the database (group 3b)', () => {// Every host reads each second (a production backend went to 5 pods on it, 2026-10-27): a Swarm with no change for it// must not cost the newest-change aggregate, seven groupBy over all its parts.+ it('the host poll reads a Swarm that keeps an old state without ever loading that state', async () => {+ const machineId = `m-${randomUUID().slice(0, 8)}`+ await db.machine.create({ data: { machineId, userId: owner.sub, apiKey: 'fixture-only', managerId: 'fixture', autonomousEnv: 'prod', authMode: 'remote' } })+ const s = await scene(f => { f.contribute(machineId, 'swarm') }, machineId)+ const padding = 'old-state-'.repeat(2_000)+ await db.superTab.update({ where: { id: s.tabId }, data: { legacyState: { padding } } })+ const reads: Array<{ operation: string; select: Record<string, unknown> | undefined }> = []+ const client = db.$extends({ query: { $allModels: { async $allOperations({ model, operation, args, query }) {+ if (model === 'SuperTab') reads.push({ operation, select: (args as { select?: Record<string, unknown> }).select })+ return query(args)+ } } } }) as unknown as PrismaClient+ const hosts = new HostReads(new SuperTabStore(client), { now: () => clock })+ clock = Date.now()++ const first = await hosts.changes(owner, machineId, { full: true })+ clock = Date.now()+ const idle = await hosts.changes(owner, machineId, { cursor: first.cursor })++ expect(first.tabs).toHaveLength(1)+ expect(JSON.stringify([first, idle])).not.toContain('old-state-')+ // The poll reads the Swarm's row for its list and its owner, each time by naming the fields: none is the old state.+ expect(reads.length).toBeGreaterThan(0)+ for (const read of reads) expect(read.select, read.operation).toBeDefined()+ for (const read of reads) expect(read.select).not.toHaveProperty('legacyState')+ })+it('the host form asks for the newest change only of the Swarms it answers for', async () => {const machineId = `m-${randomUUID().slice(0, 8)}`await db.machine.create({ data: { machineId, userId: owner.sub, apiKey: 'fixture-only', managerId: 'fixture', autonomousEnv: 'prod', authMode: 'remote' } })diff --git a/backend/src/superTabs/migration/dropLegacy.ts b/backend/src/superTabs/migration/dropLegacy.tsindex cf97ee2e9..fb8fab695 100644--- a/backend/src/superTabs/migration/dropLegacy.ts+++ b/backend/src/superTabs/migration/dropLegacy.ts@@ -10,12 +10,19 @@ export interface DropOptions {apply?: boolean/** Swarms per write. */batch?: number+ /** Awaited after each write, so a large backlog never holds the database for long. */+ pause?: () => Promise<void>+ /** Checked before each write: an aborted run returns what it has done, not done. */+ signal?: AbortSignal}-/** Counts and sizes only: nothing that names a Swarm or shows its content. */+/** Counts and sizes only: nothing that names a Swarm or shows its content. `kept` and `keptBytes` are 0 when `ok` is false: they are+ * not read then. */export interface DropReport {ok: boolean; swarms: number; unmigrated: number; kept: number; keptBytes: number; removed: number; batches: number/** Removals the database refused. The run stops at the first batch with one, or that removes nothing. */writeErrors: number+ /** No Swarm keeps an old state any more: set when the run found none, or removed the last ones. */+ done: boolean}export const DEFAULT_BATCH = 100@@ -28,16 +35,18 @@ async function count(db: PrismaClient, query: object): Promise<number> {return Number((await db.$runCommandRaw({ count: 'SuperTab', query }) as { n: unknown }).n)}-export async function dropLegacyStates(db: PrismaClient, { apply = false, batch = DEFAULT_BATCH }: DropOptions = {}): Promise<DropReport> {+export async function dropLegacyStates(db: PrismaClient, { apply = false, batch = DEFAULT_BATCH, pause, signal }: DropOptions = {}): Promise<DropReport> {const [swarms, unmigrated] = [await count(db, {}), await count(db, UNMIGRATED)]+ // While a Swarm is still in one row nothing is removed, so the old states are not read (summing them reads every one whole).+ if (unmigrated) return { ok: false, swarms, unmigrated, kept: 0, keptBytes: 0, removed: 0, batches: 0, writeErrors: 0, done: false }const [size] = (await db.$runCommandRaw({ aggregate: 'SuperTab', cursor: {}, pipeline: [{ $match: KEPT },{ $group: { _id: null, kept: { $sum: 1 }, keptBytes: { $sum: { $bsonSize: '$legacyState' } } } }] }) as unknown as Batch<{ kept: number; keptBytes: number }>).cursor.firstBatch- const report = { ok: unmigrated === 0, swarms, unmigrated, kept: size?.kept ?? 0, keptBytes: size?.keptBytes ?? 0, removed: 0, batches: 0, writeErrors: 0 }- if (!report.ok || !apply) return report- for (;;) {+ const report = { ok: true, swarms, unmigrated, kept: size?.kept ?? 0, keptBytes: size?.keptBytes ?? 0, removed: 0, batches: 0, writeErrors: 0, done: !size?.kept }+ if (!apply) return report+ while (!signal?.aborted) {const ids = (await db.$runCommandRaw({ find: 'SuperTab', filter: KEPT, projection: { _id: 1 }, limit: batch }) as unknown as Batch<{ _id: string }>).cursor.firstBatch.map(row => row._id)- if (!ids.length) return report+ if (!ids.length) return { ...report, done: true }// Only rows still in parts: one rolled back meanwhile keeps whatever it holds.const updated = await db.$runCommandRaw({ update: 'SuperTab', updates: [{ q: { _id: { $in: ids }, ...KEPT }, u: { $unset: { legacyState: '' } }, multi: true }] }) as{ nModified: unknown; writeErrors?: unknown[] }@@ -47,11 +56,13 @@ export async function dropLegacyStates(db: PrismaClient, { apply = false, batchreport.batches++// The same rows would come back from the next find: a refused or empty batch would repeat for ever.if (!removed || updated.writeErrors?.length) return report+ await pause?.()}+ return report}/** `--apply` removes, and only with `--backup-confirmed`: removing cannot be undone without a backup. `--batch N`. */-export function dropOptions(argv: readonly string[]): Required<DropOptions> {+export function dropOptions(argv: readonly string[]): Required<Pick<DropOptions, 'apply' | 'batch'>> {const options = { apply: false, batch: DEFAULT_BATCH }let backupConfirmed = falsefor (let i = 0; i < argv.length; i++) {diff --git a/backend/src/superTabs/migration/dropLegacyJob.test.ts b/backend/src/superTabs/migration/dropLegacyJob.test.tsnew file mode 100644index 000000000..14d22ba73--- /dev/null+++ b/backend/src/superTabs/migration/dropLegacyJob.test.ts@@ -0,0 +1,34 @@+import { getEventListeners } from 'node:events'+import { afterEach, describe, expect, it, vi } from 'vitest'+import { sleeper } from './dropLegacyJob.js'++describe('the pause between writes', () => {+ afterEach(() => vi.useRealTimers())++ it('leaves no stop listener behind once its time is up, so a long backlog does not pile them up', async () => {+ vi.useFakeTimers()+ const control = new AbortController()+ const wait = sleeper(control.signal)++ for (let i = 0; i < 5; i++) {+ const done = wait(500)+ expect(getEventListeners(control.signal, 'abort')).toHaveLength(1)+ await vi.advanceTimersByTimeAsync(500)+ await done+ }++ expect(getEventListeners(control.signal, 'abort')).toHaveLength(0)+ })++ it('ends at once when stopped, and removes its listener', async () => {+ vi.useFakeTimers()+ const control = new AbortController()+ const done = sleeper(control.signal)(3_600_000)++ control.abort()+ await done++ expect(getEventListeners(control.signal, 'abort')).toHaveLength(0)+ expect(vi.getTimerCount()).toBe(0)+ })+})diff --git a/backend/src/superTabs/migration/dropLegacyJob.ts b/backend/src/superTabs/migration/dropLegacyJob.tsnew file mode 100644index 000000000..5a08841ae--- /dev/null+++ b/backend/src/superTabs/migration/dropLegacyJob.ts@@ -0,0 +1,59 @@+/**+ * Removes the dead old state of every migrated Swarm on its own after a release (`SuperTab.legacyState`; Database+ * optimization roadmap, phase 0). It runs in the singleton worker: a few Swarms per write with a pause between writes, waits+ * while any Swarm is still in one row, tries again after an error, and stops for good once none keeps an old state. A second+ * runner would do no harm: each write matches only rows that still keep one.+ */+import type { PrismaClient } from '@prisma/client'+import { logger } from '../../utils/logger.js'+import { dropLegacyStates, type DropReport } from './dropLegacy.js'++/** A busy Swarm's old state is about 1 MB: this bounds a write to a few megabytes. */+export const JOB_BATCH = 5+export const PAUSE_MS = 500+/** Between two tries while a Swarm waits for its split or the database fails. */+export const RETRY_MS = 3_600_000+/** Lets a starting worker finish its own startup first. */+export const START_DELAY_MS = 60_000++export interface JobOptions {+ batch?: number+ pause?: () => Promise<void>+ wait?: (ms: number) => Promise<void>+ /** Counts and sizes only, or the error text of a failed try. */+ log?: (line: Record<string, unknown>) => void+ signal?: AbortSignal+}++/** Waits `ms`, or until `signal` aborts; either way its timer and its stop listener are gone. */+export const sleeper = (signal?: AbortSignal) => (ms: number) => new Promise<void>(resolve => {+ const finish = () => { clearTimeout(timer); signal?.removeEventListener('abort', finish); resolve() }+ const timer = setTimeout(finish, ms)+ timer.unref()+ signal?.addEventListener('abort', finish, { once: true })+})++/** Tries until no Swarm keeps an old state, or `signal` aborts (then it returns the last report, or an empty one). */+export async function dropLegacyUntilDone(db: PrismaClient, { batch = JOB_BATCH, pause, wait = sleeper(), log = () => {}, signal }: JobOptions = {}): Promise<DropReport | null> {+ let report: DropReport | null = null+ while (!signal?.aborted) {+ try {+ report = await dropLegacyStates(db, { apply: true, batch, pause, signal })+ log({ ...report })+ if (report.done) return report+ } catch (error) {+ log({ failed: error instanceof Error ? error.message : String(error) })+ }+ await wait(RETRY_MS)+ }+ return report+}++/** Starts the removal in the background; the returned function stops it. */+export function startLegacyDrop(db: PrismaClient, delayMs = START_DELAY_MS, batch = JOB_BATCH): () => void {+ const control = new AbortController()+ const wait = sleeper(control.signal)+ void wait(delayMs).then(() => dropLegacyUntilDone(db, { batch, signal: control.signal, wait, pause: () => wait(PAUSE_MS),+ log: line => 'failed' in line ? logger.warn('[legacy-drop] failed', line) : logger.info('[legacy-drop] run', line) }))+ return () => control.abort()+}diff --git a/backend/src/worker.ts b/backend/src/worker.tsindex 963850fca..6f578294d 100644--- a/backend/src/worker.ts+++ b/backend/src/worker.ts@@ -16,6 +16,7 @@ import { ensurePlans } from './lib/db/seed.js'import { prisma } from './lib/prisma.js'import { releaseSchema } from './lib/db/schemaRelease.js'import { startSwarmSweeps } from './superTabs/sweeps.js'+import { startLegacyDrop } from './superTabs/migration/dropLegacyJob.js'import { startDeliverySettle } from './superTabs/deliverySettle.js'import { appPullRequests, markFinishedGroups, startSwarmArchive, unknownPullRequests } from './superTabs/archive.js'import { SuperTabStore } from './superTabs/store.js'@@ -54,6 +55,7 @@ async function start(): Promise<void> {await reconcileCommunityLikeCounts()let stopSweeps = (): void => {}+ let stopLegacyDrop = (): void => {}let stopArchive = (): void => {}let stopDeliveries = (): void => {}let stopReceiptSweep = (): void => {}@@ -64,6 +66,7 @@ async function start(): Promise<void> {machineBillingWorkerService.stop()productUsagePeopleRollupService.stop()stopSweeps()+ stopLegacyDrop()stopArchive()stopDeliveries()stopReceiptSweep()@@ -83,6 +86,8 @@ async function start(): Promise<void> {const swarms = new SuperTabStore(prisma, Date.now, null, { deliveriesWaiting: announceSwarmDeliveries, hostsChanged: announceSwarmHostChanges,swarmChanged: announceSwarmChanges })stopSweeps = startSwarmSweeps(prisma, undefined, () => swarms.workspaces.finishRemovals())+ // The dead old state of migrated Swarms goes by itself, a few at a time (superTabs/migration/dropLegacyJob.ts).+ stopLegacyDrop = startLegacyDrop(prisma)// Finished groups archive once GitHub says their pull requests are merged or closed; without the app, only groups that// link none do (superTabs/archive.ts).const githubConfig = githubAppConfig(env), githubApp = githubConfig ? new GitHubApp(githubConfig) : null