@defrex/autobuild 1.18.0 → 1.19.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.
- package/README.md +1 -1
- package/SPEC.md +44 -9
- package/docs/architecture.md +30 -9
- package/package.json +3 -3
- package/packages/core/src/cli/dispatch.ts +2 -0
- package/packages/core/src/events/catalog-identity.ts +3 -1
- package/packages/core/src/events/payloads.ts +7 -1
- package/packages/core/src/kernel/__snapshots__/reducer-identity-records/e012e9e8f3e82935.json +424 -0
- package/packages/core/src/kernel/janitor-failure.ts +1 -0
- package/packages/core/src/kernel/reducer-revisions.ts +4 -0
- package/packages/core/src/kernel/reducer.ts +6 -0
- package/packages/core/src/kernel/session-settlement.ts +82 -0
- package/packages/core/src/processes/build-runner.ts +100 -29
- package/packages/core/src/processes/dispatcher.ts +164 -3
- package/packages/core/src/processes/execution-settlement.ts +30 -0
- package/packages/core/src/store/reducer-value-shapes.json +2655 -2630
- package/packages/core/src/store/remote/released-clients.json +11 -0
- package/packages/core/src/store/remote/released-reducer-values/1.19.0.json +36461 -0
- package/packages/core/src/store/remote/released-reducer-values/index.ts +18 -16
- package/packages/core/src/testing/reduced-read-budget.ts +36 -0
- package/skills/guide/SKILL.md +24 -10
- 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.
|
|
29
|
+
bun add -d --exact @defrex/autobuild@1.19.0
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
<!-- release-install:end -->
|
package/SPEC.md
CHANGED
|
@@ -792,7 +792,11 @@ next stage, or finalize after the last, waits for every member to pass or skip.
|
|
|
792
792
|
On a normal stage transition the runner drains agent turns before stage-local
|
|
793
793
|
shutdown: a terminal may precede trailing artifacts, transcript deposit and
|
|
794
794
|
`session.ended`. Parent shutdown and session budgets still interrupt this drain;
|
|
795
|
-
fail-fast retains immediate whole-execution cancellation.
|
|
795
|
+
fail-fast retains immediate whole-execution cancellation. A member's session is
|
|
796
|
+
ended once its step has an outcome, before the next stage or finalize starts.
|
|
797
|
+
When the adapter yields no endable handle or transcript after the terminal, the
|
|
798
|
+
runner ends it `reclaimed` rather than leaving it open; any agent phase whose
|
|
799
|
+
terminal is durable closes its bracket the same way.
|
|
796
800
|
|
|
797
801
|
By default a failure lets all siblings finish; the settled stage routes once
|
|
798
802
|
with every failed report, and no later stage runs. `failFast = true` on either
|
|
@@ -2726,7 +2730,11 @@ Local git-worktree runners suspend an interrupted agent turn on dispatcher
|
|
|
2726
2730
|
SIGINT/SIGTERM. A conditional artifact deposit records `session.suspended`
|
|
2727
2731
|
with cause `shutdown`, the native handle, active milliseconds, partial transcript
|
|
2728
2732
|
and any known incremental usage. A terminal fact that lands first prevents
|
|
2729
|
-
suspension
|
|
2733
|
+
suspension and ends the bracket instead, `reclaimed` when no transcript is
|
|
2734
|
+
available; a remote shutdown does the same for a finished occurrence.
|
|
2735
|
+
Suspension fences the old session's terminal credentials permanently. A
|
|
2736
|
+
dispatcher-settled suspension (below) also carries the ended `execution
|
|
2737
|
+
{instance, outcome}`; its continuation cause is `runner-loss`.
|
|
2730
2738
|
Graceful shutdown waits for provider cleanup and durable suspension without a
|
|
2731
2739
|
wall-clock force-exit deadline. Only after the runner leader exits does bounded
|
|
2732
2740
|
process-group cleanup reap remaining descendants. Abnormal parent loss retains
|
|
@@ -5549,7 +5557,7 @@ with illustrative members:
|
|
|
5549
5557
|
| 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
5558
|
| 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
5559
|
| 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) |
|
|
5560
|
+
| 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
5561
|
| 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
5562
|
| 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
5563
|
| Integration attention | Kernel/dispatcher `integration.verification-failed {id, head, parent, steps, guidance}`: one durable failed-cycle notification, recovered from exact verification receipts |
|
|
@@ -6383,17 +6391,44 @@ every actionable build on its first tick rather than waiting for the sweep;
|
|
|
6383
6391
|
lease claiming stays the exclusivity gate, so a genuinely live old runner
|
|
6384
6392
|
wins harmlessly.
|
|
6385
6393
|
|
|
6386
|
-
|
|
6387
|
-
|
|
6388
|
-
|
|
6394
|
+
Sessions open only inside executions, so an execution that ends never leaves
|
|
6395
|
+
its sessions open. When a build has a recorded execution, none is open, no
|
|
6396
|
+
live lease is held and sessions remain open, the dispatcher settles every one
|
|
6397
|
+
of them in place at its next sweep or janitor visit, without launching a
|
|
6398
|
+
runner. A pause, an open escalation, a pending abort or a terminal status does
|
|
6399
|
+
not defer this. A done or aborted build, or one with an abort pending, resumes
|
|
6400
|
+
nothing, so every session it left open is ended `reclaimed`; the janitor does
|
|
6401
|
+
this before abort cleanup, and the dispatcher that records a terminal build's
|
|
6402
|
+
`execution.ended` first ends the sessions that execution left open, so a
|
|
6403
|
+
crash between the two leaves the execution open and the build visited. On any
|
|
6404
|
+
other build, an unfinished occurrence that carries a native handle — the one the
|
|
6405
|
+
engine runs next, or, while a hold keeps the engine waiting, one with no
|
|
6406
|
+
durable terminal (an outcome, its own escalation or wait, a failure, or a
|
|
6407
|
+
completed phase) — is `session.suspended` with cause `shutdown`, a placeholder
|
|
6408
|
+
transcript and the ended `execution {instance, outcome}`; the next runner
|
|
6409
|
+
resumes it natively as a runner loss, or records the ordinary fallback where
|
|
6410
|
+
native resume is unavailable. Every other open session — a step that already
|
|
6411
|
+
has its outcome, a superseded round or attempt, a session with no handle — is
|
|
6412
|
+
ended `reclaimed`.
|
|
6413
|
+
Each write is conditional on the build's cursor, so a runner that attached
|
|
6414
|
+
meanwhile wins and the next visit decides again. The janitor settles before it
|
|
6415
|
+
reads landing readiness, so a finished leaf reaches its landing decision in the
|
|
6416
|
+
same visit. Once settlement closes a remote guest's last session, the host's
|
|
6417
|
+
publication settlement requests and publishes any summary boundary the guest
|
|
6418
|
+
never requested.
|
|
6419
|
+
|
|
6420
|
+
A running, unblocked, unpaused build with an orphaned open session and no
|
|
6421
|
+
recorded execution, or whose settlement lost a race, still has pending kernel
|
|
6422
|
+
cleanup even when the phase engine waits on its PR. With no live lease or
|
|
6423
|
+
execution, the next admitted sweep attaches a runner through ordinary session
|
|
6389
6424
|
reclamation before summary and landing readiness can proceed. A provider-proved
|
|
6390
6425
|
end reuses the healthy workspace; a proved loss uses fenced replacement. An
|
|
6391
6426
|
unobserved open execution is not proof of death. Intentionally suspended sessions
|
|
6392
6427
|
and idle collecting nodes do not trigger this cleanup. A proved-ended execution
|
|
6393
6428
|
with actionable work or eligible cleanup bypasses absent-lease first-claim grace;
|
|
6394
|
-
never-attached builds retain grace. Detection
|
|
6395
|
-
no history replay or new poll. Existing infrastructure
|
|
6396
|
-
retry budgets govern failed recovery.
|
|
6429
|
+
never-attached builds retain grace. Detection and settlement use canonical
|
|
6430
|
+
reduced facts, with no history replay or new poll. Existing infrastructure
|
|
6431
|
+
failure attention and retry budgets govern failed recovery.
|
|
6397
6432
|
|
|
6398
6433
|
Verification's current result boundary also advances on `verify.config-captured`
|
|
6399
6434
|
and `verify.config-superseded` (§16.1). These facts do not change reconcile
|
package/docs/architecture.md
CHANGED
|
@@ -2444,8 +2444,11 @@ Local git-worktree runners suspend an interrupted agent turn on dispatcher
|
|
|
2444
2444
|
SIGINT/SIGTERM. A conditional artifact deposit records `session.suspended`
|
|
2445
2445
|
with cause `shutdown`, the native handle, active milliseconds, partial transcript
|
|
2446
2446
|
and any known incremental usage. A terminal fact that lands first prevents
|
|
2447
|
-
suspension
|
|
2448
|
-
|
|
2447
|
+
suspension and ends the bracket instead, `reclaimed` when no transcript is
|
|
2448
|
+
available; a remote shutdown does the same for a finished occurrence.
|
|
2449
|
+
Suspension fences the old session's terminal credentials permanently. A
|
|
2450
|
+
dispatcher-settled suspension also carries the ended `execution`, and its
|
|
2451
|
+
continuation cause is `runner-loss`. Graceful shutdown waits for provider cleanup and durable suspension without a
|
|
2449
2452
|
wall-clock force-exit deadline. Only after the runner leader exits does bounded
|
|
2450
2453
|
process-group cleanup reap remaining descendants. Abnormal parent loss retains
|
|
2451
2454
|
the detached reaper recovery path.
|
|
@@ -2796,14 +2799,32 @@ only live per-member handles and recovery contexts; durable starts, outcomes,
|
|
|
2796
2799
|
cancellations and failed-stage receipts drive every barrier and restart.
|
|
2797
2800
|
Normal stage transitions drain terminal-reached agent turns before stage-local
|
|
2798
2801
|
interruption, retaining session budgets and parent shutdown. This closes session
|
|
2799
|
-
brackets and deposits trailing evidence before summary publication.
|
|
2802
|
+
brackets and deposits trailing evidence before summary publication. A member
|
|
2803
|
+
whose step has an outcome has its bracket ended before the stage returns, as
|
|
2804
|
+
`reclaimed` when the adapter yields no transcript; the runner closes any
|
|
2805
|
+
terminal-reached bracket it cannot end with a transcript the same way. Fail-fast
|
|
2800
2806
|
cancellation records facts before immediate whole-execution teardown and replacement.
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
+
Open sessions of an ended execution are settled in place by the dispatcher,
|
|
2808
|
+
without a runner, at the lease sweep and at the janitor visit before landing
|
|
2809
|
+
readiness, on running, paused, blocked and aborted builds alike. Whoever
|
|
2810
|
+
records `execution.ended` for a done or aborted build (`settleOpenExecution`
|
|
2811
|
+
and the local dispatch exit) first ends its open sessions through
|
|
2812
|
+
`endTerminalBuildSessions`, so a crash in between leaves the execution open
|
|
2813
|
+
and the build visited. The pure partition is
|
|
2814
|
+
`kernel/session-settlement.ts`: a terminal build, or one with an abort pending,
|
|
2815
|
+
ends every session; otherwise an unfinished occurrence with a native handle —
|
|
2816
|
+
the engine's next one, or one whose terminal guard is still clear while a hold
|
|
2817
|
+
keeps the engine waiting — is `session.suspended` (`shutdown`, with the ended
|
|
2818
|
+
`execution`, retained by read decoder revision 13) and resumes as a runner
|
|
2819
|
+
loss; every other session is ended `reclaimed`. Writes are cursor-conditional,
|
|
2820
|
+
and the host's publication settlement then repairs any unrequested summary.
|
|
2821
|
+
The lease sweep still treats eligible running orphaned open brackets with no
|
|
2822
|
+
recorded execution as pending cleanup even on an engine wait. It excludes live
|
|
2823
|
+
leases/executions, blocked or paused builds and idle collecting nodes, then uses
|
|
2824
|
+
ordinary runner attachment/reclamation. Proved-ended pending work bypasses
|
|
2825
|
+
first-claim grace; healthy ended workspaces are reused and lost environments
|
|
2826
|
+
follow fenced recovery. Both paths use existing canonical reduced facts and add
|
|
2827
|
+
no event-log reads. `kernel/verify-stage-state.ts` owns occurrence/session associations,
|
|
2807
2828
|
including escalation supersession and complete implement feedback references.
|
|
2808
2829
|
|
|
2809
2830
|
Human access uses `postgres-store/src/organizations.ts` and the shared hosted
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@defrex/autobuild",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.19.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.
|
|
166
|
-
"@defrex/autobuild-vercel-sandbox": "1.
|
|
165
|
+
"@defrex/autobuild-postgres-store": "1.19.0",
|
|
166
|
+
"@defrex/autobuild-vercel-sandbox": "1.19.0",
|
|
167
167
|
"@resvg/resvg-js": "2.6.2",
|
|
168
168
|
"@types/bun": "^1.3.14",
|
|
169
169
|
"@types/node": "^24.0.0",
|
|
@@ -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
|
-
|
|
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,
|
|
@@ -374,6 +374,7 @@ function refineRegeneration(
|
|
|
374
374
|
}
|
|
375
375
|
|
|
376
376
|
const attempt = z.number().int().positive()
|
|
377
|
+
const executionOutcome = z.enum(['completed', 'stopped', 'lost', 'relaunch'])
|
|
377
378
|
const dispatchStage = z.enum(['create', 'workspace', 'spec', 'comment', 'branch', 'launch'])
|
|
378
379
|
const infrastructureOperation = z.enum([
|
|
379
380
|
'provision',
|
|
@@ -1451,7 +1452,7 @@ export const eventPayloadSchemas = {
|
|
|
1451
1452
|
'execution.ended': z.strictObject({
|
|
1452
1453
|
instance: z.string().min(1),
|
|
1453
1454
|
workspaceRef: z.string().min(1),
|
|
1454
|
-
outcome:
|
|
1455
|
+
outcome: executionOutcome,
|
|
1455
1456
|
exitCode: z.number().int().nullable().optional(),
|
|
1456
1457
|
}),
|
|
1457
1458
|
/** Advisory: an optimization node has accounted this build's first `count`
|
|
@@ -1881,6 +1882,11 @@ export const eventPayloadSchemas = {
|
|
|
1881
1882
|
turns: z.number().int().nonnegative(),
|
|
1882
1883
|
})
|
|
1883
1884
|
.optional(),
|
|
1885
|
+
/** Present only when the dispatcher suspended a session whose execution
|
|
1886
|
+
* had already ended; its continuation is a runner loss. */
|
|
1887
|
+
execution: z
|
|
1888
|
+
.strictObject({ instance: z.string().min(1), outcome: executionOutcome })
|
|
1889
|
+
.optional(),
|
|
1884
1890
|
}),
|
|
1885
1891
|
'session.resumed': z.strictObject({
|
|
1886
1892
|
session: z.string().min(1),
|