@defrex/autobuild 1.13.0 → 1.15.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 +61 -11
- package/docs/answering-blocked-builds.md +5 -3
- package/docs/architecture.md +29 -0
- package/docs/configuration.md +16 -8
- package/docs/dispatcher-hosting.md +10 -0
- package/docs/operating.md +8 -0
- package/docs/operator-api.md +1 -1
- package/docs/operator-surfaces.md +1 -1
- package/docs/remote-store-protocol.md +1 -1
- package/docs/troubleshooting.md +35 -1
- package/package.json +3 -3
- package/packages/core/src/cli/dispatch.ts +105 -5
- package/packages/core/src/cli/repository-status.ts +15 -0
- package/packages/core/src/config/schema.ts +2 -2
- package/packages/core/src/events/policy.ts +2 -0
- package/packages/core/src/events/repository.ts +102 -0
- package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +4 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/be211f0e31a65006.json.gz +0 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-records/23d33121de6d3325.json +107 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-records/312cc4090820a612.json +1078 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-records/a2780567b4989fb6.json +105 -0
- package/packages/core/src/kernel/done-escalations.ts +8 -4
- package/packages/core/src/kernel/reducer-revisions.ts +6 -0
- package/packages/core/src/kernel/reducer.ts +15 -1
- package/packages/core/src/kernel/repository-read-facts.ts +18 -0
- package/packages/core/src/ports/workspace/build-execution.ts +9 -1
- package/packages/core/src/ports/workspace/vercel-sandbox.ts +99 -12
- package/packages/core/src/processes/dispatcher.ts +957 -185
- package/packages/core/src/processes/execution-settlement.ts +24 -3
- package/packages/core/src/processes/pass-stages.ts +294 -0
- package/packages/core/src/processes/tick-publication.ts +1 -0
- package/packages/core/src/store/contract.ts +7 -0
- package/packages/core/src/store/reducer-value-shapes.json +5733 -5345
- package/packages/core/src/store/reducer-value-validation.ts +7 -0
- package/packages/core/src/store/remote/released-clients.json +22 -0
- package/packages/core/src/store/remote/released-reducer-values/1.14.0.json +36076 -0
- package/packages/core/src/store/remote/released-reducer-values/1.15.0.json +36354 -0
- package/packages/core/src/store/remote/released-reducer-values/index.ts +20 -16
- package/packages/core/src/store/repo-state-events.ts +2 -0
- package/packages/core/src/testing/dispatch-read-budget.ts +12 -2
- package/packages/core/src/testing/reduced-read-budget.ts +405 -1
- package/skills/guide/SKILL.md +29 -9
- package/skills/guide/references/operator-api.md +1 -1
- package/skills/guide/references/remote-store-protocol.md +1 -1
- package/skills/operate/SKILL.md +64 -5
- 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.15.0
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
<!-- release-install:end -->
|
package/SPEC.md
CHANGED
|
@@ -1873,8 +1873,10 @@ open builds until an operator acknowledges them (§14).
|
|
|
1873
1873
|
|
|
1874
1874
|
- **Contribution:** a build whose status is `done` and which has at least one
|
|
1875
1875
|
open escalation contributes `{slug, kind}`. Any other build contributes
|
|
1876
|
-
nothing. Completion closes no escalation,
|
|
1877
|
-
|
|
1876
|
+
nothing. Completion closes no escalation, but the first `build.aborted`
|
|
1877
|
+
closes every escalation open then, so an aborted build is listed only for an
|
|
1878
|
+
escalation raised after its abort, such as a cleanup failure that escalates,
|
|
1879
|
+
until it is answered or the janitor recovers.
|
|
1878
1880
|
- **Arguments:** none, so each repository has one key. Nothing expires.
|
|
1879
1881
|
- **Answer:** `{position, builds: [{slug, kind}]}` by slug, with `cursor: 0`.
|
|
1880
1882
|
Readers confirm each listed build against its build-reducer state.
|
|
@@ -1993,6 +1995,44 @@ workspace requests are cancelled, at the work deadline, which is the budget minu
|
|
|
1993
1995
|
a teardown reserve of `min(30 s, budget/4)`. Teardown (provisioning abandonment,
|
|
1994
1996
|
repository-lease release, `dispatcher.run-stopped`) is bounded by the budget end;
|
|
1995
1997
|
a write storage cannot finish by then is abandoned and the lease left to expire.
|
|
1998
|
+
Deadline-gated work starts only when it fits before the work deadline: a remote
|
|
1999
|
+
provision needs the provider's estimate (about 150 s), and a stopped-sandbox
|
|
2000
|
+
recovery needs a realistic resume (about 45 s) plus the cleanup reserve, with
|
|
2001
|
+
`recoveryTimeoutMs` as its ceiling. A recovery the deadline cuts short stops the
|
|
2002
|
+
sandbox, or leaves it uncertain for a later fence, and consumes no infrastructure
|
|
2003
|
+
attempt. A tick that defers such work counts it as `provisioningDeferred` or
|
|
2004
|
+
`recoveryDeferred`, logs one line per build naming the step, and is never
|
|
2005
|
+
reported idle. It records those builds in the latest-only, advisory
|
|
2006
|
+
`dispatcher.work-deferred` fact (a deferral noted after the work deadline is
|
|
2007
|
+
written in teardown, under the cleanup deadline, while the repository lease is
|
|
2008
|
+
still held), and the next invocation sweeps them before its
|
|
2009
|
+
other stages, re-deriving every decision from build state. The fact is a
|
|
2010
|
+
scheduling hint, never authority; an entry leaves it only after its own pass
|
|
2011
|
+
finishes without deferring again. Carried recoveries start within half of the
|
|
2012
|
+
window that remains.
|
|
2013
|
+
No stage consumes a bounded pass. Its stages run in order (deferred work,
|
|
2014
|
+
settlement, ticket preparations, janitor, recovery, lease sweep, admission,
|
|
2015
|
+
intake), and each may start new items only until its share of the time left
|
|
2016
|
+
when it starts: a half for deferred work, the janitor and the lease sweep, a
|
|
2017
|
+
quarter for the others, and intake runs to the work deadline. Each helper in a
|
|
2018
|
+
stage still starts its first item while the work deadline has not passed, and
|
|
2019
|
+
in-flight work is never cancelled at a share. Loops whose items stay listed
|
|
2020
|
+
after handling (execution, harvest and operator-sandbox settlement, the
|
|
2021
|
+
janitor, hand-back settlement, dispatch recovery, startup resume and the lease
|
|
2022
|
+
sweep) visit their items in key order from the last item they started, so
|
|
2023
|
+
every item is reached within a bounded number of passes whatever order the
|
|
2024
|
+
listing returns; their positions are the latest-only, advisory
|
|
2025
|
+
`dispatcher.pass-cursors` fact, written at most once per pass and only when
|
|
2026
|
+
one changed; a pass the work deadline abandons mid-visit records them in
|
|
2027
|
+
teardown, so the visit cut short is not retried first. Priority-ordered loops (node admission, start requests, ready
|
|
2028
|
+
tickets, parked admission, ticket waits) keep their order. In a bounded pass a
|
|
2029
|
+
node's integration receipts are recovered at the start of its own janitor
|
|
2030
|
+
visit, and listings are not filtered for mixed-version deferral: the build a
|
|
2031
|
+
decision reads, writes or acts on is checked itself, at most once a pass. Each
|
|
2032
|
+
bounded pass logs `stages:` with each stage's time and items; a pass the work
|
|
2033
|
+
deadline cuts short logs `tick: work deadline reached during <stage>` with the
|
|
2034
|
+
part in flight and how far it got, records that partial summary in teardown,
|
|
2035
|
+
and `ab repository status` shows the latest pass as `last pass stages:`.
|
|
1996
2036
|
A budget stop is a normal run stop. Credential deletion then gets the remaining
|
|
1997
2037
|
budget and at least 5 seconds; issuance or deletion unsettled by then is
|
|
1998
2038
|
reported and left to the capped expiry. Each served tick
|
|
@@ -5219,8 +5259,8 @@ effective configuration only, so heartbeat or lease renewal without an event
|
|
|
5219
5259
|
does not alter them. Every nonterminal build, including `queued`, has a
|
|
5220
5260
|
dashboard row; a pre-run row names its pending dispatch boundary or latest
|
|
5221
5261
|
durable failure. A `done` build with an open escalation, such as a
|
|
5222
|
-
post-landing integration audit raised after it completed or
|
|
5223
|
-
|
|
5262
|
+
post-landing integration audit raised after it completed or an escalation
|
|
5263
|
+
raised during abort cleanup, also has a row, `BLOCKED` with the note
|
|
5224
5264
|
`done` and its question, until an operator acknowledges it with `ab answer`;
|
|
5225
5265
|
it holds no slot and offers no other control. A human may discard only such a queued build. Discard is
|
|
5226
5266
|
dispatcher cleanup, returns the ticket to its
|
|
@@ -5404,7 +5444,11 @@ with illustrative members:
|
|
|
5404
5444
|
Abort cleanup is a dispatcher-owned ordered saga. A runner acknowledges abort
|
|
5405
5445
|
for a running leaf; for a queued, paused or blocked leaf with no live execution
|
|
5406
5446
|
lease, and for a node, the dispatcher appends `build.aborted` itself and runs
|
|
5407
|
-
the saga, never provisioning a workspace or starting a runner first.
|
|
5447
|
+
the saga, never provisioning a workspace or starting a runner first. The first
|
|
5448
|
+
`build.aborted` accepts the abort and closes, unanswered, every escalation open
|
|
5449
|
+
at that moment. It also ends any janitor failure episode, so a cleanup failure
|
|
5450
|
+
after it starts a new episode and escalates under a new id. A repeated
|
|
5451
|
+
`build.aborted` closes nothing. While an
|
|
5408
5452
|
execution lease is live, the janitor defers the saga so it cannot race
|
|
5409
5453
|
process-tree teardown. Once that supervisor releases the lease, or an abruptly
|
|
5410
5454
|
orphaned lease expires, cleanup closes an open unmerged PR without overriding a
|
|
@@ -5814,7 +5858,10 @@ carries the measured delta. The read-budget harness in
|
|
|
5814
5858
|
lastEvent}`. `blocked` ≡ an open escalation: an `escalation.raised` (or the
|
|
5815
5859
|
escalation a `phase.deferral-escalated` or `wait.entered` opens) without a
|
|
5816
5860
|
matching `escalation.answered`, matched by id; a ticket wait's escalation also
|
|
5817
|
-
closes on `wait.ended` and on a `wait-unresolvable` raise.
|
|
5861
|
+
closes on `wait.ended` and on a `wait-unresolvable` raise. The first
|
|
5862
|
+
`build.aborted` closes every escalation open then, without an
|
|
5863
|
+
`escalation.answered` and without entering `answeredEscalations`; one raised
|
|
5864
|
+
after it stays open. `waitRequest` and
|
|
5818
5865
|
`wait` project the latest ticket-wait request and entered wait (§11 "Ticket
|
|
5819
5866
|
waits"); `wait.ended?: {cause: operator | automatic | unresolvable, seq,
|
|
5820
5867
|
message}` is the wait's first end. `reviewRoundCeilings` projects valid
|
|
@@ -5905,8 +5952,8 @@ rollup (§7.7): the build's `kind` (from `build.created`, default `work`), its
|
|
|
5905
5952
|
`doneEscalations` rollup (§7.7): the build's `kind`, its latest terminal fact
|
|
5906
5953
|
(`done` or `aborted`) and its open escalation ids in raise order. It applies the build reducer's open-escalation
|
|
5907
5954
|
rules exactly: raises, deferrals, janitor escalations and entered ticket waits
|
|
5908
|
-
open; answers, wait ends, janitor recovery, `wait-unresolvable
|
|
5909
|
-
supersession close. Its ids always equal the build reducer's
|
|
5955
|
+
open; answers, wait ends, janitor recovery, `wait-unresolvable`, verify
|
|
5956
|
+
supersession and the first abort close. Its ids always equal the build reducer's
|
|
5910
5957
|
`openEscalations`.
|
|
5911
5958
|
|
|
5912
5959
|
### 15.6 Walkthroughs
|
|
@@ -5946,7 +5993,9 @@ A discard request is honored only while the build remains queued; one that races
|
|
|
5946
5993
|
attachment is inert and cannot tear down live work. A human discard waits out
|
|
5947
5994
|
any unexpired execution lease, then releases a partial workspace and stale
|
|
5948
5995
|
lease, returns the ticket to Ready, and appends `build.completed {outcome:
|
|
5949
|
-
discarded}` last. No runner is required.
|
|
5996
|
+
discarded}` last. No runner is required. A queued build has no open escalation,
|
|
5997
|
+
so a discard closes none; an escalation its cleanup raises stays open until it
|
|
5998
|
+
is answered or the janitor recovers.
|
|
5950
5999
|
|
|
5951
6000
|
**A — grouped verification:** a failing member waits at its stage barrier for
|
|
5952
6001
|
all siblings unless a fail-fast member fails. After cancellation and confirmed
|
|
@@ -6981,7 +7030,7 @@ automatic = true # immediate/60-second target checks; false requi
|
|
|
6981
7030
|
#vcpus = 4
|
|
6982
7031
|
#timeoutSeconds = 2700
|
|
6983
7032
|
#operationTimeoutMs = 30000 # provider calls, not VM/session lifetime
|
|
6984
|
-
#recoveryTimeoutMs = 120000 # one stopped-sandbox resume plus guest git
|
|
7033
|
+
#recoveryTimeoutMs = 120000 # ceiling: one stopped-sandbox resume plus guest git
|
|
6985
7034
|
#environmentVariables = ["ANTHROPIC_API_KEY"]
|
|
6986
7035
|
|
|
6987
7036
|
#[pr.imageHost] # optional public inline rendering for attached images
|
|
@@ -7708,7 +7757,8 @@ The janitor keeps retrying on its backoff underneath; a successful attempt
|
|
|
7708
7757
|
clears the attention, closes the escalation unanswered and the build continues.
|
|
7709
7758
|
Answering it with a bare retry makes the janitor attempt on its next tick. An
|
|
7710
7759
|
episode raises at most one escalation; a new episode after recovery can raise
|
|
7711
|
-
another. `
|
|
7760
|
+
another. The first `build.aborted` also ends the episode and closes its
|
|
7761
|
+
escalation, so abort cleanup failures start a new episode with a new id. `policy.janitorBackoffMaxSeconds` sets the positive integer cap.
|
|
7712
7762
|
A pending control the janitor can act on wakes it during backoff: an abort, a
|
|
7713
7763
|
pause, a resume of a paused build, a queued discard or an unacknowledged landing
|
|
7714
7764
|
command. A leaf's resume that only cancelled a never-acknowledged pause is not
|
|
@@ -22,7 +22,7 @@ until the revision lands.
|
|
|
22
22
|
| Replace the build contract from a file | `ab answer <slug> --revise-spec <file>` | Records the replacement as the next spec revision and restarts leaves at `plan`; nodes recollect and verify. |
|
|
23
23
|
| Re-import an amended ticket | `ab answer <slug> --revise-spec-from-ticket` | Reads the build's recorded ticket and performs the same revision. |
|
|
24
24
|
| Accept a rewritten target | `ab answer <slug> --accept-target` | Answers only a `target-rewritten` escalation; the build's own commits restack onto the current target. See [A rewritten target](#a-rewritten-target). |
|
|
25
|
-
| Abandon the build | `ab abort <slug> [--to ready] [--reason <text>]` | Irrevocably requests abort
|
|
25
|
+
| Abandon the build | `ab abort <slug> [--to ready] [--reason <text>]` | Irrevocably requests abort. Abort closes the build's open escalations without answering them. Cleanup returns the ticket to Triage, or with `--to ready` to Ready with its blockers kept, and then reports `ticket.handed-back`. Ready requires the current ticket to meet the spec standard; otherwise cleanup returns it to Triage, and the comment and event name the requested destination and the missing parts. An [optimization attempt](optimization-nodes.md#landing-and-settlement) is the exception: its abort settles `aborted`, ignores `--to`, reports no `ticket.handed-back`, and the node moves the ticket to Rejected after cleanup. |
|
|
26
26
|
|
|
27
27
|
The dashboard's blocked-build `r` shortcut requests an inline answer step that
|
|
28
28
|
supports guidance and a blank retry. While that step is open, it is exclusive
|
|
@@ -209,5 +209,7 @@ with nothing open.
|
|
|
209
209
|
dashboards, `ab web` and `operator.attention` show the escalation while it is
|
|
210
210
|
open and drop it once acknowledged. On a dashboard the build reads red
|
|
211
211
|
`BLOCKED` with the note `done` and its question, and holds no slot. Completion
|
|
212
|
-
closes
|
|
213
|
-
|
|
212
|
+
closes nothing, but accepting an abort closes every escalation open then, so an
|
|
213
|
+
aborted build appears here only for an escalation raised afterwards, such as a
|
|
214
|
+
cleanup failure. A discard is accepted only while the build is queued, when
|
|
215
|
+
nothing is open.
|
package/docs/architecture.md
CHANGED
|
@@ -830,6 +830,35 @@ provider to verify and finish the same generation, and if it cannot, the
|
|
|
830
830
|
replacement consumes no infrastructure attempt. A preservation or release
|
|
831
831
|
failure is recorded against its build, as an infrastructure failure or janitor
|
|
832
832
|
attention, and never stops the dispatcher from advancing other builds.
|
|
833
|
+
Work a bounded invocation defers for budget (a provision, or a stopped-sandbox
|
|
834
|
+
recovery the Vercel provider admits on a realistic resume estimate rather than
|
|
835
|
+
the `recoveryTimeoutMs` ceiling) is noted per tick by `Dispatcher.noteDeferral`,
|
|
836
|
+
counted as `provisioningDeferred` or `recoveryDeferred` with one diagnostic line
|
|
837
|
+
per build, and carried in the latest-only `dispatcher.work-deferred` fact; one
|
|
838
|
+
noted after the work signal aborts is written through the tick's
|
|
839
|
+
`teardownWrite` scope under the cleanup signal. The
|
|
840
|
+
next tick's first stage, `serviceDeferredWork`, runs the ordinary `sweepBuild`
|
|
841
|
+
pass for those builds before settlement and the janitor; the lease sweep and
|
|
842
|
+
settlement skip what it took up. A resume the deadline cuts short is stopped or
|
|
843
|
+
left uncertain, and observation reports a budget deferral as a `running`
|
|
844
|
+
observation marked `deferred`.
|
|
845
|
+
Stage fairness lives in `processes/pass-stages.ts` (pure: shares, rotation,
|
|
846
|
+
the stage record and its rendering). `Dispatcher.runTick` wraps each stage in
|
|
847
|
+
`runStage`, which hands its helpers a copy of the tick options whose
|
|
848
|
+
`deadlineAt` is the stage's cut, and every per-item loop gates on `stageGate`,
|
|
849
|
+
which stops at the invocation budget or, past the cut, after the part's first
|
|
850
|
+
item. Rotated loops go through `rotated()`, which orders items after the
|
|
851
|
+
position read from the reduced `dispatcher.pass-cursors` fact;
|
|
852
|
+
`persistPassCursors` appends changed positions once a pass, through the same
|
|
853
|
+
hint-write discipline as the deferral hint. Each started item's key becomes the
|
|
854
|
+
live position at once, and bounded teardown calls `persistPassPositions`, so a
|
|
855
|
+
pass abandoned mid-visit still records where its loops reached. In a bounded pass `tickDigests()`
|
|
856
|
+
lists unfiltered and `checkCompatibility` checks the build each decision acts
|
|
857
|
+
on, memoized per pass. `passSummary()` closes a stage still in flight as
|
|
858
|
+
stopped by the deadline; bounded teardown in `cli/dispatch.ts` prints it and
|
|
859
|
+
closes the open tick boundary with that partial summary under the cleanup
|
|
860
|
+
scope. Those advisory writes race beside provisioning abandonment and
|
|
861
|
+
execution teardown, so a stalled one never postpones them.
|
|
833
862
|
Fencing is revalidated after restart; a saved receipt alone never authorizes
|
|
834
863
|
cleanup of a newer execution. Current recovery notes are linked by the session
|
|
835
864
|
manifest's `workspaceRecovery` field. Recovery notes apply to the next session
|
package/docs/configuration.md
CHANGED
|
@@ -1306,7 +1306,7 @@ preflight = "test \"$(pi --version)\" = \"0.84.4\" && pi update --models"
|
|
|
1306
1306
|
- **Reload:** Dispatcher restart required; startup adapters retain their configuration. Build-owned pipeline: captured from the execution checkout each verify cycle; later base-branch edits do not replace it. Workspace provisioning applies at the next build launch. A running invocation keeps its captured values.
|
|
1307
1307
|
- **Local override:** Committed only: set in autobuild.toml.
|
|
1308
1308
|
|
|
1309
|
-
**Description:**
|
|
1309
|
+
**Description:** Ceiling in milliseconds for one stopped-sandbox recovery: an explicit cold resume plus the guest git work that follows it, including a push. A bounded invocation starts a recovery when a realistic resume (about 45 s) plus its cleanup reserve still fits, and its deadline bounds the recovery further. Separate from operationTimeoutMs.
|
|
1310
1310
|
|
|
1311
1311
|
**Constraints:** safe integer; ≥ 1000; ≤ 600000
|
|
1312
1312
|
|
|
@@ -1615,12 +1615,20 @@ treated as running:
|
|
|
1615
1615
|
record, and stops it again, so a finished session's `publication.requested`
|
|
1616
1616
|
is published instead of the execution being declared lost.
|
|
1617
1617
|
- **Resume has its own budget.** Preservation and publication resume a
|
|
1618
|
-
stopped sandbox explicitly
|
|
1619
|
-
|
|
1618
|
+
stopped sandbox explicitly. `recoveryTimeoutMs` (default 120 s) is the
|
|
1619
|
+
ceiling for the cold resume plus the guest git work and push.
|
|
1620
1620
|
`operationTimeoutMs` still bounds each metadata acknowledgement.
|
|
1621
|
-
- **The invocation deadline wins.** A hosted invocation
|
|
1622
|
-
|
|
1623
|
-
|
|
1621
|
+
- **The invocation deadline wins.** A hosted invocation starts a recovery
|
|
1622
|
+
only while a realistic resume (about 45 s) plus the cleanup reserve
|
|
1623
|
+
(`2 × operationTimeoutMs`) still fits, and stops recovery early enough to
|
|
1624
|
+
restore policy and stop the sandbox before it ends. A resume the deadline
|
|
1625
|
+
cuts short is stopped, or left uncertain until a later fence, and charges
|
|
1626
|
+
no infrastructure attempt.
|
|
1627
|
+
- **Deferred work runs first next time.** Work that cannot fit is deferred:
|
|
1628
|
+
the tick counts it as `recoveryDeferred`, logs
|
|
1629
|
+
`build <slug>: <step> deferred by the invocation budget`, and records the
|
|
1630
|
+
build in the latest-only `dispatcher.work-deferred` fact. The next
|
|
1631
|
+
invocation sweeps those builds first, within half of the window.
|
|
1624
1632
|
- **No redundant stops.** Fence and cleanup skip `stop()` for a sandbox the
|
|
1625
1633
|
provider already reports stopped.
|
|
1626
1634
|
- **Failures name their step.** `infrastructure.failed` and the exhaustion
|
|
@@ -1648,8 +1656,8 @@ is different: the next invocation verifies it and finishes it in the same
|
|
|
1648
1656
|
generation. If it cannot be finished, it is released and replaced without
|
|
1649
1657
|
consuming `maxInfrastructureAttempts`. A bounded dispatcher invocation does not
|
|
1650
1658
|
start provisioning with less than about 150 s of budget left; it records
|
|
1651
|
-
`provisioningDeferred` in the tick report
|
|
1652
|
-
invocation.
|
|
1659
|
+
`provisioningDeferred` in the tick report, logs the build, and records it in
|
|
1660
|
+
`dispatcher.work-deferred`, so the next invocation provisions it first.
|
|
1653
1661
|
|
|
1654
1662
|
The representative actual-provider check is opt-in and must point at an
|
|
1655
1663
|
independent consuming repository whose `autobuild.toml` selects the universal
|
|
@@ -87,6 +87,16 @@ next tick recovers automatically without spending build infrastructure attempts.
|
|
|
87
87
|
Project account slots never fall back to service-environment credentials.
|
|
88
88
|
Observation, controls and cleanup continue during the hold.
|
|
89
89
|
|
|
90
|
+
Each hosted invocation is one bounded pass. Its stages share the window: the
|
|
91
|
+
janitor, the lease sweep and deferred work may each start items for half of the
|
|
92
|
+
time left when they begin, the other stages for a quarter, and intake runs to
|
|
93
|
+
the work deadline. Loops whose items stay listed (settlement, the janitor,
|
|
94
|
+
hand-backs, dispatch recovery, resume and the lease sweep) continue on the next
|
|
95
|
+
invocation after the last item they started; priority-ordered loops (node
|
|
96
|
+
admission, start requests, ready tickets, ticket waits) keep their order. Each
|
|
97
|
+
pass logs a `stages:` line; see
|
|
98
|
+
[a stage keeps stopping at the work deadline](troubleshooting.md#a-stage-keeps-stopping-at-the-work-deadline).
|
|
99
|
+
|
|
90
100
|
### Origin-mode dispatcher with remote workspaces
|
|
91
101
|
|
|
92
102
|
Commit a remote-compatible configuration to the base branch:
|
package/docs/operating.md
CHANGED
|
@@ -37,6 +37,14 @@ Agree on boundaries before the agent acts: moving a ticket to ready can start a
|
|
|
37
37
|
|
|
38
38
|
The agent answers questions your instructions settle and escalates ambiguous goals, scope or compatibility tradeoffs, consequential or destructive choices, missing authority or access, and dispatcher trouble.
|
|
39
39
|
|
|
40
|
+
While it waits on you, the agent keeps operating everything else. Later updates would bury the request, so the agent repeats it, locally and over MCP alike:
|
|
41
|
+
|
|
42
|
+
- This is operator behavior, not something every agent does. It applies only to the agent holding the operator role and running the standing watch or `repository.attention` rounds, not to build sessions, spec or ticket sessions, or a one-off question.
|
|
43
|
+
- Every status message, whether a round summary, an outcome report or a reply, ends with a **Waiting on you** section.
|
|
44
|
+
- The section lists each open escalation or decision, merge awaiting your consent, question put to you, and attention it must report rather than fix, such as a forge-only merge, a missing credential or a maintainer-only dispatcher restart.
|
|
45
|
+
- Each item is restated in full: ticket and build, what is needed, the options and the agent's recommendation. You can act on the latest message alone. The agent checks each item against current state first, so a resolved one is never repeated from memory.
|
|
46
|
+
- Resolved items drop out. When nothing waits, the message ends with one line saying so, such as `Waiting on you: nothing.`
|
|
47
|
+
|
|
40
48
|
## Watch for attention
|
|
41
49
|
|
|
42
50
|
```
|
package/docs/operator-api.md
CHANGED
|
@@ -85,7 +85,7 @@ raw session-event append. External operator harnesses own agent execution.
|
|
|
85
85
|
| Method and path | Result |
|
|
86
86
|
|---|---|
|
|
87
87
|
| `GET …/builds?scope=active\|queued\|all` | Build summaries, newest update first. `queued` means active plus queued, matching `ab builds --queued`. Each nonterminal summary's `slot` is `{state: "held"}`, `{state: "requested", request, priority?: "urgent" \| "high" \| "low"}` or `{state: "none"}`; absent means unknown (an older server), never `none`. Its `statusWord` is `{word, tone, note?}`, the status word every surface shows; `status` stays the reducer's lifecycle status. |
|
|
88
|
-
| `GET …/builds/{slug}` | `{detail, dashboardRow}`; `detail.slot` and `dashboardRow.slot` carry the build's slot state, shaped as in `GET …/builds`; `detail.runnerAttaches` records chronological attach boundaries and their runtime identity (version, commit, source kind/location), with null runtime for unrecorded historical attaches; `dashboardRow` remains a `CLEANING` row after `build.aborted` and becomes `null` only when the dashboard stops listing it: at `build.completed` when no escalation is open. A completed build with an open escalation keeps, or regains, a `BLOCKED` row (note `done`), including
|
|
88
|
+
| `GET …/builds/{slug}` | `{detail, dashboardRow}`; `detail.slot` and `dashboardRow.slot` carry the build's slot state, shaped as in `GET …/builds`; `detail.runnerAttaches` records chronological attach boundaries and their runtime identity (version, commit, source kind/location), with null runtime for unrecorded historical attaches; `dashboardRow` remains a `CLEANING` row after `build.aborted` and becomes `null` only when the dashboard stops listing it: at `build.completed` when no escalation is open. A completed build with an open escalation keeps, or regains, a `BLOCKED` row (note `done`), including one raised during abort cleanup; abort itself closes the escalations open when it is accepted. The row becomes `null` once the escalation is acknowledged; neither step reopens its lifecycle state. |
|
|
89
89
|
| `GET …/dashboard` | `{generatedAt, model, settingsHeader}`. `model` is the dashboard's rows, steps, elapsed timing inputs, harvest row, triage (when the dispatcher published one)/queue/capacity and settings projection. `model.capacity.slots` maps each build to its slot state, and each `model.builds[].slot` repeats it; absent means unknown. `model.configuration` is `"no-dispatcher-run"` when the repository records no dispatcher run, and absent otherwise. Optional `rollback` contains `correlation`, `lineage`, full `failed` and `restored` runtime identities and rollback event `ts` for the authoritative dispatcher lineage’s unresolved hold. Both dashboards name failed, restored and held runtime plus timestamp. Matching durable different-target hold clearance removes it; a fresh operator lineage hides it only after a committed operational tick or accepted takeover. Run-started and yielded ticks alone cannot replace authority; same-lineage generations retain the notice. Historical rollback records are not fallback notices. Optional `handoffs` lists all accepted unfinished handoffs with predecessor `run`, optional `successor`, `correlation`, full `from`/`to` runtimes, `mode` and optional `deadline`. Outstanding drain-mode builds carry `draining: true`, also on build-detail `dashboardRow`; matching settlement removes it. Accepted completion removes the handoff; neither takeover nor the clock does. Missing historical mode means cutover and missing deadline displays unknown. |
|
|
90
90
|
| `GET …/status` | Repository intake, pause, and default-auto-merge projection, plus `ticketStarts` (`{pending, recent}`, each entry with its `priority`) when single-ticket start requests are pending or recently settled. `capacity.slots`, when the held configuration is readable, maps each nonterminal build to its slot state; `capacity.occupied` counts its `held` entries. Its `operator` is `{presence: "unavailable", reason}`: this route does not load presence registrations, so it is not evidence that no operator is present. |
|
|
91
91
|
| `GET …/harvest/status` | Harvest gate, runs, steps, recovery, and attention projection. |
|
|
@@ -75,7 +75,7 @@ Every nonterminal build row on both dashboards, `ab builds` and `ab build status
|
|
|
75
75
|
| `MERGING` | amber | none | A finished pipeline with merge consent, waiting for merge gates or the forge. |
|
|
76
76
|
| `PAUSED` | amber | none | An acknowledged pause. |
|
|
77
77
|
| `COLLECTING` | amber | none | An integration build collecting child work. |
|
|
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
|
|
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. |
|
|
79
79
|
| `CLEANING` | dim | none | Abort cleanup. |
|
|
80
80
|
|
|
81
81
|
- Green means held: the active counter `<occupied>/<capacity>` counts the green rows.
|
|
@@ -776,7 +776,7 @@ builds.
|
|
|
776
776
|
| `appendRepo` | `POST /repos/{repo}/events` | event write | `201` + repository event envelope |
|
|
777
777
|
| `appendRepoIfCurrent` | `POST /repos/{repo}/events/conditional` | `{"expectedSeq": nonnegative integer, "event": event write}` | appended: `201` + repository event envelope; journal advanced: `200 null` (mirroring section 3's build compare-and-append). A server without the route answers `404`; callers report it and never fall back to an unconditional append |
|
|
778
778
|
| `getRepoEvents` / `getRepositoryTail` | `GET /repos/{repo}/events?since={n}&through={n}&wait={s}` | optional `since` query value, parsed as in section 3; absence defaults to `0`. Optional `wait` in whole seconds, per the event-wait rules of section 3 | `200` + envelopes with `seq > since`, up to the frozen head; optional `through` caps the response at `seq <= through`; `409 cursor-too-old` below `max(0, head - 1000)` |
|
|
779
|
-
| `getRepoStateEvents` | `GET /repos/{repo}/state-events` | none | `200` + the bounded repository-journal subset (AUT-489): every durable event type (`ticket-preparation.*`, `harvest.*`, `orchestrator.sandbox.*`, the three dispatcher setting types, and cross-generation handoff correlation facts: target-prepared, yield-requested, upgrade-failed, handoff-started, terminal-released, takeover, drain-deadline, drain-settled and handoff-completed) plus the latest-only `dispatcher.ticket-scan-completed` and `dispatcher.
|
|
779
|
+
| `getRepoStateEvents` | `GET /repos/{repo}/state-events` | none | `200` + the bounded repository-journal subset (AUT-489): every durable event type (`ticket-preparation.*`, `harvest.*`, `orchestrator.sandbox.*`, the three dispatcher setting types, and cross-generation handoff correlation facts: target-prepared, yield-requested, upgrade-failed, handoff-started, terminal-released, takeover, drain-deadline, drain-settled and handoff-completed) plus the latest-only `dispatcher.ticket-scan-completed`, `dispatcher.placement-set`, `dispatcher.work-deferred` and `dispatcher.pass-cursors` facts and, when the journal has one, the tail from the latest `dispatcher.run-started`, in increasing sequence order; served inside the repository-existence gate like `GET events`, so an unknown repository is `404` |
|
|
780
780
|
| `getReducerSnapshot` (repo scope) | `GET /repos/{repo}/snapshots/{reducer}?version={n}` | required `version` query value, a positive integer; `reducer` is a registry name (`^[A-Za-z][A-Za-z0-9._-]{0,63}$`) | `200` + `{"version", "cursor", "state"}` or `200 null` when absent, written by another reducer version, ahead of the journal's tail, or the repository has no journal record; an unknown repository is `404`, which the shipped client also maps to `null` |
|
|
781
781
|
| `putReducerSnapshot` (repo scope) | `PUT /repos/{repo}/snapshots/{reducer}` | `{"version": int >= 1, "cursor": int >= 0, "state": JSON}`, at most 16 MiB (`413` above) | `200 {"written": boolean}`; the stored cursor never decreases, so a write at an equal or lower cursor (or an equal cursor at an equal or lower version) and one past the journal's tail answer `written: false` |
|
|
782
782
|
| `appendRepoWithArtifacts` | `POST /repos/{repo}/deposits` | atomic deposit request | `201` + `{event, artifacts}` using repository shapes |
|
package/docs/troubleshooting.md
CHANGED
|
@@ -60,6 +60,7 @@ bun ab harvest status
|
|
|
60
60
|
- **Forge cooldown:** `forge landing/polling paused until <reset>` means a GitHub rate limit holds forge work until that reset, whether a request was refused or a successful response reported the quota exhausted. `forge rate limit <resource>` lines show the last observed quota and when it was seen.
|
|
61
61
|
- **Capacity:** a build holds a slot while Autobuild owes its next move. Paused builds, builds blocked on a question once nothing is still working on them, builds waiting for a merge decision or on other tickets, and idle collecting nodes hold none. An answered or resumed build, a finished build that must re-verify or reconcile, and a build whose ticket wait ended wait as parked work for a slot ahead of claims at its level; higher-level work, including higher-level ready tickets, goes first, and `ab priority <slug> urgent` expedites a waiting build. Occupancy never exceeds `capacity`.
|
|
62
62
|
- **Harvest:** check the acknowledged harvest gate and unclaimed observations. Harvest triggers at `policy.harvestThreshold` observations, or `policy.harvestMaxDrift` other merged builds since the oldest observation (zero disables drift), and uses no build slot.
|
|
63
|
+
- **Bounded passes:** a hosted invocation also prints `stages:`. If `intake` is missing from it, see [a stage keeps stopping at the work deadline](#a-stage-keeps-stopping-at-the-work-deadline).
|
|
63
64
|
|
|
64
65
|
## Worktree destination not isolated
|
|
65
66
|
|
|
@@ -127,7 +128,40 @@ See [answering blocked builds](operating.md#answer-and-pause). Preserve event lo
|
|
|
127
128
|
| `preserve` | Inspecting or pushing the sandbox's commits | Check forge credentials and the branch, then retry. |
|
|
128
129
|
| `cleanup` | Stop, snapshot purge or delete | Check the sandbox and its snapshots in the provider, then retry. |
|
|
129
130
|
|
|
130
|
-
A
|
|
131
|
+
A step the invocation deadline defers is not a failure:
|
|
132
|
+
|
|
133
|
+
- It charges no infrastructure attempt.
|
|
134
|
+
- The dispatch log names it: `build <slug>: <step> deferred by the invocation budget`.
|
|
135
|
+
- The tick counts it as `recoveryDeferred` (or `provisioningDeferred`) and never reports `tick: idle`.
|
|
136
|
+
- The next invocation runs that build first.
|
|
137
|
+
|
|
138
|
+
See [Vercel sandbox recovery](configuration.md#vercel-sandbox).
|
|
139
|
+
|
|
140
|
+
## A build stays STARTING with repeated deferral lines
|
|
141
|
+
|
|
142
|
+
**Symptom.** The same build logs `resume deferred by the invocation budget` or `provision deferred by the invocation budget` on several invocations in a row, and stays STARTING.
|
|
143
|
+
|
|
144
|
+
**Cause.** Even with the build served first, the hosted invocation budget can't fit the work. A provision needs about 150 s; a resume needs about 105 s by default (a realistic resume plus the cleanup reserve).
|
|
145
|
+
|
|
146
|
+
**Action.** Report it to the instance operator: the invocation budget is too small for this work. Retrying the build doesn't help.
|
|
147
|
+
|
|
148
|
+
## A stage keeps stopping at the work deadline
|
|
149
|
+
|
|
150
|
+
**Symptom.** Hosted invocations log `tick: work deadline reached during <stage>`, or `ab repository status` shows `last pass stages: … stopped by the work deadline during …` on pass after pass.
|
|
151
|
+
|
|
152
|
+
**Reading the lines.** Every bounded pass prints one `stages:` line, for example:
|
|
153
|
+
|
|
154
|
+
```text
|
|
155
|
+
stages: settlement 3.1s 6/11 (executions 5/9, harvest 1/2, sandboxes 0/0) · janitor 131.4s 4/12 (share) · sweep 40.2s 9/9 · intake 12.0s 1/1
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
- **Time and items:** each stage's seconds and the items it reached out of those it listed.
|
|
159
|
+
- **`(share)`:** the stage used its share of the window and stopped starting items. In settlement, the janitor, hand-backs, dispatch recovery, resume and the lease sweep, the loop continues on the next invocation after the last item it started, so it works through its whole listing over successive passes. Priority-ordered loops (node admission, start requests, ready tickets, ticket waits) start from the top again.
|
|
160
|
+
- **`(deadline)`:** the work deadline stopped the pass inside that stage. The `tick: work deadline reached during …` line names the part in flight, such as `settlement: harvest 1 of 2 (6 of 11 overall)`.
|
|
161
|
+
|
|
162
|
+
**Cause.** One visit in the named stage takes most of the window: usually a slow forge or provider call for one build.
|
|
163
|
+
|
|
164
|
+
**Action.** Report the stage and part to the instance operator with the `stages:` lines from several invocations. A stage stopped by `share` alone is normal under load.
|
|
131
165
|
|
|
132
166
|
## Remote project access
|
|
133
167
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@defrex/autobuild",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.15.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.15.0",
|
|
166
|
+
"@defrex/autobuild-vercel-sandbox": "1.15.0",
|
|
167
167
|
"@resvg/resvg-js": "2.6.2",
|
|
168
168
|
"@types/bun": "^1.3.14",
|
|
169
169
|
"@types/node": "^24.0.0",
|
|
@@ -234,6 +234,11 @@ import {
|
|
|
234
234
|
type LaunchRunnerResult,
|
|
235
235
|
type TickReport,
|
|
236
236
|
} from '../processes/dispatcher'
|
|
237
|
+
import {
|
|
238
|
+
formatDeadlineStop,
|
|
239
|
+
formatPassStages,
|
|
240
|
+
type PassStageRecord,
|
|
241
|
+
} from '../processes/pass-stages'
|
|
237
242
|
import { RepoViewStore } from '../processes/repo-view'
|
|
238
243
|
import {
|
|
239
244
|
BuildControlError,
|
|
@@ -1600,6 +1605,7 @@ class DispatchLoop {
|
|
|
1600
1605
|
|
|
1601
1606
|
private dispatcherTick(resumeCurrent: boolean): Promise<Awaited<ReturnType<Dispatcher['tick']>>> {
|
|
1602
1607
|
return this.serialize(async () => {
|
|
1608
|
+
this.stagesPrinted = false
|
|
1603
1609
|
// The yield observer may have accepted while this tick was queued.
|
|
1604
1610
|
if (this.retirement !== undefined) return emptyTickReport()
|
|
1605
1611
|
// Refresh before every watch decision. The owner publishes atomically;
|
|
@@ -1646,7 +1652,10 @@ class DispatchLoop {
|
|
|
1646
1652
|
const readyObservation =
|
|
1647
1653
|
settings.intake || (!this.dashboard && this.opts.kernelRunId === undefined)
|
|
1648
1654
|
? undefined
|
|
1649
|
-
: await this.dispatcher.observeReady({
|
|
1655
|
+
: await this.dispatcher.observeReady({
|
|
1656
|
+
viewRefreshed: true,
|
|
1657
|
+
...(this.opts.deadlineAt !== undefined ? { deadlineAt: this.opts.deadlineAt } : {}),
|
|
1658
|
+
})
|
|
1650
1659
|
await this.wiring.renewAccounts?.({ repo: this.repoIdentity, run: this.runId })
|
|
1651
1660
|
const report = await this.dispatcher.tick({
|
|
1652
1661
|
resumeCurrent,
|
|
@@ -1661,7 +1670,10 @@ class DispatchLoop {
|
|
|
1661
1670
|
// transport call). Watch mode has no deadline ⇒ absent ⇒ unbounded.
|
|
1662
1671
|
...(this.opts.deadlineAt !== undefined ? { deadlineAt: this.opts.deadlineAt } : {}),
|
|
1663
1672
|
...(this.opts.invocationBudget !== undefined
|
|
1664
|
-
? {
|
|
1673
|
+
? {
|
|
1674
|
+
workSignal: this.opts.invocationBudget.work,
|
|
1675
|
+
teardownWrite: this.teardownWrite(this.opts.invocationBudget),
|
|
1676
|
+
}
|
|
1665
1677
|
: {}),
|
|
1666
1678
|
})
|
|
1667
1679
|
const publishedReport: TickReport = {
|
|
@@ -3430,6 +3442,7 @@ class DispatchLoop {
|
|
|
3430
3442
|
creationDiagnostics: _creationDiagnostics,
|
|
3431
3443
|
dependencyDiagnostics: _dependencyDiagnostics,
|
|
3432
3444
|
agentContextDiagnostics: _agentContextDiagnostics,
|
|
3445
|
+
deferredDiagnostics: _deferredDiagnostics,
|
|
3433
3446
|
...counters
|
|
3434
3447
|
} = merged
|
|
3435
3448
|
const completed = {
|
|
@@ -3942,6 +3955,9 @@ class DispatchLoop {
|
|
|
3942
3955
|
if (error instanceof ForgeRequestDeferred || isRecoveryDeferred(error)) {
|
|
3943
3956
|
if (leaseClaimed) await this.repoView.releaseLease(slug, instance)
|
|
3944
3957
|
await this.repoView.refreshBuild(slug)
|
|
3958
|
+
// The dispatcher's guarded launch entry records a recovery deferral
|
|
3959
|
+
// (its step and build) and reports it as `already-active`.
|
|
3960
|
+
if (isRecoveryDeferred(error)) throw error
|
|
3945
3961
|
return 'already-active'
|
|
3946
3962
|
}
|
|
3947
3963
|
if (leaseClaimed) {
|
|
@@ -4326,7 +4342,31 @@ class DispatchLoop {
|
|
|
4326
4342
|
}
|
|
4327
4343
|
}
|
|
4328
4344
|
|
|
4345
|
+
/** Whether this pass's `stages:` line was printed, by its report or by
|
|
4346
|
+
* bounded teardown; a pass prints it once. */
|
|
4347
|
+
private stagesPrinted = false
|
|
4348
|
+
|
|
4329
4349
|
private printReport(report: Awaited<ReturnType<Dispatcher['tick']>>, printIdle = true): boolean {
|
|
4350
|
+
const printed = this.printReportLines(report, printIdle)
|
|
4351
|
+
// A bounded pass's per-stage time and items (#1409): display only, never
|
|
4352
|
+
// a counter.
|
|
4353
|
+
if (report.stages !== undefined && !this.stagesPrinted) this.printStages(report.stages)
|
|
4354
|
+
return printed
|
|
4355
|
+
}
|
|
4356
|
+
|
|
4357
|
+
/** A bounded pass's deadline line, when the work deadline stopped a stage,
|
|
4358
|
+
* then its `stages:` line; once per pass. */
|
|
4359
|
+
private printStages(stages: readonly PassStageRecord[]): void {
|
|
4360
|
+
this.stagesPrinted = true
|
|
4361
|
+
const stop = formatDeadlineStop(stages)
|
|
4362
|
+
if (stop !== undefined) this.say(`tick: ${stop}`)
|
|
4363
|
+
this.say(`stages: ${formatPassStages(stages)}`)
|
|
4364
|
+
}
|
|
4365
|
+
|
|
4366
|
+
private printReportLines(
|
|
4367
|
+
report: Awaited<ReturnType<Dispatcher['tick']>>,
|
|
4368
|
+
printIdle: boolean,
|
|
4369
|
+
): boolean {
|
|
4330
4370
|
// `queued` is a standing depth, not a tick action — the header owns it;
|
|
4331
4371
|
// repeating it in the notice would make every saturated tick look busy.
|
|
4332
4372
|
const {
|
|
@@ -4336,7 +4376,9 @@ class DispatchLoop {
|
|
|
4336
4376
|
creationDiagnostics,
|
|
4337
4377
|
dependencyDiagnostics,
|
|
4338
4378
|
agentContextDiagnostics,
|
|
4379
|
+
deferredDiagnostics,
|
|
4339
4380
|
queued: _queued,
|
|
4381
|
+
stages: _stages,
|
|
4340
4382
|
...counts
|
|
4341
4383
|
} = report
|
|
4342
4384
|
for (const line of janitorDiagnostics) this.routineDiagnostic(line)
|
|
@@ -4346,6 +4388,7 @@ class DispatchLoop {
|
|
|
4346
4388
|
for (const line of ticketDiagnostics) this.routineDiagnostic(line)
|
|
4347
4389
|
for (const line of creationDiagnostics) this.say(line)
|
|
4348
4390
|
for (const line of dependencyDiagnostics) this.say(line)
|
|
4391
|
+
for (const line of deferredDiagnostics) this.say(line)
|
|
4349
4392
|
const parts = Object.entries(counts)
|
|
4350
4393
|
.filter(([, count]) => typeof count === 'number' && count > 0)
|
|
4351
4394
|
.map(([name, count]) => `${name}=${count}`)
|
|
@@ -4359,7 +4402,8 @@ class DispatchLoop {
|
|
|
4359
4402
|
ticketDiagnostics.length > 0 ||
|
|
4360
4403
|
creationDiagnostics.length > 0 ||
|
|
4361
4404
|
dependencyDiagnostics.length > 0 ||
|
|
4362
|
-
agentContextDiagnostics.length > 0
|
|
4405
|
+
agentContextDiagnostics.length > 0 ||
|
|
4406
|
+
deferredDiagnostics.length > 0
|
|
4363
4407
|
if (reportedDiagnostic) return true
|
|
4364
4408
|
// A tick that did something is worth a plain line. Interactive mode
|
|
4365
4409
|
// suppresses both action counts and the every-10s idle noise.
|
|
@@ -5516,7 +5560,9 @@ class DispatchLoop {
|
|
|
5516
5560
|
for (const report of settledReports) {
|
|
5517
5561
|
settledPrinted = this.printReport(report, false) || settledPrinted
|
|
5518
5562
|
}
|
|
5519
|
-
|
|
5563
|
+
// A pass the work deadline cut short is reported by bounded teardown,
|
|
5564
|
+
// never as idle.
|
|
5565
|
+
if (!initialPrinted && !settledPrinted && !this.budgetStopped()) {
|
|
5520
5566
|
this.printReport(emptyTickReport())
|
|
5521
5567
|
}
|
|
5522
5568
|
// One delivery pass per configured hook; the next invocation retries.
|
|
@@ -5547,10 +5593,22 @@ class DispatchLoop {
|
|
|
5547
5593
|
}
|
|
5548
5594
|
}
|
|
5549
5595
|
|
|
5596
|
+
/** The deferral hint's late-write scope: one write under the cleanup
|
|
5597
|
+
* signal, refused once that deadline has passed. */
|
|
5598
|
+
private teardownWrite(budget: InvocationBudget) {
|
|
5599
|
+
return <T>(write: () => Promise<T>): Promise<T> =>
|
|
5600
|
+
budget.cleanup.aborted
|
|
5601
|
+
? Promise.reject(budget.cleanup.reason)
|
|
5602
|
+
: withInvocationSignal(budget.cleanup, write)
|
|
5603
|
+
}
|
|
5604
|
+
|
|
5550
5605
|
private async boundedTeardown(budget: InvocationBudget): Promise<void> {
|
|
5551
5606
|
// Whether or not the deadline fired, no launch may start during
|
|
5552
5607
|
// teardown: provisioning abandonment runs beside execution teardown.
|
|
5553
5608
|
this.onWorkDeadline()
|
|
5609
|
+
// The cut pass's lines print now; its advisory writes race beside the
|
|
5610
|
+
// other cleanup, so a stalled write never postpones unrelated teardown.
|
|
5611
|
+
const summary = this.reportCutPass(budget)
|
|
5554
5612
|
const provisioning = untilAborted(
|
|
5555
5613
|
withInvocationSignal(budget.cleanup, () => this.dispatcher.stopProvisioning()),
|
|
5556
5614
|
budget.cleanup,
|
|
@@ -5566,7 +5624,7 @@ class DispatchLoop {
|
|
|
5566
5624
|
}),
|
|
5567
5625
|
budget.cleanup,
|
|
5568
5626
|
)
|
|
5569
|
-
const cleanup = await Promise.allSettled([provisioning, optional])
|
|
5627
|
+
const cleanup = await Promise.allSettled([provisioning, optional, summary])
|
|
5570
5628
|
await untilAborted(
|
|
5571
5629
|
withInvocationSignal(budget.final, () => this.releaseRepoLease()),
|
|
5572
5630
|
budget.final,
|
|
@@ -5575,6 +5633,48 @@ class DispatchLoop {
|
|
|
5575
5633
|
if (failed !== undefined) throw failed.reason
|
|
5576
5634
|
}
|
|
5577
5635
|
|
|
5636
|
+
/** A pass the work deadline abandoned before its report printed (#1409):
|
|
5637
|
+
* name the stage and part in flight and print the stages so far, at once;
|
|
5638
|
+
* then, as a teardown racer bounded by the cleanup deadline, record where
|
|
5639
|
+
* the pass's loops reached and close the still-open tick boundary with
|
|
5640
|
+
* that partial summary, so `ab repository status` shows it. Never rejects:
|
|
5641
|
+
* a concurrent abandoned publication may already have closed the boundary. */
|
|
5642
|
+
private reportCutPass(budget: InvocationBudget): Promise<void> {
|
|
5643
|
+
const writes: Promise<void>[] = []
|
|
5644
|
+
const write = (what: string, run: () => Promise<unknown>) =>
|
|
5645
|
+
writes.push(
|
|
5646
|
+
untilAborted(run(), budget.cleanup).then(
|
|
5647
|
+
() => undefined,
|
|
5648
|
+
(error: unknown) => this.warn(`${what} not recorded: ${formatDispatcherError(error)}`),
|
|
5649
|
+
),
|
|
5650
|
+
)
|
|
5651
|
+
// The next invocation continues after the visit the deadline cut short.
|
|
5652
|
+
// A no-op when the pass already recorded its positions; the write itself
|
|
5653
|
+
// goes through teardownWrite.
|
|
5654
|
+
write('pass positions', () => this.dispatcher.persistPassPositions())
|
|
5655
|
+
const partial = this.stagesPrinted ? undefined : this.dispatcher.passReport()
|
|
5656
|
+
if (partial?.stages !== undefined && partial.stages.length > 0) {
|
|
5657
|
+
this.printStages(partial.stages)
|
|
5658
|
+
if (this.tickStartedAt !== undefined) {
|
|
5659
|
+
const {
|
|
5660
|
+
queued: _queued,
|
|
5661
|
+
janitorDiagnostics: _janitorDiagnostics,
|
|
5662
|
+
blockedDiagnostics: _blockedDiagnostics,
|
|
5663
|
+
ticketDiagnostics: _ticketDiagnostics,
|
|
5664
|
+
creationDiagnostics: _creationDiagnostics,
|
|
5665
|
+
dependencyDiagnostics: _dependencyDiagnostics,
|
|
5666
|
+
agentContextDiagnostics: _agentContextDiagnostics,
|
|
5667
|
+
deferredDiagnostics: _deferredDiagnostics,
|
|
5668
|
+
...counters
|
|
5669
|
+
} = partial
|
|
5670
|
+
write('partial pass summary', () =>
|
|
5671
|
+
this.teardownWrite(budget)(() => this.finishTick({ outcome: 'completed', counters }, [])),
|
|
5672
|
+
)
|
|
5673
|
+
}
|
|
5674
|
+
}
|
|
5675
|
+
return Promise.all(writes).then(() => undefined)
|
|
5676
|
+
}
|
|
5677
|
+
|
|
5578
5678
|
async run(): Promise<void> {
|
|
5579
5679
|
// Before the `--once` branch, so both modes report it exactly once.
|
|
5580
5680
|
this.reportRoleDiagnostics()
|