@defrex/autobuild 1.4.1 → 1.5.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 (201) hide show
  1. package/README.md +1 -1
  2. package/SPEC.md +440 -95
  3. package/bin/ab-dispatch-kernel.ts +1 -0
  4. package/docs/accounts.md +9 -0
  5. package/docs/agent-runtimes.md +1 -0
  6. package/docs/answering-blocked-builds.md +2 -1
  7. package/docs/architecture.md +290 -130
  8. package/docs/assets/headline-wide.png +0 -0
  9. package/docs/build-store.md +33 -3
  10. package/docs/cli.md +2 -1
  11. package/docs/configuration-overview.md +9 -0
  12. package/docs/configuration.md +166 -101
  13. package/docs/dispatcher-hosting.md +19 -3
  14. package/docs/dispatcher.md +9 -4
  15. package/docs/integration-overview.md +2 -2
  16. package/docs/integration-tree.md +91 -28
  17. package/docs/merge-policy.md +28 -9
  18. package/docs/operator-api.md +43 -18
  19. package/docs/operator-surfaces.md +1 -1
  20. package/docs/plugin-authoring.md +85 -8
  21. package/docs/remote-store-protocol.md +25 -7
  22. package/docs/remote-ticket-protocol.md +126 -12
  23. package/docs/restacking.md +20 -6
  24. package/docs/seams.md +2 -2
  25. package/docs/setup.md +19 -13
  26. package/docs/spec-standard.md +2 -1
  27. package/docs/ticket-dependencies.md +26 -8
  28. package/docs/ticket-migration.md +70 -7
  29. package/docs/ticket-sources.md +82 -5
  30. package/docs/tickets.md +34 -2
  31. package/docs/troubleshooting.md +2 -2
  32. package/docs/verification.md +5 -5
  33. package/docs/website.md +8 -0
  34. package/docs/workspaces.md +1 -1
  35. package/package.json +5 -4
  36. package/packages/core/src/accounts/hosted-readiness.ts +21 -0
  37. package/packages/core/src/cli/attention.ts +1 -0
  38. package/packages/core/src/cli/build-control.ts +36 -12
  39. package/packages/core/src/cli/connect.ts +9 -18
  40. package/packages/core/src/cli/context.ts +44 -0
  41. package/packages/core/src/cli/dashboard/configuration.ts +11 -0
  42. package/packages/core/src/cli/dashboard/model.ts +40 -10
  43. package/packages/core/src/cli/dashboard/queue.ts +21 -0
  44. package/packages/core/src/cli/dashboard/render.ts +40 -22
  45. package/packages/core/src/cli/dispatch-frontend.ts +63 -30
  46. package/packages/core/src/cli/dispatch-mode.ts +35 -16
  47. package/packages/core/src/cli/dispatch-repository-feed.ts +40 -11
  48. package/packages/core/src/cli/dispatch.ts +154 -47
  49. package/packages/core/src/cli/help.ts +59 -22
  50. package/packages/core/src/cli/init-hosted-accounts.ts +54 -0
  51. package/packages/core/src/cli/init-readiness-remote.ts +16 -3
  52. package/packages/core/src/cli/init-validation.ts +144 -42
  53. package/packages/core/src/cli/issue-links.ts +67 -0
  54. package/packages/core/src/cli/main.ts +32 -15
  55. package/packages/core/src/cli/pr-summary-publication.ts +38 -7
  56. package/packages/core/src/cli/publication-settlement.ts +36 -24
  57. package/packages/core/src/cli/repository-status.ts +201 -49
  58. package/packages/core/src/cli/status.ts +41 -3
  59. package/packages/core/src/cli/terminals.ts +37 -2
  60. package/packages/core/src/cli/ticket-editor.ts +20 -6
  61. package/packages/core/src/cli/ticket.ts +264 -46
  62. package/packages/core/src/cli/triage-count-sampler.ts +59 -0
  63. package/packages/core/src/cli/watch.ts +4 -0
  64. package/packages/core/src/config/live.ts +45 -4
  65. package/packages/core/src/config/load.ts +9 -0
  66. package/packages/core/src/config/pipeline-source.ts +6 -2
  67. package/packages/core/src/config/ready-assignee.ts +86 -0
  68. package/packages/core/src/config/schema.ts +164 -36
  69. package/packages/core/src/distribution-packaging.ts +1 -1
  70. package/packages/core/src/events/catalog.ts +5 -0
  71. package/packages/core/src/events/compatibility.ts +2 -1
  72. package/packages/core/src/events/payloads.ts +70 -0
  73. package/packages/core/src/events/policy.ts +8 -0
  74. package/packages/core/src/events/repository.ts +91 -28
  75. package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +41 -0
  76. package/packages/core/src/kernel/build-identity.ts +12 -0
  77. package/packages/core/src/kernel/change-presence.ts +139 -6
  78. package/packages/core/src/kernel/dispatch-capacity.ts +80 -14
  79. package/packages/core/src/kernel/dispatch-status.ts +10 -1
  80. package/packages/core/src/kernel/dispatch-upgrade.ts +104 -5
  81. package/packages/core/src/kernel/engine.ts +4 -2
  82. package/packages/core/src/kernel/finalize-pr-rejection.ts +95 -0
  83. package/packages/core/src/kernel/generators/repository-journals.ts +15 -1
  84. package/packages/core/src/kernel/harvest.ts +4 -1
  85. package/packages/core/src/kernel/integration-completeness.ts +104 -17
  86. package/packages/core/src/kernel/integration-landing.ts +17 -0
  87. package/packages/core/src/kernel/integration-state.ts +17 -0
  88. package/packages/core/src/kernel/issue-keywords.ts +202 -0
  89. package/packages/core/src/kernel/janitor-failure.ts +11 -0
  90. package/packages/core/src/kernel/kernel-git.ts +87 -0
  91. package/packages/core/src/kernel/landing-readiness.ts +25 -17
  92. package/packages/core/src/kernel/log-index.ts +1 -1
  93. package/packages/core/src/kernel/node-issue-links.ts +142 -0
  94. package/packages/core/src/kernel/node-parent.ts +6 -0
  95. package/packages/core/src/kernel/node-restack-transaction.ts +2 -0
  96. package/packages/core/src/kernel/pr-summary.ts +24 -0
  97. package/packages/core/src/kernel/read-deferrals.ts +75 -12
  98. package/packages/core/src/kernel/read-facts.ts +32 -1
  99. package/packages/core/src/kernel/reconcile-restack.ts +1 -1
  100. package/packages/core/src/kernel/reducer-registry.ts +31 -1
  101. package/packages/core/src/kernel/reducer.ts +90 -2
  102. package/packages/core/src/kernel/ticket-preparation.ts +12 -0
  103. package/packages/core/src/kernel/verify-budget.ts +43 -0
  104. package/packages/core/src/operator/index.ts +3 -1
  105. package/packages/core/src/operator/presentation.ts +3 -0
  106. package/packages/core/src/operator/protocol.ts +38 -2
  107. package/packages/core/src/operator/query.ts +66 -29
  108. package/packages/core/src/operator/registry.ts +47 -26
  109. package/packages/core/src/operator/tickets.ts +77 -10
  110. package/packages/core/src/plugin-sdk/index.ts +13 -0
  111. package/packages/core/src/plugins/manifest.ts +1 -1
  112. package/packages/core/src/plugins/registry.ts +1 -0
  113. package/packages/core/src/ports/forge/contract.ts +69 -0
  114. package/packages/core/src/ports/forge/create.ts +5 -0
  115. package/packages/core/src/ports/forge/fake.ts +184 -3
  116. package/packages/core/src/ports/forge/git-rewrite.ts +4 -2
  117. package/packages/core/src/ports/forge/github.ts +175 -38
  118. package/packages/core/src/ports/forge/local-git.ts +14 -0
  119. package/packages/core/src/ports/forge/readiness.ts +10 -0
  120. package/packages/core/src/ports/forge-failure.ts +43 -0
  121. package/packages/core/src/ports/runner/claude.ts +7 -1
  122. package/packages/core/src/ports/runner/codex.ts +7 -2
  123. package/packages/core/src/ports/runner/native-cli-fixture.ts +2 -1
  124. package/packages/core/src/ports/runner/pi.ts +7 -1
  125. package/packages/core/src/ports/runner/runtime.ts +3 -0
  126. package/packages/core/src/ports/runner/start-prompt.ts +37 -0
  127. package/packages/core/src/ports/tickets/contract.ts +320 -7
  128. package/packages/core/src/ports/tickets/create.ts +72 -17
  129. package/packages/core/src/ports/tickets/fake.ts +18 -0
  130. package/packages/core/src/ports/tickets/file-codec.ts +20 -0
  131. package/packages/core/src/ports/tickets/file.ts +43 -1
  132. package/packages/core/src/ports/tickets/github-fake.ts +1123 -0
  133. package/packages/core/src/ports/tickets/github-issues.ts +431 -0
  134. package/packages/core/src/ports/tickets/github-validators.ts +194 -0
  135. package/packages/core/src/ports/tickets/github.ts +2029 -0
  136. package/packages/core/src/ports/tickets/hosted-index.ts +34 -3
  137. package/packages/core/src/ports/tickets/issue-links.ts +86 -0
  138. package/packages/core/src/ports/tickets/lifecycle.ts +60 -4
  139. package/packages/core/src/ports/tickets/linear.ts +66 -6
  140. package/packages/core/src/ports/tickets/migration.ts +290 -68
  141. package/packages/core/src/ports/tickets/operations.ts +98 -12
  142. package/packages/core/src/ports/tickets/priority.ts +55 -0
  143. package/packages/core/src/ports/tickets/remote-protocol.ts +195 -29
  144. package/packages/core/src/ports/tickets/remote.ts +188 -13
  145. package/packages/core/src/ports/tickets/revision.ts +22 -1
  146. package/packages/core/src/ports/tickets/states.ts +43 -0
  147. package/packages/core/src/ports/tickets/tree.ts +58 -12
  148. package/packages/core/src/ports/tickets/update.ts +12 -2
  149. package/packages/core/src/ports/types.ts +194 -11
  150. package/packages/core/src/ports/workspace/commit-preservation.ts +135 -13
  151. package/packages/core/src/ports/workspace/git-worktree.ts +3 -1
  152. package/packages/core/src/ports/workspace/vercel-sandbox.ts +132 -27
  153. package/packages/core/src/processes/build-runner.ts +99 -21
  154. package/packages/core/src/processes/dispatcher.ts +1080 -533
  155. package/packages/core/src/processes/execution-no-progress.ts +5 -0
  156. package/packages/core/src/processes/harvest-runner.ts +17 -8
  157. package/packages/core/src/processes/harvest.ts +5 -8
  158. package/packages/core/src/processes/tick-publication.ts +12 -2
  159. package/packages/core/src/processes/ticket-scan-schedule.ts +78 -0
  160. package/packages/core/src/processes/workspace-preservation.ts +37 -2
  161. package/packages/core/src/runtime-identity.ts +10 -2
  162. package/packages/core/src/scenarios/harness.ts +4 -0
  163. package/packages/core/src/store/adapter.ts +7 -1
  164. package/packages/core/src/store/contract.ts +83 -2
  165. package/packages/core/src/store/digest.ts +32 -1
  166. package/packages/core/src/store/reducer-value-shapes.json +4187 -3391
  167. package/packages/core/src/store/remote/protocol.ts +2 -0
  168. package/packages/core/src/store/remote/released-clients.json +22 -0
  169. package/packages/core/src/store/remote/released-reducer-values/1.5.0.json +26924 -0
  170. package/packages/core/src/store/remote/released-reducer-values/index.ts +2 -0
  171. package/packages/core/src/store/repo-state-events.ts +2 -0
  172. package/packages/core/src/store/types.ts +5 -0
  173. package/packages/core/src/testing/dispatch-read-budget.ts +729 -123
  174. package/packages/core/src/testing/index.ts +18 -1
  175. package/packages/core/src/testing/presence-history.ts +79 -0
  176. package/packages/core/src/testing/reduced-read-budget.ts +1197 -31
  177. package/packages/core/src/testing/upgrade-generations.ts +77 -0
  178. package/skills/code-review/SKILL.md +4 -3
  179. package/skills/finalize/SKILL.md +18 -2
  180. package/skills/guide/SKILL.md +382 -139
  181. package/skills/guide/references/accounts.md +9 -0
  182. package/skills/guide/references/integration-tree.md +91 -28
  183. package/skills/guide/references/merge-policy.md +28 -9
  184. package/skills/guide/references/operator-api.md +43 -18
  185. package/skills/guide/references/plugin-authoring.md +85 -8
  186. package/skills/guide/references/remote-store-protocol.md +25 -7
  187. package/skills/guide/references/remote-ticket-protocol.md +126 -12
  188. package/skills/guide/references/restacking.md +20 -6
  189. package/skills/guide/references/setup.md +19 -13
  190. package/skills/guide/references/spec-standard.md +2 -1
  191. package/skills/guide/references/ticket-dependencies.md +26 -8
  192. package/skills/guide/references/ticket-migration.md +70 -7
  193. package/skills/harvest-review/SKILL.md +4 -3
  194. package/skills/implement/SKILL.md +20 -1
  195. package/skills/operate/SKILL.md +103 -28
  196. package/skills/plan/SKILL.md +1 -1
  197. package/skills/reconcile/SKILL.md +5 -4
  198. package/skills/spec/SKILL.md +15 -2
  199. package/skills/tickets/SKILL.md +114 -37
  200. package/templates/autobuild.toml +5 -0
  201. package/templates/hosted-service/package.json +2 -2
@@ -1,3 +1,7 @@
1
+ import {
2
+ assertReadyAssigneeAccepted,
3
+ prepareReadyAssigneeForDispatch,
4
+ } from '../config/ready-assignee'
1
5
  import { selectDispatchMode } from './dispatch-mode'
2
6
  import { createTerminalModeController } from './terminal-restore'
3
7
  import { inspectLocalAccountEnvironment } from '../accounts/local-owner'
@@ -27,13 +31,15 @@ import { resolveUpgradeTarget } from './dispatch-upgrade-target'
27
31
  import { prepareUpgrade } from './dispatch-upgrade-install'
28
32
  import { readDispatchUpgrade } from '../store/reduced-reads'
29
33
  import type { Handoff, UpgradeRun } from '../kernel/dispatch-upgrade'
30
- import { RUNTIME_IDENTITY, formatDispatcherError } from '../runtime-identity'
34
+ import { formatDispatcherError, runtimeIdentity } from '../runtime-identity'
31
35
 
32
36
  import { isDeepStrictEqual } from 'node:util'
33
37
  import { guardForge } from '../kernel/guarded-forge'
34
38
  import { dispatchCapacity } from '../kernel/dispatch-capacity'
35
- import { openTicketSource } from './ticket'
39
+ import { lazyTicketSource, openTicketSource } from './ticket'
40
+ import { ticketLifecycle } from '../ports/tickets/lifecycle'
36
41
  import {
42
+ branchGuardWarnings,
37
43
  inspectForgeReadiness,
38
44
  formatForgeReadiness,
39
45
  hardReadinessKeys,
@@ -55,7 +61,11 @@ import { RemoteBuildStore } from '../store/remote/client'
55
61
  import { delegateCredential } from '../store/remote/credentials'
56
62
  import { isRemoteStoreRef } from './repo-state'
57
63
  import { projectToken } from './project-credentials'
58
- import { settleSummaryRequests } from './pr-summary-publication'
64
+ import {
65
+ readLaunchFence,
66
+ settleSummaryRequests,
67
+ summaryHandoffPending,
68
+ } from './pr-summary-publication'
59
69
  import { readDispatcherLiveness, StandbyIdentityResolver } from './dispatcher-liveness'
60
70
  import { formatDispatcherIdentity } from '../kernel/dispatcher-liveness'
61
71
  /**
@@ -184,7 +194,6 @@ import {
184
194
  } from '../processes/build-execution-state'
185
195
  import { HarvestRunner, type HarvestRunnerResult } from '../processes/harvest-runner'
186
196
  import {
187
- unclaimedObservationCount,
188
197
  evaluateHarvestPressureFromStore,
189
198
  evaluateHarvestPressureFromDigests,
190
199
  } from '../processes/harvest'
@@ -196,6 +205,7 @@ import {
196
205
  toggleRepositorySetting,
197
206
  } from '../operator/control'
198
207
  import {
208
+ defaultTriageState,
199
209
  Dispatcher,
200
210
  emptyTickReport,
201
211
  type LaunchRunnerResult,
@@ -225,6 +235,7 @@ import {
225
235
  type RepoTickFinish,
226
236
  } from '../store/types'
227
237
  import { availableRelease } from './self-update'
238
+ import { TriageCountSampler, triageReader } from './triage-count-sampler'
228
239
  import {
229
240
  startUpgradeNotice,
230
241
  type AvailableReleaseProbe,
@@ -262,6 +273,13 @@ export function slugNamingPrompt(spec: string): string {
262
273
  ].join('\n')
263
274
  }
264
275
 
276
+ /** Configuration-level warnings recorded durably as `roleWarnings` on run
277
+ * start and config reload: role-key diagnostics plus forge capability gaps
278
+ * such as missing cross-store branch protection (AUT-1106). */
279
+ function startupWarnings(config: Config, forge: Forge): string[] {
280
+ return [...roleKeyWarnings(config), ...branchGuardWarnings(forge)]
281
+ }
282
+
265
283
  function definedEnv(env: Record<string, string | undefined>): Record<string, string> {
266
284
  const defined: Record<string, string> = {}
267
285
  for (const [key, value] of Object.entries(env)) {
@@ -456,6 +474,10 @@ export interface DispatchOpts {
456
474
  /** Private child-kernel correlation. Presence suppresses terminal ownership
457
475
  * and enables durable dispatcher status publication. */
458
476
  kernelRunId?: string
477
+ /** Private: this dispatcher feeds an interactive Store-only frontend, so it
478
+ * samples the display-only triage count for its published status. Only
479
+ * `bin/ab-dispatch-kernel.ts` sets it; hosted kernels never sample. */
480
+ frontendStatus?: boolean
459
481
  /** Durable journaling identity of this dispatcher invocation. Every
460
482
  * dispatcher-initiated journal write and the repository lease carry this id,
461
483
  * so "who holds this repository?" and "who is writing this journal?" are the
@@ -533,6 +555,10 @@ async function defaultWire(
533
555
  env: opts.env,
534
556
  repoRoot: state.checkout,
535
557
  ...(opts.repository !== undefined ? { repository: opts.repository } : {}),
558
+ // Origin mode runs kernel Git through the caller's exec seam (the hosted
559
+ // dispatcher routes it to its shipped Git), as `fetchOriginModeConfig`
560
+ // already does; a checkout dispatcher keeps finding Git on its PATH.
561
+ ...(originMode ? { exec: opts.exec } : {}),
536
562
  })
537
563
  // Checkout-less provider seams: the sandbox provider derives its origin and
538
564
  // remote branch heads from these instead of host `git` — every host-exec
@@ -565,6 +591,11 @@ async function defaultWire(
565
591
  opened.localStateRoot,
566
592
  plugins,
567
593
  )
594
+ // Once, before the loop: whatever a readyAssignee value needs is resolved
595
+ // here so neither a tick nor a reload ever spends a request on it.
596
+ await prepareReadyAssigneeForDispatch(tickets, config.tickets, (line) => {
597
+ if (opts.silent !== true) opts.stderr(`warning: ${line}`)
598
+ })
568
599
  const { runtimes } = createProductionRuntimes()
569
600
  if (opts.env.AB_PROJECT_SECRETS_FAILED === '1')
570
601
  for (const name of JSON.parse(opts.env.AB_PROJECT_SECRETS_UNAVAILABLE ?? '[]') as string[])
@@ -751,7 +782,15 @@ class DispatchLoop {
751
782
  }
752
783
  /** Settlement-only publications carry the latest standing status instead of
753
784
  * manufacturing a zero queue measurement or losing diagnostics. */
754
- private lastTickStatus = {
785
+ private lastTickStatus: {
786
+ queued: number
787
+ triage?: number
788
+ blockedDiagnostics: string[]
789
+ janitorDiagnostics: string[]
790
+ ticketDiagnostics: string[]
791
+ creationDiagnostics: string[]
792
+ dependencyDiagnostics: string[]
793
+ } = {
755
794
  queued: 0,
756
795
  blockedDiagnostics: [] as string[],
757
796
  janitorDiagnostics: [] as string[],
@@ -808,11 +847,14 @@ class DispatchLoop {
808
847
  private forgePublicationFailed = false
809
848
  private readonly startupRootBranch: string
810
849
  private configWarnings: readonly string[] = []
850
+ /** Deprecation notices of an autobuild.toml change that is not adopted. */
851
+ private candidateWarnings: readonly string[] = []
811
852
  /** Last intake-enabled tick's standing queue depth, for the dashboard header. */
812
853
  private queuedCount = 0
813
- /** Last successfully measured unclaimed observation count. Sampling failures
814
- * retain this factual value rather than inventing a zero. */
815
- private observationCount = 0
854
+ /** Display-only triage count, sampled between ticks at most once per
855
+ * `TRIAGE_COUNT_REFRESH_MS`. Present only for interactive dashboards and
856
+ * frontend-status kernels; its value is undefined until a read succeeds. */
857
+ private readonly triageSampler: TriageCountSampler | undefined
816
858
  /** A slug/id-bound blocked-resume field. The model receives only slug/value;
817
859
  * captured escalation ids stay controller-private. */
818
860
  private resumePrompt: ResumePrompt | undefined
@@ -876,6 +918,13 @@ class DispatchLoop {
876
918
  // DispatchLoop constructions (tests).
877
919
  this.runId = opts.runId ?? opts.kernelRunId ?? `${this.host}-dispatch-${wiring.ids('inst')}`
878
920
  this.dashboard = opts.terminal?.interactive === true && opts.plain !== true
921
+ this.triageSampler =
922
+ this.dashboard || opts.frontendStatus === true
923
+ ? new TriageCountSampler(
924
+ triageReader(wiring.tickets, () => defaultTriageState(this.currentConfig().config)),
925
+ wiring.clock,
926
+ )
927
+ : undefined
879
928
  this.keyboard =
880
929
  this.dashboard && opts.terminal !== undefined && opts.input !== undefined
881
930
  ? createKeyboardProtocol((chunk) => opts.terminal!.write(chunk), opts.terminal.modes)
@@ -1203,7 +1252,10 @@ class DispatchLoop {
1203
1252
  )
1204
1253
  })
1205
1254
  : await this.liveConfig.refreshFromDisk()
1206
- if (outcome.kind === 'unchanged') return
1255
+ if (outcome.kind === 'unchanged') {
1256
+ if (this.candidateWarnings.length > 0) this.reportCandidateDeprecations([])
1257
+ return
1258
+ }
1207
1259
  if (outcome.kind === 'rejected') {
1208
1260
  if (outcome.notify) {
1209
1261
  await this.appendStatus({
@@ -1213,6 +1265,9 @@ class DispatchLoop {
1213
1265
  })
1214
1266
  this.warn(`config reload rejected: ${outcome.error}`)
1215
1267
  }
1268
+ // LiveConfig returns these once per distinct candidate content.
1269
+ if (outcome.deprecations !== undefined && outcome.deprecations.length > 0)
1270
+ this.reportCandidateDeprecations(outcome.deprecations)
1216
1271
  return
1217
1272
  }
1218
1273
  if (outcome.kind === 'publication-failed') {
@@ -1222,6 +1277,7 @@ class DispatchLoop {
1222
1277
  payload: { run: this.runId, error: outcome.error },
1223
1278
  })
1224
1279
  this.warn(`config reload not applied because its durable trace failed: ${outcome.error}`)
1280
+ if (outcome.deprecations.length > 0) this.reportCandidateDeprecations(outcome.deprecations)
1225
1281
  return
1226
1282
  }
1227
1283
 
@@ -1233,6 +1289,8 @@ class DispatchLoop {
1233
1289
  `autobuild.toml reload requires dispatch restart for: ${outcome.restartRequired.join(', ')}`,
1234
1290
  )
1235
1291
  }
1292
+ // The adopted file's deprecations now arrive as accepted-config notices.
1293
+ if (this.candidateWarnings.length > 0) this.candidateWarnings = []
1236
1294
  this.reportRoleDiagnostics()
1237
1295
  }
1238
1296
 
@@ -1284,19 +1342,6 @@ class DispatchLoop {
1284
1342
  // the latest repository facts. Shared refresh failures still fail the tick.
1285
1343
  await this.repoView.refresh()
1286
1344
  const digests = await this.repoView.getRepoBuildDigests(this.repoIdentity)
1287
- if (this.dashboard) {
1288
- try {
1289
- // Display-only sampling reuses the refreshed inputs without backing
1290
- // reads. Publish only a complete measurement; retain it on failure.
1291
- const count = unclaimedObservationCount({
1292
- digests,
1293
- harvestEvents: this.repoView.repositoryFacts().harvest,
1294
- })
1295
- this.observationCount = count
1296
- } catch {
1297
- // Retry on the next tick without fabricating a zero.
1298
- }
1299
- }
1300
1345
  const executionSlugs = new Set(
1301
1346
  [...digests].filter(([, digest]) => digest.executionOpen).map(([slug]) => slug),
1302
1347
  )
@@ -1332,8 +1377,10 @@ class DispatchLoop {
1332
1377
  ticketDiagnostics: readyObservation?.ticketDiagnostics ?? report.ticketDiagnostics,
1333
1378
  }
1334
1379
  this.queuedCount = publishedReport.queued
1380
+ const triage = this.triageSampler?.value
1335
1381
  this.lastTickStatus = {
1336
1382
  queued: publishedReport.queued,
1383
+ ...(triage !== undefined ? { triage } : {}),
1337
1384
  blockedDiagnostics: [...publishedReport.blockedDiagnostics],
1338
1385
  janitorDiagnostics: [...publishedReport.janitorDiagnostics],
1339
1386
  ticketDiagnostics: [...publishedReport.ticketDiagnostics],
@@ -1364,6 +1411,7 @@ class DispatchLoop {
1364
1411
  // no dependence on emission order relative to `startRendering()`.
1365
1412
  const warningLines = [
1366
1413
  ...this.configWarnings,
1414
+ ...this.candidateWarnings,
1367
1415
  ...this.forgeWarnings,
1368
1416
  ...(this.warningLine !== undefined ? [this.warningLine] : []),
1369
1417
  ]
@@ -1872,6 +1920,7 @@ class DispatchLoop {
1872
1920
  result = await controlBuild({
1873
1921
  store: this.wiring.store,
1874
1922
  ticketSource: async () => this.wiring.tickets,
1923
+ rejectedState: async () => ticketLifecycle(this.currentConfig().config.tickets).rejected,
1875
1924
  repo: this.repoIdentity,
1876
1925
  slug,
1877
1926
  env: this.opts.env,
@@ -3053,7 +3102,9 @@ class DispatchLoop {
3053
3102
  const runFacts = recent?.start
3054
3103
  ? recent
3055
3104
  : (await readDispatcherRunFacts(this.repoView, this.repoIdentity, this.runId)).value
3056
- const publish = shouldPublishTickFromFacts(merged, facts, runFacts, startedAt)
3105
+ const publish = shouldPublishTickFromFacts(merged, facts, runFacts, startedAt, {
3106
+ triage: this.lastTickStatus.triage,
3107
+ })
3057
3108
  const events: RepositoryEventWrite[] = publish
3058
3109
  ? [
3059
3110
  {
@@ -3347,6 +3398,9 @@ class DispatchLoop {
3347
3398
  // reached the durable branch. Reconcile that fact before a replacement
3348
3399
  // runner can rerun the phase and create a non-fast-forward successor.
3349
3400
  await this.settlePendingPublication(slug, instance)
3401
+ // Before the guest can run: every unsettled summary request above this
3402
+ // fence at completion was written by this execution.
3403
+ const launchFenceSeq = await readLaunchFence(this.repoView, slug)
3350
3404
  const launchAuth = /^https?:/i.test(this.wiring.storeRef)
3351
3405
  ? {
3352
3406
  token: await (this.wiring.credentialIssuer ?? delegateCredential)(
@@ -3411,8 +3465,19 @@ class DispatchLoop {
3411
3465
  }
3412
3466
 
3413
3467
  await this.repoView.refreshBuild(slug)
3414
- const state = (await readBuildFacts(this.repoView, slug)).value.state
3468
+ const facts = (await readBuildFacts(this.repoView, slug)).value
3469
+ const state = facts.state
3415
3470
  if (diagnostic === null && exit.exitCode === 0) {
3471
+ if (!relaunch && summaryHandoffPending(facts, launchFenceSeq)) {
3472
+ // The guest yielded only so this host can publish its summary.
3473
+ await this.appendStatus({
3474
+ actor: DISPATCHER,
3475
+ type: 'dispatcher.summary-handoff',
3476
+ payload: { run: this.runId, slug, status: state.status },
3477
+ })
3478
+ this.routineDiagnostic(`build ${slug} handed off its PR summary`)
3479
+ return
3480
+ }
3416
3481
  await this.appendStatus({
3417
3482
  actor: DISPATCHER,
3418
3483
  type: 'dispatcher.runner-settled',
@@ -3752,7 +3817,12 @@ class DispatchLoop {
3752
3817
  }
3753
3818
 
3754
3819
  private reportRoleDiagnostics(): void {
3755
- const lines = roleKeyWarnings(this.currentConfig().config)
3820
+ // The accepted file's deprecations were collected at parse time, never
3821
+ // written there, so they reach this surface once per startup or adoption.
3822
+ const lines = [
3823
+ ...this.liveConfig.deprecations(),
3824
+ ...startupWarnings(this.currentConfig().config, this.wiring.forge),
3825
+ ]
3756
3826
  if (this.dashboard) {
3757
3827
  this.configWarnings = lines
3758
3828
  this.syncModelControls()
@@ -3762,6 +3832,24 @@ class DispatchLoop {
3762
3832
  }
3763
3833
  }
3764
3834
 
3835
+ /**
3836
+ * Deprecation guidance for a changed autobuild.toml that was not adopted
3837
+ * (rejected after parsing, or its publication failed). Labelled as pending
3838
+ * so it cannot be read as the accepted config's state. An empty list clears
3839
+ * the dashboard entry.
3840
+ */
3841
+ private reportCandidateDeprecations(lines: readonly string[]): void {
3842
+ this.candidateWarnings = lines.map(
3843
+ (line) => `${line} (pending autobuild.toml change, not yet adopted)`,
3844
+ )
3845
+ if (this.dashboard) {
3846
+ this.syncModelControls()
3847
+ this.paint()
3848
+ } else if (!this.presentationReleased && this.opts.silent !== true) {
3849
+ for (const line of this.candidateWarnings) this.opts.stderr(line)
3850
+ }
3851
+ }
3852
+
3765
3853
  private printReport(report: Awaited<ReturnType<Dispatcher['tick']>>, printIdle = true): boolean {
3766
3854
  // `queued` is a standing depth, not a tick action — the header owns it;
3767
3855
  // repeating it in the notice would make every saturated tick look busy.
@@ -3907,8 +3995,7 @@ class DispatchLoop {
3907
3995
  configSnapshot.config.tickets.source,
3908
3996
  ),
3909
3997
  ),
3910
- observationCount: this.observationCount,
3911
- observationLimit: configSnapshot.config.policy.harvestThreshold,
3998
+ ...(this.triageSampler?.value !== undefined ? { triage: this.triageSampler.value } : {}),
3912
3999
  },
3913
4000
  repositoryEvents,
3914
4001
  )
@@ -4522,8 +4609,9 @@ class DispatchLoop {
4522
4609
  break
4523
4610
  // Read-only policy supervision: never another tick or config fan-out.
4524
4611
  try {
4525
- const { loadConfig } = await import('../config/load')
4526
- const config = await loadConfig(join(this.opts.targetRepo, 'autobuild.toml'))
4612
+ // Deprecations were reported at startup/reload; this re-read stays quiet.
4613
+ const path = join(this.opts.targetRepo, 'autobuild.toml')
4614
+ const config = parseConfig(await Bun.file(path).text(), path, () => {})
4527
4615
  const { createRuntimeResolver } = await import('../ports/runner/routing')
4528
4616
  createRuntimeResolver(
4529
4617
  this.wiring.runtimes,
@@ -4625,7 +4713,7 @@ class DispatchLoop {
4625
4713
  this.upgradeController = new DispatchUpgradeController({
4626
4714
  run: this.runId,
4627
4715
  lineage: launch.lineage!,
4628
- from: RUNTIME_IDENTITY,
4716
+ from: runtimeIdentity(),
4629
4717
  runningBunTag: (await readDistributionIdentity(distributionRoot())).bunTag,
4630
4718
  reservationOwner: launch.launcherPid,
4631
4719
  resolved: upgrades.runs[this.runId]?.resolved,
@@ -4746,6 +4834,8 @@ class DispatchLoop {
4746
4834
  // lease and any provisioning state are released for the next
4747
4835
  // invocation.
4748
4836
  if (this.pastDeadline()) return
4837
+ // One background triage read before the single tick, never inside it.
4838
+ this.triageSampler?.poke()
4749
4839
  const initial = await this.dispatcherTick(true).catch(async (error: unknown) => {
4750
4840
  await this.reportTickFailure(error)
4751
4841
  throw error
@@ -4789,6 +4879,9 @@ class DispatchLoop {
4789
4879
  this.startRendering()
4790
4880
  this.startUpgradeChecks()
4791
4881
  let startup = true
4882
+ // Triage counts are sampled between ticks, never inside one: the read
4883
+ // runs in the background and the next publication carries its value.
4884
+ this.triageSampler?.poke()
4792
4885
  while (!this.watchStopped && !this.superseded) {
4793
4886
  let failed = false
4794
4887
  try {
@@ -4800,6 +4893,7 @@ class DispatchLoop {
4800
4893
  failed = true
4801
4894
  await this.reportTickFailure(error)
4802
4895
  }
4896
+ this.triageSampler?.poke()
4803
4897
  if (this.watchStopped || this.superseded) break
4804
4898
  await sleep(failed || this.pendingTickFailure ? Math.max(intervalMs, 1000) : intervalMs)
4805
4899
  }
@@ -4844,6 +4938,8 @@ async function fetchOriginModeConfig(
4844
4938
  ): Promise<{
4845
4939
  content: string
4846
4940
  config: Config
4941
+ /** Deprecation lines of the returned (startup) file, collected unwritten. */
4942
+ deprecations: readonly string[]
4847
4943
  }> {
4848
4944
  const repository = normalizeGitRemoteUrl(opts.repository!)
4849
4945
  const label = `${repository}/autobuild.toml`
@@ -4866,9 +4962,10 @@ async function fetchOriginModeConfig(
4866
4962
  }
4867
4963
  throw error
4868
4964
  })
4869
- const parsed = parseConfig(content, label)
4965
+ const deprecations: string[] = []
4966
+ const parsed = parseConfig(content, label, (line) => deprecations.push(line))
4870
4967
  if (parsed.baseBranch === undefined || parsed.baseBranch === '') {
4871
- return { content, config: parsed }
4968
+ return { content, config: parsed, deprecations }
4872
4969
  }
4873
4970
  const branchContent = await readFile
4874
4971
  .call(forge, 'autobuild.toml', parsed.baseBranch)
@@ -4882,7 +4979,9 @@ async function fetchOriginModeConfig(
4882
4979
  throw error
4883
4980
  })
4884
4981
  const branchLabel = `${label}@${parsed.baseBranch}`
4885
- return { content: branchContent, config: parseConfig(branchContent, branchLabel) }
4982
+ const branchDeprecations: string[] = []
4983
+ const config = parseConfig(branchContent, branchLabel, (line) => branchDeprecations.push(line))
4984
+ return { content: branchContent, config, deprecations: branchDeprecations }
4886
4985
  }
4887
4986
 
4888
4987
  /** Loopback hosts where a plain-http store origin is accepted: it names the
@@ -5003,9 +5102,9 @@ export async function abDispatch(opts: DispatchOpts): Promise<void> {
5003
5102
  },
5004
5103
  input: opts.input ?? { start: () => () => {} },
5005
5104
  ...(!interactive ? { plainOutput: opts.stdout } : {}),
5006
- ticketSource: async () =>
5007
- (
5008
- await openTicketSource(
5105
+ controlTickets: () =>
5106
+ lazyTicketSource(() =>
5107
+ openTicketSource(
5009
5108
  {
5010
5109
  targetRepo: state.checkout,
5011
5110
  exec: opts.exec,
@@ -5014,8 +5113,8 @@ export async function abDispatch(opts: DispatchOpts): Promise<void> {
5014
5113
  stdout: opts.stdout,
5015
5114
  },
5016
5115
  'ab merge',
5017
- )
5018
- ).source,
5116
+ ),
5117
+ ),
5019
5118
  once: opts.once === true,
5020
5119
  ...(opts.intervalMs !== undefined ? { intervalMs: opts.intervalMs } : {}),
5021
5120
  ...(opts.signal !== undefined ? { signal: opts.signal } : {}),
@@ -5100,9 +5199,9 @@ export async function abDispatch(opts: DispatchOpts): Promise<void> {
5100
5199
  checkout: state.checkout,
5101
5200
  storeRef: opened.storeRef,
5102
5201
  store: opened.store,
5103
- ticketSource: async () =>
5104
- (
5105
- await openTicketSource(
5202
+ controlTickets: () =>
5203
+ lazyTicketSource(() =>
5204
+ openTicketSource(
5106
5205
  {
5107
5206
  targetRepo: state.checkout,
5108
5207
  exec: resolvedOpts.exec,
@@ -5111,8 +5210,8 @@ export async function abDispatch(opts: DispatchOpts): Promise<void> {
5111
5210
  stdout: resolvedOpts.stdout,
5112
5211
  },
5113
5212
  'ab merge',
5114
- )
5115
- ).source,
5213
+ ),
5214
+ ),
5116
5215
  env: resolvedOpts.env,
5117
5216
  terminal: resolvedOpts.terminal,
5118
5217
  input: resolvedOpts.input,
@@ -5137,12 +5236,16 @@ export async function abDispatch(opts: DispatchOpts): Promise<void> {
5137
5236
  const configPath = join(resolvedOpts.targetRepo, 'autobuild.toml')
5138
5237
  let configContent: string
5139
5238
  let config: Config
5239
+ // Collected, never written at parse time: the dispatcher reports them once
5240
+ // with its other configuration notices (`reportRoleDiagnostics`).
5241
+ let startupDeprecations: readonly string[] = []
5140
5242
  if (opts.repository !== undefined) {
5141
5243
  // Origin mode startup config: the base branch's autobuild.toml, fetched
5142
5244
  // through the forge (default branch first — baseBranch itself is config).
5143
5245
  const fetched = originConfig!
5144
5246
  configContent = fetched.content
5145
5247
  config = fetched.config
5248
+ startupDeprecations = fetched.deprecations
5146
5249
  if (config.forge !== 'github') {
5147
5250
  throw new Error(
5148
5251
  `origin-mode dispatch requires the builtin github forge, but the fetched autobuild.toml selects ${JSON.stringify(config.forge)}`,
@@ -5170,7 +5273,9 @@ export async function abDispatch(opts: DispatchOpts): Promise<void> {
5170
5273
  } else {
5171
5274
  try {
5172
5275
  configContent = await Bun.file(configPath).text()
5173
- config = parseConfig(configContent, configPath)
5276
+ const deprecations: string[] = []
5277
+ config = parseConfig(configContent, configPath, (line) => deprecations.push(line))
5278
+ startupDeprecations = deprecations
5174
5279
  } catch (error) {
5175
5280
  if ((error as NodeJS.ErrnoException).code === 'ENOENT') {
5176
5281
  throw new Error(
@@ -5279,13 +5384,15 @@ export async function abDispatch(opts: DispatchOpts): Promise<void> {
5279
5384
  kind: effectiveArtifact.kind,
5280
5385
  rev: effectiveArtifact.revision,
5281
5386
  },
5282
- roleWarnings: roleKeyWarnings(effectiveConfig),
5387
+ roleWarnings: startupWarnings(effectiveConfig, wiring.forge),
5283
5388
  },
5284
5389
  }
5285
5390
  },
5286
5391
  )
5287
5392
  wiring.updateRuntimeReferences?.(effectiveConfig)
5288
5393
  },
5394
+ startupDeprecations,
5395
+ (next) => assertReadyAssigneeAccepted(next.tickets, wiring.tickets),
5289
5396
  )
5290
5397
 
5291
5398
  // Launch flags are durable repository setters. Omission writes nothing, so
@@ -5333,7 +5440,7 @@ export async function abDispatch(opts: DispatchOpts): Promise<void> {
5333
5440
  pid: process.pid,
5334
5441
  host: hostname(),
5335
5442
  effectiveConfig: { kind: artifact.kind, rev: artifact.revision },
5336
- roleWarnings: roleKeyWarnings(config),
5443
+ roleWarnings: startupWarnings(config, wiring.forge),
5337
5444
  },
5338
5445
  }
5339
5446
  },
@@ -5343,7 +5450,7 @@ export async function abDispatch(opts: DispatchOpts): Promise<void> {
5343
5450
  await view.appendRepo(state.repo, {
5344
5451
  actor: DISPATCHER,
5345
5452
  type: 'dispatcher.runtime-recorded',
5346
- payload: { run: runId, startedSeq: started.event.seq, runtime: RUNTIME_IDENTITY },
5453
+ payload: { run: runId, startedSeq: started.event.seq, runtime: runtimeIdentity() },
5347
5454
  })
5348
5455
 
5349
5456
  const loop = new DispatchLoop(liveConfig, wiring, resolvedOpts, view)
@@ -201,17 +201,17 @@ export const HELP_CATALOG: readonly HelpEntry[] = [
201
201
  detail: page([
202
202
  'Usage:',
203
203
  ' ab ticket tree [--json]',
204
- ' ab ticket create <title> --body <file> [--state <state>] [--labels a,b] [--blocked-by id,id] [--kind work|node] [--target <id> | --no-target] [--json]',
204
+ ' ab ticket create <title> --body <file> [--state <state>] [--labels a,b] [--blocked-by id,id] [--issues N[:refs],...] [--priority urgent|normal] [--kind work|node] [--target <id> | --no-target] [--json]',
205
205
  ' ab ticket edit <id>',
206
206
  ' ab ticket export <dir> [--store <ref>]',
207
- ' ab ticket import <dir> [--store <ref>]',
207
+ ' ab ticket import <dir> [--states <state,...>] [--store <ref>]',
208
208
  ' ab ticket migration record <dir> [--store <ref>]',
209
- ' ab ticket update <id> [--kind work|node] [--target <id> | --no-target] [--title <title>] [--body <file>] [--labels a,b] [--expected-revision <opaque>] [--json]',
209
+ ' ab ticket update <id> [--kind work|node] [--target <id> | --no-target] [--title <title>] [--body <file>] [--labels a,b] [--issues N[:refs],...] [--priority urgent|normal] [--expected-revision <opaque>] [--json]',
210
210
  ' ab ticket block <id> <blocker-id[,blocker-id...]> [--expected-revision <opaque>] [--json]',
211
211
  ' ab ticket unblock <id> <blocker-id[,blocker-id...]> [--expected-revision <opaque>] [--json]',
212
212
  ' ab ticket list [--state <state>] [--labels a,b] [--json]',
213
213
  ' ab ticket show <id> [--store <ref>] [--json]',
214
- ' ab ticket move <id> <state> [--expected-revision <opaque>] [--json]',
214
+ ' ab ticket move <id> (<state> | --role triage|ready|backlog|rejected) [--expected-revision <opaque>] [--json]',
215
215
  ' ab ticket states [--json]',
216
216
  ' ab ticket state create <name> [--about <text>] [--json]',
217
217
  ' ab ticket attach <id> <kind> <path> [--name <name>] [--store <ref>] [--json]',
@@ -220,7 +220,7 @@ export const HELP_CATALOG: readonly HelpEntry[] = [
220
220
  '',
221
221
  'Operate on the configured [tickets] source (§8.8); commands run outside sessions.',
222
222
  'Every JSON ticket read includes an opaque revision. update, move, block and',
223
- 'unblock accept --expected-revision to refuse stale writes. Linear refuses checks.',
223
+ 'unblock accept --expected-revision to refuse stale writes. Linear and GitHub refuse checks.',
224
224
  'edit opens VISUAL or EDITOR, checks the opening revision, and preserves failed buffers.',
225
225
  `create files a ticket and may establish initial blockers.
226
226
  --kind work|node declares a ticket's kind; work is the default. --target <id>
@@ -235,9 +235,18 @@ These fields describe intent; dispatch and merge behavior are unchanged.`,
235
235
  '"" clears labels, and update never changes state. block and unblock accept',
236
236
  'comma-separated blocker ids and are idempotent. Every id is validated before',
237
237
  'any relationship is written, so an invalid list leaves the ticket unchanged.',
238
+ '--issues records forge issues the ticket addresses: N (closes, the default)',
239
+ 'or N:refs for partial work, comma-separated. On update it replaces the set',
240
+ 'and --issues "" clears it. Sources that cannot store issue links refuse the',
241
+ 'write, name the source, and write nothing.',
242
+ '--priority urgent dispatches the ticket before normal ready work, each class',
243
+ 'in source order; it never preempts a running build. normal (the default)',
244
+ 'removes urgency. Sources that cannot store priority refuse urgent, name the',
245
+ 'source, and write nothing; normal is a no-op there.',
238
246
  '',
239
247
  'With no list filters, list uses the same ready criteria as dispatch. show one ticket, including its body/spec.',
240
- 'Human output is the default. --json emits exactly one bare value: Ticket[]',
248
+ 'Human output is the default and marks urgent tickets. --json emits exactly',
249
+ 'one bare value, and every JSON ticket names its priority: Ticket[]',
241
250
  'for list, the hierarchy for tree, and the resulting Ticket for ticket mutations; show',
242
251
  'adds an assets array (kind, name, revision, size, layout, fileCount).',
243
252
  '',
@@ -252,20 +261,31 @@ These fields describe intent; dispatch and merge behavior are unchanged.`,
252
261
  'its source naming the asset and how to download it. Assets over the store',
253
262
  'limit (25 MiB by default, lower on a hosted deployment) are refused.',
254
263
  '',
255
- 'states lists every state of the source: lifecycle states first (triage, ready,',
256
- 'doing, done), then custom ones alphabetically, each with the roles it plays',
257
- 'under the current config (create, ready, claimed, triage, proposal, done, or',
258
- 'none), its ticket count, and its purpose when set. --json emits one bare',
264
+ 'move --role triage|ready|backlog|rejected moves a ticket into a lifecycle',
265
+ 'role through the [tickets] names. backlog and rejected exist only when',
266
+ '[tickets].backlogState or rejectedState is set; otherwise the move is refused',
267
+ 'naming the key. A source that creates states creates the role state on first use.',
268
+ '',
269
+ 'states lists every state of the source: role-holding states in workflow order',
270
+ '(triage, create, proposal, backlog, ready, claimed, done, rejected), then the',
271
+ 'rest, each with the roles it plays under the current config (or none), its',
272
+ 'ticket count, and its purpose when set. --json emits one bare',
259
273
  'array of {name, roles, tickets, about?}. state create makes a state, e.g.',
260
- 'icebox, and is idempotent: an existing state is reported, and --about (one',
274
+ 'needs-design, and is idempotent: an existing state is reported, and --about (one',
261
275
  'line) records or replaces its purpose. A name is one to forty lowercase',
262
276
  'letters, digits, and hyphens, starting with a letter, and may not match an',
263
- 'existing state case-insensitively. There is no rename or delete. Only the file',
264
- 'source supports both; others exit nonzero naming the source. A state with no',
265
- 'purpose and no tickets is an empty directory that git does not track.',
266
- '',
267
- 'Ticket ids are source-local (for example AUT-8 or file-1). For block and',
268
- 'unblock, the first id is always the ticket being changed. State names and',
277
+ 'existing state case-insensitively. There is no rename or delete. The file,',
278
+ 'hosted and github sources support both; others exit nonzero naming the source.',
279
+ 'Hosted and github creation refuse an existing name instead of reporting it. A',
280
+ 'file state with no purpose and no tickets is an empty directory that git does',
281
+ 'not track.',
282
+ '',
283
+ 'export writes every ticket to a portable directory; import loads one into the',
284
+ 'configured source. import --states a,b imports only tickets in those states and',
285
+ 'refuses a selection that leaves behind a blocker, target or unfinished build.',
286
+ '',
287
+ 'Ticket ids are source-local (for example AUT-8, file-1 or GitHub issue 123). For',
288
+ 'block and unblock, the first id is always the ticket being changed. State names and',
269
289
  'unknown-id errors come from the configured source; ab ticket states lists them.',
270
290
  ]),
271
291
  },
@@ -386,7 +406,7 @@ These fields describe intent; dispatch and merge behavior are unchanged.`,
386
406
  'Consent and held ready merges use only build.consent-ready, once per readiness episode.',
387
407
  'Unready or stale consent candidates stay silent; one merge gate decision per build/PR.',
388
408
  'Repository: harvest.escalated, harvest.recovery-exhausted, dispatcher.config-rejected, dispatcher.forge-readiness-failed,',
389
- 'dispatcher.config-reloaded with restartRequired, abnormal dispatcher.run-stopped,',
409
+ 'dispatcher.kernel-git-unavailable, dispatcher.config-reloaded with restartRequired, abnormal dispatcher.run-stopped,',
390
410
  'and dispatcher.lost. dispatcher.ticket-source-persistent reports degradation past',
391
411
  'resetAt after a tick started at or after reset completes or fails while still degraded,',
392
412
  'or 15 minutes without a reset; dispatcher.tick-failure-persistent reports',
@@ -755,6 +775,22 @@ These fields describe intent; dispatch and merge behavior are unchanged.`,
755
775
  'build phase at any time and is not a terminal command.',
756
776
  ]),
757
777
  },
778
+ {
779
+ name: 'issue',
780
+ audience: 'ai',
781
+ summary: 'Downgrade a linked issue from closes to refs.',
782
+ detail: page([
783
+ 'Usage:',
784
+ ' ab issue downgrade <N> --reason <text>',
785
+ '',
786
+ 'Record that this build only partly resolves linked issue N, so its PR and',
787
+ 'landed commit write Refs #N instead of Closes #N. --reason is required and',
788
+ 'shows in build status. Downgrades are one-way: a refs link, an unlinked',
789
+ 'issue, or any upgrade is refused. Finalize seals the links before the PR is',
790
+ "opened; after that the command fails and you should use 'ab escalate'.",
791
+ 'This is not a terminal command.',
792
+ ]),
793
+ },
758
794
  {
759
795
  name: 'done',
760
796
  audience: 'ai',
@@ -788,14 +824,15 @@ These fields describe intent; dispatch and merge behavior are unchanged.`,
788
824
  {
789
825
  name: 'escalate',
790
826
  audience: 'ai',
791
- summary: 'Park the build with a question for a human.',
827
+ summary: 'Park the build with a question for external judgment.',
792
828
  detail: page([
793
829
  'Usage:',
794
830
  ' ab escalate <question> [--refs a,b]',
795
831
  '',
796
- 'Park the build for human input, optionally attaching comma-separated source',
797
- 'or artifact references. This is a terminal command. Every phase ends with',
798
- 'exactly one terminal command (D5).',
832
+ 'Park the build for external judgment, optionally attaching comma-separated',
833
+ 'source or artifact references. The operator agent or a human answers the',
834
+ 'question; a build-phase agent cannot answer its own escalation. This is a',
835
+ 'terminal command. Every phase ends with exactly one terminal command (D5).',
799
836
  ]),
800
837
  },
801
838
  {