spur-board 0.66.0 → 0.68.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-CNZV8Ua0.mjs → chunk-AwNJBvcj.mjs} +2 -2
- package/dist/{chunk-BdO94P44.mjs → chunk-C11wvkRU.mjs} +41 -9
- package/dist/{chunk-BJMN8jrU.mjs → chunk-t6u2F3E-.mjs} +1 -1
- package/dist/cli.mjs +3 -3
- package/dist/client.mjs +1 -1
- package/dist/daemon.mjs +279 -46
- package/dist/mcp.mjs +3 -3
- package/package.json +1 -1
- package/skills/spur-board/SKILL.md +3 -4
- package/skills/spur-board/references/how-board-works.md +57 -45
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { o as CliError, t as fetchCatalogVersion } from "./chunk-
|
|
1
|
+
import { d as buildCatalogSnapshot, lt as configSchema, p as OPERATIONS, ut as plainHttpAllowed } from "./chunk-C11wvkRU.mjs";
|
|
2
|
+
import { o as CliError, t as fetchCatalogVersion } from "./chunk-t6u2F3E-.mjs";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
4
|
import { closeSync, constants, fstatSync, lstatSync, mkdirSync, openSync, readFileSync, realpathSync, renameSync, statSync, unlinkSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { homedir } from "node:os";
|
|
@@ -128,6 +128,7 @@ const GATE_CONDITIONS = [
|
|
|
128
128
|
"no_conflict",
|
|
129
129
|
"external_comments_handled",
|
|
130
130
|
"comment_history_read",
|
|
131
|
+
"threads_resolved",
|
|
131
132
|
"submit_on_head",
|
|
132
133
|
"review_on_head",
|
|
133
134
|
"approved",
|
|
@@ -306,11 +307,21 @@ const columnConfig = z.strictObject({
|
|
|
306
307
|
id: z.enum(COLUMN_IDS, { error: (issue) => typeof issue.input === "string" ? `Unknown column ${JSON.stringify(issue.input)}: custom columns arrive with custom matchers and are not supported yet. Built-in columns: ${COLUMN_IDS.join(", ")}` : void 0 }).describe("The built-in column this entry configures."),
|
|
307
308
|
enabled: z.boolean().default(true).describe("false skips the column: tasks move past it and its exit condition is not checked. todo, dev and done cannot be disabled."),
|
|
308
309
|
orchestrator: nonEmpty.default("none").describe("Who takes the column's turns. none: the task's live worker session, else the operator. operator: the operator, who also gets the questions asked in the column. Otherwise the name of a spurProjects entry with role orchestrator or curator whose sessions orchestrate the column and get the questions others ask in it."),
|
|
309
|
-
cycleLimit: z.int().min(1).default(DEFAULT_CYCLE_LIMIT).describe("How many times a task may return to Dev from this column before the board stops it for the operator. Returns by the column executor,
|
|
310
|
+
cycleLimit: z.int().min(1).default(DEFAULT_CYCLE_LIMIT).describe("How many times a task may return to Dev from this column before the board stops it for the operator. Returns by the column executor, for external comments and for unresolved review threads count, a changes-requested review included (it is an external comment, not a separate return); a conflict, red CI and a draft do not."),
|
|
310
311
|
courseCheck: z.int().min(0).default(DEFAULT_COURSE_CHECK).describe("How many returns to Dev from this column, counted as for cycleLimit, before the board holds the task and asks courseCheckTo (by default the curator, or the operator when the project has no curator) to check its course. The answer resets the count and reaches the worker as a task comment. 0 turns the check off; cycleLimit is checked first."),
|
|
311
|
-
courseCheckTo: nonEmpty.optional().describe("Who answers this column's course check: operator, the curator's name, or the name of a column orchestrator. Without it, the curator, or the operator when the project has no curator. When the addressee has no live session the question moves to the operator; a conductor that is rung and does not answer keeps it, and the operator gets an item.")
|
|
312
|
+
courseCheckTo: nonEmpty.optional().describe("Who answers this column's course check: operator, the curator's name, or the name of a column orchestrator. Without it, the curator, or the operator when the project has no curator. When the addressee has no live session the question moves to the operator; a conductor that is rung and does not answer keeps it, and the operator gets an item."),
|
|
313
|
+
requireResolvedThreads: z.boolean().optional().describe("true: a task leaves this column, and every column right of it, only when its PR has no unresolved review thread; an unresolved one sends it back to Dev, and the worker's Dev turn lists each thread. Outdated threads count; a thread counts until someone resolves it, whoever wrote it. Defaults to true on ready-to-merge and false elsewhere; allowed on dev through ready-to-merge.")
|
|
312
314
|
});
|
|
313
|
-
/**
|
|
315
|
+
/** Columns a task never leaves through the Dev gate, so they cannot require resolved threads. */
|
|
316
|
+
const NO_THREAD_GATE = /* @__PURE__ */ new Set([
|
|
317
|
+
"todo",
|
|
318
|
+
"ready-for-dev",
|
|
319
|
+
"done"
|
|
320
|
+
]);
|
|
321
|
+
/**
|
|
322
|
+
* The board rules: required columns present and enabled, resolved threads required only from Dev
|
|
323
|
+
* to Ready to Merge, built-ins in canonical order.
|
|
324
|
+
*/
|
|
314
325
|
function checkBoard(items, ctx) {
|
|
315
326
|
rejectDuplicates(items, "id", "column", ctx);
|
|
316
327
|
for (const required of REQUIRED_COLUMN_IDS) {
|
|
@@ -326,6 +337,13 @@ function checkBoard(items, ctx) {
|
|
|
326
337
|
message: `Required column ${JSON.stringify(required)} cannot be disabled`
|
|
327
338
|
});
|
|
328
339
|
}
|
|
340
|
+
items.forEach((item, i) => {
|
|
341
|
+
if (item.requireResolvedThreads === true && NO_THREAD_GATE.has(item.id)) ctx.addIssue({
|
|
342
|
+
code: "custom",
|
|
343
|
+
path: [i, "requireResolvedThreads"],
|
|
344
|
+
message: `Column ${JSON.stringify(item.id)} cannot require resolved threads: set it on a column from dev to ready-to-merge`
|
|
345
|
+
});
|
|
346
|
+
});
|
|
329
347
|
let previous = -1;
|
|
330
348
|
items.forEach((item, i) => {
|
|
331
349
|
const position = COLUMN_IDS.indexOf(item.id);
|
|
@@ -358,7 +376,7 @@ const projectSchema = z.strictObject({
|
|
|
358
376
|
branchPattern: linkPattern(DEFAULT_LINK.branchPattern, "Regular expression that starts with ^ and whose one capture group reads the issue number from a PR head branch, such as <agent>-<number>-<slug>. Branches longer than 255 characters are not matched. For a Jira project the capture group reads the issue key, such as PROJ-12, which must use one of tracker.projectKeys in any letter case; left at the default, a Jira project finds every such key in the PR head branch."),
|
|
359
377
|
titlePattern: linkPattern(DEFAULT_LINK.titlePattern, "Regular expression that starts with ^ and whose one capture group reads the issue number from a PR title, such as fix(core): #12 summary. Titles longer than 255 characters are not matched. For a Jira project the capture group reads the issue key, such as PROJ-12, which must use one of tracker.projectKeys in any letter case; left at the default, a Jira project finds every such key in the PR title.")
|
|
360
378
|
}).prefault({}).describe("How a project links a PR to its task. A github-issues project reads an issue number from PRs in tracker.repo; a Jira project reads an issue key with one of tracker.projectKeys from PRs in repos. Left at the defaults, a Jira project links every tracker.projectKeys key (such as PROJ-12, any letter case) in the PR title or head branch. Set the sources and patterns to the branch and PR title naming rules of the repos. The board does not enforce those rules; the repo enforces them through its CI title check and its agents' skills. board doctor compares these rules with recent PRs by operatorGithubLogin."),
|
|
361
|
-
operatorGithubLogin: z.string().regex(/^[A-Za-z0-9-]{1,39}$/, "Expected a GitHub login").describe("The GitHub account agents open PRs under. PR discovery in repos keeps only PRs whose author is this login. It is not necessarily the maintainer's own account: when agents push as one account and a maintainer approves as another, set the agents' account, or no PR is discovered."),
|
|
379
|
+
operatorGithubLogin: z.string().regex(/^[A-Za-z0-9-]{1,39}$/, "Expected a GitHub login").describe("The GitHub account agents open PRs under. PR discovery in repos keeps only PRs whose author is this login. It is not necessarily the maintainer's own account: when agents push as one account and a maintainer approves as another, set the agents' account, or no PR is discovered. Comments, reviews and approvals by this login or by a bot (GitHub App) are not external: they never return a task to Dev, approve External Review or block its approval. Every other account is external, the repo owner's and the human operator's included."),
|
|
362
380
|
spurProjects: z.array(spurProject).superRefine((items, ctx) => {
|
|
363
381
|
rejectDuplicates(items, "name", "spur project name", ctx);
|
|
364
382
|
let curator;
|
|
@@ -549,6 +567,7 @@ const configSchema = z.strictObject({
|
|
|
549
567
|
}).prefault({}),
|
|
550
568
|
github: z.strictObject({ reserveRemaining: z.int().min(0).default(1e3).describe("GitHub API requests to leave unused in each quota window.") }).prefault({}),
|
|
551
569
|
health: z.strictObject({
|
|
570
|
+
turnStallAfterMs: durationMs(6e5, "How long an unhealthy open-turn executor waits before a curator or operator block"),
|
|
552
571
|
errorAfterMs: durationMs(9e4, "How long a session stays in error before it is flagged"),
|
|
553
572
|
needsInputAfterMs: durationMs(12e4, "How long a session waits for input before it is flagged"),
|
|
554
573
|
idleInDevAfterMs: durationMs(18e5, "How long a worker session without an open PR, or the executor of a taken turn, waits at its prompt before it is flagged"),
|
|
@@ -1213,7 +1232,12 @@ const prFactsSchema = z.strictObject({
|
|
|
1213
1232
|
commitSha: commitShaSchema.describe("Commit the review was given on."),
|
|
1214
1233
|
submittedAt: at$2.describe("When the review was submitted.")
|
|
1215
1234
|
})).describe("The latest review of each reviewer, with the commit it was given on."),
|
|
1216
|
-
reviewThreads: z.array(z.strictObject({
|
|
1235
|
+
reviewThreads: z.array(z.strictObject({
|
|
1236
|
+
resolved: z.boolean().describe("Whether the review thread is resolved."),
|
|
1237
|
+
id: z.string().min(1).optional().describe("Node ID of the review thread; missing in facts stored by an earlier version."),
|
|
1238
|
+
url: webUrl.optional().describe("Web URL of the thread's first comment; missing in facts stored by an earlier version."),
|
|
1239
|
+
outdated: z.boolean().optional().describe("Whether the thread is on a diff line the head no longer has; missing in facts stored by an earlier version.")
|
|
1240
|
+
})).describe("Review threads on the pull request."),
|
|
1217
1241
|
reviewRequests: z.array(z.strictObject({
|
|
1218
1242
|
kind: z.enum(REVIEWER_KINDS).optional().describe("Kind of reviewer asked to review."),
|
|
1219
1243
|
id: z.string().min(1).optional().describe("Login of the user or bot, or the slug of the team."),
|
|
@@ -1556,6 +1580,7 @@ const GATE_REASONS = [
|
|
|
1556
1580
|
"mergeable_unknown",
|
|
1557
1581
|
"external_comments",
|
|
1558
1582
|
"comment_history_incomplete",
|
|
1583
|
+
"unresolved_threads",
|
|
1559
1584
|
"no_submit_on_head",
|
|
1560
1585
|
"no_review_on_head",
|
|
1561
1586
|
"not_approved",
|
|
@@ -2158,7 +2183,12 @@ const turnViewSchema = z.strictObject({
|
|
|
2158
2183
|
taken: z.strictObject({
|
|
2159
2184
|
by: actorIdSchema,
|
|
2160
2185
|
at: z.iso.datetime().describe("When the turn was taken, ISO 8601 UTC.")
|
|
2161
|
-
}).nullable().describe("Who took the turn and when; null until it is taken.")
|
|
2186
|
+
}).nullable().describe("Who took the turn and when; null until it is taken."),
|
|
2187
|
+
threads: z.array(z.strictObject({
|
|
2188
|
+
id: z.string().min(1).describe("Node ID of the review thread."),
|
|
2189
|
+
url: z.url({ protocol: /^https?$/ }).describe("Web URL of the thread's first comment."),
|
|
2190
|
+
outdated: z.boolean().describe("Whether the thread is on a diff line the head no longer has.")
|
|
2191
|
+
}).describe("One unresolved review thread.")).min(1).optional().describe("The unresolved review threads on the task's open pull request, read live, in a Dev turn of a project requiring resolved threads; absent when none, or when the pull request is closed, merged or missing. Fix or answer each thread, then resolve it.")
|
|
2162
2192
|
}).describe("A turn: the executor of a column is asked to act on a task.");
|
|
2163
2193
|
/** A turn as `task.get` shows it: who executes it, whether it was taken, and how it closed. */
|
|
2164
2194
|
const taskTurnSchema = turnViewSchema.pick({
|
|
@@ -2209,7 +2239,7 @@ const taskWhySchema = z.strictObject({
|
|
|
2209
2239
|
gates: z.array(z.strictObject({
|
|
2210
2240
|
column: z.enum(COLUMN_IDS).describe("Board column."),
|
|
2211
2241
|
enabled: z.boolean().describe("Whether the column is enabled in the project."),
|
|
2212
|
-
ok: z.boolean().describe("Whether the column's own exit conditions pass."),
|
|
2242
|
+
ok: z.boolean().describe("Whether the column's own exit conditions pass. Dev's threads_resolved counts once any enabled column requires resolved threads, while the gates left of that column ignore it."),
|
|
2213
2243
|
blockedIn: z.enum(COLUMN_IDS).nullable().describe("Leftmost enabled column at or left of this one whose exit conditions fail; null when the cumulative gate passes."),
|
|
2214
2244
|
conditions: z.array(gateConditionSchema).describe("The column's exit conditions, empty for a column without any.")
|
|
2215
2245
|
}).describe("The gate of one column.")).describe("The gate of every column, To Do to Done; empty when the pull request facts are missing."),
|
|
@@ -2474,7 +2504,8 @@ const failed = (condition, reason) => ({
|
|
|
2474
2504
|
});
|
|
2475
2505
|
/**
|
|
2476
2506
|
* The gates of a task in Review on a project with To Do, Dev, Review and Done enabled: Dev passes,
|
|
2477
|
-
* Review waits for its review on head.
|
|
2507
|
+
* Review waits for its review on head. Ready to Merge is disabled, so no column requires resolved
|
|
2508
|
+
* threads and Dev's `threads_resolved` is met.
|
|
2478
2509
|
*/
|
|
2479
2510
|
const reviewGates = [
|
|
2480
2511
|
{
|
|
@@ -2503,6 +2534,7 @@ const reviewGates = [
|
|
|
2503
2534
|
met("no_conflict"),
|
|
2504
2535
|
met("external_comments_handled"),
|
|
2505
2536
|
met("comment_history_read"),
|
|
2537
|
+
met("threads_resolved"),
|
|
2506
2538
|
met("submit_on_head")
|
|
2507
2539
|
]
|
|
2508
2540
|
},
|
|
@@ -4066,4 +4098,4 @@ function assertNever(value) {
|
|
|
4066
4098
|
throw new Error(`Unexpected value: ${JSON.stringify(value)}`);
|
|
4067
4099
|
}
|
|
4068
4100
|
//#endregion
|
|
4069
|
-
export {
|
|
4101
|
+
export { err as $, prSourceId as A, prFactsSchema as B, userIdSchema as C, AdapterError as D, eventPayloadSchemas as E, REVIEW_STATES as F, JIRA_PROJECT_KEY as G, ringMarker as H, SESSION_HEALTH_STATES as I, encodeActorId as J, REF_NUMBER as K, SESSION_STATUSES as L, sourceCursorSchema as M, trackerSourceId as N, batchSchema as O, PR_STATES as P, ERRORS as Q, isExternalAuthor as R, messageRefSchema as S, GATE_REASONS as T, sessionFactsSchema as U, prRefSchema as V, ticketFactsSchema as W, parseActorId as X, errorCodeOf as Y, parseRef as Z, renderMcpError as _, requestHashOf as a, DEFAULT_LINK as at, inboundEventSchema as b, tokenRequestStatusSchema as c, RESERVED_PROJECT as ct, buildCatalogSnapshot as d, requiredSecretKeys as dt, errorContextSchema as et, roleCanUseOperation as f, COLUMN_IDS as ft, renderJsonError as g, renderHttpProblem as h, TASK_HOLDS as ht, TOKEN_REQUEST_LIMITS as i, DEFAULT_HTTP_PORT as it, sessionTransitionSchema as j, entityRefSchema as k, BOARD_TICK_MS as l, configSchema as lt, turnHandedSchema as m, SLACK_BOT_SCOPES as mt, doctorReportSchema as n, ok as nt, tokenRequestResultSchema as o, DEFAULT_SLACK_APP_NAME as ot, OPERATIONS as p, DISPATCHER_MODES as pt, actorIdSchema as q, remoteDoctorReportSchema as r, successEnvelopeSchema as rt, tokenRequestSchema as s, DEFAULT_SLACK_COMMAND as st, assertNever as t, errorEnvelopeSchema as tt, SYSTEMD_SERVICE_SETTINGS as u, plainHttpAllowed as ut, SPACE_IDS as v, EVENT_KINDS as w, interactionRefSchema as x, conversationRefSchema as y, parseRingMarker as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Q as ERRORS, c as tokenRequestStatusSchema, et as errorContextSchema, g as renderJsonError, o as tokenRequestResultSchema, rt as successEnvelopeSchema, tt as errorEnvelopeSchema } from "./chunk-C11wvkRU.mjs";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { request } from "node:http";
|
package/dist/cli.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Q as ERRORS, a as requestHashOf, dt as requiredSecretKeys, f as roleCanUseOperation, lt as configSchema, mt as SLACK_BOT_SCOPES, p as OPERATIONS, q as actorIdSchema, r as remoteDoctorReportSchema, rt as successEnvelopeSchema, u as SYSTEMD_SERVICE_SETTINGS } from "./chunk-C11wvkRU.mjs";
|
|
2
2
|
import { t as apiBaseUrl } from "./chunk-DAMwWWmT.mjs";
|
|
3
|
-
import { a as requestTokenEnrollment, c as renderCliError, i as requestSkillReload, l as escapeTerminalControls, n as fetchTokenStatus, o as CliError, r as requestOperation, s as errorExitCode } from "./chunk-
|
|
4
|
-
import { a as memoryVerdictCache, c as loadClientConfig, d as resolveDaemonAddress, f as tokenInFolder, i as fileVerdictCache, l as loadEnrollmentConfig, n as cliPackageVersion, o as configFile, s as dataDirectory, t as checkCatalog, u as readConfiguredPort } from "./chunk-
|
|
3
|
+
import { a as requestTokenEnrollment, c as renderCliError, i as requestSkillReload, l as escapeTerminalControls, n as fetchTokenStatus, o as CliError, r as requestOperation, s as errorExitCode } from "./chunk-t6u2F3E-.mjs";
|
|
4
|
+
import { a as memoryVerdictCache, c as loadClientConfig, d as resolveDaemonAddress, f as tokenInFolder, i as fileVerdictCache, l as loadEnrollmentConfig, n as cliPackageVersion, o as configFile, s as dataDirectory, t as checkCatalog, u as readConfiguredPort } from "./chunk-AwNJBvcj.mjs";
|
|
5
5
|
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
6
6
|
import { accessSync, chmodSync, closeSync, constants, cpSync, existsSync, ftruncateSync, lstatSync, mkdirSync, openSync, readFileSync, readdirSync, readlinkSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync, writeSync } from "node:fs";
|
|
7
7
|
import { homedir, hostname, userInfo } from "node:os";
|
package/dist/client.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as requestTokenEnrollment, i as requestSkillReload, n as fetchTokenStatus, r as requestOperation, t as fetchCatalogVersion } from "./chunk-
|
|
1
|
+
import { a as requestTokenEnrollment, i as requestSkillReload, n as fetchTokenStatus, r as requestOperation, t as fetchCatalogVersion } from "./chunk-t6u2F3E-.mjs";
|
|
2
2
|
export { fetchCatalogVersion, fetchTokenStatus, requestOperation, requestSkillReload, requestTokenEnrollment };
|
package/dist/daemon.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { $ as err, A as prSourceId, B as prFactsSchema, C as userIdSchema, D as AdapterError, E as eventPayloadSchemas, F as REVIEW_STATES, G as JIRA_PROJECT_KEY, H as ringMarker, I as SESSION_HEALTH_STATES, J as encodeActorId, K as REF_NUMBER, L as SESSION_STATUSES, M as sourceCursorSchema, N as trackerSourceId, O as batchSchema, P as PR_STATES, Q as ERRORS, R as isExternalAuthor, S as messageRefSchema, T as GATE_REASONS, U as sessionFactsSchema, V as prRefSchema, W as ticketFactsSchema, X as parseActorId, Y as errorCodeOf, Z as parseRef$1, a as requestHashOf, at as DEFAULT_LINK, b as inboundEventSchema, c as tokenRequestStatusSchema, ct as RESERVED_PROJECT, d as buildCatalogSnapshot, dt as requiredSecretKeys, f as roleCanUseOperation, ft as COLUMN_IDS, h as renderHttpProblem, ht as TASK_HOLDS, i as TOKEN_REQUEST_LIMITS, j as sessionTransitionSchema, k as entityRefSchema, l as BOARD_TICK_MS, lt as configSchema, m as turnHandedSchema, mt as SLACK_BOT_SCOPES, n as doctorReportSchema, nt as ok, o as tokenRequestResultSchema, p as OPERATIONS, pt as DISPATCHER_MODES, q as actorIdSchema, rt as successEnvelopeSchema, s as tokenRequestSchema, st as DEFAULT_SLACK_COMMAND, t as assertNever, ut as plainHttpAllowed, v as SPACE_IDS, w as EVENT_KINDS, x as interactionRefSchema, y as conversationRefSchema, z as parseRingMarker } from "./chunk-C11wvkRU.mjs";
|
|
2
2
|
import { t as apiBaseUrl } from "./chunk-DAMwWWmT.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { createHash, randomUUID } from "node:crypto";
|
|
@@ -14126,7 +14126,22 @@ function executorDone(column, facts, columns) {
|
|
|
14126
14126
|
if (orchestratorOf$1(column, columns) !== "none") return false;
|
|
14127
14127
|
return onHead.some((mark) => mark.kind === "submit" && orchestratorOf$1(mark.column, columns) === "none");
|
|
14128
14128
|
}
|
|
14129
|
-
|
|
14129
|
+
/**
|
|
14130
|
+
* The leftmost enabled column that requires resolved threads: `requireResolvedThreads`, by default
|
|
14131
|
+
* true on Ready to Merge only. Undefined when no enabled column requires them.
|
|
14132
|
+
*/
|
|
14133
|
+
function threadsFrom(project) {
|
|
14134
|
+
return project.columns.find((c) => c.enabled && (c.requireResolvedThreads ?? c.id === "ready-to-merge"))?.id;
|
|
14135
|
+
}
|
|
14136
|
+
/** Whether any enabled column of the project requires resolved review threads. */
|
|
14137
|
+
function threadsGated(project) {
|
|
14138
|
+
return threadsFrom(project) !== void 0;
|
|
14139
|
+
}
|
|
14140
|
+
/**
|
|
14141
|
+
* Dev's failing reasons. `threads` adds the resolved-threads condition: it holds for the gate of
|
|
14142
|
+
* every column at or right of the leftmost column requiring resolved threads.
|
|
14143
|
+
*/
|
|
14144
|
+
function devReasons(facts, columns, waived, threads) {
|
|
14130
14145
|
const { pr } = facts;
|
|
14131
14146
|
if (pr === null) return ["no_pr"];
|
|
14132
14147
|
if (pr.state === "closed") return ["pr_closed"];
|
|
@@ -14139,16 +14154,20 @@ function devReasons(facts, columns, waived) {
|
|
|
14139
14154
|
if (pr.mergeable === "unknown") reasons.push("mergeable_unknown");
|
|
14140
14155
|
if (facts.unhandledExternalComments > 0) reasons.push("external_comments");
|
|
14141
14156
|
if (facts.commentHistory === "incomplete") reasons.push("comment_history_incomplete");
|
|
14157
|
+
if (threads && facts.unresolvedThreads > 0) reasons.push("unresolved_threads");
|
|
14142
14158
|
if (!executorDone("dev", facts, columns)) reasons.push("no_submit_on_head");
|
|
14143
14159
|
return reasons;
|
|
14144
14160
|
}
|
|
14145
|
-
/**
|
|
14146
|
-
|
|
14161
|
+
/**
|
|
14162
|
+
* The failing reasons of one column's exit condition. Only Dev's resolved-threads condition depends
|
|
14163
|
+
* on the column asked: `threads` says whether it counts.
|
|
14164
|
+
*/
|
|
14165
|
+
function columnCondition(column, facts, columns, waived, threads) {
|
|
14147
14166
|
switch (column) {
|
|
14148
14167
|
case "todo":
|
|
14149
14168
|
case "ready-for-dev":
|
|
14150
14169
|
case "done": return [];
|
|
14151
|
-
case "dev": return devReasons(facts, columns, waived);
|
|
14170
|
+
case "dev": return devReasons(facts, columns, waived, threads);
|
|
14152
14171
|
case "review":
|
|
14153
14172
|
case "product-review": return executorDone(column, facts, columns) ? [] : ["no_review_on_head"];
|
|
14154
14173
|
case "external-review": return facts.externalReviewApproved ? [] : ["not_approved"];
|
|
@@ -14160,17 +14179,21 @@ function columnCondition(column, facts, columns, waived) {
|
|
|
14160
14179
|
/**
|
|
14161
14180
|
* Evaluates the exit conditions of every enabled column from To Do up to and including `column`,
|
|
14162
14181
|
* and returns the leftmost one that fails. A column absent from the project's columns or disabled
|
|
14163
|
-
* passes through. A merged pull request passes every column.
|
|
14164
|
-
*
|
|
14182
|
+
* passes through. A merged pull request passes every column. Dev's resolved-threads condition
|
|
14183
|
+
* counts when `column` is at or right of the leftmost enabled column requiring resolved threads.
|
|
14184
|
+
* Once Dev is evaluated with its check condition passed by `reposWithoutCi`, the result carries
|
|
14185
|
+
* `checksWaivedBy`.
|
|
14165
14186
|
*/
|
|
14166
14187
|
function evaluateGate(column, facts, project) {
|
|
14167
14188
|
if (facts.pr?.state === "merged") return { ok: true };
|
|
14168
14189
|
const waived = noCiWaives(facts.pr, project);
|
|
14190
|
+
const from = threadsFrom(project);
|
|
14191
|
+
const threads = from !== void 0 && COLUMN_IDS.indexOf(from) <= COLUMN_IDS.indexOf(column);
|
|
14169
14192
|
let marker = {};
|
|
14170
14193
|
for (const id of COLUMN_IDS.slice(0, COLUMN_IDS.indexOf(column) + 1)) {
|
|
14171
14194
|
if (project.columns.find((c) => c.id === id)?.enabled !== true) continue;
|
|
14172
14195
|
if (id === "dev" && waived) marker = { checksWaivedBy: "reposWithoutCi" };
|
|
14173
|
-
const [first, ...rest] = columnCondition(id, facts, project.columns, waived);
|
|
14196
|
+
const [first, ...rest] = columnCondition(id, facts, project.columns, waived, threads);
|
|
14174
14197
|
if (first !== void 0) return {
|
|
14175
14198
|
ok: false,
|
|
14176
14199
|
column: id,
|
|
@@ -14194,6 +14217,7 @@ const COLUMN_CONDITIONS = {
|
|
|
14194
14217
|
"no_conflict",
|
|
14195
14218
|
"external_comments_handled",
|
|
14196
14219
|
"comment_history_read",
|
|
14220
|
+
"threads_resolved",
|
|
14197
14221
|
"submit_on_head"
|
|
14198
14222
|
],
|
|
14199
14223
|
review: ["review_on_head"],
|
|
@@ -14214,6 +14238,7 @@ const CONDITION_OF = {
|
|
|
14214
14238
|
mergeable_unknown: "no_conflict",
|
|
14215
14239
|
external_comments: "external_comments_handled",
|
|
14216
14240
|
comment_history_incomplete: "comment_history_read",
|
|
14241
|
+
unresolved_threads: "threads_resolved",
|
|
14217
14242
|
no_submit_on_head: "submit_on_head",
|
|
14218
14243
|
no_review_on_head: "review_on_head",
|
|
14219
14244
|
not_approved: "approved",
|
|
@@ -14223,20 +14248,22 @@ const CONDITION_OF = {
|
|
|
14223
14248
|
const STOPS_DEV = /* @__PURE__ */ new Set(["no_pr", "pr_closed"]);
|
|
14224
14249
|
/**
|
|
14225
14250
|
* Every column's own exit conditions with their state, and where its cumulative gate blocks, as
|
|
14226
|
-
* `evaluateGate` decides it for each column.
|
|
14227
|
-
*
|
|
14251
|
+
* `evaluateGate` decides it for each column. Dev's own conditions count resolved threads once any
|
|
14252
|
+
* enabled column requires them. A merged pull request passes every column and every condition.
|
|
14253
|
+
* `checksWaivedBy` is the marker `evaluateGate('done')` carries, or null.
|
|
14228
14254
|
*/
|
|
14229
14255
|
function explainGates(facts, project) {
|
|
14230
14256
|
const merged = facts.pr?.state === "merged";
|
|
14231
14257
|
const waived = noCiWaives(facts.pr, project);
|
|
14232
|
-
|
|
14258
|
+
const threads = threadsGated(project);
|
|
14233
14259
|
let checksWaivedBy = null;
|
|
14234
14260
|
return {
|
|
14235
14261
|
gates: COLUMN_IDS.map((column) => {
|
|
14236
14262
|
const enabled = project.columns.find((c) => c.id === column)?.enabled === true;
|
|
14237
|
-
const reasons = merged ? [] : columnCondition(column, facts, project.columns, waived);
|
|
14263
|
+
const reasons = merged ? [] : columnCondition(column, facts, project.columns, waived, threads);
|
|
14238
14264
|
if (enabled && !merged && column === "dev" && waived) checksWaivedBy = "reposWithoutCi";
|
|
14239
|
-
|
|
14265
|
+
const gate = evaluateGate(column, facts, project);
|
|
14266
|
+
const blockedIn = gate.ok ? null : gate.column;
|
|
14240
14267
|
const stopped = reasons.some((reason) => STOPS_DEV.has(reason));
|
|
14241
14268
|
const conditions = COLUMN_CONDITIONS[column].map((condition) => {
|
|
14242
14269
|
const reason = reasons.find((r) => CONDITION_OF[r] === condition) ?? null;
|
|
@@ -14267,6 +14294,7 @@ const COUNTED = {
|
|
|
14267
14294
|
executor: true,
|
|
14268
14295
|
changes_requested: true,
|
|
14269
14296
|
external_comments: true,
|
|
14297
|
+
unresolved_threads: true,
|
|
14270
14298
|
conflict: false,
|
|
14271
14299
|
checks_red: false,
|
|
14272
14300
|
draft: false
|
|
@@ -14361,7 +14389,7 @@ function dispatch(input) {
|
|
|
14361
14389
|
};
|
|
14362
14390
|
const result = (next) => {
|
|
14363
14391
|
const deferred = next !== null && input.spurBlind && orchestratorOf(project, next.column) === "none";
|
|
14364
|
-
const opened = cycleHeld || deferred ? null : next;
|
|
14392
|
+
const opened = cycleHeld || deferred ? null : withThreads(next);
|
|
14365
14393
|
const handsOver = opened?.column === "dev" && facts.commentHistory === "complete" && facts.unhandledExternalComments > 0;
|
|
14366
14394
|
return opened !== null && (opened.kind === "after_submit" || handsOver) ? {
|
|
14367
14395
|
moves,
|
|
@@ -14372,6 +14400,16 @@ function dispatch(input) {
|
|
|
14372
14400
|
turn: opened
|
|
14373
14401
|
};
|
|
14374
14402
|
};
|
|
14403
|
+
const withThreads = (next) => {
|
|
14404
|
+
if (next?.column !== "dev" || !threadsGated(project) || facts.unresolvedThreads === 0) return next;
|
|
14405
|
+
const { reasons } = next;
|
|
14406
|
+
if (reasons.some((r) => r === "no_pr" || r === "pr_closed" || r === "unresolved_threads")) return next;
|
|
14407
|
+
const added = /* @__PURE__ */ new Set([...reasons, "unresolved_threads"]);
|
|
14408
|
+
return {
|
|
14409
|
+
...next,
|
|
14410
|
+
reasons: GATE_REASONS.filter((reason) => added.has(reason))
|
|
14411
|
+
};
|
|
14412
|
+
};
|
|
14375
14413
|
for (let step = 0; step < STEP_BOUND; step++) {
|
|
14376
14414
|
const merged = facts.pr?.state === "merged";
|
|
14377
14415
|
if (column === "done") {
|
|
@@ -14437,7 +14475,8 @@ const CAUSE_OF = {
|
|
|
14437
14475
|
checks_red: "checks_red",
|
|
14438
14476
|
conflict: "conflict",
|
|
14439
14477
|
pr_draft: "draft",
|
|
14440
|
-
external_comments: "external_comments"
|
|
14478
|
+
external_comments: "external_comments",
|
|
14479
|
+
unresolved_threads: "unresolved_threads"
|
|
14441
14480
|
};
|
|
14442
14481
|
/**
|
|
14443
14482
|
* The cycle causes of a return to Dev: `executor` when the column executor returned it with a
|
|
@@ -14751,6 +14790,17 @@ function prsPolledSince(task, since) {
|
|
|
14751
14790
|
//#endregion
|
|
14752
14791
|
//#region ../core/src/app/fromYou.ts
|
|
14753
14792
|
const episodeSchema = z.object({ startedAt: z.number() }).nullable();
|
|
14793
|
+
const stallEpisodeSchema = z.object({
|
|
14794
|
+
session: z.string().nullable(),
|
|
14795
|
+
health: z.string().nullable(),
|
|
14796
|
+
since: z.string().nullable(),
|
|
14797
|
+
revision: z.int().min(1)
|
|
14798
|
+
});
|
|
14799
|
+
const stallObservationSchema = z.object({
|
|
14800
|
+
blind: z.boolean(),
|
|
14801
|
+
observedAt: z.string().nullable(),
|
|
14802
|
+
resumedAt: z.number().nullable()
|
|
14803
|
+
});
|
|
14754
14804
|
const ENDED_WORKER_LABELS = {
|
|
14755
14805
|
worker_completed: "worker ended (completed), no PR",
|
|
14756
14806
|
worker_killed: "worker ended (killed), no PR",
|
|
@@ -14785,7 +14835,7 @@ async function conversationWaiting(trx, config, block, subject) {
|
|
|
14785
14835
|
};
|
|
14786
14836
|
}
|
|
14787
14837
|
/** Reconciles every item in the caller's observation or tick transaction. */
|
|
14788
|
-
async function reconcileItems(trx, config, now, spurComplete, warnSkipped) {
|
|
14838
|
+
async function reconcileItems(trx, config, now, spurComplete, warnSkipped, spurContinuityStartAt) {
|
|
14789
14839
|
const candidates = [];
|
|
14790
14840
|
const sources = await trx.selectFrom("source_state").selectAll().execute();
|
|
14791
14841
|
const sourceById = new Map(sources.map((state) => [state.source, state]));
|
|
@@ -15018,6 +15068,120 @@ async function reconcileItems(trx, config, now, spurComplete, warnSkipped) {
|
|
|
15018
15068
|
revision: "closed"
|
|
15019
15069
|
});
|
|
15020
15070
|
}
|
|
15071
|
+
const observationRow = await trx.selectFrom("meta").select("value").where("key", "=", "turn_stall_observation").executeTakeFirst();
|
|
15072
|
+
const previousObservation = observationRow === void 0 ? {
|
|
15073
|
+
blind: false,
|
|
15074
|
+
observedAt: null,
|
|
15075
|
+
resumedAt: null
|
|
15076
|
+
} : parseJson(stallObservationSchema, observationRow.value);
|
|
15077
|
+
const spurExpired = spur?.last_complete_at != null && now > Date.parse(spur.last_complete_at) + config.adapters.spur.intervalMs * config.thresholds.staleMultiplier;
|
|
15078
|
+
const observation = spurBlind || !spurComplete || spurExpired ? {
|
|
15079
|
+
...previousObservation,
|
|
15080
|
+
blind: true,
|
|
15081
|
+
observedAt: spurComplete ? spur?.observed_at ?? null : null
|
|
15082
|
+
} : spurContinuityStartAt !== void 0 ? {
|
|
15083
|
+
blind: false,
|
|
15084
|
+
observedAt: spur?.observed_at ?? null,
|
|
15085
|
+
resumedAt: spurContinuityStartAt
|
|
15086
|
+
} : previousObservation.blind && spur?.observed_at != null && spur.observed_at !== previousObservation.observedAt ? {
|
|
15087
|
+
blind: false,
|
|
15088
|
+
observedAt: spur.observed_at,
|
|
15089
|
+
resumedAt: Date.parse(spur.observed_at)
|
|
15090
|
+
} : previousObservation;
|
|
15091
|
+
if (JSON.stringify(observation) !== JSON.stringify(previousObservation)) await trx.insertInto("meta").values({
|
|
15092
|
+
key: "turn_stall_observation",
|
|
15093
|
+
value: toJson(stallObservationSchema, observation)
|
|
15094
|
+
}).onConflict((oc) => oc.column("key").doUpdateSet({ value: toJson(stallObservationSchema, observation) })).execute();
|
|
15095
|
+
const stallBlind = observation.blind;
|
|
15096
|
+
const stallExecutors = /* @__PURE__ */ new Map();
|
|
15097
|
+
const stalled = /* @__PURE__ */ new Set();
|
|
15098
|
+
const stallHeld = /* @__PURE__ */ new Set();
|
|
15099
|
+
const turns = await trx.selectFrom("turn").selectAll().where("closed_at", "is", null).execute();
|
|
15100
|
+
for (const turn of turns) {
|
|
15101
|
+
const task = taskById.get(turn.task_id);
|
|
15102
|
+
if (task === void 0 || turn.role === "operator") continue;
|
|
15103
|
+
const holder = turn.acked_by === null ? null : parseActorId(turn.acked_by);
|
|
15104
|
+
let executor = holder?.actor === "agent" ? await trx.selectFrom("session_snapshot").selectAll().where("id", "=", holder.actorRef.session).executeTakeFirst() : turn.acked_at === null ? await selectNotificationRecipient(trx, {
|
|
15105
|
+
task_id: task.id,
|
|
15106
|
+
role: turn.role,
|
|
15107
|
+
author_session: null
|
|
15108
|
+
}, config) : void 0;
|
|
15109
|
+
if (executor === void 0 && turn.acked_at === null) {
|
|
15110
|
+
const target = config.projects.find((entry) => entry.id === task.project)?.columns.find((entry) => entry.id === turn.column)?.orchestrator;
|
|
15111
|
+
const stopped = await trx.selectFrom("session_snapshot").selectAll().where("state", "=", "stopped").where("ended_at", "is", null).where("absent_since", "is", null).orderBy("first_seen", "desc").orderBy("id").execute();
|
|
15112
|
+
for (const row of stopped) if (await trx.selectFrom("link").select("id").where("task_id", "=", task.id).where("session_id", "=", row.id).where("role", "=", turn.role === "worker" ? "worker" : "orchestrator").where("banned", "=", 0).executeTakeFirst() !== void 0 || turn.role !== "worker" && row.spur_project === target) {
|
|
15113
|
+
executor = row;
|
|
15114
|
+
break;
|
|
15115
|
+
}
|
|
15116
|
+
}
|
|
15117
|
+
if (executor === void 0 || executor.ended_at !== null || executor.absent_since !== null) {
|
|
15118
|
+
await observeTurnEpisode(trx, turn.id, null);
|
|
15119
|
+
continue;
|
|
15120
|
+
}
|
|
15121
|
+
if (turn.role === "worker") {
|
|
15122
|
+
if (await trx.selectFrom("link").select("id").where("task_id", "=", task.id).where("session_id", "=", executor.id).where("banned", "=", 1).executeTakeFirst() !== void 0) {
|
|
15123
|
+
await observeTurnEpisode(trx, turn.id, null);
|
|
15124
|
+
continue;
|
|
15125
|
+
}
|
|
15126
|
+
}
|
|
15127
|
+
const parsed = sessionFactsSchema.safeParse(JSON.parse(executor.detail));
|
|
15128
|
+
if (!parsed.success) {
|
|
15129
|
+
await observeTurnEpisode(trx, turn.id, null);
|
|
15130
|
+
continue;
|
|
15131
|
+
}
|
|
15132
|
+
const fact = parsed.data;
|
|
15133
|
+
if (holder?.actor === "agent" && holder.actorRef.project !== fact.spurProject) {
|
|
15134
|
+
await observeTurnEpisode(trx, turn.id, null);
|
|
15135
|
+
continue;
|
|
15136
|
+
}
|
|
15137
|
+
const episode = await observeTurnEpisode(trx, turn.id, fact);
|
|
15138
|
+
const episodeSince = episode.since ?? fact.healthSince;
|
|
15139
|
+
if (![
|
|
15140
|
+
"needs_input",
|
|
15141
|
+
"error",
|
|
15142
|
+
"rate_limited",
|
|
15143
|
+
"stopped"
|
|
15144
|
+
].includes(fact.health)) continue;
|
|
15145
|
+
const healthStart = Math.max(Date.parse(turn.created_at), Date.parse(episodeSince));
|
|
15146
|
+
if (!Number.isFinite(healthStart)) continue;
|
|
15147
|
+
stalled.add(`${String(task.id)}:${fact.id}`);
|
|
15148
|
+
const key = `turn-stall:${String(turn.id)}:${fact.id}:${fact.health}:${episodeSince}:${String(episode.revision)}`;
|
|
15149
|
+
stallHeld.add(key);
|
|
15150
|
+
const previous = await trx.selectFrom("operator_item").select([
|
|
15151
|
+
"text",
|
|
15152
|
+
"cleared_at",
|
|
15153
|
+
"block_id"
|
|
15154
|
+
]).where("item_key", "=", key).orderBy("id", "desc").executeTakeFirst();
|
|
15155
|
+
const activeBlock = previous?.cleared_at === null ? blocks.find((block) => block.id === previous.block_id) : void 0;
|
|
15156
|
+
if (activeBlock?.addressee_role === "curator" && (await curatorSession(trx, config, task.project))?.id === fact.id) await moveBlockToAddressee(trx, {
|
|
15157
|
+
task,
|
|
15158
|
+
block: activeBlock,
|
|
15159
|
+
to: "operator",
|
|
15160
|
+
reason: "The selected curator is the stalled executor.",
|
|
15161
|
+
ctx: {
|
|
15162
|
+
actor: "system",
|
|
15163
|
+
at: new Date(now).toISOString()
|
|
15164
|
+
},
|
|
15165
|
+
config
|
|
15166
|
+
});
|
|
15167
|
+
const since = previous?.cleared_at === null ? healthStart : Math.max(healthStart, observation.resumedAt ?? healthStart);
|
|
15168
|
+
if (stallBlind || now - since < config.health.turnStallAfterMs) continue;
|
|
15169
|
+
stallExecutors.set(key, fact.id);
|
|
15170
|
+
const questions = blocks.filter((block) => {
|
|
15171
|
+
const author = parseActorId(block.author);
|
|
15172
|
+
return block.task_id === task.id && author?.actor === "agent" && author.actorRef.project === fact.spurProject && author.actorRef.session === fact.id;
|
|
15173
|
+
}).map((block) => `B${String(block.id)}`);
|
|
15174
|
+
const quota = fact.health === "rate_limited" ? `; quota name unavailable; reset ${fact.rateLimitResetAt ?? "unknown"}` : "";
|
|
15175
|
+
candidates.push({
|
|
15176
|
+
key,
|
|
15177
|
+
kind: "anomaly",
|
|
15178
|
+
taskId: task.id,
|
|
15179
|
+
summary: previous?.text ?? `${task.key}: turn T${String(turn.id)} executor ${fact.id} remains ${fact.health} since ${episodeSince}; turn-relative elapsed ${String(now - since)} ms${since > healthStart ? `; continuous observation since ${new Date(since).toISOString()}` : ""}${quota}${questions.length === 0 ? "" : `; open executor questions: ${questions.join(", ")}`}`,
|
|
15180
|
+
factAt: episodeSince,
|
|
15181
|
+
source: "spur",
|
|
15182
|
+
priority: 4
|
|
15183
|
+
});
|
|
15184
|
+
}
|
|
15021
15185
|
const previousEpisode = await trx.selectFrom("meta").select("value").where("key", "=", "host_load_episode").executeTakeFirst();
|
|
15022
15186
|
const health = evaluateSessionHealth({
|
|
15023
15187
|
sessions: subjects,
|
|
@@ -15038,6 +15202,11 @@ async function reconcileItems(trx, config, now, spurComplete, warnSkipped) {
|
|
|
15038
15202
|
const task = taskById.get(Number(flag.taskId));
|
|
15039
15203
|
if (task === void 0) continue;
|
|
15040
15204
|
const fact = subjects.find((subject) => subject.taskId === flag.taskId && subject.id === flag.sessionId);
|
|
15205
|
+
if ([
|
|
15206
|
+
"stuck_worker",
|
|
15207
|
+
"stuck_orchestrator",
|
|
15208
|
+
"needs_input"
|
|
15209
|
+
].includes(flag.kind) && stalled.has(`${flag.taskId}:${flag.sessionId}`)) continue;
|
|
15041
15210
|
const endedLabel = ENDED_WORKER_LABELS[flag.kind];
|
|
15042
15211
|
const asking = flag.kind === "needs_input" && fact !== void 0 && blocks.some((block) => {
|
|
15043
15212
|
const author = parseActorId(block.author);
|
|
@@ -15080,15 +15249,16 @@ async function reconcileItems(trx, config, now, spurComplete, warnSkipped) {
|
|
|
15080
15249
|
const seen = /* @__PURE__ */ new Set([...ordered.map((item) => item.key), ...heldKeys]);
|
|
15081
15250
|
for (const flag of health.held) {
|
|
15082
15251
|
const task = taskById.get(Number(flag.taskId));
|
|
15083
|
-
if (task !== void 0) seen.add(healthKey(task.id, flag));
|
|
15252
|
+
if (task !== void 0 && !stalled.has(`${flag.taskId}:${flag.sessionId}`)) seen.add(healthKey(task.id, flag));
|
|
15084
15253
|
}
|
|
15085
15254
|
const existing = await trx.selectFrom("operator_item").selectAll().where("kind", "in", RECONCILED_KINDS).where("cleared_at", "is", null).execute();
|
|
15086
|
-
const stillInError = new Set(health.hostLoad === null ? [] : subjects.filter((subject) => subject.endedAt === null && subject.health === "error" && subject.role !== "other").map((subject) => healthKey(Number(subject.taskId), {
|
|
15255
|
+
const stillInError = new Set(health.hostLoad === null ? [] : subjects.filter((subject) => subject.endedAt === null && subject.health === "error" && subject.role !== "other" && !stalled.has(`${subject.taskId}:${subject.id}`)).map((subject) => healthKey(Number(subject.taskId), {
|
|
15087
15256
|
taskId: subject.taskId,
|
|
15088
15257
|
sessionId: subject.id,
|
|
15089
15258
|
kind: subject.role === "worker" ? "stuck_worker" : "stuck_orchestrator"
|
|
15090
15259
|
})));
|
|
15091
15260
|
const spurHeld = spurBlind ? await blindHeldKeys(trx, subjects) : /* @__PURE__ */ new Set();
|
|
15261
|
+
if (stallBlind) for (const key of stallHeld) spurHeld.add(key);
|
|
15092
15262
|
for (const item of existing) {
|
|
15093
15263
|
if (item.kind !== "anomaly") continue;
|
|
15094
15264
|
if (item.source === "spur" && spurHeld.has(item.item_key) || stillInError.has(item.item_key)) seen.add(item.item_key);
|
|
@@ -15122,7 +15292,7 @@ async function reconcileItems(trx, config, now, spurComplete, warnSkipped) {
|
|
|
15122
15292
|
source: candidate.source,
|
|
15123
15293
|
priority: candidate.priority
|
|
15124
15294
|
};
|
|
15125
|
-
if (ITEM_POLICY[candidate.kind].block && task !== null && task !== void 0) await raiseAnomaly(trx, config, task, input);
|
|
15295
|
+
if (ITEM_POLICY[candidate.kind].block && task !== null && task !== void 0) await raiseAnomaly(trx, config, task, input, stallExecutors.get(candidate.key));
|
|
15126
15296
|
else await raiseItem(trx, {
|
|
15127
15297
|
...input,
|
|
15128
15298
|
taskId: candidate.taskId,
|
|
@@ -15148,15 +15318,17 @@ function prCompleteAt(project, sourceById) {
|
|
|
15148
15318
|
* Raises a ledger item with the operator block it stands for. An active item of the key is
|
|
15149
15319
|
* returned as it is, so a repeated raise opens no second block.
|
|
15150
15320
|
*/
|
|
15151
|
-
async function raiseAnomaly(trx, config, task, input) {
|
|
15321
|
+
async function raiseAnomaly(trx, config, task, input, executorId) {
|
|
15152
15322
|
const active = await trx.selectFrom("operator_item").selectAll().where("item_key", "=", input.itemKey).where("cleared_at", "is", null).executeTakeFirst();
|
|
15153
15323
|
if (active !== void 0) return active;
|
|
15154
15324
|
const prefix = `${task.key}: `;
|
|
15325
|
+
const toCurator = input.itemKey.startsWith("turn-stall:") && curatorProject(config, task.project) !== null && (await curatorSession(trx, config, task.project))?.id !== executorId;
|
|
15155
15326
|
const block = await openSystemBlock(trx, {
|
|
15156
15327
|
task,
|
|
15157
15328
|
reason: input.text.startsWith(prefix) ? input.text.slice(prefix.length) : input.text,
|
|
15158
15329
|
at: input.at.toISOString(),
|
|
15159
|
-
config
|
|
15330
|
+
config,
|
|
15331
|
+
...toCurator ? { addressee: "curator" } : {}
|
|
15160
15332
|
});
|
|
15161
15333
|
return raiseItem(trx, {
|
|
15162
15334
|
...input,
|
|
@@ -15204,6 +15376,24 @@ async function blindHeldKeys(trx, subjects) {
|
|
|
15204
15376
|
for (const { turn } of await quietTurns(trx)) held.add(`stuck-turn:${String(turn.id)}`);
|
|
15205
15377
|
return held;
|
|
15206
15378
|
}
|
|
15379
|
+
/** A producer's local healthSince can restart without a new current observed health state. */
|
|
15380
|
+
async function observeTurnEpisode(trx, turnId, fact) {
|
|
15381
|
+
const key = `turn_stall_episode:${String(turnId)}`;
|
|
15382
|
+
const row = await trx.selectFrom("meta").select("value").where("key", "=", key).executeTakeFirst();
|
|
15383
|
+
const previous = row === void 0 ? void 0 : parseJson(stallEpisodeSchema, row.value);
|
|
15384
|
+
if (previous !== void 0 && previous.session === (fact?.id ?? null) && previous.health === (fact?.health ?? null)) return previous;
|
|
15385
|
+
const episode = {
|
|
15386
|
+
session: fact?.id ?? null,
|
|
15387
|
+
health: fact?.health ?? null,
|
|
15388
|
+
since: fact?.healthSince ?? null,
|
|
15389
|
+
revision: (previous?.revision ?? 0) + 1
|
|
15390
|
+
};
|
|
15391
|
+
await trx.insertInto("meta").values({
|
|
15392
|
+
key,
|
|
15393
|
+
value: toJson(stallEpisodeSchema, episode)
|
|
15394
|
+
}).onConflict((oc) => oc.column("key").doUpdateSet({ value: toJson(stallEpisodeSchema, episode) })).execute();
|
|
15395
|
+
return episode;
|
|
15396
|
+
}
|
|
15207
15397
|
function healthKey(taskId, flag) {
|
|
15208
15398
|
return `health:${String(taskId)}:${flag.sessionId}:${flag.kind}`;
|
|
15209
15399
|
}
|
|
@@ -15701,6 +15891,7 @@ async function readInput(trx, task, project, mode, blind, config, clock) {
|
|
|
15701
15891
|
externalReviewApproved: pr !== null && externalApproval(pr, project.operatorGithubLogin),
|
|
15702
15892
|
commentHistory: pr?.feedbackComplete === true ? "complete" : "incomplete",
|
|
15703
15893
|
unhandledExternalComments: unhandled.length,
|
|
15894
|
+
unresolvedThreads: pr === null ? 0 : pr.reviewThreads.filter((thread) => !thread.resolved).length,
|
|
15704
15895
|
marks
|
|
15705
15896
|
},
|
|
15706
15897
|
reopened: mergedOpen === void 0 && await trx.selectFrom("link").select("id").where("task_id", "=", task.id).where("reopen_hidden_at", "is not", null).executeTakeFirst() !== void 0,
|
|
@@ -15944,6 +16135,43 @@ async function taskSessions(trx, taskId) {
|
|
|
15944
16135
|
});
|
|
15945
16136
|
}
|
|
15946
16137
|
//#endregion
|
|
16138
|
+
//#region ../core/src/app/turn-view.ts
|
|
16139
|
+
/**
|
|
16140
|
+
* The unresolved review threads a Dev turn lists, read live from the task's PR snapshot: only on a
|
|
16141
|
+
* project requiring resolved threads and an open PR, and only threads with an id and a link (facts
|
|
16142
|
+
* stored by an earlier version lack them). Undefined when none.
|
|
16143
|
+
*/
|
|
16144
|
+
async function turnThreads(trx, taskId, project, turn) {
|
|
16145
|
+
if (turn.column !== "dev" || project === void 0 || !threadsGated(project)) return void 0;
|
|
16146
|
+
const pr = await prFacts(trx, taskId);
|
|
16147
|
+
if (pr?.state !== "open") return void 0;
|
|
16148
|
+
const threads = pr.reviewThreads.flatMap(({ resolved, id, url, outdated }) => resolved || id === void 0 || url === void 0 ? [] : [{
|
|
16149
|
+
id,
|
|
16150
|
+
url,
|
|
16151
|
+
outdated: outdated ?? false
|
|
16152
|
+
}]);
|
|
16153
|
+
return threads.length === 0 ? void 0 : threads;
|
|
16154
|
+
}
|
|
16155
|
+
/** A turn as the worker and `task.get --why` read it, with the threads of a Dev turn. */
|
|
16156
|
+
async function turnView(trx, turn, task, project) {
|
|
16157
|
+
const threads = await turnThreads(trx, task.id, project, turn);
|
|
16158
|
+
return {
|
|
16159
|
+
id: `T${String(turn.id)}`,
|
|
16160
|
+
task: task.key,
|
|
16161
|
+
column: turn.column,
|
|
16162
|
+
addressee: turn.role,
|
|
16163
|
+
reason: turn.reason,
|
|
16164
|
+
handed: turnHanded(turn),
|
|
16165
|
+
head: turn.head_sha,
|
|
16166
|
+
at: turn.created_at,
|
|
16167
|
+
taken: turn.acked_by === null || turn.acked_at === null ? null : {
|
|
16168
|
+
by: turn.acked_by,
|
|
16169
|
+
at: turn.acked_at
|
|
16170
|
+
},
|
|
16171
|
+
...threads === void 0 ? {} : { threads }
|
|
16172
|
+
};
|
|
16173
|
+
}
|
|
16174
|
+
//#endregion
|
|
15947
16175
|
//#region ../core/src/app/task-queries.ts
|
|
15948
16176
|
/** How many of the last moves `task.get --why` shows. */
|
|
15949
16177
|
const WHY_MOVES = 5;
|
|
@@ -16057,22 +16285,6 @@ async function taskByKey(trx, key) {
|
|
|
16057
16285
|
if (task === void 0) throw new CommandError("not_found", "Check the task key.");
|
|
16058
16286
|
return task;
|
|
16059
16287
|
}
|
|
16060
|
-
function turnView(turn, key) {
|
|
16061
|
-
return {
|
|
16062
|
-
id: `T${String(turn.id)}`,
|
|
16063
|
-
task: key,
|
|
16064
|
-
column: turn.column,
|
|
16065
|
-
addressee: turn.role,
|
|
16066
|
-
reason: turn.reason,
|
|
16067
|
-
handed: turnHanded(turn),
|
|
16068
|
-
head: turn.head_sha,
|
|
16069
|
-
at: turn.created_at,
|
|
16070
|
-
taken: turn.acked_by === null || turn.acked_at === null ? null : {
|
|
16071
|
-
by: turn.acked_by,
|
|
16072
|
-
at: turn.acked_at
|
|
16073
|
-
}
|
|
16074
|
-
};
|
|
16075
|
-
}
|
|
16076
16288
|
function createTaskQueries(deps) {
|
|
16077
16289
|
const { config, clock, completeSince } = deps;
|
|
16078
16290
|
const taskKey = (key) => {
|
|
@@ -16087,12 +16299,12 @@ function createTaskQueries(deps) {
|
|
|
16087
16299
|
async function why(trx, task) {
|
|
16088
16300
|
const column = task.shadow_column ?? task.column;
|
|
16089
16301
|
const open = await trx.selectFrom("turn").selectAll().where("task_id", "=", task.id).where("closed_at", "is", null).orderBy("id", "desc").executeTakeFirst();
|
|
16302
|
+
const project = config.projects.find((entry) => entry.id === task.project);
|
|
16090
16303
|
const shared = {
|
|
16091
16304
|
column,
|
|
16092
|
-
turn: open === void 0 ? null : turnView(open, task
|
|
16305
|
+
turn: open === void 0 ? null : await turnView(trx, open, task, project),
|
|
16093
16306
|
moves: await moveViews(trx, task.id, { limit: WHY_MOVES })
|
|
16094
16307
|
};
|
|
16095
|
-
const project = config.projects.find((entry) => entry.id === task.project);
|
|
16096
16308
|
if (project === void 0) return {
|
|
16097
16309
|
...shared,
|
|
16098
16310
|
dispatcher: null,
|
|
@@ -16211,7 +16423,7 @@ function createTaskQueries(deps) {
|
|
|
16211
16423
|
*/
|
|
16212
16424
|
async function inboxTurns(trx, projects, actor) {
|
|
16213
16425
|
if (parseActorId(actor)?.actor !== "agent" || projects.size === 0) return [];
|
|
16214
|
-
const rows = await trx.selectFrom("turn").innerJoin("task", "task.id", "turn.task_id").selectAll("turn").select("task.key").where("task.project", "in", [...projects]).where("turn.closed_at", "is", null).where("turn.role", "!=", "operator").orderBy("turn.id").execute();
|
|
16426
|
+
const rows = await trx.selectFrom("turn").innerJoin("task", "task.id", "turn.task_id").selectAll("turn").select(["task.key", "task.project"]).where("task.project", "in", [...projects]).where("turn.closed_at", "is", null).where("turn.role", "!=", "operator").orderBy("turn.id").execute();
|
|
16215
16427
|
const turns = [];
|
|
16216
16428
|
for (const turn of rows) {
|
|
16217
16429
|
if (turn.acked_by !== actor) {
|
|
@@ -16219,7 +16431,11 @@ function createTaskQueries(deps) {
|
|
|
16219
16431
|
const mayTake = turn.acked_at === null ? notice?.acked_at === null : turn.role.startsWith("orchestrator:");
|
|
16220
16432
|
if (notice === void 0 || !mayTake || !await notificationAddressedTo(trx, notice, actor, config)) continue;
|
|
16221
16433
|
}
|
|
16222
|
-
|
|
16434
|
+
const project = config.projects.find((entry) => entry.id === turn.project);
|
|
16435
|
+
turns.push(await turnView(trx, turn, {
|
|
16436
|
+
id: turn.task_id,
|
|
16437
|
+
key: turn.key
|
|
16438
|
+
}, project));
|
|
16223
16439
|
}
|
|
16224
16440
|
return turns;
|
|
16225
16441
|
}
|
|
@@ -17536,6 +17752,8 @@ function createObservationCore(deps) {
|
|
|
17536
17752
|
const now = clock.now();
|
|
17537
17753
|
await scanTransaction(store, config, async (trx) => {
|
|
17538
17754
|
const wasBlind = await blindReason(trx, source);
|
|
17755
|
+
const previousSpur = source === "spur" ? await trx.selectFrom("source_state").select("last_complete_at").where("source", "=", source).executeTakeFirst() : void 0;
|
|
17756
|
+
const spurGap = previousSpur?.last_complete_at != null && Date.parse(batch.observedAt) > Date.parse(previousSpur.last_complete_at) + config.adapters.spur.intervalMs * config.thresholds.staleMultiplier;
|
|
17539
17757
|
await sourceState(trx, source, observation.state, batch.observedAt, batch.cursor);
|
|
17540
17758
|
await recordUsage(trx, source, batch.usage, now);
|
|
17541
17759
|
for (const probe of batch.prProbes ?? []) {
|
|
@@ -17662,7 +17880,7 @@ function createObservationCore(deps) {
|
|
|
17662
17880
|
if (observation.effectiveComplete && !completeSince.has(source) || recovered) await dispatchSource(trx, source, dispatchContext);
|
|
17663
17881
|
await dispatchMergedTickets(trx, source, dispatchContext);
|
|
17664
17882
|
await dispatchJournaled(trx, dispatchContext);
|
|
17665
|
-
await reconcileItems(trx, config, now, currentComplete.has("spur"), warnSkipped);
|
|
17883
|
+
await reconcileItems(trx, config, now, currentComplete.has("spur"), warnSkipped, source === "spur" && observation.effectiveComplete && (!completeSince.has("spur") || spurGap) ? Date.parse(batch.observedAt) : void 0);
|
|
17666
17884
|
if (deps.productVersion !== void 0) await enqueueLiveAfterFirstPoll(trx, {
|
|
17667
17885
|
config,
|
|
17668
17886
|
productVersion: deps.productVersion,
|
|
@@ -19240,6 +19458,7 @@ function teamScopeDenied(error, query) {
|
|
|
19240
19458
|
const REVIEWER_FIELDS = "requestedReviewer { __typename ... on Bot { login } ... on Mannequin { login } ... on User { login } ... on Team { slug } ... on EnterpriseTeam { slug } } asCodeOwner";
|
|
19241
19459
|
const REVIEW_FIELDS = "id author { __typename login } state commit { oid } submittedAt";
|
|
19242
19460
|
const COMMENT_FIELDS = "nodes { id author { __typename login } createdAt body } pageInfo { hasPreviousPage startCursor }";
|
|
19461
|
+
const THREAD_FIELDS = "id isResolved isOutdated comments(first: 1) { nodes { url } }";
|
|
19243
19462
|
const CLOSING_FIELDS = "nodes { number repository { nameWithOwner } } pageInfo { hasNextPage endCursor }";
|
|
19244
19463
|
const prFields = (number, closing = false) => `id number url title updatedAt mergedAt closedAt state isDraft mergeable mergeStateStatus
|
|
19245
19464
|
author { login } headRefName headRefOid
|
|
@@ -19249,7 +19468,7 @@ const prFields = (number, closing = false) => `id number url title updatedAt mer
|
|
|
19249
19468
|
} pageInfo { hasNextPage endCursor } } }
|
|
19250
19469
|
reviews(first: 100) { nodes { ${REVIEW_FIELDS} } pageInfo { hasNextPage endCursor } }
|
|
19251
19470
|
comments(last: 100) { ${COMMENT_FIELDS} }
|
|
19252
|
-
reviewThreads(first: 100) { nodes {
|
|
19471
|
+
reviewThreads(first: 100) { nodes { ${THREAD_FIELDS} } pageInfo { hasNextPage endCursor } }
|
|
19253
19472
|
reviewRequests(first: 100) { nodes { ${REVIEWER_FIELDS} } pageInfo { hasNextPage endCursor } }${closing ? `\n closingIssuesReferences(first: 100) { ${CLOSING_FIELDS} }` : ""}`;
|
|
19254
19473
|
const DISCOVERY_FIELDS = `nodes { number updatedAt author { login } state } pageInfo { hasNextPage endCursor }`;
|
|
19255
19474
|
const INDEX_FIELDS = `number updatedAt state isDraft mergeable mergeStateStatus headRefOid statusCheckRollup { state contexts(first: 100) { totalCount nodes { ... on CheckRun { __typename name status conclusion completedAt } ... on StatusContext { __typename context state } } } } reviews(first: 100) { totalCount nodes { id state } } reviewThreads(first: 100) { totalCount nodes { isResolved } } reviewRequests(first: 100) { totalCount nodes { ${REVIEWER_FIELDS} } } comments(last: 1) { totalCount nodes { id } }`;
|
|
@@ -19272,7 +19491,7 @@ function detailQuery(numbers, closing = false) {
|
|
|
19272
19491
|
function pageQuery(connection, bootstrap = false) {
|
|
19273
19492
|
if (connection === "comments") return `query PrPage($owner: String!, $repo: String!, $number: Int!, $before: String!) { rateLimit { cost remaining resetAt } repository(owner: $owner, name: $repo) { pullRequest(number: $number) { comments(last: 100, before: $before) { ${COMMENT_FIELDS} } } } }`;
|
|
19274
19493
|
if (connection === "pullRequests") return `query DiscoveryPage($owner: String!, $repo: String!, $after: String!) { rateLimit { cost remaining resetAt } repository(owner: $owner, name: $repo) { pullRequests(first: 100, after: $after, states: [${discoveryStates(bootstrap)}], orderBy: {field: UPDATED_AT, direction: DESC}) { ${DISCOVERY_FIELDS} } } }`;
|
|
19275
|
-
return `query PrPage($owner: String!, $repo: String!, $number: Int!, $after: String!) { rateLimit { cost remaining resetAt } repository(owner: $owner, name: $repo) { pullRequest(number: $number) { ${connection === "closingIssuesReferences" ? `closingIssuesReferences(first: 100, after: $after) { ${CLOSING_FIELDS} }` : connection === "contexts" ? `statusCheckRollup { contexts(first: 100, after: $after) { nodes { ... on CheckRun { __typename name status conclusion startedAt completedAt checkSuite { createdAt } isRequired(pullRequestNumber: $number) } ... on StatusContext { __typename context state createdAt isRequired(pullRequestNumber: $number) } } pageInfo { hasNextPage endCursor } } }` : `${connection}(first: 100, after: $after) { nodes { ${connection === "reviews" ? REVIEW_FIELDS : connection === "reviewThreads" ?
|
|
19494
|
+
return `query PrPage($owner: String!, $repo: String!, $number: Int!, $after: String!) { rateLimit { cost remaining resetAt } repository(owner: $owner, name: $repo) { pullRequest(number: $number) { ${connection === "closingIssuesReferences" ? `closingIssuesReferences(first: 100, after: $after) { ${CLOSING_FIELDS} }` : connection === "contexts" ? `statusCheckRollup { contexts(first: 100, after: $after) { nodes { ... on CheckRun { __typename name status conclusion startedAt completedAt checkSuite { createdAt } isRequired(pullRequestNumber: $number) } ... on StatusContext { __typename context state createdAt isRequired(pullRequestNumber: $number) } } pageInfo { hasNextPage endCursor } } }` : `${connection}(first: 100, after: $after) { nodes { ${connection === "reviews" ? REVIEW_FIELDS : connection === "reviewThreads" ? THREAD_FIELDS : REVIEWER_FIELDS} } pageInfo { hasNextPage endCursor } }`} } } }`;
|
|
19276
19495
|
}
|
|
19277
19496
|
/**
|
|
19278
19497
|
* The failure that GraphQL `errors` mean for the whole request, in rule order: a rate limit is
|
|
@@ -19487,7 +19706,12 @@ const prWire = z.object({
|
|
|
19487
19706
|
statusCheckRollup: z.object({ contexts: nodes(contextWire) }).nullish(),
|
|
19488
19707
|
reviews: nodes(reviewWire),
|
|
19489
19708
|
comments: nodes(commentWire),
|
|
19490
|
-
reviewThreads: nodes(z.object({
|
|
19709
|
+
reviewThreads: nodes(z.object({
|
|
19710
|
+
id: z.string().optional(),
|
|
19711
|
+
isResolved: z.boolean(),
|
|
19712
|
+
isOutdated: z.boolean().optional(),
|
|
19713
|
+
comments: nodes(z.object({ url: z.string() })).optional()
|
|
19714
|
+
})),
|
|
19491
19715
|
reviewRequests: nodes(z.object({
|
|
19492
19716
|
requestedReviewer: reviewerWire,
|
|
19493
19717
|
asCodeOwner: z.boolean()
|
|
@@ -19725,6 +19949,15 @@ function reviewer(wire) {
|
|
|
19725
19949
|
default: return assertNever(wire);
|
|
19726
19950
|
}
|
|
19727
19951
|
}
|
|
19952
|
+
function reviewThread(node) {
|
|
19953
|
+
const url = node.comments?.nodes[0]?.url;
|
|
19954
|
+
return {
|
|
19955
|
+
resolved: node.isResolved,
|
|
19956
|
+
...node.id === void 0 ? {} : { id: node.id },
|
|
19957
|
+
...url === void 0 ? {} : { url },
|
|
19958
|
+
...node.isOutdated === void 0 ? {} : { outdated: node.isOutdated }
|
|
19959
|
+
};
|
|
19960
|
+
}
|
|
19728
19961
|
/**
|
|
19729
19962
|
* `feedbackComplete` says whether the comments in `value`, with the `held` comments an earlier
|
|
19730
19963
|
* poll read, reach back to the cursor or start.
|
|
@@ -19760,7 +19993,7 @@ function normalizePr(repo, value, rule, feedbackComplete, held = []) {
|
|
|
19760
19993
|
mergeState,
|
|
19761
19994
|
...checks,
|
|
19762
19995
|
reviews: latestReviews(wire.reviews.nodes),
|
|
19763
|
-
reviewThreads: wire.reviewThreads.nodes.map(
|
|
19996
|
+
reviewThreads: wire.reviewThreads.nodes.map(reviewThread),
|
|
19764
19997
|
reviewRequests: wire.reviewRequests.nodes.flatMap(({ requestedReviewer, asCodeOwner }) => requestedReviewer === null ? [] : [{
|
|
19765
19998
|
...reviewer(requestedReviewer),
|
|
19766
19999
|
asCodeOwner
|
package/dist/mcp.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { o as CliError, r as requestOperation } from "./chunk-
|
|
3
|
-
import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-
|
|
1
|
+
import { Q as ERRORS, _ as renderMcpError, p as OPERATIONS } from "./chunk-C11wvkRU.mjs";
|
|
2
|
+
import { o as CliError, r as requestOperation } from "./chunk-t6u2F3E-.mjs";
|
|
3
|
+
import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-AwNJBvcj.mjs";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
5
|
import { readFileSync } from "node:fs";
|
|
6
6
|
import { z } from "zod";
|
package/package.json
CHANGED
|
@@ -23,13 +23,12 @@ after checking an uncertain outcome.
|
|
|
23
23
|
## Turns
|
|
24
24
|
|
|
25
25
|
Ack T<number> first with keyed
|
|
26
|
-
`board inbox ack <entries>`; only its acking session may submit or return.
|
|
27
|
-
close turns outside Dev; taken Dev turns survive pushes.
|
|
26
|
+
`board inbox ack <entries>`; only its acking session may submit or return.
|
|
28
27
|
On `turn_closed`, act only on a turn `board inbox` lists. Shadow mode opens no turn:
|
|
29
28
|
`board submit <task> <sha>`.
|
|
30
29
|
|
|
31
|
-
- Dev worker: ack,
|
|
32
|
-
Re-request review only from reviewers whose threads
|
|
30
|
+
- Dev worker: ack, then keyed `board submit <turn> <sha>` for the PR head. Answer each external comment the turn hands you with a new head or a reasoned reply; a reply alone submits the same head.
|
|
31
|
+
Re-request review only from reviewers whose threads your push closed.
|
|
33
32
|
If returns repeat the same mechanism, fix the class once; one table test for variants;
|
|
34
33
|
edges with no user-visible effect under PR Risk; still fix P0/P1 and user-visible findings.
|
|
35
34
|
- Column orchestrator: ack, then keyed `board submit <turn> <sha>` for the reviewed head, or
|
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
# How the Board works
|
|
2
2
|
|
|
3
|
-
`board task <task> --why`: gates, holds, waits, turn and moves.
|
|
4
|
-
|
|
5
3
|
## Columns and executors
|
|
6
4
|
|
|
7
5
|
`todo`, `ready-for-dev`, `dev`, `review`, `product-review`,
|
|
8
6
|
`external-review`, `qa`, `ready-to-merge`, `done`.
|
|
9
|
-
`projects[].columns[].enabled
|
|
7
|
+
`projects[].columns[].enabled`: disabled/omitted columns skip gates;
|
|
10
8
|
To Do, Dev, Done stay enabled.
|
|
11
9
|
|
|
12
10
|
Each column has one executor: `projects[].columns[].orchestrator`:
|
|
13
11
|
`none` (live worker, else operator), `operator`, or project with role
|
|
14
|
-
`orchestrator` or `curator`. The worker owns the code and branch; others
|
|
15
|
-
submit inspected heads or return findings; never push.
|
|
12
|
+
`orchestrator` or `curator`. The worker owns the code and branch; others inspect/return, never push.
|
|
16
13
|
|
|
17
14
|
`projects[].spurProjects[].role` accepts `worker`, `operator`, `curator` and
|
|
18
|
-
`orchestrator`.
|
|
15
|
+
`orchestrator`.
|
|
19
16
|
|
|
20
17
|
## Gates and placement
|
|
21
18
|
|
|
@@ -24,65 +21,83 @@ per evaluation). Turns follow unmet entry gates, actionable post-submit failures
|
|
|
24
21
|
rerouting or Done wrap-up. Holds and existing turns can yield neither action.
|
|
25
22
|
|
|
26
23
|
Moves, turns and course checks need `projects[].dispatcher.mode: on`;
|
|
27
|
-
default is `shadow`:
|
|
24
|
+
default is `shadow`: no doorbells or blocks.
|
|
28
25
|
|
|
29
26
|
Gates are cumulative: each column checks its enabled gate and those to its left. At a turn boundary, failed gates return to the leftmost failing
|
|
30
|
-
column.
|
|
27
|
+
column. Pending CI, unknown
|
|
31
28
|
mergeability and incomplete comment history are waits. Downstream handoff waits
|
|
32
|
-
for settled prerequisites; Dev can receive a repair turn
|
|
33
|
-
conflicts or unhandled external comments.
|
|
29
|
+
for settled prerequisites; Dev can receive a repair turn.
|
|
34
30
|
|
|
35
|
-
Dev needs an open non-draft PR, passing checks, no conflict, handled
|
|
31
|
+
Dev needs an open non-draft PR, passing checks, no conflict, handled
|
|
36
32
|
feedback, comment history and current-head submit. Feedback excludes
|
|
37
33
|
bots, approvals and `projects[].operatorGithubLogin` (agents' account), so worker
|
|
38
34
|
thread replies never count; others' posts do.
|
|
35
|
+
The repo owner's and the human operator's own accounts count too, unless one is
|
|
36
|
+
that login: a PR comment is a change request; talk to agents in Slack
|
|
37
|
+
(`@shortName`) or the Board. A review-thread reply is a new review. An approval
|
|
38
|
+
hides its inline comments; thread resolution and the head a comment was left on
|
|
39
|
+
change nothing for feedback. Bots (GitHub Apps) neither return a task, approve it nor block
|
|
40
|
+
an approval; their threads still count. Handled means handed by ID to a Dev turn, not answered; in shadow
|
|
41
|
+
mode, a later submit in Dev or an executor `none` column handles it.
|
|
39
42
|
A status comment whose last line is a hidden `board-reviewer-progress` or
|
|
40
|
-
`board-reviewer-unavailable` marker is not external feedback. No required checks:
|
|
43
|
+
`board-reviewer-unavailable` marker is not external feedback. No required checks: non-skipped count. `projects[].reposWithoutCi` waives absent checks
|
|
41
44
|
for listed repos; never failed/skipped required ones.
|
|
42
45
|
|
|
43
46
|
Review and Product Review need current-head internal review marks, separate from
|
|
44
|
-
External Review's external approval. QA: current-head submit; Ready to Merge awaits merge. Executor `none` may reuse same-head submits
|
|
45
|
-
except enabled columns
|
|
47
|
+
External Review's external approval. QA: current-head submit; Ready to Merge awaits merge. Executor `none` may reuse same-head submits of other worker columns. Fixed gate rules have no configuration switch
|
|
48
|
+
except enabled columns, no-CI and resolved threads.
|
|
49
|
+
|
|
50
|
+
`projects[].columns[].requireResolvedThreads` (default: `ready-to-merge` only)
|
|
51
|
+
gates that column and those right of it: an unresolved review thread, outdated
|
|
52
|
+
or by anyone, returns the task to Dev, whose turn lists each thread link. The
|
|
53
|
+
worker fixes or answers, then resolves each; reviewers never do. A
|
|
54
|
+
Dev submit on the same head moves right, keeping marks and approval. An
|
|
55
|
+
approval's inline notes are threads; it still passes External Review.
|
|
46
56
|
|
|
47
57
|
Review/Product Review mark lasts across visits on the current head. A visit
|
|
48
|
-
submission belongs to one column visit; moving left clears it and those to the right. New heads invalidate internal Review and Product Review marks
|
|
49
|
-
even old heads.
|
|
58
|
+
submission belongs to one column visit; moving left clears it and those to the right. New heads invalidate internal Review and Product Review marks.
|
|
50
59
|
|
|
51
|
-
|
|
52
|
-
ticket with live work and no merged PR. `board status` lists them
|
|
53
|
-
as operator block threads.
|
|
60
|
+
PR closed without merge with no open PR, or closed
|
|
61
|
+
ticket with live work and no merged PR. `board status` lists them as operator block threads.
|
|
54
62
|
|
|
55
63
|
## Turns and delivery
|
|
56
64
|
|
|
57
|
-
A turn `T<number>`:
|
|
65
|
+
A turn `T<number>`: keyed `board inbox ack <entries>`.
|
|
58
66
|
Only the acknowledging session may submit or return: keyed
|
|
59
67
|
`board submit <turn> <sha>` accepts the head; keyed
|
|
60
68
|
`board return <turn> <reason>` sends findings to Dev. In
|
|
61
69
|
shadow mode, use keyed `board submit <task> <sha>`.
|
|
62
70
|
Unseen heads answer `pending`: that submit is final; do not resubmit or raise a
|
|
63
|
-
block.
|
|
64
|
-
(`projects[].dispatcher.submitConfirmMs`).
|
|
71
|
+
block. Confirm timeout: `projects[].dispatcher.submitConfirmMs`.
|
|
65
72
|
|
|
66
73
|
A new head closes taken turns outside Dev; taken Dev turns survive pushes.
|
|
67
|
-
|
|
68
|
-
|
|
74
|
+
Right of Dev, red CI, a draft, a conflict, an external comment or an unresolved
|
|
75
|
+
thread where required returns the task to Dev at once, unless a turn is taken; then after its submit or return.
|
|
76
|
+
The Dev turn hands the comments, beside a return's `code` block.
|
|
69
77
|
|
|
70
78
|
Closed turns receive no further Board sends; Obsolete queued rings are dropped;
|
|
71
79
|
a message already accepted by Spur cannot be retracted. Check `board inbox` and
|
|
72
80
|
act only on a current turn; reread after `turn_closed`.
|
|
73
81
|
|
|
82
|
+
Open-turn executors in `needs_input`, `error`, `rate_limited` or `stopped` raise
|
|
83
|
+
one question after `health.turnStallAfterMs` (default 600000): curator unless self, else
|
|
84
|
+
operator. Time starts at the later turn/state start; taking never resets it.
|
|
85
|
+
One frozen explanation/dismissal per turn/session/state episode. Recovery,
|
|
86
|
+
replacement, removal, archive or turn closure withdraws it. Blind Spur opens none,
|
|
87
|
+
holds existing; gaps restart timing for new questions.
|
|
88
|
+
|
|
74
89
|
## Doorbells
|
|
75
90
|
|
|
76
91
|
A turn opened for you by your own confirmed submit or return is first rung only after `doorbells.firstRetryMs`; a turn opened for you any other way rings at once.
|
|
77
92
|
|
|
78
93
|
A doorbell expects action: read `board inbox` for the turn, addressed
|
|
79
94
|
block, answer or follow-up. Ordinary task comments do not ring; nor does a block
|
|
80
|
-
tracked by its author role ring itself.
|
|
95
|
+
tracked by its author role ring itself.
|
|
81
96
|
|
|
82
|
-
|
|
97
|
+
Repeat up to three delivered rings;
|
|
83
98
|
acknowledgement stops them. Removal notices and quiet-turn reminders ring once.
|
|
84
99
|
Busy recipients defer delivery; pending delivery or earlier rings in the Spur
|
|
85
|
-
queue defer repeats.
|
|
100
|
+
queue defer repeats. Queues can exhaust their waiting window.
|
|
86
101
|
|
|
87
102
|
Most notices await recipients; taskless worker, orchestrator and operator-agent
|
|
88
103
|
answers end without a live asking session. Curator and course-check orchestrator
|
|
@@ -92,30 +107,28 @@ curator questions move to operator.
|
|
|
92
107
|
|
|
93
108
|
## Course checks and cycle limits
|
|
94
109
|
|
|
95
|
-
`projects[].columns[].courseCheck` defaults to 3
|
|
110
|
+
`projects[].columns[].courseCheck` defaults to 3 returns to Dev;
|
|
96
111
|
`courseCheck: 0` disables it. `projects[].columns[].cycleLimit` defaults to 10 and
|
|
97
|
-
takes priority. Executor returns
|
|
98
|
-
CI failures, conflicts and drafts alone do not count, nor
|
|
99
|
-
mode switches.
|
|
112
|
+
takes priority. Executor returns and external comments (a changes-requested
|
|
113
|
+
review is one) count, as do thread returns; CI failures, conflicts and drafts alone do not count, nor
|
|
114
|
+
reopened tickets or mode switches.
|
|
100
115
|
|
|
101
|
-
Checks hold for input.
|
|
102
116
|
If returns keep hitting the same mechanism, fix the bug class once; cover its variants with one table test. Put remaining edges with no user-visible effect under Risk in the PR description. Still fix P0/P1 and user-visible findings in this PR.
|
|
103
117
|
`projects[].columns[].courseCheckTo`: `operator`, curator or column orchestrator.
|
|
104
118
|
Default: curator (`projects[].spurProjects[].role`), else operator. An answer
|
|
105
119
|
resets the course count and reaches the worker as a task comment. Only the
|
|
106
120
|
operator can resolve the separate cycle limit and reset its count. With no live
|
|
107
121
|
session it falls back to the operator; a live conductor that does not
|
|
108
|
-
answer keeps the question
|
|
122
|
+
answer keeps the question.
|
|
109
123
|
|
|
110
124
|
## Blocks and escalation
|
|
111
125
|
|
|
112
126
|
A question (`needs_input`): column orchestrator, else curator, else
|
|
113
|
-
operator. Routing avoids asking yourself
|
|
114
|
-
ask the operator.
|
|
127
|
+
operator. Routing avoids asking yourself; curators ask the operator.
|
|
115
128
|
|
|
116
129
|
A `code` block goes to the worker; `dependency` or `external` block stays with
|
|
117
130
|
its author's role. Escalation: column orchestrator to curator to
|
|
118
|
-
operator; other blocks escalate straight to the operator.
|
|
131
|
+
operator; other blocks escalate straight to the operator. Keyed
|
|
119
132
|
`board escalate <block>` if its addressee cannot resolve it.
|
|
120
133
|
|
|
121
134
|
Taskless: all roles, operator only:
|
|
@@ -123,13 +136,13 @@ Taskless: all roles, operator only:
|
|
|
123
136
|
Project `needs_input` blocks get Slack threads except operator-agent asks;
|
|
124
137
|
operator: `board inbox`, keyed `board answer`. Answers reach a current curator session; other roles use the asking session.
|
|
125
138
|
|
|
126
|
-
|
|
127
|
-
`operator.slack
|
|
139
|
+
`projects[].columns[].orchestrator`, `projects[].spurProjects[].role`,
|
|
140
|
+
`operator.slack`.
|
|
128
141
|
|
|
129
142
|
## Slack now
|
|
130
143
|
|
|
131
144
|
`slack.channels.feed`: curator answers and operator items,
|
|
132
|
-
except items
|
|
145
|
+
except delivery/health/ended-worker items and blocks.
|
|
133
146
|
`slack.channels.orchestrators`: block threads addressed to the operator by
|
|
134
147
|
others. Answer in the existing block thread.
|
|
135
148
|
|
|
@@ -144,13 +157,12 @@ Middle mentions or Slack `<@U…>` address nobody; unknown names cause no lookup
|
|
|
144
157
|
error. The operator checks short-name collisions with workspace names.
|
|
145
158
|
A task key after the prefix attaches it.
|
|
146
159
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
else project name/role icon (`board` for operator). No session:
|
|
160
|
+
Read `board inbox`; reply via `board answer`. Each operator thread message rings again; `close` or ✅ in the
|
|
161
|
+
thread closes it. Replies use `projects[].spurProjects[].displayName` and `icon`.
|
|
162
|
+
No session:
|
|
151
163
|
`board status` lists it as waiting.
|
|
152
164
|
|
|
153
165
|
## Done follows the ticket
|
|
154
166
|
|
|
155
|
-
One linked PR merging does not by itself finish the task. Done
|
|
156
|
-
closed. If open
|
|
167
|
+
One linked PR merging does not by itself finish the task. Done: `projects[].tracker.doneStatuses` for Jira; for GitHub, the Issue must be
|
|
168
|
+
closed. If still open, link another PR.
|