spur-board 0.105.0 → 0.105.1
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/daemon.mjs
CHANGED
|
@@ -15531,15 +15531,6 @@ function evaluateSessionHealth(input) {
|
|
|
15531
15531
|
seen.add(identity);
|
|
15532
15532
|
const task = tasks[session.taskId];
|
|
15533
15533
|
if (session.endedAt !== null) {
|
|
15534
|
-
if (session.role === "worker" && (session.endReason === "kill" || session.endReason === "vanished") && task?.turnSessions?.includes(session.id) === true && !liveWorkerTasks.has(session.taskId)) {
|
|
15535
|
-
const flag = {
|
|
15536
|
-
taskId: session.taskId,
|
|
15537
|
-
sessionId: session.id,
|
|
15538
|
-
kind: "worker_lost"
|
|
15539
|
-
};
|
|
15540
|
-
(spur.observationComplete ? flags : held).push(flag);
|
|
15541
|
-
continue;
|
|
15542
|
-
}
|
|
15543
15534
|
if (session.role === "worker" && (session.endReason === "complete" || session.endReason === "kill" || session.endReason === "vanished") && task !== void 0 && !task.hasOpenPr && !task.hasMergedPr && !liveWorkerTasks.has(session.taskId)) {
|
|
15544
15535
|
const flag = {
|
|
15545
15536
|
taskId: session.taskId,
|
|
@@ -15603,16 +15594,14 @@ const stallObservationSchema = z.object({
|
|
|
15603
15594
|
const ENDED_WORKER_LABELS = {
|
|
15604
15595
|
worker_completed: "worker ended (completed), no PR",
|
|
15605
15596
|
worker_killed: "worker ended (killed), no PR",
|
|
15606
|
-
worker_vanished: "worker vanished, no PR"
|
|
15607
|
-
worker_lost: "worker ended during its open turn"
|
|
15597
|
+
worker_vanished: "worker vanished, no PR"
|
|
15608
15598
|
};
|
|
15609
15599
|
/** Health flags only the operator can resolve; each opens an operator block. */
|
|
15610
15600
|
const ANOMALY_FLAGS = /* @__PURE__ */ new Set([
|
|
15611
15601
|
"stuck_worker",
|
|
15612
15602
|
"stuck_orchestrator",
|
|
15613
15603
|
"needs_input",
|
|
15614
|
-
"worker_completed"
|
|
15615
|
-
"worker_lost"
|
|
15604
|
+
"worker_completed"
|
|
15616
15605
|
]);
|
|
15617
15606
|
/**
|
|
15618
15607
|
* The item for an open operator conversation with a ring that waits for a live session of its
|
|
@@ -15676,6 +15665,7 @@ async function reconcileItems(trx, config, now, spurComplete, warnSkipped, spurC
|
|
|
15676
15665
|
}
|
|
15677
15666
|
const tasks = await trx.selectFrom("task").selectAll().where("membership", "!=", "archived").execute();
|
|
15678
15667
|
const taskById = new Map(tasks.map((task) => [task.id, task]));
|
|
15668
|
+
const endedHolders = await endedTurnItems(trx, taskById, candidates, new Date(now));
|
|
15679
15669
|
const misses = await trx.selectFrom("source_miss").selectAll().execute();
|
|
15680
15670
|
for (const miss of misses) {
|
|
15681
15671
|
if (miss.gone !== 1) continue;
|
|
@@ -15790,8 +15780,7 @@ async function reconcileItems(trx, config, now, spurComplete, warnSkipped, spurC
|
|
|
15790
15780
|
for (const task of tasks) taskPrs[String(task.id)] = {
|
|
15791
15781
|
hasOpenPr: false,
|
|
15792
15782
|
hasMergedPr: false,
|
|
15793
|
-
prCompleteAt: prCompleteAt(config.projects.find((entry) => entry.id === task.project), sourceById)
|
|
15794
|
-
turnSessions: []
|
|
15783
|
+
prCompleteAt: prCompleteAt(config.projects.find((entry) => entry.id === task.project), sourceById)
|
|
15795
15784
|
};
|
|
15796
15785
|
const tickets = await trx.selectFrom("ticket_snapshot").select([
|
|
15797
15786
|
"task_id",
|
|
@@ -15818,11 +15807,6 @@ async function reconcileItems(trx, config, now, spurComplete, warnSkipped, spurC
|
|
|
15818
15807
|
const project = config.projects.find((entry) => entry.id === task.project);
|
|
15819
15808
|
state.hasMergedPr = at === null || project === void 0 || mergedTicket(project, config, tickets.find((entry) => entry.task_id === taskId), task.manual_include === 1, at) !== "open";
|
|
15820
15809
|
}
|
|
15821
|
-
const workerTurns = await trx.selectFrom("turn").select(["task_id", "acked_by"]).where("role", "=", "worker").where("closed_at", "is", null).where("acked_at", "is not", null).execute();
|
|
15822
|
-
for (const turn of workerTurns) {
|
|
15823
|
-
const holder = turn.acked_by === null ? null : parseActorId(turn.acked_by);
|
|
15824
|
-
if (holder?.actor === "agent") taskPrs[String(turn.task_id)]?.turnSessions.push(holder.actorRef.session);
|
|
15825
|
-
}
|
|
15826
15810
|
const heldKeys = [];
|
|
15827
15811
|
for (const task of tasks) {
|
|
15828
15812
|
const state = taskPrs[String(task.id)];
|
|
@@ -16021,6 +16005,7 @@ async function reconcileItems(trx, config, now, spurComplete, warnSkipped, spurC
|
|
|
16021
16005
|
value: toJson(episodeSchema, health.episode)
|
|
16022
16006
|
}).onConflict((oc) => oc.column("key").doUpdateSet({ value: toJson(episodeSchema, health.episode) })).execute();
|
|
16023
16007
|
for (const flag of health.flags) {
|
|
16008
|
+
if (endedHolders.has(`${flag.taskId}:${flag.sessionId}`)) continue;
|
|
16024
16009
|
const task = taskById.get(Number(flag.taskId));
|
|
16025
16010
|
if (task === void 0) continue;
|
|
16026
16011
|
const fact = subjects.find((subject) => subject.taskId === flag.taskId && subject.id === flag.sessionId);
|
|
@@ -16050,11 +16035,11 @@ async function reconcileItems(trx, config, now, spurComplete, warnSkipped, spurC
|
|
|
16050
16035
|
const threshold = stuckTurnAfterMs(config);
|
|
16051
16036
|
for (const { turn, sessionId, ended, quietSince, reminder, delivered } of await quietTurns(trx)) {
|
|
16052
16037
|
const task = taskById.get(turn.task_id);
|
|
16053
|
-
if (task === void 0 || quietSince === null || flagged.has(sessionId)) continue;
|
|
16038
|
+
if (ended || task === void 0 || quietSince === null || flagged.has(sessionId)) continue;
|
|
16054
16039
|
const quiet = Date.parse(quietSince);
|
|
16055
16040
|
const reminded = reminder !== void 0 && delivered && reminder.acked_at !== null && now >= Math.max(Date.parse(reminder.acked_at), quiet) + threshold;
|
|
16056
16041
|
const unreached = reminder !== void 0 && reminder.exhausted_at !== null && now >= quiet + threshold;
|
|
16057
|
-
if (!reminded && !unreached
|
|
16042
|
+
if (!reminded && !unreached) continue;
|
|
16058
16043
|
candidates.push({
|
|
16059
16044
|
key: `stuck-turn:${String(turn.id)}`,
|
|
16060
16045
|
kind: "anomaly",
|
|
@@ -16070,6 +16055,7 @@ async function reconcileItems(trx, config, now, spurComplete, warnSkipped, spurC
|
|
|
16070
16055
|
const ordered = orderItems(candidates);
|
|
16071
16056
|
const seen = /* @__PURE__ */ new Set([...ordered.map((item) => item.key), ...heldKeys]);
|
|
16072
16057
|
for (const flag of health.held) {
|
|
16058
|
+
if (endedHolders.has(`${flag.taskId}:${flag.sessionId}`)) continue;
|
|
16073
16059
|
const task = taskById.get(Number(flag.taskId));
|
|
16074
16060
|
if (task !== void 0 && !stalled.has(`${flag.taskId}:${flag.sessionId}`)) seen.add(healthKey(task.id, flag));
|
|
16075
16061
|
}
|
|
@@ -16079,7 +16065,7 @@ async function reconcileItems(trx, config, now, spurComplete, warnSkipped, spurC
|
|
|
16079
16065
|
sessionId: subject.id,
|
|
16080
16066
|
kind: subject.role === "worker" ? "stuck_worker" : "stuck_orchestrator"
|
|
16081
16067
|
})));
|
|
16082
|
-
const spurHeld = spurBlind ? await blindHeldKeys(trx, subjects) : /* @__PURE__ */ new Set();
|
|
16068
|
+
const spurHeld = spurBlind ? await blindHeldKeys(trx, subjects.filter((subject) => !endedHolders.has(`${subject.taskId}:${subject.id}`))) : /* @__PURE__ */ new Set();
|
|
16083
16069
|
if (stallBlind) for (const key of stallHeld) spurHeld.add(key);
|
|
16084
16070
|
for (const item of existing) {
|
|
16085
16071
|
if (item.kind !== "anomaly") continue;
|
|
@@ -16191,16 +16177,44 @@ async function closeEndedDoneTurns(trx, at) {
|
|
|
16191
16177
|
reason: "moved",
|
|
16192
16178
|
at
|
|
16193
16179
|
});
|
|
16194
|
-
const keys = [`stuck-turn:${String(turn.id)}`,
|
|
16195
|
-
taskId: String(turn.task_id),
|
|
16196
|
-
sessionId,
|
|
16197
|
-
kind: "worker_lost"
|
|
16198
|
-
})];
|
|
16180
|
+
const keys = [`stuck-turn:${String(turn.id)}`, `health:${String(turn.task_id)}:${sessionId}:worker_lost`];
|
|
16199
16181
|
const items = await trx.selectFrom("operator_item").selectAll().where("item_key", "in", keys).where("cleared_at", "is", null).execute();
|
|
16200
16182
|
const reason = `turn T${String(turn.id)} closed: its holder ${sessionId} ended in Done`;
|
|
16201
16183
|
for (const item of items) await clearReconciled(trx, item, at, reason);
|
|
16202
16184
|
}
|
|
16203
16185
|
}
|
|
16186
|
+
/** Raise ended-holder attention from ownership, independent of links, PRs and source freshness. */
|
|
16187
|
+
async function endedTurnItems(trx, tasks, candidates, at) {
|
|
16188
|
+
const holders = /* @__PURE__ */ new Set();
|
|
16189
|
+
const turns = await trx.selectFrom("turn").selectAll().where("closed_at", "is", null).where("acked_at", "is not", null).execute();
|
|
16190
|
+
for (const turn of turns) {
|
|
16191
|
+
const holder = turn.acked_by === null ? null : parseActorId(turn.acked_by);
|
|
16192
|
+
if (holder?.actor !== "agent") continue;
|
|
16193
|
+
const sessionId = holder.actorRef.session;
|
|
16194
|
+
const session = await trx.selectFrom("session_snapshot").selectAll().where("id", "=", sessionId).executeTakeFirst();
|
|
16195
|
+
if (session === void 0 || session.ended_at === null) continue;
|
|
16196
|
+
const parsed = sessionFactsSchema.safeParse(JSON.parse(session.detail));
|
|
16197
|
+
if (!parsed.success || parsed.data.id !== sessionId || parsed.data.spurProject !== holder.actorRef.project || parsed.data.endedAt === null) continue;
|
|
16198
|
+
const keys = [`stuck-turn:${String(turn.id)}`, `health:${String(turn.task_id)}:${sessionId}:worker_lost`];
|
|
16199
|
+
const legacy = await trx.selectFrom("operator_item").selectAll().where("item_key", "in", keys).where("cleared_at", "is", null).execute();
|
|
16200
|
+
const reason = `turn T${String(turn.id)} holder ${sessionId} ended; start a replacement worker or archive the task`;
|
|
16201
|
+
for (const item of legacy) await clearReconciled(trx, item, at, reason);
|
|
16202
|
+
const task = tasks.get(turn.task_id);
|
|
16203
|
+
if (task === void 0 || task.column === "done" || turn.column !== task.column || turn.epoch !== task.column_epoch) continue;
|
|
16204
|
+
holders.add(`${String(task.id)}:${sessionId}`);
|
|
16205
|
+
candidates.push({
|
|
16206
|
+
key: `ended-turn:${String(turn.id)}:${sessionId}`,
|
|
16207
|
+
kind: "worker_ended",
|
|
16208
|
+
taskId: task.id,
|
|
16209
|
+
summary: `${task.key}: turn T${String(turn.id)} holder ${sessionId} ended`,
|
|
16210
|
+
factAt: session.ended_at,
|
|
16211
|
+
revision: session.ended_at,
|
|
16212
|
+
source: "spur",
|
|
16213
|
+
priority: 4
|
|
16214
|
+
});
|
|
16215
|
+
}
|
|
16216
|
+
return holders;
|
|
16217
|
+
}
|
|
16204
16218
|
/**
|
|
16205
16219
|
* Raises the cycle-limit block of a task's column, once while it is open. The operator's close
|
|
16206
16220
|
* of the block or its item is the reset: a later call opens a new block.
|
|
@@ -16227,7 +16241,7 @@ async function blindHeldKeys(trx, subjects) {
|
|
|
16227
16241
|
sessionId: subject.id,
|
|
16228
16242
|
kind
|
|
16229
16243
|
}));
|
|
16230
|
-
for (const { turn } of await quietTurns(trx)) held.add(`stuck-turn:${String(turn.id)}`);
|
|
16244
|
+
for (const { turn, ended } of await quietTurns(trx)) if (!ended) held.add(`stuck-turn:${String(turn.id)}`);
|
|
16231
16245
|
return held;
|
|
16232
16246
|
}
|
|
16233
16247
|
/** A producer's local healthSince can restart without a new current observed health state. */
|
package/package.json
CHANGED
|
@@ -68,9 +68,9 @@ carry the same optional `url`; blocks and turns have no synthetic target.
|
|
|
68
68
|
| `board_observation` `block:` | a block waits for its addressee | answer `B<n>` if it is a question, or close it with a reason; listed only when the block is not addressed to you; otherwise shown as its block | attention | the block closes | stored target |
|
|
69
69
|
| `board_observation` `filter:` | the ticket left the tracker filter but work is live | return the ticket to the tracker filter, or finish or unlink the linked work (`board unlink <task> --pr <pr> --reason <reason>`) | attention | the ticket is back in the filter or no linked open PR or live session is left | stored target |
|
|
70
70
|
| `board_observation` `health:` | a session health flag | check session `<session>` in Spur; a vanished worker: start a new worker for the task, or archive the task | attention | the flag ends | stored target |
|
|
71
|
-
| `worker_ended` | the
|
|
71
|
+
| `worker_ended` | an agent holding the current open non-Done turn ended, with any end reason and regardless of PRs or links; also a killed worker without a PR | start a new worker for the task, or archive the task | attention | the turn closes, its holder changes, the task leaves the column visit or is archived; for a worker without a turn, the health flag ends | stored target |
|
|
72
72
|
| `turn` | a turn is yours | listed as its `T…` entry | attention | the turn closes | absent |
|
|
73
|
-
| `anomaly` | a session or turn of the task is stuck,
|
|
73
|
+
| `anomaly` | a live session or turn of the task is stuck, or a worker completed without a PR and has no current open turn | wait for the answer to `B<n>`, or answer it yourself; listed only when addressed to the curator; otherwise shown as its block | attention | the condition ends or its block closes | stored target |
|
|
74
74
|
| `cycle_limit` | the task reached its column's cycle limit | not listed: shown as its block | attention | its block closes | stored target |
|
|
75
75
|
| `course_check` | the task keeps returning from a column | wait for the answer to `B<n>`, or answer it yourself; listed only when addressed to the curator or orchestrator; otherwise shown as its block | attention | its block closes | stored target |
|
|
76
76
|
| `conversation_waiting` | your conversation waits for a live session | start a session in its Spur project, or close `B<n>` with a reason | attention | a session starts or the block closes | stored target |
|
|
@@ -35,6 +35,16 @@ One frozen explanation/dismissal per turn/session/state episode. Recovery,
|
|
|
35
35
|
replacement, removal, archive or turn closure withdraws it. Blind Spur opens none,
|
|
36
36
|
holds existing; gaps restart timing for new questions.
|
|
37
37
|
|
|
38
|
+
An accepted ended session holding the current non-Done turn raises one
|
|
39
|
+
`worker_ended` attention item immediately, with no stall block. Every end reason
|
|
40
|
+
counts, including unknown; an open PR or another linked live session does not
|
|
41
|
+
resolve the held turn. Start a replacement worker or archive the task. The item
|
|
42
|
+
clears on turn closure, actual holder replacement, archive or departure from the
|
|
43
|
+
column visit. Existing ended-holder stall blocks withdraw with a recorded reason,
|
|
44
|
+
even while Spur is blind. Removing a link alone leaves the taken turn unresolved.
|
|
45
|
+
Done wrap-up turns still close when their holder ends. A stopped session without
|
|
46
|
+
an end time remains subject to live stall timing above.
|
|
47
|
+
|
|
38
48
|
## Doorbells
|
|
39
49
|
|
|
40
50
|
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.
|