@defrex/autobuild 1.5.0 → 1.7.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 (126) hide show
  1. package/README.md +1 -1
  2. package/SPEC.md +192 -24
  3. package/docs/agent-runtimes.md +1 -1
  4. package/docs/answering-blocked-builds.md +7 -4
  5. package/docs/architecture.md +100 -32
  6. package/docs/configuration-overview.md +10 -0
  7. package/docs/configuration.md +340 -10
  8. package/docs/dispatcher.md +2 -2
  9. package/docs/forges.md +1 -0
  10. package/docs/glossary.md +1 -1
  11. package/docs/operating.md +1 -1
  12. package/docs/operator-api.md +33 -10
  13. package/docs/operator-surfaces.md +6 -3
  14. package/docs/plugin-authoring.md +48 -6
  15. package/docs/remote-store-protocol.md +33 -10
  16. package/docs/restacking.md +16 -7
  17. package/docs/ticket-sources.md +34 -6
  18. package/docs/tickets.md +7 -1
  19. package/docs/troubleshooting.md +1 -1
  20. package/docs/workspaces.md +1 -1
  21. package/package.json +3 -3
  22. package/packages/core/src/cli/attention.ts +3 -0
  23. package/packages/core/src/cli/binary-direct.ts +1 -0
  24. package/packages/core/src/cli/dashboard/model.ts +14 -4
  25. package/packages/core/src/cli/dashboard/poll.ts +14 -0
  26. package/packages/core/src/cli/dashboard/render.ts +3 -0
  27. package/packages/core/src/cli/dispatch-frontend.ts +10 -14
  28. package/packages/core/src/cli/dispatch-preflight.ts +5 -1
  29. package/packages/core/src/cli/dispatch-repository-feed.ts +145 -109
  30. package/packages/core/src/cli/dispatch-tickets.ts +47 -0
  31. package/packages/core/src/cli/dispatch-upgrade-controller.ts +3 -0
  32. package/packages/core/src/cli/dispatch.ts +377 -101
  33. package/packages/core/src/cli/help.ts +15 -6
  34. package/packages/core/src/cli/init-validation.ts +14 -1
  35. package/packages/core/src/cli/repo-lease.ts +225 -0
  36. package/packages/core/src/cli/repository-status.ts +40 -3
  37. package/packages/core/src/cli/status.ts +21 -13
  38. package/packages/core/src/cli/ticket.ts +22 -4
  39. package/packages/core/src/cli/wait.ts +4 -1
  40. package/packages/core/src/cli/watch.ts +17 -4
  41. package/packages/core/src/config/live.ts +4 -0
  42. package/packages/core/src/config/profiles.ts +96 -0
  43. package/packages/core/src/config/ready-assignee.ts +43 -11
  44. package/packages/core/src/config/roles.ts +33 -10
  45. package/packages/core/src/config/schema.ts +204 -26
  46. package/packages/core/src/events/catalog.ts +2 -0
  47. package/packages/core/src/events/compatibility.ts +3 -1
  48. package/packages/core/src/events/forge-degradation-policy.ts +16 -2
  49. package/packages/core/src/events/payloads.ts +23 -0
  50. package/packages/core/src/events/policy.ts +3 -0
  51. package/packages/core/src/events/repository.ts +19 -0
  52. package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +267 -352
  53. package/packages/core/src/kernel/build-creation.ts +29 -0
  54. package/packages/core/src/kernel/dispatch-capacity.ts +134 -30
  55. package/packages/core/src/kernel/engine.ts +13 -6
  56. package/packages/core/src/kernel/forge-health.ts +47 -0
  57. package/packages/core/src/kernel/generators/build-log.ts +9 -0
  58. package/packages/core/src/kernel/guarded-forge.ts +76 -18
  59. package/packages/core/src/kernel/incremental-fixtures.ts +1 -0
  60. package/packages/core/src/kernel/janitor-failure.ts +85 -5
  61. package/packages/core/src/kernel/leaf-restack-state.ts +4 -2
  62. package/packages/core/src/kernel/log-index.ts +1 -1
  63. package/packages/core/src/kernel/node-landing.ts +2 -1
  64. package/packages/core/src/kernel/node-parent.ts +2 -0
  65. package/packages/core/src/kernel/read-facts.ts +9 -1
  66. package/packages/core/src/kernel/reducer-registry.ts +6 -1
  67. package/packages/core/src/kernel/reducer.ts +75 -4
  68. package/packages/core/src/kernel/ticket-preparation.ts +15 -8
  69. package/packages/core/src/operator/protocol.ts +10 -0
  70. package/packages/core/src/operator/query.ts +16 -13
  71. package/packages/core/src/operator/registry.ts +25 -5
  72. package/packages/core/src/operator/sandbox-host.ts +3 -0
  73. package/packages/core/src/operator/tickets.ts +15 -3
  74. package/packages/core/src/plugin-sdk/index.ts +4 -0
  75. package/packages/core/src/ports/forge/create.ts +6 -0
  76. package/packages/core/src/ports/forge/github-transport.ts +40 -3
  77. package/packages/core/src/ports/forge/github.ts +12 -1
  78. package/packages/core/src/ports/forge/workspace-ancestry.ts +60 -0
  79. package/packages/core/src/ports/forge-failure.ts +31 -2
  80. package/packages/core/src/ports/runner/routing.ts +66 -5
  81. package/packages/core/src/ports/tickets/assignees.ts +54 -0
  82. package/packages/core/src/ports/tickets/contract.ts +164 -4
  83. package/packages/core/src/ports/tickets/create.ts +35 -7
  84. package/packages/core/src/ports/tickets/github-fake.ts +18 -2
  85. package/packages/core/src/ports/tickets/github.ts +247 -29
  86. package/packages/core/src/ports/tickets/hosted-index.ts +1 -0
  87. package/packages/core/src/ports/tickets/operations.ts +6 -1
  88. package/packages/core/src/ports/tickets/tree.ts +12 -2
  89. package/packages/core/src/ports/tickets/update.ts +6 -2
  90. package/packages/core/src/ports/types.ts +37 -3
  91. package/packages/core/src/ports/workspace/commit-preservation.ts +28 -12
  92. package/packages/core/src/ports/workspace/git-worktree.ts +3 -1
  93. package/packages/core/src/ports/workspace/harvest-execution.ts +4 -2
  94. package/packages/core/src/ports/workspace/vercel-sandbox.ts +12 -0
  95. package/packages/core/src/processes/build-child.ts +28 -7
  96. package/packages/core/src/processes/build-execution-state.ts +4 -1
  97. package/packages/core/src/processes/build-runner.ts +17 -2
  98. package/packages/core/src/processes/dispatcher.ts +329 -59
  99. package/packages/core/src/processes/execution-no-progress.ts +2 -0
  100. package/packages/core/src/processes/harvest-child.ts +8 -2
  101. package/packages/core/src/processes/harvest-execution-state.ts +104 -0
  102. package/packages/core/src/processes/harvest-runner.ts +251 -17
  103. package/packages/core/src/processes/repo-view.ts +2 -0
  104. package/packages/core/src/scenarios/harness.ts +160 -36
  105. package/packages/core/src/store/reduced-reads.ts +10 -0
  106. package/packages/core/src/store/reducer-value-shapes.json +3339 -2898
  107. package/packages/core/src/store/remote/client.ts +21 -8
  108. package/packages/core/src/store/remote/index.ts +4 -0
  109. package/packages/core/src/store/remote/protocol.ts +7 -0
  110. package/packages/core/src/store/remote/released-clients.json +22 -0
  111. package/packages/core/src/store/remote/released-reducer-values/1.6.0.json +27173 -0
  112. package/packages/core/src/store/remote/released-reducer-values/1.7.0.json +27366 -0
  113. package/packages/core/src/store/remote/released-reducer-values/index.ts +4 -0
  114. package/packages/core/src/store/repo-state-events.ts +1 -0
  115. package/packages/core/src/store/types.ts +11 -0
  116. package/packages/core/src/testing/dispatch-read-budget.ts +84 -58
  117. package/packages/core/src/testing/index.ts +2 -0
  118. package/packages/core/src/testing/reduced-read-budget.ts +411 -11
  119. package/skills/guide/SKILL.md +166 -35
  120. package/skills/guide/references/operator-api.md +33 -10
  121. package/skills/guide/references/plugin-authoring.md +48 -6
  122. package/skills/guide/references/remote-store-protocol.md +33 -10
  123. package/skills/guide/references/restacking.md +16 -7
  124. package/skills/operate/SKILL.md +79 -14
  125. package/skills/tickets/SKILL.md +22 -4
  126. package/templates/hosted-service/package.json +2 -2
@@ -120,6 +120,10 @@ confirmed, absent, or unknown without deleting an environment or its snapshots.
120
120
  Only dispatcher-authorized reap follows the durable fence and preservation/loss
121
121
  receipt. `provision` accepts exact `restoration` heads; branch ancestry must be
122
122
  verified, and detached producer objects must never overwrite the named branch.
123
+ `provision` also receives `restorationArchives`: `local` for the local-git
124
+ forge, whose repository already holds the archive refs and must not be fetched
125
+ from, and `remote` otherwise, in which case a provider sharing the repository
126
+ must fetch each exact archive ref from origin before verifying it.
123
127
  `preserve` receives `replaced`, and `provision` receives `restorationReplaced`:
124
128
  the build's bounded record of the latest 64 shas recorded rewrites replaced.
125
129
  A branch head equal to or contained in one of them is superseded. Preserve
@@ -154,6 +158,9 @@ API 1.8 adds optional forge failure classification. Import `ForgeFailure` and `i
154
158
  ```ts
155
159
  // Rate limit, with a valid ISO reset timestamp:
156
160
  throw new ForgeFailure(message, { kind: 'rate-limited', resetAt })
161
+ // The limited request carried no credential: say why, so the limit stays local
162
+ // to the caller instead of pausing the repository:
163
+ throw new ForgeFailure(message, { kind: 'rate-limited', resetAt, unauthenticated: reason })
157
164
  // Retryable transport error:
158
165
  throw new ForgeFailure(message, { kind: 'transient', retry: 'retryable' })
159
166
  ```
@@ -533,10 +540,12 @@ refuse a configured `readyAssignee` with an error naming the source and plugin.
533
540
  Three optional methods support it:
534
541
 
535
542
  - `prepareReadyAssignee(): Promise<void>` is called once at dispatcher startup,
536
- before the loop and never in a tick, whether or not `readyAssignee` is set.
543
+ before the loop and never in a tick, whether or not `readyAssignee` or
544
+ `createAssignee` is set.
537
545
  Resolve whatever `"me"` needs and memoize it. A credential with no user is a
538
546
  recorded result, not a throw; throw only for infrastructure failures, which
539
- fail startup when `readyAssignee` is set and are otherwise a warning.
547
+ fail startup when `readyAssignee` or `createAssignee` is set and are
548
+ otherwise a warning.
540
549
  - `readyAssigneeRefusal(value): string | undefined` is synchronous and makes no
541
550
  request. Return why the value can't be honoured from what was prepared, or
542
551
  `undefined`. Startup and every reload call it, so a refused reload keeps the
@@ -545,6 +554,29 @@ Three optional methods support it:
545
554
  return a one-line summary of who the value names, such as `me → @octocat`,
546
555
  or throw an error that says how to fix a value that names nobody.
547
556
 
557
+ ## Optional assignees capability
558
+
559
+ An adapter opts in with `assignees: true` and must then accept
560
+ `assignees?: string[]` on create, update and revision-checked update, where
561
+ each entry is a username or `me` (the owner of the source's credential) and an
562
+ update replaces the whole set, `[]` clearing it. Return `assignees` on every
563
+ read, `[]` when unassigned, and leave it out of revisions. Check each user
564
+ before any write and refuse, writing nothing, when one can't be assigned. A
565
+ write the provider accepts without the requested assignees must fail rather
566
+ than report success, and a retried keyed create that adopts an existing ticket
567
+ must leave it with the requested assignees. Without the flag, the
568
+ compatibility facade refuses any write naming assignees, including `[]`, with
569
+ `TicketAssigneesUnsupported` before your methods run, strips them from reads,
570
+ and dispatcher startup, `ab init --validate` and live reloads refuse a
571
+ configured `[tickets].createAssignee`, naming the source and plugin.
572
+
573
+ Callers apply `createAssignee` themselves, so a draft's assignees are always
574
+ exact. To support it, implement `createAssigneeRefusal(value)`, synchronous
575
+ and request-free like `readyAssigneeRefusal`, and
576
+ `describeCreateAssignee(value)` for `ab init --validate`. `"me"` should reuse
577
+ what `prepareReadyAssignee` resolved, so a dispatcher never resolves it in a
578
+ tick.
579
+
548
580
  ## Optional ticket paging capability
549
581
 
550
582
  Native paging is an optional API 1.9 ticket-source capability:
@@ -552,8 +584,11 @@ Native paging is an optional API 1.9 ticket-source capability:
552
584
  The SDK exports these types; the result is `TicketListing & { total: number }`.
553
585
  Criteria retain state, labels (AND), and assignee semantics. The page has a
554
586
  nonnegative integer `limit`, optional nonnegative integer `offset` (default 0),
555
- and optional `order: 'oldest' | 'newest'` (default oldest). Newest reverses the
556
- entire source order before offset and limit. Total counts all matches, even
587
+ and optional `order: 'oldest' | 'newest'` (default oldest). Oldest is the
588
+ source's dispatch order: with `priority`, urgent tickets first, then normal
589
+ ones, each in listing order. Newest is newest filed first: creation time
590
+ descending, regardless of urgency, with a stable tie-break. It is not the
591
+ reverse of dispatch order. Offset and limit apply after ordering. Total counts all matches, even
557
592
  with limit zero or an offset past the end. Records, diagnostics and errors
558
593
  match the exhaustive listing. The shared `describeTicketSourceContract` suite
559
594
  automatically compares declared native paging with full-read windows.
@@ -561,7 +596,12 @@ automatically compares declared native paging with full-read windows.
561
596
  Only paged operator listings select this capability. Sources without it retain
562
597
  the full-read fallback, which orders the listing before offset and limit: by
563
598
  default a stable urgent-first partition (urgent, then normal, each in source
564
- order), or for newest the reversed source order. Native errors propagate. Unpaged operator
599
+ order), or for newest the reversed listing, which is newest filed first for
600
+ sources that list in filing order (file, GitHub, Linear). The remote
601
+ `HostedTicketSource` is the exception: the hosted list-ready protocol returns
602
+ urgent tickets first and carries no filing time, so the client cannot see
603
+ filing order, and its newest pages are reversed dispatch order whenever urgent
604
+ tickets exist. Native errors propagate. Unpaged operator
565
605
  listings, CLI ticket lists and dispatcher ready scans remain exhaustive through
566
606
  `listReady`/`listAll`. The hosted PostgreSQL source counts matches without
567
607
  bodies and reads only the SQL-bounded window. File, Linear, GitHub and the remote
@@ -570,4 +610,6 @@ bodies and reads only the SQL-bounded window. File, Linear, GitHub and the remot
570
610
  Hosted cooldown recording rejects observed reset deadlines beyond the 24-hour
571
611
  admission horizon explicitly; adapters must not shorten or invent a provider
572
612
  reset to evade this validation. Operator forge-clear is an audited override,
573
- not a successful provider observation.
613
+ not a successful provider observation. Only limits the dispatcher's own forge
614
+ classifies, without `unauthenticated`, record repository cooldown; others are
615
+ local to the process and reported as `forge.credential-limited` attention.
@@ -35,6 +35,12 @@ service publishes `>=1.2.0 <1.4.0` until later publication facts permit retireme
35
35
  The service reads the clock for each decision, so retirement needs no redeploy. Health needs no credentials, version
36
36
  headers, or available backend. On the service’s own line, both its runtime protocol and its published ledger protocol are admitted. Health advertises a fully validated same-line request’s admitted protocol. Otherwise it advertises the service line’s published protocol, or its runtime protocol when that line is unpublished. Thus default 1.3 health advertises 6 anonymously and to published clients, and 7 to admitted source clients; explicit 1.4/7 services default to 7. The package version and support range remain truthful. Health performs no store reads.
37
37
 
38
+ Every current service advertises `build-creation-key-v1` in health `capabilities`:
39
+ keyed project creation lands at the derived slug described under `POST /builds`.
40
+ Clients send a creation key only after seeing it. A client treats a service without
41
+ it as allocating, so an unkeyed creation whose response was lost there is reported
42
+ as an unknown outcome rather than as absence.
43
+
38
44
 
39
45
  ## Hosted dispatch placement
40
46
 
@@ -372,7 +378,7 @@ it to exist. An unknown build returns `404 not-found`.
372
378
 
373
379
  | BuildStore operation | HTTP route | Request | Success |
374
380
  |---|---|---|---|
375
- | `createBuild` | `POST /builds` | `{slug: string, repo: string, repoOrigin?: string, ticket?: TicketRef, branch?: string, created?: event write}`; `slug`, `repo`, and a supplied `branch` are nonempty. `created`, when present, must be a valid `build.created` write; the server appends it as seq 1 atomically with the record (both exist or neither), and an invalid one is `422` with nothing created | `201` + authoritative `BuildRecord`; project credentials receive a fresh random-suffixed slug and a branch in the build kind's namespace (`ab/<slug>`, or `ab-node/<slug>` for a node); a supplied `branch` must be `ab/<requested slug>` or `ab-node/<requested slug>` agreeing with the `build.created` kind, otherwise `400 validation`. Owner admin/open mode keeps exact-slug semantics with `409 conflict` for duplicates |
381
+ | `createBuild` | `POST /builds` | `{slug: string, repo: string, repoOrigin?: string, ticket?: TicketRef, branch?: string, created?: event write, creationKey?: string}`; `slug`, `repo`, and a supplied `branch` are nonempty; a supplied `creationKey` matches `^[A-Za-z0-9_-]{1,128}$`. `created`, when present, must be a valid `build.created` write; the server appends it as seq 1 atomically with the record (both exist or neither), and an invalid one is `422` with nothing created | `201` + authoritative `BuildRecord`; project credentials receive a fresh random-suffixed slug, or with `creationKey` the slug that key derives (a repeated key is `409 conflict`), and a branch in the build kind's namespace (`ab/<slug>`, or `ab-node/<slug>` for a node); a supplied `branch` must be `ab/<requested slug>` or `ab-node/<requested slug>` agreeing with the `build.created` kind, otherwise `400 validation`. Owner admin/open mode keeps exact-slug semantics with `409 conflict` for duplicates |
376
382
  | `listBuilds` | `GET /builds` | none | `200` + `BuildRecord[]`, filtered by the server to the credential project; owner admin may list all projects. List order is unspecified |
377
383
  | `getBuild` | `GET /builds/{slug}` | none | `200` + `BuildRecord`; absent is `404` (the shipped client maps this to `null`) |
378
384
  | `append` | `POST /builds/{slug}/events` | event write | `201` + build event envelope |
@@ -529,7 +535,7 @@ client version window are unchanged.
529
535
  | Scope | Reducers with no arguments |
530
536
  | --- | --- |
531
537
  | Build | `executionNoProgress`, `summaryRequests`, `build`, `buildDigest`, `currentPrAttachments`, `pendingPrAttachmentReclaims`, `openExecution`, `lastExecutionOutcome`, `infrastructureFailureReset`, `openWorkspace`, `setupStreak`, `openBuildWorkspace`, `currentDeferralObservation`, `dashboardFacts`, `pinnedAssets`, `buildDelegation` |
532
- | Repository | `dispatchPlacement`, `ticketPreparation`, `harvest`, `dispatchSettings`, `sandboxStates`, `openHarvestExecutions`, `autoMergeDefault`, `effectiveConfig`, `harvestDelegation` |
538
+ | Repository | `dispatchPlacement`, `ticketPreparation`, `harvest`, `dispatchSettings`, `sandboxStates`, `openHarvestExecutions`, `hostedHarvestAuthority`, `autoMergeDefault`, `effectiveConfig`, `harvestDelegation` |
533
539
 
534
540
  | Reducer | Scope | Required arguments |
535
541
  | --- | --- | --- |
@@ -542,7 +548,12 @@ another's accumulator. `effectiveConfig` returns an object with optional `run`
542
548
  and `reference: {kind, rev}`. Absence is distinct from an unreadable referenced
543
549
  artifact. Delegation values contain semantic lifecycle facts indexed by prefixed
544
550
  identifiers, not authorization decisions; request time and grace expiry are
545
- always evaluated against those facts on the service.
551
+ always evaluated against those facts on the service. `hostedHarvestAuthority`
552
+ returns `{current?: {execution, run, leaseHolder, released}}`: the latest
553
+ `harvest.execution.authorized` and whether that execution has since ended or
554
+ been released. Its size does not grow with harvest history; a hosted harvest
555
+ guest re-reads it at durable boundaries to decide whether it still holds
556
+ authority, and a server that does not serve it stops the guest.
546
557
 
547
558
  Each remaining registered reducer is explicitly excluded:
548
559
 
@@ -1185,8 +1196,12 @@ Remote clients continue mapping addressed GET 404 responses to null. Nested
1185
1196
  streams must also belong to the addressed parent.
1186
1197
 
1187
1198
  `GET /builds` is filtered by the server to the credential's project. Project
1188
- `POST /builds` always allocates a fresh random-suffixed slug from the requested
1189
- base, even when the base is unused, and a matching branch in the build kind's
1199
+ `POST /builds` without `creationKey` allocates a fresh random-suffixed slug from
1200
+ the requested base, even when the base is unused. With `creationKey` it creates at
1201
+ most once at `<base>-<first 24 hex of sha256("autobuild-build-creation\0" + repo +
1202
+ "\0" + requested slug + "\0" + creationKey)>` and answers a repeated key with
1203
+ `409 conflict`, never a second identity; `creationBuildSlug` in the client package
1204
+ computes it. Either way it creates a matching branch in the build kind's
1190
1205
  namespace: `ab-node/<slug>` when the `build.created` payload has `kind: "node"`,
1191
1206
  otherwise `ab/<slug>`. Without `created`, a supplied `branch` prefix decides the
1192
1207
  kind. A supplied `branch` must be exactly `ab/<requested slug>` or
@@ -1266,8 +1281,13 @@ or invoke operator APIs. Harvest writes require the exact run in event payloads
1266
1281
  and artifact metadata; artifacts use the harvest kinds. Every artifact in an
1267
1282
  atomic deposit is checked before writing. Harvest streams have an immutable
1268
1283
  `harvest:<run>:<execution>:` label namespace. Addressed streams resolve their actual owner;
1269
- a guessed ID cannot bypass the boundary. Only the runner can heartbeat or re-acquire its exact
1270
- adopted repository lease holder; another current holder still fences it. Recovery acknowledgements remain dispatcher-side.
1284
+ a guessed ID cannot bypass the boundary. A harvest-runner grant may heartbeat or re-acquire
1285
+ only its exact adopted repository lease holder, and another current holder fences those lease
1286
+ calls. That lease permission is not the prepared guest's execution authority: the guest neither
1287
+ heartbeats, reclaims nor releases the invocation lease, so routine `--once` teardown or a
1288
+ successor invocation's lease acquisition alone does not fence it. The guest instead reads
1289
+ `hostedHarvestAuthority` at durable boundaries and stops when its execution authorization is
1290
+ released or replaced, or when that verification fails. Recovery acknowledgements remain dispatcher-side.
1271
1291
 
1272
1292
  Hosted ticket access is gated by grant kind. Build-runner and build-phase grants
1273
1293
  cannot call ticket routes. Harvest-phase grants may call only list-ready,
@@ -1766,14 +1786,17 @@ The commands use the saved owner credential, even if an ambient build token exis
1766
1786
  ### Forge cooldown admission and explicit recovery
1767
1787
 
1768
1788
  Hosted repository event appends and atomic artifact deposits validate
1769
- `dispatcher.forge-degraded` before any durable mutation. The payload must match
1770
- its event schema, with a finite ISO `resetAt` at most 24 hours after server time
1789
+ `dispatcher.forge-degraded` and `forge.credential-limited` before any durable
1790
+ mutation. The payload must match its event schema, with a finite ISO `resetAt` at most 24 hours after server time
1771
1791
  (inclusive). Already-expired deadlines are accepted. Invalid or out-of-horizon
1772
1792
  writes return `400 validation` (the remote adapter exposes `EventValidationError`);
1773
1793
  the server never clamps or invents a provider reset. Historical decoding has no clock-relative restriction.
1774
1794
 
1775
1795
  Build-runner and build-phase grants may POST only the kernel-authored
1776
- `dispatcher.forge-degraded` repository fact through the events route. The
1796
+ `forge.credential-limited` and `dispatcher.forge-degraded` repository facts
1797
+ through the events route. Current runners and phase sessions record only
1798
+ `forge.credential-limited` attention; the `dispatcher.forge-degraded` exception
1799
+ remains for runners pinned to older releases. The
1777
1800
  preceding `requireProject` check binds this exception to the exact repository
1778
1801
  in the delegated claim. A hosted project identifies one repository. Delegates
1779
1802
  cannot write recovery, deposits or other repository facts, regardless of the
@@ -17,7 +17,7 @@ node fast-forwards preserve ordered contributing identities.
17
17
 
18
18
  Destination heads come only from the authoritative forge branch; dispatcher-host
19
19
  refs are never a fallback. Failed remote reads retain the accepted observation;
20
- classified rate limits use repository forge degradation and cooldown. Changed
20
+ dispatcher-classified rate limits use repository forge degradation and cooldown. Changed
21
21
  heads require immutable commit ancestry proof against the accepted target and
22
22
  the destination base already used by replay. Missing capability or failed proof
23
23
  defers new replay. A non-descendant without kernel lineage records
@@ -221,7 +221,7 @@ not consume `maxPhaseAttempts`. A seventh transient failure records
221
221
  error and six retries. Answering that escalation opens a fresh publication episode
222
222
  for the same retained intent without resetting agent phase failures. Pending
223
223
  publication keeps its workspace through backoff and unresolved exhaustion.
224
- Classified rate limits retain repository cooldown and consume no publication
224
+ Dispatcher-classified rate limits retain repository cooldown and consume no publication
225
225
  retry allowance. Rejected pushes, lease conflicts, dirty trees and unclassified
226
226
  errors retain their existing behavior.
227
227
 
@@ -237,11 +237,14 @@ sessions do not inherit obsolete reconstruction instructions.
237
237
  ## Ticket preparation before build creation
238
238
 
239
239
  Before claiming, the dispatcher journals a repository-scoped preparation intent;
240
- a won claim and the exact selected creation slug are durable boundaries. Caught
240
+ a won claim, the selected creation slug and, when the build store attests keyed
241
+ creation, the attempt's creation key are durable boundaries. Caught
241
242
  asset-copy, spec-authoring, naming, and build-creation failures return the ticket
242
243
  to configured Ready; a nonconforming spec goes to configured Triage. Recovery
243
- checks the exact selected build first: a matching record and atomic
244
- `build.created` retain ownership even if creation threw after committing.
244
+ point-reads the selected slug and, for a keyed attempt, the canonical slug derived
245
+ from the repository, selected slug and key: one matching record and atomic
246
+ `build.created` retain ownership even if creation threw after committing or its
247
+ response was lost.
245
248
  Unavailable or conflicting readback never authorizes release or a replacement
246
249
  build. Pending attempts retain the original failure, latest recovery error and
247
250
  retry deadline in the canonical repository reduced value; resolved attempts
@@ -249,8 +252,10 @@ leave that value. Under repository ownership, each tick admits at most eight
249
252
  due recovery attempts, before intake and independently of capacity or intake
250
253
  settings, with a 30-second durable retry delay after recovery failure. Unresolved
251
254
  ticket identities remain withheld. An uncertain claim outcome or unrelated
252
- external ticket state, missing ticket/state, or conflicting slug ownership terminates
253
- automatic recovery with an `abandoned` resolution and diagnostic reason. The
255
+ external ticket state, missing ticket/state, conflicting slug ownership, builds at
256
+ both identities, or an unknown creation outcome (an unkeyed attempt on a store
257
+ that allocates slugs, where absence is not evidence) terminates automatic
258
+ recovery with an `abandoned` resolution and diagnostic reason. The
254
259
  ticket is left unchanged; an operator can leave it finished or cancelled, or
255
260
  inspect ownership and explicitly return it to Ready for another attempt. These
256
261
  cases stop provider polling and further durable diagnostic appends. The tick
@@ -258,6 +263,10 @@ that records the abandonment reports one dispatcher diagnostic naming the
258
263
  ticket and attempt, whether the claim was confirmed or its provider outcome is
259
264
  unknown, and the recorded reason. If that tick fails for any reason, its
260
265
  failure error carries the diagnostics instead. Later ticks do not repeat it.
266
+ The `abandoned` resolution event records whether the claim was confirmed, and
267
+ default `ab watch` repository attention reports the same line once as it lands,
268
+ whether or not its tick failed; a fresh watch does not replay historical
269
+ abandonments.
261
270
  Recovery failures are
262
271
  reported without preventing janitor, lease sweep, or other dispatch recovery.
263
272
  This is not general process
@@ -113,7 +113,7 @@ rejectedState = "rejected"
113
113
 
114
114
  ### GitHub (`github`)
115
115
 
116
- Tickets are the issues of the forge repository, the GitHub repository that `origin` names, so a team grooms and tracks work where it already looks. The source authenticates as the `github` forge does: `GITHUB_TOKEN`, then `GH_TOKEN`, then the gh CLI's `gh auth login`. A fine-grained token needs Issues read and write, and Metadata read, on the repository, and a user token's user needs triage or write access: GitHub silently drops label changes from anyone below that, so a label write that doesn't come back fails with a permission error instead of reporting success. `ab init --validate` names a missing token, a token that can't read and write issues, a user who can't set labels, disabled issues, an `origin` that isn't a GitHub repository, a state that can't be a label, and a `readyAssignee` that names no user who can be assigned issues in the repository.
116
+ Tickets are the issues of the forge repository, the GitHub repository that `origin` names, so a team grooms and tracks work where it already looks. The source authenticates as the `github` forge does: `GITHUB_TOKEN`, then `GH_TOKEN`, then the gh CLI's `gh auth login`. A fine-grained token needs Issues read and write, and Metadata read, on the repository, and a user token's user needs triage or write access: GitHub silently drops label changes from anyone below that, so a label write that doesn't come back fails with a permission error instead of reporting success. `ab init --validate` names a missing token, a token that can't read and write issues, a user who can't set labels, disabled issues, an `origin` that isn't a GitHub repository, a state that can't be a label, and a `readyAssignee` or `createAssignee` that names no user who can be assigned issues in the repository, or `"me"` with a credential that has no user.
117
117
 
118
118
  <!-- seam-config:start -->
119
119
  ```toml
@@ -138,17 +138,35 @@ rejectedState = "rejected"
138
138
  - **Closing reasons.** Closed as completed, or closed before GitHub recorded reasons, is done. Closed as not planned or duplicate is in the `rejectedState` state; without `rejectedState` it reads as a fixed `not-planned` state that is never ready, never resolves a blocker and can't be moved into. Moving to done or rejected closes the issue with that reason (an issue already closed with the other reason is reopened and closed again, because GitHub changes a reason only with the state); moving to any other state opens it with exactly that state's label.
139
139
  - **Reopen goes to triage.** If a state label survived the close, the adapter strips that stale label the first time it reads the reopened issue. It tells stale from fresh by the issue's last 100 label and reopen events; an issue whose deciding event is older than that is left out of listings with a diagnostic until its state label is removed and re-added.
140
140
  - **Labels.** `readyLabels` defaults to `["autobuild"]`; `[]` removes the gate. Missing labels are created on demand. State and link labels are never part of a ticket's labels, and a write that names one is refused. The `autobuild:proposal` and `autobuild:aborted` labels that harvest and abort apply are ordinary labels, so `proposal` and `aborted` can't be states.
141
- - **Assignee.** `readyAssignee = "me"` keeps only issues assigned to the login that owns the GitHub credential; a username, including an Enterprise Managed User login such as `mona_acme`, names a specific user. The ready read itself is narrowed by assignee, an unassigned issue is never ready, and any one of several assignees matches. `"me"` costs one `GET /user` per dispatcher start, never during a tick, so a reload that enables it needs no restart unless startup couldn't resolve the credential's owner.
141
+ - **Assignee.** `readyAssignee = "me"` keeps only issues assigned to the login that owns the GitHub credential; a username, including an Enterprise Managed User login such as `mona_acme`, names a specific user. The ready read itself is narrowed by assignee, an unassigned issue is never ready, and any one of several assignees matches. While `readyAssignee` is set, each scan reports open ready issues that carry every `readyLabels` entry but have no assignee in the ticket diagnostics, which `ab repository status` and the dashboards show, naming the ten lowest-numbered and counting the rest. The report never claims or assigns them; assigning one makes it claimable. `"me"` costs one `GET /user` per dispatcher start, never during a tick, so a reload that enables it needs no restart unless startup couldn't resolve the credential's owner.
142
+ - **Assignees.** Tickets carry the issue's assignees as an `assignees` array of usernames in JSON reads, whether they were set on GitHub or through `ab`, and `ab ticket show` prints them. They aren't part of the ticket's `revision`. `--assignees` on `ab ticket create` and `ab ticket update`, and the `assignees` field of the operator `tickets.create` and `tickets.update` tools, set them: each entry is a username or `me`, at most ten entries counted before duplicates collapse, and an update replaces the whole set. `createAssignee = "me"` (or a username) assigns every ticket Autobuild creates, through `ab ticket create`, operator `tickets.create` and harvest proposals, unless the create names its own assignees; a harvest proposal goes to the owner of the filing dispatcher's credential. That pairs with `readyAssignee = "me"`, so each person's dispatcher picks up the tickets they file. A create or update fails, naming the cause and writing nothing, when `me` has no user behind the credential (a GitHub App installation token has none) or a user can't be assigned issues in the repository. GitHub silently drops assignees a token without push access sets, so a write whose assignees don't come back fails, naming the issue and saying it is unassigned; a retried harvest create adopts that issue and assigns it. A write naming assignees costs one check per user per process, `me` reuses the `readyAssignee` `GET /user`, and reads cost nothing extra.
142
143
  - **Blockers** are native issue dependencies ("blocked by"), visible on both issues, including ones added on GitHub. A blocker resolves when its issue is done. One in another repository never resolves and is named in the dependency diagnostics. An issue transferred to another repository is no longer a ticket here: its old number reads as missing, so it is never written and never resolves a blocker.
143
144
  - **Issue links.** The ticket's own issue is always a `closes` link that can't be removed. Links to other issues are labels named `autobuild-link:<intent> #<n>`, such as `autobuild-link:refs #820`, so they show on the issue and survive edits on GitHub. Each linked issue and intent adds one repository label, which appears in GitHub's label picker; unused link labels are never deleted.
144
145
  - **Comments and assets.** Dispatcher notices post as issue comments, but tickets carry no comment history, so `ab ticket show` lists none; export and import read comment history explicitly. Assets live in the BuildStore, with the usual note left as an issue comment.
145
146
  - **Nodes and targets.** A node is an issue with the exact `node` label. A ticket targets a node by being a sub-issue of the node's issue, so the node's sub-issue list on GitHub shows its children. A parent without the `node` label, or in another repository, is ordinary grouping: it gives no target, never blocks dispatch and is left untouched, so `--target` on such an issue is refused and `--no-target` doesn't remove it. Sub-issues and `node` labels added or removed on GitHub read the same as `ab ticket` writes. GitHub allows 100 direct sub-issues per issue and 8 levels of nesting. A repository label named `Node` or another casing must be renamed to `node` first.
146
147
  - **Export and import.** `ab ticket export` covers every issue, closed ones included. `ab ticket import` remaps every id to a new issue number and resumes by creation key, as the ticket migration procedure's GitHub section describes.
147
148
  - **Not supported:** guarded writes (`--expected-revision` is refused, as with Linear).
148
- - **Cost.** Dispatcher reads are conditional requests. Their validators live under the local state root, in `github-tickets/<owner>/<repo>/validators/`, and are evicted after 7 days unused, so a tick on an unchanged repository spends no primary rate-limit budget. A process without them, such as a cold hosted instance, pays one read sized by the ready candidates. A ready candidate whose parent issue isn't in the listing adds one conditional read of that parent, at most one per distinct parent. A node's completeness check reads the node issue and its sub-issues, conditionally, whatever the repository's size. Rate limits surface as the ticket-source rate-limit error, with GitHub's reset time.
149
+ - **Cost.** Dispatcher reads are conditional requests. Their validators live under the local state root, in `github-tickets/<owner>/<repo>/validators/`, and are evicted after 7 days unused, so a tick on an unchanged repository spends no primary rate-limit budget. A process without them, such as a cold hosted instance, pays one read sized by the ready candidates. A ready candidate whose parent issue isn't in the listing adds one conditional read of that parent, at most one per distinct parent. A node's completeness check reads the node issue and its sub-issues, conditionally, whatever the repository's size. With `readyAssignee` set, the unassigned-issue report adds one conditional read per scan, plus one per further page, which is free on an unchanged repository; its failure, a rate limit included, is a diagnostic that never stops assigned tickets from being listed and claimed. Rate limits surface as the ticket-source rate-limit error, with GitHub's reset time.
149
150
  - **State counts** are display-only: one fresh GraphQL request per call, plus one more for each further page of 100 `autobuild:` labels, never cached and never reading issue history, with done and rejected subject to GitHub's search-index lag. Three cases approximate. A stale reopen label counts in its label's state until the first read strips it. An issue with two or more state labels counts once in each until its labels are fixed; the first read reports it. A closure that predates GitHub's close reasons reads as done but may count as rejected or `not-planned`, and never heals.
150
151
  - **Creation keys** live in a hidden marker in the issue body. A keyed create needs `idempotencyKeyReservedAt`; harvest supplies it.
151
152
 
153
+ Issues filed directly on GitHub aren't assigned by Autobuild, so under `readyAssignee` they never become ready until someone assigns them. A small Actions workflow can assign each opened issue to its author:
154
+
155
+ ```yaml
156
+ on: { issues: { types: [opened] } }
157
+ permissions: { issues: write }
158
+ jobs:
159
+ assign:
160
+ runs-on: ubuntu-latest
161
+ steps:
162
+ - run: gh issue edit "$NUMBER" --repo "$REPO" --add-assignee "$AUTHOR"
163
+ env:
164
+ GH_TOKEN: ${{ github.token }}
165
+ NUMBER: ${{ github.event.issue.number }}
166
+ REPO: ${{ github.repository }}
167
+ AUTHOR: ${{ github.event.issue.user.login }}
168
+ ```
169
+
152
170
  ### Optional issue links
153
171
 
154
172
  The `file`, `hosted` and `github` sources store [forge issue links](tickets.md#groom-a-buildable-spec): as `issueLinks` frontmatter (`file`), transactional project data (`hosted`), or `autobuild-link:<intent> #<n>` labels (`github`), where the ticket's own issue is a `closes` link with no label. `linear` doesn't, because Linear links GitHub issues natively through its own integration; a create or update that names issue links is refused with an error naming the source, and nothing is written.
@@ -188,6 +206,8 @@ bun ab plugin test ticket-source acme
188
206
 
189
207
  Declare `readyAssignee` only if `listReady` filters by `criteria.assignee`; without it, a configured `readyAssignee` is refused, naming your source. See the [optional ready assignee capability](plugin-authoring.md#optional-ready-assignee-capability).
190
208
 
209
+ Declare `assignees` only if you store, return and verify ticket assignees; without it, a write naming assignees and a configured `createAssignee` are refused, naming your source. See the [optional assignees capability](plugin-authoring.md#optional-assignees-capability).
210
+
191
211
  Declare tree support only if you keep the [optional tree contract](plugin-authoring.md#optional-ticket-tree-capability) on the same port and harness: exhaustive pagination, canonical targets, revision coverage and atomic rejection.
192
212
 
193
213
  Native paging is an optional API 1.9 ticket-source capability:
@@ -195,8 +215,11 @@ Native paging is an optional API 1.9 ticket-source capability:
195
215
  The SDK exports these types; the result is `TicketListing & { total: number }`.
196
216
  Criteria retain state, labels (AND), and assignee semantics. The page has a
197
217
  nonnegative integer `limit`, optional nonnegative integer `offset` (default 0),
198
- and optional `order: 'oldest' | 'newest'` (default oldest). Newest reverses the
199
- entire source order before offset and limit. Total counts all matches, even
218
+ and optional `order: 'oldest' | 'newest'` (default oldest). Oldest is the
219
+ source's dispatch order: with `priority`, urgent tickets first, then normal
220
+ ones, each in listing order. Newest is newest filed first: creation time
221
+ descending, regardless of urgency, with a stable tie-break. It is not the
222
+ reverse of dispatch order. Offset and limit apply after ordering. Total counts all matches, even
200
223
  with limit zero or an offset past the end. Records, diagnostics and errors
201
224
  match the exhaustive listing. The shared `describeTicketSourceContract` suite
202
225
  automatically compares declared native paging with full-read windows.
@@ -204,7 +227,12 @@ automatically compares declared native paging with full-read windows.
204
227
  Only paged operator listings select this capability. Sources without it retain
205
228
  the full-read fallback, which orders the listing before offset and limit: by
206
229
  default a stable urgent-first partition (urgent, then normal, each in source
207
- order), or for newest the reversed source order. Native errors propagate. Unpaged operator
230
+ order), or for newest the reversed listing, which is newest filed first for
231
+ sources that list in filing order (file, GitHub, Linear). The remote
232
+ `HostedTicketSource` is the exception: the hosted list-ready protocol returns
233
+ urgent tickets first and carries no filing time, so the client cannot see
234
+ filing order, and its newest pages are reversed dispatch order whenever urgent
235
+ tickets exist. Native errors propagate. Unpaged operator
208
236
  listings, CLI ticket lists and dispatcher ready scans remain exhaustive through
209
237
  `listReady`/`listAll`. The hosted PostgreSQL source counts matches without
210
238
  bodies and reads only the SQL-bounded window. File, Linear, GitHub and the remote
package/docs/tickets.md CHANGED
@@ -55,6 +55,12 @@ When a ticket must go next, such as a fix for a stuck build, mark it urgent inst
55
55
  bun ab ticket update AUT-12 --priority urgent
56
56
  ```
57
57
 
58
+ On the `github` source a ticket has assignees. `--assignees alice,me` on `ab ticket create` or `ab ticket update` sets them, where `me` is the owner of the GitHub credential. On update it replaces the whole set, `--assignees ''` clears it, and omitting the option leaves it alone. Set `[tickets].createAssignee` to assign every ticket Autobuild creates, including harvest proposals; explicit `--assignees` replace that default. `ab ticket show` prints the assignees, and JSON ticket reads carry an `assignees` array of usernames. Sources that can't store assignees refuse the option and name the source. See [Ticket sources](ticket-sources.md#shipped-adapters).
59
+
60
+ ```sh
61
+ bun ab ticket update 412 --assignees octocat
62
+ ```
63
+
58
64
 
59
65
  ## Backlog and rejected
60
66
 
@@ -76,7 +82,7 @@ Moving a ticket back to triage, backlog or ready restores ordinary behavior. "Bu
76
82
  The dispatcher claims only tickets in the ready state with the required labels and any source-specific filter. A ready ticket still waits on:
77
83
 
78
84
  - **Blockers.** Unresolved prerequisite tickets keep it queued; they don't create a blocked build. With nodes, prerequisites with builds must be present at the sampled destination; see [integration and blocker presence](integration-overview.md).
79
- - **Destination and capacity.** Its target must accept new work, and a capacity slot must be free and not reserved for an integration node awaiting verification.
85
+ - **Destination and capacity.** Its target must accept new work, and a capacity slot must be free and not reserved for an integration node awaiting verification or a finished build waiting to re-verify or reconcile.
80
86
 
81
87
  When a slot is free, the dispatcher takes urgent ready tickets first, then normal ones, each in the source's order. Priority changes only that order: a blocked urgent ticket waits like any other while normal work proceeds, and an urgent ticket never stops or pauses a running build. The web dashboard's Queue tab lists tickets in the same order and marks urgent ones `URGENT`; the mark shows priority, not that the ticket will dispatch next.
82
88
 
@@ -57,7 +57,7 @@ bun ab harvest status
57
57
  - **Ready state:** ticket in the exact ready state with every required label.
58
58
  - **Blockers and destination:** blockers done, target node open, required changes in the destination. A target node built by another dispatcher's store never opens here; see [several dispatchers](build-store.md#several-dispatchers-on-one-repository). `ab repository status` lists the queue diagnostics.
59
59
  - **Claims:** claimed tickets aren't reclaimed.
60
- - **Capacity:** paused or blocked work keeps its slot; idle collecting nodes take none. Node verification and reconciliation account specially for descendants' slots.
60
+ - **Capacity:** paused or blocked unfinished work keeps its slot; builds waiting for a merge decision and idle collecting nodes take none. A finished build that must re-verify or reconcile reserves a slot ahead of new claims. Node verification and reconciliation account specially for descendants' slots.
61
61
  - **Harvest:** check the acknowledged harvest gate and unclaimed observations. Harvest triggers at `policy.harvestThreshold` observations, or `policy.harvestMaxDrift` other merged builds since the oldest observation (zero disables drift), and uses no build slot.
62
62
 
63
63
  ## Authentication failures
@@ -126,7 +126,7 @@ export AB_GIT_READ_TOKEN='<read-only repository token>'
126
126
 
127
127
  - Use a repository-scoped read token, separate from the push identity. For a public clone, remove `gitUsernameEnv` and `gitPasswordEnv`.
128
128
  - Autobuild passes these as the authenticated Git source for [Vercel private-repository cloning](https://vercel.com/kb/guide/sandbox-private-github-repositories); don't embed credentials in the origin URL.
129
- - `environmentVariables` forwards legacy runtime API credentials; declared account credentials become placeholders even when listed here. Never forward `AB_TOKEN`, `GITHUB_TOKEN`, `GH_TOKEN`, Vercel tokens or the clone token; Autobuild supplies scoped Store authority, keeps clone secrets out of guest commands, and publishes from the host.
129
+ - `environmentVariables` forwards legacy runtime API credentials; declared account credentials become placeholders even when listed here. Never forward `AB_TOKEN`, `GITHUB_TOKEN`, `GH_TOKEN`, Vercel tokens or the clone token; Autobuild supplies scoped Store authority, keeps clone secrets out of guest commands, and publishes from the host. Guest runners always run with `AB_GITHUB_REQUIRE_CREDENTIAL=1`, which a forwarded value cannot override, so a GitHub API request from the guest without a credential fails with a typed error naming `GITHUB_TOKEN or GH_TOKEN` instead of using the sandbox address's shared anonymous quota.
130
130
 
131
131
  ## Writing your own
132
132
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defrex/autobuild",
3
- "version": "1.5.0",
3
+ "version": "1.7.0",
4
4
  "description": "Agent-driven software delivery from groomed ticket to merged PR",
5
5
  "repository": {
6
6
  "type": "git",
@@ -157,8 +157,8 @@
157
157
  },
158
158
  "devDependencies": {
159
159
  "@biomejs/biome": "2.5.5",
160
- "@defrex/autobuild-postgres-store": "1.5.0",
161
- "@defrex/autobuild-vercel-sandbox": "1.5.0",
160
+ "@defrex/autobuild-postgres-store": "1.7.0",
161
+ "@defrex/autobuild-vercel-sandbox": "1.7.0",
162
162
  "@resvg/resvg-js": "2.6.2",
163
163
  "@types/bun": "^1.3.14",
164
164
  "@types/node": "^24.0.0",
@@ -62,11 +62,14 @@ export function repositoryNeedsAttention(event: RepositoryEvent): boolean {
62
62
  case 'dispatcher.runtime-rolled-back':
63
63
  case 'dispatcher.upgrade-failed':
64
64
  case 'dispatcher.kernel-git-unavailable':
65
+ case 'forge.credential-limited':
65
66
  return true
66
67
  case 'dispatcher.config-reloaded':
67
68
  return event.payload.restartRequired.length > 0
68
69
  case 'dispatcher.run-stopped':
69
70
  return event.payload.outcome === 'abnormal'
71
+ case 'ticket-preparation.resolved':
72
+ return event.payload.outcome === 'abandoned'
70
73
  default:
71
74
  return false
72
75
  }
@@ -187,6 +187,7 @@ export async function runDirectBinary(
187
187
  repo: record.repo,
188
188
  name: forge.name,
189
189
  wait: true,
190
+ scope: { process: `phase session ${cliEnv.session} (build ${cliEnv.build})` },
190
191
  })
191
192
  return await runCli(argv, {
192
193
  ...unscopedDeps,
@@ -73,7 +73,7 @@ import {
73
73
  currentDeferralObservationReducer,
74
74
  type DeferralLedger,
75
75
  } from '../../kernel/auto-merge'
76
- import { decideNextFromFacts } from '../../kernel/engine'
76
+ import { decideNextFromFacts, landingRestackDue } from '../../kernel/engine'
77
77
  import { verifyPhase } from '../../ontology'
78
78
  import { indexLog, type LogIndex } from '../../kernel/log-index'
79
79
  import {
@@ -185,6 +185,8 @@ export interface DashboardHarvest {
185
185
 
186
186
  export interface DashboardBuild {
187
187
  draining?: boolean
188
+ /** A work row's standing alert, such as a parked build waiting for a slot. */
189
+ alert?: { tone: 'yellow' | 'red'; text: string }
188
190
  integrationRow?: IntegrationRow
189
191
  integrationDetail?: IntegrationDetail
190
192
  collectionIdentity?: {
@@ -1344,15 +1346,22 @@ export interface DashboardHeader extends DashboardFrameHeader {
1344
1346
  * projection here means build rows (including their phase intervals) may be
1345
1347
  * cached without caching dispatcher settings or Harvest state.
1346
1348
  */
1347
- /** A node waiting for a runner slot says so on its row unless a more urgent
1348
- * alert already stands. Returns copies; cached projected rows stay intact. */
1349
+ /** A node or parked build waiting for a runner slot says so on its row
1350
+ * unless a more urgent alert already stands. Returns copies; cached projected
1351
+ * rows stay intact. */
1349
1352
  export function decorateSlotWaits(
1350
1353
  rows: readonly DashboardBuild[],
1351
1354
  capacity: DispatchCapacity | undefined,
1352
1355
  ): DashboardBuild[] {
1353
1356
  const waiting = new Map((capacity?.waitingNodes ?? []).map((node) => [node.slug, node.request]))
1354
- if (!waiting.size) return [...rows]
1357
+ const parked = new Map(
1358
+ (capacity?.waitingBuilds ?? []).map((build) => [build.slug, build.request]),
1359
+ )
1360
+ if (!waiting.size && !parked.size) return [...rows]
1355
1361
  return rows.map((row) => {
1362
+ const leaf = parked.get(row.slug)
1363
+ if (leaf && !row.integrationRow && !row.alert)
1364
+ return { ...row, alert: { tone: 'yellow', text: slotWaitText(leaf) } }
1356
1365
  const request = waiting.get(row.slug)
1357
1366
  if (!request || !row.integrationRow || row.integrationRow.alert) return row
1358
1367
  return {
@@ -1437,6 +1446,7 @@ export function buildDashboard(
1437
1446
  state,
1438
1447
  workspace: openBuildWorkspace(events) !== null,
1439
1448
  provisioning: provisionMarkerReducer.reduce(events) !== undefined,
1449
+ restackDue: landingRestackDue(state, indexLog(events)),
1440
1450
  })),
1441
1451
  config.capacity,
1442
1452
  new Date(),
@@ -9,6 +9,8 @@ import { composeBuildConfig } from '../../config/live'
9
9
  import type { PipelineSourceMeta } from '../../config/pipeline-source'
10
10
  import type { AbEvent } from '../../events/catalog'
11
11
  import { buildReducer, type BuildAcc, type BuildState } from '../../kernel/reducer'
12
+ import { landingRestackDue } from '../../kernel/engine'
13
+ import { leafRestackReducer, type LeafRestackState } from '../../kernel/leaf-restack-state'
12
14
  import {
13
15
  BUILD_EFFECTIVE_CONFIG_ARTIFACT,
14
16
  parseBuildConfigMetadata,
@@ -65,6 +67,8 @@ interface LiveEntry {
65
67
  * folded into a copy of it instead of re-reducing the whole log. */
66
68
  acc: BuildAcc
67
69
  state: BuildState
70
+ /** Advanced with every delta, for `landingRestackDue`. */
71
+ restack: LeafRestackState
68
72
  build: DashboardBuild | null
69
73
  }
70
74
 
@@ -81,6 +85,7 @@ interface ReducedEntry {
81
85
  state: BuildState
82
86
  workspace: boolean
83
87
  provisioning: boolean
88
+ restackDue: boolean
84
89
  build: DashboardBuild | null
85
90
  }
86
91
 
@@ -267,6 +272,7 @@ export class DashboardBuildPollCache {
267
272
  state: value.state,
268
273
  workspace: value.workspace !== null,
269
274
  provisioning: value.provisionMarker !== undefined,
275
+ restackDue: landingRestackDue(value.state, value.log),
270
276
  build:
271
277
  current?.kind === 'reduced' &&
272
278
  current.cursor === cursor &&
@@ -322,6 +328,10 @@ export class DashboardBuildPollCache {
322
328
  events,
323
329
  acc,
324
330
  state,
331
+ restack: leafRestackReducer.advance(
332
+ current?.restack ?? leafRestackReducer.initial(),
333
+ delta,
334
+ ),
325
335
  build: await this.projectRow(record, state, events, config),
326
336
  })
327
337
  }
@@ -347,6 +357,10 @@ export class DashboardBuildPollCache {
347
357
  workspace: entry.kind === 'reduced' ? entry.workspace : entry.workspace.open !== null,
348
358
  provisioning:
349
359
  entry.kind === 'reduced' ? entry.provisioning : entry.provisionMarker.marker !== null,
360
+ restackDue:
361
+ entry.kind === 'reduced'
362
+ ? entry.restackDue
363
+ : landingRestackDue(entry.state, { restack: entry.restack }),
350
364
  })
351
365
  states.set(slug, entry.state)
352
366
  if (entry.build !== null) builds.push(entry.build)
@@ -471,6 +471,9 @@ function renderBuild(
471
471
  ),
472
472
  )
473
473
  }
474
+ if (build.alert)
475
+ for (const line of wrappedText(build.alert.text, Math.max(1, width - 4), ''))
476
+ lines.push(paint(` ! ${line}`, build.alert.tone, color))
474
477
  // Setup failures and blocker questions are dense-list previews. Their model
475
478
  // strings remain untouched; newline-aware wrapping and capping happen only
476
479
  // at this presentation seam.