spur-board 0.105.0 → 0.105.2

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
@@ -3,8 +3,8 @@ import { t as apiBaseUrl } from "./chunk-Bzb7aI8R.mjs";
3
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-D-1P5oeK.mjs";
4
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-gi-XmApc.mjs";
5
5
  import { createHash, randomBytes, randomUUID } from "node:crypto";
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
- import { homedir, hostname, userInfo } from "node:os";
6
+ import { accessSync, chmodSync, closeSync, constants, cpSync, existsSync, ftruncateSync, lstatSync, mkdirSync, mkdtempSync, openSync, readFileSync, readdirSync, readlinkSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync, writeSync } from "node:fs";
7
+ import { homedir, hostname, tmpdir, userInfo } from "node:os";
8
8
  import { basename, dirname, isAbsolute, join, resolve } from "node:path";
9
9
  import { Command, CommanderError } from "@commander-js/extra-typings";
10
10
  import { z } from "zod";
@@ -681,7 +681,9 @@ function renderUserUnit(paths) {
681
681
  ""
682
682
  ].join("\n");
683
683
  }
684
- /** Runs a command to completion. */
684
+ /** How long a child killed for its timeout may take to exit before it gets SIGKILL. */
685
+ const KILL_GRACE_MS = 1e3;
686
+ /** Runs a command to completion, or until `options.timeoutMs` runs out. */
685
687
  async function runCommand(command, args, options = {}) {
686
688
  return new Promise((resolveResult, reject) => {
687
689
  const child = spawn(command, [...args], {
@@ -701,12 +703,28 @@ async function runCommand(command, args, options = {}) {
701
703
  child.stderr?.setEncoding("utf8").on("data", (chunk) => {
702
704
  stderr += chunk;
703
705
  });
704
- child.on("error", reject);
706
+ let timedOut = false;
707
+ let grace;
708
+ const timer = options.timeoutMs === void 0 ? void 0 : setTimeout(() => {
709
+ timedOut = true;
710
+ child.kill("SIGTERM");
711
+ grace = setTimeout(() => {
712
+ child.kill("SIGKILL");
713
+ }, KILL_GRACE_MS);
714
+ }, options.timeoutMs);
715
+ child.on("error", (error) => {
716
+ clearTimeout(timer);
717
+ clearTimeout(grace);
718
+ reject(error);
719
+ });
705
720
  child.on("close", (code) => {
721
+ clearTimeout(timer);
722
+ clearTimeout(grace);
706
723
  resolveResult({
707
724
  exitCode: code ?? 1,
708
725
  stdout,
709
- stderr
726
+ stderr,
727
+ ...timedOut ? { timedOut: true } : {}
710
728
  });
711
729
  });
712
730
  });
@@ -1171,6 +1189,65 @@ async function installSkills(options = {}) {
1171
1189
  await Promise.all(skills.map((skill) => requireSource(join(packageRoot, "skills", skill.source))));
1172
1190
  return withInstallLock(home, env, () => installIntoHome(home, packageRoot, version, options, env));
1173
1191
  }
1192
+ /** Waits between tarball 404s; the last one repeats. No retry starts past the bound. */
1193
+ const TARBALL_DELAYS_MS = [
1194
+ 5e3,
1195
+ 1e4,
1196
+ 2e4,
1197
+ 3e4
1198
+ ];
1199
+ /**
1200
+ * Downloads `spec` with `npm pack` into a temp dir it removes, retrying a 404 while the next wait
1201
+ * still ends inside the bound. Each attempt gets the remaining budget as its timeout, so the whole
1202
+ * check ends within `waitMs`.
1203
+ */
1204
+ async function waitForTarball(spec, deps) {
1205
+ const boundMs = deps.waitMs ?? 6e5;
1206
+ const delays = deps.delaysMs ?? TARBALL_DELAYS_MS;
1207
+ const dir = mkdtempSync(join(tmpdir(), "board-update-pack-"));
1208
+ try {
1209
+ const started = deps.now();
1210
+ const deadline = started + boundMs;
1211
+ for (let attempt = 0;; attempt += 1) {
1212
+ const result = await deps.runner("npm", [
1213
+ "pack",
1214
+ spec,
1215
+ "--pack-destination",
1216
+ dir
1217
+ ], {
1218
+ env: deps.env,
1219
+ timeoutMs: deadline - deps.now()
1220
+ });
1221
+ const now = deps.now();
1222
+ const failure = (reason, ranPastBound) => ({
1223
+ ok: false,
1224
+ reason,
1225
+ ranPastBound,
1226
+ result,
1227
+ waitedMs: now - started,
1228
+ boundMs
1229
+ });
1230
+ if (result.timedOut === true || now > deadline) return failure("not-served", true);
1231
+ if (result.exitCode === 0) return { ok: true };
1232
+ if (!/\bE404\b/.test(result.stderr)) return failure("failed", false);
1233
+ const wait = delays[Math.min(attempt, delays.length - 1)] ?? 0;
1234
+ if (now + wait >= deadline) return failure("not-served", false);
1235
+ deps.onWait?.({
1236
+ waitMs: wait,
1237
+ waitedMs: now - started,
1238
+ boundMs
1239
+ });
1240
+ await deps.sleep(wait);
1241
+ }
1242
+ } finally {
1243
+ try {
1244
+ rmSync(dir, {
1245
+ recursive: true,
1246
+ force: true
1247
+ });
1248
+ } catch {}
1249
+ }
1250
+ }
1174
1251
  // src/update.ts
1175
1252
  const stateSchema = z.object({
1176
1253
  schema: z.literal(1),
@@ -1802,6 +1879,28 @@ function changedField(stdout) {
1802
1879
  function blockingIds(report) {
1803
1880
  return new Set(report.filter((check) => check.blocking).map((check) => check.id));
1804
1881
  }
1882
+ /**
1883
+ * Downloads `target` with `npm pack` before anything changes, so a registry that lists a version
1884
+ * but does not serve its tarball yet stops the update while the service still runs
1885
+ * (`waitForTarball`); any other failure, an integrity mismatch included, refuses at once.
1886
+ */
1887
+ async function confirmTarball(updater, target, npmEnv) {
1888
+ const { ports } = updater;
1889
+ updater.progress("tarball check");
1890
+ const outcome = await waitForTarball(target, {
1891
+ runner: ports.runner,
1892
+ sleep: ports.sleep,
1893
+ now: ports.now,
1894
+ env: npmEnv,
1895
+ onWait: ({ waitMs, waitedMs, boundMs }) => {
1896
+ updater.progress(`tarball wait: ${target} is listed but its tarball is not served yet (E404); retrying in ${String(waitMs / 1e3)} s, waited ${String(Math.floor(waitedMs / 1e3))} s of ${String(boundMs / 1e3)} s`);
1897
+ }
1898
+ });
1899
+ if (outcome.ok) return;
1900
+ const detail = childDetail(outcome.result);
1901
+ if (outcome.reason === "failed") throw config(`${target} cannot be downloaded: ${detail}. Nothing was changed and the service was not stopped.`);
1902
+ throw config(`The registry lists ${target} but did not serve its tarball within ${String(outcome.boundMs / 1e3)} s: ${outcome.ranPastBound ? `npm pack ran past the bound (${detail})` : detail}. Nothing was changed and the service was not stopped; run \`board update\` again later.`);
1903
+ }
1805
1904
  /** `board update [version]`: preflight, snapshot, stop, backup, install, then health checks. */
1806
1905
  async function updatePackage(options, requested) {
1807
1906
  const updater = new Updater(options, "update");
@@ -1873,6 +1972,7 @@ async function update(updater, options, requested) {
1873
1972
  ...npmArgs
1874
1973
  ], { env: npmEnv });
1875
1974
  if (dryRun.exitCode !== 0) throw config(`${target} cannot be installed with this Node: ${childDetail(dryRun)}`);
1975
+ await confirmTarball(updater, target, npmEnv);
1876
1976
  updater.progress("doctor");
1877
1977
  let baseline;
1878
1978
  try {
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 && !(ended && now >= quiet + threshold)) continue;
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)}`, healthKey(turn.task_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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spur-board",
3
- "version": "0.105.0",
3
+ "version": "0.105.2",
4
4
  "license": "MIT",
5
5
  "engines": {
6
6
  "node": "^24.12.0 || ^26.0.0"
@@ -7,11 +7,11 @@ Use this when the installed package is older than the intended release. `board u
7
7
  2. Run every `board` command below with the Node and PATH of a live Spur session. The update refuses when this shell's Node, package path or `BOARD_HOME` and `XDG_*` settings differ from the service unit, or when the running daemon uses another data directory or config file, drop-ins and environment files included; its hint quotes both sides. If the service was installed from another environment, ask before running `board service install` from this one.
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
- 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.
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. Before it stops the service, the update downloads the target with `npm pack`; while the registry lists the version but answers 404 for its tarball, as just after a release, it waits up to 10 minutes and prints a `tarball wait` line before each retry.
11
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; the skill reinstall already messaged live Spur sessions to read the `spur-board` skill again. Ask the operator to stop and wake the sessions the `sessions.stale` line lists under stop and wake, which keeps their conversations; for sessions it names as still queued, rerun `board doctor --json` in a minute. After a rollback to a version installed before, sessions told about it earlier get no new message and stay listed. 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
- 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.
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`. A target whose tarball the registry did not serve within 10 minutes, or whose tarball fails its integrity check, is refused with the service still running; run `board update` again later. 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.
15
15
  10. To go back to the version before the last update, first run `board rollback` without `--yes`. Outside a terminal it changes nothing, prints what it would do and the `Lost:` text to stderr, and exits 2. Tell the operator that text: either nothing, or the Board changes and journal events recorded after the update started. Run `board rollback --yes` only after the operator agrees.
16
16
  11. Never rewrite settled config or secrets, reissue an operator token, uninstall the service, or revoke a token as part of an update.
17
17
 
@@ -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 task's worker session was killed | start a new worker for the task, or archive the task | attention | the flag ends | stored target |
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, done or lost | 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 |
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.