@defrex/autobuild 1.12.0 → 1.14.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 (167) hide show
  1. package/README.md +1 -1
  2. package/SPEC.md +465 -163
  3. package/bin/ab-build-runner.ts +8 -0
  4. package/docs/answering-blocked-builds.md +28 -4
  5. package/docs/architecture.md +136 -53
  6. package/docs/cli.md +1 -1
  7. package/docs/configuration.md +120 -17
  8. package/docs/dispatcher.md +19 -8
  9. package/docs/integration-overview.md +1 -1
  10. package/docs/integration-tree.md +12 -9
  11. package/docs/merge-policy.md +7 -2
  12. package/docs/operating.md +13 -3
  13. package/docs/operator-api.md +46 -23
  14. package/docs/operator-surfaces.md +7 -6
  15. package/docs/optimization-nodes.md +7 -6
  16. package/docs/plugin-authoring.md +46 -18
  17. package/docs/remote-store-protocol.md +52 -13
  18. package/docs/remote-ticket-protocol.md +85 -38
  19. package/docs/restacking.md +48 -3
  20. package/docs/setup.md +2 -1
  21. package/docs/ticket-migration.md +2 -2
  22. package/docs/ticket-sources.md +23 -8
  23. package/docs/tickets.md +4 -4
  24. package/docs/troubleshooting.md +32 -2
  25. package/docs/verification.md +3 -1
  26. package/package.json +3 -3
  27. package/packages/core/src/cli/build-control.ts +72 -6
  28. package/packages/core/src/cli/dashboard/actions.ts +4 -0
  29. package/packages/core/src/cli/dashboard/integration-row.ts +43 -19
  30. package/packages/core/src/cli/dashboard/model.ts +14 -8
  31. package/packages/core/src/cli/dashboard/poll.ts +218 -10
  32. package/packages/core/src/cli/dashboard/queue.ts +21 -10
  33. package/packages/core/src/cli/dashboard/row-text.ts +2 -1
  34. package/packages/core/src/cli/dashboard/vocabulary.ts +5 -1
  35. package/packages/core/src/cli/dispatch-frontend.ts +2 -1
  36. package/packages/core/src/cli/dispatch-tickets.ts +33 -12
  37. package/packages/core/src/cli/dispatch.ts +547 -145
  38. package/packages/core/src/cli/help.ts +38 -24
  39. package/packages/core/src/cli/main.ts +7 -5
  40. package/packages/core/src/cli/publication-settlement.ts +4 -0
  41. package/packages/core/src/cli/remote-poll.ts +22 -5
  42. package/packages/core/src/cli/repository-status.ts +19 -9
  43. package/packages/core/src/cli/status.ts +23 -11
  44. package/packages/core/src/cli/store-opening.ts +12 -0
  45. package/packages/core/src/cli/ticket-start.ts +3 -3
  46. package/packages/core/src/cli/ticket.ts +12 -11
  47. package/packages/core/src/cli/wait.ts +8 -28
  48. package/packages/core/src/cli/watch.ts +113 -50
  49. package/packages/core/src/config/reference-metadata.ts +7 -1
  50. package/packages/core/src/config/reference.ts +5 -2
  51. package/packages/core/src/config/schema.ts +51 -16
  52. package/packages/core/src/events/payloads.ts +74 -14
  53. package/packages/core/src/events/policy.ts +1 -0
  54. package/packages/core/src/events/repository.ts +33 -3
  55. package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +31 -0
  56. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/be211f0e31a65006.json.gz +0 -0
  57. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/0a10010ee5cf2e47.json +577 -0
  58. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/227701361be6d1e0.json +490 -0
  59. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/312cc4090820a612.json +1078 -0
  60. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/76e5043bae7a80ab.json +86 -0
  61. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/87a917802870bbed.json +87 -0
  62. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/9d85616e5b9e24c1.json +500 -0
  63. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/a2780567b4989fb6.json +105 -0
  64. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/c7c94fbe7f63cf07.json +84 -0
  65. package/packages/core/src/kernel/clean-restack-policy.ts +40 -0
  66. package/packages/core/src/kernel/dispatch-capacity.ts +243 -107
  67. package/packages/core/src/kernel/done-escalations.ts +273 -0
  68. package/packages/core/src/kernel/engine.ts +28 -9
  69. package/packages/core/src/kernel/integration-landing.ts +24 -4
  70. package/packages/core/src/kernel/integration-stack.ts +39 -0
  71. package/packages/core/src/kernel/janitor-failure.ts +20 -1
  72. package/packages/core/src/kernel/log-index-value.ts +3 -0
  73. package/packages/core/src/kernel/log-index.ts +41 -2
  74. package/packages/core/src/kernel/open-pr-backpressure.ts +3 -3
  75. package/packages/core/src/kernel/reducer-registry.ts +3 -0
  76. package/packages/core/src/kernel/reducer-revisions.ts +19 -0
  77. package/packages/core/src/kernel/reducer.ts +42 -8
  78. package/packages/core/src/kernel/repository-attention.ts +14 -5
  79. package/packages/core/src/kernel/repository-read-facts.ts +9 -0
  80. package/packages/core/src/kernel/ticket-starts.ts +15 -4
  81. package/packages/core/src/kernel/verify-stages.ts +46 -7
  82. package/packages/core/src/operator/attention.ts +28 -3
  83. package/packages/core/src/operator/done-escalations.ts +38 -0
  84. package/packages/core/src/operator/presentation.ts +1 -1
  85. package/packages/core/src/operator/protocol.ts +8 -5
  86. package/packages/core/src/operator/query.ts +33 -19
  87. package/packages/core/src/operator/registry.ts +17 -13
  88. package/packages/core/src/operator/ticket-start.ts +8 -7
  89. package/packages/core/src/operator/tickets.ts +28 -9
  90. package/packages/core/src/plugin-sdk/index.ts +10 -0
  91. package/packages/core/src/plugins/manifest.ts +14 -1
  92. package/packages/core/src/ports/forge/create.ts +8 -0
  93. package/packages/core/src/ports/forge/github-transport.ts +5 -1
  94. package/packages/core/src/ports/forge/github.ts +3 -0
  95. package/packages/core/src/ports/tickets/contract.ts +147 -76
  96. package/packages/core/src/ports/tickets/create.ts +47 -7
  97. package/packages/core/src/ports/tickets/fake.ts +8 -4
  98. package/packages/core/src/ports/tickets/file-codec.ts +4 -3
  99. package/packages/core/src/ports/tickets/file.ts +7 -3
  100. package/packages/core/src/ports/tickets/github.ts +1 -0
  101. package/packages/core/src/ports/tickets/grants.ts +11 -3
  102. package/packages/core/src/ports/tickets/hosted-index.ts +5 -0
  103. package/packages/core/src/ports/tickets/linear.ts +28 -9
  104. package/packages/core/src/ports/tickets/migration.ts +4 -4
  105. package/packages/core/src/ports/tickets/operations.ts +4 -2
  106. package/packages/core/src/ports/tickets/priority-labels.ts +213 -0
  107. package/packages/core/src/ports/tickets/priority.ts +127 -21
  108. package/packages/core/src/ports/tickets/remote-protocol.ts +10 -0
  109. package/packages/core/src/ports/tickets/remote.ts +104 -11
  110. package/packages/core/src/ports/tickets/revision.ts +5 -3
  111. package/packages/core/src/ports/tickets/search.ts +9 -0
  112. package/packages/core/src/ports/tickets/tree.ts +8 -6
  113. package/packages/core/src/ports/types.ts +30 -15
  114. package/packages/core/src/ports/workspace/build-execution.ts +13 -1
  115. package/packages/core/src/ports/workspace/builtin-capabilities.ts +4 -0
  116. package/packages/core/src/ports/workspace/create.ts +16 -3
  117. package/packages/core/src/ports/workspace/execution-exit-marker.ts +41 -0
  118. package/packages/core/src/ports/workspace/recovery-step.ts +101 -0
  119. package/packages/core/src/ports/workspace/vercel-sandbox.ts +596 -144
  120. package/packages/core/src/processes/build-execution-state.ts +4 -0
  121. package/packages/core/src/processes/build-runner.ts +14 -1
  122. package/packages/core/src/processes/dispatcher.ts +841 -230
  123. package/packages/core/src/processes/execution-settlement.ts +25 -3
  124. package/packages/core/src/processes/harvest-runner.ts +12 -7
  125. package/packages/core/src/processes/infrastructure-failure-budget.ts +7 -2
  126. package/packages/core/src/processes/invocation-budget.ts +176 -0
  127. package/packages/core/src/processes/publication-loss.ts +38 -3
  128. package/packages/core/src/processes/tick-publication.ts +1 -0
  129. package/packages/core/src/processes/workspace-preservation.ts +86 -15
  130. package/packages/core/src/store/contract.ts +88 -3
  131. package/packages/core/src/store/event-reads.ts +30 -1
  132. package/packages/core/src/store/reduced-reads.ts +23 -0
  133. package/packages/core/src/store/reducer-value-shapes.json +6759 -6490
  134. package/packages/core/src/store/reducer-value-validation.ts +188 -33
  135. package/packages/core/src/store/remote/client.ts +169 -29
  136. package/packages/core/src/store/remote/compatibility.ts +113 -56
  137. package/packages/core/src/store/remote/credentials.ts +4 -1
  138. package/packages/core/src/store/remote/protocol.ts +3 -0
  139. package/packages/core/src/store/remote/released-clients.json +22 -0
  140. package/packages/core/src/store/remote/released-reducer-values/1.13.0.json +35966 -0
  141. package/packages/core/src/store/remote/released-reducer-values/1.14.0.json +36076 -0
  142. package/packages/core/src/store/remote/released-reducer-values/index.ts +20 -16
  143. package/packages/core/src/store/remote/released-value-policy.ts +144 -0
  144. package/packages/core/src/store/remote/retry.ts +406 -0
  145. package/packages/core/src/store/repo-state-events.ts +1 -0
  146. package/packages/core/src/testing/dispatch-read-budget.ts +155 -11
  147. package/packages/core/src/testing/index.ts +2 -0
  148. package/packages/core/src/testing/invocation-budget.ts +42 -0
  149. package/packages/core/src/testing/reduced-read-budget.ts +589 -19
  150. package/packages/core/src/testing/released-value-coverage.ts +423 -0
  151. package/packages/core/src/web/overview-source.ts +19 -6
  152. package/skills/guide/SKILL.md +147 -67
  153. package/skills/guide/references/integration-tree.md +12 -9
  154. package/skills/guide/references/merge-policy.md +7 -2
  155. package/skills/guide/references/operator-api.md +46 -23
  156. package/skills/guide/references/optimization-nodes.md +7 -6
  157. package/skills/guide/references/plugin-authoring.md +46 -18
  158. package/skills/guide/references/remote-store-protocol.md +52 -13
  159. package/skills/guide/references/remote-ticket-protocol.md +85 -38
  160. package/skills/guide/references/restacking.md +48 -3
  161. package/skills/guide/references/setup.md +2 -1
  162. package/skills/guide/references/ticket-migration.md +2 -2
  163. package/skills/operate/SKILL.md +136 -55
  164. package/skills/plan/SKILL.md +4 -3
  165. package/skills/spec/SKILL.md +9 -5
  166. package/skills/tickets/SKILL.md +25 -17
  167. package/templates/hosted-service/package.json +2 -2
@@ -122,7 +122,7 @@ record calls for action. It reports failed node verification, build escalations,
122
122
  harvest escalations/recovery exhaustion, automatic upgrade failures and runtime rollbacks, rejected configuration, reloads needing
123
123
  restart, abnormal dispatcher stops/loss, abandoned ticket preparations, ticket hand-backs (`ticket.handed-back`), single-ticket start settlements (`ticket.start-settled`), ticket-source and forge degradation past reset (15 minutes
124
124
  for ticket sources without reset), forge rate limits outside the dispatcher's credential
125
- (`forge.credential-limited`), configured hook failures and skips (`hook.*`), and five minutes of continuous tick failures. Advertised resets
125
+ (`forge.credential-limited`), configured hook failures and skips (`hook.*`), and five minutes of continuous tick failures across consecutive runs, including one-tick hosted runs. Remote store and hosted ticket requests retry transient unavailability briefly; a blip that outlasts the retries, including in hosted ticket policy sync, fails that tick without an abnormal stop. Advertised resets
126
126
  wait for a post-reset tick to finish before requiring action; ordinary recovery
127
127
  on that retry stays silent. Source grace and cooldown-driven failures do not
128
128
  start the tick-failure clock. When failure writes are unavailable, dispatch watch
@@ -152,8 +152,12 @@ registration identity. A separate unflagged diagnostic watch or wait must never
152
152
  replace the standing monitor or supply its resume cursor.
153
153
  Named diagnostic watches end when all named builds
154
154
  are terminal; add `--repository` for repository attention. With no slugs all
155
- active builds and repository attention are included. Reconcile status after
156
- arming because historical build attention is silently baselined.
155
+ active builds and repository attention are included. Once a build is terminal
156
+ and settled (no pending cleanup, reclaim, open execution or integration audit),
157
+ the watch delivers its events through settlement, then retires it from tracking
158
+ and later cursors, so re-arming never accumulates finished builds; named builds
159
+ are never retired. Reconcile status after arming because historical build
160
+ attention is silently baselined.
157
161
 
158
162
  Add an extra monitor only for an identified need, such as a human asking
159
163
  to hear when a particular build merges or an outcome triggering follow-up work.
@@ -204,6 +208,12 @@ including inside background shells and harness monitors. Do not rely on a
204
208
  shell alias or function that those facilities may lose. Never block a
205
209
  foreground command for their whole duration.
206
210
 
211
+ A watch or wait that exits 1 with `incompatible reducer …` means this CLI and
212
+ the service disagree on a reduced value. Retrying cannot fix it, so do not
213
+ re-arm in a loop. Align them, service first and then the project's Autobuild,
214
+ or run the CLI that matches the service, then re-arm. If you cannot align them,
215
+ report it to the human.
216
+
207
217
  Ticket-source degradation records mean dispatch intake cannot evaluate the source;
208
218
  existing builds may still advance. Inspect `ab repository status --json` for the
209
219
  active cause, operation, message, and expected reset. Reset times are advisory;
@@ -272,8 +282,9 @@ that appear after you arm. Finishing the initially queued set is no reason to st
272
282
  3. Handle each attention record using the shared rules. Repository records have
273
283
  no build slug: inspect repository status. Re-arm from the standing watch's
274
284
  latest cursor, including its trailing cursor after a timeout or count exit.
275
- 4. Report each merged, closed or aborted outcome and file or move tickets when
276
- warranted. A conflict or escalation requires action. Keep the standing watch
285
+ 4. Report each merged, closed or aborted outcome, ending each report as *Keep
286
+ what waits on the human in view* requires, and file or move tickets when
287
+ warranted. An escalation requires action. Keep the standing watch
277
288
  alive and keep discovering work until the human ends or hands off the role.
278
289
 
279
290
  Use `ab wait` and named unflagged watches only as separate diagnostics. They
@@ -296,7 +307,7 @@ is not exposed there, and its
296
307
  and `wait` carries `state` and `tickets`.
297
308
  The `SLOT` column (`slot` in `--json`) says whether the build holds a slot,
298
309
  has requested one (`resume`, `reconcile`, `verification`, `reopen` or
299
- `propose`, maybe urgent) or holds none, by the rules the dispatcher admits
310
+ `propose`, maybe with its `urgent`, `high` or `low` level) or holds none, by the rules the dispatcher admits
300
311
  work by. `unknown`, or no `slot`, means an older server; never read it as none.
301
312
  - `ab build status <slug> [--events N]` — one build's detail, its `slot:` line
302
313
  (`slot` in JSON), chronological runner attaches with runtime identity, and
@@ -332,10 +343,12 @@ Read events with a cursor or a small `--events` count; logs are long.
332
343
  ticket wait's escalation ends the wait early; the dispatcher ends it when its
333
344
  tickets complete (see ticket wait attention). A blocked build holds no slot
334
345
  once nothing is still working on it, and an answer does not give it one: it
335
- waits as a `resume` request ahead of normal ticket claims (urgent work
336
- first) until a slot frees. A build whose other verify steps, launch or
337
- execution still run keeps its slot through the answer and requests nothing. Run
338
- `ab help answer` for the full menu.
346
+ waits as a `resume` request ahead of ticket claims at its level (higher
347
+ levels first) until a slot frees. A build whose other verify steps, launch or
348
+ execution still run keeps its slot through the answer and requests nothing.
349
+ On a done build it only acknowledges open escalations (for example, a
350
+ post-landing integration audit), leaving the build done; other forms are
351
+ refused. Run `ab help answer` for the full menu.
339
352
  - `ab pause <slug>` / `ab resume <slug>`; `ab pause --all` / `ab resume --all`
340
353
  hold and release the whole repository. Pause immediately interrupts live agent
341
354
  sessions and acknowledges after they stop. Resume continues the same native
@@ -343,7 +356,7 @@ Read events with a cursor or a small `--events` count; logs are long.
343
356
  reason recorded in session.resume-fallback. Without a live agent (including
344
357
  check-only verify), pause still takes effect at the next boundary. A paused
345
358
  build holds no slot once the pause is acknowledged; resumed, it waits for a
346
- slot ahead of normal ticket claims like an answered build.
359
+ slot ahead of ticket claims at its level like an answered build.
347
360
  - `ab abort <slug> [--to triage|ready] [--reason <text>]` — destructive:
348
361
  closes the PR, removes branches, and hands the ticket back to triage by
349
362
  default. To send back a build that waits on other work, use
@@ -352,7 +365,10 @@ Read events with a cursor or a small `--events` count; logs are long.
352
365
  longer conforms to the spec standard falls back to triage, and the comment
353
366
  lists what is missing. `--reason` is quoted in the hand-back comment.
354
367
  Cleanup is asynchronous: act on the `ticket.handed-back` repository event,
355
- not on `build.aborted` or the build leaving `ab builds`. Aborting an
368
+ not on `build.aborted` or the build leaving `ab builds`. Abort closes the
369
+ build's open escalations; do not acknowledge them afterwards. Only an
370
+ escalation raised after the abort (a cleanup failure) needs an answer.
371
+ Aborting an
356
372
  optimization attempt is different: it settles `aborted` and its node moves the
357
373
  ticket to the rejected role, so no hand-back is reported and `--to` has no
358
374
  effect.
@@ -369,13 +385,14 @@ Read events with a cursor or a small `--events` count; logs are long.
369
385
  blocked one), merged or closed PRs (file a new ticket), and pending abort or
370
386
  discard. Re-run `ab reopen` with the same arguments after an interrupted spec
371
387
  reopen; it completes the recorded one.
372
- - `ab start <ticket-id> [--priority manual|urgent|normal] [--cancel]` — ask
388
+ - `ab start <ticket-id> [--priority manual|urgent|high|normal|low] [--cancel]` — ask
373
389
  the running dispatcher to claim one ticket on its next tick with a free slot,
374
390
  even while intake is off or open-PR backpressure is engaged, and no other.
375
- The default `manual` priority goes ahead of all waiting work, urgent included;
376
- choose `urgent` when urgent waiting builds should still go first (the build
377
- is then urgent), or `normal` when the ticket should wait behind normal
378
- waiting builds and urgent tickets. Repeating it with another priority
391
+ The default `manual` priority goes ahead of all waiting work, urgent included,
392
+ and the build takes its ticket's level. Choose a level (`urgent`, `high`,
393
+ `normal` or `low`) when waiting builds at that level or above, and
394
+ higher-level tickets, should still go first; the build then takes that
395
+ level. Repeating it with another priority
379
396
  updates the pending request. Use it to work a backlog one ticket at a time, or to run a single fix,
380
397
  instead of turning intake on or moving other tickets out of ready. Every gate
381
398
  still applies (ready state, spec standard, resolved blockers, no active
@@ -433,27 +450,30 @@ filed from a forge issue carries it with `--issues N` (`closes`), or
433
450
  ticket into the ready state sends it to dispatch — do that only when the
434
451
  ticket genuinely conforms and the human's intent is clear.
435
452
 
436
- The dispatcher claims urgent ready tickets before normal ones, each in source
437
- order, and ahead of normal builds waiting for a slot to re-verify, reconcile or
438
- resume. To expedite a ticket, such as a fix for a stuck build, mark it urgent
439
- with `--priority urgent` on create or update; never move other ready tickets
440
- out of ready to make room. A claimed ticket's priority becomes its build's,
441
- except that an optimization node's attempts claim at the node's current
442
- priority; a claimed attempt keeps its own.
453
+ Ticket priority is `urgent`, `high`, `normal` (the default) or `low`. The
454
+ dispatcher claims ready tickets by level, urgent first and low last, each
455
+ level in source order and ahead of lower-level builds waiting for a slot to
456
+ re-verify, reconcile or resume. To expedite a ticket, such as a fix for a
457
+ stuck build, mark it `urgent` (an emergency) or `high` (ahead of routine work)
458
+ with `--priority` on create or update; mark background work `low`. Never move
459
+ other ready tickets out of ready to make room. A build takes its ticket's
460
+ level, except that an optimization node's attempts claim at the node's
461
+ current level; a claimed attempt keeps its own.
443
462
  To expedite a build that already exists — a waiting reconcile or re-verify
444
- that now blocks other work — run `ab priority <slug> urgent` (MCP:
463
+ that now blocks other work — run `ab priority <slug> urgent` or `high` (MCP:
445
464
  `builds.control` with action `priority` and `priority: "urgent"`); `normal`
446
- returns it to normal order. Free slots go to `manual` start requests, urgent
447
- waiting work, urgent tickets (urgent start requests first), normal waiting
448
- work, then normal tickets (normal start requests first); an `ab start`
449
- request goes ahead per its tier. Urgency never preempts a
450
- running build, and a blocked urgent ticket still waits on its blockers. A
451
- source that cannot store priority refuses `urgent` and names itself; tell the
452
- human.
465
+ returns it to normal order and `low` defers it. Free slots go to `manual`
466
+ start requests, then for each level from urgent to low, that level's waiting
467
+ work, then its start requests and ready tickets; an `ab start` request goes
468
+ ahead per its tier. Priority never preempts a running build, and a blocked
469
+ ticket still waits on its blockers. A
470
+ priority refusal comes only from a hosted service too old to store the
471
+ level; tell the human.
453
472
 
454
473
  When ready tickets sit unclaimed with free slots, check
455
474
  `capacity.backpressure` in `ab repository status --json`. While `active` is
456
- true, `[policy].maxOpenPrs` open-PR backpressure is pausing normal claims
475
+ true, `[policy].maxOpenPrs` open-PR backpressure is pausing claims of
476
+ `high`, `normal` and `low` tickets
457
477
  until the open root PR count drains to `resumeOpenPrs` (below `maxOpenPrs`
458
478
  when the two are equal); urgent tickets still dispatch. Relieve it by getting PRs merged or closed (or, where the repository
459
479
  sets `excludeHeldOpenPrs`, by holding them), not by raising `capacity`.
@@ -547,11 +567,14 @@ external harness belongs to that harness. Protocol session approval answers are
547
567
  ### Each round
548
568
 
549
569
  Begin every operator round with `repository.attention`. One call returns
550
- everything waiting on you: blocked builds with their open escalation questions,
570
+ everything waiting on the operator: blocked builds with their open escalation questions
571
+ (including done builds with an open escalation, which `builds.answer`
572
+ acknowledges while the build stays done),
551
573
  merges awaiting consent or held, repository attention events after your cursor,
552
574
  builds paused, stalled or failing verification, and dispatcher attention. Each
553
575
  item's `resolve` names the tool call that acts on it, primary first; `by:
554
- "human"` marks a condition you report rather than fix. Act on each item, then
576
+ "human"` marks a condition you report rather than fix; carry it in the Waiting
577
+ on you section (see *Shared rules*). Act on each item, then
555
578
  pass back `events.cursor` next round. Omit the cursor on the first call to get
556
579
  a baseline; on `code: "cursor-too-old"`, call again without one.
557
580
 
@@ -595,7 +618,9 @@ that does the job, and say what you are doing before you do it:
595
618
  verifies; leaves require an escalation and restart from plan after any unfinished reconcile
596
619
  resumes under the revised spec and its publication is confirmed. Answering a
597
620
  ticket wait's escalation ends the wait early; the dispatcher ends it when its
598
- tickets complete.
621
+ tickets complete. On a done build it only acknowledges open escalations
622
+ (guidance or retry, for example a post-landing integration audit), leaving the
623
+ build done; other resolutions are refused.
599
624
  - `builds.reopen` — send a finished, unmerged leaf back with `feedback`, a spec
600
625
  `revision` (`{origin: "body" | "ticket", body}`, destructive — it replaces the
601
626
  spec), or both, exactly as `ab reopen` does. Feedback returns to implement; a
@@ -610,14 +635,16 @@ that does the job, and say what you are doing before you do it:
610
635
  - `tickets.create` — file a new ticket from a conversation. A ticket filed
611
636
  from a forge issue carries it in `issueLinks` as `{issue}` (intent `closes`,
612
637
  the default) or `{issue, intent: "refs"}` when the work only partly
613
- addresses it. `priority: "urgent"` dispatches it before normal ready work
614
- and normal waiting builds. Its `labels` are unioned with the repository's
638
+ addresses it. `priority` is `urgent`, `high`, `normal` (the default) or
639
+ `low`; ready work dispatches by level, urgent first, each level ahead of
640
+ lower-level waiting builds. Its `labels` are unioned with the repository's
615
641
  `[tickets].createLabels`, and harvest proposals carry them too.
616
642
  - `tickets.update`, `tickets.block`, `tickets.unblock` — edit fields and
617
643
  blocker relations. `issueLinks` on update replaces the whole set;
618
- `priority` (`urgent` or `normal`) expedites a ticket instead of moving other
619
- ready tickets aside, and a source that cannot store it refuses `urgent` with
620
- `code: "priority-unsupported"`.
644
+ `priority` (`urgent`, `high`, `normal` or `low`; omitted leaves it alone)
645
+ expedites a ticket instead of moving other ready tickets aside. Any other
646
+ value is refused. `code: "priority-unsupported"` comes only from a hosted
647
+ service, or a raw source, that cannot store the level.
621
648
  - `tickets.move` — move a ticket between workflow states, by native `state`
622
649
  or by lifecycle `role` (`triage`, `ready`, `backlog`, `rejected`; give
623
650
  exactly one). Use `role` for deferring and declining work, with the same
@@ -626,7 +653,7 @@ that does the job, and say what you are doing before you do it:
626
653
  genuinely conforms and the human's intent is clear.
627
654
  - `tickets.start` — ask the running dispatcher to start one ticket even while
628
655
  intake is off, as `ab start` does, with optional `priority` (`manual` by
629
- default, `urgent` or `normal`, chosen as for `ab start`); `cancel: true`
656
+ default, or `urgent`, `high`, `normal` or `low`, chosen as for `ab start`); `cancel: true`
630
657
  withdraws a pending request. The outcome arrives as `ticket.start-settled` in `repository.events`.
631
658
  - `tickets.asset.attach`, `tickets.asset.get`, `tickets.asset.remove` — attach,
632
659
  read and remove ticket assets with base64 bytes, as `ab ticket attach`,
@@ -722,9 +749,9 @@ Treat every default-watch record as a call to act:
722
749
  dispatcher.
723
750
  - Dispatcher loss, abnormal stop, restart-required reload, rejected config, or
724
751
  persistent tick failure: diagnose through repository status and report the
725
- condition to the human. Repository read failures fail the watch tick and
726
- retry on the next tick, using the existing five-minute persistent-failure
727
- attention. For validation failures, inspect the stored tick error for reducer,
752
+ condition to the human. Repository read failures and exhausted transient
753
+ store or ticket-service failures fail the tick and retry on the next tick,
754
+ using the existing five-minute persistent-failure attention. For validation failures, inspect the stored tick error for reducer,
728
755
  scope, cursor, field path, and running version/commit. Follow the ownership rules below before considering a new dispatcher.
729
756
  - Persistent source degradation: inspect the source cause and reset evidence,
730
757
  diagnose and report the continuing intake problem.
@@ -779,7 +806,9 @@ or a human decision is required.
779
806
 
780
807
  ### When to escalate instead of act
781
808
 
782
- Stop and ask the human — in plain streamed text — whenever:
809
+ Don't act; ask the human — in plain streamed text — and keep operating
810
+ everything else. Carry the question in the Waiting on you section (below)
811
+ until it is answered. Ask whenever:
783
812
 
784
813
  - The action is destructive and not clearly instructed (`abort`, `discard`,
785
814
  a bulk control, a repository-wide setting).
@@ -796,6 +825,44 @@ Filing a ticket is acting — do it when the request is concrete. Default to
796
825
  resolving attention yourself within these boundaries; ask the human only
797
826
  for the exceptions above.
798
827
 
828
+ ### Keep what waits on the human in view
829
+
830
+ This rule applies only to the agent that currently holds the operator role:
831
+ one that has taken the role and runs the standing operator watch, or, as a
832
+ connected agent, operates `repository.attention` rounds. It does not apply to
833
+ an agent that reads this skill to answer a one-off question, or to any other
834
+ role or session.
835
+
836
+ You keep working while the human is away, and each later message pushes an
837
+ earlier request out of view. So while anything waits on a human, every message
838
+ you send that reports status ends with a **Waiting on you** section: round
839
+ summaries, outcome reports (merged, closed, aborted) and replies to the human
840
+ alike. This holds the same way on the local CLI and as a connected agent.
841
+
842
+ What belongs in it:
843
+
844
+ - An escalation or decision only the human can make, including every case
845
+ under *When to escalate instead of act*.
846
+ - A merge waiting for the human's consent under the repository's merge policy
847
+ (`ab merges` locally, `merges.list` over MCP).
848
+ - A question you have put to the human.
849
+ - Attention you must report rather than fix: items marked `by: "human"` in
850
+ `repository.attention`, a merge only the human can perform on the forge, a
851
+ missing credential, or a dispatcher restart only a maintainer may perform.
852
+
853
+ Restate each item in full, so the human can act on the latest message alone:
854
+ the ticket and build, what is needed, the options, and your recommendation.
855
+ "See above" or any other pointer to an earlier message does not count.
856
+
857
+ Before you restate an item, confirm it is still open against current state:
858
+ the build's status (`ab build status <slug> --json`, `builds.get` over MCP),
859
+ pending merges (`ab merges`, `merges.list`), and the escalation itself. Never
860
+ repeat an item from memory.
861
+
862
+ Drop an item once it is resolved or no longer needs the human. When nothing
863
+ waits, end the message with one line saying so, such as
864
+ `Waiting on you: nothing.`
865
+
799
866
  ### Boundaries
800
867
 
801
868
  - Automatic generation handoff is product behavior, not agent process authority.
@@ -867,10 +934,10 @@ verification receipts and node children/completeness. Unknown completeness is
867
934
  not zero children. A changed head or parent must regain current verification;
868
935
  unfinished or automatically authorized candidates do not ask for attention.
869
936
  Queued and held candidates hold no capacity slot; one that must re-verify or
870
- reconcile waits for a slot ahead of normal ticket claims (urgent work first), so
937
+ reconcile waits for a slot ahead of ticket claims at its level (higher levels first), so
871
938
  a full repository delays it without failing it. A build waiting on other
872
939
  tickets, paused, or blocked on a question with nothing still working on it
873
- holds no slot either, and takes one ahead of normal claims once its wait ends.
940
+ holds no slot either, and takes one ahead of claims at its level once its wait ends.
874
941
 
875
942
  Select a queue build in the terminal and use `l merge` or `o hold`, or run
876
943
  `ab merge <slug>` / `ab hold <slug>`. MCP uses `builds.control` with action `merge`
@@ -888,18 +955,22 @@ the rejected role no longer does. When integration
888
955
  verification fails, file a repair child targeting that node and let it merge
889
956
  before retrying the node cycle.
890
957
 
891
- Watch for decisions and conflicts with `ab watch --operator --json`; save its opaque cursor
958
+ Watch for decisions and escalations with `ab watch --operator --json`; save its opaque cursor
892
959
  and resume with `ab watch --operator --since <watch-cursor> --json`. On
893
960
  `cursor-too-old`, re-arm without `--since`, reconcile status and acknowledge the
894
961
  unavailable historical gap. Default attention includes
895
- failed node verification (`integration.verification-failed`), node merges, node item conflicts, conflicted leaf replays, revoked protected consent (`landing.consent-revoked`), failing forge CI on a finished leaf (`pr.checks-failed`), optimization noise above ε (`optimization.noise-exceeded`) and derived
962
+ failed node verification (`integration.verification-failed`), node merges, revoked protected consent (`landing.consent-revoked`), failing forge CI on a finished leaf (`pr.checks-failed`), optimization noise above ε (`optimization.noise-exceeded`) and derived
896
963
  `build.consent-ready` observations, including already-ready merges on first
897
964
  repository-wide discovery. Readiness is identified by its durable
898
965
  entry position: resuming suppresses the same episode, while a new candidate or
899
966
  exit/re-entry can notify again. Explicit `--event` globs remain event-only.
967
+ Routine restack conflicts (node item conflicts, conflicted leaf replays) are
968
+ resolved automatically and stay silent; an unresolvable one arrives as an
969
+ escalation or `landing.consent-revoked`. Follow them explicitly with
970
+ `--event restack.replayed` or `--event node.item-conflicted`.
900
971
  Use `ab wait --for consent --for node-merged --for restack-conflicted --json`
901
972
  for one wake; state waits return immediately when already satisfied. `--for
902
- attention` also includes current failed node verification, consent readiness, janitor failure attention, an open janitor escalation and merge/conflict attention.
973
+ attention` also includes current failed node verification, consent readiness, janitor failure attention, an open janitor escalation and merge attention.
903
974
  Resume event backlogs with `--since <cursor>`; keep handling emitted records
904
975
  before interpreting terminal completion.
905
976
 
@@ -926,7 +997,7 @@ first tick after every named ticket completes, with no answer needed, and a
926
997
  wait with some tickets still open stays in place. Answer sooner only when the
927
998
  needed work landed another way or the wait is mistaken; any answer ends the
928
999
  wait early. Either way the build then waits as a `resume` request and takes a
929
- slot ahead of normal ticket claims (urgent work first). If its target moved, it first restacks onto the
1000
+ slot ahead of ticket claims at its level (higher levels first). If its target moved, it first restacks onto the
930
1001
  target's current head, so the resumed phase sees the merged blockers;
931
1002
  `ab build status` shows a `restack:` line with trigger `wait-resume`, and a
932
1003
  conflicting restack shows as `reconcile` before the phase resumes (a conflict
@@ -1012,9 +1083,9 @@ when to stop, and landing the result.
1012
1083
  The dispatcher applies the change on its next tick, with no replanning and
1013
1084
  running attempts untouched. Lowering the threshold to the current value, or a
1014
1085
  budget to what is already spent, stops the node on that tick.
1015
- - **Speed up its attempts** with `ab priority <node> urgent`: attempts claimed
1016
- afterwards take the urgent tier. No slot is reserved and nothing running is
1017
- preempted; attempts already claimed keep their priority.
1086
+ - **Speed up or defer its attempts** with `ab priority <node> urgent|high|normal|low`:
1087
+ attempts claimed afterwards take that level. No slot is reserved and nothing
1088
+ running is preempted; attempts already claimed keep their level.
1018
1089
  - **Stop it** with `ab objective <node> --stop` to take the progress so far.
1019
1090
  Without a flag the objective's stop mode applies, `abort` unless the objective
1020
1091
  says otherwise. `--stop --abort` cancels queued attempts and aborts running
@@ -1054,6 +1125,16 @@ required by proven history. This reconstruction consumes no infrastructure
1054
1125
  attempt and no additional conflict occurrence; it needs no operator guidance.
1055
1126
  A bare retry also clears an existing infrastructure-limit escalation through
1056
1127
  ordinary retry semantics. Unavailable inspection defers rather than proving loss.
1128
+ An infrastructure-limit escalation that says `at step resume` usually means a
1129
+ slow cold resume of a stopped sandbox: retry, or suggest raising
1130
+ `recoveryTimeoutMs` within the hosted invocation budget. `at step fence` or
1131
+ `at step cleanup` points at sandbox or provider state worth checking before a
1132
+ retry; `at step preserve` at the checkout, forge credentials or branch.
1133
+ A dispatch log line `build X: resume deferred by the invocation budget` (or
1134
+ `provision deferred`), counted as `recoveryDeferred` or `provisioningDeferred`,
1135
+ is normal: nothing is charged and the next invocation runs that build first.
1136
+ The same build deferring across several invocations means the hosted budget
1137
+ cannot fit that work: report it, and do not retry it.
1057
1138
 
1058
1139
  Leaf restack and reconcile publication retry classified transient forge or transport
1059
1140
  failures six times after the initial attempt, waiting 30, 60, 120, 240, 300 and
@@ -124,9 +124,10 @@ verdict.
124
124
  If the approved selection later names any step absent from the cycle's pinned
125
125
  configured universe, the entire selection falls back to all configured optional
126
126
  steps. The kernel records one observation per cycle and plan revision naming
127
- the unknown steps. Mandatory steps, path applicability and post-reconcile policy
128
- still apply. A valid selection continues to skip genuinely omitted optional
129
- steps. Strict validation when depositing a new plan is unchanged.
127
+ the unknown steps. Mandatory steps, path applicability and post-reconcile and
128
+ clean-restack policies still apply. A valid selection continues to skip
129
+ genuinely omitted optional steps. Strict validation when depositing a new plan
130
+ is unchanged.
130
131
 
131
132
  ## What a plan contains
132
133
 
@@ -164,15 +164,19 @@ keep the Evidence citation.
164
164
 
165
165
  When grooming established that the ticket must go next — for example a fix
166
166
  that unblocks a stuck build — create it with `--priority urgent` so the
167
- dispatcher claims it before normal ready work and normal waiting builds, and
168
- claims it even while open-PR backpressure pauses normal intake. Otherwise omit
169
- the flag; normal is the default. A source that cannot store priority refuses
170
- the create and names itself; file it normal and tell the human so the operator can expedite it.
167
+ dispatcher claims it before all other ready work and lower-level waiting
168
+ builds, and claims it even while open-PR backpressure pauses other intake.
169
+ When grooming ranked it more or less important than routine work, use
170
+ `--priority high` (claimed ahead of routine work, without urgent's
171
+ backpressure bypass) or `--priority low` (claimed only when no higher-level
172
+ work wants the slot). Otherwise omit the flag; normal is the default. If the
173
+ create is refused with a priority error (a hosted service too old to store the
174
+ level), file it normal and tell the human so the operator can expedite it.
171
175
 
172
176
  When the explicitly named destination equals `[tickets].readyState`, tell the
173
177
  human in the completion response that the ticket may be claimed by the next
174
178
  dispatch once the repository's label, dependency, intake, capacity, and other
175
- readiness gates are satisfied, after any urgent ready tickets. Before ready filing, follow
179
+ readiness gates are satisfied, after any higher-level ready tickets. Before ready filing, follow
176
180
  [After filing: check operator presence](#after-filing-check-operator-presence):
177
181
  with a live operator, say the existing operator will pick it up; without one,
178
182
  say you will operate it. The human's explicit instructions override either default.
@@ -139,7 +139,7 @@ states the work could be in with `ab ticket list --state <state>` before
139
139
  filing.
140
140
 
141
141
  ```
142
- ab ticket create "Rate-limit auth endpoints" --body spec.md [--labels bug,api] [--blocked-by file-1,file-2] [--issues 824,820:refs] [--priority urgent] [--assignees alice,me]
142
+ ab ticket create "Rate-limit auth endpoints" --body spec.md [--labels bug,api] [--blocked-by file-1,file-2] [--issues 824,820:refs] [--priority urgent|high|normal|low] [--assignees alice,me]
143
143
  ```
144
144
 
145
145
  It lands in `triage/` and prints the new id. `--body` is a file, and its
@@ -150,8 +150,10 @@ spec gets bounced back to `triage/` by the dispatcher rather than built.
150
150
  Blocker ids are source-local; every blocker must exist before creation
151
151
  succeeds. When the ticket originates from a forge issue, attach it with
152
152
  `--issues`: `N` (intent `closes`, the default) when the ticket fully resolves
153
- the issue, `N:refs` when it only partly addresses it. `--priority urgent` makes
154
- the dispatcher claim it before normal ready work; omit it for normal.
153
+ the issue, `N:refs` when it only partly addresses it. `--priority` takes
154
+ `urgent`, `high`, `normal` (the default) or `low`; the dispatcher claims
155
+ ready work by level, so `urgent` goes before all other ready work and `low`
156
+ after it.
155
157
  `--assignees` assigns the ticket on a source that stores assignees (GitHub):
156
158
  usernames, or `me` for the owner of the GitHub credential. Without it, a
157
159
  configured `[tickets].createAssignee` assigns the ticket, and `--assignees ''`
@@ -207,10 +209,13 @@ ab ticket unblock file-3 file-1
207
209
 
208
210
  Update is partial: omitted fields stay untouched, while an explicitly empty
209
211
  `--labels` clears labels. `--issues` replaces the whole set of issue links and
210
- `--issues ''` clears it. `--priority urgent|normal` sets the dispatch class;
211
- the file tracker writes `priority = "urgent"` and removes the key for normal. A
212
- source that cannot store priority refuses `urgent`, names itself, and writes
213
- nothing; `normal` succeeds there. `--assignees` replaces the whole set of
212
+ `--issues ''` clears it. `--priority urgent|high|normal|low` sets the level and
213
+ omitting it leaves the level alone; any other value is refused before anything
214
+ is written. The file tracker writes `priority = "<level>"` and removes the key
215
+ for normal. GitHub and plugin sources without native priority store it as one
216
+ `priority:urgent`, `priority:high` or `priority:low` label, shown as the
217
+ ticket's priority, not among its labels; set it with `--priority`, never
218
+ `--labels`, which refuses priority labels. `--assignees` replaces the whole set of
214
219
  assignees, `--assignees ''` clears it, and omitting it leaves them alone;
215
220
  `ab ticket show` prints them and JSON reads carry an `assignees` array. Hand a
216
221
  GitHub ticket to someone else this way. A source that cannot store assignees
@@ -267,15 +272,18 @@ another move to `ready/`, subject to the remaining dispatch gates and available
267
272
  capacity. Blocker edits must use the source-agnostic `ab ticket block` and
268
273
  `ab ticket unblock` commands shown above.
269
274
 
270
- With a free slot the dispatcher claims eligible urgent tickets first, then
271
- normal ones, each in source order; urgent tickets also go ahead of normal
272
- builds waiting to re-verify, reconcile or resume. A blocked urgent ticket waits
273
- while normal work proceeds, and urgency never stops a running build. To
274
- expedite a ticket, mark it urgent rather than moving other tickets out of
275
- `ready/`. Editing a ticket's priority after it is claimed does not change its
276
- build; the operator runs `ab priority <slug> urgent` for that.
275
+ With a free slot the dispatcher claims eligible tickets by level, `urgent`,
276
+ `high`, `normal`, then `low`, each level in source order; each level also
277
+ goes ahead of lower-level builds waiting to re-verify, reconcile or resume.
278
+ Each build takes its ticket's level. A blocked ticket waits while
279
+ lower-level work proceeds, and priority never stops a running build. To
280
+ expedite a ticket, mark it `urgent` or `high` rather than moving other
281
+ tickets out of `ready/`. Editing a ticket's priority after it is claimed does
282
+ not change its build; the operator runs `ab priority <slug> <level>` for
283
+ that.
277
284
  When `[policy].maxOpenPrs` is set and that many root PRs are open and unmerged,
278
- open-PR backpressure pauses normal claims while urgent ones are still claimed.
285
+ open-PR backpressure pauses `high`, `normal` and `low` claims while urgent
286
+ ones are still claimed.
279
287
 
280
288
  When the dispatcher claims an eligible file ticket, it moves it to `doing/`,
281
289
  then to `done/` on merge or back to `triage/` if the build aborts (`ready/`
@@ -471,8 +479,8 @@ absolute file path containing the edited text. Read the current ticket and
471
479
  reapply the intended changes before retrying; conflicts are never merged.
472
480
 
473
481
  File and Linear revisions fingerprint kind, target, title, body, canonical label/blocker sets,
474
- state and urgent priority; file revisions also cover nonempty issue links. GitHub revisions
475
- fingerprint kind, target, title, body, canonical label/blocker sets, state and issue links,
482
+ state and any priority other than normal; file revisions also cover nonempty issue links. GitHub revisions
483
+ fingerprint kind, target, title, body, canonical label/blocker sets (priority labels included), state and issue links,
476
484
  including the ticket's own issue; GitHub tickets carry no comments. Reverting
477
485
  identical content restores its fingerprint. File checks
478
486
  re-read immediately before writing, with the existing no-lock race window.
@@ -4,8 +4,8 @@
4
4
  "build": "ab-hosted-service-build"
5
5
  },
6
6
  "dependencies": {
7
- "@defrex/autobuild-hosted-store-service": "1.12.0",
8
- "@defrex/autobuild": "1.12.0",
7
+ "@defrex/autobuild-hosted-store-service": "1.14.0",
8
+ "@defrex/autobuild": "1.14.0",
9
9
  "next": "16.1.6",
10
10
  "react": "19.2.4",
11
11
  "react-dom": "19.2.4"