@defrex/autobuild 1.19.0 → 1.20.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 (55) hide show
  1. package/README.md +1 -1
  2. package/SPEC.md +53 -9
  3. package/docs/architecture.md +23 -7
  4. package/docs/assets/headline-wide.png +0 -0
  5. package/docs/dispatcher.md +1 -1
  6. package/docs/merge-policy.md +2 -1
  7. package/docs/operator-surfaces.md +1 -1
  8. package/docs/plugin-authoring.md +11 -4
  9. package/docs/process-ownership.md +43 -0
  10. package/docs/remote-store-protocol.md +7 -0
  11. package/docs/restacking.md +11 -2
  12. package/docs/setup.md +7 -2
  13. package/docs/verification.md +1 -1
  14. package/package.json +3 -3
  15. package/packages/core/src/cli/dashboard/model.ts +1 -0
  16. package/packages/core/src/cli/dashboard/vocabulary.ts +3 -0
  17. package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +1 -0
  18. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/3f0c4e6d1d54e5bf.json +92 -0
  19. package/packages/core/src/kernel/dispatch-capacity.ts +15 -3
  20. package/packages/core/src/kernel/engine.ts +15 -2
  21. package/packages/core/src/kernel/janitor-failure.ts +1 -0
  22. package/packages/core/src/kernel/reducer-revisions.ts +1 -0
  23. package/packages/core/src/processes/build-runner.ts +67 -7
  24. package/packages/core/src/processes/check-termination.ts +44 -0
  25. package/packages/core/src/processes/dispatcher.ts +131 -18
  26. package/packages/core/src/processes/publication-loss.ts +29 -0
  27. package/packages/core/src/processes/repo-view.ts +2 -1
  28. package/packages/core/src/store/contract.ts +43 -0
  29. package/packages/core/src/store/digest.ts +19 -1
  30. package/packages/core/src/store/reducer-value-shapes.json +8 -0
  31. package/packages/core/src/store/remote/protocol.ts +3 -0
  32. package/packages/core/src/store/remote/released-clients.json +11 -0
  33. package/packages/core/src/store/remote/released-reducer-values/1.20.0.json +36469 -0
  34. package/packages/core/src/store/remote/released-reducer-values/index.ts +16 -14
  35. package/packages/core/src/store/types.ts +5 -0
  36. package/packages/core/src/testing/reduced-read-budget.ts +131 -0
  37. package/skills/code-review/SKILL.md +5 -0
  38. package/skills/finalize/SKILL.md +5 -0
  39. package/skills/guide/SKILL.md +18 -7
  40. package/skills/guide/references/merge-policy.md +2 -1
  41. package/skills/guide/references/plugin-authoring.md +11 -4
  42. package/skills/guide/references/process-ownership.md +43 -0
  43. package/skills/guide/references/remote-store-protocol.md +7 -0
  44. package/skills/guide/references/restacking.md +11 -2
  45. package/skills/guide/references/setup.md +7 -2
  46. package/skills/harvest/SKILL.md +5 -0
  47. package/skills/harvest-review/SKILL.md +5 -0
  48. package/skills/implement/SKILL.md +5 -0
  49. package/skills/judge/SKILL.md +4 -0
  50. package/skills/operate/SKILL.md +5 -0
  51. package/skills/plan/SKILL.md +5 -0
  52. package/skills/plan-review/SKILL.md +5 -0
  53. package/skills/propose/SKILL.md +5 -0
  54. package/skills/reconcile/SKILL.md +5 -0
  55. package/templates/hosted-service/package.json +2 -2
package/README.md CHANGED
@@ -26,7 +26,7 @@ From the repository you want built, install Autobuild as a development dependenc
26
26
  <!-- release-install:start -->
27
27
 
28
28
  ```sh
29
- bun add -d --exact @defrex/autobuild@1.19.0
29
+ bun add -d --exact @defrex/autobuild@1.20.0
30
30
  ```
31
31
 
32
32
  <!-- release-install:end -->
package/SPEC.md CHANGED
@@ -197,7 +197,8 @@ forge-side backup of displaced leaf and node history and of unpublished
197
197
  workspace commits: where the forge refuses them, rewrites and node writes keep a
198
198
  BuildStore copy or warn and proceed, and workspace preservation keeps a
199
199
  BuildStore copy or refuses the release, except under abort cleanup, which
200
- records the commits lost and releases (§15.7). Results are pass, fail, or unknown; incomplete
200
+ records the commits lost and releases, and merged completion, which needs no
201
+ preservation (§15.7). Results are pass, fail, or unknown; incomplete
201
202
  inspection never proves permission. Local Git passes trivially; legacy plugins
202
203
  report unknown. Known hard failures fail init validation and produce one durable
203
204
  `dispatcher.forge-readiness-failed` repository fact per run/check; historical
@@ -2201,6 +2202,14 @@ The verdict vocabulary is phase-dependent and the CLI enforces it: review
2201
2202
  phases accept `approve|revise|escalate`; agent-verify steps accept
2202
2203
  `pass|fail|skip` (`fail` requires a report; `skip` requires a reason).
2203
2204
  Deterministic checks never touch the CLI — the kernel runs them directly.
2205
+ When a check's command dies from a signal (exit status 128+N), its
2206
+ `verify-report:<step>` names the signal on its first line and records
2207
+ `signal` and `runnerShutdown` in artifact metadata. `runnerShutdown: false`
2208
+ means the runner's own shutdown was not in effect, so another process sent
2209
+ the signal; the failure is counted as usual. A check the runner's own
2210
+ shutdown kills deposits only an uncounted report artifact with
2211
+ `runnerShutdown: true` and appends no event, so no attempt is spent and the
2212
+ step reruns after relaunch. No event payload changes.
2204
2213
  Exact flags and validation live with the CLI implementation and its tests.
2205
2214
 
2206
2215
  ### 8.3 What `ab context` materializes
@@ -3466,7 +3475,12 @@ A build releases its slot as soon as it waits on the outside world:
3466
3475
  | another ticket | an entered ticket wait (§11) |
3467
3476
  | the forge | a finished pipeline waiting for merge gates or for the forge to merge |
3468
3477
  | its children | an integration build with no cycle, conflict, measurement or proposal that needs a runner: collecting child work, or waiting for a repair child |
3469
- | nothing | `done` or `aborted`; abort cleanup holds no slot |
3478
+ | nothing | `done` or `aborted`; abort cleanup holds no slot; a build whose PR merged, before its completion is recorded |
3479
+
3480
+ A build whose PR merged holds and requests no slot: its work is on the target,
3481
+ and only the dispatcher's completion and cleanup remain. The janitor stops
3482
+ observing its target, so a target move after the merge raises no restack or
3483
+ `verification` request.
3470
3484
 
3471
3485
  A pipeline is finished once every verify step and every finalize post-step for
3472
3486
  the current spec has passed. The dispatcher records the finish as an advisory
@@ -5423,7 +5437,7 @@ using a slot and the word tells why.
5423
5437
  | | held | `ABORTING` | an abort was requested and the runner is still stopping |
5424
5438
  | teal (`live`) | requested | `QUEUED` | parked work waiting for admission; the note names the request (`resume`, `reconcile`, `verification`, `reopen`, `propose`) and marks urgent, high and low waiters |
5425
5439
  | amber (`held`) | none | `WAITING` | a finished pipeline waiting for a merge decision or on hold, an entered ticket wait, or a `revise-spec` answer waiting for its revision; the note says which (`merge decision`, `on hold`, `on <tickets>`, `spec revision`) |
5426
- | | none | `MERGING` | a finished pipeline with merge consent, waiting for merge gates or for the forge to merge |
5440
+ | | none | `MERGING` | a finished pipeline with merge consent, waiting for merge gates or for the forge to merge, or a merged PR whose completion is pending (note `merged`) |
5427
5441
  | | none | `PAUSED` | an acknowledged pause |
5428
5442
  | | none | `COLLECTING` | an integration build collecting child work |
5429
5443
  | red (`alert`) | none | `BLOCKED` | an open escalation, other than a ticket wait's own, or a failed node verification waiting for a repair child; the note `done` marks a completed build whose escalation awaits acknowledgement |
@@ -5436,7 +5450,8 @@ holding a slot shows them. A build without a slot keeps its word until the
5436
5450
  acknowledgement, which is not gated. A resumed pause is `QUEUED` until it is
5437
5451
  admitted again; there is no separate resuming word. The reducer's `queued` and
5438
5452
  `running` statuses are lifecycle facts, not display words: a newly claimed
5439
- build shows `STARTING`, and a settled build shows `WAITING` or `MERGING`.
5453
+ build shows `STARTING`, a settled build shows `WAITING` or `MERGING`, and a
5454
+ merged build not yet completed shows `MERGING` whatever its consent.
5440
5455
 
5441
5456
  A harvest run is never a build and never holds a slot. Its row shows
5442
5457
  `HARVESTING` (teal) while it works, `PAUSED` or `SUSPENDED` (amber) while it is
@@ -5974,6 +5989,14 @@ janitor's work set until the moves commit, and a settlement recorded on an
5974
5989
  already completed node re-arms it through the node's incrementally advanced
5975
5990
  digest, with no repository scan.
5976
5991
 
5992
+ **Pending merged release in the build digest.** The digest also folds
5993
+ `workspace.provisioned`, `workspace.cleanup-required` and `workspace.released`
5994
+ into `releasePending`, set while a completed build whose PR merged still has
5995
+ an open workspace. Like a pending attachment reclaim, it is a post-terminal
5996
+ duty: the build stays in the janitor's work set until its release lands
5997
+ (§15.7), and the flag clears through the build's incrementally advanced
5998
+ digest, with no repository scan.
5999
+
5977
6000
  **Optimization read cost.** The digest's size does not grow with settled
5978
6001
  attempts: admission caps `inFlight` plus `rejections` at the objective's concurrency, and
5979
6002
  settled attempts leave only counters. The dispatcher, the dashboards, status
@@ -6102,7 +6125,7 @@ code-review.started{r1} → code-review.verdict{approve}
6102
6125
  verify.started{types} → verify.completed{outcome:pass} → …unit
6103
6126
  verify.started{acceptance} → pr-attachment.designated{artifact,filename,mediaType} → verify.completed{outcome:pass}
6104
6127
  finalize.started → pr-attachment.hosted{designationSeq,asset} → finalize.completed{pr} → finalize.step-completed{release-notes}
6105
- (later, janitor:) pr.merged → workspace.released → build.completed{merged} → pr-attachment.reclaimed{hostedSeq}
6128
+ (later, janitor:) pr.merged → build.completed{merged} → pr-attachment.reclaimed{hostedSeq} → workspace.released
6106
6129
  ```
6107
6130
 
6108
6131
  **Interrupted dispatch:** if the log stops after `build.created`, a later
@@ -6261,8 +6284,8 @@ The setup target belongs only to escalation metadata and is not a pipeline `Phas
6261
6284
  native continuation described in §9. The following remote-sandbox recovery
6262
6285
  retains its fresh-session fallback.
6263
6286
 
6264
- Before releasing or replacing a build workspace, the dispatcher confirms a
6265
- non-destructive execution fence for the exact workspace and execution generation.
6287
+ Before releasing or replacing a build workspace, other than completing a merged
6288
+ build (§15.7), the dispatcher confirms a non-destructive execution fence for the exact workspace and execution generation.
6266
6289
  It preserves unpublished branch commits and distinct detached producer candidates
6267
6290
  under immutable `refs/autobuild/archive/<build>/<sha>` refs, verifies their exact
6268
6291
  readback, and records `workspace.commits-preserved` before cleanup. Where the
@@ -6465,6 +6488,26 @@ correlated facts; a failed delete remains pending and retries on later ticks,
6465
6488
  including after the build is already done. A fixup request for a merged or
6466
6489
  closed PR is a *new ticket*, never a reopened build.
6467
6490
 
6491
+ **Merged completion.** When the janitor sees a build's PR merged and no
6492
+ execution is live, it records `pr.merged`, moves the ticket to done and records
6493
+ `build.completed {outcome: merged}` **before** touching the workspace. The
6494
+ merged commit is on the target, so it never fences, preserves or resumes a
6495
+ merged build's workspace. Release then runs the pre-release publication guard
6496
+ without a guest resume where it can: a pending `publication.requested` whose
6497
+ commit equals the merged PR's head or landing, or that a host-side forge
6498
+ ancestry proof places below either, is recorded `publication.lost` without
6499
+ settlement; any other pending request is settled as every release settles it.
6500
+ Provider cleanup (reap or release) follows, then `workspace.released {reason:
6501
+ completion}`. A cleanup the pass cannot finish leaves the build completed with
6502
+ `releasePending` in its digest (§15.5): later janitor visits retry it, a
6503
+ deadline deferral charges nothing, and a failure is a janitor episode with its
6504
+ usual backoff and escalation. Completion never waits on cleanup. Until it is
6505
+ recorded, a merged leaf runs nothing: the engine decides `wait awaiting-pr`
6506
+ for it after operator commands, whatever phase work its log still shows, and
6507
+ the dispatcher never admits it to a slot or launches a runner for it.
6508
+ Closed-unmerged completion and every other release (abort, pause, blocked,
6509
+ replacement, discard) keep their preservation.
6510
+
6468
6511
  **Reopening a settled leaf.** An operator who wants changes to a leaf that
6469
6512
  finished its pipeline and waits for its merge decision sends it back with
6470
6513
  `ab reopen <slug> --feedback <text>`, optionally with `--revise-spec <file>` or
@@ -6606,8 +6649,9 @@ Workspace commit preservation (§12 D) is the strict exception: its unpublished
6606
6649
  commits may exist nowhere else. It tries the forge archive ref, then a
6607
6650
  `history-objects-<sha>` store copy excluding the preservation base, and never
6608
6651
  classifies a commit as `target` or proceeds unretained. When both fail, release
6609
- is refused and cleanup stays pending. Abort cleanup is the one exception: it
6610
- records `workspace.commits-lost` and releases. A history copy is identified by its head:
6652
+ is refused and cleanup stays pending. Abort cleanup is one exception: it
6653
+ records `workspace.commits-lost` and releases. Merged completion is the other:
6654
+ the merged commit is on the target, so it releases without preserving (§15.7). A history copy is identified by its head:
6611
6655
  a later retention of the same commit reuses the existing copy and its saved
6612
6656
  base. Preservation records that base and, when it is no longer an ancestor of
6613
6657
  the current preservation base, retains the base itself the same way, to a
@@ -793,14 +793,15 @@ lock: a legacy dead session may remain open, while an actual takeover closes it
793
793
  explicitly.
794
794
 
795
795
  `processes/workspace-preservation.ts` owns the non-destructive fence, immutable
796
- checkpoint and durable receipt ordering shared by both release paths in the
797
- dispatcher. `ports/workspace/commit-preservation.ts` inventories the unpublished
796
+ checkpoint and durable receipt ordering shared by the dispatcher's release
797
+ paths; merged completion bypasses it (see
798
+ [Leaf and reconcile restacking](#leaf-and-reconcile-restacking)). `ports/workspace/commit-preservation.ts` inventories the unpublished
798
799
  change and restores exact refs or store copies, keeping detached producer objects
799
800
  separate from the named branch. Provider provisioning and start failures signal
800
801
  `WorkspaceCleanupRequired`; they cannot delete an existing build checkout.
801
802
 
802
- Before releasing or replacing a build workspace, the dispatcher confirms a
803
- non-destructive execution fence for the exact workspace and execution generation.
803
+ Before releasing or replacing a build workspace, other than completing a
804
+ merged build, the dispatcher confirms a non-destructive execution fence for the exact workspace and execution generation.
804
805
  It preserves unpublished branch commits and distinct detached producer candidates
805
806
  under immutable `refs/autobuild/archive/<build>/<sha>` refs, verifies their exact
806
807
  readback, and records `workspace.commits-preserved` before cleanup. Where the
@@ -826,7 +827,12 @@ cleanup records `workspace.commits-preserved` (or `workspace.commits-retained`)
826
827
  carrying forward earlier preserved heads, then releases and replaces it. Unknown fencing, inspection, transport, or
827
828
  receipt-write outcomes leave the workspace and snapshots intact, except under
828
829
  abort cleanup, which records `workspace.commits-lost` and tears the workspace
829
- down. A workspace
830
+ down. Merged completion skips this ordering: the janitor records
831
+ `build.completed` first, then releases the workspace without a fence,
832
+ preservation or resume, since the merged commit is on the target. A pending
833
+ publication still passes the merged pre-release guard before cleanup, and a
834
+ cleanup the pass cannot finish stays pending (`releasePending`) and retries
835
+ on later janitor visits. A workspace
830
836
  flagged by `workspace.cleanup-required` is never launched into: the dispatcher
831
837
  releases it and provisions the next generation. Provisioning cut off by a
832
838
  recorded dispatcher teardown is the exception: the next invocation asks the
@@ -2222,8 +2228,18 @@ use the same order and record `node.history-retained`; node recovery restores
2222
2228
  reserved inputs before reading them and abandons a reservation whose inputs are
2223
2229
  kept nowhere. Workspace preservation (`preserveRetained`, `retainPreservedCopy`)
2224
2230
  is strict: archive ref, else store copy, else release is refused. Abort cleanup
2225
- is the one exception: when preservation fails, `recordAbortPreservationFailure`
2226
- records `workspace.commits-lost` and the release proceeds. A reused copy
2231
+ is one exception: when preservation fails, `recordAbortPreservationFailure`
2232
+ records `workspace.commits-lost` and the release proceeds. Merged completion is
2233
+ the other: `releaseMergedWorkspace` runs after `build.completed` and never
2234
+ fences, preserves or resumes, because the merged commit is on the target.
2235
+ Its pre-release publication guard (`mergedHeadCovers`) treats a pending
2236
+ `publication.requested` as covered when its commit equals the merged PR's head
2237
+ or landing, or a host-side forge ancestry proof places it below either. A
2238
+ covered request is recorded `publication.lost` without settlement; an uncovered
2239
+ request, or one whose ancestry is unknown, is settled as every release settles
2240
+ it. The guard runs before provider cleanup. Completion is already recorded, so
2241
+ a cleanup the pass cannot finish leaves `releasePending` on the build's digest
2242
+ and later janitor visits retry it. A reused copy
2227
2243
  keeps its saved base, which preservation retains in turn and
2228
2244
  `restoreRetainedHead` follows to a bounded depth.
2229
2245
  GitHub uses explicit Git transport leases; local-git uses shared-database
Binary file
@@ -55,7 +55,7 @@ Others stay queued. Ready tickets are claimed by level, `urgent`, `high`, `norma
55
55
 
56
56
  To start one ticket without turning intake on for the whole ready queue, run `ab start <ticket-id> [--priority manual|urgent|high|normal|low]` (or the `tickets.start` operator tool). The running dispatcher, local or hosted, claims just that ticket on its next tick with a free slot in the request's tier and records the outcome as a `ticket.start-settled` event shown by `ab watch` and `ab repository status`. The default `manual` tier goes ahead of all waiting work; the four level tiers wait their turn as described below. The ticket must still be in the ready state, meet the spec standard, have no unresolved blockers and a destination that accepts work, and is deduplicated against existing builds; capacity and repository pause still apply. Listing labels and the ready assignee are not applied, because the ticket is named. Every tier bypasses intake off and open-PR backpressure for that ticket only. See `ab help start`.
57
57
 
58
- Each build gets its own workspace (local git worktree or remote sandbox) and a build-runner that owns its pipeline. Capacity is the repository's number of slots. A build takes a slot only by admission (a ticket claim, a start request or an admitted slot request) and holds it while Autobuild owes its next move, runner or not: between phases, while provisioning, across a crashed runner or expired lease, while a requested pause or abort winds down, and while work it started outlasts a question: other steps of a verify stage, or a recorded launch and its execution. The dispatcher records `slot.admitted` before every such launch. It releases the slot as soon as it waits on the outside world: an open question nothing is still working past, an acknowledged pause, a merge decision or merge gates, or other tickets (`ab wait-on`). When that wait ends (an answer, a resume, a moved target, a conflicted PR, an ended ticket wait) the build holds no slot until it is admitted again, ahead of ticket claims at its level. Occupancy never exceeds `capacity`. Builds without a slot keep their workspaces, so retained workspaces can exceed `capacity`. An integration node takes a slot only when admitted to verify, reconcile or propose, and holds it until that work is done; it holds none while collecting children, waiting for a repair child, or blocked. See [the integration tree](integration-overview.md). `ab builds`, `ab build status` and `ab repository status` report each build's slot state; see [Operator surfaces](operator-surfaces.md).
58
+ Each build gets its own workspace (local git worktree or remote sandbox) and a build-runner that owns its pipeline. Capacity is the repository's number of slots. A build takes a slot only by admission (a ticket claim, a start request or an admitted slot request) and holds it while Autobuild owes its next move, runner or not: between phases, while provisioning, across a crashed runner or expired lease, while a requested pause or abort winds down, and while work it started outlasts a question: other steps of a verify stage, or a recorded launch and its execution. The dispatcher records `slot.admitted` before every such launch. It releases the slot as soon as it waits on the outside world: an open question nothing is still working past, an acknowledged pause, a merge decision or merge gates, or other tickets (`ab wait-on`). A build whose PR merged holds and requests no slot and runs nothing more: the janitor completes it and releases its workspace. When that wait ends (an answer, a resume, a moved target, a conflicted PR, an ended ticket wait) the build holds no slot until it is admitted again, ahead of ticket claims at its level. Occupancy never exceeds `capacity`. Builds without a slot keep their workspaces, so retained workspaces can exceed `capacity`. An integration node takes a slot only when admitted to verify, reconcile or propose, and holds it until that work is done; it holds none while collecting children, waiting for a repair child, or blocked. See [the integration tree](integration-overview.md). `ab builds`, `ab build status` and `ab repository status` report each build's slot state; see [Operator surfaces](operator-surfaces.md).
59
59
 
60
60
  ## Slot admission order
61
61
 
@@ -264,7 +264,8 @@ displaced history under immutable exact archive refs
264
264
  - **Workspace preservation** keeps unpublished workspace commits under archive
265
265
  refs, else as BuildStore copies. When neither holds them, release is refused,
266
266
  except under abort cleanup, which records `workspace.commits-lost` and
267
- releases.
267
+ releases, and merged completion, which releases without preserving: the
268
+ merged commit is already on the target.
268
269
  - There is never a branch or tag fallback. When an environment refuses non-branch
269
270
  Git pushes, as Claude Code on the web's GitHub proxy does, the GitHub adapter
270
271
  creates the same archive ref through REST ref creation and confirms it by exact
@@ -72,7 +72,7 @@ Every nonterminal build row on both dashboards, `ab builds` and `ab build status
72
72
  | `ABORTING` | green | held | An abort was requested and the runner is still stopping. |
73
73
  | `QUEUED` | teal | requested | Parked work waiting for admission. The note names the request (`resume`, `reconcile`, `verification`, `reopen`, `propose`) and marks urgent, high and low waiters. |
74
74
  | `WAITING` | amber | none | A finished pipeline waiting for a merge decision (`merge decision`) or on hold (`on hold`), a ticket wait (`on <ids>`), or a `revise-spec` answer waiting for its revision (`spec revision`). |
75
- | `MERGING` | amber | none | A finished pipeline with merge consent, waiting for merge gates or the forge. |
75
+ | `MERGING` | amber | none | A finished pipeline with merge consent, waiting for merge gates or the forge, or a merged PR whose completion is pending (note `merged`). |
76
76
  | `PAUSED` | amber | none | An acknowledged pause. |
77
77
  | `COLLECTING` | amber | none | An integration build collecting child work. |
78
78
  | `BLOCKED` | red | none | An open escalation, or a failed node verification waiting for a repair child. The note `done` marks a completed build with an open escalation, such as a post-landing audit or an escalation raised during abort cleanup; the row stays until `ab answer` acknowledges it. |
@@ -136,8 +136,8 @@ applying a thin replay pack whose base is missing, and return true for an
136
136
  available leaf candidate even when archiving it is refused. Missing capabilities fail
137
137
  safely at destructive boundaries. `WorkspaceRecovery.fence(handle)` reports
138
138
  confirmed, absent, or unknown without deleting an environment or its snapshots.
139
- Only dispatcher-authorized reap follows the durable fence and preservation/loss
140
- receipt. `provision` accepts exact `restoration` heads; branch ancestry must be
139
+ Outside merged completion, dispatcher-authorized reap follows only the durable
140
+ fence and preservation/loss receipt. `provision` accepts exact `restoration` heads; branch ancestry must be
141
141
  verified, and detached producer objects must never overwrite the named branch.
142
142
  `provision` also receives `restorationArchives`: `local` for the local-git
143
143
  forge, whose repository already holds the archive refs and must not be fetched
@@ -158,9 +158,16 @@ archive transport refuses a head's archive ref, call it with your trusted Git
158
158
  transport. It keeps the head as a BuildStore copy and resolves to the copy's
159
159
  exclusion base; record the head with that `storeBase` in place of `remoteRef`.
160
160
  It throws when the head cannot be kept; rethrow so release is refused. A
161
- provider that ignores it preserves strictly. Abort cleanup is the exception:
161
+ provider that ignores it preserves strictly. Abort cleanup is one exception:
162
162
  when preservation fails, the dispatcher records the commits as lost
163
- (`workspace.commits-lost`) and releases anyway. A `restoration` head may name
163
+ (`workspace.commits-lost`) and releases anyway. Merged completion is the other:
164
+ the merged commit is on the target, so the dispatcher records `build.completed`
165
+ first, then reaps the workspace with no fence, `preserve` call or resume. A
166
+ pending publication passes the merged pre-release guard before reap. For a
167
+ merged build, `reap` can rely only on that guard having run and on the build
168
+ being terminal; it must not expect a fence or receipt, and a reap that cannot
169
+ finish stays pending and is retried on later janitor visits. Every other
170
+ release keeps the strict ordering above. A `restoration` head may name
164
171
  `storeBase` instead of `remoteRef`. Then `provision` receives
165
172
  `restoreStored({ exec, workspacePath, sha })`: when the commit is absent, call
166
173
  it with your trusted transport, and fail provisioning when it resolves false.
@@ -0,0 +1,43 @@
1
+ # Stopping processes on a shared host
2
+
3
+ Several builds' agents and the kernel's verify commands run side by side on
4
+ one host. A name or pattern kill matches every process with that name, so it
5
+ also stops other builds' work. The victim's verify check records an ordinary
6
+ failed attempt and spends verify budget, and nothing in its output tells the
7
+ kill apart from a real failure.
8
+
9
+ ## Rule
10
+
11
+ Stop only processes your session started, by the PID or process group you
12
+ recorded when you started them.
13
+
14
+ ## Forbidden
15
+
16
+ - `pkill`, `pkill -f`, `killall`, `kill $(pgrep …)`.
17
+ - Any selection by command name or pattern, including names that look like
18
+ yours: `tsc`, `node`, `bun`, browsers, dev servers.
19
+
20
+ ## Recipes
21
+
22
+ | Need | Do |
23
+ |---|---|
24
+ | Stop a background command | `cmd & pid=$!` when starting it, then `kill "$pid"` |
25
+ | Stop a process tree | `setsid cmd & pid=$!`, then `kill -TERM -- -"$pid"` |
26
+ | Bound a command's runtime | `timeout 300 cmd`, or the harness's own background-task stop |
27
+ | The PID was lost | Leave the process; it ends with the session's teardown. Never hunt for it by name. |
28
+
29
+ **Not yours:** the kernel's verify check commands and every other session's
30
+ processes, whatever their names.
31
+
32
+ ## Reading a signal-killed verify report
33
+
34
+ A check command that dies from a signal names the signal on the first line
35
+ of its `verify-report:<step>` artifact, and its metadata carries `signal` and
36
+ `runnerShutdown`.
37
+
38
+ - `runnerShutdown: false` — the runner's own shutdown was not in effect, so
39
+ another process sent the signal. Rerun the check before changing code, and
40
+ record it with `ab observe` if it recurs.
41
+ - `runnerShutdown: true` — the runner stopped the check during its own
42
+ shutdown. That is an orderly stop: not a failure, not counted, and the step
43
+ reruns after relaunch.
@@ -899,6 +899,13 @@ The member is additive and keeps the protocol version. A digest without it is
899
899
  an older service's answer: the activity pass fails closed with a typed
900
900
  capability error and never reads the build's events instead.
901
901
 
902
+ `releasePending` is `true` on a completed build whose PR merged while its
903
+ workspace is still open (no `workspace.released` after its latest
904
+ `workspace.provisioned` or `workspace.cleanup-required`). It keeps the build in
905
+ the dispatcher's janitor work set until its release lands. The member is
906
+ additive and keeps the protocol version; an older service omits it, and its
907
+ clients retry a merged build's pending release only once the service deploys.
908
+
902
909
  The digest is derived from the event log on every call — the server persists
903
910
  nothing and there is no refresh step. Protocol version `3` reshaped the
904
911
  digest's `observations` from bare sequence numbers to `{seq, ts}` pairs and
@@ -199,8 +199,17 @@ displaced heads and the temporary change, best effort, per commit:
199
199
  transaction reserves again from the published branches.
200
200
  - Workspace preservation is strict: archive ref, else a `history-objects-<sha>`
201
201
  store copy over the preservation base, else release is refused. Abort cleanup
202
- is the one exception: when preservation fails it records
203
- `workspace.commits-lost` and releases. Store-kept
202
+ is one exception: when preservation fails it records
203
+ `workspace.commits-lost` and releases. Merged completion is the other: the
204
+ merged commit is on the target, so a merged build's workspace is released
205
+ without preservation, after `build.completed` is recorded.
206
+ Before cleanup, a pending `publication.requested` is covered when its commit
207
+ equals the merged PR's head or landing, or a host-side forge ancestry proof
208
+ places it below either. A covered request is recorded `publication.lost`
209
+ without settlement; an uncovered request, or one whose ancestry is unknown,
210
+ is settled as every release settles it. A cleanup the pass cannot finish
211
+ leaves the build completed with `releasePending` set, and later janitor
212
+ visits retry it. Store-kept
204
213
  heads go on decisive `workspace.commits-retained`, and replacement
205
214
  provisioning restores them on any host.
206
215
 
package/docs/setup.md CHANGED
@@ -416,6 +416,9 @@ repositories or configuration through parent directories, including focused test
416
416
  and Git probes. Do not relocate required installed tooling or retained evidence;
417
417
  manifest-directed artifact paths remain authoritative. Never commit scratch.
418
418
 
419
+ Stop only processes the session started, by recorded PID or process group;
420
+ see [process ownership](process-ownership.md).
421
+
419
422
 
420
423
  1. Run `ab context` and read `"$AB_CONTEXT_DIR/context.json"`. The verifier receives
421
424
  `$AB_CONTEXT_DIR/spec.md`, the configured step,
@@ -519,8 +522,10 @@ Archive refs are a recommendation (WARN or UNKNOWN, never FAIL):
519
522
  build and proceed.
520
523
  - **Workspace preservation** keeps unpublished workspace commits as BuildStore
521
524
  copies where refused, and refuses to release the workspace only when the store
522
- copy fails too. Abort cleanup is the exception: it records
523
- `workspace.commits-lost` and releases.
525
+ copy fails too. Abort cleanup is one exception: it records
526
+ `workspace.commits-lost` and releases. Merged completion is the other: the
527
+ merged PR head already covers the work, so the workspace is released without
528
+ preservation after the build completes.
524
529
 
525
530
  Require **linear history** on protected root and node target branches to prevent
526
531
  merge commits from GitHub's update-branch action. On the configured root, enable
@@ -55,7 +55,7 @@ For example: `steps = ["types", ["unit", "integration"], ["acceptance", "docs"]]
55
55
 
56
56
  | Kind | Runs | Outcome |
57
57
  |---|---|---|
58
- | `check` | a named `command` from `[commands]`, no agent | exit 0 passes; nonzero fails, keeping the output |
58
+ | `check` | a named `command` from `[commands]`, no agent | exit 0 passes; nonzero fails, keeping the output. A command killed by a signal says so in its report, with whether Autobuild's own shutdown was in effect; a check Autobuild's shutdown stops leaves an uncounted report and reruns |
59
59
  | `agent` | the exact `skill` you configure ([repository-local](skills.md#add-a-repository-local-skill), no prefix inferred) | `ab verdict` records pass, fail or skip |
60
60
 
61
61
  - **Pass** satisfies the member; the next stage waits for its siblings.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defrex/autobuild",
3
- "version": "1.19.0",
3
+ "version": "1.20.0",
4
4
  "description": "Agent-driven software delivery from groomed ticket to merged PR",
5
5
  "repository": {
6
6
  "type": "git",
@@ -162,8 +162,8 @@
162
162
  },
163
163
  "devDependencies": {
164
164
  "@biomejs/biome": "2.5.5",
165
- "@defrex/autobuild-postgres-store": "1.19.0",
166
- "@defrex/autobuild-vercel-sandbox": "1.19.0",
165
+ "@defrex/autobuild-postgres-store": "1.20.0",
166
+ "@defrex/autobuild-vercel-sandbox": "1.20.0",
167
167
  "@resvg/resvg-js": "2.6.2",
168
168
  "@types/bun": "^1.3.14",
169
169
  "@types/node": "^24.0.0",
@@ -536,6 +536,7 @@ export function statusBasis(state: BuildState): StatusBasis | undefined {
536
536
  ...(settled !== undefined ? { settled } : {}),
537
537
  ...(reviseSpecPending(state) ? { reviseSpec: true as const } : {}),
538
538
  ...(waitTickets?.length ? { waitTickets } : {}),
539
+ ...(state.prState === 'merged' ? { merged: true as const } : {}),
539
540
  }
540
541
  }
541
542
 
@@ -110,6 +110,8 @@ export interface StatusBasis {
110
110
  /** A completed build with an open escalation, raised after completion; it
111
111
  * rests `blocked` until an operator acknowledges it. */
112
112
  done?: true
113
+ /** The PR merged; completion is pending. A merged build holds no slot. */
114
+ merged?: true
113
115
  }
114
116
 
115
117
  /** The basis a hand-built row without one implies from its status alone. */
@@ -174,6 +176,7 @@ export function buildStatusText(input: {
174
176
  )
175
177
  // No slot: a pending pause or abort waits for its acknowledgement.
176
178
  if (basis.resting === 'blocked') return buildWord(status, 'BLOCKED')
179
+ if (basis.merged) return buildWord(status, 'MERGING', 'merged')
177
180
  if (basis.resting === 'waiting')
178
181
  return buildWord(
179
182
  status,
@@ -8520,6 +8520,7 @@
8520
8520
  "$.reclaimed: array",
8521
8521
  "$.terminal: string",
8522
8522
  "$.ticketWait: undefined",
8523
+ "$.workspaceOpen: boolean",
8523
8524
  "$: object"
8524
8525
  ],
8525
8526
  "sandboxStates": [
@@ -0,0 +1,92 @@
1
+ {
2
+ "records": [
3
+ {
4
+ "name": "buildDigest",
5
+ "identity": "buildDigest",
6
+ "revisions": [
7
+ "buildDigest/fold/2lfn4ripe4",
8
+ "buildDigest/fold/8fy0afqcn5",
9
+ "buildDigest/fold/r14f4ydbcd",
10
+ "buildDigest/shape/7dw02b53nl",
11
+ "buildDigest/shape/gfei8y6315",
12
+ "buildDigest/shape/qr2vs0xtvj"
13
+ ],
14
+ "entries": {
15
+ "017d8dd5bb6dd80b": "a2d0d3d0a39f884b33fe5b29c625af68",
16
+ "10a4657408d4e121": "a2d0d3d0a39f884b33fe5b29c625af68",
17
+ "1411d1cdbdd9911e": "a2d0d3d0a39f884b33fe5b29c625af68",
18
+ "1444fe1fa7fc802c": "a2d0d3d0a39f884b33fe5b29c625af68",
19
+ "178e12f1759b7552": "a2d0d3d0a39f884b33fe5b29c625af68",
20
+ "1921f86f752428c9": "a2d0d3d0a39f884b33fe5b29c625af68",
21
+ "1972c1d66008ef6b": "a2d0d3d0a39f884b33fe5b29c625af68",
22
+ "19e8e43e7f3f1a06": "a2d0d3d0a39f884b33fe5b29c625af68",
23
+ "21ce2c0bf58318e1": "a2d0d3d0a39f884b33fe5b29c625af68",
24
+ "293dcb3a94fb3470": "d31462f05a2e2dae5c72b866f1a5aed7",
25
+ "2ab7436356267118": "a2d0d3d0a39f884b33fe5b29c625af68",
26
+ "2d084641735caaff": "a2d0d3d0a39f884b33fe5b29c625af68",
27
+ "3237bcecf68e5db9": "a2d0d3d0a39f884b33fe5b29c625af68",
28
+ "33d0cc593610e56f": "733ce596c7746a0eafa1a42bd9002fa2",
29
+ "35cf9ccc4478b2d2": "a2d0d3d0a39f884b33fe5b29c625af68",
30
+ "3649e7bd1203f154": "a2d0d3d0a39f884b33fe5b29c625af68",
31
+ "38c75099d9191471": "c5ea86ea0f58a25ad232aaab30bf5f24",
32
+ "431c9bb2ee8838e0": "a2d0d3d0a39f884b33fe5b29c625af68",
33
+ "49064fc079964a5c": "21786745663a1f172058676e1f4ac3d3",
34
+ "4932c70a2af97faf": "a2d0d3d0a39f884b33fe5b29c625af68",
35
+ "4f00c0f2c8afd159": "a2d0d3d0a39f884b33fe5b29c625af68",
36
+ "516a5a7aadf97587": "a2d0d3d0a39f884b33fe5b29c625af68",
37
+ "536085773daf6b58": "4406d99a8a9b53c1f06df3b54b3252fd",
38
+ "59ffaa6974094c72": "a2d0d3d0a39f884b33fe5b29c625af68",
39
+ "5f0ca42af862c4ee": "097ce77f4c3f47f1507131bbb69eb1a4",
40
+ "6118031132db9bfc": "a2d0d3d0a39f884b33fe5b29c625af68",
41
+ "643d70429ce03dad": "097ce77f4c3f47f1507131bbb69eb1a4",
42
+ "677ea92572c29082": "a2d0d3d0a39f884b33fe5b29c625af68",
43
+ "6ae5bf60504d6467": "670a882990170585207e95b5cdcf1c93",
44
+ "6bd6275061aaffa5": "a2d0d3d0a39f884b33fe5b29c625af68",
45
+ "6efdc8defc75fccb": "a2d0d3d0a39f884b33fe5b29c625af68",
46
+ "7833e42d16301424": "1fb775713fd7c044e18d0f949b13eea6",
47
+ "7d4edad0614adaf1": "a2d0d3d0a39f884b33fe5b29c625af68",
48
+ "837365898d04f45a": "a2d0d3d0a39f884b33fe5b29c625af68",
49
+ "85f9f0c921b8b5bb": "2fba78b7f57b8e4cc307a5abbb86a6c0",
50
+ "8879f57a24733897": "76cac9107e404e323c125d37254e84e9",
51
+ "88cb9e71bdec972d": "5484ba6742bece7b2e0ba8819fc89848",
52
+ "89625654b02e9ac1": "a2d0d3d0a39f884b33fe5b29c625af68",
53
+ "8cc15eb1807c0157": "a2d0d3d0a39f884b33fe5b29c625af68",
54
+ "8ced97c44bc0af3a": "a2d0d3d0a39f884b33fe5b29c625af68",
55
+ "8d4144004720b9f8": "a2d0d3d0a39f884b33fe5b29c625af68",
56
+ "8db633ead1807f8b": "a2d0d3d0a39f884b33fe5b29c625af68",
57
+ "8e42cdbd0994ab0c": "a2d0d3d0a39f884b33fe5b29c625af68",
58
+ "9539b995af5c54a9": "a2d0d3d0a39f884b33fe5b29c625af68",
59
+ "9ee3919fbd4f9458": "a2d0d3d0a39f884b33fe5b29c625af68",
60
+ "a0b32c12e4e6edb6": "a2d0d3d0a39f884b33fe5b29c625af68",
61
+ "a55218252707bdd3": "689bac6f9b5c7bd90d9524eaca58122f",
62
+ "a98af134be2da8a9": "a2d0d3d0a39f884b33fe5b29c625af68",
63
+ "af953392d81911da": "b7371c4e191ae3cd4dcfdd8209937329",
64
+ "b0d877c44810ecb0": "a2d0d3d0a39f884b33fe5b29c625af68",
65
+ "be211f0e31a65006": "67e0fa2cfa5adc5fb40bd74d7cc310e4",
66
+ "c68b7ee2e2610f30": "a2d0d3d0a39f884b33fe5b29c625af68",
67
+ "c7f7e0378aeea237": "a2d0d3d0a39f884b33fe5b29c625af68",
68
+ "c98cb1659eb142b6": "a2d0d3d0a39f884b33fe5b29c625af68",
69
+ "ca830adf06ed55a1": "d05cca66d0eb8361e95db1567f15266d",
70
+ "cb3a219f33e437ca": "a2d0d3d0a39f884b33fe5b29c625af68",
71
+ "cf1e0c0d82567e0c": "a2d0d3d0a39f884b33fe5b29c625af68",
72
+ "d1432a819d8e48c5": "ded9c93e2c31e63ecda783a1c14603be",
73
+ "d185ed6aa9192aff": "a2d0d3d0a39f884b33fe5b29c625af68",
74
+ "d5d5ccca80a893d8": "097ce77f4c3f47f1507131bbb69eb1a4",
75
+ "d873fad29d6c7e55": "a2d0d3d0a39f884b33fe5b29c625af68",
76
+ "e2f18fa32fe1f6d0": "a2d0d3d0a39f884b33fe5b29c625af68",
77
+ "e37393fed29e84c5": "a2d0d3d0a39f884b33fe5b29c625af68",
78
+ "e6a8585e2a054ff6": "a2d0d3d0a39f884b33fe5b29c625af68",
79
+ "eb7ddd5319d09e27": "a2d0d3d0a39f884b33fe5b29c625af68",
80
+ "eca4959b2b87ae15": "f226faf9a216209468a09e99297331ad",
81
+ "ee10d7959ec4843c": "a2d0d3d0a39f884b33fe5b29c625af68",
82
+ "ef1b68347966ab26": "a2d0d3d0a39f884b33fe5b29c625af68",
83
+ "f3e55425cc41f230": "d05cca66d0eb8361e95db1567f15266d",
84
+ "f5b9ace9b59351e7": "a2d0d3d0a39f884b33fe5b29c625af68",
85
+ "f8155387eb5f375c": "92337ee35b617424d494c23dff1be345",
86
+ "fa8f1475a55be935": "a2d0d3d0a39f884b33fe5b29c625af68",
87
+ "fb21116a15d0b1f1": "a2d0d3d0a39f884b33fe5b29c625af68",
88
+ "fe95444fbeabe592": "a2d0d3d0a39f884b33fe5b29c625af68"
89
+ }
90
+ }
91
+ ]
92
+ }
@@ -42,7 +42,8 @@ import {
42
42
  * Release follows state; acquisition never does, so a leaf whose outside
43
43
  * wait ended asks for a slot (`slotRequest`) and holds none until it is
44
44
  * admitted again. Runner liveness plays no part in a leaf's hold (only launch
45
- * records and execution facts do), and its workspace never counts. A node
45
+ * records and execution facts do), and its workspace never counts. A build
46
+ * whose PR merged holds and requests no slot (`prMerged`). A node
46
47
  * holds a slot only once the dispatcher admitted it for a runner need it still has (`nodeHoldsSlot`); a workspace,
47
48
  * a lease or a provisioning marker never takes one. */
48
49
  export interface CapacityBuild {
@@ -296,6 +297,13 @@ function terminal(state: BuildState): boolean {
296
297
  return state.status === 'done' || state.status === 'aborted'
297
298
  }
298
299
 
300
+ /** The build's PR merged: its work is on the target, and only completion and
301
+ * cleanup remain, which are the dispatcher's own and need no runner. A merged
302
+ * build holds and requests no slot, even before `build.completed`. */
303
+ function prMerged(state: BuildState): boolean {
304
+ return state.prState === 'merged'
305
+ }
306
+
299
307
  /** A nonterminal leaf that finished its pipeline (every verify step and
300
308
  * finalize post-step) for the current spec at least once, as recorded by
301
309
  * `pipeline.settled`. A spec revision after settlement makes it unfinished,
@@ -406,6 +414,7 @@ function blockedOnlyByEscalations(build: LeafSlotFacts): boolean {
406
414
  export function leafHoldsSlot(build: LeafSlotFacts): boolean {
407
415
  return (
408
416
  !terminal(build.state) &&
417
+ !prMerged(build.state) &&
409
418
  slotAdmitted(build.state) &&
410
419
  (!leafOutsideWait(build) ||
411
420
  (blockedOnlyByEscalations(build) && escalationCarried(escalationCarryInput(build.state))))
@@ -526,7 +535,8 @@ export function nodeOutsideWait(state: BuildState): boolean {
526
535
  * provisioning marker or live lease. */
527
536
  export function nodeHoldsSlot(build: CapacityBuild, now: Date): boolean {
528
537
  const { state } = build
529
- if (state.kind !== 'node' || terminal(state) || nodeOutsideWait(state)) return false
538
+ if (state.kind !== 'node' || terminal(state) || prMerged(state) || nodeOutsideWait(state))
539
+ return false
530
540
  const needs = nodeRunnerNeeds(state)
531
541
  if (state.slotAdmittedSeq === undefined) return needs.length > 0 && runnerAllocated(build, now)
532
542
  const need = state.slotAdmittedNeed
@@ -580,7 +590,7 @@ export function legacyNodeRunnerNeed(build: CapacityBuild, now: Date): NodeSlotN
580
590
 
581
591
  export function occupiesCapacity(build: CapacityBuild, now: Date): boolean {
582
592
  const { state } = build
583
- if (terminal(state)) return false
593
+ if (terminal(state) || prMerged(state)) return false
584
594
  if (state.kind !== 'node') return leafHoldsSlot(build)
585
595
  return nodeHoldsSlot(build, now) || legacyNodeRunner(build, now)
586
596
  }
@@ -591,6 +601,7 @@ export function leafSlotRequest(build: LeafSlotFacts): SlotRequest | undefined {
591
601
  const { state } = build
592
602
  if (
593
603
  terminal(state) ||
604
+ prMerged(state) ||
594
605
  leafHoldsSlot(build) ||
595
606
  leafOutsideWait(build) ||
596
607
  // Mixed-version deferral withholds every decision, admission included.
@@ -630,6 +641,7 @@ export function nodeSlotNeed(build: CapacityBuild, now: Date): NodeSlotNeed | un
630
641
  state.kind !== 'node' ||
631
642
  state.status === 'done' ||
632
643
  state.status === 'aborted' ||
644
+ prMerged(state) ||
633
645
  state.status === 'paused' ||
634
646
  state.status === 'blocked' ||
635
647
  // Mixed-version deferral withholds every decision, admission included.