spur-board 0.63.3 → 0.63.4

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
@@ -9858,9 +9858,12 @@ async function registerBlockNotification(trx, block, at) {
9858
9858
  }
9859
9859
  /**
9860
9860
  * Register an agent executor's turn. Core opens a turn, so no session authored it: the worker
9861
- * or column orchestrator the board selects is rung.
9861
+ * or column orchestrator the board selects is rung. A turn opened by the operation of the
9862
+ * session it would ring first rings only after `doorbells.firstRetryMs`, so an ack in that time
9863
+ * sends nothing.
9862
9864
  */
9863
- async function registerTurnNotification(trx, turn, at) {
9865
+ async function registerTurnNotification(trx, turn, at, opts) {
9866
+ const nextAt = await heldForOpener(trx, turn, opts) ? new Date(at.getTime() + opts.config.doorbells.firstRetryMs) : at;
9864
9867
  await trx.insertInto("notification").values({
9865
9868
  source_key: `turn:${String(turn.id)}:${turn.role}`,
9866
9869
  kind: "turn",
@@ -9872,13 +9875,25 @@ async function registerTurnNotification(trx, turn, at) {
9872
9875
  role: turn.role,
9873
9876
  author_session: null,
9874
9877
  recipient_session: null,
9875
- next_at: at.toISOString(),
9878
+ next_at: nextAt.toISOString(),
9876
9879
  last_outbox_id: null,
9877
9880
  acked_at: null,
9878
9881
  exhausted_at: null,
9879
9882
  created_at: at.toISOString()
9880
9883
  }).onConflict((oc) => oc.column("source_key").doNothing()).execute();
9881
9884
  }
9885
+ /** Whether the opener is the agent session the turn would ring now. */
9886
+ async function heldForOpener(trx, turn, opts) {
9887
+ const opener = opts.opener === void 0 ? void 0 : parseActorId(opts.opener);
9888
+ if (opener?.actor !== "agent") return false;
9889
+ return (await selectNotificationRecipient(trx, {
9890
+ task_id: turn.task_id,
9891
+ role: turn.role,
9892
+ author_session: null,
9893
+ kind: "turn",
9894
+ block_id: null
9895
+ }, opts.config))?.id === opener.actorRef.session;
9896
+ }
9882
9897
  /**
9883
9898
  * The key of the reminder to `session` about a turn it took at `takenAt`. The take time names the
9884
9899
  * ownership episode, so a session that loses the turn and takes it again gets a new reminder.
@@ -11281,7 +11296,7 @@ async function turnNotification(trx, turnId) {
11281
11296
  * An agent executor gets a ringing notification, the operator one `turn` item.
11282
11297
  */
11283
11298
  async function openTurn(trx, input) {
11284
- const { task, reason, handed, at, config } = input;
11299
+ const { task, reason, handed, at, config, opener } = input;
11285
11300
  const unclosed = await trx.selectFrom("turn").selectAll().where("task_id", "=", task.id).where("closed_at", "is", null).executeTakeFirst();
11286
11301
  if (unclosed?.column === task.column && unclosed.epoch === task.column_epoch) return unclosed;
11287
11302
  if (unclosed !== void 0) await closeTurns(trx, {
@@ -11319,7 +11334,10 @@ async function openTurn(trx, input) {
11319
11334
  blockId: null,
11320
11335
  at
11321
11336
  });
11322
- else await registerTurnNotification(trx, turn, at);
11337
+ else await registerTurnNotification(trx, turn, at, {
11338
+ config,
11339
+ opener
11340
+ });
11323
11341
  return turn;
11324
11342
  }
11325
11343
  /**
@@ -15749,7 +15767,8 @@ async function applyOn(trx, task, read, result, ctx) {
15749
15767
  reason: handedBack === void 0 ? reason : `${reason} (submit of ${handedBack.sha.slice(0, 7)}: ${handedBack.failure})`,
15750
15768
  handed: current.column === "dev" ? handed : [],
15751
15769
  at,
15752
- config
15770
+ config,
15771
+ opener: ctx.actor
15753
15772
  });
15754
15773
  }
15755
15774
  /**
@@ -16456,13 +16475,14 @@ const CONFIRMATION = {
16456
16475
  function createTurnMutations(deps) {
16457
16476
  const { config, prPoller, completeSince } = deps;
16458
16477
  /** Dispatches the task after the command's change and returns its fresh row. */
16459
- async function dispatched(trx, taskId, at) {
16460
- await dispatchTasks(trx, [taskId], {
16478
+ async function dispatched(trx, id, at, actor) {
16479
+ await dispatchTasks(trx, [id], {
16461
16480
  config,
16462
16481
  at: new Date(at),
16463
- complete: completeSince
16482
+ complete: completeSince,
16483
+ actor
16464
16484
  });
16465
- return taskById(trx, taskId);
16485
+ return taskById(trx, id);
16466
16486
  }
16467
16487
  async function submitShadow(trx, input, ctx) {
16468
16488
  const task = await shadowTask(trx, input.turn, config);
@@ -16482,7 +16502,7 @@ function createTurnMutations(deps) {
16482
16502
  ...CONFIRMATION[confirmed]
16483
16503
  }, ctx.actor);
16484
16504
  return {
16485
- task: taskView(await dispatched(trx, task.id, ctx.at)),
16505
+ task: taskView(await dispatched(trx, task.id, ctx.at, ctx.actor)),
16486
16506
  turn: null,
16487
16507
  sha: input.sha,
16488
16508
  status: "confirmed"
@@ -16525,7 +16545,7 @@ function createTurnMutations(deps) {
16525
16545
  ...CONFIRMATION[confirmed]
16526
16546
  }, ctx.actor);
16527
16547
  return {
16528
- task: taskView(await dispatched(trx, task.id, ctx.at)),
16548
+ task: taskView(await dispatched(trx, task.id, ctx.at, ctx.actor)),
16529
16549
  turn: input.turn,
16530
16550
  sha: input.sha,
16531
16551
  status: confirmed === "pending" ? "pending" : "confirmed"
@@ -16549,7 +16569,7 @@ function createTurnMutations(deps) {
16549
16569
  turn: turnLabel(turn.id),
16550
16570
  block: `B${String(block.id)}`
16551
16571
  });
16552
- const moved = await dispatched(trx, task.id, ctx.at);
16572
+ const moved = await dispatched(trx, task.id, ctx.at, ctx.actor);
16553
16573
  return {
16554
16574
  task: taskView(moved),
16555
16575
  block: blockView(block, taskSubject(moved))
@@ -16579,7 +16599,7 @@ function createTurnMutations(deps) {
16579
16599
  reason: input.reason,
16580
16600
  config
16581
16601
  });
16582
- const settled = await dispatched(trx, task.id, ctx.at);
16602
+ const settled = await dispatched(trx, task.id, ctx.at, ctx.actor);
16583
16603
  return {
16584
16604
  task: taskView(settled),
16585
16605
  from: corrected.from,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spur-board",
3
- "version": "0.63.3",
3
+ "version": "0.63.4",
4
4
  "license": "MIT",
5
5
  "engines": {
6
6
  "node": "^24.12.0 || ^26.0.0"
@@ -1,147 +1,158 @@
1
1
  # How the Board works
2
2
 
3
- Start with `board task <task> --why`: it explains the gates, holds, open turn and
4
- last moves behind the task's position.
3
+ `board task <task> --why`: gates, holds, waits, turn and moves.
5
4
 
6
5
  ## Columns and executors
7
6
 
8
- The fixed order is `todo`, `ready-for-dev`, `dev`, `review`, `product-review`,
7
+ Order: `todo`, `ready-for-dev`, `dev`, `review`, `product-review`,
9
8
  `external-review`, `qa`, `ready-to-merge`, `done`.
10
- `projects[].columns[].enabled` false, or omitting an optional column, skips it and
11
- its gate; To Do, Dev and Done must stay enabled.
9
+ `projects[].columns[].enabled` false or an omitted optional column skips its gate;
10
+ To Do, Dev and Done stay enabled.
12
11
 
13
- Each column has one executor, selected by `projects[].columns[].orchestrator`:
14
- `none` uses the task's live worker, falling back to the operator; `operator` uses
15
- the operator; another value names a configured Spur project whose session takes
16
- the turn. The worker owns the code and branch. Other column executors inspect the
17
- head and submit it or return it with findings; they do not push to that branch.
12
+ Each column has one executor: `projects[].columns[].orchestrator` selects
13
+ `none` (live worker, else operator), `operator`, or a project with role
14
+ `orchestrator` or `curator`. The worker owns the code and branch; other executors
15
+ inspect and submit the head or return findings without pushing.
18
16
 
19
- `projects[].spurProjects[].role` currently accepts `worker`, `operator` and
20
- `curator`. The curator answers questions and checks direction. A separate
21
- `orchestrator` project role is planned, not available; today column assignment
22
- uses the configured Spur project name rather than that role value.
17
+ `projects[].spurProjects[].role` accepts `worker`, `operator`, `curator` and
18
+ `orchestrator`. Curators check direction; orchestrators execute columns, never as workers.
23
19
 
24
20
  ## Gates and placement
25
21
 
26
- The operational moves, turns and course checks below apply with
27
- `projects[].dispatcher.mode: on`. The default is `shadow`: gates record a proposed
28
- position, but open no turns, doorbells or blocks; submit using the task key.
29
-
30
- Gates are cumulative: a column checks its own enabled exit gate and every enabled
31
- gate to its left. At a turn boundary, a broken earlier gate returns the task to
32
- the leftmost failing column. A taken turn normally holds its column until it is
33
- submitted, returned or closed by a new head. Pending CI, unknown mergeability and
34
- incomplete comment history are waits, not reasons by themselves to send work back.
35
- Downstream handoff waits for settled prerequisites; Dev can still receive a
36
- repair turn to fix red CI, a draft, conflicts or unhandled external comments.
37
-
38
- Dev needs an open, non-draft PR, passing checks, no conflict, handled external
39
- feedback, complete comment history and a submit on the current head. With no
40
- required checks, non-skipped checks are evaluated. `projects[].reposWithoutCi`
41
- waives the check requirement only for a listed repository with no checks at all;
42
- it does not waive a failing or skipped required check.
43
-
44
- Review and Product Review need current-head review marks. External Review waits
45
- for external approval. QA needs a current-head submission; Ready to Merge waits
46
- for the PR to merge. A column with executor `none` can use a worker submission on
47
- that head from another worker-executed column. These fixed gate rules have no
48
- configuration switch beyond enabling columns and the no-CI exception above.
49
-
50
- A Review or Product Review mark lasts across visits while its head remains
51
- current. A visit submission belongs to one column visit; a move left clears
52
- submissions at that column and to its right. A new head invalidates internal
53
- Review and Product Review marks, even if an older head later comes back.
22
+ Facts (head, checks, reviews, comments, ticket, sessions) feed gates. The
23
+ dispatcher has two actions: move the task and open an executor turn (at most one
24
+ per evaluation). Turns follow unmet entry gates, actionable post-submit failures,
25
+ rerouting or Done wrap-up. Holds and existing turns can yield neither action;
26
+ facts need not cause handoffs.
27
+
28
+ Moves, turns and course checks require `projects[].dispatcher.mode: on`. The
29
+ default is `shadow`: proposed placement only, no turns, doorbells or blocks;
30
+ submit by task key.
31
+
32
+ Gates are cumulative: each column checks its enabled gate and those to its left. At a turn boundary, broken gates return work to the leftmost failing
33
+ column. Taken turns hold until submit, return or a new head. Pending CI, unknown
34
+ mergeability and incomplete comment history are waits. Downstream handoff waits
35
+ for settled prerequisites; Dev can receive a repair turn for red CI, drafts,
36
+ conflicts or unhandled external comments.
37
+
38
+ Dev needs an open non-draft PR, passing checks, no conflict, handled external
39
+ feedback, complete comment history and current-head submit. Non-skipped checks
40
+ count when none are required. `projects[].reposWithoutCi` waives absent checks
41
+ for listed repos, never failing or skipped required checks.
42
+
43
+ Review and Product Review need current-head internal review marks, separate from
44
+ External Review's external approval. QA needs a current-head submission; Ready to Merge waits for merge. Executor `none` may reuse same-head worker submissions
45
+ from another worker column. Fixed gate rules have no configuration switch
46
+ beyond enabled columns and the no-CI exception.
47
+
48
+ A Review or Product Review mark lasts across visits on the current head. A visit
49
+ submission belongs to one column visit; moving left clears submissions there and
50
+ to its right. New heads invalidate internal Review and Product Review marks,
51
+ even if an old head returns.
52
+
53
+ Derived anomalies include a PR closed without merge with no open PR, or a closed
54
+ ticket with live work and no merged PR. `board status` lists them; they can also
55
+ surface as operator block threads.
54
56
 
55
57
  ## Turns and delivery
56
58
 
57
- A turn `T<number>` hands one column visit to its executor. First acknowledge it
58
- with keyed `board inbox ack <entries>`. Only the acknowledging session may submit
59
- or return it: keyed `board submit <turn> <sha>` accepts the head, and keyed
60
- `board return <turn> <reason>` sends findings back to Dev. A worker submits a fresh
61
- PR head after pushing. In shadow mode, use keyed `board submit <task> <sha>`.
62
- An unseen head answers `pending`: that submit is final,
63
- so do not resubmit or raise a block; the Board confirms it or hands the turn back
59
+ A turn `T<number>` assigns a visit. Use keyed `board inbox ack <entries>`.
60
+ Only the acknowledging session may submit or return: keyed
61
+ `board submit <turn> <sha>` accepts the head; keyed
62
+ `board return <turn> <reason>` sends findings to Dev. Submit after pushing. In
63
+ shadow mode, use keyed `board submit <task> <sha>`.
64
+ Unseen heads answer `pending`: that submit is final; do not resubmit or raise a
65
+ block. It confirms or returns the turn
64
66
  (`projects[].dispatcher.submitConfirmMs`).
65
67
 
66
- A new head closes taken turns outside Dev; a taken Dev turn survives the worker's
67
- push so that worker can submit it. An unacknowledged turn does not hold back a
68
- return for CI, draft, conflict or external comments. The operator gets one inbox
69
- item and Slack thread for a turn, which closes when the task leaves the column.
68
+ A new head closes taken turns outside Dev; taken Dev turns survive pushes.
69
+ Untaken turns allow returns for CI, drafts, conflicts or external comments.
70
+ Operator turns get one inbox item and Slack thread until the task leaves.
70
71
 
71
- Closed turns receive no further Board sends. Obsolete queued rings are dropped,
72
- but a message already accepted by Spur cannot be retracted. On receipt, check
73
- `board inbox` and act only on a current turn; after `turn_closed`, read it again.
72
+ Closed turns receive no further Board sends. Obsolete queued rings are dropped;
73
+ a message already accepted by Spur cannot be retracted. Check `board inbox` and
74
+ act only on a current turn; reread after `turn_closed`.
74
75
 
75
- ## Course checks and cycle limits
76
+ ## Doorbells
77
+
78
+ A doorbell expects action: read `board inbox` for the turn, addressed
79
+ block, answer or follow-up. Ordinary task comments do not ring; nor does a block
80
+ tracked by its author role ring itself. Notifications are separate from moves.
81
+
82
+ Unacknowledged series normally repeat, up to three delivered rings;
83
+ acknowledgement stops them. Removal notices and quiet-turn reminders ring once.
84
+ Busy recipients defer delivery; pending delivery or earlier rings in the Spur
85
+ queue defer repeats. Queued rings can exhaust their waiting window.
76
86
 
77
- `projects[].columns[].courseCheck` defaults to 3 counted returns to Dev from that
78
- column; `courseCheck: 0` disables the course check.
79
- `projects[].columns[].cycleLimit` defaults to 10 and takes priority if both limits
80
- are reached. Executor returns, changes requested and external comments count;
81
- CI failures, conflicts and drafts alone do not count. Reopening a ticket or
82
- switching dispatcher mode does not count as a return.
87
+ Most notices await recipients; taskless worker, orchestrator and operator-agent
88
+ answers end without a live asking session. Curator and course-check orchestrator
89
+ questions fall back to operator. Operator conversations await their project.
90
+ Exhaustion alerts the operator, except removals and quiet-turn reminders;
91
+ curator questions move to operator.
83
92
 
84
- A course check holds the task and asks for direction, with open findings.
85
- `projects[].columns[].courseCheckTo` may name `operator`, the curator, or a
86
- configured column orchestrator. Without it, the target is the curator selected by
87
- `projects[].spurProjects[].role`, or the operator if no curator is configured.
88
- An answer resets the course count and reaches the worker as a task comment.
89
- The cycle limit is separate: only the operator can resolve it and reset its count.
93
+ ## Course checks and cycle limits
94
+
95
+ `projects[].columns[].courseCheck` defaults to 3 counted returns to Dev;
96
+ `courseCheck: 0` disables it. `projects[].columns[].cycleLimit` defaults to 10 and
97
+ takes priority. Executor returns, changes requested and external comments count;
98
+ CI failures, conflicts and drafts alone do not count, nor ticket reopening or
99
+ dispatcher mode changes.
90
100
 
91
- If the course-check addressee has no live session, the question falls back to the
92
- operator. A live conductor that was rung but does not answer keeps the question;
93
- the operator gets an item to intervene.
101
+ Course checks hold work for direction.
102
+ `projects[].columns[].courseCheckTo`: `operator`, curator or column orchestrator.
103
+ Default: curator (`projects[].spurProjects[].role`), else operator. An answer
104
+ resets the course count and reaches the worker as a task comment. Only the
105
+ operator can resolve the separate cycle limit and reset its count. With no live
106
+ session the question falls back to the operator; a live conductor that does not
107
+ answer keeps the question, with an intervention item.
94
108
 
95
109
  ## Blocks and escalation
96
110
 
97
- A question (`needs_input`) goes to the column's configured orchestrator, then the
98
- curator when no other orchestrator takes it, otherwise the operator. Routing
99
- avoids asking yourself: an orchestrator's own question goes to the curator, and
100
- the curator's own question goes to the operator. A column explicitly assigned to
101
- `operator` also sends questions to the operator.
111
+ A question (`needs_input`) goes to the column orchestrator, else curator, else
112
+ operator. Routing avoids asking yourself: orchestrators ask the curator; curators
113
+ ask the operator. An `operator` column asks the operator.
114
+
115
+ A `code` block goes to the worker; a `dependency` or `external` block stays with
116
+ its author's role. Questions escalate from column orchestrator to curator to
117
+ operator; other blocks escalate straight to the operator. Skip your own project:
118
+ a curator orchestrating the column escalates straight to the operator. Use keyed
119
+ `board escalate <block>` if the addressee cannot resolve it.
102
120
 
103
- A `code` block goes to the worker to repair. A `dependency` or `external` block
104
- stays with its author's role to track the dependency or outside event. Questions
105
- can escalate from column orchestrator to curator to operator; other blocks
106
- escalate straight to the operator. Escalation skips a step your own project also
107
- holds: a curator that also orchestrates the column escalates its column's
108
- question straight to the operator. Use keyed `board escalate <block>`
109
- when the current addressee cannot resolve it.
121
+ Taskless: all roles, operator only:
122
+ `board project ask <project> <text> --to operator --key <key>`.
123
+ Project `needs_input` blocks get Slack threads except operator-agent asks;
124
+ operator: `board inbox`, keyed `board answer`. Answers reach a current curator session; other roles use the asking session.
110
125
 
111
- The routing configuration is `projects[].columns[].orchestrator`,
112
- `projects[].spurProjects[].role` and `operator.slack` (the operator's Slack user
113
- ID). Role addresses follow the current session filling the role.
126
+ Routing: `projects[].columns[].orchestrator`, `projects[].spurProjects[].role`,
127
+ `operator.slack` (Slack user ID). Roles follow the current session.
114
128
 
115
129
  ## Slack now
116
130
 
117
- `slack.channels.feed` carries summaries like curator answers and operator
118
- items, except items shown elsewhere and delivery problems.
131
+ `slack.channels.feed` carries curator answers and operator items,
132
+ except those elsewhere and delivery problems.
119
133
  `slack.channels.orchestrators` carries block threads addressed to the operator by
120
- someone else. Answer in the existing block thread to preserve its task context.
134
+ others. Answer in the existing block thread.
121
135
 
122
136
  ## Slack addressing
123
137
 
124
- Once a `projects[].spurProjects[].shortName` is set, a new operator message in
138
+ With `projects[].spurProjects[].shortName`, a new operator message in
125
139
  `slack.channels.orchestrators` starts a conversation. A leading registered
126
- `@shortName` selects that Spur project and is stripped. With an
127
- absent or unknown leading name, `slack.defaultAddressee` receives the complete
128
- text, retaining any unknown prefix; without it the Board replies once with the
129
- valid prefixes. A mention in the middle, or a Slack `<@U…>` mention, addresses
130
- nobody; an unknown name causes no lookup error. The operator checks short-name
131
- collisions with workspace names. A task key right after the prefix attaches
132
- that task.
133
-
134
- The addressee is rung with the block ID, reads it in `board inbox` and replies
135
- in the thread with `board answer`. Each operator thread message rings it again;
136
- `close` or ✅ in the thread closes it. Replies use
137
- `projects[].spurProjects[].displayName` and `icon`, else the project name and
138
- role icon (`board` for operator roles). With no live session,
140
+ `@shortName` selects that Spur project and is stripped. With an absent or unknown
141
+ leading name, `slack.defaultAddressee` receives the complete text, retaining any
142
+ unknown prefix; without it the Board replies once with the valid prefixes.
143
+ Middle mentions or Slack `<@U…>` address nobody; unknown names cause no lookup
144
+ error. The operator checks short-name collisions with workspace names.
145
+ A task key after the prefix attaches it.
146
+
147
+ The addressee gets the block ID, reads `board inbox`, replies with
148
+ `board answer`. Each operator thread message rings again; `close` or ✅ in the
149
+ thread closes it. Replies use `projects[].spurProjects[].displayName` and `icon`,
150
+ else project name and role icon (`board` for operator). Without a session,
139
151
  `board status` lists it as waiting.
140
152
 
141
153
  ## Done follows the ticket
142
154
 
143
- One linked PR merging does not by itself finish the task. Done follows ticket
144
- completion: `projects[].tracker.doneStatuses` defines Jira's done statuses;
145
- for GitHub, the Issue must be closed. After a merge the Board waits for tracker
146
- confirmation; if the ticket remains open once that confirmation settles, work
155
+ One linked PR merging does not by itself finish the task. Done follows the
156
+ ticket: `projects[].tracker.doneStatuses` for Jira; for GitHub, the Issue must be
157
+ closed. After merge, wait for tracker confirmation; if it settles open, work
147
158
  continues and another PR can be linked.