@defrex/autobuild 1.11.1 → 1.13.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.
Files changed (213) hide show
  1. package/README.md +1 -1
  2. package/SPEC.md +601 -203
  3. package/bin/ab-build-runner.ts +8 -0
  4. package/docs/answering-blocked-builds.md +32 -2
  5. package/docs/architecture.md +188 -57
  6. package/docs/assets/headline-wide.png +0 -0
  7. package/docs/cli.md +1 -1
  8. package/docs/configuration.md +120 -23
  9. package/docs/dispatcher.md +19 -8
  10. package/docs/integration-overview.md +1 -1
  11. package/docs/integration-tree.md +33 -18
  12. package/docs/merge-policy.md +7 -2
  13. package/docs/operating.md +5 -3
  14. package/docs/operator-api.md +48 -25
  15. package/docs/operator-surfaces.md +39 -3
  16. package/docs/optimization-nodes.md +10 -8
  17. package/docs/plugin-authoring.md +46 -18
  18. package/docs/remote-store-protocol.md +51 -12
  19. package/docs/remote-ticket-protocol.md +85 -38
  20. package/docs/restacking.md +48 -3
  21. package/docs/setup.md +2 -1
  22. package/docs/ticket-migration.md +2 -2
  23. package/docs/ticket-sources.md +23 -8
  24. package/docs/tickets.md +4 -4
  25. package/docs/troubleshooting.md +17 -2
  26. package/docs/verification.md +3 -1
  27. package/package.json +3 -3
  28. package/packages/core/src/cli/ambient-errors.ts +17 -0
  29. package/packages/core/src/cli/bounded-io.ts +174 -0
  30. package/packages/core/src/cli/build-control.ts +72 -6
  31. package/packages/core/src/cli/dashboard/actions.ts +4 -0
  32. package/packages/core/src/cli/dashboard/integration-row.ts +43 -19
  33. package/packages/core/src/cli/dashboard/model.ts +93 -29
  34. package/packages/core/src/cli/dashboard/poll.ts +231 -34
  35. package/packages/core/src/cli/dashboard/queue.ts +21 -10
  36. package/packages/core/src/cli/dashboard/render.ts +14 -37
  37. package/packages/core/src/cli/dashboard/row-text.ts +26 -8
  38. package/packages/core/src/cli/dashboard/tone-ansi.ts +39 -0
  39. package/packages/core/src/cli/dashboard/vocabulary.ts +165 -20
  40. package/packages/core/src/cli/dispatch-frontend.ts +2 -1
  41. package/packages/core/src/cli/dispatch-handoff.ts +41 -10
  42. package/packages/core/src/cli/dispatch-launch-contract.ts +5 -0
  43. package/packages/core/src/cli/dispatch-launcher-cadence.ts +80 -0
  44. package/packages/core/src/cli/dispatch-launcher.ts +9 -10
  45. package/packages/core/src/cli/dispatch-preflight.ts +12 -3
  46. package/packages/core/src/cli/dispatch-release-observer.ts +53 -0
  47. package/packages/core/src/cli/dispatch-runtime-cache.ts +204 -82
  48. package/packages/core/src/cli/dispatch-runtime-dependencies.ts +250 -43
  49. package/packages/core/src/cli/dispatch-tickets.ts +33 -12
  50. package/packages/core/src/cli/dispatch-upgrade-install.ts +36 -16
  51. package/packages/core/src/cli/dispatch-upgrade-source.ts +8 -2
  52. package/packages/core/src/cli/dispatch-yield-observer.ts +82 -0
  53. package/packages/core/src/cli/dispatch.ts +595 -149
  54. package/packages/core/src/cli/env.ts +2 -15
  55. package/packages/core/src/cli/help.ts +43 -28
  56. package/packages/core/src/cli/main.ts +11 -7
  57. package/packages/core/src/cli/production-store.ts +102 -0
  58. package/packages/core/src/cli/publication-settlement.ts +4 -0
  59. package/packages/core/src/cli/remote-poll.ts +22 -5
  60. package/packages/core/src/cli/repo-state.ts +2 -3
  61. package/packages/core/src/cli/repository-status.ts +44 -28
  62. package/packages/core/src/cli/sessionless-store.ts +26 -0
  63. package/packages/core/src/cli/status.ts +188 -47
  64. package/packages/core/src/cli/store-opening.ts +26 -57
  65. package/packages/core/src/cli/store-ref.ts +6 -1
  66. package/packages/core/src/cli/ticket-start.ts +3 -3
  67. package/packages/core/src/cli/ticket.ts +12 -11
  68. package/packages/core/src/cli/wait.ts +8 -28
  69. package/packages/core/src/cli/watch.ts +113 -50
  70. package/packages/core/src/config/reference-metadata.ts +7 -1
  71. package/packages/core/src/config/reference.ts +5 -2
  72. package/packages/core/src/config/schema.ts +51 -16
  73. package/packages/core/src/distribution-packaging.ts +156 -18
  74. package/packages/core/src/events/catalog-identity.ts +28 -0
  75. package/packages/core/src/events/catalog.ts +3 -9
  76. package/packages/core/src/events/compatibility.ts +2 -30
  77. package/packages/core/src/events/payloads.ts +85 -14
  78. package/packages/core/src/events/policy.ts +3 -0
  79. package/packages/core/src/events/repository.ts +15 -4
  80. package/packages/core/src/events/sessions.ts +1 -1
  81. package/packages/core/src/events/validation-error.ts +12 -0
  82. package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +36 -0
  83. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/0a10010ee5cf2e47.json +577 -0
  84. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/227701361be6d1e0.json +490 -0
  85. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/3064e337cc75f8d6.json +310 -0
  86. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/76e5043bae7a80ab.json +86 -0
  87. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/87a917802870bbed.json +87 -0
  88. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/9d85616e5b9e24c1.json +500 -0
  89. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/a1e90a969d32a367.json +307 -0
  90. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/c7c94fbe7f63cf07.json +84 -0
  91. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/da3bc91c49211eab.json +310 -0
  92. package/packages/core/src/kernel/auto-merge-default.ts +2 -1
  93. package/packages/core/src/kernel/capacity-build.ts +21 -0
  94. package/packages/core/src/kernel/clean-restack-policy.ts +40 -0
  95. package/packages/core/src/kernel/discard-in-flight.ts +13 -0
  96. package/packages/core/src/kernel/dispatch-capacity.ts +578 -235
  97. package/packages/core/src/kernel/done-escalations.ts +269 -0
  98. package/packages/core/src/kernel/engine.ts +30 -17
  99. package/packages/core/src/kernel/integration-landing.ts +24 -4
  100. package/packages/core/src/kernel/integration-stack.ts +39 -0
  101. package/packages/core/src/kernel/janitor-failure.ts +20 -1
  102. package/packages/core/src/kernel/log-index-value.ts +3 -0
  103. package/packages/core/src/kernel/log-index.ts +41 -2
  104. package/packages/core/src/kernel/measurement.ts +24 -0
  105. package/packages/core/src/kernel/open-pr-backpressure.ts +3 -3
  106. package/packages/core/src/kernel/read-facts.ts +8 -370
  107. package/packages/core/src/kernel/reducer-registry.ts +43 -125
  108. package/packages/core/src/kernel/reducer-revisions.ts +18 -0
  109. package/packages/core/src/kernel/reducer-value-entry.ts +98 -0
  110. package/packages/core/src/kernel/reducer-value-index.ts +75 -0
  111. package/packages/core/src/kernel/reducer.ts +84 -16
  112. package/packages/core/src/kernel/reopen-state.ts +10 -0
  113. package/packages/core/src/kernel/repository-attention.ts +14 -5
  114. package/packages/core/src/kernel/repository-read-facts.ts +375 -0
  115. package/packages/core/src/kernel/ticket-starts.ts +15 -4
  116. package/packages/core/src/kernel/verify-stage-state.ts +145 -3
  117. package/packages/core/src/kernel/verify-stages.ts +46 -7
  118. package/packages/core/src/operator/attention.ts +28 -3
  119. package/packages/core/src/operator/done-escalations.ts +38 -0
  120. package/packages/core/src/operator/presentation.ts +14 -1
  121. package/packages/core/src/operator/protocol.ts +8 -5
  122. package/packages/core/src/operator/query.ts +72 -57
  123. package/packages/core/src/operator/registry.ts +19 -15
  124. package/packages/core/src/operator/ticket-start.ts +8 -7
  125. package/packages/core/src/operator/tickets.ts +28 -9
  126. package/packages/core/src/plugin-sdk/index.ts +10 -0
  127. package/packages/core/src/plugins/manifest.ts +14 -1
  128. package/packages/core/src/ports/forge/create.ts +8 -0
  129. package/packages/core/src/ports/forge/github-transport.ts +5 -1
  130. package/packages/core/src/ports/forge/github.ts +3 -0
  131. package/packages/core/src/ports/tickets/contract.ts +147 -76
  132. package/packages/core/src/ports/tickets/create.ts +47 -7
  133. package/packages/core/src/ports/tickets/fake.ts +8 -4
  134. package/packages/core/src/ports/tickets/file-codec.ts +4 -3
  135. package/packages/core/src/ports/tickets/file.ts +7 -3
  136. package/packages/core/src/ports/tickets/github.ts +1 -0
  137. package/packages/core/src/ports/tickets/grants.ts +11 -3
  138. package/packages/core/src/ports/tickets/hosted-index.ts +5 -0
  139. package/packages/core/src/ports/tickets/linear.ts +28 -9
  140. package/packages/core/src/ports/tickets/migration.ts +4 -4
  141. package/packages/core/src/ports/tickets/operations.ts +4 -2
  142. package/packages/core/src/ports/tickets/priority-labels.ts +213 -0
  143. package/packages/core/src/ports/tickets/priority.ts +127 -21
  144. package/packages/core/src/ports/tickets/remote-protocol.ts +10 -0
  145. package/packages/core/src/ports/tickets/remote.ts +104 -11
  146. package/packages/core/src/ports/tickets/revision.ts +5 -3
  147. package/packages/core/src/ports/tickets/search.ts +9 -0
  148. package/packages/core/src/ports/tickets/tree.ts +8 -6
  149. package/packages/core/src/ports/types.ts +30 -15
  150. package/packages/core/src/ports/workspace/build-execution.ts +4 -0
  151. package/packages/core/src/ports/workspace/builtin-capabilities.ts +4 -0
  152. package/packages/core/src/ports/workspace/create.ts +16 -3
  153. package/packages/core/src/ports/workspace/execution-exit-marker.ts +41 -0
  154. package/packages/core/src/ports/workspace/fake.ts +15 -3
  155. package/packages/core/src/ports/workspace/recovery-step.ts +101 -0
  156. package/packages/core/src/ports/workspace/vercel-sandbox.ts +510 -145
  157. package/packages/core/src/processes/build-execution-state.ts +4 -0
  158. package/packages/core/src/processes/build-runner.ts +14 -1
  159. package/packages/core/src/processes/dispatcher.ts +777 -288
  160. package/packages/core/src/processes/execution-no-progress.ts +1 -0
  161. package/packages/core/src/processes/execution-settlement.ts +1 -0
  162. package/packages/core/src/processes/harvest-runner.ts +12 -7
  163. package/packages/core/src/processes/infrastructure-failure-budget.ts +7 -2
  164. package/packages/core/src/processes/invocation-budget.ts +176 -0
  165. package/packages/core/src/processes/publication-loss.ts +38 -3
  166. package/packages/core/src/processes/workspace-preservation.ts +86 -15
  167. package/packages/core/src/store/contract.ts +81 -3
  168. package/packages/core/src/store/event-reads.ts +30 -1
  169. package/packages/core/src/store/local/capabilities.ts +115 -0
  170. package/packages/core/src/store/local/store.ts +86 -56
  171. package/packages/core/src/store/reduced-reads.ts +32 -1
  172. package/packages/core/src/store/reducer-value-read.ts +235 -0
  173. package/packages/core/src/store/reducer-value-shapes.json +6722 -6475
  174. package/packages/core/src/store/reducer-value-validation.ts +181 -33
  175. package/packages/core/src/store/reducer-values.ts +36 -204
  176. package/packages/core/src/store/remote/client.ts +169 -29
  177. package/packages/core/src/store/remote/compatibility.ts +113 -56
  178. package/packages/core/src/store/remote/credentials.ts +4 -1
  179. package/packages/core/src/store/remote/protocol.ts +3 -0
  180. package/packages/core/src/store/remote/released-clients.json +22 -0
  181. package/packages/core/src/store/remote/released-reducer-values/1.12.0.json +35806 -0
  182. package/packages/core/src/store/remote/released-reducer-values/1.13.0.json +35966 -0
  183. package/packages/core/src/store/remote/released-reducer-values/index.ts +20 -16
  184. package/packages/core/src/store/remote/released-value-policy.ts +144 -0
  185. package/packages/core/src/store/remote/retry.ts +406 -0
  186. package/packages/core/src/store/rollup-lease.ts +41 -0
  187. package/packages/core/src/store/rollups.ts +7 -38
  188. package/packages/core/src/store/snapshots.ts +1 -1
  189. package/packages/core/src/testing/dispatch-read-budget.ts +409 -14
  190. package/packages/core/src/testing/import-graph.ts +78 -0
  191. package/packages/core/src/testing/index.ts +2 -0
  192. package/packages/core/src/testing/invocation-budget.ts +42 -0
  193. package/packages/core/src/testing/reduced-read-budget.ts +602 -40
  194. package/packages/core/src/testing/released-value-coverage.ts +423 -0
  195. package/packages/core/src/testing/slot-agreement.ts +52 -0
  196. package/packages/core/src/web/assets/app.js +5 -5
  197. package/packages/core/src/web/overview-source.ts +19 -6
  198. package/skills/guide/SKILL.md +245 -103
  199. package/skills/guide/references/integration-tree.md +33 -18
  200. package/skills/guide/references/merge-policy.md +7 -2
  201. package/skills/guide/references/operator-api.md +48 -25
  202. package/skills/guide/references/optimization-nodes.md +10 -8
  203. package/skills/guide/references/plugin-authoring.md +46 -18
  204. package/skills/guide/references/remote-store-protocol.md +51 -12
  205. package/skills/guide/references/remote-ticket-protocol.md +85 -38
  206. package/skills/guide/references/restacking.md +48 -3
  207. package/skills/guide/references/setup.md +2 -1
  208. package/skills/guide/references/ticket-migration.md +2 -2
  209. package/skills/operate/SKILL.md +114 -65
  210. package/skills/plan/SKILL.md +4 -3
  211. package/skills/spec/SKILL.md +9 -5
  212. package/skills/tickets/SKILL.md +25 -17
  213. package/templates/hosted-service/package.json +2 -2
@@ -1,4 +1,5 @@
1
1
  import { verifyStages, type VerifyConfig } from '../config/schema'
2
+ import type { CleanRestackPolicy } from '../events/payloads'
2
3
  import type { LogIndex, VerifyRecord } from './log-index'
3
4
  import type { VerifyStageState } from './verify-stage-state'
4
5
  import { acceptedRewriteBoundary } from './leaf-restack-base'
@@ -40,11 +41,13 @@ export function activeVerifyStage(
40
41
  }
41
42
 
42
43
  /** A leaf's verify cycle boundary inputs (§15.6-A): the latest code-review
43
- * approval, reconcile completion, configuration boundary, or clean
44
- * wait-resume restack after a verify:* or finalize wait (SPEC §11 "Ticket
45
- * waits"), or an accepted rewritten target's replay boundary. Results at or before it describe an older change or base. The
46
- * engine's stage selection and its `cycleBoundary` both read it; a node's
47
- * wait-resume input is always 0, since nodes declare no waits. */
44
+ * approval, reconcile completion, configuration boundary, clean wait-resume
45
+ * restack after a verify:* or finalize wait (SPEC §11 "Ticket waits"), clean
46
+ * awaiting-landing restack that froze an opted-in clean-restack policy (SPEC
47
+ * §16), or an accepted rewritten target's replay boundary. Results at or
48
+ * before it describe an older change or base. The engine's stage selection
49
+ * and its `cycleBoundary` both read it; a node's wait-resume and clean-restack
50
+ * inputs are always 0, since nodes declare no waits and never freeze one. */
48
51
  export function leafVerifyCycleInputs(
49
52
  log: Pick<
50
53
  LogIndex,
@@ -52,6 +55,7 @@ export function leafVerifyCycleInputs(
52
55
  | 'lastReconcileCompletedSeq'
53
56
  | 'verifyConfigBoundary'
54
57
  | 'waitResumeVerifyBoundary'
58
+ | 'cleanRestackVerifyBoundary'
55
59
  | 'restack'
56
60
  >,
57
61
  ): number {
@@ -60,13 +64,14 @@ export function leafVerifyCycleInputs(
60
64
  log.lastReconcileCompletedSeq,
61
65
  log.verifyConfigBoundary,
62
66
  log.waitResumeVerifyBoundary,
67
+ log.cleanRestackVerifyBoundary,
63
68
  acceptedRewriteBoundary(log) ?? 0,
64
69
  )
65
70
  }
66
71
 
67
72
  /** The restack a leaf's current verify cycle runs on, which its verify facts
68
- * cite: the clean wait-resume completion that opened the cycle (SPEC §11
69
- * "Ticket waits"), else the replay boundary's verify-entry or
73
+ * cite: the clean wait-resume or clean-restack-policy completion that opened
74
+ * the cycle (whichever is newer), else the replay boundary's verify-entry or
70
75
  * reconcile-linked completion. Undefined before any restack completed. */
71
76
  export function leafVerifiedRestack(
72
77
  log: Pick<
@@ -75,6 +80,8 @@ export function leafVerifiedRestack(
75
80
  | 'lastReconcileCompletedSeq'
76
81
  | 'waitResumeVerifyBoundary'
77
82
  | 'waitResumeVerifyCycle'
83
+ | 'cleanRestackVerifyBoundary'
84
+ | 'cleanRestackVerifyCycle'
78
85
  | 'restack'
79
86
  >,
80
87
  ) {
@@ -83,7 +90,39 @@ export function leafVerifiedRestack(
83
90
  log.lastReconcileCompletedSeq,
84
91
  acceptedRewriteBoundary(log) ?? 0,
85
92
  )
93
+ if (
94
+ log.cleanRestackVerifyBoundary > replay &&
95
+ log.cleanRestackVerifyBoundary > log.waitResumeVerifyBoundary
96
+ )
97
+ return log.restack.gates[String(log.cleanRestackVerifyCycle)]
86
98
  return log.waitResumeVerifyBoundary > replay
87
99
  ? log.restack.gates[String(log.waitResumeVerifyCycle)]
88
100
  : log.restack.gates[String(replay)]
89
101
  }
102
+
103
+ /** The frozen clean-restack policy governing the current verify cycle: only
104
+ * while its completion is newer than every other code boundary (approval,
105
+ * reconcile, accepted rewrite, wait resume). A later boundary restores
106
+ * ordinary verification. */
107
+ export function cleanRestackPolicyInForce(
108
+ log: Pick<
109
+ LogIndex,
110
+ | 'code'
111
+ | 'lastReconcileCompletedSeq'
112
+ | 'waitResumeVerifyBoundary'
113
+ | 'cleanRestackVerifyBoundary'
114
+ | 'cleanRestackPolicy'
115
+ | 'restack'
116
+ >,
117
+ ): CleanRestackPolicy | undefined {
118
+ if (log.cleanRestackPolicy === undefined) return undefined
119
+ return log.cleanRestackVerifyBoundary >
120
+ Math.max(
121
+ log.code.latestApproveSeq,
122
+ log.lastReconcileCompletedSeq,
123
+ acceptedRewriteBoundary(log) ?? 0,
124
+ log.waitResumeVerifyBoundary,
125
+ )
126
+ ? log.cleanRestackPolicy
127
+ : undefined
128
+ }
@@ -12,8 +12,9 @@
12
12
  *
13
13
  * Read cost per call is bounded: one `repository.status` pass, one open-build
14
14
  * view pass (one facts read per open, nonterminal build; settled builds are
15
- * never listed), and one repository journal page of at most 256 rows after
16
- * the cursor. Nothing grows with log length or settled history, and the call
15
+ * never listed), one `doneEscalations` rollup read with a record and facts
16
+ * read per done build that still has an open escalation, and one repository
17
+ * journal page of at most 256 rows after the cursor. Nothing grows with log length or settled history, and the call
17
18
  * reads zero event rows when nothing changed since the cursor.
18
19
  */
19
20
  import { isDiverged } from '../cli/build-progress'
@@ -27,6 +28,7 @@ import type { TicketRef } from '../ontology'
27
28
  import type { BuildStore } from '../store/types'
28
29
  import type { OperatorToolName } from './annotations'
29
30
  import { consentEntryFromView } from './landings'
31
+ import { doneEscalatedBuilds } from './done-escalations'
30
32
  import { getRepositoryStatus } from './query'
31
33
  import { withOperatorView } from './read-view'
32
34
  import { readRepositoryAttentionPage } from './repository-events'
@@ -382,7 +384,8 @@ export async function getOperatorAttention(opts: {
382
384
  const escalations: AttentionEscalationItem[] = []
383
385
  const merges: AttentionMergeItem[] = []
384
386
  const waiting: AttentionWaitingItem[] = []
385
- for (const { record, digest } of await view.listOpenBuilds(repo)) {
387
+ const open = await view.listOpenBuilds(repo)
388
+ for (const { record, digest } of open) {
386
389
  if (record.repo !== repo || digest.terminal !== undefined) continue
387
390
  const facts = await view.buildFacts(record.slug)
388
391
  const state = facts.state
@@ -440,6 +443,28 @@ export async function getOperatorAttention(opts: {
440
443
  }),
441
444
  )
442
445
  }
446
+ // A done build's escalation waits on an acknowledgement only: no merge
447
+ // or waiting item, and the build stays done.
448
+ const openSlugs = new Set(open.map(({ record }) => record.slug))
449
+ for (const { record, facts } of await doneEscalatedBuilds(view, repo, openSlugs)) {
450
+ const summary = summarizeFrom(record, facts.state, now)
451
+ escalations.push({
452
+ slug: record.slug,
453
+ ...(record.ticket !== undefined ? { ticket: record.ticket } : {}),
454
+ status: summary.status,
455
+ ...(summary.phase !== undefined ? { phase: summary.phase } : {}),
456
+ ...(summary.round !== undefined ? { round: summary.round } : {}),
457
+ escalations: facts.state.openEscalations,
458
+ resolve: [
459
+ {
460
+ tool: 'builds.answer',
461
+ input: { repo, slug: record.slug },
462
+ by: 'operator',
463
+ note: 'acknowledges; the build stays done',
464
+ },
465
+ ],
466
+ })
467
+ }
443
468
  return {
444
469
  escalations: escalations.sort(bySlug),
445
470
  merges: merges.sort(bySlug),
@@ -0,0 +1,38 @@
1
+ /**
2
+ * The `done` builds with an open escalation that operator surfaces list
3
+ * beside the open builds (SPEC §7.7 `doneEscalations`, §14).
4
+ *
5
+ * One `doneEscalations` rollup read, then `getBuild` and the saved build facts
6
+ * per listed build: bounded by escalated done builds, never by history. Each
7
+ * candidate is confirmed against its reduced state, so the row and attention
8
+ * text always come from the build reducer. Call it inside an existing
9
+ * operator view pass; it opens none of its own.
10
+ */
11
+ import { openOnDone } from '../kernel/done-escalations'
12
+ import type { RepoViewStore } from '../processes/repo-view'
13
+ import { readDoneEscalations, type CurrentBuildFacts } from '../store/reduced-reads'
14
+ import type { BuildRecord } from '../store/types'
15
+
16
+ export interface DoneEscalatedBuild {
17
+ record: BuildRecord
18
+ facts: CurrentBuildFacts
19
+ }
20
+
21
+ /** Escalated done builds of `repo`, by slug, skipping `skip` (builds the
22
+ * caller already read as open). */
23
+ export async function doneEscalatedBuilds(
24
+ view: RepoViewStore,
25
+ repo: string,
26
+ skip: ReadonlySet<string> = new Set(),
27
+ ): Promise<DoneEscalatedBuild[]> {
28
+ const listed = await readDoneEscalations(view, repo)
29
+ const builds: DoneEscalatedBuild[] = []
30
+ for (const { slug } of listed.builds) {
31
+ if (skip.has(slug)) continue
32
+ const record = await view.getBuild(slug)
33
+ if (record === null || record.repo !== repo) continue
34
+ const facts = await view.buildFacts(slug)
35
+ if (openOnDone(facts.state)) builds.push({ record, facts })
36
+ }
37
+ return builds
38
+ }
@@ -23,6 +23,19 @@ export type {
23
23
  StepState,
24
24
  StepTiming,
25
25
  } from '../cli/dashboard/model'
26
+ export {
27
+ BUILD_STATUS_TONE,
28
+ HARVEST_STATUS_TONE,
29
+ buildStatusText,
30
+ harvestStatusText,
31
+ } from '../cli/dashboard/vocabulary'
32
+ export type {
33
+ BuildStatusWord,
34
+ DashboardTone,
35
+ HarvestStatusWord,
36
+ StatusBasis,
37
+ StatusText,
38
+ } from '../cli/dashboard/vocabulary'
26
39
  export { parseTranscript } from '../cli/dashboard/transcript'
27
40
  export type {
28
41
  TranscriptPresentation,
@@ -39,5 +52,5 @@ export type { DashboardHandoff } from '../cli/dashboard/handoff'
39
52
  export { formatRollback } from '../cli/dashboard/rollback'
40
53
  export type { DashboardRollback } from '../cli/dashboard/rollback'
41
54
  export { handPushedLabel, handPushedText } from '../cli/dashboard/hand-pushed'
42
- export { URGENT_MARK, queuedTickets } from '../cli/dashboard/queue'
55
+ export { PRIORITY_MARKS, URGENT_MARK, queuedTickets } from '../cli/dashboard/queue'
43
56
  export type { QueuedTicket } from '../cli/dashboard/queue'
@@ -2,9 +2,12 @@ import { z } from 'zod'
2
2
  import { abortDestinationSchema } from '../events/payloads'
3
3
  import { issueLinksInputSchema } from '../ports/tickets/issue-links'
4
4
  import { TICKET_MOVE_ROLES } from '../ports/tickets/lifecycle'
5
- import { ticketPrioritySchema } from '../ports/tickets/priority'
5
+ import {
6
+ buildPrioritySchema,
7
+ startTierSchema,
8
+ ticketPrioritySchema,
9
+ } from '../ports/tickets/priority'
6
10
  import { ticketAssigneesSchema } from '../ports/tickets/assignees'
7
- import { ticketStartPrioritySchema } from '../events/repository'
8
11
 
9
12
  const issueLinksField = issueLinksInputSchema
10
13
  .optional()
@@ -15,7 +18,7 @@ const issueLinksField = issueLinksInputSchema
15
18
  const priorityField = ticketPrioritySchema
16
19
  .optional()
17
20
  .describe(
18
- 'Dispatch class: "urgent" is claimed before normal ready work (never preempting a running build); "normal" (the default) removes urgency. Sources that cannot store priority refuse urgent.',
21
+ 'Priority level: "urgent", "high", "normal" (the default) or "low". Dispatch claims ready work by level, urgent, then high, normal and low, each in the source\'s order, never preempting a running build; only urgent claims bypass open-PR backpressure. On update, "normal" clears the level. A source without native priority stores it as a priority:<level> label.',
19
22
  )
20
23
 
21
24
  const assigneesField = ticketAssigneesSchema
@@ -47,7 +50,7 @@ export const buildControlRequestSchema = z.discriminatedUnion('action', [
47
50
  }),
48
51
  z.strictObject({ action: z.literal('hold'), reason: z.string().optional() }),
49
52
  /** Slot-admission priority for an active build; never changes the ticket. */
50
- z.strictObject({ action: z.literal('priority'), priority: ticketPrioritySchema }),
53
+ z.strictObject({ action: z.literal('priority'), priority: buildPrioritySchema }),
51
54
  ])
52
55
  export type OperatorBuildControlRequest = z.infer<typeof buildControlRequestSchema>
53
56
 
@@ -177,7 +180,7 @@ export const ticketMoveRequestSchema = ticketMoveRequestShape.refine(
177
180
  )
178
181
  /** `POST …/tickets/{id}/start`'s optional body; an empty body is manual. */
179
182
  export const ticketStartRequestSchema = z.strictObject({
180
- priority: ticketStartPrioritySchema.optional(),
183
+ priority: startTierSchema.optional(),
181
184
  })
182
185
  export const ticketBlockerRequestSchema = z.strictObject({
183
186
  expectedRevision: expectedRevisionSchema,
@@ -1,16 +1,18 @@
1
1
  import { normalizeEffectiveConfigArtifact } from '../config/effective-artifact'
2
- import { migrationIdentity } from '../kernel/ticket-migrations'
3
2
  import { enrichDrainingRow, projectHandoffs } from '../cli/dashboard/handoff'
4
3
  import { repositoryQueueDepth } from '../cli/dashboard/header'
5
- import { enrichIntegrationRows } from '../cli/dashboard/integration-row'
4
+ import {
5
+ enrichIntegrationRows,
6
+ unresolvedIntegrationRecords,
7
+ } from '../cli/dashboard/integration-row'
6
8
  import {
7
9
  dispatchCapacity,
8
- slotRequest,
9
10
  startClaimDemand,
10
- urgentClaimDemand,
11
+ claimDemand,
11
12
  type CapacityBuild,
12
13
  } from '../kernel/dispatch-capacity'
13
14
  import { landingRestackDue } from '../kernel/engine'
15
+ import { capacityBuildFromFacts } from '../kernel/capacity-build'
14
16
  import { forgeReadinessWarnings } from '../kernel/dispatch-status'
15
17
  import { readBuildDigests } from '../store/reduced-reads'
16
18
  import {
@@ -60,6 +62,7 @@ import { DISPATCHER_EFFECTIVE_CONFIG_ARTIFACT } from '../store/retention'
60
62
  import { reduceDispatchStatus } from '../kernel/dispatch-status'
61
63
  import type { RepoViewStore } from '../processes/repo-view'
62
64
  import { withOperatorView } from './read-view'
65
+ import { doneEscalatedBuilds } from './done-escalations'
63
66
  import type { RepositoryEvent } from '../events/repository'
64
67
  import type { BuildRecord, BuildStore, Clock } from '../store/types'
65
68
 
@@ -88,6 +91,19 @@ export async function listOperatorBuilds(opts: {
88
91
  return withOperatorView(opts.store, opts.repo, 'builds', (view) => listFromView(view, opts))
89
92
  }
90
93
 
94
+ /** A node's provisioning marker, for capacity; a leaf reads none. */
95
+ async function nodeProvisioning(
96
+ view: RepoViewStore,
97
+ slug: string,
98
+ state: BuildState,
99
+ ): Promise<{ provisioning: boolean; provisioningSeq?: number }> {
100
+ if (state.kind !== 'node') return { provisioning: false }
101
+ const marker = (await readBuildFacts(view, slug)).value.provisionMarker
102
+ return marker === undefined
103
+ ? { provisioning: false }
104
+ : { provisioning: true, provisioningSeq: marker.seq }
105
+ }
106
+
91
107
  async function listFromView(
92
108
  view: RepoViewStore,
93
109
  opts: { repo: string; scope: BuildListScope; now: Date },
@@ -113,24 +129,14 @@ async function listFromView(
113
129
  for (const record of records) {
114
130
  if (record.repo !== opts.repo) continue
115
131
  const facts = await view.buildFacts(record.slug)
116
- const projected = summarizeFrom(
132
+ const projected = summarizeFrom(record, facts.state, opts.now, {
117
133
  record,
118
- facts.state,
119
- opts.now,
120
- slotRequest(
121
- {
122
- record,
123
- state: facts.state,
124
- workspace: facts.workspace !== null,
125
- // Leaves rely on the continuation's lease; only nodes read the marker.
126
- provisioning:
127
- facts.state.kind === 'node' &&
128
- (await readBuildFacts(view, record.slug)).value.provisionMarker !== undefined,
129
- restackDue: landingRestackDue(facts.state, facts.log),
130
- },
131
- opts.now,
132
- ),
133
- )
134
+ state: facts.state,
135
+ workspace: facts.workspace !== null,
136
+ // The marker anchors runners launched before durable node admission.
137
+ ...(await nodeProvisioning(view, record.slug, facts.state)),
138
+ restackDue: landingRestackDue(facts.state, facts.log),
139
+ })
134
140
  if (statuses.has(projected.status)) output.push(projected)
135
141
  }
136
142
  return output.sort((a, b) => b.updatedAt.localeCompare(a.updatedAt))
@@ -282,12 +288,14 @@ async function readPinnedConfig(
282
288
  * AUT-487 digest): `effectiveStatus` maps only `done` outside the visible set
283
289
  * (cli/dashboard/model.ts `isVisible`), so `projectBuild` returns null
284
290
  * exactly for this state, and a pinned effective-config read for such a
285
- * build could never be surfaced. One predicate so every consumer cannot
286
- * diverge from each other or from the row projection: the digest's `terminal`
287
- * is a third consumer of the same gate — `terminal === 'done'` is exactly
288
- * `reduceBuild(...).status === 'done'` — and the snapshot uses it to skip a
289
- * finished build's history and pinned-config reads without weakening this
290
- * predicate as the authority. If cli/dashboard/model.ts ever adds a
291
+ * build could never be surfaced. A `done` build with an open escalation
292
+ * projects as `blocked`, so it passes this gate and renders a row. One
293
+ * predicate so every consumer cannot diverge from each other or from the row
294
+ * projection: the digest's `terminal` is a third consumer of the same gate —
295
+ * the open listing holds no completed build, and the snapshot reads escalated
296
+ * done builds through the `doneEscalations` rollup instead — so the snapshot
297
+ * skips a finished build's history and pinned-config reads without weakening
298
+ * this predicate as the authority. If cli/dashboard/model.ts ever adds a
291
299
  * non-visible status, this predicate must follow — the snapshot
292
300
  * byte-identical differential test and the done/aborted query tests pin the
293
301
  * coupling. */
@@ -343,10 +351,17 @@ export async function getOperatorBuild(opts: {
343
351
  }
344
352
  }
345
353
  }
346
- return {
347
- detail: detailFromFacts(record, facts, opts.now),
348
- dashboardRow,
349
- }
354
+ const detail = detailFromFacts(
355
+ record,
356
+ facts,
357
+ opts.now,
358
+ undefined,
359
+ undefined,
360
+ undefined,
361
+ capacityBuildFromFacts(record, facts),
362
+ )
363
+ if (dashboardRow && detail.slot) dashboardRow.slot = detail.slot
364
+ return { detail, dashboardRow }
350
365
  }
351
366
 
352
367
  export async function getRepositoryStatus(
@@ -435,9 +450,7 @@ async function dashboardFromView(
435
450
  record,
436
451
  state: facts.state,
437
452
  workspace: facts.workspace !== null,
438
- provisioning:
439
- facts.state.kind === 'node' &&
440
- (await readBuildFacts(view, record.slug)).value.provisionMarker !== undefined,
453
+ ...(await nodeProvisioning(view, record.slug, facts.state)),
441
454
  restackDue: landingRestackDue(facts.state, facts.log),
442
455
  })
443
456
  if (projectsNoDashboardRow(facts.state)) continue
@@ -452,6 +465,21 @@ async function dashboardFromView(
452
465
  )
453
466
  if (row !== null) projected.push(decorateWithPinnedMeta(row, pinned))
454
467
  }
468
+ // A done build with an open escalation renders a row until it is
469
+ // acknowledged, through the `doneEscalations` rollup; it holds no slot.
470
+ const openSlugs = new Set(open.map(({ record }) => record.slug))
471
+ for (const { record, facts } of await doneEscalatedBuilds(view, opts.repo, openSlugs)) {
472
+ const pinned = await readPinnedConfig(view, record.slug, config, facts.state.verify.configPin)
473
+ const row = projectBuildFromFacts(
474
+ record,
475
+ facts.state,
476
+ { dashboard: facts.dashboard, log: facts.log, deferral: facts.deferral },
477
+ config,
478
+ undefined,
479
+ pinned.config,
480
+ )
481
+ if (row !== null) projected.push(decorateWithPinnedMeta(row, pinned))
482
+ }
455
483
  // The pure core writes nothing — a snapshot performs no store writes and
456
484
  // never creates or locks the repository record.
457
485
  const warningLines = [
@@ -459,20 +487,14 @@ async function dashboardFromView(
459
487
  ...forgeReadinessWarnings(status),
460
488
  ...(status.warningNotice !== undefined ? [status.warningNotice] : []),
461
489
  ]
462
- const capacityProjection = dispatchCapacity(
463
- capacityBuilds,
464
- config.capacity,
465
- opts.clock(),
466
- migrationIdentity(repositoryEvents.ticketMigrations, config.tickets.source),
467
- {
468
- urgentClaims: urgentClaimDemand(repositoryEvents),
469
- openPrs: {
470
- policy: config.policy,
471
- engaged: repositoryEvents.openPrBackpressure !== undefined,
472
- },
473
- startRequests: startClaimDemand(repositoryEvents),
490
+ const capacityProjection = dispatchCapacity(capacityBuilds, config.capacity, opts.clock(), {
491
+ claims: claimDemand(repositoryEvents),
492
+ openPrs: {
493
+ policy: config.policy,
494
+ engaged: repositoryEvents.openPrBackpressure !== undefined,
474
495
  },
475
- )
496
+ startRequests: startClaimDemand(repositoryEvents),
497
+ })
476
498
  const model = buildDashboardFromProjected(
477
499
  enrichIntegrationRows(projected, await integrationRecords(view, opts.repo, projected, records)),
478
500
  {
@@ -502,16 +524,9 @@ async function integrationRecords(
502
524
  rows: readonly DashboardBuild[],
503
525
  open: readonly BuildRecord[],
504
526
  ): Promise<BuildRecord[]> {
505
- const listed = new Set(open.map((record) => record.slug))
506
- const wanted = new Set<string>()
507
- for (const row of rows)
508
- for (const child of row.integrationDetail?.children ?? []) {
509
- if (!child.builds?.length) continue
510
- if (!child.builds.includes(child.id) && child.title !== 'title unavailable') continue
511
- for (const slug of child.builds) if (!listed.has(slug)) wanted.add(slug)
512
- }
513
- if (wanted.size === 0) return [...open]
514
- const settled = await Promise.all([...wanted].map((slug) => view.getBuild(slug)))
527
+ const wanted = unresolvedIntegrationRecords(rows, new Set(open.map((record) => record.slug)))
528
+ if (wanted.length === 0) return [...open]
529
+ const settled = await Promise.all(wanted.map((slug) => view.getBuild(slug)))
515
530
  return [
516
531
  ...open,
517
532
  ...settled.filter((record): record is BuildRecord => record !== null && record.repo === repo),
@@ -10,7 +10,11 @@ import { getOperatorTicketTree } from './tickets'
10
10
  import { openOperatorTickets, operatorControlTickets } from './tickets'
11
11
  import { TicketRevisionConflict, TicketRevisionUnsupported } from '../ports/tickets/revision'
12
12
  import { TicketIssueLinksUnsupported } from '../ports/tickets/issue-links'
13
- import { TicketPriorityUnsupported, ticketPrioritySchema } from '../ports/tickets/priority'
13
+ import {
14
+ buildPrioritySchema,
15
+ START_TIERS,
16
+ TicketPriorityUnsupported,
17
+ } from '../ports/tickets/priority'
14
18
  import { TicketAssigneesUnsupported } from '../ports/tickets/assignees'
15
19
  /**
16
20
  * The agent tool registry — one typed table that is the single source of
@@ -504,10 +508,10 @@ const buildControlInput = z.strictObject({
504
508
  .describe(
505
509
  'Control to request: "pause" (or "cancel-pause" to revoke a pending pause), "resume" a paused build, "merge" (deprecated alias "land") for merge consent or "hold" to withdraw consent, "priority" to set the build\'s slot-admission priority — or the destructive "abort" (cancels the build, cleans up its PR and workspace, hands the ticket back to triage, or to ready with `to`) and "discard" (dequeue a queued build).',
506
510
  ),
507
- priority: ticketPrioritySchema
511
+ priority: buildPrioritySchema
508
512
  .optional()
509
513
  .describe(
510
- 'Required with, and only valid with, "priority": "urgent" admits the build to free slots ahead of normal parked work and normal ticket claims; "normal" returns it to normal order. Running work is never preempted and the ticket is unchanged.',
514
+ 'Required with, and only valid with, "priority": the build\'s level, "urgent", "high", "normal" or "low". Free slots go to each level\'s parked work and then its ticket claims, urgent first and low last. Running work is never preempted and the ticket is unchanged.',
511
515
  ),
512
516
  to: abortDestinationSchema
513
517
  .optional()
@@ -616,7 +620,7 @@ const ticketsListInput = z.strictObject({
616
620
  .enum(['oldest', 'newest'])
617
621
  .optional()
618
622
  .describe(
619
- 'Dispatch order, urgent tickets first and then the source order (the default), or newest filed first regardless of urgency.',
623
+ 'Priority order, urgent then high then normal then low tickets, each in the source order (the default), or newest filed first regardless of priority.',
620
624
  ),
621
625
  })
622
626
 
@@ -679,10 +683,10 @@ const ticketsStartInput = z.strictObject({
679
683
  repo: repoField,
680
684
  id: ticketIdField,
681
685
  priority: z
682
- .enum(['manual', 'urgent', 'normal'])
686
+ .enum(START_TIERS)
683
687
  .optional()
684
688
  .describe(
685
- 'Slot-admission tier for the request (default "manual"): manual goes ahead of all waiting work; urgent waits for urgent parked work; normal waits for normal parked work and urgent claims. Not allowed with cancel.',
689
+ 'Slot-admission tier for the request (default "manual"): manual goes ahead of all waiting work; urgent, high, normal or low waits for parked work at that level or above and for the start requests and ticket claims of every higher level, and goes ahead of that level\'s ready tickets. Not allowed with cancel.',
686
690
  ),
687
691
  cancel: z
688
692
  .boolean()
@@ -867,7 +871,7 @@ export const TOOLS: readonly ToolEntry[] = [
867
871
  'builds.list',
868
872
  'List one repository’s builds, newest first, with effective status derived from the build log.',
869
873
  buildListInput,
870
- 'JSON array of build summaries: slug, ticket ref, effective status, phase/round/attempt, PR number/url/state, updatedAt, lease health, durable-event progress, any ticket wait (`wait` with its state and tickets; `waitOnly` when the wait is the only open escalation), and an optimization node’s objective progress (`objective`).',
874
+ 'JSON array of build summaries: slug, ticket ref, effective status, phase/round/attempt, PR number/url/state, updatedAt, lease health, durable-event progress, any ticket wait (`wait` with its state and tickets; `waitOnly` when the wait is the only open escalation), an optimization node’s objective progress (`objective`), and each nonterminal build’s slot state (`slot`: `{state: "held"}`, `{state: "requested", request, priority?: "urgent" | "high" | "low"}` or `{state: "none"}`; absent means unknown, never none).',
871
875
  async (raw, ctx) => {
872
876
  const input = raw as z.infer<typeof buildListInput>
873
877
  return listOperatorBuilds({
@@ -882,7 +886,7 @@ export const TOOLS: readonly ToolEntry[] = [
882
886
  'builds.get',
883
887
  'Show detailed state for one build: open escalations, verify progress, PR lifecycle, lease health, and the dashboard row.',
884
888
  buildDetailInput,
885
- '{detail, dashboardRow}: the full build detail projection and the dashboard row a terminal dashboard would render (null when the build has no dashboard row). An optimization node carries its objective progress as `detail.objective` and `dashboardRow.objectiveRow`.',
889
+ '{detail, dashboardRow}: the full build detail projection and the dashboard row a terminal dashboard would render (null when the build has no dashboard row). An optimization node carries its objective progress as `detail.objective` and `dashboardRow.objectiveRow`. A nonterminal build reports its slot state as `detail.slot` and `dashboardRow.slot`, shaped as in builds.list.',
886
890
  async (raw, ctx) => {
887
891
  const input = raw as z.infer<typeof buildDetailInput>
888
892
  return getOperatorBuild({
@@ -996,7 +1000,7 @@ export const TOOLS: readonly ToolEntry[] = [
996
1000
  ),
997
1001
  defineTool(
998
1002
  'builds.control',
999
- "Pause immediately suspends a live agent session. Resume continues where stopped when supported; remote and unsupported sessions rerun fresh. Request a durable control for one active build: pause/cancel-pause, resume, hold or merge — or the destructive abort and discard. Merge requires a ready candidate, and an optional head binds consent to the reviewed head; hold withdraws merge consent, with an optional reason. Priority sets the build's slot-admission priority (urgent or normal) to expedite waiting work without aborting it.",
1003
+ "Pause immediately suspends a live agent session. Resume continues where stopped when supported; remote and unsupported sessions rerun fresh. Request a durable control for one active build: pause/cancel-pause, resume, hold or merge — or the destructive abort and discard. Merge requires a ready candidate, and an optional head binds consent to the reviewed head; hold withdraws merge consent, with an optional reason. Priority sets the build's slot-admission level (urgent, high, normal or low) to expedite or defer waiting work without aborting it.",
1000
1004
  buildControlInput,
1001
1005
  'Either {kind: "command", slug, command, event} for an accepted control, or {kind: "answer-required", slug, escalationIds} when a resume needs its open escalations answered first.',
1002
1006
  async (raw, ctx) => {
@@ -1073,9 +1077,9 @@ export const TOOLS: readonly ToolEntry[] = [
1073
1077
  ),
1074
1078
  defineTool(
1075
1079
  'builds.answer',
1076
- 'Answer a blocked build’s open escalations: guidance text, a bare retry, a dismissal of the cited findings, a review-round ceiling, accept-target (answers only a leaf’s target-rewritten escalation: restack its own commits onto the rewritten target), or a spec revision (destructive — replaces the spec). Leaves require an escalation and restart from plan; idle collecting or verification-failed nodes may revise without an escalation and recollect for verification.',
1080
+ 'Answer a blocked build’s open escalations: guidance text, a bare retry, a dismissal of the cited findings, a review-round ceiling, accept-target (answers only a leaf’s target-rewritten escalation: restack its own commits onto the rewritten target), or a spec revision (destructive — replaces the spec). Leaves require an escalation and restart from plan; idle collecting or verification-failed nodes may revise without an escalation and recollect for verification. On a done build it only acknowledges open escalations (guidance or retry), leaving it done; other resolutions are refused.',
1077
1081
  buildsAnswerInput,
1078
- 'The controlBuild answer result: {kind: "answered", slug, count, resolution, resumed, …} describing how many escalations were answered and with what.',
1082
+ 'The controlBuild answer result: {kind: "answered", slug, count, resolution, resumed, …} describing how many escalations were answered and with what; acknowledged: true when a done build’s escalations were only closed.',
1079
1083
  async (raw, ctx) => {
1080
1084
  const input = raw as OperatorAnswerRequest & { repo: string; slug: string }
1081
1085
  await requireRouteBuild(ctx.store, input.repo, input.slug)
@@ -1152,7 +1156,7 @@ export const TOOLS: readonly ToolEntry[] = [
1152
1156
  'repository.status',
1153
1157
  'Report one repository’s durable dispatcher settings and journal state.',
1154
1158
  repositoryStatusInput,
1155
- 'The repository status projection: dispatcherRunning is true for a holder, expired holder or unfinished draining handoff; ticket intake, repository-wide pause, claim-time auto-merge default, and the harvest/dispatch journal state the sessionless CLI and dashboard read. operator.presence is "unavailable" here because this tool does not load presence registrations; that is not evidence that no operator is present.',
1159
+ 'The repository status projection: dispatcherRunning is true for a holder, expired holder or unfinished draining handoff; ticket intake, repository-wide pause, claim-time auto-merge default, and the harvest/dispatch journal state the sessionless CLI and dashboard read. capacity.slots maps each nonterminal build to its slot state, shaped as in builds.list; occupied counts its held entries. operator.presence is "unavailable" here because this tool does not load presence registrations; that is not evidence that no operator is present.',
1156
1160
  async (raw, ctx) => {
1157
1161
  const input = raw as z.infer<typeof repositoryStatusInput>
1158
1162
  return getRepositoryStatus(ctx.store, input.repo)
@@ -1351,7 +1355,7 @@ export const TOOLS: readonly ToolEntry[] = [
1351
1355
  ),
1352
1356
  defineTool(
1353
1357
  'tickets.create',
1354
- 'Create a ticket in the configured source, optionally labelled (explicit labels are unioned with the [tickets].createLabels default), pre-blocked, linked to the forge issues it addresses, urgent so it dispatches before normal ready work, assigned (explicit assignees replace the [tickets].createAssignee default), or filed in a nondefault state.',
1358
+ 'Create a ticket in the configured source, optionally labelled (explicit labels are unioned with the [tickets].createLabels default), pre-blocked, linked to the forge issues it addresses, at a priority level (ready work dispatches by level: urgent, high, normal, then low), assigned (explicit assignees replace the [tickets].createAssignee default), or filed in a nondefault state.',
1355
1359
  ticketsCreateInput,
1356
1360
  '{ticket, blockers, build}: the created ticket and its (usually empty) dependency states.',
1357
1361
  async (raw, ctx) => {
@@ -1391,7 +1395,7 @@ export const TOOLS: readonly ToolEntry[] = [
1391
1395
  ),
1392
1396
  defineTool(
1393
1397
  'tickets.update',
1394
- 'Partially replace a ticket’s editable fields (title, body, labels, issue links, priority, assignees, kind, target); urgent priority dispatches before normal ready work, and assignees replace the whole set ([] clears). State is never changed here.',
1398
+ 'Partially replace a ticket’s editable fields (title, body, labels, issue links, priority, assignees, kind, target); ready work dispatches by level (urgent, high, normal, then low), "normal" clears the level, and assignees replace the whole set ([] clears). State is never changed here.',
1395
1399
  ticketsUpdateInput,
1396
1400
  '{ticket, blockers, build}: the updated ticket.',
1397
1401
  async (raw, ctx) => {
@@ -1467,7 +1471,7 @@ export const TOOLS: readonly ToolEntry[] = [
1467
1471
  ),
1468
1472
  defineTool(
1469
1473
  'tickets.start',
1470
- "Ask the running dispatcher to start one ticket by id, even while intake is off. Records a durable, attributed request that the dispatcher (local or hosted) honours on its next tick with a free slot in the request's priority tier (manual by default, ahead of all waiting work; or urgent, or normal), claiming no other ticket. The claimed build is urgent when priority is urgent, otherwise it keeps its ticket's priority. Every gate still applies: ready state, spec standard, resolved blockers, no active build, capacity and repository pause. Repeating the request with another priority updates the pending request. With cancel, cancels the pending request instead.",
1474
+ "Ask the running dispatcher to start one ticket by id, even while intake is off. Records a durable, attributed request that the dispatcher (local or hosted) honours on its next tick with a free slot in the request's priority tier (manual by default, ahead of all waiting work; or urgent, high, normal or low, each after that level's parked work and ahead of its ready tickets), claiming no other ticket. The claimed build takes the request's level, or its ticket's level for a manual request. Every gate still applies: ready state, spec standard, resolved blockers, no active build, capacity and repository pause. Repeating the request with another priority updates the pending request. With cancel, cancels the pending request instead.",
1471
1475
  ticketsStartInput,
1472
1476
  'For a request: {status: "pending", existing, updated, request, priority, requestedAt, ticket, event?} — existing is true when a request for the ticket was already pending; updated is true when its priority was changed to this one (event is the update), and false with no event when nothing was written. For cancel: {cancelled: true, request, ticket, event} or {cancelled: false, id} when nothing was pending. The settlement arrives later as a ticket.start-settled repository event (repository.events) and in repository.status ticketStarts.',
1473
1477
  async (raw, ctx) => {