@defrex/autobuild 1.8.0 → 1.9.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 +92 -11
- package/docs/architecture.md +38 -14
- package/docs/configuration.md +247 -4
- package/docs/dispatcher-hosting.md +4 -0
- package/docs/merge-policy.md +45 -5
- package/docs/operating.md +21 -0
- package/docs/operator-api.md +11 -2
- package/docs/plugin-authoring.md +4 -1
- package/docs/restacking.md +4 -0
- package/docs/setup.md +3 -1
- package/docs/verification.md +7 -6
- package/package.json +4 -3
- package/packages/core/src/cli/attention.ts +3 -0
- package/packages/core/src/cli/dashboard/landing-display.ts +9 -1
- package/packages/core/src/cli/dashboard/model.ts +25 -6
- package/packages/core/src/cli/dashboard/render.ts +2 -2
- package/packages/core/src/cli/dispatch.ts +120 -1
- package/packages/core/src/cli/help.ts +6 -2
- package/packages/core/src/cli/repository-status.ts +66 -1
- package/packages/core/src/cli/status.ts +2 -2
- package/packages/core/src/cli/watch.ts +1074 -627
- package/packages/core/src/config/live.ts +1 -0
- package/packages/core/src/config/load.ts +19 -0
- package/packages/core/src/config/schema.ts +114 -0
- package/packages/core/src/events/catalog.ts +2 -0
- package/packages/core/src/events/payloads.ts +22 -0
- package/packages/core/src/events/policy.ts +9 -0
- package/packages/core/src/events/repository.ts +43 -0
- package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +31 -0
- package/packages/core/src/kernel/auto-merge.ts +33 -0
- package/packages/core/src/kernel/generators/repository-journals.ts +18 -0
- package/packages/core/src/kernel/landing-state.ts +56 -0
- package/packages/core/src/kernel/leaf-restack-base.ts +34 -0
- package/packages/core/src/kernel/leaf-restack-state.ts +1 -29
- package/packages/core/src/kernel/reducer.ts +1 -1
- package/packages/core/src/kernel/ticket-wait.ts +1 -1
- package/packages/core/src/plugin-sdk/index.ts +7 -1
- package/packages/core/src/ports/forge/fake.ts +128 -8
- package/packages/core/src/ports/forge/git-rewrite.ts +34 -3
- package/packages/core/src/ports/forge/github-squash-message.ts +89 -0
- package/packages/core/src/ports/forge/github-transport.ts +30 -0
- package/packages/core/src/ports/forge/github.ts +565 -164
- package/packages/core/src/ports/types.ts +47 -3
- package/packages/core/src/processes/build-execution-state.ts +4 -3
- package/packages/core/src/processes/dispatcher.ts +73 -4
- package/packages/core/src/processes/execution-no-progress.ts +2 -0
- package/packages/core/src/processes/hook-command.ts +125 -0
- package/packages/core/src/processes/hook-webhook.ts +144 -0
- package/packages/core/src/processes/hooks.ts +740 -0
- package/packages/core/src/store/contract.ts +28 -0
- package/packages/core/src/store/reducer-value-shapes.json +3729 -3297
- package/packages/core/src/store/remote/released-clients.json +22 -0
- package/packages/core/src/store/remote/released-reducer-values/1.9.0.json +29475 -0
- package/packages/core/src/store/remote/released-reducer-values/index.ts +2 -0
- package/packages/core/src/store/repo-state-events.ts +3 -0
- package/packages/core/src/store/retention.ts +16 -2
- package/packages/core/src/testing/index.ts +1 -0
- package/packages/core/src/testing/reduced-read-budget.ts +476 -1
- package/skills/guide/SKILL.md +81 -6
- package/skills/guide/references/merge-policy.md +45 -5
- package/skills/guide/references/operator-api.md +11 -2
- package/skills/guide/references/plugin-authoring.md +4 -1
- package/skills/guide/references/restacking.md +4 -0
- package/skills/guide/references/setup.md +3 -1
- package/skills/operate/SKILL.md +24 -4
- package/templates/hosted-service/package.json +2 -2
package/docs/operating.md
CHANGED
|
@@ -77,6 +77,7 @@ one-off events from that gap.
|
|
|
77
77
|
- **Default filter:** actionable attention only, such as escalations and ready merges awaiting consent. Add `--event` globs for routine lifecycle events. Ticket waits beginning and ending are routine: follow them with `--event 'wait.*' --event escalation.answered`. A `wait-unresolvable` escalation, raised when a waited ticket is rejected or deleted, is ordinary attention.
|
|
78
78
|
- **Starts now:** a fresh watch ignores history, so check current status too.
|
|
79
79
|
- **Resumable:** pass the opaque cursor from the JSON output back with `--since` to receive events recorded while away within the hosted window described above. The final JSON line always carries one.
|
|
80
|
+
- **Identified:** every JSON record carries an `id` that stays the same when the record is seen again after a resume, so consumers can deduplicate by it.
|
|
80
81
|
- **Duration:** 30 minutes by default; `--timeout 0` keeps it open.
|
|
81
82
|
|
|
82
83
|
```
|
|
@@ -93,6 +94,26 @@ bun ab wait my-build --for attention --json --timeout 5m
|
|
|
93
94
|
|
|
94
95
|
Existing attention returns immediately, even with a cursor, so looping `wait` doesn't consume events. Use `watch --since` for that. Hosted `wait --since` uses the same inclusive 1,000-position resume window and too-old recovery described above: re-arm without `--since`, reconcile repository and build status, and account for the unavailable historical gap.
|
|
95
96
|
|
|
97
|
+
### React to attention with a hook
|
|
98
|
+
|
|
99
|
+
Tooling that should react to attention, such as a notifier, does not need its
|
|
100
|
+
own long-running `ab watch`. Declare a hook and the dispatcher delivers each
|
|
101
|
+
matching record to it, one JSON line on stdin per invocation, at least once and
|
|
102
|
+
in order:
|
|
103
|
+
|
|
104
|
+
```toml
|
|
105
|
+
[hooks.notify]
|
|
106
|
+
command = "jq -r '.id + \" \" + (.event.type // .observation.type)' >> attention.log"
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
A hook can instead target an HTTPS URL, which receives each record as a signed
|
|
110
|
+
JSON `POST` and also works from a hosted dispatcher.
|
|
111
|
+
|
|
112
|
+
A hook complements your operator's standing watch; it does not replace it.
|
|
113
|
+
Failing hooks surface as `hook.failing` attention, and `bun ab repository status`
|
|
114
|
+
shows each hook's progress. See [`[hooks]`](configuration.md#hooks) for filters,
|
|
115
|
+
the record format, webhook signing and the delivery guarantee.
|
|
116
|
+
|
|
96
117
|
## Answer and pause
|
|
97
118
|
|
|
98
119
|
```
|
package/docs/operator-api.md
CHANGED
|
@@ -297,8 +297,9 @@ The default watch reports actionable conditions only:
|
|
|
297
297
|
signal for a ready consent or held merge, including first repository-wide
|
|
298
298
|
discovery. Its target has the queue entry shape `{kind, branch, ticket?, build?}`.
|
|
299
299
|
Unready and stale candidates stay silent. `build.merge-decision` remains for
|
|
300
|
-
current actionable merge-gate deferrals
|
|
301
|
-
build/PR; it does not duplicate consent or
|
|
300
|
+
current actionable merge-gate deferrals, landings awaiting a human merge, and
|
|
301
|
+
unsafe forge outcomes, once per build/PR; it does not duplicate consent or
|
|
302
|
+
hold attention.
|
|
302
303
|
- Repository `harvest.escalated`, `harvest.recovery-exhausted`,
|
|
303
304
|
`dispatcher.config-rejected`, `dispatcher.config-reloaded` with nonempty
|
|
304
305
|
`restartRequired`, `dispatcher.upgrade-failed`, `dispatcher.runtime-rolled-back`,
|
|
@@ -307,6 +308,14 @@ The default watch reports actionable conditions only:
|
|
|
307
308
|
line names the process whose GitHub request was rate-limited outside the
|
|
308
309
|
dispatcher's credential (unauthenticated, with why, or on that process's own
|
|
309
310
|
credential) and its reset; dispatcher forge work continues.
|
|
311
|
+
- Repository `hook.failing`, `hook.recovered` and `hook.skipped`: a configured
|
|
312
|
+
hook (`[hooks]`) has failed continuously for five minutes (once per episode,
|
|
313
|
+
naming the latest error and the record `id` it is stuck on), has delivered
|
|
314
|
+
again after a reported episode, or resumed past history it could no longer
|
|
315
|
+
read (with the skipped stream ranges) or a build announcement it could not
|
|
316
|
+
resolve. Inspect `ab repository status`, fix the hook's command, endpoint or
|
|
317
|
+
configuration, and treat a skipped range as records the hook's consumer never
|
|
318
|
+
received.
|
|
310
319
|
- Repository `ticket-preparation.resolved` with outcome `abandoned`: automatic
|
|
311
320
|
preparation recovery stopped and left the ticket unchanged. The line names the
|
|
312
321
|
ticket, attempt and recorded reason; the payload's `claimed` says whether the
|
package/docs/plugin-authoring.md
CHANGED
|
@@ -56,6 +56,7 @@ Declare served model prefixes and a default. Optional tool-free `oneShot` sits b
|
|
|
56
56
|
- API 1.2: optional idempotent `closePr` and `deleteBranch` for abort cleanup. `closePr` must preserve a racing merge. Without them, cleanup stays visibly pending.
|
|
57
57
|
- Optional `prAttachments` hosts images; the text-only path must work without it.
|
|
58
58
|
- Optional `closesIssues: true` declares that closing keywords reaching the default branch close issues. Only then does the kernel pass `issueLinks` (`{ issue, intent }[]`). For a leaf aimed at the default branch it passes the build's sealed links to `openPr` and in `BuildLandingOptions` to `setAutoMerge` and `squashMerge`. Compose them with the SDK helpers: `neutralizeClosingReferences(title, links, { repository })` for the PR title and squash headline, `withIssueKeywords(body, links, { repository, trailers: false })` for the PR body so it ends with the `Closes #N` / `Refs #N` lines, and `landingMessage(message, buildSlug, links, { repository })` for the landed message, which puts the keyword paragraph before the trailer block. `repository` is `owner/name`, so qualified references to other repositories are left alone. Compare an already-applied landing request against the same composition, or auto-merge churns. The kernel calls `setAutoMerge(…, true, options)` on every eligible poll while a request is armed: return `applied` without mutating when the armed method and message match, and call `options.canApply()` before any mutation that repairs them. Without the flag no links are passed and none are written. A leaf aimed at a node passes its links to `openPr` with every intent `refs` (and none to the landing calls), a root node's PR receives the node's own links merged with its landed children's union, and a nested node's PR receives that set with every intent `refs`. When `openPr` adopts an existing open PR for the head and links are present, converge it: neutralize the existing title, recompose the existing body with `withIssueKeywords`, write only the fields that changed, and confirm by readback, without replacing the title, prose or merge message. To keep a node's PR current, implement the optional `updatePrIssueLinks(workspacePath, number, issueLinks)`: read the PR, neutralize its title and compose its body with `withIssueKeywords(body, links, { repository, trailers: false })`, write only when either changed, re-read and throw when the readback disagrees or the PR is not open. Without the method a node's set is recorded but never written.
|
|
59
|
+
- A forge that cannot arm a gated root landing natively may return `polling` from `setAutoMerge(…, true, options)`, with `headSha` and `clear` true only when the forge reports the PR clear to merge at that head, or `human-merge` when the base requires a merge queue. The kernel then squashes a clear PR with `options.requireClearState`. Honour it: re-read the PR, refuse with an ordinary error unless it is still clear at the expected head, call `options.canApply()` immediately before the merge request, and raise the forge's refusal of that request as the SDK's `ForgeRejection`, which settles the landing as awaiting a human merge. Never rely on the forge refusing a premature merge.
|
|
59
60
|
|
|
60
61
|
### Reconcile rewrites
|
|
61
62
|
|
|
@@ -65,7 +66,9 @@ Reconcile requires the optional grouped `Forge.rewrite` capability:
|
|
|
65
66
|
2. Publish immutable exact-SHA refs under `refs/autobuild/archive/<slug>/<sha>`. Remote
|
|
66
67
|
archives also publish commits present only on the remote: GitHub uses create-only
|
|
67
68
|
Git-reference REST creation when the workspace lacks the commit, retaining guarded
|
|
68
|
-
Git pushes for local objects.
|
|
69
|
+
Git pushes for local objects. When a non-branch Git push of the archive ref is
|
|
70
|
+
refused (not a transient failure), GitHub creates the identical ref through the same
|
|
71
|
+
REST call; the readback still decides. Exact remote readback confirms publication, then a
|
|
69
72
|
non-shallow fetch of only that exact archive ref (without tags, configured refmap
|
|
70
73
|
expansion or a depth limit) restores missing commits and their missing ancestry,
|
|
71
74
|
writes no shallow boundary, leaves an already-shallow repository's existing
|
package/docs/restacking.md
CHANGED
|
@@ -145,6 +145,10 @@ Before replacement the kernel publishes retained tips, displaced heads and the
|
|
|
145
145
|
temporary change under immutable exact archive refs. Remote archives also publish
|
|
146
146
|
commits present only on the remote: GitHub uses create-only Git-reference REST creation
|
|
147
147
|
when the workspace lacks the commit, retaining guarded Git pushes for local objects.
|
|
148
|
+
When the environment refuses a non-branch Git push of an archive ref, as Claude Code on
|
|
149
|
+
the web's GitHub proxy does, GitHub creates the identical archive ref through the same
|
|
150
|
+
REST call; a commit that exists only in the local workspace cannot use this fallback and
|
|
151
|
+
fails with an error naming both refusals.
|
|
148
152
|
Exact remote readback confirms publication, then a non-shallow fetch of only that exact
|
|
149
153
|
archive ref (without tags, configured refmap expansion or a depth limit) restores
|
|
150
154
|
missing commits and their missing ancestry, writes no shallow boundary, leaves an
|
package/docs/setup.md
CHANGED
|
@@ -475,7 +475,9 @@ For GitHub, enable **Allow squash merging** and **Allow rebase merging** in
|
|
|
475
475
|
Settings → General. The kernel needs direct publication and force-push permission
|
|
476
476
|
throughout `refs/heads/ab/` and `refs/heads/ab-node/`, including future branch
|
|
477
477
|
names. It also publishes immutable `refs/autobuild/archive/` refs, a non-head
|
|
478
|
-
namespace.
|
|
478
|
+
namespace. If the environment's Git transport refuses non-branch pushes, the GitHub
|
|
479
|
+
adapter falls back to creating the archive ref through the REST API (Contents: write),
|
|
480
|
+
so that path needs REST access to the archive namespace. Review protection rules, inherited organization rulesets, push rules,
|
|
479
481
|
and actor restrictions for all three namespaces. GitHub's branch APIs cannot
|
|
480
482
|
prove archive-domain access: manually verify it with your administrator without
|
|
481
483
|
creating probe refs or overwriting archives. Autobuild never changes settings or
|
package/docs/verification.md
CHANGED
|
@@ -170,14 +170,15 @@ Autobuild's own chain: this repository's choices, not defaults.
|
|
|
170
170
|
| 3 | unit | check | the in-memory test suite; a guard fails any test that does IO |
|
|
171
171
|
| 4 | build | check | packs every publishable package and checks its contents, imports and bins; mandatory |
|
|
172
172
|
| 5 | integration | check | every IO test (filesystem, processes, network, real time) plus database-backed suites and a packed hosted-service deploy rehearsal; runs concurrently with unit and build |
|
|
173
|
-
| 6 |
|
|
174
|
-
| 7 | ui-
|
|
175
|
-
| 8 | ui-
|
|
176
|
-
| 9 |
|
|
173
|
+
| 6 | app-load | check | mounts each operator web-app page's real client code in headless Chromium over fixture data; any uncaught exception or unhandled rejection fails, naming the page and error |
|
|
174
|
+
| 7 | ui-tui | agent | captures terminal-dashboard frames and judges them |
|
|
175
|
+
| 8 | ui-app | agent | captures operator web-app frames and judges them against the design; the capture first mounts each depicted page the same way |
|
|
176
|
+
| 9 | ui-website | agent | captures site and docs frames at desktop and phone widths, compared with approved references |
|
|
177
|
+
| 10 | docs | agent | fails when a `docs/` passage no longer matches the build's user-facing changes |
|
|
177
178
|
|
|
178
|
-
Steps 5 to
|
|
179
|
+
Steps 5 to 10 are optional. Integration covers every package plus `tools/`, `scripts/` and `bin/`, and applies to every build because many of its tests check skills, docs and configuration. Steps 6 to 10 are path-scoped. App-load is the step that catches a web-app page failing to load in a browser. Its paths cover every file the web app's client bundle reads: the app, the hosted service source, `packages/core/src/`, the capture tooling and the workspace manifests. A kernel-only diff that changes what the dashboard bundles still runs it, while docs-, skills- and website-only diffs skip it. Steps 7 to 10 run through repository skills `verify-ui-tui`, `verify-ui-app`, `verify-ui-website` and `verify-docs`. The docs step applies to product source, skills, templates, `SPEC.md`, `README.md` and `docs/`.
|
|
179
180
|
|
|
180
|
-
A plan for a docs change like this page selects lint, types, unit, build, integration, ui-website and docs; both of the last two pass their path checks because they cover `docs/`. The untouched ui-tui and ui-app steps aren't selected.
|
|
181
|
+
A plan for a docs change like this page selects lint, types, unit, build, integration, ui-website and docs; both of the last two pass their path checks because they cover `docs/`. The untouched app-load, ui-tui and ui-app steps aren't selected.
|
|
181
182
|
|
|
182
183
|
Grouped failures retain the legacy `feedback.verify` object for the first report
|
|
183
184
|
in configured order. A decisive `verify.stage-failed` receipt carries the full
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@defrex/autobuild",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"description": "Agent-driven software delivery from groomed ticket to merged PR",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -126,6 +126,7 @@
|
|
|
126
126
|
"dev:cli": "bun --hot --no-clear-screen bin/ab-dev.ts",
|
|
127
127
|
"capture:dashboard": "bun tools/dashboard-capture.ts",
|
|
128
128
|
"capture:web-dashboard": "bun packages/web-dashboard-capture/src/web-dashboard-capture.tsx",
|
|
129
|
+
"check:app-load": "bun packages/web-dashboard-capture/src/client-load.ts && AB_APP_LOAD_BROWSER_TEST=1 bun test packages/web-dashboard-capture/src/client-load.browser.integration.test.ts",
|
|
129
130
|
"capture:website": "bun tools/website-capture.ts",
|
|
130
131
|
"website:dev": "bun packages/website/src/dev.ts",
|
|
131
132
|
"website:build": "bun packages/website/src/build.ts",
|
|
@@ -157,8 +158,8 @@
|
|
|
157
158
|
},
|
|
158
159
|
"devDependencies": {
|
|
159
160
|
"@biomejs/biome": "2.5.5",
|
|
160
|
-
"@defrex/autobuild-postgres-store": "1.
|
|
161
|
-
"@defrex/autobuild-vercel-sandbox": "1.
|
|
161
|
+
"@defrex/autobuild-postgres-store": "1.9.0",
|
|
162
|
+
"@defrex/autobuild-vercel-sandbox": "1.9.0",
|
|
162
163
|
"@resvg/resvg-js": "2.6.2",
|
|
163
164
|
"@types/bun": "^1.3.14",
|
|
164
165
|
"@types/node": "^24.0.0",
|
|
@@ -62,6 +62,9 @@ export function repositoryNeedsAttention(event: RepositoryEvent): boolean {
|
|
|
62
62
|
case 'dispatcher.runtime-rolled-back':
|
|
63
63
|
case 'dispatcher.upgrade-failed':
|
|
64
64
|
case 'dispatcher.kernel-git-unavailable':
|
|
65
|
+
case 'hook.failing':
|
|
66
|
+
case 'hook.recovered':
|
|
67
|
+
case 'hook.skipped':
|
|
65
68
|
case 'forge.credential-limited':
|
|
66
69
|
case 'ticket.handed-back':
|
|
67
70
|
return true
|
|
@@ -99,6 +99,10 @@ export const mergeVocabulary = {
|
|
|
99
99
|
label: 'merge',
|
|
100
100
|
merged: 'merged',
|
|
101
101
|
consent: 'Merge awaits consent. Merge releases this build; Hold keeps it waiting.',
|
|
102
|
+
/** Landing by polling because the forge cannot arm native auto-merge. */
|
|
103
|
+
polling: 'polling',
|
|
104
|
+
/** Settled: a human merges the PR on the forge. */
|
|
105
|
+
humanMerge: 'awaits a human merge',
|
|
102
106
|
} as const
|
|
103
107
|
|
|
104
108
|
export function mergeSummary(build: {
|
|
@@ -111,7 +115,11 @@ export function mergeSummary(build: {
|
|
|
111
115
|
? 'held'
|
|
112
116
|
: landing?.decision?.mode === 'consent' && landing.command?.kind !== 'land'
|
|
113
117
|
? 'awaiting consent'
|
|
114
|
-
: build.autoMerge
|
|
118
|
+
: build.autoMerge === 'polling'
|
|
119
|
+
? mergeVocabulary.polling
|
|
120
|
+
: build.autoMerge === 'human-merge'
|
|
121
|
+
? mergeVocabulary.humanMerge
|
|
122
|
+
: build.autoMerge
|
|
115
123
|
return `${mergeVocabulary.label} ${status}`
|
|
116
124
|
}
|
|
117
125
|
export function mergedChildren(merged: number, total: number): string {
|
|
@@ -19,7 +19,11 @@ import {
|
|
|
19
19
|
import { openBuildWorkspace, provisionMarkerReducer } from '../../processes/dispatcher-selectors'
|
|
20
20
|
import { projectTree, treeVocabulary, type TreeProjection } from './tree'
|
|
21
21
|
export { treeVocabulary, consentQueue } from './tree'
|
|
22
|
-
import {
|
|
22
|
+
import {
|
|
23
|
+
currentLandingFallback,
|
|
24
|
+
landingAuthorized,
|
|
25
|
+
landingFallbackReason,
|
|
26
|
+
} from '../../kernel/landing-state'
|
|
23
27
|
import {
|
|
24
28
|
integrationComplete,
|
|
25
29
|
integrationFailed,
|
|
@@ -70,7 +74,7 @@ import type { Config } from '../../config/schema'
|
|
|
70
74
|
import type { PipelineSourceMeta } from '../../config/pipeline-source'
|
|
71
75
|
import type { BuildState, PhaseContext, PrLifecycle } from '../../kernel/reducer'
|
|
72
76
|
import {
|
|
73
|
-
|
|
77
|
+
currentLandingWaitReasonFrom,
|
|
74
78
|
currentDeferralObservationReducer,
|
|
75
79
|
type DeferralLedger,
|
|
76
80
|
} from '../../kernel/auto-merge'
|
|
@@ -119,8 +123,16 @@ export type EffectiveStatus =
|
|
|
119
123
|
|
|
120
124
|
export type StepState = 'done' | 'current' | 'provisional' | 'pending'
|
|
121
125
|
|
|
122
|
-
/** Human intent versus correlated forge application, rendered non-color-only.
|
|
123
|
-
|
|
126
|
+
/** Human intent versus correlated forge application, rendered non-color-only.
|
|
127
|
+
* `polling` and `human-merge` are the routes an authorized landing takes when
|
|
128
|
+
* the forge cannot arm native auto-merge. */
|
|
129
|
+
export type AutoMergeDisplay =
|
|
130
|
+
| 'off'
|
|
131
|
+
| 'requested'
|
|
132
|
+
| 'enabled'
|
|
133
|
+
| 'cancelling'
|
|
134
|
+
| 'polling'
|
|
135
|
+
| 'human-merge'
|
|
124
136
|
|
|
125
137
|
/**
|
|
126
138
|
* A step's wall-clock timing, now-INDEPENDENT so the model can be cached and
|
|
@@ -481,7 +493,7 @@ export function autoMergeDisplay(state: BuildState): AutoMergeDisplay {
|
|
|
481
493
|
return state.landing.native?.enabled &&
|
|
482
494
|
state.landing.native.decisionSeq === state.landing.decision?.seq
|
|
483
495
|
? 'enabled'
|
|
484
|
-
: 'requested'
|
|
496
|
+
: (currentLandingFallback(state.landing)?.mode ?? 'requested')
|
|
485
497
|
return 'off'
|
|
486
498
|
}
|
|
487
499
|
const { requested, commandSeq, applied } = state.autoMerge
|
|
@@ -1054,6 +1066,13 @@ export function projectBuildFromFacts(
|
|
|
1054
1066
|
? autoMergeConsentReason(record.slug)
|
|
1055
1067
|
: 'Merge policy decision pending'
|
|
1056
1068
|
steps[steps.length - 1] = { ...steps[steps.length - 1]!, reason }
|
|
1069
|
+
} else if (mergeCurrent && state.pr !== undefined && state.prState === 'open') {
|
|
1070
|
+
const fallback = currentLandingFallback(state.landing)
|
|
1071
|
+
if (fallback !== undefined)
|
|
1072
|
+
steps[steps.length - 1] = {
|
|
1073
|
+
...steps[steps.length - 1]!,
|
|
1074
|
+
reason: landingFallbackReason(fallback, state.pr.number),
|
|
1075
|
+
}
|
|
1057
1076
|
}
|
|
1058
1077
|
|
|
1059
1078
|
const setupError = state.janitor?.attention
|
|
@@ -1075,7 +1094,7 @@ export function projectBuildFromFacts(
|
|
|
1075
1094
|
const decision = decideNextFromFacts(state, facts.log, pipeline)
|
|
1076
1095
|
const mergeWaitReason =
|
|
1077
1096
|
decision.kind === 'wait' && decision.reason === 'awaiting-pr'
|
|
1078
|
-
?
|
|
1097
|
+
? currentLandingWaitReasonFrom(facts.deferral, state)
|
|
1079
1098
|
: undefined
|
|
1080
1099
|
|
|
1081
1100
|
return {
|
|
@@ -376,9 +376,9 @@ function renderBuild(
|
|
|
376
376
|
const autoColor: ColorName =
|
|
377
377
|
build.autoMerge === 'enabled'
|
|
378
378
|
? 'green'
|
|
379
|
-
: build.autoMerge === 'requested'
|
|
379
|
+
: build.autoMerge === 'requested' || build.autoMerge === 'polling'
|
|
380
380
|
? 'cyan'
|
|
381
|
-
: build.autoMerge === 'cancelling'
|
|
381
|
+
: build.autoMerge === 'cancelling' || build.autoMerge === 'human-merge'
|
|
382
382
|
? 'yellow'
|
|
383
383
|
: 'dim'
|
|
384
384
|
if (build.kind !== 'integration') rightTokens.push(paint(mergeSummary(build), autoColor, color))
|
|
@@ -61,6 +61,9 @@ import { issueTicketGrant, ticketGrantRequest } from '../ports/tickets/grants'
|
|
|
61
61
|
import { RemoteBuildStore } from '../store/remote/client'
|
|
62
62
|
import { delegateCredential } from '../store/remote/credentials'
|
|
63
63
|
import { isRemoteStoreRef } from './repo-state'
|
|
64
|
+
import { HookSupervisor, type HookInvoke } from '../processes/hooks'
|
|
65
|
+
import { hookInvoker } from '../processes/hook-webhook'
|
|
66
|
+
import { watchSelection } from './watch'
|
|
64
67
|
import { projectToken } from './project-credentials'
|
|
65
68
|
import {
|
|
66
69
|
readLaunchFence,
|
|
@@ -98,7 +101,7 @@ import { createHash } from 'node:crypto'
|
|
|
98
101
|
import { tmpdir } from 'node:os'
|
|
99
102
|
import { join, resolve } from 'node:path'
|
|
100
103
|
import semver from 'semver'
|
|
101
|
-
import { parseConfig } from '../config/load'
|
|
104
|
+
import { ConfigError, parseConfig } from '../config/load'
|
|
102
105
|
import {
|
|
103
106
|
composeBuildConfig,
|
|
104
107
|
DISPATCHER_CONFIG_ARTIFACT,
|
|
@@ -520,6 +523,37 @@ export interface DispatchOpts {
|
|
|
520
523
|
* dispatch never consult them. */
|
|
521
524
|
availableReleaseProbe?: AvailableReleaseProbe
|
|
522
525
|
upgradeNoticeScheduler?: UpgradeNoticeScheduler
|
|
526
|
+
/** False when this dispatcher cannot run repository-configured local
|
|
527
|
+
* commands (the hosted dispatcher): a configured command hook is then a
|
|
528
|
+
* config error at startup and on reload, never silently ignored. URL hooks
|
|
529
|
+
* are delivered either way. */
|
|
530
|
+
localCommands?: false
|
|
531
|
+
/** Test seam for configured hook delivery; defaults to running the hook's
|
|
532
|
+
* command or POSTing to its URL (`processes/hook-webhook.ts`). */
|
|
533
|
+
invokeHook?: HookInvoke
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
/** Reject hooks this dispatcher cannot deliver: command hooks where local
|
|
537
|
+
* commands cannot run, and URL hooks whose signing-secret variable is unset
|
|
538
|
+
* or blank in the dispatcher environment. Errors name the variable, never
|
|
539
|
+
* its value. */
|
|
540
|
+
export function assertHooksDeliverable(
|
|
541
|
+
config: Config,
|
|
542
|
+
opts: Pick<DispatchOpts, 'localCommands' | 'env'>,
|
|
543
|
+
): void {
|
|
544
|
+
for (const [name, hook] of Object.entries(config.hooks ?? {})) {
|
|
545
|
+
if (hook.command !== undefined && opts.localCommands === false)
|
|
546
|
+
throw new ConfigError(
|
|
547
|
+
`autobuild.toml: [hooks.${name}] is a command hook, which needs a dispatcher that can run local commands; the hosted dispatcher cannot — use a url hook, remove it, or dispatch locally`,
|
|
548
|
+
)
|
|
549
|
+
if (hook.url !== undefined && hook.secretEnv !== undefined) {
|
|
550
|
+
const value = opts.env[hook.secretEnv]
|
|
551
|
+
if (value === undefined || value.trim() === '')
|
|
552
|
+
throw new ConfigError(
|
|
553
|
+
`autobuild.toml: [hooks.${name}].secretEnv names ${hook.secretEnv}, which is unset or empty in the dispatcher environment`,
|
|
554
|
+
)
|
|
555
|
+
}
|
|
556
|
+
}
|
|
523
557
|
}
|
|
524
558
|
|
|
525
559
|
/** setTimeout that also resolves the moment ANY stop signal aborts, so OS
|
|
@@ -3867,6 +3901,82 @@ class DispatchLoop {
|
|
|
3867
3901
|
if (!this.dashboard) this.opts.stdout(line)
|
|
3868
3902
|
}
|
|
3869
3903
|
|
|
3904
|
+
private hooks: HookSupervisor | undefined
|
|
3905
|
+
|
|
3906
|
+
private hookSupervisor(): HookSupervisor {
|
|
3907
|
+
this.hooks ??= new HookSupervisor({
|
|
3908
|
+
store: this.wiring.store,
|
|
3909
|
+
repo: this.repoIdentity,
|
|
3910
|
+
storeRef: this.wiring.storeRef,
|
|
3911
|
+
checkout: this.opts.targetRepo,
|
|
3912
|
+
clock: () => this.wiring.clock(),
|
|
3913
|
+
invoke:
|
|
3914
|
+
this.opts.invokeHook ??
|
|
3915
|
+
hookInvoker({
|
|
3916
|
+
checkout: this.opts.targetRepo,
|
|
3917
|
+
env: this.opts.env,
|
|
3918
|
+
clock: () => this.wiring.clock(),
|
|
3919
|
+
}),
|
|
3920
|
+
warn: (line) => this.warn(line),
|
|
3921
|
+
appendRepo: (event) => this.repoView.appendRepo(this.repoIdentity, event),
|
|
3922
|
+
intervalMs: watchSelection(this.wiring.storeRef).intervalMs,
|
|
3923
|
+
})
|
|
3924
|
+
return this.hooks
|
|
3925
|
+
}
|
|
3926
|
+
|
|
3927
|
+
/**
|
|
3928
|
+
* Configured hooks run only while this loop holds repository authority and
|
|
3929
|
+
* is not yielding or retiring; they run outside the tick serialization, and
|
|
3930
|
+
* nothing reads their outcome. Reloads apply here, after each tick's
|
|
3931
|
+
* config refresh.
|
|
3932
|
+
*/
|
|
3933
|
+
private async syncHooks(): Promise<void> {
|
|
3934
|
+
try {
|
|
3935
|
+
const hooks = this.currentConfig().config.hooks ?? {}
|
|
3936
|
+
if (
|
|
3937
|
+
this.holdsRepoAuthority() &&
|
|
3938
|
+
!this.yieldPending &&
|
|
3939
|
+
this.retirement === undefined &&
|
|
3940
|
+
!this.watchStopped
|
|
3941
|
+
) {
|
|
3942
|
+
if (this.hooks === undefined && Object.keys(hooks).length === 0) return
|
|
3943
|
+
await this.hookSupervisor().reconcile(hooks)
|
|
3944
|
+
} else await this.stopHooks()
|
|
3945
|
+
} catch (error) {
|
|
3946
|
+
this.warn(`hooks: ${error instanceof Error ? error.message : String(error)}`)
|
|
3947
|
+
}
|
|
3948
|
+
}
|
|
3949
|
+
|
|
3950
|
+
private async stopHooks(): Promise<void> {
|
|
3951
|
+
const hooks = this.hooks
|
|
3952
|
+
this.hooks = undefined
|
|
3953
|
+
await hooks?.stop()
|
|
3954
|
+
}
|
|
3955
|
+
|
|
3956
|
+
private async drainHooksOnce(): Promise<void> {
|
|
3957
|
+
const hooks = this.currentConfig().config.hooks ?? {}
|
|
3958
|
+
if (Object.keys(hooks).length === 0 || !this.holdsRepoAuthority()) return
|
|
3959
|
+
// A one-pass invocation with a deadline (the hosted cron) stops in-flight
|
|
3960
|
+
// deliveries when it passes; stopped records are redelivered next time.
|
|
3961
|
+
const deadline = this.opts.deadlineAt
|
|
3962
|
+
const timers = this.opts.timers ?? DEFAULT_TIMERS
|
|
3963
|
+
const controller = new AbortController()
|
|
3964
|
+
const handle =
|
|
3965
|
+
deadline === undefined
|
|
3966
|
+
? undefined
|
|
3967
|
+
: timers.setTimeout(
|
|
3968
|
+
() => controller.abort(),
|
|
3969
|
+
Math.max(0, deadline - this.wiring.clock().getTime()),
|
|
3970
|
+
)
|
|
3971
|
+
try {
|
|
3972
|
+
await this.hookSupervisor().drainOnce(hooks, controller.signal)
|
|
3973
|
+
} catch (error) {
|
|
3974
|
+
this.warn(`hooks: ${error instanceof Error ? error.message : String(error)}`)
|
|
3975
|
+
} finally {
|
|
3976
|
+
if (handle !== undefined) timers.clearTimeout(handle)
|
|
3977
|
+
}
|
|
3978
|
+
}
|
|
3979
|
+
|
|
3870
3980
|
private warn(line: string): void {
|
|
3871
3981
|
if (this.presentationReleased) return
|
|
3872
3982
|
if (this.dashboard) this.setWarning(line)
|
|
@@ -4646,6 +4756,8 @@ class DispatchLoop {
|
|
|
4646
4756
|
this.cutoverRequested = true
|
|
4647
4757
|
// Suspend local harvest durably before transferring repository authority.
|
|
4648
4758
|
await this.stopLocalHarvest()
|
|
4759
|
+
// Hooks resume from durable progress under the successor.
|
|
4760
|
+
await this.stopHooks()
|
|
4649
4761
|
// A hosted launch can still be provisioning when yield is requested.
|
|
4650
4762
|
// Keep joining that continuation and detach as soon as its handle exists.
|
|
4651
4763
|
while (this.harvestInFlight) {
|
|
@@ -5119,8 +5231,11 @@ class DispatchLoop {
|
|
|
5119
5231
|
if (!initialPrinted && !settledPrinted) {
|
|
5120
5232
|
this.printReport(emptyTickReport())
|
|
5121
5233
|
}
|
|
5234
|
+
// One delivery pass per configured hook; the next invocation retries.
|
|
5235
|
+
if (!this.pastDeadline()) await this.drainHooksOnce()
|
|
5122
5236
|
} finally {
|
|
5123
5237
|
this.localHarvestShutdown.abort()
|
|
5238
|
+
await this.stopHooks()
|
|
5124
5239
|
await this.stopBuildExecutions()
|
|
5125
5240
|
await this.stopLocalHarvest()
|
|
5126
5241
|
await this.stopHostedHarvest()
|
|
@@ -5167,6 +5282,7 @@ class DispatchLoop {
|
|
|
5167
5282
|
}
|
|
5168
5283
|
}
|
|
5169
5284
|
this.triageSampler?.poke()
|
|
5285
|
+
await this.syncHooks()
|
|
5170
5286
|
if (this.watchStopped || this.superseded) break
|
|
5171
5287
|
await sleep(failed || this.pendingTickFailure ? Math.max(intervalMs, 1000) : intervalMs)
|
|
5172
5288
|
}
|
|
@@ -5176,6 +5292,7 @@ class DispatchLoop {
|
|
|
5176
5292
|
} finally {
|
|
5177
5293
|
this.localHarvestShutdown.abort()
|
|
5178
5294
|
await this.upgradeController?.stop()
|
|
5295
|
+
await this.stopHooks()
|
|
5179
5296
|
if (this.retirement) {
|
|
5180
5297
|
await this.retireGeneration()
|
|
5181
5298
|
} else {
|
|
@@ -5573,6 +5690,7 @@ export async function abDispatch(opts: DispatchOpts): Promise<void> {
|
|
|
5573
5690
|
// both modes, so passing it as `packageRoot` is behavior-preserving; the
|
|
5574
5691
|
// installation candidate (AUT-517) and the disk-first EROFS gate (AUT-587)
|
|
5575
5692
|
// are unchanged.
|
|
5693
|
+
assertHooksDeliverable(config, resolvedOpts)
|
|
5576
5694
|
const plugins = await loadPlugins(config.plugins, resolvedOpts.targetRepo, {
|
|
5577
5695
|
packageRoot: state.checkout,
|
|
5578
5696
|
onNotice: (line) => resolvedOpts.stderr(line),
|
|
@@ -5668,6 +5786,7 @@ export async function abDispatch(opts: DispatchOpts): Promise<void> {
|
|
|
5668
5786
|
(next) => {
|
|
5669
5787
|
assertReadyAssigneeAccepted(next.tickets, wiring.tickets)
|
|
5670
5788
|
assertCreateAssigneeAccepted(next.tickets, wiring.tickets)
|
|
5789
|
+
assertHooksDeliverable(next, resolvedOpts)
|
|
5671
5790
|
},
|
|
5672
5791
|
)
|
|
5673
5792
|
|
|
@@ -414,11 +414,13 @@ These fields describe intent; dispatch and merge behavior are unchanged.`,
|
|
|
414
414
|
'integration.verification-failed (failed node verification), build.janitor-failing, build.janitor-escalated,',
|
|
415
415
|
'build.compatibility-deferred, node.item-conflicted, target.rewritten, conflicted restack.replayed,',
|
|
416
416
|
'landing.consent-revoked (protected merge consent revoked by a reconcile), derived build.consent-ready and',
|
|
417
|
-
'build.merge-decision (a current actionable merge-gate deferral
|
|
417
|
+
'build.merge-decision (a current actionable merge-gate deferral, a landing awaiting a human merge,',
|
|
418
|
+
'or an unsafe forge outcome).',
|
|
418
419
|
'Consent and held ready merges use only build.consent-ready, once per readiness episode.',
|
|
419
420
|
'Unready or stale consent candidates stay silent; one merge gate decision per build/PR.',
|
|
420
421
|
'Repository: harvest.escalated, harvest.recovery-exhausted, dispatcher.config-rejected, dispatcher.forge-readiness-failed,',
|
|
421
422
|
'dispatcher.kernel-git-unavailable, forge.credential-limited, dispatcher.config-reloaded with restartRequired,',
|
|
423
|
+
'hook.failing, hook.recovered and hook.skipped (configured hook delivery health),',
|
|
422
424
|
'abnormal dispatcher.run-stopped,',
|
|
423
425
|
'abandoned ticket-preparation.resolved (claim confirmed or unconfirmed; ticket unchanged),',
|
|
424
426
|
'ticket.handed-back (a claimed or ready ticket returned other than as completion: abort,',
|
|
@@ -439,7 +441,9 @@ These fields describe intent; dispatch and merge behavior are unchanged.`,
|
|
|
439
441
|
'cursors remain valid. Fresh watches baseline history and retain repository timers;',
|
|
440
442
|
'reconcile existing build attention through status after arming.',
|
|
441
443
|
'',
|
|
442
|
-
'Record shape (--json):
|
|
444
|
+
'Record shape (--json): id (a stable record identity, the same across redelivery and',
|
|
445
|
+
'resume: build:<slug>:<seq>, repo:<seq>, or the observation type and its dedupe identity),',
|
|
446
|
+
'build (slug, or null for a repository event), repo (repository',
|
|
443
447
|
'id, present only for repository events), event (the complete durable envelope: build,',
|
|
444
448
|
'seq, ts, actor, type, payload), state (for build events, the reduction after this',
|
|
445
449
|
'event: status, phase, round, openEscalations with their ids and questions, pr, prState,',
|
|
@@ -24,7 +24,8 @@ import {
|
|
|
24
24
|
type ForgeDegradation,
|
|
25
25
|
} from '../kernel/forge-health'
|
|
26
26
|
import { forgeHotspot, type ForgeRequestCounts } from '../ports/forge-telemetry'
|
|
27
|
-
import { configSchema } from '../config/schema'
|
|
27
|
+
import { configSchema, hooksSchema } from '../config/schema'
|
|
28
|
+
import { readHookProgress } from '../processes/hooks'
|
|
28
29
|
import type { BuildStore } from '../store/types'
|
|
29
30
|
import { readBuildFacts } from '../store/reduced-reads'
|
|
30
31
|
import { forgeReadinessWarnings, reduceDispatchStatus } from '../kernel/dispatch-status'
|
|
@@ -171,6 +172,9 @@ export interface RepositoryStatus extends DispatchSettings {
|
|
|
171
172
|
upgradeStatus: RepositoryUpgradeStatus
|
|
172
173
|
rollbackHold?: DispatchUpgradeState['lastRollback']
|
|
173
174
|
capacity?: DispatchCapacity
|
|
175
|
+
/** Configured hooks of the latest dispatcher run and their delivery
|
|
176
|
+
* progress; set only by `ab repository status`. */
|
|
177
|
+
hooks?: HookStatus[]
|
|
174
178
|
/** Dispatcher startup warnings, then forge readiness warnings. */
|
|
175
179
|
warningLines?: string[]
|
|
176
180
|
/** Standing ticket diagnostics from the latest completed ticket scan — for
|
|
@@ -471,6 +475,7 @@ export function renderRepositoryStatus(status: RepositoryStatus): string[] {
|
|
|
471
475
|
]
|
|
472
476
|
: []),
|
|
473
477
|
...(status.warningLines ?? []),
|
|
478
|
+
...(status.hooks ?? []).map(renderHookStatus),
|
|
474
479
|
`dispatcher: ${status.dispatcher.state}${status.dispatcher.holder ? ` — ${formatRepositoryDispatcherIdentity(status.dispatcher.holder)}` : ' — no dispatcher holds the repository'}`,
|
|
475
480
|
...(status.dispatcher.expiredHolder
|
|
476
481
|
? [
|
|
@@ -505,6 +510,65 @@ export function renderRepositoryStatus(status: RepositoryStatus): string[] {
|
|
|
505
510
|
]
|
|
506
511
|
}
|
|
507
512
|
|
|
513
|
+
/** One configured hook's delivery status, from its durable progress. */
|
|
514
|
+
export interface HookStatus {
|
|
515
|
+
name: string
|
|
516
|
+
command: string | null
|
|
517
|
+
url: string | null
|
|
518
|
+
lastSuccessAt: string | null
|
|
519
|
+
/** Records queued (including one in flight) at the last progress write. */
|
|
520
|
+
backlog: number
|
|
521
|
+
caughtUp: boolean
|
|
522
|
+
failing: { since: string; attempts: number; error: string; reported: boolean } | null
|
|
523
|
+
updatedAt: string | null
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
/**
|
|
527
|
+
* Hooks configured by the latest dispatcher run's effective config, each
|
|
528
|
+
* with its progress artifact: one artifact read plus one per hook. Only the
|
|
529
|
+
* `hooks` field is parsed, so unrelated drift never fails status.
|
|
530
|
+
*/
|
|
531
|
+
export async function readRepositoryHooks(
|
|
532
|
+
store: BuildStore,
|
|
533
|
+
repo: string,
|
|
534
|
+
facts: RepositoryReadFacts,
|
|
535
|
+
): Promise<HookStatus[]> {
|
|
536
|
+
const ref = facts.status?.effectiveConfig
|
|
537
|
+
if (!ref) return []
|
|
538
|
+
const artifact = await store.getRepoArtifact(repo, ref.kind, ref.rev)
|
|
539
|
+
if (!artifact) return []
|
|
540
|
+
let raw: unknown
|
|
541
|
+
try {
|
|
542
|
+
raw = (JSON.parse(new TextDecoder().decode(artifact.content)) as { hooks?: unknown }).hooks
|
|
543
|
+
} catch {
|
|
544
|
+
return []
|
|
545
|
+
}
|
|
546
|
+
const parsed = hooksSchema.safeParse(raw ?? {})
|
|
547
|
+
if (!parsed.success) return []
|
|
548
|
+
const hooks: HookStatus[] = []
|
|
549
|
+
for (const [name, hook] of Object.entries(parsed.data)) {
|
|
550
|
+
const progress = await readHookProgress(store, repo, name)
|
|
551
|
+
const backlog = progress?.pending ?? 0
|
|
552
|
+
hooks.push({
|
|
553
|
+
name,
|
|
554
|
+
command: hook.command ?? null,
|
|
555
|
+
url: hook.url ?? null,
|
|
556
|
+
lastSuccessAt: progress?.lastSuccessAt ?? null,
|
|
557
|
+
backlog,
|
|
558
|
+
caughtUp: backlog === 0 && progress?.failing === undefined,
|
|
559
|
+
failing: progress?.failing ?? null,
|
|
560
|
+
updatedAt: progress?.updatedAt ?? null,
|
|
561
|
+
})
|
|
562
|
+
}
|
|
563
|
+
return hooks
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
export function renderHookStatus(hook: HookStatus): string {
|
|
567
|
+
return `hook ${hook.name} — last delivered ${hook.lastSuccessAt ?? 'never'} — ${
|
|
568
|
+
hook.backlog === 0 ? 'caught up' : `${hook.backlog} pending`
|
|
569
|
+
}${hook.failing ? ` — failing since ${hook.failing.since}: ${hook.failing.error}` : ''}`
|
|
570
|
+
}
|
|
571
|
+
|
|
508
572
|
/** Capacity is optional when no held dispatcher has a retrievable configuration. */
|
|
509
573
|
export async function readRepositoryCapacity(
|
|
510
574
|
store: BuildStore,
|
|
@@ -572,6 +636,7 @@ export async function abRepositoryStatus(opts: RepositoryStatusOpts): Promise<vo
|
|
|
572
636
|
}
|
|
573
637
|
const capacity = await readRepositoryCapacity(store, repo, facts, dispatcher, observedAt)
|
|
574
638
|
if (capacity) status.capacity = capacity
|
|
639
|
+
status.hooks = await readRepositoryHooks(store, repo, facts)
|
|
575
640
|
if (opts.json === true) {
|
|
576
641
|
opts.stdout(JSON.stringify(status, null, 2))
|
|
577
642
|
return
|
|
@@ -73,7 +73,7 @@ import {
|
|
|
73
73
|
import { sameLandingCandidate } from '../kernel/landing-state'
|
|
74
74
|
import type { PipelineSourceMeta } from '../config/pipeline-source'
|
|
75
75
|
import { openExecution } from '../processes/execution-settlement'
|
|
76
|
-
import {
|
|
76
|
+
import { currentLandingWaitReasonFrom } from '../kernel/auto-merge'
|
|
77
77
|
import { autoMergeDisplay, effectiveStatus, type AutoMergeDisplay } from './dashboard/model'
|
|
78
78
|
import { decideNextFromFacts } from '../kernel/engine'
|
|
79
79
|
import {
|
|
@@ -1177,7 +1177,7 @@ function decideFromConfig(facts: BuildFacts, config: Config): BuildDecisionProje
|
|
|
1177
1177
|
const decision = decideNextFromFacts(facts.state, facts.log, config)
|
|
1178
1178
|
if (decision.kind !== 'wait') return { kind: 'runner-work' }
|
|
1179
1179
|
if (decision.reason !== 'awaiting-pr') return { kind: 'parked', reason: decision.reason }
|
|
1180
|
-
const reason =
|
|
1180
|
+
const reason = currentLandingWaitReasonFrom(facts.deferral, facts.state)
|
|
1181
1181
|
return { kind: 'awaiting-pr', ...(reason !== undefined ? { reason } : {}) }
|
|
1182
1182
|
}
|
|
1183
1183
|
|