@defrex/autobuild 1.18.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 (63) hide show
  1. package/README.md +1 -1
  2. package/SPEC.md +97 -18
  3. package/docs/architecture.md +53 -16
  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/cli/dispatch.ts +2 -0
  18. package/packages/core/src/events/catalog-identity.ts +3 -1
  19. package/packages/core/src/events/payloads.ts +7 -1
  20. package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +1 -0
  21. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/3f0c4e6d1d54e5bf.json +92 -0
  22. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/e012e9e8f3e82935.json +424 -0
  23. package/packages/core/src/kernel/dispatch-capacity.ts +15 -3
  24. package/packages/core/src/kernel/engine.ts +15 -2
  25. package/packages/core/src/kernel/janitor-failure.ts +2 -0
  26. package/packages/core/src/kernel/reducer-revisions.ts +5 -0
  27. package/packages/core/src/kernel/reducer.ts +6 -0
  28. package/packages/core/src/kernel/session-settlement.ts +82 -0
  29. package/packages/core/src/processes/build-runner.ts +167 -36
  30. package/packages/core/src/processes/check-termination.ts +44 -0
  31. package/packages/core/src/processes/dispatcher.ts +295 -21
  32. package/packages/core/src/processes/execution-settlement.ts +30 -0
  33. package/packages/core/src/processes/publication-loss.ts +29 -0
  34. package/packages/core/src/processes/repo-view.ts +2 -1
  35. package/packages/core/src/store/contract.ts +43 -0
  36. package/packages/core/src/store/digest.ts +19 -1
  37. package/packages/core/src/store/reducer-value-shapes.json +2742 -2709
  38. package/packages/core/src/store/remote/protocol.ts +3 -0
  39. package/packages/core/src/store/remote/released-clients.json +22 -0
  40. package/packages/core/src/store/remote/released-reducer-values/1.19.0.json +36461 -0
  41. package/packages/core/src/store/remote/released-reducer-values/1.20.0.json +36469 -0
  42. package/packages/core/src/store/remote/released-reducer-values/index.ts +20 -16
  43. package/packages/core/src/store/types.ts +5 -0
  44. package/packages/core/src/testing/reduced-read-budget.ts +167 -0
  45. package/skills/code-review/SKILL.md +5 -0
  46. package/skills/finalize/SKILL.md +5 -0
  47. package/skills/guide/SKILL.md +42 -17
  48. package/skills/guide/references/merge-policy.md +2 -1
  49. package/skills/guide/references/plugin-authoring.md +11 -4
  50. package/skills/guide/references/process-ownership.md +43 -0
  51. package/skills/guide/references/remote-store-protocol.md +7 -0
  52. package/skills/guide/references/restacking.md +11 -2
  53. package/skills/guide/references/setup.md +7 -2
  54. package/skills/harvest/SKILL.md +5 -0
  55. package/skills/harvest-review/SKILL.md +5 -0
  56. package/skills/implement/SKILL.md +5 -0
  57. package/skills/judge/SKILL.md +4 -0
  58. package/skills/operate/SKILL.md +5 -0
  59. package/skills/plan/SKILL.md +5 -0
  60. package/skills/plan-review/SKILL.md +5 -0
  61. package/skills/propose/SKILL.md +5 -0
  62. package/skills/reconcile/SKILL.md +5 -0
  63. 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.18.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
@@ -792,7 +793,11 @@ next stage, or finalize after the last, waits for every member to pass or skip.
792
793
  On a normal stage transition the runner drains agent turns before stage-local
793
794
  shutdown: a terminal may precede trailing artifacts, transcript deposit and
794
795
  `session.ended`. Parent shutdown and session budgets still interrupt this drain;
795
- fail-fast retains immediate whole-execution cancellation.
796
+ fail-fast retains immediate whole-execution cancellation. A member's session is
797
+ ended once its step has an outcome, before the next stage or finalize starts.
798
+ When the adapter yields no endable handle or transcript after the terminal, the
799
+ runner ends it `reclaimed` rather than leaving it open; any agent phase whose
800
+ terminal is durable closes its bracket the same way.
796
801
 
797
802
  By default a failure lets all siblings finish; the settled stage routes once
798
803
  with every failed report, and no later stage runs. `failFast = true` on either
@@ -2197,6 +2202,14 @@ The verdict vocabulary is phase-dependent and the CLI enforces it: review
2197
2202
  phases accept `approve|revise|escalate`; agent-verify steps accept
2198
2203
  `pass|fail|skip` (`fail` requires a report; `skip` requires a reason).
2199
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.
2200
2213
  Exact flags and validation live with the CLI implementation and its tests.
2201
2214
 
2202
2215
  ### 8.3 What `ab context` materializes
@@ -2726,7 +2739,11 @@ Local git-worktree runners suspend an interrupted agent turn on dispatcher
2726
2739
  SIGINT/SIGTERM. A conditional artifact deposit records `session.suspended`
2727
2740
  with cause `shutdown`, the native handle, active milliseconds, partial transcript
2728
2741
  and any known incremental usage. A terminal fact that lands first prevents
2729
- suspension; suspension fences the old session's terminal credentials permanently.
2742
+ suspension and ends the bracket instead, `reclaimed` when no transcript is
2743
+ available; a remote shutdown does the same for a finished occurrence.
2744
+ Suspension fences the old session's terminal credentials permanently. A
2745
+ dispatcher-settled suspension (below) also carries the ended `execution
2746
+ {instance, outcome}`; its continuation cause is `runner-loss`.
2730
2747
  Graceful shutdown waits for provider cleanup and durable suspension without a
2731
2748
  wall-clock force-exit deadline. Only after the runner leader exits does bounded
2732
2749
  process-group cleanup reap remaining descendants. Abnormal parent loss retains
@@ -3458,7 +3475,12 @@ A build releases its slot as soon as it waits on the outside world:
3458
3475
  | another ticket | an entered ticket wait (§11) |
3459
3476
  | the forge | a finished pipeline waiting for merge gates or for the forge to merge |
3460
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 |
3461
- | 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.
3462
3484
 
3463
3485
  A pipeline is finished once every verify step and every finalize post-step for
3464
3486
  the current spec has passed. The dispatcher records the finish as an advisory
@@ -5415,7 +5437,7 @@ using a slot and the word tells why.
5415
5437
  | | held | `ABORTING` | an abort was requested and the runner is still stopping |
5416
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 |
5417
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`) |
5418
- | | 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`) |
5419
5441
  | | none | `PAUSED` | an acknowledged pause |
5420
5442
  | | none | `COLLECTING` | an integration build collecting child work |
5421
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 |
@@ -5428,7 +5450,8 @@ holding a slot shows them. A build without a slot keeps its word until the
5428
5450
  acknowledgement, which is not gated. A resumed pause is `QUEUED` until it is
5429
5451
  admitted again; there is no separate resuming word. The reducer's `queued` and
5430
5452
  `running` statuses are lifecycle facts, not display words: a newly claimed
5431
- 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.
5432
5455
 
5433
5456
  A harvest run is never a build and never holds a slot. Its row shows
5434
5457
  `HARVESTING` (teal) while it works, `PAUSED` or `SUSPENDED` (amber) while it is
@@ -5549,7 +5572,7 @@ with illustrative members:
5549
5572
  | Operator commands [D2] | `build.abort-requested {reason?, to?, origin?: {kind: optimization-stop, node}}` → `build.aborted` (a human, or the dispatcher for an attempt of a stopped optimization node, §13.1.1); `build.pause-requested` → `build.paused`; `build.discard-requested`; `build.hold-requested {reason?}`; `build.priority-set {priority, level?}` (advisory slot-admission level, §12); `build.land-requested` → `landing.command-acknowledged`; decisive human `build.reopened {feedback?, spec?: {artifact, assets?}}` (§15.7); `escalation.answered` (optionally carrying a validated `reviewRoundCeiling`, or the `assets` sampled with a revise-from-ticket authorization) |
5550
5573
  | Merge policy | `landing.decided` (candidate, matched rule/default, labels, target, mode, matched `paths?` summary); advisory `landing.deferred` (candidate, reason, rule, policy); kernel `landing.consent-revoked {commandSeq, source, rule, previousHead, head, consentedHead?, paths}`; `landing.native-enable-started`; `landing.native-applied`; advisory dispatcher `landing.polling-selected {candidate, decisionSeq, commandSeq?, detail}` and `landing.human-merge-required {candidate, decisionSeq, commandSeq?, cause: merge-queue-rule \| merge-queue-activity \| merge-refused, detail}` |
5551
5574
  | Spec | `spec.imported`, `spec.authored`, `spec.revised` (either positive `escalation` sequence or exclusive `operator: {user, via?}` provenance for an idle node or a settled leaf's reopen, §15.7; optionally carrying `assets`, a re-pin of the ticket's assets, §6.3) |
5552
- | Sessions | `session.started` (including optional write-ahead continuation intent, budget ceiling, and the effective first `prompt` the bracket sent: the start prompt, the live continuation message, or the interruption notice); `session.suspended` with partial transcript and active duration; `session.resumed` acceptance (stale reports are inert); reasoned `session.resume-fallback`; kernel-only `session.native-handle-recorded` with bracket and native execution identity; `session.ended` with transcript ref and usage (ordinary completion — the analysis corpus), or `session.ended {outcome: reclaimed, reclaimedBy: {instance, resumedFromSeq}}` (explicit transcriptless takeover) |
5575
+ | Sessions | `session.started` (including optional write-ahead continuation intent, budget ceiling, and the effective first `prompt` the bracket sent: the start prompt, the live continuation message, or the interruption notice); `session.suspended` with partial transcript and active duration (and, when the dispatcher settled it after its execution ended, that `execution {instance, outcome}`); `session.resumed` acceptance (stale reports are inert); reasoned `session.resume-fallback`; kernel-only `session.native-handle-recorded` with bracket and native execution identity; `session.ended` with transcript ref and usage (ordinary completion — the analysis corpus), or `session.ended {outcome: reclaimed, reclaimedBy: {instance, resumedFromSeq}}` (explicit transcriptless takeover) |
5553
5576
  | Plan/code loops | `plan.started` … `plan-review.verdict`; `implement.started` … `code-review.verdict`; agent `implement.declined {round, reason, artifact?}` (decisive), an optimization attempt's alternative implement terminal: the build completes `closed-unmerged` and the dispatcher writes `attempt.settled {outcome: declined, note}` on the node (§13.1.1) |
5554
5577
  | Verify/finalize | `verify.started {step, attempt, feedback?, baseSha?, headSha?, restackId?}`, `verify.completed {step, outcome, skipCause?: post-reconcile-policy \| clean-restack-policy, baseSha?, headSha?, restackId?}`, `verify.cancelled {step, attempt, cause: {step}, baseSha?, headSha?, restackId?}`, `verify.stage-failed {attempt, cycle, stage, failed, cancelled, baseSha?, headSha?, restackId?}`, `verify.reconcile-policy-captured {reconcileSeq, steps}`, `finalize.completed {pr}`, `finalize.step-started {step}`, `finalize.step-completed {step, ok, headSha?}` |
5555
5578
  | Integration attention | Kernel/dispatcher `integration.verification-failed {id, head, parent, steps, guidance}`: one durable failed-cycle notification, recovered from exact verification receipts |
@@ -5966,6 +5989,14 @@ janitor's work set until the moves commit, and a settlement recorded on an
5966
5989
  already completed node re-arms it through the node's incrementally advanced
5967
5990
  digest, with no repository scan.
5968
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
+
5969
6000
  **Optimization read cost.** The digest's size does not grow with settled
5970
6001
  attempts: admission caps `inFlight` plus `rejections` at the objective's concurrency, and
5971
6002
  settled attempts leave only counters. The dispatcher, the dashboards, status
@@ -6094,7 +6125,7 @@ code-review.started{r1} → code-review.verdict{approve}
6094
6125
  verify.started{types} → verify.completed{outcome:pass} → …unit
6095
6126
  verify.started{acceptance} → pr-attachment.designated{artifact,filename,mediaType} → verify.completed{outcome:pass}
6096
6127
  finalize.started → pr-attachment.hosted{designationSeq,asset} → finalize.completed{pr} → finalize.step-completed{release-notes}
6097
- (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
6098
6129
  ```
6099
6130
 
6100
6131
  **Interrupted dispatch:** if the log stops after `build.created`, a later
@@ -6253,8 +6284,8 @@ The setup target belongs only to escalation metadata and is not a pipeline `Phas
6253
6284
  native continuation described in §9. The following remote-sandbox recovery
6254
6285
  retains its fresh-session fallback.
6255
6286
 
6256
- Before releasing or replacing a build workspace, the dispatcher confirms a
6257
- 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.
6258
6289
  It preserves unpublished branch commits and distinct detached producer candidates
6259
6290
  under immutable `refs/autobuild/archive/<build>/<sha>` refs, verifies their exact
6260
6291
  readback, and records `workspace.commits-preserved` before cleanup. Where the
@@ -6383,17 +6414,44 @@ every actionable build on its first tick rather than waiting for the sweep;
6383
6414
  lease claiming stays the exclusivity gate, so a genuinely live old runner
6384
6415
  wins harmlessly.
6385
6416
 
6386
- A running, unblocked, unpaused build with an orphaned open session has pending
6387
- kernel cleanup even when the phase engine waits on its PR. With no live lease
6388
- or execution, the next admitted sweep attaches a runner through ordinary session
6417
+ Sessions open only inside executions, so an execution that ends never leaves
6418
+ its sessions open. When a build has a recorded execution, none is open, no
6419
+ live lease is held and sessions remain open, the dispatcher settles every one
6420
+ of them in place at its next sweep or janitor visit, without launching a
6421
+ runner. A pause, an open escalation, a pending abort or a terminal status does
6422
+ not defer this. A done or aborted build, or one with an abort pending, resumes
6423
+ nothing, so every session it left open is ended `reclaimed`; the janitor does
6424
+ this before abort cleanup, and the dispatcher that records a terminal build's
6425
+ `execution.ended` first ends the sessions that execution left open, so a
6426
+ crash between the two leaves the execution open and the build visited. On any
6427
+ other build, an unfinished occurrence that carries a native handle — the one the
6428
+ engine runs next, or, while a hold keeps the engine waiting, one with no
6429
+ durable terminal (an outcome, its own escalation or wait, a failure, or a
6430
+ completed phase) — is `session.suspended` with cause `shutdown`, a placeholder
6431
+ transcript and the ended `execution {instance, outcome}`; the next runner
6432
+ resumes it natively as a runner loss, or records the ordinary fallback where
6433
+ native resume is unavailable. Every other open session — a step that already
6434
+ has its outcome, a superseded round or attempt, a session with no handle — is
6435
+ ended `reclaimed`.
6436
+ Each write is conditional on the build's cursor, so a runner that attached
6437
+ meanwhile wins and the next visit decides again. The janitor settles before it
6438
+ reads landing readiness, so a finished leaf reaches its landing decision in the
6439
+ same visit. Once settlement closes a remote guest's last session, the host's
6440
+ publication settlement requests and publishes any summary boundary the guest
6441
+ never requested.
6442
+
6443
+ A running, unblocked, unpaused build with an orphaned open session and no
6444
+ recorded execution, or whose settlement lost a race, still has pending kernel
6445
+ cleanup even when the phase engine waits on its PR. With no live lease or
6446
+ execution, the next admitted sweep attaches a runner through ordinary session
6389
6447
  reclamation before summary and landing readiness can proceed. A provider-proved
6390
6448
  end reuses the healthy workspace; a proved loss uses fenced replacement. An
6391
6449
  unobserved open execution is not proof of death. Intentionally suspended sessions
6392
6450
  and idle collecting nodes do not trigger this cleanup. A proved-ended execution
6393
6451
  with actionable work or eligible cleanup bypasses absent-lease first-claim grace;
6394
- never-attached builds retain grace. Detection uses canonical reduced facts, with
6395
- no history replay or new poll. Existing infrastructure failure attention and
6396
- retry budgets govern failed recovery.
6452
+ never-attached builds retain grace. Detection and settlement use canonical
6453
+ reduced facts, with no history replay or new poll. Existing infrastructure
6454
+ failure attention and retry budgets govern failed recovery.
6397
6455
 
6398
6456
  Verification's current result boundary also advances on `verify.config-captured`
6399
6457
  and `verify.config-superseded` (§16.1). These facts do not change reconcile
@@ -6430,6 +6488,26 @@ correlated facts; a failed delete remains pending and retries on later ticks,
6430
6488
  including after the build is already done. A fixup request for a merged or
6431
6489
  closed PR is a *new ticket*, never a reopened build.
6432
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
+
6433
6511
  **Reopening a settled leaf.** An operator who wants changes to a leaf that
6434
6512
  finished its pipeline and waits for its merge decision sends it back with
6435
6513
  `ab reopen <slug> --feedback <text>`, optionally with `--revise-spec <file>` or
@@ -6571,8 +6649,9 @@ Workspace commit preservation (§12 D) is the strict exception: its unpublished
6571
6649
  commits may exist nowhere else. It tries the forge archive ref, then a
6572
6650
  `history-objects-<sha>` store copy excluding the preservation base, and never
6573
6651
  classifies a commit as `target` or proceeds unretained. When both fail, release
6574
- is refused and cleanup stays pending. Abort cleanup is the one exception: it
6575
- 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:
6576
6655
  a later retention of the same commit reuses the existing copy and its saved
6577
6656
  base. Preservation records that base and, when it is no longer an ancestor of
6578
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
@@ -2444,8 +2460,11 @@ Local git-worktree runners suspend an interrupted agent turn on dispatcher
2444
2460
  SIGINT/SIGTERM. A conditional artifact deposit records `session.suspended`
2445
2461
  with cause `shutdown`, the native handle, active milliseconds, partial transcript
2446
2462
  and any known incremental usage. A terminal fact that lands first prevents
2447
- suspension; suspension fences the old session's terminal credentials permanently.
2448
- Graceful shutdown waits for provider cleanup and durable suspension without a
2463
+ suspension and ends the bracket instead, `reclaimed` when no transcript is
2464
+ available; a remote shutdown does the same for a finished occurrence.
2465
+ Suspension fences the old session's terminal credentials permanently. A
2466
+ dispatcher-settled suspension also carries the ended `execution`, and its
2467
+ continuation cause is `runner-loss`. Graceful shutdown waits for provider cleanup and durable suspension without a
2449
2468
  wall-clock force-exit deadline. Only after the runner leader exits does bounded
2450
2469
  process-group cleanup reap remaining descendants. Abnormal parent loss retains
2451
2470
  the detached reaper recovery path.
@@ -2796,14 +2815,32 @@ only live per-member handles and recovery contexts; durable starts, outcomes,
2796
2815
  cancellations and failed-stage receipts drive every barrier and restart.
2797
2816
  Normal stage transitions drain terminal-reached agent turns before stage-local
2798
2817
  interruption, retaining session budgets and parent shutdown. This closes session
2799
- brackets and deposits trailing evidence before summary publication. Fail-fast
2818
+ brackets and deposits trailing evidence before summary publication. A member
2819
+ whose step has an outcome has its bracket ended before the stage returns, as
2820
+ `reclaimed` when the adapter yields no transcript; the runner closes any
2821
+ terminal-reached bracket it cannot end with a transcript the same way. Fail-fast
2800
2822
  cancellation records facts before immediate whole-execution teardown and replacement.
2801
- The dispatcher's lease sweep treats eligible running orphaned open brackets as
2802
- pending cleanup even on an engine wait. It excludes live leases/executions,
2803
- blocked or paused builds and idle collecting nodes, then uses ordinary runner
2804
- attachment/reclamation. Proved-ended pending work bypasses first-claim grace;
2805
- healthy ended workspaces are reused and lost environments follow fenced recovery.
2806
- The predicate uses existing canonical reduced facts and adds no event-log reads. `kernel/verify-stage-state.ts` owns occurrence/session associations,
2823
+ Open sessions of an ended execution are settled in place by the dispatcher,
2824
+ without a runner, at the lease sweep and at the janitor visit before landing
2825
+ readiness, on running, paused, blocked and aborted builds alike. Whoever
2826
+ records `execution.ended` for a done or aborted build (`settleOpenExecution`
2827
+ and the local dispatch exit) first ends its open sessions through
2828
+ `endTerminalBuildSessions`, so a crash in between leaves the execution open
2829
+ and the build visited. The pure partition is
2830
+ `kernel/session-settlement.ts`: a terminal build, or one with an abort pending,
2831
+ ends every session; otherwise an unfinished occurrence with a native handle —
2832
+ the engine's next one, or one whose terminal guard is still clear while a hold
2833
+ keeps the engine waiting — is `session.suspended` (`shutdown`, with the ended
2834
+ `execution`, retained by read decoder revision 13) and resumes as a runner
2835
+ loss; every other session is ended `reclaimed`. Writes are cursor-conditional,
2836
+ and the host's publication settlement then repairs any unrequested summary.
2837
+ The lease sweep still treats eligible running orphaned open brackets with no
2838
+ recorded execution as pending cleanup even on an engine wait. It excludes live
2839
+ leases/executions, blocked or paused builds and idle collecting nodes, then uses
2840
+ ordinary runner attachment/reclamation. Proved-ended pending work bypasses
2841
+ first-claim grace; healthy ended workspaces are reused and lost environments
2842
+ follow fenced recovery. Both paths use existing canonical reduced facts and add
2843
+ no event-log reads. `kernel/verify-stage-state.ts` owns occurrence/session associations,
2807
2844
  including escalation supersession and complete implement feedback references.
2808
2845
 
2809
2846
  Human access uses `postgres-store/src/organizations.ts` and the shared hosted
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.18.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.18.0",
166
- "@defrex/autobuild-vercel-sandbox": "1.18.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,
@@ -247,6 +247,7 @@ import {
247
247
  type PassStageRecord,
248
248
  } from '../processes/pass-stages'
249
249
  import { RepoViewStore } from '../processes/repo-view'
250
+ import { endTerminalBuildSessions } from '../processes/execution-settlement'
250
251
  import {
251
252
  BuildControlError,
252
253
  buildControlUser,
@@ -3991,6 +3992,7 @@ class DispatchLoop {
3991
3992
  const request = (await readBuildFacts(this.repoView, slug)).value.state
3992
3993
  .drainingExecutions?.[instance]?.relaunch
3993
3994
  const relaunch = !active.stopping && exit.exitCode === 0 && !!request
3995
+ await endTerminalBuildSessions(this.repoView, slug, instance)
3994
3996
  await this.repoView.append(slug, {
3995
3997
  actor: DISPATCHER,
3996
3998
  type: 'execution.ended',
@@ -14,7 +14,9 @@ import { buildEventPolicy, repositoryEventPolicy } from './policy'
14
14
  // Revision 11 retains optional forge rate-limit snapshots on tick telemetry
15
15
  // and the optional continued marker on forge degradation.
16
16
  // Revision 12 retains the optional build priority and urgent scan demand.
17
- export const READ_DECODER_REVISION = 12
17
+ // Revision 13 retains the optional ended execution on dispatcher-settled
18
+ // session suspensions.
19
+ export const READ_DECODER_REVISION = 13
18
20
  export function catalogIdentity(
19
21
  build: Record<string, string> = buildEventPolicy,
20
22
  repository: Record<string, string> = repositoryEventPolicy,