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.

Board cards show CI state and the next release time (#3391)

harness-for-autonomous[bot]3c040823769c
diff --git a/backend/integration/superTabPullRequestEvents.test.ts b/backend/integration/superTabPullRequestEvents.test.ts
index 86652341c..3d4892374 100644
--- a/backend/integration/superTabPullRequestEvents.test.ts
+++ b/backend/integration/superTabPullRequestEvents.test.ts
@@ -531,3 +531,52 @@ describe('pull request events', () => {
})
})
})
+
+// Task #3827: the board's Done cards say whether the pull request's checks are green. The watch already reads them each pass; it
+// records one state per linked pull request on the task, and only when it changes.
+describe('a pull request\'s check state', () => {
+ const checksOf = async (f: Awaited<ReturnType<typeof swarm>>) => (await f.store.read(owner, f.tab)).state.conversations.find(c => c.id === f.task)!.pullRequestChecks
+ const ran = (conclusion: string | null, at: number) => ({ checkRuns: [{ name: 'ci/required', status: conclusion ? 'completed' : 'in_progress', conclusion, completedAt: conclusion ? at : null }],
+ checkSuites: [{ status: conclusion ? 'completed' : 'in_progress', runs: 1 }] })
+
+ it('follows the checks of an open task: running, red, then green', async () => {
+ const f = await swarm()
+ f.pulls.set(f.PR, f.pull(ran(null, 0)))
+ await f.pass()
+ expect(await checksOf(f)).toEqual({ [f.PR]: 'running' })
+ f.pulls.set(f.PR, f.pull(ran('failure', f.clock.now + 10_000)))
+ await f.pass()
+ expect(await checksOf(f)).toEqual({ [f.PR]: 'red' })
+ f.pulls.set(f.PR, f.pull(ran('success', f.clock.now + 10_000)))
+ await f.pass()
+ expect(await checksOf(f)).toEqual({ [f.PR]: 'green' })
+ })
+
+ it('is recorded for a done task too, which posts nothing', async () => {
+ const f = await swarm()
+ await f.execute({ type: 'work.status', conversationId: f.task, assignmentId: f.assignment, status: 'done', result: `Done ${f.PR}` }, host, f.worker)
+ const before = (await f.told()).length
+ f.pulls.set(f.PR, f.pull(ran('success', f.clock.now + 10_000)))
+ await f.pass()
+ expect(await checksOf(f)).toEqual({ [f.PR]: 'green' })
+ // A push turns it back: same head or not, the state moves with the checks.
+ f.pulls.set(f.PR, f.pull(ran('failure', f.clock.now + 10_000)))
+ await f.pass()
+ expect(await checksOf(f)).toEqual({ [f.PR]: 'red' })
+ expect(await f.told()).toHaveLength(before)
+ })
+
+ it('writes nothing when the checks did not change, and keeps the state a pass reads', async () => {
+ const f = await swarm()
+ await f.execute({ type: 'work.status', conversationId: f.task, assignmentId: f.assignment, status: 'done', result: `Done ${f.PR}` }, host, f.worker)
+ f.pulls.set(f.PR, f.pull(ran('success', f.clock.now + 10_000)))
+ await f.pass()
+ const version = async () => (await f.store.read(owner, f.tab)).version
+ const at = await version()
+ await f.pass()
+ await f.pass()
+ expect(await version()).toBe(at)
+ expect(await checksOf(f)).toEqual({ [f.PR]: 'green' })
+ })
+})
+
diff --git a/backend/src/superTabs/model.ts b/backend/src/superTabs/model.ts
index 6b4521cf6..4bc9d9a1a 100644
--- a/backend/src/superTabs/model.ts
+++ b/backend/src/superTabs/model.ts
@@ -443,6 +443,9 @@ export interface Conversation {
/** Each linked pull request's head and patch id as the PR watch last read them (#3394): what check verdicts count against.
* Absent until the watch reads one. */
pullRequestHeads?: Record<string, PullRequestHead>
+ /** Each linked pull request's check state as the PR watch last read it, `green`, `red` or `running` (pullRequestEvents.ts
+ * checksStateOf, task #3827): what the board's Done cards say. Written only when it changes; absent until the watch reads one. */
+ pullRequestChecks?: Record<string, import('./pullRequestEvents.js').ChecksState>
/** Its steps and reviews (groups whose reviewOf is this one), newest last, at most 200 (production's most was 14): what a new
* pull request head re-derives the checks of, dormant ones included (#3394). Empty from a task's start; absent on a task
* from before, whose PR watch looks them up once (pullRequestEvents.ts listedSteps). */
diff --git a/backend/src/superTabs/parts/light.test.ts b/backend/src/superTabs/parts/light.test.ts
index 3c8935cbd..f66921a4b 100644
--- a/backend/src/superTabs/parts/light.test.ts
+++ b/backend/src/superTabs/parts/light.test.ts
@@ -71,6 +71,7 @@ const conversation: Required<Conversation> = {
priority: 'P0',
projectId: 'p',
proposals: [],
+ pullRequestChecks: {},
pullRequestEvents: {},
pullRequestHeads: {},
pullRequestUrls: [],
diff --git a/backend/src/superTabs/parts/light.ts b/backend/src/superTabs/parts/light.ts
index 8958ea72b..be7235b3f 100644
--- a/backend/src/superTabs/parts/light.ts
+++ b/backend/src/superTabs/parts/light.ts
@@ -95,6 +95,7 @@ export const GROUP_FIELDS = {
'pin',
'priority',
'proposals',
+ 'pullRequestChecks',
'pullRequestEvents',
'pullRequestHeads',
'pullRequestUrls',
diff --git a/backend/src/superTabs/pullRequestEvents.test.ts b/backend/src/superTabs/pullRequestEvents.test.ts
index 5e182214d..2eeed80cd 100644
--- a/backend/src/superTabs/pullRequestEvents.test.ts
+++ b/backend/src/superTabs/pullRequestEvents.test.ts
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest'
-import { pullRequestEvents, SEEN_KEPT, type PullRequestWatch } from './pullRequestEvents.js'
+import { checksStateOf, pullRequestEvents, SEEN_KEPT, type PullRequestWatch } from './pullRequestEvents.js'
import { appPullRequestWatch } from './pullRequestEvents.js'
import type { GitHubApp } from '../github/app.js'
@@ -15,6 +15,35 @@ const run = (name: string, conclusion: string | null, completedAt: number | null
const SEEN = [`ready:${NOW - 3_600_000}`]
const events = (w: PullRequestWatch, seen: readonly string[] = SEEN, bot: string | null = 'harness[bot]') => pullRequestEvents(w, seen, bot, NOW)
+// Task #3827: the board's Done cards say whether the pull request's checks are green. The watch reads them every pass already.
+describe('checksStateOf', () => {
+ const passed = { checkRuns: [run('build', 'success'), run('docs', 'skipped')], checkSuites: [{ status: 'completed', runs: 2 }] }
+
+ it('is green once every run passed and every suite with runs is done', () => {
+ expect(checksStateOf(watch(passed))).toBe('green')
+ expect(checksStateOf(watch({ ...passed, checkSuites: [{ status: 'completed', runs: 2 }, { status: 'queued', runs: 0 }] }))).toBe('green')
+ })
+
+ it('is red as soon as one run failed, whatever else still runs', () => {
+ expect(checksStateOf(watch({ checkRuns: [run('build', 'failure'), run('test', null)], checkSuites: [{ status: 'in_progress', runs: 2 }] }))).toBe('red')
+ expect(checksStateOf(watch({ checkRuns: [run('ci/required', 'timed_out')], checkSuites: [{ status: 'completed', runs: 1 }] }))).toBe('red')
+ })
+
+ it('is running while a run or suite is not done, before any run is read, and for a draft', () => {
+ expect(checksStateOf(watch({ ...passed, checkRuns: [...passed.checkRuns, run('test', null)] }))).toBe('running')
+ expect(checksStateOf(watch({ ...passed, checkSuites: [{ status: 'in_progress', runs: 2 }] }))).toBe('running')
+ expect(checksStateOf(watch())).toBe('running')
+ expect(checksStateOf(watch({ ...passed, draft: true }))).toBe('running')
+ })
+
+ it('says green exactly when the watch posts CI passed', () => {
+ for (const patch of [passed, { ...passed, checkRuns: [run('x', 'failure')] }, { ...passed, checkSuites: [{ status: 'in_progress', runs: 2 }] }, {}]) {
+ const w = watch(patch)
+ expect(events(w).events.some(event => event.key === `ci-green:${HEAD}`)).toBe(checksStateOf(w) === 'green')
+ }
+ })
+})
+
describe('pullRequestEvents', () => {
it('posts CI failed with the failing job names', () => {
const { events: posted } = events(watch({ checkRuns: [run('build (ubuntu)', 'failure'), run('lint', 'success'), run('ci/required', 'failure'), run('test', null)] }))
diff --git a/backend/src/superTabs/pullRequestEvents.ts b/backend/src/superTabs/pullRequestEvents.ts
index fb5db2f02..066aba87d 100644
--- a/backend/src/superTabs/pullRequestEvents.ts
+++ b/backend/src/superTabs/pullRequestEvents.ts
@@ -42,6 +42,22 @@ const PASSED = new Set(['success', 'neutral', 'skipped'])
export const SEEN_KEPT = 50
const QUOTE = 300
+/** Whether every check run of [watch]'s head is done and passed, and every suite that has runs is done: nothing left to wait for. */
+const settledGreen = (watch: PullRequestWatch): boolean => {
+ const suites = watch.checkSuites.filter(suite => suite.runs > 0)
+ return watch.checkRuns.length > 0 && suites.length > 0 && suites.every(suite => suite.status === 'completed')
+ && watch.checkRuns.every(run => run.status === 'completed' && !!run.conclusion && PASSED.has(run.conclusion))
+}
+
+/** What a task's pull request shows the board (Conversation.pullRequestChecks, task #3827): `red` once a check failed, `green`
+ * when everything is done and passed (the rule that posts "CI passed"), else `running`: a draft, checks still going, or none read. */
+export type ChecksState = 'green' | 'red' | 'running'
+export function checksStateOf(watch: PullRequestWatch): ChecksState {
+ if (watch.draft) return 'running'
+ if (watch.checkRuns.some(run => !!run.conclusion && FAILED.has(run.conclusion))) return 'red'
+ return settledGreen(watch) ? 'green' : 'running'
+}
+
const short = (sha: string) => sha.slice(0, 7)
const quoted = (body: string) => {
const text = body.trim().replace(/\s+/g, ' ')
@@ -83,9 +99,7 @@ export function pullRequestEvents(watch: PullRequestWatch, seen: readonly string
const failed = watch.checkRuns.filter(run => failing(run) && (run.completedAt ?? now) >= since)
const stale = watch.checkRuns.some(run => failing(run) && (run.completedAt ?? now) < since)
if (failed.length) add(`ci-red:${head}`, `CI failed on your pull request #${number} (head ${short(head)}): ${failed.map(run => run.name).join(', ')}. ${url}`)
- const suites = watch.checkSuites.filter(suite => suite.runs > 0)
- if (!failed.length && !stale && watch.checkRuns.length && suites.length && suites.every(suite => suite.status === 'completed')
- && watch.checkRuns.every(run => run.status === 'completed' && run.conclusion && PASSED.has(run.conclusion))) {
+ if (!failed.length && !stale && settledGreen(watch)) {
add(`ci-green:${head}`, `CI passed on your pull request #${number} (head ${short(head)}). ${url}`)
}
}
diff --git a/backend/src/superTabs/read/contract.ts b/backend/src/superTabs/read/contract.ts
index f54ce6b1b..3aec6a253 100644
--- a/backend/src/superTabs/read/contract.ts
+++ b/backend/src/superTabs/read/contract.ts
@@ -73,6 +73,10 @@ export interface ProgressView {
export interface Derived {
/** The board's pulse of each project the reader sees (pulse.ts, task #3384), by project id. Absent from an older backend. */
pulse?: Record<string, import('../pulse.js').Pulse>
+ /** When each component's release may next open, by project id then component (releases.ts nextReleaseAt, task #3827): 0 is now,
+ * absent one is left to people. Only for the projects the reader sees and that have a release list; the list itself is never
+ * sent. A time already past is as good as 0: the settle writes a new one each minute it changes. Absent from an older backend. */
+ releaseTimes?: Record<string, import('../releases.js').ReleaseLedger['nextAt'] & object>
/** Every agent the reader can see. `workDecision` is null when the stored value stands; `roleId` null outside Custom. */
/** `roleName`: the role it goes by (instructions.ts roleNameOf), its stored one or what it is. */
agents: Record<string, { downSince: string | null; limitedUntil: string | null; workDecision: 'awaiting' | null; roleId: string | null; roleName: string }>
diff --git a/backend/src/superTabs/read/views.test.ts b/backend/src/superTabs/read/views.test.ts
index cecc2ae5d..311116274 100644
--- a/backend/src/superTabs/read/views.test.ts
+++ b/backend/src/superTabs/read/views.test.ts
@@ -248,6 +248,22 @@ describe('the pulse on the read', () => {
expect(Object.keys(owners.derived.pulse ?? {})).toHaveLength(2)
})
+ // Task #3827: the board's Merged cards say when the next release is due. The server records it on the project's release list
+ // (never sent whole) and the read sends only that: a time per component, for the projects the reader sees.
+ it('sends each visible project\'s next release times, and nothing else of its release list', () => {
+ const { s } = scene()
+ s.edit(state => {
+ state.projects!.find(p => p.name === 'Pilot')!.releases = { pending: [], nextAt: { desktop: 0, backend: NOW + 60 * MINUTE } }
+ })
+ const parts = store.split(s.state, { tabId: 'tab', version: R, now: NOW })
+ const view = readerView(parts, peer, NOW, { teamMachines: [] })
+ const pilot = view.parts.head.data.projects!.find(p => p.name === 'Pilot')!
+ expect(view.derived.releaseTimes).toEqual({ [pilot.id]: { desktop: 0, backend: NOW + 60 * MINUTE } })
+ expect(pilot).not.toHaveProperty('releases')
+ const other = view.parts.head.data.projects!.find(p => p.name !== 'Pilot')
+ if (other) expect(view.derived.releaseTimes).not.toHaveProperty(other.id)
+ })
+
// River, on ReviewPulse2's review of #3209: the pulse's lists name conversations, so a reader gets only those they read; a
// Buddy reads only its person's own, so it gets the counts alone (they are its project's totals, which it may read).
it('names only conversations the reader may read: a Buddy gets the counts without the lists', () => {
diff --git a/backend/src/superTabs/read/views.ts b/backend/src/superTabs/read/views.ts
index 3afec997f..574b4a0f9 100644
--- a/backend/src/superTabs/read/views.ts
+++ b/backend/src/superTabs/read/views.ts
@@ -195,8 +195,15 @@ function derive(state: SuperTabState, visible: SuperTabState, actor: Actor, now:
...(Object.keys(suspended).length ? { suspendedEngines: suspended } : {}), ...(machineSuspended ? { machineSuspended } : {}), ...(leads[pool.machineId] ? { lead: leads[pool.machineId] } : {}) }] as const
}
const pulse = pulses(state, visible, actor, isBuddyReader(state, actor))
+ // The next release times the settle recorded (releases.ts), for the projects this reader sees: the release list itself stays
+ // the server's (task #3827).
+ const releaseTimes = Object.fromEntries(visible.projects?.flatMap(seen => {
+ const nextAt = state.projects?.find(p => p.id === seen.id)?.releases?.nextAt
+ return nextAt ? [[seen.id, nextAt] as const] : []
+ }) ?? [])
return {
...(pulse ? { pulse } : {}),
+ ...(Object.keys(releaseTimes).length ? { releaseTimes } : {}),
agents: Object.fromEntries(visible.agents.map(seen => [seen.id, { downSince: seen.downSince ?? null, limitedUntil: seen.limitedUntil ?? null,
workDecision: seen.workDecision === 'awaiting' && state.agents.find(a => a.id === seen.id)!.workDecision !== 'awaiting' ? 'awaiting' as const : null,
roleId: seen.roleId ?? null,
diff --git a/backend/src/superTabs/releases.test.ts b/backend/src/superTabs/releases.test.ts
index 877430ee1..99455bb0c 100644
--- a/backend/src/superTabs/releases.test.ts
+++ b/backend/src/superTabs/releases.test.ts
@@ -3,7 +3,7 @@ import type { Agent, Conversation, SuperTabState } from './model.js'
import type { SwarmProject } from './projects.js'
import { missingContract } from './taskContract.js'
import { backendPaused, compareTags, componentsOf, inReleaseWindow, isReleaseTag, notePendingRelease, PENDING_MAX, RELEASE_COMPONENTS, RELEASE_RULES,
- ledgerGroupIds, pendingKey, releaseDue, settleReleases, PENDING_MS, shipped, waitingFor, type PendingRelease, type ReleaseLedger } from './releases.js'
+ ledgerGroupIds, nextReleaseAt, pendingKey, releaseDue, settleReleases, PENDING_MS, shipped, waitingFor, type PendingRelease, type ReleaseLedger } from './releases.js'
/** A time in Vietnam (UTC+7, no daylight saving) on 6 November 2026. */
const vn = (hour: number, minute = 0) => Date.UTC(2026, 10, 6, hour - 7, minute)
@@ -87,6 +87,41 @@ describe('releaseDue', () => {
})
})
+describe('nextReleaseAt', () => {
+ const DAY = 24 * 60 * MINUTE
+ const backendLast = (at: number): ReleaseLedger => ledger({ pending: [entry({ components: ['backend'] })], last: { backend: { tag: 'v1.4.16_backend', sha: 'abc', at } } })
+
+ it('is 0 when a release may open now, so the read does not change with the clock', () => {
+ expect(nextReleaseAt(ledger(), 'desktop', vn(11), RELEASE_RULES)).toBe(0)
+ expect(nextReleaseAt(ledger(), 'backend', vn(11), RELEASE_RULES)).toBe(0)
+ })
+
+ it('is the window\'s start before it, and the next day\'s after it', () => {
+ expect(nextReleaseAt(ledger(), 'desktop', vn(8, 30), RELEASE_RULES)).toBe(vn(9))
+ expect(nextReleaseAt(ledger(), 'desktop', vn(18), RELEASE_RULES)).toBe(vn(9) + DAY)
+ expect(nextReleaseAt(ledger(), 'cli', vn(23, 15), RELEASE_RULES)).toBe(vn(9) + DAY)
+ })
+
+ it('moves the backend out of its pause, and past its pace after its last release', () => {
+ expect(nextReleaseAt(ledger(), 'backend', vn(9, 30), RELEASE_RULES)).toBe(vn(10))
+ expect(nextReleaseAt(backendLast(vn(11)), 'backend', vn(11, 30), RELEASE_RULES)).toBe(vn(13))
+ // 16:00 + 120 minutes is 18:00, outside the window: the next day's window opens at 09:00 into the pause, so 10:00.
+ expect(nextReleaseAt(backendLast(vn(16)), 'backend', vn(16, 30), RELEASE_RULES)).toBe(vn(10) + DAY)
+ // Before the window the backend waits for the pause to end too.
+ expect(nextReleaseAt(ledger(), 'backend', vn(8), RELEASE_RULES)).toBe(vn(10))
+ })
+
+ it('is null for the apps when the pace leaves them to people', () => {
+ const rules = { ...RELEASE_RULES, releasePace: { ...RELEASE_RULES.releasePace, appsAfterVisibleBatch: false } }
+ expect(nextReleaseAt(ledger(), 'desktop', vn(11), rules)).toBeNull()
+ expect(nextReleaseAt(ledger(), 'backend', vn(11), rules)).toBe(0)
+ })
+
+ it('answers on the minute', () => {
+ expect(nextReleaseAt(ledger(), 'desktop', vn(8, 30) + 41_000, RELEASE_RULES)).toBe(vn(9))
+ })
+})
+
describe('shipping', () => {
it('orders release tags by version, not by when they ran', () => {
expect(compareTags('v1.3.78_desktop', 'v1.3.77_desktop')).toBeGreaterThan(0)
@@ -170,6 +205,18 @@ describe('settleReleases', () => {
const webRelease = { tag: 'v1.3.98_web', sha: 'w1', at: T - 5 * MINUTE, carries: [key12] }
const noFacts = { resolved: [], releases: {} }
+ it('records when each component may next release, and changes nothing when that has not changed (task #3827)', () => {
+ const state = swarm([entry({ groupId: 'g12', mergedAt: vn(8), components: ['desktop', 'backend'] })])
+ settleReleases(state, 'p1', noFacts, vn(8, 30))
+ expect(ledgerOf(state).nextAt).toEqual({ backend: vn(10), cli: vn(9), desktop: vn(9), web: vn(9) })
+ const before = JSON.stringify(ledgerOf(state))
+ settleReleases(state, 'p1', noFacts, vn(8, 45))
+ expect(JSON.stringify(ledgerOf(state))).toBe(before)
+ // Inside the window the apps may go at once: 0, and the backend after its pause.
+ settleReleases(state, 'p1', noFacts, vn(9, 30))
+ expect(ledgerOf(state).nextAt).toEqual({ backend: vn(10), cli: 0, desktop: 0, web: 0 })
+ })
+
it('marks a task released once every release it needs carries it, and takes it off the list', () => {
const state = swarm([entry({ groupId: 'g12', mergedAt: T - 20 * MINUTE, components: ['desktop', 'web'] })])
const group = () => state.conversations.find(c => c.id === 'g12')!
diff --git a/backend/src/superTabs/releases.ts b/backend/src/superTabs/releases.ts
index 6650fbb88..94b6618f8 100644
--- a/backend/src/superTabs/releases.ts
+++ b/backend/src/superTabs/releases.ts
@@ -84,7 +84,10 @@ export interface ReleaseStep { groupId: string; at: number; endedAt?: number }
export interface ReleaseLedger { pending: PendingRelease[]; last?: Partial<Record<ReleaseComponentId, VerifiedRelease>>; steps?: Partial<Record<ReleaseComponentId, ReleaseStep>>
/** Tasks the cap pushed off the list with no other merge left on it: the merge's write may not hold them, so the next settle
* loads them and clears their `releasing` (review of #3267). */
- leaving?: string[] }
+ leaving?: string[]
+ /** When each component's release may next open (nextReleaseAt): 0 for now, absent for one left to people. Written by the settle
+ * only when it changes, and sent to readers in `derived.releaseTimes` for the board's Merged cards (task #3827). */
+ nextAt?: Partial<Record<ReleaseComponentId, number>> }
/** The groups a settle of [ledger] loads: the tasks waiting, the open release steps, the tasks leaving. */
export const ledgerGroupIds = (ledger: ReleaseLedger): string[] =>
@@ -110,6 +113,35 @@ export function releaseDue(ledger: ReleaseLedger, component: ReleaseComponentId,
return !last || now - last.at >= rules.releasePace.backendEveryMinutes * 60_000
}
+const minutesOf = (time: string): number => Number(time.slice(0, 2)) * 60 + Number(time.slice(3, 5))
+/** Minutes from the clock time [from] to the next [to], 0 to 1439. */
+const minutesUntil = (from: string, to: string): number => (minutesOf(to) - minutesOf(from) + 1440) % 1440
+
+/**
+ * When a release of [component] may next open, as the board's Merged cards say it (task #3827): 0 when it may now (so the read
+ * does not change with the clock), else the minute it may, in ms; null for the apps when the pace leaves them to people. It is
+ * [releaseDue] without the waiting change and the open step: a merged task waits by definition. The backend's pace counts from
+ * its last verified release, and every component waits for the window, the backend also for its pause to end. The clock's own
+ * minutes carry it past a boundary; a zone that shifts its clock may need another look, so a few rounds settle it.
+ */
+export function nextReleaseAt(ledger: ReleaseLedger, component: ReleaseComponentId, now: number, rules: ReleaseRules): number | null {
+ if (component !== 'backend' && !rules.releasePace.appsAfterVisibleBatch) return null
+ let at = now
+ if (component === 'backend') {
+ const last = ledger.last?.backend
+ if (last) at = Math.max(at, last.at + rules.releasePace.backendEveryMinutes * 60_000)
+ }
+ const pause = component === 'backend' ? rules.releasePace.backendPause : null
+ for (let round = 0; round < 4; round++) {
+ const time = clock(rules, at)
+ if (!within(time, rules.releaseWindow)) at += minutesUntil(time, rules.releaseWindow.start) * 60_000
+ else if (pause && within(time, pause)) at += minutesUntil(time, pause.end) * 60_000
+ else break
+ }
+ at -= at % 60_000
+ return at <= now ? 0 : at
+}
+
/** Whether every release [entry] needs carries it: none for a change that only tests or documents. */
export const shipped = (entry: PendingRelease): boolean => !!entry.components && entry.components.every(c => !!entry.shippedIn?.[c])
@@ -251,6 +283,13 @@ export function settleReleases(state: SuperTabState, projectId: string, facts: R
if (now - step.endedAt >= STEP_GRACE_MS) delete ledger.steps![component.id]
}
+ const nextAt: Partial<Record<ReleaseComponentId, number>> = {}
+ for (const component of RELEASE_COMPONENTS) {
+ const at = nextReleaseAt(ledger, component.id, now, rules)
+ if (at !== null) nextAt[component.id] = at
+ }
+ if (JSON.stringify(ledger.nextAt) !== JSON.stringify(nextAt)) ledger.nextAt = nextAt
+
const due = RELEASE_COMPONENTS.filter(c => releaseDue(ledger, c.id, now, rules))
if (!due.length || state.paused) return outcome
const id = stableId('release-step', state.id, projectId, due.map(c => c.id).join(','), String(now))
diff --git a/backend/src/superTabs/store.ts b/backend/src/superTabs/store.ts
index d803fe85e..d69782304 100644
--- a/backend/src/superTabs/store.ts
+++ b/backend/src/superTabs/store.ts
@@ -89,7 +89,7 @@ import { activeMachineKeysOf } from '../lib/deviceKeyLog.js'
import { commitParts, indexesOf, machineContentChanged, numberMessages, type Touch, type Written } from './parts/commit.js'
import { loadDeliveryParts, ms } from './parts/light.js'
import { endSteps, ownerOf, stepEndedRows, stepsOf } from './steps.js'
-import { pullRequestEvents, readPullRequestsNow, type PullRequestReader, type PullRequestWatch, type TaskHeads } from './pullRequestEvents.js'
+import { checksStateOf, pullRequestEvents, readPullRequestsNow, type PullRequestReader, type PullRequestWatch, type TaskHeads } from './pullRequestEvents.js'
import { deriveCheck, keepHead, refreshChecks, watchedLinks } from './checkVerdicts.js'
import { reopenOnEvents } from './handed.js'
import type { TrainTask } from './mergeTrain/plan.js'
@@ -5244,14 +5244,19 @@ export class SuperTabStore {
refreshChecks(checked.checks, watch.url, newHead ? known : undefined, group.pullRequestHeads)
}
}
+ // What the board says of its checks (task #3827): recorded with the head, even for a done task, and only when it changed.
+ const checks = checksStateOf(watch), checksMoved = group.pullRequestChecks?.[watch.url] !== checks
+ // Of the links it still has: a state of a pull request the task dropped goes with the link.
+ if (checksMoved) group.pullRequestChecks = Object.fromEntries(Object.entries({ ...group.pullRequestChecks, [watch.url]: checks })
+ .filter(([url]) => group.pullRequestUrls!.includes(url)))
if (done) {
- if (!newHead && !repatched) return 0
+ if (!newHead && !repatched && !checksMoved) return 0
await this.save(tx, loaded, state, clock.next())
return 0
}
const seen = group.pullRequestEvents?.[watch.url] ?? []
const { events: seenEvents, keys } = pullRequestEvents(watch, seen, botLogin, now)
- if (!newHead && !repatched && keys.length === seen.length && keys.every((key, i) => key === seen[i])) return 0
+ if (!newHead && !repatched && !checksMoved && keys.length === seen.length && keys.every((key, i) => key === seen[i])) return 0
group.pullRequestEvents = { ...group.pullRequestEvents, [watch.url]: keys }
// CI failing or a conflict brings a handed task back to its Engineer, in the message that tells it (handed.ts, #3399).
const events = reopenOnEvents(group, seenEvents, now)
diff --git a/desktop/lib/super_tabs/model.dart b/desktop/lib/super_tabs/model.dart
index 5576dab5b..95f490513 100644
--- a/desktop/lib/super_tabs/model.dart
+++ b/desktop/lib/super_tabs/model.dart
@@ -427,6 +427,13 @@ class SuperTabConversation {
releasing = row['releasing'] is List
? List.unmodifiable((row['releasing'] as List).whereType<String>())
: null,
+ pullRequestChecks = row['pullRequestChecks'] is Map
+ ? Map.unmodifiable({
+ for (final MapEntry(:key, :value)
+ in (row['pullRequestChecks'] as Map).entries)
+ if (key is String && value is String) key: value,
+ })
+ : const {},
releasedTags = row['released'] is Map && row['released']['tags'] is List
? List.unmodifiable(
(row['released']['tags'] as List).whereType<String>(),
@@ -555,6 +562,10 @@ class SuperTabConversation {
/// an older server: each reads as released, as it did.
final List<String>? releasing;
+ /// Each linked pull request's check state as the server's PR watch last read it, by URL: `green`, `red` or `running`
+ /// (backend pullRequestEvents.ts checksStateOf, task #3827). Empty before the watch reads one, and from an older server.
+ final Map<String, String> pullRequestChecks;
+
/// The release tags (`v1.3.84_desktop`) that carried it to people, once they
/// have (backend releases.ts `released`): what Shipped names. Empty before,
/// for work merged before the server recorded releases, and from an older
@@ -1045,6 +1056,15 @@ class SuperTabSnapshot {
activityDigest = row['activityDigest'] as String?,
remindersDigest = row['remindersDigest'] as String?,
_pulses = SuperTabPulse.readAll(row['pulse']),
+ _releaseTimes = {
+ if (row['releaseTimes'] case final Map projects)
+ for (final MapEntry(key: project, value: times) in projects.entries)
+ if (project is String && times is Map)
+ project: {
+ for (final MapEntry(key: part, value: at) in times.entries)
+ if (part is String && at is num) part: at.toInt(),
+ },
+ },
chatSettings = Map.unmodifiable({
if (row['chatSettings'] case final Map settings)
for (final MapEntry(:key, :value) in settings.entries)
@@ -1201,6 +1221,12 @@ class SuperTabSnapshot {
SuperTabPulse? pulseOf(String projectId) => _pulses[projectId];
final Map<String, SuperTabPulse> _pulses;
+ /// When each release part (`desktop`, `cli`, `web`, `backend`) of [projectId] may next open, in ms: 0 is now, and a part
+ /// left to people has none (backend releases.ts nextReleaseAt, task #3827). Empty from an older server.
+ Map<String, int> releaseTimesOf(String projectId) =>
+ _releaseTimes[projectId] ?? const {};
+ final Map<String, Map<String, int>> _releaseTimes;
+
/// The reader's own notification setting by conversation (backend chatSettings.ts); a chat not listed is at
/// [SuperTabNotify.mentions]. Never another person's.
final Map<String, SuperTabNotify> chatSettings;
diff --git a/desktop/lib/super_tabs/parts.dart b/desktop/lib/super_tabs/parts.dart
index 7ccaac1ca..0b7b829f2 100644
--- a/desktop/lib/super_tabs/parts.dart
+++ b/desktop/lib/super_tabs/parts.dart
@@ -499,6 +499,10 @@ class SuperTabParts {
}
// Each project's board pulse (backend superTabs/pulse.ts, task #3384).
if (_derived['pulse'] case final Map pulse) state['pulse'] = pulse;
+ // When each release may next open, per project (backend releases.ts nextReleaseAt, task #3827).
+ if (_derived['releaseTimes'] case final Map times) {
+ state['releaseTimes'] = times;
+ }
// Sent only where the server does not try Harness Team accounts yet.
if (_derived['teamAccounts'] == false) state['teamAccounts'] = false;
// Sent by a server that takes a thread reply's New session.
diff --git a/desktop/lib/super_tabs/task_groups.dart b/desktop/lib/super_tabs/task_groups.dart
index 2e9c85209..f6b4bc2a9 100644
--- a/desktop/lib/super_tabs/task_groups.dart
+++ b/desktop/lib/super_tabs/task_groups.dart
@@ -1,3 +1,5 @@
+import 'dart:math' as math;
+
import 'package:collection/collection.dart';
import 'attention.dart';
@@ -121,6 +123,40 @@ bool superTabMergeOverdue(SuperTabConversation task, DateTime now) =>
!superTabTaskShipped(task) &&
(superTabMergeWait(task, now) ?? Duration.zero) > superTabMergeWarnAfter;
+/// A task's checks as the server recorded them for the pull requests it still links, the worst first: `red`, then `running`,
+/// then `green`; null when it recorded none (an older server, or the watch has not read one).
+String? _checksOf(SuperTabConversation task) {
+ final states = {
+ for (final url in task.pullRequestUrls)
+ if (task.pullRequestChecks[url] case final state?
+ when const {'red', 'running', 'green'}.contains(state))
+ state,
+ };
+ return const ['red', 'running', 'green'].firstWhereOrNull(states.contains);
+}
+
+/// When the next release of any of [parts] may open, as the Merged card says it, in the reader's time: "about 15:30", with
+/// "tomorrow" or the date for another day, and "due now" when it may already; null when none of them has a time.
+String? _nextRelease(List<String> parts, Map<String, int> times, DateTime now) {
+ final known = [for (final part in parts) ?times[part]];
+ if (known.isEmpty) return null;
+ final first = known.reduce(math.min);
+ if (first <= now.millisecondsSinceEpoch) return 'next release due now';
+ final at = DateTime.fromMillisecondsSinceEpoch(first);
+ String two(int n) => n.toString().padLeft(2, '0');
+ final day = DateTime(
+ at.year,
+ at.month,
+ at.day,
+ ).difference(DateTime(now.year, now.month, now.day)).inDays;
+ final when = switch (day) {
+ 0 => '',
+ 1 => ' tomorrow',
+ _ => ' ${_months[at.month - 1]} ${at.day}',
+ };
+ return 'next release about ${two(at.hour)}:${two(at.minute)}$when';
+}
+
String _waited(Duration wait) {
final (hours, minutes) = (wait.inHours, wait.inMinutes % 60);
return hours == 0
@@ -142,6 +178,7 @@ SuperTabTaskPlace? superTabTaskPlaceOf(
int mentions = 0,
int needsHuman = 0,
String? Function(String personId)? personName,
+ Map<String, int> releaseTimes = const {},
}) {
final assignment = task.assignment;
final status = assignment?['status'];
@@ -163,9 +200,12 @@ SuperTabTaskPlace? superTabTaskPlaceOf(
// waits for one, whatever else the task is (it is often closed already).
if (superTabTaskReleasing(task)) {
final parts = _parts(task.releasing!);
+ final next = _nextRelease(task.releasing!, releaseTimes, now);
return at(
SuperTabTaskColumn.merged,
- parts.isEmpty ? 'waiting for a release' : 'waiting for $parts',
+ parts.isEmpty
+ ? 'waiting for a release'
+ : ['waiting for $parts', ?next].join(' · '),
);
}
// Shipped means released; finished with nothing to merge is Done (#2872).
@@ -187,13 +227,18 @@ SuperTabTaskPlace? superTabTaskPlaceOf(
return null;
}
if (status == 'done') {
+ // Red checks put it back in Working: Done is waiting to merge, with the checks green (task #3827).
+ final checks = _checksOf(task);
+ if (checks == 'red') return mark('CI red');
final wait = superTabMergeWait(task, now);
- return at(
- SuperTabTaskColumn.done,
- wait == null
- ? 'waiting to merge'
- : 'waiting to merge for ${_waited(wait)}',
- );
+ final waited = wait == null ? null : _waited(wait);
+ return at(SuperTabTaskColumn.done, switch (checks) {
+ 'green' =>
+ 'green, ${waited == null ? 'waiting to merge' : 'waiting $waited'}',
+ 'running' =>
+ 'CI running, ${waited == null ? 'waiting to merge' : 'waiting $waited'}',
+ _ => waited == null ? 'waiting to merge' : 'waiting to merge for $waited',
+ });
}
if (assignment == null) {
final date = task.notBefore;
@@ -270,6 +315,7 @@ Map<SuperTabTaskColumn, List<SuperTabTaskEntry>> superTabTaskBoard(
int Function(SuperTabConversation task)? mentions,
int Function(SuperTabConversation task)? needsHuman,
String? Function(String personId)? personName,
+ Map<String, int> releaseTimes = const {},
}) {
final board = {
for (final column in SuperTabTaskColumn.values)
@@ -303,6 +349,7 @@ Map<SuperTabTaskColumn, List<SuperTabTaskEntry>> superTabTaskBoard(
// A closed task's agent asks nothing: only open ones are asked.
needsHuman: task.closed ? 0 : needsHuman?.call(task) ?? 0,
personName: personName,
+ releaseTimes: releaseTimes,
);
if (place == null) continue;
board[place.column]!.add((
@@ -376,5 +423,6 @@ Map<SuperTabTaskColumn, List<SuperTabTaskEntry>> superTabProjectBoard(
mentions: (task) => tags.mentionsIn(task.id),
needsHuman: needsHuman,
personName: (id) => people[id],
+ releaseTimes: c.snapshot?.releaseTimesOf(project.id) ?? const {},
);
}
diff --git a/desktop/test/super_tab_task_columns_test.dart b/desktop/test/super_tab_task_columns_test.dart
index e84a5e805..1f7375bdf 100644
--- a/desktop/test/super_tab_task_columns_test.dart
+++ b/desktop/test/super_tab_task_columns_test.dart
@@ -18,6 +18,8 @@ SuperTabConversation _task({
DateTime? shippedAt,
num? queueRank,
String? notBefore,
+ Map<String, String>? checks,
+ String? alsoLinked,
}) => SuperTabConversation.fromJson({
...conversationFixture(id, 'Task $id'),
'number': number,
@@ -25,7 +27,7 @@ SuperTabConversation _task({
if (status != null)
'assignment': {'agentId': 'a1', 'status': status, 'progressAt': 1},
'liveness': ?liveness,
- if (linked || merged) 'pullRequestUrls': [_pr],
+ if (linked || merged) 'pullRequestUrls': [_pr, ?alsoLinked],
if (linked || merged)
'cards': {
'pullRequests': [
@@ -35,6 +37,7 @@ SuperTabConversation _task({
if (shippedAt != null) 'shippedAt': shippedAt.millisecondsSinceEpoch,
'queueRank': ?queueRank,
'notBefore': ?notBefore,
+ 'pullRequestChecks': ?checks,
});
Map<String, dynamic> _waiting(String why, {String? personId}) => {
@@ -48,12 +51,14 @@ SuperTabTaskPlace? _place(
SuperTabConversation task, {
int mentions = 0,
int needsHuman = 0,
+ Map<String, int> releaseTimes = const {},
}) => superTabTaskPlaceOf(
task,
readerId: 'me',
now: _now,
mentions: mentions,
needsHuman: needsHuman,
+ releaseTimes: releaseTimes,
personName: (id) => const {'ken': 'Ken', 'me': 'Dee'}[id],
);
@@ -259,6 +264,128 @@ void main() {
}
});
+ // Task #3827: the server records each linked pull request's check state and each component's next release time.
+ group('what the server says of checks and releases', () {
+ SuperTabConversation done(Map<String, String> checks, {int minutes = 12}) =>
+ _task(
+ status: 'done',
+ linked: true,
+ checks: checks,
+ shippedAt: _now.subtract(Duration(minutes: minutes)),
+ );
+
+ test('a done task says its checks and how long it has waited', () {
+ expect(_place(done({_pr: 'green'}))!.state, 'green, waiting 12 min');
+ expect(
+ _place(done({_pr: 'running'}))!.state,
+ 'CI running, waiting 12 min',
+ );
+ expect(
+ _place(done({_pr: 'green'}, minutes: 90))!.state,
+ 'green, waiting 1 h 30 min',
+ );
+ expect(_place(done({_pr: 'green'}))!.column, SuperTabTaskColumn.done);
+ });
+
+ test('a done task with no state recorded reads as before', () {
+ expect(_place(done({}))!.state, 'waiting to merge for 12 min');
+ expect(
+ _place(done({'https://github.com/acme/app/pull/99': 'green'}))!.state,
+ 'waiting to merge for 12 min',
+ );
+ });
+
+ test('red checks put a done task back in Working, as CI red', () {
+ expect(_place(done({_pr: 'red'})), (
+ column: SuperTabTaskColumn.working,
+ needsYou: false,
+ state: 'CI red',
+ ));
+ });
+
+ test('the worst state of its pull requests is the task\'s', () {
+ final two = _task(
+ status: 'done',
+ linked: true,
+ alsoLinked: 'https://github.com/acme/app/pull/13',
+ checks: {
+ _pr: 'green',
+ 'https://github.com/acme/app/pull/13': 'running',
+ },
+ shippedAt: _now.subtract(const Duration(minutes: 5)),
+ );
+ expect(_place(two)!.state, 'CI running, waiting 5 min');
+ });
+
+ SuperTabConversation releasing(List<String> parts) =>
+ SuperTabConversation.fromJson({
+ ...conversationFixture('t', 'Task t'),
+ 'assignment': {'agentId': 'a1', 'status': 'done'},
+ 'releasing': parts,
+ });
+ int at(int day, int hour, [int minute = 0]) =>
+ DateTime(2026, 11, day, hour, minute).millisecondsSinceEpoch;
+
+ test(
+ 'a merged task says when the next release is due, in the reader\'s time',
+ () {
+ final times = {'desktop': at(4, 15, 30), 'cli': at(4, 15, 30)};
+ expect(
+ _place(releasing(['desktop', 'cli']), releaseTimes: times)!.state,
+ 'waiting for Desktop, CLI · next release about 15:30',
+ );
+ expect(
+ _place(releasing(['desktop']), releaseTimes: times)!.column,
+ SuperTabTaskColumn.merged,
+ );
+ },
+ );
+
+ test(
+ 'it names the earliest of the parts it waits for, and now as due now',
+ () {
+ final times = {'desktop': at(4, 15, 30), 'cli': at(4, 11)};
+ expect(
+ _place(releasing(['desktop', 'cli']), releaseTimes: times)!.state,
+ 'waiting for Desktop, CLI · next release about 11:00',
+ );
+ expect(
+ _place(releasing(['desktop']), releaseTimes: {'desktop': 0})!.state,
+ 'waiting for Desktop · next release due now',
+ );
+ },
+ );
+
+ test('tomorrow and later days say so', () {
+ expect(
+ _place(
+ releasing(['backend']),
+ releaseTimes: {'backend': at(5, 9)},
+ )!.state,
+ 'waiting for Backend · next release about 09:00 tomorrow',
+ );
+ expect(
+ _place(
+ releasing(['backend']),
+ releaseTimes: {'backend': at(9, 9)},
+ )!.state,
+ 'waiting for Backend · next release about 09:00 Nov 9',
+ );
+ });
+
+ test('no time for its parts, or none known, reads as before', () {
+ expect(_place(releasing(['desktop']))!.state, 'waiting for Desktop');
+ expect(
+ _place(releasing(['desktop']), releaseTimes: {'cli': at(4, 15)})!.state,
+ 'waiting for Desktop',
+ );
+ expect(
+ _place(releasing([]), releaseTimes: {'desktop': at(4, 15)})!.state,
+ 'waiting for a release',
+ );
+ });
+ });
+
test('a tag of the reader marks the task in its own column', () {
expect(_place(_task(), mentions: 1), (
column: SuperTabTaskColumn.nextUp,
diff --git a/desktop/test/super_tab_tasks_shots_test.dart b/desktop/test/super_tab_tasks_shots_test.dart
index 5106f679d..d04dcb56d 100644
--- a/desktop/test/super_tab_tasks_shots_test.dart
+++ b/desktop/test/super_tab_tasks_shots_test.dart
@@ -104,6 +104,21 @@ void main() {
status: 'done',
pullRequest: 3500,
shippedAt: DateTime.now().subtract(const Duration(minutes: 12)),
+ checks: {
+ 'https://github.com/autonomous-ai/openharness/pull/3500': 'green',
+ },
+ ),
+ taskFixture(
+ 'done-red',
+ 'Checks failed after review',
+ 27,
+ requester: 'owner',
+ status: 'done',
+ pullRequest: 3502,
+ shippedAt: DateTime.now().subtract(const Duration(minutes: 5)),
+ checks: {
+ 'https://github.com/autonomous-ai/openharness/pull/3502': 'red',
+ },
),
taskFixture(
'done-stuck',
@@ -113,6 +128,9 @@ void main() {
status: 'done',
pullRequest: 3501,
shippedAt: DateTime.now().subtract(const Duration(minutes: 90)),
+ checks: {
+ 'https://github.com/autonomous-ai/openharness/pull/3501': 'green',
+ },
),
taskFixture(
'merged-two',
@@ -151,6 +169,20 @@ void main() {
},
),
]);
+ // What the server sends in `derived.releaseTimes` (task #3827): the apps may release in two hours, the backend later.
+ server.state['releaseTimes'] = {
+ 'lead': {
+ 'desktop': DateTime.now()
+ .add(const Duration(hours: 2))
+ .millisecondsSinceEpoch,
+ 'cli': DateTime.now()
+ .add(const Duration(hours: 2))
+ .millisecondsSinceEpoch,
+ 'backend': DateTime.now()
+ .add(const Duration(hours: 4))
+ .millisecondsSinceEpoch,
+ },
+ };
final conversations = (server.state['conversations'] as List)
.cast<Map<String, dynamic>>();
conversations.firstWhere((task) => task['id'] == 'sender')['liveness'] =
diff --git a/desktop/test/super_tab_tasks_view_test.dart b/desktop/test/super_tab_tasks_view_test.dart
index f841ee606..2547a8a6b 100644
--- a/desktop/test/super_tab_tasks_view_test.dart
+++ b/desktop/test/super_tab_tasks_view_test.dart
@@ -27,6 +27,7 @@ Map<String, dynamic> taskFixture(
DateTime? shippedAt,
List<String>? releasing,
Map<String, dynamic>? released,
+ Map<String, String>? checks,
}) => {
...conversationFixture(id, title),
'projectId': 'lead',
@@ -56,6 +57,7 @@ Map<String, dynamic> taskFixture(
if (shippedAt != null) 'shippedAt': shippedAt.millisecondsSinceEpoch,
'releasing': ?releasing,
'released': ?released,
+ 'pullRequestChecks': ?checks,
};
/// The project of the mockup Dee confirmed: a proposal, two tasks nobody is on
@@ -1030,6 +1032,92 @@ void main() {
await _close(tester, c);
});
+ testWidgets(
+ 'a done task says its checks, red ones return it to Working, and a merged '
+ 'one says when the next release is due (task #3827)',
+ (tester) async {
+ final server = tasksServer();
+ String pr(int n) =>
+ 'https://github.com/autonomous-ai/openharness/pull/$n';
+ (server.state['conversations'] as List).addAll(<Map<String, dynamic>>[
+ taskFixture(
+ 'green-done',
+ 'Checks passed',
+ 40,
+ requester: 'owner',
+ status: 'done',
+ pullRequest: 3600,
+ shippedAt: _now.subtract(const Duration(minutes: 12)),
+ checks: {pr(3600): 'green'},
+ ),
+ taskFixture(
+ 'stale-green',
+ 'Green for a while',
+ 41,
+ requester: 'owner',
+ status: 'done',
+ pullRequest: 3601,
+ shippedAt: _now.subtract(const Duration(minutes: 90)),
+ checks: {pr(3601): 'green'},
+ ),
+ taskFixture(
+ 'red-done',
+ 'Checks failed',
+ 42,
+ requester: 'owner',
+ status: 'done',
+ pullRequest: 3602,
+ shippedAt: _now.subtract(const Duration(minutes: 5)),
+ checks: {pr(3602): 'red'},
+ ),
+ taskFixture(
+ 'merged-soon',
+ 'Waiting for Desktop',
+ 43,
+ requester: 'owner',
+ status: 'done',
+ pullRequest: 3603,
+ merged: true,
+ shippedAt: _now.subtract(const Duration(minutes: 30)),
+ releasing: ['desktop'],
+ ),
+ ]);
+ // What the server sends in `derived.releaseTimes`: Desktop may release at 15:30 today.
+ server.state['releaseTimes'] = {
+ 'lead': {
+ 'desktop': DateTime(2026, 11, 4, 15, 30).millisecondsSinceEpoch,
+ },
+ };
+ final c = await _show(tester, server);
+ Finder line(String id, String text) =>
+ find.descendant(of: _card(id), matching: find.textContaining(text));
+ expect(
+ _cardsIn(tester, 'done'),
+ containsAll(['green-done', 'stale-green']),
+ );
+ expect(line('green-done', 'green, waiting 12 min'), findsOneWidget);
+ expect(
+ tester
+ .widget<Text>(line('green-done', 'green, waiting 12 min'))
+ .style
+ ?.color,
+ isNot(grid.AppPalette.warn),
+ );
+ final stale = line('stale-green', 'green, waiting 1 h 30 min');
+ expect(stale, findsOneWidget);
+ expect(tester.widget<Text>(stale).style?.color, grid.AppPalette.warn);
+ expect(_cardsIn(tester, 'working'), contains('red-done'));
+ expect(_cardsIn(tester, 'done'), isNot(contains('red-done')));
+ expect(line('red-done', 'CI red'), findsOneWidget);
+ expect(_cardsIn(tester, 'merged'), contains('merged-soon'));
+ expect(
+ line('merged-soon', 'waiting for Desktop · next release about 15:30'),
+ findsOneWidget,
+ );
+ await _close(tester, c);
+ },
+ );
+
testWidgets(
'a released task is under Shipped with its version (task #3812)',
(tester) async {
diff --git a/desktop/test/support/super_tab_fixture.dart b/desktop/test/support/super_tab_fixture.dart
index d1b81d85a..58a32ee05 100644
--- a/desktop/test/support/super_tab_fixture.dart
+++ b/desktop/test/support/super_tab_fixture.dart
@@ -195,6 +195,7 @@ class SwarmPartsBackend {
'otherProjectsWork': state['otherProjectsWork'],
// Each project's board pulse (backend superTabs/pulse.ts, task #3384).
if (state['pulse'] != null) 'pulse': state['pulse'],
+ if (state['releaseTimes'] != null) 'releaseTimes': state['releaseTimes'],
if (state['avatars'] != null) 'avatars': state['avatars'],
// Only where the server does not try Team accounts (backend read/views.ts).
if (state['teamAccounts'] == false) 'teamAccounts': false,
diff --git a/docs/plans/2026-11-06-board-ci-and-release-time-plan.md b/docs/plans/2026-11-06-board-ci-and-release-time-plan.md
new file mode 100644
index 000000000..99d841a16
--- /dev/null
+++ b/docs/plans/2026-11-06-board-ci-and-release-time-plan.md
@@ -0,0 +1,109 @@
+# Board cards show CI state and the next release time: implementation plan
+
+> Written by the project's Engineer way of working (project instructions, Engineer): plan first, then each task test first,
+> the failing test committed before its code. No Execution Handoff.
+
+**Goal:** A Done card on the Tasks board says whether its pull request's checks are green and how long it has waited to merge,
+and a Merged card says when the next release is due (task #3827, requested by Dee through Harness; split from #3812, which
+shipped the six columns without these two facts).
+
+**Architecture:** The server already reads each open or done task's pull request every minute for the PR watch
+(`pullRequestEvents.ts`, #3731's throttle) and settles each project's release list with its rules and the last releases
+(`releases.ts settleReleases`). Both write what they already know into the Swarm's own state, so the board's changes feed
+carries it and nothing reads GitHub per board load:
+- the watch records one state per linked pull request, `green`, `red` or `running`, on the task (`pullRequestChecks`), derived by
+ the same rule it uses to post "CI failed" and "CI passed", written only when it changes;
+- the settle records the next time each component's release may open (`nextAt`) on the project's release list, derived by
+ `nextReleaseAt` from the window, the pace, the backend's pause and its last verified release, written only when it changes;
+ the read sends the visible projects' times in `derived.releaseTimes`.
+Desktop reads both: Done reads "green, waiting 12 min" (a warning past an hour; red CI puts the task back in Working as "CI red"),
+Merged reads "next release about 15:30" in the reader's local time.
+
+**Tech Stack:** TypeScript backend (vitest unit tests, the Super Tab integration suite in PR CI), Dart and Flutter Desktop.
+
+**Spec:** Task #3827's brief; the Task Board table of docs/plans/2026-11-06-buddy-board-final-spec.md; docs/plans/2026-11-03-pr-events-to-engineer-plan.md
+and docs/plans/2026-11-05-release-schedule-plan.md.
+
+## Global Constraints
+
+- PR body first line: "Requested by dee through Harness."
+- Owns `backend/src/superTabs/`, `desktop/lib/super_tabs/` and `desktop/test/`.
+- No extra GitHub read per board load: nothing new is asked of GitHub; the PR watch's existing read is reused.
+- Fields are only added. An older Desktop ignores them; a newer Desktop with an older backend shows what it showed.
+- Desktop tests use a memory store and a fake sign-in. No fixed sleeps.
+
+## Design
+
+- growth: one short state per linked pull request, replaced in place and dropped with the link; one number per component per
+ project, replaced in place. Both die with the task or project. Bounded by the existing link and component limits.
+- concurrency: the PR watch's write already runs in the task's transaction (`pullRequestSeen`); the release settle's in the
+ project's (`settleReleases`). No new lock; each field is set inside the write that already holds it, and only when it differs.
+- read cost: no query is added and nothing is read from GitHub. The state comes from the read the watch already made this pass,
+ the times from the rules the settle already loaded. The board's read sends the stored values; `derived.releaseTimes` is a small
+ map built from the head's project records the read already holds, with no store read.
+- scale: 10x tasks adds a field to each linked task's part, unchanged unless its checks change (a few times per head). The warning
+ metric is the part-write rate of `pullRequestSeen`, which does not rise when nothing changed (it already returns early).
+- compatibility: backend first. Absent fields mean unknown: Desktop shows the waiting time alone, as in #3812. The server keeps no
+ contract it must not change: both fields are new and optional.
+- migration and rollback: none to run; a task gets its state at the next watch pass, a project its times at the next settle.
+ Rolling back the backend leaves the fields in stored state, ignored by the older code; rolling back Desktop shows the old lines.
+- audience: the same as the task: the field is on the task part the reader may read; `derived.releaseTimes` is sent only for
+ projects the reader sees, and holds no task, name or content.
+- identity: nothing acts as a person; the watch and the settle are the Swarm's own workers.
+- failure: a pull request the watch cannot read keeps its last state until it can; a project with no rules saved uses the seed's.
+ Nothing breaks without a line: unknown shows the plain wait.
+- platforms: backend; Desktop (macOS, Linux, Windows, web share the Dart path).
+
+## Review Focus
+
+- `green` only when every check run of the head is completed and passed and every suite with runs is completed (the rule that
+ already posts "CI passed"); a draft or a pull request GitHub is still computing is `running`, never `green`.
+- `nextReleaseAt` never answers a time inside the backend's pause or outside the window; a time already allowed is 0, so the read
+ does not change every minute.
+- Nothing new is written when the state or the time did not change.
+
+## Task 1: the next release time (backend)
+
+**Files:** `backend/src/superTabs/releases.ts`, `backend/src/superTabs/releases.test.ts`.
+
+**Interfaces:** `nextReleaseAt(ledger, component, now, rules): number | null` (0: allowed now; null: this pace releases it by hand);
+`ReleaseLedger.nextAt?: Partial<Record<ReleaseComponentId, number>>`.
+
+- [ ] Failing tests: allowed now is 0; before the window it is the window's start the same day; after it, the next day's; inside the
+ backend's pause it is the pause's end; within the backend's pace of its last release it is that release plus the pace, moved into the
+ window; apps with `appsAfterVisibleBatch` false are null; settle records `nextAt` and writes nothing when it did not change.
+- [ ] Implement `nextReleaseAt` and set `ledger.nextAt` at the end of `settleReleases`. Commit.
+
+## Task 2: the times in the read (backend)
+
+**Files:** `backend/src/superTabs/read/contract.ts`, `read/views.ts`, `read/views.test.ts`.
+
+- [ ] Failing test: `derived.releaseTimes` holds each visible project's `nextAt` and nothing for a project the reader does not see
+ or one with none.
+- [ ] Add `Derived.releaseTimes` and build it in `derive`. Commit.
+
+## Task 3: the pull request's check state (backend)
+
+**Files:** `backend/src/superTabs/pullRequestEvents.ts`, `pullRequestEvents.test.ts`, `model.ts`, `store.ts`,
+`backend/integration/superTabPullRequestEvents.test.ts`.
+
+**Interfaces:** `checksStateOf(watch): 'green' | 'red' | 'running'`; `Conversation.pullRequestChecks?: Record<string, ...>`.
+
+- [ ] Failing tests: all runs passed and suites completed is green; any failed run is red; a draft, runs still going or none read is
+ running; the same rule that posts "CI passed". Integration: the watch records the state on an open task and on a done one, changes
+ it when the head's checks change, and writes nothing when they did not.
+- [ ] Implement `checksStateOf`; in `pullRequestSeen` set the state (also for a done task, which returns early today); drop states of
+ links no longer watched. Commit.
+
+## Task 4: Desktop reads both and the cards say them
+
+**Files:** `desktop/lib/super_tabs/model.dart`, `parts.dart`, `task_groups.dart`, `tasks_view.dart`, tests under `desktop/test/`.
+
+- [ ] Failing tests: a done task whose state is green reads "green, waiting 12 min" and turns to a warning past an hour; running reads
+ "CI running, waiting 12 min"; red is in Working as "CI red"; unknown reads as before. A merged task reads "next release about 15:30"
+ from its parts' times (the earliest), "next release due now" at 0, and as before with none.
+- [ ] Parse `pullRequestChecks` and `derived.releaseTimes`; place and caption by them. Commit.
+
+## Task 5: screenshots and evidence
+
+- [ ] Light and dark screenshots of the board with the new lines; red/green and the integration run in the pull request.
diff --git a/mobile/lib/swarm/model.dart b/mobile/lib/swarm/model.dart
index b53818585..54793532a 100644
--- a/mobile/lib/swarm/model.dart
+++ b/mobile/lib/swarm/model.dart
@@ -429,6 +429,13 @@ class SuperTabConversation {
releasing = row['releasing'] is List
? List.unmodifiable((row['releasing'] as List).whereType<String>())
: null,
+ pullRequestChecks = row['pullRequestChecks'] is Map
+ ? Map.unmodifiable({
+ for (final MapEntry(:key, :value)
+ in (row['pullRequestChecks'] as Map).entries)
+ if (key is String && value is String) key: value,
+ })
+ : const {},
releasedTags = row['released'] is Map && row['released']['tags'] is List
? List.unmodifiable(
(row['released']['tags'] as List).whereType<String>(),
@@ -509,6 +516,10 @@ class SuperTabConversation {
/// it for its board; the phone carries it as the desktop does).
final List<String>? releasing;
+ /// Each linked pull request's check state as the server's PR watch last read it, by URL: `green`, `red` or `running`
+ /// (backend pullRequestEvents.ts checksStateOf, task #3827). Read as the desktop does; the phone draws no board yet.
+ final Map<String, String> pullRequestChecks;
+
/// The release tags that carried it to people, once they have (backend releases.ts `released`); empty before. Read as the
/// desktop does; the phone draws no board yet.
final List<String> releasedTags;
@@ -949,6 +960,15 @@ class SuperTabSnapshot {
mentionsWaiting = (row['mentionsWaiting'] as num?)?.toInt() ?? 0,
mentionsDigest = row['mentionsDigest'] as String?,
pulses = SuperTabPulse.readAll(row['pulse']),
+ _releaseTimes = {
+ if (row['releaseTimes'] case final Map projects)
+ for (final MapEntry(key: project, value: times) in projects.entries)
+ if (project is String && times is Map)
+ project: {
+ for (final MapEntry(key: part, value: at) in times.entries)
+ if (part is String && at is num) part: at.toInt(),
+ },
+ },
decisionsWaiting = (row['decisionsWaiting'] as num?)?.toInt() ?? 0,
decisionsDigest = row['decisionsDigest'] as String?,
promptsWaiting = List.unmodifiable([
@@ -1084,6 +1104,11 @@ class SuperTabSnapshot {
/// board draws no strip.
SuperTabPulse? pulseOf(String projectId) => pulses[projectId];
+ /// When each release part of [projectId] may next open, in ms: 0 is now (backend releases.ts nextReleaseAt, task #3827).
+ Map<String, int> releaseTimesOf(String projectId) =>
+ _releaseTimes[projectId] ?? const {};
+ final Map<String, Map<String, int>> _releaseTimes;
+
/// Decisions asked of the reader and not yet answered, Swarm-wide; 0 from a
/// backend before decisions (backend superTabs/decisions.ts).
final int decisionsWaiting;
diff --git a/mobile/lib/swarm/parts.dart b/mobile/lib/swarm/parts.dart
index 7ccaac1ca..0b7b829f2 100644
--- a/mobile/lib/swarm/parts.dart
+++ b/mobile/lib/swarm/parts.dart
@@ -499,6 +499,10 @@ class SuperTabParts {
}
// Each project's board pulse (backend superTabs/pulse.ts, task #3384).
if (_derived['pulse'] case final Map pulse) state['pulse'] = pulse;
+ // When each release may next open, per project (backend releases.ts nextReleaseAt, task #3827).
+ if (_derived['releaseTimes'] case final Map times) {
+ state['releaseTimes'] = times;
+ }
// Sent only where the server does not try Harness Team accounts yet.
if (_derived['teamAccounts'] == false) state['teamAccounts'] = false;
// Sent by a server that takes a thread reply's New session.