spur-board 0.44.1 → 0.44.3

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/cli.mjs CHANGED
@@ -493,12 +493,13 @@ async function runDoctor(options = {}) {
493
493
  const version = ports.productVersion();
494
494
  const stamps = [".claude", ".codex"].flatMap((agent) => ["spur-board", "spur-board-setup"].map((skill) => stamp(ports, join(home, agent, "skills", skill, ".spur-board-install.json"))));
495
495
  const latestInstall = Math.max(...stamps.flatMap((entry) => entry === null ? [] : [entry.installedAt]));
496
- const stale = sessions.filter((session) => session.startAt !== void 0 && session.startAt < latestInstall);
497
- const unknownStarts = sessions.some((session) => session.startAt === void 0);
496
+ const connected = sessions.filter((session) => session.project !== void 0 && configured.has(session.project));
497
+ const stale = connected.filter((session) => session.startAt !== void 0 && session.startAt < latestInstall);
498
+ const unknownStarts = connected.some((session) => session.startAt === void 0);
498
499
  const staleSessions = [...new Set(stale.map((session) => session.id))];
499
500
  const staleIds = safeIds(staleSessions);
500
501
  const staleCount = staleSessions.length === 0 ? "sessions" : `${String(staleSessions.length)} session${staleSessions.length === 1 ? "" : "s"}`;
501
- checks.push(stale.length > 0 || unknownStarts ? warning("sessions.stale", `Restart ${staleCount} started before the last skill install${listing(staleIds)}; verify sessions whose start time is unavailable.`) : result("sessions.stale", true, "Restart older sessions."));
502
+ checks.push(stale.length > 0 || unknownStarts ? warning("sessions.stale", `Ask ${staleCount} started before the last skill install to re-read the spur-board skill (SKILL.md and references/)${listing(staleIds)}. Claude Code reads it from ~/.claude/skills/spur-board, Codex from ~/.codex/skills/spur-board ($CODEX_HOME/skills/spur-board when set). No restart is needed; doctor keeps listing a session after it re-reads.${unknownStarts ? " Ask connected sessions whose start time is unavailable to re-read it too." : ""}`) : result("sessions.stale", true, "Ask older sessions to re-read the spur-board skill."));
502
503
  const portFix = await checkHttpPort(config.http.port, {
503
504
  bind: ports.bind,
504
505
  run: (command, args) => Promise.resolve(ports.run(command, args))
@@ -1860,7 +1861,7 @@ async function update(updater, options, requested) {
1860
1861
  }
1861
1862
  updater.finish(state, "succeeded", null);
1862
1863
  const stale = report.find((check) => check.id === "sessions.stale");
1863
- const operator = [MCP_LINE, ...stale?.status === "warning" && stale.fix !== null ? [`Stop and wake these Spur sessions so they load the new skill: ${stale.fix}`] : []];
1864
+ const operator = [MCP_LINE, ...stale?.status === "warning" && stale.fix !== null ? [stale.fix] : []];
1864
1865
  return {
1865
1866
  from,
1866
1867
  to,
package/dist/daemon.mjs CHANGED
@@ -12858,7 +12858,7 @@ function evaluateSessionHealth(input) {
12858
12858
  sessionId: session.id,
12859
12859
  kind: ENDED_WORKER_KINDS[session.endReason]
12860
12860
  };
12861
- (spur.observationComplete ? flags : held).push(flag);
12861
+ (spur.observationComplete && prsPolledSince(task, session.endedAt) ? flags : held).push(flag);
12862
12862
  }
12863
12863
  continue;
12864
12864
  }
@@ -12873,10 +12873,14 @@ function evaluateSessionHealth(input) {
12873
12873
  if (session.role === "other") continue;
12874
12874
  const heldMs = now - Date.parse(session.healthSince);
12875
12875
  let kind = null;
12876
+ let fresh = true;
12876
12877
  if (session.health === "error" && episode === null && heldMs >= config.errorAfterMs) kind = session.role === "worker" ? "stuck_worker" : "stuck_orchestrator";
12877
12878
  else if (session.health === "needs_input" && heldMs >= config.needsInputAfterMs) kind = "needs_input";
12878
- else if (session.health === "waiting" && session.role === "worker" && task !== void 0 && !task.hasOpenPr && heldMs >= config.idleInDevAfterMs) kind = "worker_idle";
12879
- if (kind !== null) flags.push({
12879
+ else if (session.health === "waiting" && session.role === "worker" && task !== void 0 && !task.hasOpenPr && heldMs >= config.idleInDevAfterMs) {
12880
+ kind = "worker_idle";
12881
+ fresh = prsPolledSince(task, session.healthSince);
12882
+ }
12883
+ if (kind !== null) (fresh ? flags : held).push({
12880
12884
  taskId: session.taskId,
12881
12885
  sessionId: session.id,
12882
12886
  kind
@@ -12890,6 +12894,10 @@ function evaluateSessionHealth(input) {
12890
12894
  episode
12891
12895
  };
12892
12896
  }
12897
+ /** Whether every PR source of the task completed a poll that began at or after `since`. */
12898
+ function prsPolledSince(task, since) {
12899
+ return task.prCompleteAt !== null && task.prCompleteAt >= Date.parse(since);
12900
+ }
12893
12901
  //#endregion
12894
12902
  //#region ../core/src/app/fromYou.ts
12895
12903
  const episodeSchema = z.object({ startedAt: z.number() }).nullable();
@@ -13019,12 +13027,14 @@ async function reconcileItems(trx, config, now, spurComplete) {
13019
13027
  "link.number",
13020
13028
  "pr_snapshot.state",
13021
13029
  "pr_snapshot.source",
13022
- "pr_snapshot.observed_at"
13030
+ "pr_snapshot.observed_at",
13031
+ "pr_snapshot.detail"
13023
13032
  ]).where("link.entity", "=", "pr").where("link.banned", "=", 0).where(pastReopenFloor).execute();
13024
13033
  const taskPrs = {};
13025
13034
  for (const task of tasks) taskPrs[String(task.id)] = {
13026
13035
  hasOpenPr: false,
13027
13036
  hasMergedPr: false,
13037
+ prCompleteAt: prCompleteAt(config.projects.find((entry) => entry.id === task.project), sourceById),
13028
13038
  turnSessions: []
13029
13039
  };
13030
13040
  for (const pr of prs) {
@@ -13038,6 +13048,7 @@ async function reconcileItems(trx, config, now, spurComplete) {
13038
13048
  const holder = turn.acked_by === null ? null : parseActorId(turn.acked_by);
13039
13049
  if (holder?.actor === "agent") taskPrs[String(turn.task_id)]?.turnSessions.push(holder.actorRef.session);
13040
13050
  }
13051
+ const heldKeys = [];
13041
13052
  for (const task of tasks) {
13042
13053
  const state = taskPrs[String(task.id)];
13043
13054
  if (state === void 0 || state.hasOpenPr || state.hasMergedPr) continue;
@@ -13047,9 +13058,15 @@ async function reconcileItems(trx, config, now, spurComplete) {
13047
13058
  })).sort((left, right) => left.ref.localeCompare(right.ref));
13048
13059
  const first = closed[0];
13049
13060
  if (first === void 0) continue;
13061
+ const closedAt = Math.max(...closed.map((pr) => pr.detail === null ? NaN : Date.parse(parseJson(prFactsSchema, pr.detail).updatedAt)));
13062
+ const key = `pr-closed:${String(task.id)}`;
13063
+ if (state.prCompleteAt === null || !(state.prCompleteAt >= closedAt)) {
13064
+ heldKeys.push(key);
13065
+ continue;
13066
+ }
13050
13067
  const refs = closed.map((pr) => pr.ref);
13051
13068
  candidates.push({
13052
- key: `pr-closed:${String(task.id)}`,
13069
+ key,
13053
13070
  kind: "anomaly",
13054
13071
  taskId: task.id,
13055
13072
  summary: `${task.key}: linked pull request ${refs.join(", ")} closed without merge, no open PR`,
@@ -13065,7 +13082,6 @@ async function reconcileItems(trx, config, now, spurComplete) {
13065
13082
  "detail",
13066
13083
  "source"
13067
13084
  ]).execute();
13068
- const unpolledTickets = [];
13069
13085
  for (const task of tasks) {
13070
13086
  const state = taskPrs[String(task.id)];
13071
13087
  const project = config.projects.find((entry) => entry.id === task.project);
@@ -13082,13 +13098,11 @@ async function reconcileItems(trx, config, now, spurComplete) {
13082
13098
  });
13083
13099
  if (!closedWhileLive) continue;
13084
13100
  const { updatedAt } = parseJson(ticketFactsSchema, ticket.detail);
13085
- const polled = project.repos.every((repo) => {
13086
- const repoSource = sourceById.get(`github:${project.id}:${repo.toLowerCase()}`);
13087
- return repoSource !== void 0 && repoSource.blind_reason === null && repoSource.last_complete_at !== null && Date.parse(repoSource.last_complete_at) > Date.parse(updatedAt);
13088
- });
13101
+ const polledAt = state.prCompleteAt;
13102
+ const polled = polledAt !== null && polledAt > Date.parse(updatedAt);
13089
13103
  const key = `ticket-closed:${String(task.id)}`;
13090
13104
  if (!polled) {
13091
- unpolledTickets.push(key);
13105
+ heldKeys.push(key);
13092
13106
  continue;
13093
13107
  }
13094
13108
  candidates.push({
@@ -13161,7 +13175,7 @@ async function reconcileItems(trx, config, now, spurComplete) {
13161
13175
  }
13162
13176
  }
13163
13177
  const ordered = orderItems(candidates);
13164
- const seen = /* @__PURE__ */ new Set([...ordered.map((item) => item.key), ...unpolledTickets]);
13178
+ const seen = /* @__PURE__ */ new Set([...ordered.map((item) => item.key), ...heldKeys]);
13165
13179
  for (const flag of health.held) {
13166
13180
  const task = taskById.get(Number(flag.taskId));
13167
13181
  if (task !== void 0) seen.add(healthKey(task.id, flag));
@@ -13215,6 +13229,20 @@ async function reconcileItems(trx, config, now, spurComplete) {
13215
13229
  }
13216
13230
  }
13217
13231
  /**
13232
+ * Start of the oldest last complete poll over the project's GitHub sources, or null while any is
13233
+ * missing, blind or never complete: a replacement PR can be in any of the project's repos.
13234
+ */
13235
+ function prCompleteAt(project, sourceById) {
13236
+ if (project === void 0) return null;
13237
+ let oldest = Infinity;
13238
+ for (const repo of project.repos) {
13239
+ const source = sourceById.get(`github:${project.id}:${repo.toLowerCase()}`);
13240
+ if (source === void 0 || source.blind_reason !== null || source.last_complete_at === null) return null;
13241
+ oldest = Math.min(oldest, Date.parse(source.last_complete_at));
13242
+ }
13243
+ return oldest;
13244
+ }
13245
+ /**
13218
13246
  * Raises a ledger item with the operator block it stands for. An active item of the key is
13219
13247
  * returned as it is, so a repeated raise opens no second block.
13220
13248
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spur-board",
3
- "version": "0.44.1",
3
+ "version": "0.44.3",
4
4
  "license": "MIT",
5
5
  "engines": {
6
6
  "node": "^24.12.0 || ^26.0.0"
@@ -36,7 +36,7 @@ Ask one question at a time, only when current state cannot answer it. Check befo
36
36
 
37
37
  ## 5. Finish
38
38
 
39
- - Run `board doctor --json`. For each failed check, inspect state, apply its `fix` with any needed consent, and repeat until green. Report warnings, especially live sessions started before the last skill install; they must restart to load it.
39
+ - Run `board doctor --json`. For each failed check, inspect state, apply its `fix` with any needed consent, and repeat until green. Report warnings; have sessions in `sessions.stale` re-read the `spur-board` skill (SKILL.md, references/).
40
40
  - Wait for the feed's `spur-board is live` line after the first complete poll. If absent, inspect doctor checks and service logs and continue the fix loop. Confirm receipt without exposing a channel ID.
41
41
 
42
42
  ## Update
@@ -8,7 +8,7 @@ Use this when the installed package is older than the intended release. `board u
8
8
  3. The update needs a running daemon. If the service is stopped, ask before starting it with `board service restart`.
9
9
  4. Tell the operator the installed version and the target, then ask before updating. The service is down for the update.
10
10
  5. Run `board update` for the latest release, or `board update <version>` for a named one. Progress lines go to stderr; the JSON result goes to stdout. A result with `changed` as `false` means the version was already installed; stop there.
11
- 6. On success, report `from`, `to`, `database.schemaChanged` and each `operator` line. Agent sessions that run `board mcp` must restart to load the new catalog; Spur sessions named as stale must stop and wake to load the new skill. Do not restart the service or reinstall the skills again: the update did both.
11
+ 6. On success, report `from`, `to`, `database.schemaChanged` and each `operator` line. Agent sessions that run `board mcp` must restart to load the new catalog; ask the Spur sessions named in the `sessions.stale` line to re-read the `spur-board` skill (SKILL.md and references/); no restart is needed. Do not restart the service or reinstall the skills again: the update did both.
12
12
  7. On exit 4 with `update_rolled_back`, the previous version is running again unless the hint reports a failed restart. Report the hint: it names the failed step and says whether the database was kept, restored, or not changed. At `first poll`, a source did not finish its first complete poll within five minutes. Fix the cause with the operator, then run `board update` again.
13
13
  8. On exit 4 with `rollback_failed`, follow `Failed update or rollback` in TROUBLESHOOTING.md: fix the step the hint names, then run `board rollback --yes` again.
14
14
  9. On any other exit 4 (`config`) or exit 2 (`usage`), nothing was changed. Report the hint and fix what it names; an older target is refused and points to `board rollback`. When another update or rollback holds the update lock, the hint gives the PID that took it: wait for it and the install it started to finish, and never remove the lock file.
@@ -22,4 +22,4 @@ Do this once; every later upgrade uses `board update`.
22
22
  1. Install the newer package with the Node and user prefix of a live Spur session. Verify `board --version` there.
23
23
  2. Note whether `board service status` reports `active` as `active`. Run the new package's `board service install`. Run `board service restart` only when the service was active before, install reported `changed` as `false`, and the daemon version changed.
24
24
  3. Ask before writing agent skill folders, then run `board skills install`.
25
- 4. Run `board doctor --json` until no blocking check remains. Ask the operator to restart live sessions that still use the older skill.
25
+ 4. Run `board doctor --json` until no blocking check remains. Ask the operator to have live sessions that still use the older skill re-read the `spur-board` skill.