@defrex/autobuild 1.8.1 → 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/reducer.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 +11 -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/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.9.0
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
<!-- release-install:end -->
|
package/SPEC.md
CHANGED
|
@@ -1958,6 +1958,11 @@ presence and its final renewal for re-arming. SIGKILL cannot be caught and still
|
|
|
1958
1958
|
relies on TTL expiry. `ab wait` does not
|
|
1959
1959
|
renew or preserve this identity. MCP presence and dashboard display are deferred.
|
|
1960
1960
|
|
|
1961
|
+
Every `ab watch --json` record carries an `id` stable across redelivery and
|
|
1962
|
+
resume: `build:<slug>:<seq>`, `repo:<seq>`, `<observation type>:<dedupe
|
|
1963
|
+
identity>` for derived observations, or `dispatcher.lost:<run>`. Configured
|
|
1964
|
+
hooks (§16.1) receive exactly these records.
|
|
1965
|
+
|
|
1961
1966
|
Filing agents check CLI repository status before ready filing. With a live
|
|
1962
1967
|
operator they put intent, rejected alternatives and out-of-scope reasons into
|
|
1963
1968
|
ticket bodies, file, tell the human the existing operator will pick it up, and
|
|
@@ -3581,7 +3586,7 @@ with illustrative members:
|
|
|
3581
3586
|
|---|---|
|
|
3582
3587
|
| Build lifecycle | `build.created` (carrying `assets`, the claim-time pin, §6.3), `workspace.provisioned`, `workspace.cleanup-required`, `workspace.fenced`, `workspace.commits-preserved`, `workspace.commits-lost`, `workspace.released`, `execution.started`, `execution.ended`, `infrastructure.failed`, `infrastructure.cleanup-attempted`, `dispatch.comment-posted`, `dispatch.failed`, `runner.attached`, `runner.runtime-recorded`, `runner.setup-failed`, `abort.remote-branch-deleted`, `abort.local-branch-deleted`, `abort.ticket-returned`, `build.ticket-returned`, `build.completed` |
|
|
3583
3588
|
| Operator commands [D2] | `build.abort-requested {reason?, to?}` → `build.aborted`; `build.pause-requested` → `build.paused`; `build.discard-requested`; `build.hold-requested`; `build.land-requested` → `landing.command-acknowledged`; `escalation.answered` (optionally carrying a validated `reviewRoundCeiling`, or the `assets` sampled with a revise-from-ticket authorization) |
|
|
3584
|
-
| Merge policy | `landing.decided` (candidate, matched rule/default, labels, target, mode, matched `paths?` summary); advisory `landing.deferred` (candidate, reason, rule, policy); kernel `landing.consent-revoked {commandSeq, source, rule, previousHead, head, consentedHead?, paths}`; `landing.native-enable-started`; `landing.native-applied` |
|
|
3589
|
+
| Merge policy | `landing.decided` (candidate, matched rule/default, labels, target, mode, matched `paths?` summary); advisory `landing.deferred` (candidate, reason, rule, policy); kernel `landing.consent-revoked {commandSeq, source, rule, previousHead, head, consentedHead?, paths}`; `landing.native-enable-started`; `landing.native-applied`; advisory dispatcher `landing.polling-selected {candidate, decisionSeq, commandSeq?, detail}` and `landing.human-merge-required {candidate, decisionSeq, commandSeq?, cause: merge-queue-rule \| merge-queue-activity \| merge-refused, detail}` |
|
|
3585
3590
|
| Spec | `spec.imported`, `spec.authored`, `spec.revised` (either positive `escalation` sequence or exclusive `operator: {user, via?}` provenance for an idle node; optionally carrying `assets`, a re-pin of the ticket's assets, §6.3) |
|
|
3586
3591
|
| Sessions | `session.started` (including optional write-ahead continuation intent, budget ceiling, and the effective first `prompt` the bracket sent: the start prompt, the live continuation message, or the interruption notice); `session.suspended` with partial transcript and active duration; `session.resumed` acceptance (stale reports are inert); reasoned `session.resume-fallback`; kernel-only `session.native-handle-recorded` with bracket and native execution identity; `session.ended` with transcript ref and usage (ordinary completion — the analysis corpus), or `session.ended {outcome: reclaimed, reclaimedBy: {instance, resumedFromSeq}}` (explicit transcriptless takeover) |
|
|
3587
3592
|
| Plan/code loops | `plan.started` … `plan-review.verdict`; `implement.started` … `code-review.verdict` |
|
|
@@ -3594,7 +3599,7 @@ with illustrative members:
|
|
|
3594
3599
|
| Post-PR [D1] | `pr.merged`, `pr.conflicted`, `reconcile.progress-checked`, `reconcile.started`, `reconcile.prepared`, `reconcile.replayed`, `reconcile.publish-intended`, `reconcile.rewritten`, `reconcile.contended`, `reconcile.completed`, kernel `reconcile.superseded {attempt, cycle, cause: wait-resume, restackId?}` (§11 "Ticket waits") |
|
|
3595
3600
|
| Cross-cutting | `observation.recorded`, `escalation.raised`, `phase.failed`, `session.build-read-failed`, `session.build-read-recovered`, `phase.deferred`, `phase.deferral-escalated` |
|
|
3596
3601
|
| Ticket waits (§11) | Agent `wait.requested {id, phase, round, tickets, reason, publication?: {branch, base, sha, settlement: published \| requested}}`; dispatcher `wait.published {id, sha}`, `wait.refused {id, cause: unknown-ticket \| own-ticket \| completed \| no-source-ticket \| publication-lost, tickets, message}` and `wait.entered {id, escalation, tickets, reason, question}`; dispatcher, kernel or human `wait.ended {id, cause: operator \| automatic, message}`; dispatcher policy `escalation.raised {policyCause: wait-unresolvable}` ends an open wait whose ticket was rejected or deleted |
|
|
3597
|
-
| Repository journal | dispatcher setting facts; run lifecycle, effective config, tick/queue diagnostics, reload and runner outcomes; the `harvest.*` workflow, recovery, and ledger facts; `ticket-preparation.*` claim boundaries; `ticket.handed-back` and `ticket.handback-settled` |
|
|
3602
|
+
| Repository journal | dispatcher setting facts; run lifecycle, effective config, tick/queue diagnostics, reload and runner outcomes; the `harvest.*` workflow, recovery, and ledger facts; `ticket-preparation.*` claim boundaries; `ticket.handed-back` and `ticket.handback-settled`; configured hook health `hook.failing`, `hook.recovered` and `hook.skipped` (advisory attention, §16.1) |
|
|
3598
3603
|
|
|
3599
3604
|
Abort cleanup is a dispatcher-owned ordered saga. While an execution lease is
|
|
3600
3605
|
live, the janitor defers the saga so it cannot race process-tree teardown. Once
|
|
@@ -4153,7 +4158,11 @@ history and rewrite facts, plus both heads and the temporary change, under immut
|
|
|
4153
4158
|
namespace or permission failures stop publication without a branch/tag fallback. Remote
|
|
4154
4159
|
archives also publish commits present only on the remote: GitHub uses create-only
|
|
4155
4160
|
Git-reference REST creation when the workspace lacks the commit, retaining guarded Git
|
|
4156
|
-
pushes for local objects.
|
|
4161
|
+
pushes for local objects. When an environment refuses a non-branch Git push of an
|
|
4162
|
+
archive ref (a refusal, not a transient failure), GitHub creates the identical archive
|
|
4163
|
+
ref through the same create-only REST call and holds it to the same exact readback; this
|
|
4164
|
+
is a transport for the same ref, never a branch or tag, never overwrites an archive, and
|
|
4165
|
+
cannot publish a commit that exists only locally, which fails naming both refusals. Exact remote readback confirms publication, then a non-shallow
|
|
4157
4166
|
fetch of only that exact archive ref (without tags, configured refmap expansion or a
|
|
4158
4167
|
depth limit) restores missing commits and their missing ancestry, writes no shallow
|
|
4159
4168
|
boundary, leaves an already-shallow repository's existing boundaries unchanged, and
|
|
@@ -4266,13 +4275,21 @@ best-effort: observe a provider-reported merge, or comment with the merged SHA
|
|
|
4266
4275
|
and close a still-open review. Acknowledgement failure never retries or fails
|
|
4267
4276
|
the merge.
|
|
4268
4277
|
|
|
4269
|
-
GitHub
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4278
|
+
GitHub derives the squash headline and body from the PR and the repository's
|
|
4279
|
+
squash title and message settings, read over REST, and lands with an expected
|
|
4280
|
+
head guard. Native auto-merge messages are checked against that derivation on
|
|
4281
|
+
eligible polls even after consent acknowledgement, and repaired through
|
|
4282
|
+
consent-guarded disable/enable. Landing reads use REST only; GraphQL carries
|
|
4283
|
+
just the native enable and disable mutations, preceded by one read-only
|
|
4284
|
+
availability probe per forge instance. A GraphQL refusal that says GraphQL is
|
|
4285
|
+
unavailable (HTTP 403 from an environment such as Claude Code on the web's
|
|
4286
|
+
GitHub proxy) is its own condition, distinct from rate limits, transient
|
|
4287
|
+
failures and permission errors; it suppresses further GraphQL from that
|
|
4288
|
+
process for 30 minutes and never drives forge cooldown. Repeated polling covers later
|
|
4289
|
+
head or metadata changes; it cannot make a future push atomic with an already
|
|
4290
|
+
armed native merge. Merge queues ignore message overrides, so identity-aware
|
|
4291
|
+
kernel merge defers with `unproven-gate-state` rather than bypassing the queue;
|
|
4292
|
+
native enable, repair and direct merge check for a queue, quiet polls do not. Human merges remain
|
|
4276
4293
|
observable regardless of trailer evidence.
|
|
4277
4294
|
|
|
4278
4295
|
Ordered `[[merge]]` rules in `autobuild.toml` decide authorization. Each rule
|
|
@@ -4387,7 +4404,30 @@ gates and the serialized node-writer publication rules remain authoritative.
|
|
|
4387
4404
|
**Merge gates are never bypassed.** Merge authorization comes from recorded
|
|
4388
4405
|
policy or explicit consent. For root-target leaves, whenever the base branch has
|
|
4389
4406
|
any real merge-blocking gate, authorization is applied as GitHub-native auto-merge, so the
|
|
4390
|
-
forge's own checks decide when the PR merges.
|
|
4407
|
+
forge's own checks decide when the PR merges. When GitHub GraphQL is unavailable,
|
|
4408
|
+
native auto-merge cannot be armed and the root leaf lands by polling instead
|
|
4409
|
+
(`landing.polling-selected`, once per candidate, decision and command). On a
|
|
4410
|
+
tick where GitHub reports the PR clear to merge (`clean`, `unstable` or
|
|
4411
|
+
`has_hooks`, with `mergeable` true) at the verified candidate head, the
|
|
4412
|
+
dispatcher rechecks consent and calls a guarded squash that re-reads that state
|
|
4413
|
+
fresh at the exact head, rechecks consent immediately before the merge request,
|
|
4414
|
+
and sends the head guard. Every other state, including `blocked`, `behind`,
|
|
4415
|
+
`dirty`, `unknown`, `draft` and any unrecognized value, never merges, so the
|
|
4416
|
+
gate is never bypassed even by a credential that could; Autobuild never relies
|
|
4417
|
+
on the forge refusing a premature merge. A quiet polling tick costs one
|
|
4418
|
+
conditional PR read, no GraphQL, queue or consent read, and appends nothing.
|
|
4419
|
+
The landing settles once as awaiting a human merge
|
|
4420
|
+
(`landing.human-merge-required`) when GitHub exposes a merge queue for the base
|
|
4421
|
+
over REST (a ruleset `merge_queue` rule, or `merge_queue_merge` activity GitHub
|
|
4422
|
+
reports for the base branch, checked on the candidate's first evaluation and
|
|
4423
|
+
before every merge) or refuses the guarded squash of a PR it had just reported
|
|
4424
|
+
clear; the refusal message is recorded and shown. A settled landing makes no
|
|
4425
|
+
further landing call for that candidate; a human merge on the forge is recorded
|
|
4426
|
+
like any other. A classic-protection merge queue that GitHub does not expose
|
|
4427
|
+
over REST and that has no recorded activity cannot be detected: a PR GitHub
|
|
4428
|
+
keeps reporting blocked there stays polling and never merges. Polling lands
|
|
4429
|
+
only while a dispatcher runs, so native auto-merge stays primary wherever
|
|
4430
|
+
GraphQL works. Only when the forge
|
|
4391
4431
|
authoritatively reports no gate may the janitor perform a normal,
|
|
4392
4432
|
head-guarded squash itself — never admin, force, or rebase — and only after
|
|
4393
4433
|
all verification and finalize work is complete. GitHub's exact documented
|
|
@@ -4551,6 +4591,41 @@ execution settings; each ready candidate retains its immutable `landing.decided`
|
|
|
4551
4591
|
rule snapshot and mode after config edits. Historical `build.auto-merge-requested`
|
|
4552
4592
|
and default-attribution fields remain replay-compatible but are not new controls.
|
|
4553
4593
|
|
|
4594
|
+
`[hooks.<name>]` declares an observe-only hook with exactly one target, a
|
|
4595
|
+
`command` or a `url`, plus optional `events` globs with `ab watch --event`
|
|
4596
|
+
grammar and catalog validation (absent means `ab watch`'s default attention
|
|
4597
|
+
filter) and `timeoutSeconds` (default 30). A `url` must be `https`, or `http`
|
|
4598
|
+
only to a loopback host, without credentials or a fragment; it requires
|
|
4599
|
+
`secretEnv`, the name of a dispatcher environment variable holding the signing
|
|
4600
|
+
secret, which must be set and nonblank. Bad names, duplicates, missing or doubled
|
|
4601
|
+
targets, bad URLs, a missing `secretEnv`, an unset or blank secret variable and
|
|
4602
|
+
globs matching no catalog event are rejected naming the hook, at startup and on
|
|
4603
|
+
reload; errors name the variable, never its value. The hosted dispatcher rejects
|
|
4604
|
+
command hooks as a config error and delivers url hooks. The lease-holding
|
|
4605
|
+
dispatcher feeds each hook an in-process watch feed from durable per-hook
|
|
4606
|
+
progress (a retention-managed `hook-progress.<name>` repository artifact) and
|
|
4607
|
+
delivers each record, the exact `ab watch --json` line with its stable `id`.
|
|
4608
|
+
A command runs once per record with the line on stdin; exit 0 within the timeout
|
|
4609
|
+
is success. A url receives one `POST` per record whose `application/json` body
|
|
4610
|
+
is that line without its newline, with headers `Autobuild-Hook` (the hook name),
|
|
4611
|
+
`Autobuild-Delivery` (the record `id`), `Autobuild-Timestamp` (Unix seconds, per
|
|
4612
|
+
attempt) and `Autobuild-Signature: v1=<hex HMAC-SHA256 of
|
|
4613
|
+
"<timestamp>.<body>" keyed by the secret>`; a 2xx response within the timeout is
|
|
4614
|
+
success, and any other status, a redirect (never followed), a timeout or a
|
|
4615
|
+
connection error is a failure. The secret never appears in events, status, logs
|
|
4616
|
+
or errors. Delivery is at-least-once, ordered per hook, one invocation at a
|
|
4617
|
+
time, outside the dispatch tick; no decision path reads a hook's outcome. A
|
|
4618
|
+
one-pass dispatch delivers until its first failure and stops in-flight
|
|
4619
|
+
deliveries at its deadline for redelivery next pass. A new hook name starts when
|
|
4620
|
+
first loaded; progress survives restarts, hot upgrades and reloads. Failures
|
|
4621
|
+
retry with increasing delay; five minutes of continuous failure records
|
|
4622
|
+
`hook.failing` once per episode, the next success `hook.recovered`, and
|
|
4623
|
+
unretrievable history `hook.skipped` with the skipped ranges. Feeds discover
|
|
4624
|
+
builds from the `ticket-preparation` announcements in the repository journal and
|
|
4625
|
+
never list the build population on a pass; idle passes read no event rows. `ab
|
|
4626
|
+
repository status` lists each hook's last success, backlog and failure; its JSON
|
|
4627
|
+
also carries the hook's `command` or `url`.
|
|
4628
|
+
|
|
4554
4629
|
|
|
4555
4630
|
```toml
|
|
4556
4631
|
baseBranch = "main"
|
|
@@ -4562,6 +4637,12 @@ plugins = ["./plugins/local.ts", "@acme/autobuild-plugin"]
|
|
|
4562
4637
|
[upgrade]
|
|
4563
4638
|
automatic = true # immediate/60-second target checks; false requires manual restart
|
|
4564
4639
|
|
|
4640
|
+
#[hooks.notify] # optional observe-only hook; exactly one of command or url
|
|
4641
|
+
#command = "./tools/notify.sh" # one ab watch --json record on stdin per invocation; local dispatchers only
|
|
4642
|
+
#url = "https://hooks.example.com/autobuild" # or: one signed JSON POST per record
|
|
4643
|
+
#secretEnv = "NOTIFY_HOOK_SECRET" # required with url; names the signing-secret variable
|
|
4644
|
+
#events = ["escalation.*"] # optional; default is the watch attention set
|
|
4645
|
+
|
|
4565
4646
|
#[workspace] # optional; default provider = "git-worktree"
|
|
4566
4647
|
#provider = "vercel-sandbox" # shipped remote provider, or plugin name
|
|
4567
4648
|
#[workspace.config]
|
package/docs/architecture.md
CHANGED
|
@@ -93,7 +93,7 @@ remote-store protocol requires matching client and server versions.
|
|
|
93
93
|
| `packages/core/src/ports/` | TicketSource / Workspace / Forge / AgentRunner / Telemetry interfaces, adapters, and fakes; registry-aware builtin/plugin construction; eager primary/alternate runtime routing and provider-failure classification, awaited native identity observation and optional fresh-process native resume under `ports/runner/` | §3.2, §9, §13 |
|
|
94
94
|
| `packages/core/src/plugins/` | Strict versioned plugin manifests, dual-root repository/package Bun loading, owner-aware adapter registration, contract/credential metadata, and runtime-factory materialization | §3.2.1, §9 |
|
|
95
95
|
| `packages/core/src/plugin-sdk/` | The sole supported `@defrex/autobuild/plugin-sdk` barrel: port/manifest types, contract suites, and reference fakes | §3.2.1 |
|
|
96
|
-
| `packages/core/src/processes/` | build-runner and standalone child composition, durable execution config/diagnostics, dispatcher (+ janitor duty, sandbox idle settlement and harvest trigger), harvest deterministic core + runner | §3.3, §7.1.2, §12, §15.7 |
|
|
96
|
+
| `packages/core/src/processes/` | build-runner and standalone child composition, durable execution config/diagnostics, dispatcher (+ janitor duty, sandbox idle settlement and harvest trigger), harvest deterministic core + runner, configured hook delivery (`hooks.ts`, `hook-command.ts`, `hook-webhook.ts`) | §3.3, §7.1.2, §12, §15.7, §16.1 |
|
|
97
97
|
| `packages/core/src/cli/` and `bin/` | The `ab` CLI — the only agent↔store channel — plus the shared presentation-only durable-progress projection, init/upgrade, the filesystem-only dispatch launcher and immutable generation cache, the dispatch frontend (Store-backed, plus the viewer's ticket-source triage count), its private supervised kernel entry, and `bin/ab-build-runner.ts` (one child per build) | §8, §14, §16.3 |
|
|
98
98
|
| `packages/core/src/cli/dashboard/` | `ab dispatch`'s fixed live frame: pure projection, renderer, poll cache, and deterministic image renderer | §14 |
|
|
99
99
|
| `bin/agent/ab` | Private launcher placed first on agent-session `PATH`; delegates to the canonical `bin/ab.ts` | §8.1 |
|
|
@@ -882,13 +882,30 @@ or reporting failure.
|
|
|
882
882
|
**Stable build identity.** The forge merge seam accepts optional build identity at operation time. Both
|
|
883
883
|
built-in adapters preserve their squash message and normalize a final
|
|
884
884
|
`Autobuild-Build: <slug>` trailer through `packages/core/src/kernel/build-identity.ts`. The GitHub
|
|
885
|
-
adapter
|
|
886
|
-
|
|
885
|
+
adapter derives the squash headline/body from the PR and the repository's
|
|
886
|
+
`squash_merge_commit_title` and `squash_merge_commit_message` settings
|
|
887
|
+
(`packages/core/src/ports/forge/github-squash-message.ts`), all read over REST;
|
|
888
|
+
GraphQL carries only the native enable and disable mutations. The transport
|
|
889
|
+
wrapper classifies a GraphQL 403 that says GraphQL is unavailable (Claude Code's
|
|
890
|
+
GitHub proxy) as `GitHubGraphQLUnavailable`, after the shared rate-limit and
|
|
891
|
+
transient classification and never as a `ForgeFailure`. Each `GitHubForge`
|
|
892
|
+
instance memoizes availability: one read-only `rateLimit` probe decides it, and
|
|
893
|
+
a refusal suppresses GraphQL for `GITHUB_GRAPHQL_RECHECK_MS` (30 minutes). With
|
|
894
|
+
GraphQL unavailable, `setAutoMerge` routes a gated root leaf to `polling` or,
|
|
895
|
+
when GitHub exposes a merge queue over REST, `human-merge`; the dispatcher
|
|
896
|
+
records `landing.polling-selected` or `landing.human-merge-required`, squashes a
|
|
897
|
+
clear PR through `squashMerge` with `requireClearState`, and settles when GitHub
|
|
898
|
+
refuses that merge. A current polling fact lets a quiet tick answer from the
|
|
899
|
+
poll's PR read alone. The janitor
|
|
887
900
|
maintains native request message freshness after acknowledgement. A matching
|
|
888
|
-
request costs
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
901
|
+
request costs the PR representation the poll already read plus one conditional
|
|
902
|
+
repository read shared by every build in the tick; a PR's commit messages are
|
|
903
|
+
read once per commit set. It needs no extra consent or pipeline read and no
|
|
904
|
+
merge-queue read; full gate inspection, including the queue check, and
|
|
905
|
+
refreshed durable consent/engine eligibility precede any repair. Comparison
|
|
906
|
+
normalizes line endings and tolerates provider trimming of surrounding
|
|
907
|
+
headline whitespace and trailing body whitespace while preserving the
|
|
908
|
+
headline, body content, and squash method.
|
|
892
909
|
`packages/core/src/kernel/issue-keywords.ts` composes a build's sealed issue
|
|
893
910
|
links into `Closes #N` / `Refs #N` lines, neutralizes closing keywords aimed at
|
|
894
911
|
`refs` issues, and places the keyword paragraph before the trailer block; a
|
|
@@ -930,13 +947,17 @@ cleanup observations. Unsupported or failed inspection leaves evidence unknown;
|
|
|
930
947
|
a read failure also records an observation without preventing completion. Old
|
|
931
948
|
logs need no migration and keep the same status and presentation.
|
|
932
949
|
|
|
933
|
-
GitHub merge queues ignore squash-message overrides.
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
950
|
+
GitHub merge queues ignore squash-message overrides. Native enable, repair and
|
|
951
|
+
the guarded direct squash read the base's effective branch rules over REST
|
|
952
|
+
(`rules/branches/{branch}`, including organization rules) and treat a
|
|
953
|
+
`merge_queue` rule as a queue; a quiet poll of an already matching request reads
|
|
954
|
+
no rules. The base comes from the REST PR representation and must equal the
|
|
955
|
+
build's base branch: a retargeted PR defers native enable and refuses the
|
|
956
|
+
direct squash rather than following the new base.
|
|
937
957
|
Kernel auto-merge therefore
|
|
938
|
-
returns an actionable `unproven-gate-state` deferral for queue-protected bases
|
|
939
|
-
|
|
958
|
+
returns an actionable `unproven-gate-state` deferral for queue-protected bases,
|
|
959
|
+
or, with GraphQL unavailable, settles the landing as awaiting a human merge; it
|
|
960
|
+
never bypasses the queue. Human queue merges still settle normally with
|
|
940
961
|
inspected trailer evidence when available. Expected-head guards and recurring
|
|
941
962
|
polls bound native message freshness, but cannot prevent a push and automatic
|
|
942
963
|
merge from both completing between polls.
|
|
@@ -1687,7 +1708,10 @@ The optional grouped Forge rewrite capability owns authoritative head snapshots,
|
|
|
1687
1708
|
immutable `refs/autobuild/archive/<slug>/<sha>` publication and expected-head CAS.
|
|
1688
1709
|
Remote archives also publish commits present only on the remote: GitHub uses create-only
|
|
1689
1710
|
Git-reference REST creation when the workspace lacks the commit, retaining guarded Git
|
|
1690
|
-
pushes for local objects.
|
|
1711
|
+
pushes for local objects. `gitRewrite` takes an optional refusal fallback: when a remote
|
|
1712
|
+
archive push exits non-zero without a transient classification, GitHub creates the
|
|
1713
|
+
identical ref through the same REST call, probing the commit only after a 422 to report a
|
|
1714
|
+
local-only commit. Exact remote readback confirms publication, then a non-shallow
|
|
1691
1715
|
fetch of only that exact archive ref (without tags, configured refmap expansion or a
|
|
1692
1716
|
depth limit) restores missing commits and their missing ancestry, writes no shallow
|
|
1693
1717
|
boundary, leaves an already-shallow repository's existing boundaries unchanged, and
|
package/docs/configuration.md
CHANGED
|
@@ -258,7 +258,7 @@ Changing the store requires restarting dispatch.
|
|
|
258
258
|
|
|
259
259
|
Parsing is strict. Unknown top-level keys or tables, unknown fields in a known
|
|
260
260
|
table, fields from the wrong step variant, malformed values, and dangling
|
|
261
|
-
command references are errors. The open maps are `[accounts]`, `[commands]`, `[roles]`,
|
|
261
|
+
command references are errors. The open maps are `[accounts]`, `[commands]`, `[hooks]`, `[roles]`,
|
|
262
262
|
`[profiles]`, `[profiles.<name>.roles]`, `[workspace.config]`, `[workspace.config.runtimeProvisioning]`,
|
|
263
263
|
`[verify.<step>]`, and `[finalize.<step>]`. Autobuild
|
|
264
264
|
validates repository-defined command, role, and step entries.
|
|
@@ -322,7 +322,7 @@ the branch head never carried the file — the deposit records the source
|
|
|
322
322
|
provenance declines to attribute them to any commit. **Deployment-owned** sections — `[accounts]`, `[roles]`
|
|
323
323
|
(runtime, model, account, args, alternates, per-role `sessionBudgetSeconds`),
|
|
324
324
|
`[profiles]` and `[policy]` — keep flowing live. **Dispatcher-owned** sections (`baseBranch`,
|
|
325
|
-
`capacity`, `ticketScanIntervalSeconds`, `forge`, `plugins`, `pr`, `tickets`, `orchestrator`) configure the
|
|
325
|
+
`capacity`, `ticketScanIntervalSeconds`, `forge`, `plugins`, `pr`, `tickets`, `orchestrator`, `hooks`) configure the
|
|
326
326
|
dispatcher itself and are never interpreted by the build runner.
|
|
327
327
|
|
|
328
328
|
Consequently, an accepted base-branch reload re-deposits only the
|
|
@@ -385,6 +385,7 @@ These fields hot-reload:
|
|
|
385
385
|
| `[roles]` | Next agent invocation for that role. Runtime, model, args, alternates, and the session budget are captured together and delivered live. |
|
|
386
386
|
| `[profiles]` | Next agent session of a build that selected the profile; builds without it are unaffected. A build's selected profile name never changes after claim. |
|
|
387
387
|
| `[upgrade]` | Cancels preparation when disabled; automatic target checks every 60 seconds. |
|
|
388
|
+
| `[hooks]` | After the next dispatcher tick: an added hook starts at its baseline, a removed one stops, and a changed one resumes from its saved progress. |
|
|
388
389
|
| `[policy]` | Next policy, convergence, or agent-session boundary, delivered live. A running session keeps its captured budget. |
|
|
389
390
|
| `tickets.readyLabels`, `tickets.readyState`, `tickets.readyAssignee` | Next ready-ticket scan. |
|
|
390
391
|
| `tickets.triageState`, `tickets.proposalState` | Next dispatcher handback or harvest filing boundary. |
|
|
@@ -3567,6 +3568,241 @@ receive no credential. The dispatcher retains idle settlement but never
|
|
|
3567
3568
|
constructs a turn runner. Tools stay gated by `[orchestrator].enabled` and the
|
|
3568
3569
|
registry's closed-table filtering; external harnesses own approvals.
|
|
3569
3570
|
|
|
3571
|
+
## `[hooks]`
|
|
3572
|
+
|
|
3573
|
+
A hook is a named, observe-only consumer of the same records `ab watch --json`
|
|
3574
|
+
prints. The lease-holding dispatcher delivers each record that matches a
|
|
3575
|
+
hook's filter to the hook's command or URL, one record per delivery, so tooling can
|
|
3576
|
+
react to escalations, merges awaiting consent, or tickets handed back without
|
|
3577
|
+
keeping its own `ab watch` process alive. A hook cannot change any build's state,
|
|
3578
|
+
phase, verdict or merge decision; gating belongs to `[verify]`, `[finalize]` and
|
|
3579
|
+
`[[merge]]`.
|
|
3580
|
+
|
|
3581
|
+
<!-- configuration-reference:hooks -->
|
|
3582
|
+
|
|
3583
|
+
#### `hooks`
|
|
3584
|
+
|
|
3585
|
+
**TOML key:** `hooks`
|
|
3586
|
+
|
|
3587
|
+
- **Type:** `table`
|
|
3588
|
+
- **Default:** `{}`
|
|
3589
|
+
- **Required:** Optional
|
|
3590
|
+
- **Reload:** Hot: next dispatcher action captures the accepted value. A running invocation keeps its captured values.
|
|
3591
|
+
|
|
3592
|
+
**Description:** Named observe-only hooks: the dispatcher delivers each matching watch record to a command or URL, in order and at least once.
|
|
3593
|
+
|
|
3594
|
+
**Constraints:** Entry names: nonempty
|
|
3595
|
+
|
|
3596
|
+
#### `hooks.<name>`
|
|
3597
|
+
|
|
3598
|
+
**TOML key:** `hooks.<name>`
|
|
3599
|
+
|
|
3600
|
+
- **Type:** `strict table`
|
|
3601
|
+
- **Default:** `omitted`
|
|
3602
|
+
- **Required:** Required
|
|
3603
|
+
- **Reload:** Hot: next dispatcher action captures the accepted value. A running invocation keeps its captured values.
|
|
3604
|
+
|
|
3605
|
+
**Description:** Named observe-only hook delivered matching watch records by the dispatcher.
|
|
3606
|
+
|
|
3607
|
+
**Constraints:** Hook names use ASCII letters, digits, ., _ and -. Exactly one of command or url. A url hook requires secretEnv naming a set, nonempty variable in the dispatcher environment. The hosted dispatcher rejects command hooks and delivers url hooks.
|
|
3608
|
+
|
|
3609
|
+
#### `hooks.<name>.command`
|
|
3610
|
+
|
|
3611
|
+
**TOML key:** `hooks.<name>.command`
|
|
3612
|
+
|
|
3613
|
+
- **Type:** `string`
|
|
3614
|
+
- **Default:** `omitted`
|
|
3615
|
+
- **Required:** Optional
|
|
3616
|
+
- **Reload:** Hot: next dispatcher action captures the accepted value. A running invocation keeps its captured values.
|
|
3617
|
+
|
|
3618
|
+
**Description:** Shell command run from the repository checkout once per record, with the record as one JSON line on stdin. Exit status 0 within the timeout is success. Set exactly one of command or url.
|
|
3619
|
+
|
|
3620
|
+
**Constraints:** hook command must be nonblank
|
|
3621
|
+
|
|
3622
|
+
#### `hooks.<name>.url`
|
|
3623
|
+
|
|
3624
|
+
**TOML key:** `hooks.<name>.url`
|
|
3625
|
+
|
|
3626
|
+
- **Type:** `string`
|
|
3627
|
+
- **Default:** `omitted`
|
|
3628
|
+
- **Required:** Optional
|
|
3629
|
+
- **Reload:** Hot: next dispatcher action captures the accepted value. A running invocation keeps its captured values.
|
|
3630
|
+
|
|
3631
|
+
**Description:** HTTPS endpoint that receives each record as a signed JSON POST; http only to loopback. A 2xx response within the timeout is success; redirects are not followed.
|
|
3632
|
+
|
|
3633
|
+
**Constraints:** Absolute HTTPS URL; HTTP allowed only to loopback (localhost, 127.0.0.0/8, [::1]). No credentials or fragment. Query strings are kept.
|
|
3634
|
+
|
|
3635
|
+
#### `hooks.<name>.secretEnv`
|
|
3636
|
+
|
|
3637
|
+
**TOML key:** `hooks.<name>.secretEnv`
|
|
3638
|
+
|
|
3639
|
+
- **Type:** `string`
|
|
3640
|
+
- **Default:** `omitted`
|
|
3641
|
+
- **Required:** Optional
|
|
3642
|
+
- **Reload:** Hot: next dispatcher action captures the accepted value. A running invocation keeps its captured values.
|
|
3643
|
+
|
|
3644
|
+
**Description:** Name of the dispatcher environment variable holding the HMAC signing secret; required with url. The value never appears in config, events, status or logs.
|
|
3645
|
+
|
|
3646
|
+
**Constraints:** matches /^[A-Za-z_][A-Za-z0-9_]*$/
|
|
3647
|
+
|
|
3648
|
+
#### `hooks.<name>.events`
|
|
3649
|
+
|
|
3650
|
+
**TOML key:** `hooks.<name>.events`
|
|
3651
|
+
|
|
3652
|
+
- **Type:** `array of string`
|
|
3653
|
+
- **Default:** `omitted`
|
|
3654
|
+
- **Required:** Optional
|
|
3655
|
+
- **Reload:** Hot: next dispatcher action captures the accepted value. A running invocation keeps its captured values.
|
|
3656
|
+
|
|
3657
|
+
**Description:** Event globs with `ab watch --event` grammar, validated against the build and repository catalogs. Absent means the default attention filter of `ab watch`.
|
|
3658
|
+
|
|
3659
|
+
**Constraints:** minimum length 1; Each item: event globs must be nonblank
|
|
3660
|
+
|
|
3661
|
+
#### `hooks.<name>.timeoutSeconds`
|
|
3662
|
+
|
|
3663
|
+
**TOML key:** `hooks.<name>.timeoutSeconds`
|
|
3664
|
+
|
|
3665
|
+
- **Type:** `number`
|
|
3666
|
+
- **Default:** `30`
|
|
3667
|
+
- **Required:** Optional
|
|
3668
|
+
- **Reload:** Hot: next dispatcher action captures the accepted value. A running invocation keeps its captured values.
|
|
3669
|
+
|
|
3670
|
+
**Description:** Seconds one delivery may take (a command run or a request) before it is stopped and counted as a failure.
|
|
3671
|
+
|
|
3672
|
+
**Constraints:** safe integer; > 0; ≤ 3600
|
|
3673
|
+
|
|
3674
|
+
<!-- configuration-reference:/hooks -->
|
|
3675
|
+
|
|
3676
|
+
<!-- config-fragment -->
|
|
3677
|
+
```toml
|
|
3678
|
+
[hooks.notify]
|
|
3679
|
+
command = "./tools/notify.sh"
|
|
3680
|
+
|
|
3681
|
+
[hooks.audit]
|
|
3682
|
+
command = "cat >> .autobuild/audit.jsonl"
|
|
3683
|
+
events = ["escalation.*", "ticket.handed-back", "hook.*"]
|
|
3684
|
+
timeoutSeconds = 10
|
|
3685
|
+
|
|
3686
|
+
[hooks.relay]
|
|
3687
|
+
url = "https://hooks.example.com/autobuild"
|
|
3688
|
+
secretEnv = "RELAY_HOOK_SECRET"
|
|
3689
|
+
```
|
|
3690
|
+
|
|
3691
|
+
**Names and validation.** Hook names use ASCII letters, digits, `.`, `_` and
|
|
3692
|
+
`-`. Each `[hooks.<name>]` table is declared once and sets exactly one target:
|
|
3693
|
+
a `command` or a `url`. A `url` must use `https`, or `http` only to a loopback
|
|
3694
|
+
host (`localhost`, `127.0.0.0/8`, `[::1]`), and may not carry credentials or a
|
|
3695
|
+
fragment. A url hook needs `secretEnv`, the name of the environment variable
|
|
3696
|
+
holding its signing secret; `secretEnv` is rejected on a command hook. The
|
|
3697
|
+
dispatcher checks that the variable is set and not blank in its own
|
|
3698
|
+
environment, and the error names the variable, never a value. Each `events`
|
|
3699
|
+
entry uses the `ab watch --event` grammar and must match an event type in the
|
|
3700
|
+
build or repository catalog, or `dispatcher.lost`; a glob that matches nothing
|
|
3701
|
+
is rejected. Every error names the hook, at startup and on reload.
|
|
3702
|
+
|
|
3703
|
+
**Default filter.** A hook without `events` receives exactly `ab watch`'s default
|
|
3704
|
+
attention set: the build attention events, conflicted restacks, the derived
|
|
3705
|
+
`build.consent-ready` and `build.merge-decision` observations, repository
|
|
3706
|
+
attention including `hook.failing`, `hook.recovered` and `hook.skipped`, the
|
|
3707
|
+
derived persistent-failure observations, and `dispatcher.lost`. Supplying
|
|
3708
|
+
`events` replaces that set entirely, as `--event` does.
|
|
3709
|
+
|
|
3710
|
+
**The record.** A command runs with `sh -c` from the repository checkout. Its
|
|
3711
|
+
stdin carries one record as a single JSON line, identical to the line `ab watch
|
|
3712
|
+
--json` prints for the same event under the same filter, including derived
|
|
3713
|
+
records. The environment is the dispatcher's, without build or session
|
|
3714
|
+
identity variables, plus `AB_HOOK=<name>`.
|
|
3715
|
+
|
|
3716
|
+
```json
|
|
3717
|
+
{"id":"build:add-login-7f3a:12","build":"add-login-7f3a","event":{"build":"add-login-7f3a","seq":12,"type":"escalation.raised","payload":{"id":"esc_4","question":"Which auth store?"},"…":"…"},"state":{"status":"blocked","phase":"implement","…":"…"},"cursor":"v1.…"}
|
|
3718
|
+
```
|
|
3719
|
+
|
|
3720
|
+
`id` is the record's stable identity: `build:<slug>:<seq>` for a build event,
|
|
3721
|
+
`repo:<seq>` for a repository event, `<observation type>:<identity>` for a derived
|
|
3722
|
+
observation, and `dispatcher.lost:<run>`. `cursor` is the hook's position after
|
|
3723
|
+
the record and is a valid `ab watch --since` cursor.
|
|
3724
|
+
|
|
3725
|
+
**Delivery guarantee.** For a command, exit status 0 within `timeoutSeconds` is
|
|
3726
|
+
success; anything else, including a timeout, is failure, and the command's whole
|
|
3727
|
+
process group is killed. For a URL, a 2xx response within `timeoutSeconds` is
|
|
3728
|
+
success; any other status, a redirect, a timeout or a connection error is
|
|
3729
|
+
failure. Each hook receives its records in order, one invocation at a
|
|
3730
|
+
time: a record is not delivered until the previous one succeeded. Delivery is
|
|
3731
|
+
at least once — a consumer can see a record again after a restart or a failed
|
|
3732
|
+
attempt — so deduplicate by `id`. Each hook has its own loop outside the
|
|
3733
|
+
dispatch tick; one hook's failures or slowness never delay another hook, a tick,
|
|
3734
|
+
or a build.
|
|
3735
|
+
|
|
3736
|
+
**Progress.** Each hook's position is durable, keyed by its name, and survives
|
|
3737
|
+
dispatcher restarts, hot upgrades and config reloads: delivery resumes after the
|
|
3738
|
+
last successful record. Changing a hook's command or filter resumes from its
|
|
3739
|
+
saved position. A hook with a new name starts when it is first loaded and does
|
|
3740
|
+
not replay history, so renaming a hook starts it fresh; re-adding a removed name
|
|
3741
|
+
resumes where it stopped. If a hook falls so far behind that its undelivered
|
|
3742
|
+
history can no longer be read, it resumes from the current position and records
|
|
3743
|
+
`hook.skipped` with the skipped ranges. `ab dispatch --once` makes one delivery
|
|
3744
|
+
pass per hook and stops at the first failure; the next invocation retries.
|
|
3745
|
+
|
|
3746
|
+
**Webhook delivery.** A url hook receives one `POST` per record. The body is the
|
|
3747
|
+
record line without its trailing newline, sent as `Content-Type:
|
|
3748
|
+
application/json` with `User-Agent: autobuild-hook`, and these headers:
|
|
3749
|
+
|
|
3750
|
+
| Header | Value |
|
|
3751
|
+
| --- | --- |
|
|
3752
|
+
| `Autobuild-Hook` | The hook name. |
|
|
3753
|
+
| `Autobuild-Delivery` | The record `id`, the same on every redelivery. Deduplicate on it. |
|
|
3754
|
+
| `Autobuild-Timestamp` | Unix seconds when this attempt was sent. |
|
|
3755
|
+
| `Autobuild-Signature` | `v1=` and the lowercase hex HMAC-SHA256 of `<timestamp>.<body>`, keyed by the secret's UTF-8 bytes. |
|
|
3756
|
+
|
|
3757
|
+
Redirects are not followed, the response body is ignored, and failure text
|
|
3758
|
+
records only the status or the kind of error, never the URL, headers, body or
|
|
3759
|
+
secret.
|
|
3760
|
+
|
|
3761
|
+
**Verifying a signature.** A receiver recomputes the HMAC over the timestamp
|
|
3762
|
+
header, a `.`, and the raw request body, compares it in constant time, and
|
|
3763
|
+
rejects a timestamp too far from its own clock so a captured request cannot be
|
|
3764
|
+
replayed later. Five minutes is a reasonable tolerance.
|
|
3765
|
+
|
|
3766
|
+
```ts
|
|
3767
|
+
import { createHmac, timingSafeEqual } from 'node:crypto'
|
|
3768
|
+
|
|
3769
|
+
const TOLERANCE_SECONDS = 5 * 60
|
|
3770
|
+
|
|
3771
|
+
export async function verifyAutobuildHook(request: Request, secret: string): Promise<string> {
|
|
3772
|
+
const timestamp = request.headers.get('autobuild-timestamp') ?? ''
|
|
3773
|
+
const signature = request.headers.get('autobuild-signature') ?? ''
|
|
3774
|
+
const body = await request.text() // the raw body, before any JSON parsing
|
|
3775
|
+
const expected = `v1=${createHmac('sha256', secret).update(`${timestamp}.${body}`).digest('hex')}`
|
|
3776
|
+
const age = Math.abs(Date.now() / 1000 - Number(timestamp))
|
|
3777
|
+
if (
|
|
3778
|
+
!(age <= TOLERANCE_SECONDS) ||
|
|
3779
|
+
signature.length !== expected.length ||
|
|
3780
|
+
!timingSafeEqual(Buffer.from(signature), Buffer.from(expected))
|
|
3781
|
+
)
|
|
3782
|
+
throw new Error('invalid Autobuild hook signature')
|
|
3783
|
+
return body // JSON.parse(body) is the record; skip it if Autobuild-Delivery was already handled
|
|
3784
|
+
}
|
|
3785
|
+
```
|
|
3786
|
+
|
|
3787
|
+
As a test vector, the secret `example-secret`, timestamp `1794909600` and body
|
|
3788
|
+
`{"id":"c1.0"}` sign to
|
|
3789
|
+
`v1=8c513d8d2b28c00d3c4f56b8afacc447ba1bd294e1df5f1b60b0ea1fe7d57a54`.
|
|
3790
|
+
|
|
3791
|
+
**Failures and status.** A failed delivery is retried with increasing delay, up
|
|
3792
|
+
to one minute between attempts. After five minutes of continuous failure the
|
|
3793
|
+
dispatcher records `hook.failing` with the hook name and latest error, once per
|
|
3794
|
+
failure episode; the first later success records `hook.recovered`. `ab
|
|
3795
|
+
repository status` lists each configured hook with its last successful delivery,
|
|
3796
|
+
its pending backlog or "caught up", and whether it is failing.
|
|
3797
|
+
|
|
3798
|
+
**Hosted dispatchers.** Command hooks need a dispatcher that can run local
|
|
3799
|
+
commands. The hosted dispatcher rejects a configured command hook as a config
|
|
3800
|
+
error naming the hook; it is never silently ignored. Url hooks work on local and
|
|
3801
|
+
hosted dispatchers alike: the variable `secretEnv` names must be set in the
|
|
3802
|
+
environment of whichever dispatcher delivers them. Each hosted invocation makes
|
|
3803
|
+
one delivery pass, and a delivery still in flight at the invocation's deadline
|
|
3804
|
+
is stopped and redelivered by the next one.
|
|
3805
|
+
|
|
3570
3806
|
## Complete example
|
|
3571
3807
|
|
|
3572
3808
|
The following deliberately exercises every fixed table and both verify/finalize
|
|
@@ -3658,6 +3894,11 @@ createState = "Triage"
|
|
|
3658
3894
|
triageState = "Triage"
|
|
3659
3895
|
proposalState = "Triage"
|
|
3660
3896
|
dir = "tickets"
|
|
3897
|
+
|
|
3898
|
+
[hooks.notify]
|
|
3899
|
+
command = "./tools/notify.sh"
|
|
3900
|
+
events = ["escalation.*", "ticket.handed-back"]
|
|
3901
|
+
timeoutSeconds = 10
|
|
3661
3902
|
```
|
|
3662
3903
|
|
|
3663
3904
|
This repository's [`autobuild.toml`](../autobuild.toml) is another worked
|
|
@@ -4033,8 +4274,10 @@ uses the no-rules fallback.
|
|
|
4033
4274
|
|
|
4034
4275
|
Native auto-merge is reconciled on every janitor poll against durable desired
|
|
4035
4276
|
merge state. While a consented request is armed and the build is eligible, each
|
|
4036
|
-
poll also reads the forge's armed merge method and message (
|
|
4037
|
-
|
|
4277
|
+
poll also reads the forge's armed merge method and message (on GitHub, the PR
|
|
4278
|
+
read the poll already made plus one conditional repository settings read; a
|
|
4279
|
+
PR's commit messages are read only when the squash settings need them, and are
|
|
4280
|
+
cached per commit set, so a moved head or base re-reads them). A request with a different method, headline, body or
|
|
4038
4281
|
`Autobuild-Build` trailer, including one a human enabled, is replaced under the
|
|
4039
4282
|
consent and gate guards before it counts as applied. A matching request costs
|
|
4040
4283
|
no mutation, consent read or event. It is disabled while held, unauthorized, unready, or replacement
|
|
@@ -140,6 +140,10 @@ credentials stay on the host and are applied by provider-scoped egress header
|
|
|
140
140
|
transforms.
|
|
141
141
|
See [origin-mode setup](setup.md#running-the-dispatcher-without-a-checkout-origin-mode) and [Workspaces](workspaces.md).
|
|
142
142
|
|
|
143
|
+
Configured hooks on the hosted dispatcher deployment must be URL hooks: it
|
|
144
|
+
rejects command hooks, and delivers URL hooks once their `secretEnv` variable is
|
|
145
|
+
set in its environment. See [`[hooks]`](configuration.md#hooks).
|
|
146
|
+
|
|
143
147
|
Integration nodes need Git on the dispatcher host even in origin mode: the
|
|
144
148
|
kernel bare-clones the origin to snapshot, restack, check presence and land.
|
|
145
149
|
The hosted dispatcher deployment ships its own self-contained `linux-x64` Git
|
package/docs/merge-policy.md
CHANGED
|
@@ -182,9 +182,36 @@ merge; uncertainty is recorded as unfenced and requires immutable merged-tree
|
|
|
182
182
|
audit. A mismatch raises operator attention without rewriting the shared parent.
|
|
183
183
|
Pending audits survive completion and retry until settled.
|
|
184
184
|
|
|
185
|
-
Root
|
|
186
|
-
|
|
187
|
-
|
|
185
|
+
Root leaves land by one of three routes. Behind a real merge-blocking gate,
|
|
186
|
+
Autobuild arms GitHub-native auto-merge. An authoritatively ungated root
|
|
187
|
+
permits an inspected-head guarded direct squash; unknown gate state defers.
|
|
188
|
+
When GitHub GraphQL is unavailable to the dispatcher, as from Claude Code on
|
|
189
|
+
the web, whose GitHub proxy refuses GraphQL, native auto-merge cannot be
|
|
190
|
+
armed, so a gated root leaf lands by polling. On each dispatcher tick
|
|
191
|
+
Autobuild checks whether GitHub reports the PR clear to merge (`clean`,
|
|
192
|
+
`unstable` or `has_hooks`, and mergeable) at the verified head. It then reads
|
|
193
|
+
that state again, rechecks consent, and squashes guarded on that head. It
|
|
194
|
+
never relies on GitHub refusing a premature merge, so a credential that could
|
|
195
|
+
bypass branch protection never merges a blocked PR. Rows show
|
|
196
|
+
`merge polling`. Polling lands only while a dispatcher runs, so native
|
|
197
|
+
auto-merge stays the route wherever GraphQL works: it lands even after the
|
|
198
|
+
dispatcher stops.
|
|
199
|
+
|
|
200
|
+
A polling landing settles once into awaiting a human merge, shown as
|
|
201
|
+
`merge awaits a human merge`, and Autobuild makes no further landing attempt
|
|
202
|
+
for that candidate when either holds: GitHub exposes a merge queue for the
|
|
203
|
+
base over REST (a ruleset merge-queue rule, or merge-queue merges GitHub
|
|
204
|
+
reports for the base branch), or GitHub refuses the guarded squash of a PR it
|
|
205
|
+
had just reported clear, in which case its refusal message is shown. A squash
|
|
206
|
+
request cannot enter a merge queue. A human merges the PR on GitHub, and
|
|
207
|
+
Autobuild records that like any human forge merge. A classic
|
|
208
|
+
branch-protection merge queue that GitHub does not expose over REST and has
|
|
209
|
+
never recorded a merge-queue merge cannot be detected. A PR GitHub keeps
|
|
210
|
+
reporting blocked there stays `merge polling` and never merges. In
|
|
211
|
+
GraphQL-blocked environments, use a ruleset merge queue or merge such PRs by
|
|
212
|
+
hand.
|
|
213
|
+
|
|
214
|
+
Node targets instead require authoritative proof of
|
|
188
215
|
an ungated destination, cancel native auto-merge and serialize the guarded push.
|
|
189
216
|
Gated or unproven node destinations stay open with actionable diagnostics.
|
|
190
217
|
A push alone is not evidence of merge: a node-target merge is recorded only
|
|
@@ -198,7 +225,16 @@ replacement confirms cancellation first; the next poll reconciles native state
|
|
|
198
225
|
before other actions. Stale enables are repaired by polling. An
|
|
199
226
|
already-enabled native request counts as applied only after the forge confirms
|
|
200
227
|
its squash method and identity message. Each eligible poll re-reads an armed
|
|
201
|
-
request and repairs it when PR edits or a human arm left it stale.
|
|
228
|
+
request and repairs it when PR edits or a human arm left it stale. On GitHub
|
|
229
|
+
the expected headline and body come from the PR and the repository's squash
|
|
230
|
+
title and message settings, with the build trailer and issue-link handling on
|
|
231
|
+
top. Landing reads use REST; GraphQL only arms or disarms native auto-merge,
|
|
232
|
+
after one read-only availability probe per dispatcher process. A GraphQL
|
|
233
|
+
refusal is remembered for 30 minutes, so a blocked environment sends at most
|
|
234
|
+
one GraphQL request per process in that window, and none on a quiet polling
|
|
235
|
+
tick. Quiet polls do not re-check merge queues; native enable, repair and
|
|
236
|
+
direct merge do, and the polling route checks merge-queue activity when it
|
|
237
|
+
first selects polling and again whenever GitHub reports the PR clear. This bounded
|
|
202
238
|
model requires replacement-head checks to take far longer than a poll interval. It
|
|
203
239
|
has no durable native-effect reservation. Human forge merges record whether a
|
|
204
240
|
hold was overridden; possible stale-enable merges raise operator attention.
|
|
@@ -209,7 +245,11 @@ No result is undone by rewriting the target.
|
|
|
209
245
|
The kernel must publish and fetch immutable exact archive refs under
|
|
210
246
|
`refs/autobuild/archive/<slug>/<sha>` and replace branches with an exact
|
|
211
247
|
expected-old-head guard. Namespace or permission failures stop publication;
|
|
212
|
-
there is no branch/tag fallback.
|
|
248
|
+
there is no branch/tag fallback. When an environment refuses non-branch Git pushes,
|
|
249
|
+
as Claude Code on the web's GitHub proxy does, the GitHub adapter creates the same
|
|
250
|
+
archive ref through REST ref creation and confirms it by exact readback. Commits that
|
|
251
|
+
exist only in the local workspace cannot use this fallback and fail with an actionable
|
|
252
|
+
error. Archive retention remains indefinite pending a
|
|
213
253
|
retention policy. See [restacking](restacking.md).
|
|
214
254
|
|
|
215
255
|
Tree admission requires node branch creation, authoritative branch-head reads
|