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.

The v2 PM text and its note only in the rebased Swarm; the release window from the project's rules (#4097) (#3442)

harness-for-autonomous[bot]d6c7190a5f89
diff --git a/backend/integration/superTabInstructions.test.ts b/backend/integration/superTabInstructions.test.ts
index 763793ac3..2bbc4c960 100644
--- a/backend/integration/superTabInstructions.test.ts
+++ b/backend/integration/superTabInstructions.test.ts
@@ -20,7 +20,7 @@ import { DEFAULT_ROUTING_POLICY } from '../src/superTabs/routingPolicy.js'
import { INSTRUCTIONS_TEMPLATE } from '../src/superTabs/instructionsTemplate.js'
import { rosterRows } from './hostRows.test-support.js'
import { SEED_RULES } from '../src/superTabs/policy.js'
-import { PM_SCHEDULE_TEXT } from '../src/superTabs/pmSchedule.js'
+import { PM_SCHEDULE_TEXT, pmScheduleText } from '../src/superTabs/pmSchedule.js'
import { plan, profiled, reads } from './plans.test-support.js'
// A fresh loopback replica set, created here. This suite never reads DATABASE_URL or an existing database.
@@ -451,7 +451,9 @@ describe('the built-in PM schedule beside the instructions', () => {
it('is in the coordinator\'s read alone, and the document read is unchanged', async () => {
const { tab, lead, worker } = await withWorker()
const asLead = (await get(host, doc(tab, lead))).json().data
- expect(asLead.builtIn).toBe(PM_SCHEDULE_TEXT)
+ // Outside the rebased Swarm (#4097): the built-in schedule with the project's own release window, no v2 section.
+ expect(asLead.builtIn).toBe(pmScheduleText({ id: tab }, {}, SEED_RULES.releaseWindow))
+ expect(asLead.builtIn).not.toBe(PM_SCHEDULE_TEXT)
expect(asLead).toMatchObject({ revision: 1, text: INSTRUCTIONS_TEMPLATE, hash: instructionsHash(INSTRUCTIONS_TEMPLATE) })
for (const [user, as] of [[host, worker], [owner]] as Array<[AuthUser, string?]>) {
const answer = await get(user, doc(tab, as))
@@ -463,10 +465,22 @@ describe('the built-in PM schedule beside the instructions', () => {
it('moves the coordinator\'s roster row by its hash; no other agent\'s row carries one', async () => {
const { tab, lead, worker } = await withWorker()
const rows = (await rosterRows(store, host, 'test-host')).filter(r => r.tabId === tab) as Array<{ agent: { id: string }; instructions: Record<string, unknown> }>
- expect(rows.find(r => r.agent.id === lead)!.instructions.builtInHash).toBe(instructionsHash(PM_SCHEDULE_TEXT))
+ expect(rows.find(r => r.agent.id === lead)!.instructions.builtInHash).toBe(instructionsHash(pmScheduleText({ id: tab }, {}, SEED_RULES.releaseWindow)))
expect(rows.find(r => r.agent.id === worker)!.instructions).not.toHaveProperty('builtInHash')
})
+ // Diego 11-06 (#4097): a team with another window is told its own hours, and its own process lines keep their force.
+ it('tells a PM outside the rebased Swarm its project\'s own release window, and never that the Swarm replaces its process lines', async () => {
+ const { tab, lead } = await withLead()
+ const berlin = { start: '13:00', end: '22:00', timeZone: 'Europe/Berlin' }
+ await run(tab, { type: 'rules.set', projectId: 'lead', baseRevision: 0, summary: 'Berlin hours',
+ rules: { ...structuredClone(SEED_RULES), releaseWindow: berlin, releasePace: { ...SEED_RULES.releasePace, backendPause: null } } })
+ const builtIn = (await get(host, doc(tab, lead))).json().data.builtIn as string
+ expect(builtIn).toContain('Releases run 13:00-22:00 Europe/Berlin time')
+ expect(builtIn).not.toContain('replaces every process line')
+ expect(builtIn).not.toContain('Vietnam time')
+ })
+
it('refuses a save holding the built-in section, and takes the document as read', async () => {
const { tab, lead } = await withLead()
const read = (await get(host, doc(tab, lead))).json().data
diff --git a/backend/src/superTabs/boardRights.test.ts b/backend/src/superTabs/boardRights.test.ts
index b4c4ec157..66d401938 100644
--- a/backend/src/superTabs/boardRights.test.ts
+++ b/backend/src/superTabs/boardRights.test.ts
@@ -1,3 +1,4 @@
+import { REBASE_SWARMS } from './migration/rebase.js'
import { describe, expect, it } from 'vitest'
import { applyCommand, type Command, type CommandContext } from './commands.js'
import { createSuperTab, visibleState, type Actor, type SuperTabState } from './model.js'
@@ -238,6 +239,8 @@ describe('pause and resume', () => {
})
describe('the PM text in a switched project', () => {
+ // The v2 section, which holds the inbox line, is the rebased Swarm's alone (#4097).
+ const rebased = { id: REBASE_SWARMS[0]!.tabId }
const INBOX_LINE = /Answer each person's message once|Your inbox lists every unanswered message/
it('drops the inbox lines, and a person\'s message there owes the PM nothing', () => {
@@ -245,12 +248,12 @@ describe('the PM text in a switched project', () => {
f.run({ type: 'project.canChat', projectId: f.app.projectId, personId: 'c', granted: true })
const ask = () => f.run({ type: 'message.send', conversationId: f.app.conversationId, text: 'Can you look at this?', replyTo: null, recipientIds: [f.pm] }, granted)
// Not switched: today's text, and the ask is owed.
- expect(pmScheduleText(f.project())).toBe(PM_SCHEDULE_TEXT)
+ expect(pmScheduleText(rebased, f.project())).toBe(PM_SCHEDULE_TEXT)
ask()
expect(owedLines(f.state, f.project(), 1000).join('\n')).toMatch(/Owed asks/)
f.run({ type: 'project.boardMode', projectId: f.app.projectId, on: true })
- const text = pmScheduleText(f.project())
+ const text = pmScheduleText(rebased, f.project())
expect(PM_SCHEDULE_TEXT).toMatch(INBOX_LINE)
expect(text).not.toMatch(INBOX_LINE)
expect(text).toContain('Keep a standing crew')
diff --git a/backend/src/superTabs/inbox.ts b/backend/src/superTabs/inbox.ts
index a7c1ae96d..c16b42999 100644
--- a/backend/src/superTabs/inbox.ts
+++ b/backend/src/superTabs/inbox.ts
@@ -78,7 +78,7 @@ const MINUTE = 60_000
/** [project]'s owed asks as the inbox's first lines: a what-changed note its PM has not confirmed (processNotes.ts, task #3581),
* then a header and one line per ask, oldest first. None when nothing is owed. */
export function owedLines(state: SuperTabState, project: SwarmProject, now: number): string[] {
- const process = noteLines(project)
+ const process = noteLines(state, project)
const asks = state.conversations.filter(c => !c.archived && c.owed && (c.projectId ?? 'lead') === project.id)
.flatMap(c => c.owed!.map(ask => ({ ...ask, conversationId: c.id }))).sort((a, b) => a.at - b.at)
if (!asks.length) return process
diff --git a/backend/src/superTabs/pmSchedule.test.ts b/backend/src/superTabs/pmSchedule.test.ts
index b8e397870..d6802b8ca 100644
--- a/backend/src/superTabs/pmSchedule.test.ts
+++ b/backend/src/superTabs/pmSchedule.test.ts
@@ -1,8 +1,10 @@
import { describe, expect, it } from 'vitest'
import type { Agent, Assignment, Conversation, SuperTabState, WorkStatus } from './model.js'
-import { BUILT_IN_HEADING, PM_SCHEDULE_TEXT, recordTidy, recordWake, SCHEDULE_SLOT_MS, scheduleMessageId, scheduleRequest, scheduleSlot, tidyMessageId, tidyRequest, tidySaved } from './pmSchedule.js'
+import { BUILT_IN_HEADING, PM_SCHEDULE_TEXT, pmScheduleText, recordTidy, recordWake, SCHEDULE_SLOT_MS, scheduleMessageId, scheduleRequest, scheduleSlot, tidyMessageId, tidyRequest, tidySaved } from './pmSchedule.js'
import { ARCHIVE_QUIET_MS } from './tidy.js'
import { latestProcessNote } from './processNotes.js'
+import { REBASE_SWARMS } from './migration/rebase.js'
+import { SEED_RULES } from './policy.js'
/** 10:00 on 4 November in Vietnam (03:00 UTC): a slot's first millisecond. */
const T = Date.UTC(2026, 10, 4, 3, 0)
@@ -362,3 +364,40 @@ describe('the daily tidy', () => {
expect(text).not.toContain('Keep every rule a person gave and who gave it.')
})
})
+
+// Diego 11-06 (#4097): the v2 section replaces a project's process lines only where its instructions were moved onto the base
+// (migration/rebase.ts REBASE_SWARMS). Elsewhere the project's own lines and people's rules keep their force, and the release
+// window is the project's own (its rules record), not Vietnam's.
+describe('the built-in PM text by Swarm', () => {
+ const REBASED = REBASE_SWARMS[0]!.tabId
+ const berlin = { start: '13:00', end: '22:00', timeZone: 'Europe/Berlin' }
+ const project = { boardMode: undefined }
+
+ it('outside the rebased Swarm, is the built-in schedule with the project\'s own release window, and no v2 section', () => {
+ const text = pmScheduleText({ id: 'other-swarm' }, project, berlin)
+ expect(text).not.toContain('replaces every process line')
+ expect(text).not.toContain('Swarm process v2')
+ expect(text).not.toContain('Vietnam time')
+ expect(text).toContain('Releases run 13:00-22:00 Europe/Berlin time')
+ expect(text).toContain(`${BUILT_IN_HEADING}\n`)
+ expect(text.slice(text.indexOf(BUILT_IN_HEADING))).toBe(PM_SCHEDULE_TEXT.slice(PM_SCHEDULE_TEXT.indexOf(BUILT_IN_HEADING)))
+ })
+
+ it('in the rebased Swarm, is today\'s text word for word with its rules\' window, and shows another window as written', () => {
+ expect(pmScheduleText({ id: REBASED }, project, SEED_RULES.releaseWindow)).toBe(PM_SCHEDULE_TEXT)
+ const text = pmScheduleText({ id: REBASED }, project, berlin)
+ expect(text).toContain('Swarm process v2')
+ expect(text).toContain('- Releases run 13:00-22:00 Europe/Berlin time. Sign-in')
+ expect(text).not.toContain('Vietnam time')
+ })
+
+ it('wakes no PM outside the rebased Swarm for the v2 text note; the rebased Swarm\'s PM still hears it', () => {
+ const outside = swarm()
+ outside.projects![0]!.processNote = { confirmed: '2026-11-06-crew' }
+ expect(wake(outside)).toBeNull()
+ const rebased = { ...swarm(), id: REBASED }
+ rebased.projects![0]!.processNote = { confirmed: '2026-11-06-crew' }
+ expect(wake(rebased)?.jobs).toEqual(['process'])
+ expect(wake(rebased)?.processNote).toBe('2026-11-06-v2-text')
+ })
+})
diff --git a/backend/src/superTabs/pmSchedule.ts b/backend/src/superTabs/pmSchedule.ts
index 7c5b284e3..0da6620fb 100644
--- a/backend/src/superTabs/pmSchedule.ts
+++ b/backend/src/superTabs/pmSchedule.ts
@@ -5,25 +5,37 @@ import { digestOf, localNow } from './digest.js'
import { DEFAULT_TIME_ZONE } from './costs/reflection.js'
import { taskLiveness } from './liveness.js'
import { archivable } from './tidy.js'
-import { processLines, unconfirmedNote } from './processNotes.js'
+import { isRebasedSwarm, processLines, unconfirmedNote } from './processNotes.js'
+import { SEED_RULES, type ProjectRules } from './policy.js'
import { switched } from './boardRights.js'
// Every project's coordinator runs the same built-in schedule, woken by the Swarm on its own poll instead of a timer of its
// own (Ken, 2026-11-04; docs/plans/2026-11-04-pm-built-in-schedule-design.md): a Codex PM may have no timer, and a restart
// lost one. A line in the project's own instructions about the same job wins; the coordinator, which reads both, judges that.
+type ReleaseWindow = ProjectRules['releaseWindow']
+
/** The heading of the built-in section, which no saved document may hold (commands.ts instructions.save). */
export const BUILT_IN_HEADING = '## Built-in PM schedule (from the Swarm)'
-/** What the coordinator reads after its project's instructions (store.ts instructions, cli swarmInstructionsSkill.ts). */
-export const PM_SCHEDULE_TEXT = `## Swarm process v2 (from the Swarm, 2026-11-06): this replaces every process line in your project's instructions. Follow this, not them; your instructions keep only your project's own facts.
+/** The release window as a PM reads it: the zone by its plain name where it has one (the seed's, so the rebased Swarm's text
+ * stays as it was), else its IANA name. */
+const ZONE_NAMES: Readonly<Record<string, string>> = { 'Asia/Ho_Chi_Minh': 'Vietnam' }
+const releaseHours = (window: ReleaseWindow): string => `${window.start}-${window.end} ${ZONE_NAMES[window.timeZone] ?? window.timeZone} time`
+
+/** The Swarm v2 process, for the Swarms whose instructions moved onto the base (migration/rebase.ts REBASE_SWARMS): there it
+ * replaces their process lines (anh Dee, #3603). Elsewhere a project's own lines and people's rules keep their force (#4097). */
+const v2Section = (window: ReleaseWindow): string => `## Swarm process v2 (from the Swarm, 2026-11-06): this replaces every process line in your project's instructions. Follow this, not them; your instructions keep only your project's own facts.
- Keep a standing crew. Mark agents as crew once, each with its role and area (backend, CLI, Desktop, mobile, docs: only the areas your project has), plus reviewers and a tester. Start a new agent only to replace a broken one or to fill an area that has none.
- Give each task its area, or let its files choose it. A free crew member takes the next task in its area by itself. Review and test steps open by themselves when a pull request is ready; don't open them by hand.
- Answer each person's message once, in its place. Your inbox lists every unanswered message until it is answered.
- A rule a program can check belongs in code, not in your instructions. Your instructions keep only judgment and your project's own facts.
-- Releases run 09:00-18:00 Vietnam time. Sign-in, tokens, access, encryption, the Buddy guard, device links and deleting data get two security reviews.
+- Releases run ${releaseHours(window)}. Sign-in, tokens, access, encryption, the Buddy guard, device links and deleting data get two security reviews.
+
+`
-${BUILT_IN_HEADING}
+/** The built-in schedule every coordinator reads, as before the v2 section (#3299). */
+const BUILT_IN_SECTION = `${BUILT_IN_HEADING}
The Swarm wakes you for these jobs with a message that names them. Set no timer of your own for them, and delete one you set
before. A line in this project's instructions above about the same job wins: follow it, and skip that job when the Swarm's
@@ -87,14 +99,23 @@ What people teach you:
if it is missing. Count repeats by person, and give the day's count in your nightly reflection, or in the next morning
digest when the project has no reflection.`
+/** What the rebased Swarm's coordinator reads after its project's instructions, for the seed's release window (store.ts
+ * instructions, cli swarmInstructionsSkill.ts); the newest note for PMs pins it (processNotes.ts). */
+export const PM_SCHEDULE_TEXT = v2Section(SEED_RULES.releaseWindow) + BUILT_IN_SECTION
+
/** The built-in text's inbox line, which a project switched to the Board way of working drops (task #3819): its PM answers no
* one in the chat, and nothing is owed to it there. */
const INBOX_LINE = '- Answer each person\'s message once, in its place. Your inbox lists every unanswered message until it is answered.\n'
if (!PM_SCHEDULE_TEXT.includes(INBOX_LINE)) throw new Error('pmSchedule.ts: the built-in text lost its inbox line; update INBOX_LINE')
-const BOARD_SCHEDULE_TEXT = PM_SCHEDULE_TEXT.replace(INBOX_LINE, '')
-/** The built-in text [project]'s coordinator reads: without the inbox line once it is switched (boardRights.ts). */
-export const pmScheduleText = (project: Pick<SwarmProject, 'boardMode'>): string => switched(project) ? BOARD_SCHEDULE_TEXT : PM_SCHEDULE_TEXT
+/** The built-in text [project]'s coordinator reads in [swarm], with the project's release window from its rules (policy.ts):
+ * the v2 section in a rebased Swarm alone, without its inbox line once the project is switched (boardRights.ts); elsewhere
+ * the release window and the built-in schedule (Diego 11-06, #4097). */
+export function pmScheduleText(swarm: Pick<SuperTabState, 'id'>, project: Pick<SwarmProject, 'boardMode'>, window: ReleaseWindow = SEED_RULES.releaseWindow): string {
+ if (!isRebasedSwarm(swarm)) return `Releases run ${releaseHours(window)}, by this project's rules.\n\n${BUILT_IN_SECTION}`
+ const text = v2Section(window) + BUILT_IN_SECTION
+ return switched(project) ? text.replace(INBOX_LINE, '') : text
+}
/** The schedule's clock: slot n starts at n * 30 minutes, in UTC. */
export const SCHEDULE_SLOT_MS = 30 * 60_000
@@ -168,7 +189,7 @@ export function scheduleRequest(state: SuperTabState, target: Agent, now: number
const since = schedule?.heardAt ?? 0
const heard = state.conversations.some(c => !c.archived && (c.heardAt ?? 0) > since && (c.id === project.leadConversationId || inProject(c, project.id)))
// A what-changed note the PM has not confirmed wakes it once (task #3581); after that it rides on the wakes due anyway.
- const note = unconfirmedNote(project)
+ const note = unconfirmedNote(state, project)
const tell = !!note && project.processNote?.told !== note.id
const jobs: ScheduleJob[] = [
...sweepDue(state, project.id, now) ? ['sweep' as const] : [],
diff --git a/backend/src/superTabs/processNotes.test.ts b/backend/src/superTabs/processNotes.test.ts
index 3b3b039dc..59aab43ff 100644
--- a/backend/src/superTabs/processNotes.test.ts
+++ b/backend/src/superTabs/processNotes.test.ts
@@ -6,6 +6,7 @@ import { createSuperTab, type Actor, type Agent, type Assignment, type Conversat
import { PM_SCHEDULE_TEXT, recordWake, SCHEDULE_SLOT_MS, scheduleRequest } from './pmSchedule.js'
import { latestProcessNote, PROCESS_NOTES } from './processNotes.js'
import { projectPulse } from './pulse.js'
+import { REBASE_SWARMS } from './migration/rebase.js'
// Task #3581 (anh Dee, 11-06): lamp's PM did not know the Swarm v2 process, and nothing told a running PM that a release changed
// how PMs work. A release that changes the PM's text carries a "what changed" note: each PM is woken once for it, lists it as owed
@@ -20,10 +21,11 @@ const working: Assignment = { id: 'w', agentId: 'eng', status: 'working', config
const task = (id: string, assignment: Assignment | null): Conversation => ({ id, projectId: 'p1', number: 1, title: 'Task', leadId: 'lead', agentIds: ['lead', 'eng'],
archived: false, brief: 'Do it.', checks: [], assignment, lastMessageSequence: 1, lastActivityAt: new Date(T).toISOString() })
-/** One project led by `lead`, its one task worked on (nothing for the sweep), its Engineer crew unless [crew] is false. */
+/** One project led by `lead`, its one task worked on (nothing for the sweep), its Engineer crew unless [crew] is false. In the
+ * rebased Swarm, which the newest note is for (processNotes.ts rebasedOnly, #4097). */
function swarm(crew = true): SuperTabState {
return {
- version: 1, id: 'tab', name: 'Swarm', ownerId: 'owner', environment: 'prod', paused: false, invitations: [],
+ version: 1, id: REBASE_SWARMS[0]!.tabId, name: 'Swarm', ownerId: 'owner', environment: 'prod', paused: false, invitations: [],
people: [{ id: 'owner', email: '[email protected]', role: 'owner', generation: 'g' }] as SuperTabState['people'],
agents: [agent('lead'), agent('eng', crew ? { crew: { role: 'Engineer', lane: 'backend', at: T, by: 'owner' } } : {})],
projects: [{ id: 'p1', name: 'lamp', ownerId: 'owner', leadConversationId: 'lead-p1', visibility: 'public', members: [], updateMinutes: 5 }],
diff --git a/backend/src/superTabs/processNotes.ts b/backend/src/superTabs/processNotes.ts
index 2af6d5a4c..6d39b21ae 100644
--- a/backend/src/superTabs/processNotes.ts
+++ b/backend/src/superTabs/processNotes.ts
@@ -7,9 +7,14 @@
*/
import type { SuperTabState } from './model.js'
import { agentProjectId, type SwarmProject } from './projects.js'
+import { REBASE_SWARMS } from './migration/rebase.js'
-/** One note: its id, its words for the PM, and the built-in schedule's fingerprint when it was written. */
-export interface ProcessNote { id: string; text: string; schedule: string }
+/** One note: its id, its words for the PM, and the built-in schedule's fingerprint when it was written. `rebasedOnly`: for the
+ * Swarms whose instructions moved onto the base (migration/rebase.ts REBASE_SWARMS) alone, as the text it announces is. */
+export interface ProcessNote { id: string; text: string; schedule: string; rebasedOnly?: true }
+
+/** Whether [swarm] is one whose instructions moved onto the base (migration/rebase.ts): its PM reads the v2 process text. */
+export const isRebasedSwarm = (swarm: Pick<SuperTabState, 'id'>): boolean => REBASE_SWARMS.some(rebased => rebased.tabId === swarm.id)
export const PROCESS_NOTES: readonly ProcessNote[] = [
{
@@ -27,19 +32,24 @@ export const PROCESS_NOTES: readonly ProcessNote[] = [
+ 'hand. Lost, stalled and idle notices are information: the Swarm hands lost work on, nudges stalled workers and stops idle Engineers '
+ 'by itself, so don\'t repeat those by hand. A rule a program can check belongs in code, not in your instructions.',
schedule: '52cb6172d956',
+ // Diego 11-06 (#4097): the v2 text replaces process lines only where the instructions moved onto the base.
+ rebasedOnly: true,
},
]
export const latestProcessNote = (): ProcessNote | undefined => PROCESS_NOTES.at(-1)
/** Every note after the newest one [project]'s PM confirmed, oldest first: all of them when it confirmed none (SecAlder's review:
- * a PM that missed a note still reads it when the next one ships). Confirming the newest clears them all. */
-export function unconfirmedNotes(project: Pick<SwarmProject, 'processNote'>): ProcessNote[] {
- return PROCESS_NOTES.slice(noteIndex(project.processNote?.confirmed) + 1)
+ * a PM that missed a note still reads it when the next one ships). Confirming the newest clears them all. A note for the
+ * rebased Swarms is none of another Swarm's. */
+export function unconfirmedNotes(swarm: Pick<SuperTabState, 'id'>, project: Pick<SwarmProject, 'processNote'>): ProcessNote[] {
+ const rebased = isRebasedSwarm(swarm)
+ return PROCESS_NOTES.slice(noteIndex(project.processNote?.confirmed) + 1).filter(note => rebased || !note.rebasedOnly)
}
/** The newest note [project]'s PM has not confirmed, or null: the one a wake is for and the board names. */
-export const unconfirmedNote = (project: Pick<SwarmProject, 'processNote'>): ProcessNote | null => unconfirmedNotes(project).at(-1) ?? null
+export const unconfirmedNote = (swarm: Pick<SuperTabState, 'id'>, project: Pick<SwarmProject, 'processNote'>): ProcessNote | null =>
+ unconfirmedNotes(swarm, project).at(-1) ?? null
/** [id]'s place in PROCESS_NOTES, or -1 for none or an unknown one. */
export const noteIndex = (id: string | undefined): number => PROCESS_NOTES.findIndex(note => note.id === id)
@@ -49,8 +59,8 @@ export const hasCrew = (state: SuperTabState, project: SwarmProject): boolean =>
state.agents.some(a => !!a.crew && agentProjectId(state, a) === project.id)
/** The what-changed notes [project]'s PM owes, oldest first, for its wakes and its inbox (inbox.ts owedLines), until it confirms it. */
-export function noteLines(project: SwarmProject): string[] {
- const notes = unconfirmedNotes(project)
+export function noteLines(swarm: Pick<SuperTabState, 'id'>, project: SwarmProject): string[] {
+ const notes = unconfirmedNotes(swarm, project)
const newest = notes.at(-1)
if (!newest) return []
return [...notes.map(note => `What changed for PMs (note ${note.id}): ${note.text}`),
@@ -62,7 +72,7 @@ export function noteLines(project: SwarmProject): string[] {
* first time. */
export function processLines(state: SuperTabState, project: SwarmProject): string[] {
return [
- ...noteLines(project),
+ ...noteLines(state, project),
...hasCrew(state, project) ? [] : ['No crew yet in this project: mark its standing agents once with crew.add {agentId, role, lane}. Until then this line comes with every wake.'],
]
}
diff --git a/backend/src/superTabs/pulse.ts b/backend/src/superTabs/pulse.ts
index 8432bf549..2a1b8fbe3 100644
--- a/backend/src/superTabs/pulse.ts
+++ b/backend/src/superTabs/pulse.ts
@@ -259,7 +259,7 @@ export function projectPulse(state: SuperTabState, project: SwarmProject, now: n
lost: { count: counts.lost.length, since: lostAt, conversationIds: counts.lost.map(l => l.id).slice(0, PULSE_LIST_MAX) },
held: { count: counts.held.length, withoutReason, list: counts.held.slice(0, PULSE_LIST_MAX) },
idleSince,
- process: (note => note ? { noteId: note.id } : null)(unconfirmedNote(project)),
+ process: (note => note ? { noteId: note.id } : null)(unconfirmedNote(state, project)),
redAt: {
asks: oldest ? oldest.at + limits.askMinutes * MINUTE : null,
idle: idleSince === null ? null : idleSince + limits.idleMinutes * MINUTE,
diff --git a/backend/src/superTabs/read/hostRows.ts b/backend/src/superTabs/read/hostRows.ts
index abba3820d..1bdf737d7 100644
--- a/backend/src/superTabs/read/hostRows.ts
+++ b/backend/src/superTabs/read/hostRows.ts
@@ -17,7 +17,8 @@ import { PM_SCHEDULE_TEXT, pmScheduleText } from '../pmSchedule.js'
import { PM_RESTART_AFTER_MS } from '../timeChecks.js'
/** The built-in PM schedule's hash, once per text: it changes only with a backend release, and with a project's switch to the
- * Board way of working (pmSchedule.ts pmScheduleText, task #3819). */
+ * Board way of working (pmSchedule.ts pmScheduleText, task #3819). It is taken over the seed's release window: this read loads
+ * no project rules, so a window change reaches the PM at its next instructions read (#4097). */
const BUILT_IN_HASHES = new Map<string, string>([[PM_SCHEDULE_TEXT, instructionsHash(PM_SCHEDULE_TEXT)]])
const builtInHash = (text: string): string => BUILT_IN_HASHES.get(text) ?? (BUILT_IN_HASHES.set(text, instructionsHash(text)), BUILT_IN_HASHES.get(text)!)
@@ -102,7 +103,7 @@ function agentRow(tabId: string, state: SuperTabState, machineId: string, user:
// running daemons read the text again (2026-11-02: agents kept the old routing after #2495, as revision 0 never moves).
instructions: home ? { projectId: home.id, revision: home.instructionsRevision ?? 0,
hash: home.instructionsHash ?? (home.instructionsRevision ? null : FIRST_INSTRUCTIONS.instructionsHash),
- coordinatorName: coordinatorNameOf(home), ...ledProject(state, target.id)?.id === home.id ? { builtInHash: builtInHash(pmScheduleText(home)) } : {} } : null,
+ coordinatorName: coordinatorNameOf(home), ...ledProject(state, target.id)?.id === home.id ? { builtInHash: builtInHash(pmScheduleText(state, home)) } : {} } : null,
...(custom ? { role: chosen && { ...chosen, projectId: custom.id } } : {}),
lead: !!ledProject(state, target.id),
// What a PM owes people, and how long it may while it hangs: its host restarts it after that (timeChecks.ts, cli host.ts).
diff --git a/backend/src/superTabs/store.ts b/backend/src/superTabs/store.ts
index 6c17182bd..0057a5ca5 100644
--- a/backend/src/superTabs/store.ts
+++ b/backend/src/superTabs/store.ts
@@ -67,7 +67,7 @@ import { lostReasonWithoutMachine } from './lostReason.js'
import { LEAD_NAME } from './leadStart.js'
import { deleteInstructions, instructionsId, readNotes, revisionId, writeInstructions, writeNotes } from './instructionsStore.js'
import { currentRules, deleteRules, readRules, readRulesHistory, writeRules } from './policyStore.js'
-import { SEED_RULES, seedRules, validMachineRules, type MachineRule } from './policy.js'
+import { SEED_RULES, seedRules, validMachineRules, type MachineRule, type ProjectRules } from './policy.js'
import { coordinatorNameOf, FIRST_INSTRUCTIONS, FIRST_SUMMARY, liveNotes, MAX_REVISIONS } from './instructions.js'
import { INSTRUCTIONS_TEMPLATE } from './instructionsTemplate.js'
import { confidentialSessions, otherRegistrations, recordConfidential } from './confidential.js'
@@ -718,6 +718,16 @@ async function machineRulesOf(tx: Transaction, tabId: string, projectId: string)
return rules
}
+/** [projectId]'s release window for its PM's built-in text (pmSchedule.ts), from its newest rules revision: the seed's for a
+ * record that does not pass the schema, said in the log, so the PM still reads its instructions. One indexed read. */
+async function releaseWindowOf(tx: Transaction, tabId: string, projectId: string): Promise<ProjectRules['releaseWindow']> {
+ return (await currentRules(tx, tabId, projectId).catch((error: unknown) => {
+ if (!(error instanceof SuperTabError) || error.code !== 'RULES_INVALID') throw error
+ logger.warn('[swarm-pm-text] rules record invalid; the seed release window is shown', { tabId, projectId })
+ return { revision: 0, rules: SEED_RULES }
+ })).rules.releaseWindow
+}
+
export class SuperTabStore {
/** Where lag-tolerant reads go (SuperTabStoreHooks.replica); the store's own client without one. */
readonly replica: PrismaClient
@@ -3353,7 +3363,7 @@ export class SuperTabStore {
const coordinator = actor.kind === 'agent' && ledProject(state, actor.agentId)?.id === project.id
return { projectId, revision, hash: stored ? stored.hash : FIRST_INSTRUCTIONS.instructionsHash, text: stored?.text ?? INSTRUCTIONS_TEMPLATE, template: !stored,
coordinatorName: coordinatorNameOf(project), notesRevision: project.notesRevision ?? 0, ...(notes ? { notes } : {}),
- ...(coordinator ? { builtIn: pmScheduleText(project) } : {}) }
+ ...(coordinator ? { builtIn: pmScheduleText(state, project, await releaseWindowOf(tx, tabId, projectId)) } : {}) }
})
}