@defrex/autobuild 1.16.0 → 1.18.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 +132 -9
- package/docs/answering-blocked-builds.md +34 -1
- package/docs/architecture.md +42 -3
- package/docs/configuration.md +44 -7
- package/docs/dispatcher-hosting.md +5 -3
- package/docs/operator-api.md +29 -6
- package/docs/plugin-authoring.md +30 -1
- package/docs/remote-store-protocol.md +13 -3
- package/docs/remote-ticket-protocol.md +37 -2
- package/docs/restacking.md +46 -1
- package/docs/setup.md +24 -9
- package/docs/ticket-sources.md +28 -1
- package/docs/troubleshooting.md +54 -2
- package/docs/workspaces.md +3 -1
- package/package.json +4 -4
- package/packages/core/src/cli/accounts.ts +3 -0
- package/packages/core/src/cli/binary-direct.ts +14 -1
- package/packages/core/src/cli/binary.ts +10 -7
- package/packages/core/src/cli/dashboard/refresh.ts +8 -0
- package/packages/core/src/cli/dispatch.ts +503 -334
- package/packages/core/src/cli/secrets.ts +2 -0
- package/packages/core/src/config/schema.ts +17 -3
- package/packages/core/src/events/payloads.ts +8 -5
- package/packages/core/src/events/repository.ts +37 -1
- package/packages/core/src/kernel/__snapshots__/reducer-identity-records/d41044cb2e54809c.json +194 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-records/e0f89f52e48cbf62.json +197 -0
- package/packages/core/src/kernel/engine.ts +118 -0
- package/packages/core/src/kernel/reconcile-restack.ts +72 -9
- package/packages/core/src/kernel/reducer-revisions.ts +5 -0
- package/packages/core/src/kernel/repository-read-facts.ts +9 -2
- package/packages/core/src/kernel/ticket-preparation.ts +10 -0
- package/packages/core/src/kernel/tracked-dirt.ts +173 -0
- package/packages/core/src/ontology.ts +1 -0
- package/packages/core/src/operator/index.ts +10 -0
- package/packages/core/src/operator/merged-builds.ts +51 -0
- package/packages/core/src/operator/registry.ts +254 -110
- package/packages/core/src/operator/repo-argument.ts +43 -0
- package/packages/core/src/operator/tickets.ts +139 -25
- package/packages/core/src/plugin-sdk/index.ts +4 -0
- package/packages/core/src/plugins/manifest.ts +1 -1
- package/packages/core/src/ports/tickets/completion.ts +71 -0
- package/packages/core/src/ports/tickets/contract.ts +73 -0
- package/packages/core/src/ports/tickets/github-fake.ts +8 -0
- package/packages/core/src/ports/tickets/github-issues.ts +1 -0
- package/packages/core/src/ports/tickets/github.ts +18 -6
- package/packages/core/src/ports/tickets/grants.ts +2 -0
- package/packages/core/src/ports/tickets/hosted-index.ts +8 -0
- package/packages/core/src/ports/tickets/linear.ts +18 -2
- package/packages/core/src/ports/tickets/remote-protocol.ts +37 -8
- package/packages/core/src/ports/tickets/remote.ts +43 -3
- package/packages/core/src/ports/tickets/tree.ts +11 -1
- package/packages/core/src/ports/types.ts +47 -4
- package/packages/core/src/ports/workspace/vercel-command-diagnostics.ts +144 -0
- package/packages/core/src/ports/workspace/vercel-sandbox.ts +649 -160
- package/packages/core/src/processes/build-child.ts +15 -1
- package/packages/core/src/processes/build-runner.ts +349 -20
- package/packages/core/src/processes/dispatcher.ts +880 -283
- package/packages/core/src/processes/harvest-child.ts +21 -1
- package/packages/core/src/processes/harvest-runner.ts +82 -35
- package/packages/core/src/processes/pass-stages.ts +32 -6
- package/packages/core/src/processes/phase-failure-budget.ts +1 -0
- package/packages/core/src/processes/provisioning-progress.ts +23 -0
- package/packages/core/src/processes/repo-view.ts +25 -4
- package/packages/core/src/processes/workspace-preparation.ts +1 -0
- package/packages/core/src/store/adapter.ts +34 -5
- package/packages/core/src/store/build-feed.ts +148 -22
- package/packages/core/src/store/build-scope.ts +12 -3
- package/packages/core/src/store/caller-attribution.ts +170 -0
- package/packages/core/src/store/contract.ts +1038 -165
- package/packages/core/src/store/local/schema.ts +12 -1
- package/packages/core/src/store/local/store.ts +260 -25
- package/packages/core/src/store/memory.ts +156 -9
- package/packages/core/src/store/phase-session.ts +23 -3
- package/packages/core/src/store/reducer-value-shapes.json +8196 -8118
- package/packages/core/src/store/remote/client.ts +90 -11
- package/packages/core/src/store/remote/credentials.ts +2 -0
- package/packages/core/src/store/remote/index.ts +31 -5
- package/packages/core/src/store/remote/protocol.ts +45 -8
- package/packages/core/src/store/remote/released-clients.json +22 -0
- package/packages/core/src/store/remote/released-reducer-values/1.17.0.json +36367 -0
- package/packages/core/src/store/remote/released-reducer-values/1.18.0.json +36436 -0
- package/packages/core/src/store/remote/released-reducer-values/index.ts +20 -16
- package/packages/core/src/store/session-handle.ts +12 -3
- package/packages/core/src/store/types.ts +48 -3
- package/packages/core/src/testing/dispatch-read-budget.ts +143 -16
- package/packages/core/src/testing/index.ts +2 -0
- package/packages/core/src/testing/reduced-read-budget.ts +420 -6
- package/skills/guide/SKILL.md +67 -13
- package/skills/guide/references/operator-api.md +29 -6
- package/skills/guide/references/plugin-authoring.md +30 -1
- package/skills/guide/references/remote-store-protocol.md +13 -3
- package/skills/guide/references/remote-ticket-protocol.md +37 -2
- package/skills/guide/references/restacking.md +46 -1
- package/skills/guide/references/setup.md +24 -9
- package/skills/operate/SKILL.md +42 -4
- package/templates/hosted-service/package.json +2 -2
package/docs/operator-api.md
CHANGED
|
@@ -5,7 +5,9 @@ contract at
|
|
|
5
5
|
`/operator/v1/repos/{repo}`. It is versioned with remote store protocol **7**.
|
|
6
6
|
Every request must send `X-Autobuild-Version`,
|
|
7
7
|
`X-Autobuild-Protocol-Version: 7`, and `Authorization: Bearer …`. Identity is
|
|
8
|
-
checked before authentication or resource lookup.
|
|
8
|
+
checked before authentication or resource lookup. The optional, diagnostic
|
|
9
|
+
`X-Autobuild-Caller` header follows the remote store protocol's transport
|
|
10
|
+
conventions.
|
|
9
11
|
|
|
10
12
|
Project credentials are opaque `abp_1_<id>_<secret>` bearer values bound to one
|
|
11
13
|
registered normalized repository. The service stores only a SHA-256 digest of
|
|
@@ -85,12 +87,13 @@ raw session-event append. External operator harnesses own agent execution.
|
|
|
85
87
|
| Method and path | Result |
|
|
86
88
|
|---|---|
|
|
87
89
|
| `GET …/builds?scope=active\|queued\|all` | Build summaries, newest update first. `queued` means active plus queued, matching `ab builds --queued`. Each nonterminal summary's `slot` is `{state: "held"}`, `{state: "requested", request, priority?: "urgent" \| "high" \| "low"}` or `{state: "none"}`; absent means unknown (an older server), never `none`. Its `statusWord` is `{word, tone, note?}`, the status word every surface shows; `status` stays the reducer's lifecycle status. |
|
|
90
|
+
| `GET …/builds?scope=merged&since=T&until=T&limit=N&cursor=C` | `{builds, next}`: merged builds, most recently merged first, each `{slug, mergedAt, kind, ticket?, pr?, target?}`. `mergedAt` is when the build merged, never a later cleanup write; `kind` is `leaf` or `node`; `pr` is `{number, url}`; `target` is `{build, ticket}` for a child of a node. `since` (inclusive) and `until` (exclusive) are ISO instants with a zone; `limit` is 1–100 (default 25); pass `next` back as `cursor` with the same window. One indexed page read, no event rows. These four parameters on another scope are a `400 validation`; a bad window, limit or cursor is `400 validation` with code `invalid-page`. |
|
|
88
91
|
| `GET …/builds/{slug}` | `{detail, dashboardRow}`; `detail.slot` and `dashboardRow.slot` carry the build's slot state, shaped as in `GET …/builds`; `detail.runnerAttaches` records chronological attach boundaries and their runtime identity (version, commit, source kind/location), with null runtime for unrecorded historical attaches; `dashboardRow` remains a `CLEANING` row after `build.aborted` and becomes `null` only when the dashboard stops listing it: at `build.completed` when no escalation is open. A completed build with an open escalation keeps, or regains, a `BLOCKED` row (note `done`), including one raised during abort cleanup; abort itself closes the escalations open when it is accepted. The row becomes `null` once the escalation is acknowledged; neither step reopens its lifecycle state. |
|
|
89
92
|
| `GET …/dashboard` | `{generatedAt, model, settingsHeader}`. `model` is the dashboard's rows, steps, elapsed timing inputs, harvest row, triage (when the dispatcher published one)/queue/capacity and settings projection. `model.capacity.slots` maps each build to its slot state, and each `model.builds[].slot` repeats it; absent means unknown. `model.configuration` is `"no-dispatcher-run"` when the repository records no dispatcher run, and absent otherwise. Optional `rollback` contains `correlation`, `lineage`, full `failed` and `restored` runtime identities and rollback event `ts` for the authoritative dispatcher lineage’s unresolved hold. Both dashboards name failed, restored and held runtime plus timestamp. Matching durable different-target hold clearance removes it; a fresh operator lineage hides it only after a committed operational tick or accepted takeover. Run-started and yielded ticks alone cannot replace authority; same-lineage generations retain the notice. Historical rollback records are not fallback notices. Optional `handoffs` lists all accepted unfinished handoffs with predecessor `run`, optional `successor`, `correlation`, full `from`/`to` runtimes, `mode` and optional `deadline`. Outstanding drain-mode builds carry `draining: true`, also on build-detail `dashboardRow`; matching settlement removes it. Accepted completion removes the handoff; neither takeover nor the clock does. Missing historical mode means cutover and missing deadline displays unknown. |
|
|
90
93
|
| `GET …/status` | Repository intake, pause, and default-auto-merge projection, plus `ticketStarts` (`{pending, recent}`, each entry with its `priority`) when single-ticket start requests are pending or recently settled. `capacity.slots`, when the held configuration is readable, maps each nonterminal build to its slot state; `capacity.occupied` counts its `held` entries. Its `operator` is `{presence: "unavailable", reason}`: this route does not load presence registrations, so it is not evidence that no operator is present. |
|
|
91
94
|
| `GET …/harvest/status` | Harvest gate, runs, steps, recovery, and attention projection. |
|
|
92
95
|
| `GET …/builds/{slug}/artifacts/{kind}?rev=N` | Raw bytes (`application/octet-stream`) plus content-disposition and `X-Autobuild-Artifact-*` metadata headers. Omit `rev` for latest. |
|
|
93
|
-
| `GET …/tickets?state=S&label=L&limit=N&offset=K&order=O` | `{states,tickets,diagnostics,criteria,triageState,readyState,doneState,total}`. The three lifecycle names come from effective repository configuration (including provider fallback). With no `state`, `criteria.state` is `triageState`; repeated `label` parameters narrow that state with AND filters. An explicit `state` selects that exact backend workflow state. `limit` (0–200) returns one page, after skipping `offset`, in `order` `oldest` (the default: priority order, urgent, high, normal, then low tickets, each in the source order) or `newest` (newest filed first, regardless of priority; see paging below); `total` counts every match before paging. |
|
|
96
|
+
| `GET …/tickets?state=S&label=L&limit=N&offset=K&order=O` | `{states,tickets,diagnostics,criteria,triageState,readyState,doneState,total}`. The three lifecycle names come from effective repository configuration (including provider fallback). With no `state`, `criteria.state` is `triageState`; repeated `label` parameters narrow that state with AND filters. An explicit `state` selects that exact backend workflow state. `limit` (0–200) returns one page, after skipping `offset`, in `order` `oldest` (the default: priority order, urgent, high, normal, then low tickets, each in the source order) or `newest` (newest filed first, regardless of priority; see paging below); `total` counts every match before paging. Tickets carry `resolvedAt` and, beside `target`, `targetTitle` when known; see completion listings below. |
|
|
94
97
|
| `GET …/tickets/states` | Full state metadata `{name,tickets,about?}[]`, including empty states (`tickets.states` in MCP). |
|
|
95
98
|
| `GET …/tickets/{id}` | `{ticket,blockers,build,assets}`. Blockers include native `exists`/`resolved` status; `build` prefers an active matching repository build, otherwise the most recently updated one. `assets` lists the current ticket assets as `{kind,name,revision,size,layout,fileCount}`, as `ab ticket show --json` does. |
|
|
96
99
|
|
|
@@ -194,7 +197,8 @@ both refusals record nothing.
|
|
|
194
197
|
|
|
195
198
|
One generic route executes any entry of the agent tool registry (the same
|
|
196
199
|
closed table `ab mcp` serves over stdio): the body is the tool's validated input — `repo`
|
|
197
|
-
included and required to equal the URL's repository
|
|
200
|
+
included and required to equal the URL's repository; a `repository` key is
|
|
201
|
+
refused as `400 validation` with code `repo-argument` — and the response is the
|
|
198
202
|
registry result verbatim. The verified operator token supplies the acting
|
|
199
203
|
identity and, when minted with one, the `via` attribution marker; the body
|
|
200
204
|
never does. Failures keep the shared `{kind,error,code?,progress?,state?}` shape
|
|
@@ -208,7 +212,10 @@ deployment can host operator sandboxes, and each call is gated per repository
|
|
|
208
212
|
on the latest deposited effective config. A closed gate is a `409 refusal`
|
|
209
213
|
with code `sandbox-orchestrator-disabled`, `sandbox-no-effective-config`,
|
|
210
214
|
`sandbox-effective-config-invalid`, `sandbox-credentials-missing` or
|
|
211
|
-
`sandbox-backend-unavailable`.
|
|
215
|
+
`sandbox-backend-unavailable`. Hosted `/mcp` tool calls reach this route
|
|
216
|
+
with the caller attribution `X-Autobuild-Caller: kind=operator;client=mcp`
|
|
217
|
+
(see the remote store protocol's transport conventions), so the service's
|
|
218
|
+
request logs can tell them apart.
|
|
212
219
|
|
|
213
220
|
### Per-repository MCP URLs
|
|
214
221
|
|
|
@@ -220,7 +227,8 @@ URL. Adding it to an agent harness connects that harness to one repository.
|
|
|
220
227
|
| URL | `<resource>` | `<resource>/<host><path>`, e.g. `https://ops.example/mcp/github.com/acme/widgets` for `https://github.com/acme/widgets` |
|
|
221
228
|
| Tool schemas | every tool requires `repo` | no `repo` field; the URL's repository is supplied |
|
|
222
229
|
| `repositories.list` | offered | not offered |
|
|
223
|
-
| A `repo` argument | names the repository |
|
|
230
|
+
| A `repo` argument | names the repository | refused, even the URL's own repository: a `validation` result with code `repo-argument` |
|
|
231
|
+
| A `repository` argument | refused: `validation`, code `repo-argument` (the argument is `repo`) | refused: `validation`, code `repo-argument` |
|
|
224
232
|
| `sandbox.*` listed | when the deployment can host sandboxes | also needs the repository's latest deposited effective config to enable `[orchestrator]` (one latest-artifact read per listing) |
|
|
225
233
|
| Instructions | describe the deployment, with each accessible repository's agent context | name only that repository, with its agent context |
|
|
226
234
|
| Prompts | one per skill per accessible repository, `<label>.<skill>` | one per skill, named for the skill |
|
|
@@ -327,7 +335,9 @@ the browser user's human actor while no token or signing secret reaches client
|
|
|
327
335
|
code. Responses are private/no-store; 401 requires reauthentication.
|
|
328
336
|
Polling clients may use a two-second interval. The gateway provides no
|
|
329
337
|
streaming transport; `ab watch` polls store event reads client-side. Delegated bearer tokens remain
|
|
330
|
-
server-side.
|
|
338
|
+
server-side. Delegated requests carry `X-Autobuild-Caller:
|
|
339
|
+
kind=operator;client=web`, set by the gateway; a browser cannot choose its
|
|
340
|
+
own attribution.
|
|
331
341
|
|
|
332
342
|
The API does not expose phase-session commands, runner startup, a push or
|
|
333
343
|
long-poll streaming transport, or a generic event-append operation; event
|
|
@@ -864,6 +874,19 @@ are successful cleanup; provider errors never count as completed deletion.
|
|
|
864
874
|
|
|
865
875
|
Paged ticket listings use the source's optional native `listPage(criteria, page)` capability when present, otherwise read the full listing, order it, and slice it: by default priority order (urgent, high, normal, then low tickets, each in source order); for `newest`, the reversed listing. `newest` means newest filed first, regardless of priority, with a stable tie-break; it is not the reverse of priority order. A source that lists in filing order (file, GitHub, Linear) gets exactly that from the reversed listing. The remote `HostedTicketSource` pages natively through the service's `list-page` operation, and uses the fallback only against a service predating it. Native errors propagate. PostgreSQL counts matches without bodies and reads only the requested window. Zero limits and offsets past the end still report the full matching total. Unpaged listings remain exhaustive; the wire payload is the same for both paths.
|
|
866
876
|
|
|
877
|
+
Completion listings (`tickets.list` in MCP) answer "what shipped" digests:
|
|
878
|
+
|
|
879
|
+
| Input | Effect |
|
|
880
|
+
|---|---|
|
|
881
|
+
| `since`, `until` | ISO-8601 with offset; half-open `since <= resolvedAt < until`. Tickets without `resolvedAt` never match. Either one defaults `state` to the effective done state. `since` must precede `until`. |
|
|
882
|
+
| `order: "completed"` | Most recently completed first, ties newest filed first; tickets without a completion time follow, newest filed first. |
|
|
883
|
+
| `excludeLabels` | Drops any ticket carrying any named label; ANDed with `labels`, `state` and the range; `total` counts after it. |
|
|
884
|
+
| `summary: true` | Omits each ticket's `body` and `comments`; every other field, `revision` included, stays. |
|
|
885
|
+
|
|
886
|
+
- **Paging.** `order` and `offset` apply with or without `limit`. Any of `offset`, `order`, `since`, `until` or `excludeLabels` without `limit` pages at 200, the maximum; `total` still counts every match. A call with none of them stays exhaustive.
|
|
887
|
+
- **Fields.** `resolvedAt` is the ISO-8601 completion time, present only on resolved tickets whose source knows it (hosted, GitHub, Linear; never the file source). `targetTitle` is the target node's title, returned when resolvable: from the source's own read, a parent already in the listing, or one `get` per distinct remaining parent. A parent that is missing or whose read fails leaves `targetTitle` absent. `criteria` echoes the state, labels, `excludeLabels`, `since` and `until` applied.
|
|
888
|
+
- **Cost.** A source declaring completion paging (hosted) answers natively with at most two index range scans of the state and range, each stopping at 5,001 tickets: one counts the matches, a second reads the requested window. A zero `limit` or a refusal stops after the first. A range holding more than 5,000 tickets refuses with `code: "completion-range-too-broad"`; narrow `since`/`until`. `excludeLabels` or `order: "completed"` alone on a state holding more than 5,000 tickets refuses too. Other sources, and hosted services that predate completion listing, filter their full state listing and never refuse.
|
|
889
|
+
|
|
867
890
|
|
|
868
891
|
### Forge cooldown admission and explicit recovery
|
|
869
892
|
|
package/docs/plugin-authoring.md
CHANGED
|
@@ -50,6 +50,7 @@ Declare served model prefixes and a default. Optional tool-free `oneShot` sits b
|
|
|
50
50
|
- Resume an intact branch non-destructively, never silently re-cut from a newer base. Rematerialize a lost copy. Make release idempotent.
|
|
51
51
|
- Optional `provision.publication` supplies a durable confirmed SHA and known cache tips for authoritative readback and cache repair. Preserve unknown unpublished work.
|
|
52
52
|
- Optional `provision.fresh: { owner }` marks a build's first provision. A pre-existing branch of that name is not the build's work: never return it as the base unless you hold your own creation receipt for `owner` (stable across that build's retries). Cut from `baseBranch` and keep the old tip recoverable. Providers that ignore it rely on claim-time deduplication.
|
|
53
|
+
- Optional `provision.signal` is the invocation's teardown token: abort in-flight provisioning promptly and record nothing; the dispatcher records the abandonment. Optional `provision.onProgress({ stage, step? })` reports each stage just before it runs, so a teardown can name it; it must never block or throw.
|
|
53
54
|
- Optional `localBranchExists(repo, branch)` reports a local `refs/heads/<branch>` in the checkout you create branches in, and throws when the probe fails. Dispatch calls it only at claim time and skips such a slug. Omit it when your branches aren't local; `remoteBranchExists` covers those.
|
|
54
55
|
|
|
55
56
|
### `forge`
|
|
@@ -251,6 +252,7 @@ A plugin relying on a capability declares an `apiVersion` range containing its v
|
|
|
251
252
|
- **1.10** Optional ticket-source ready-assignee capability (`readyAssignee`, with `prepareReadyAssignee`, `readyAssigneeRefusal` and `describeReadyAssignee`); sources without it refuse `[tickets].readyAssignee`. Also optional targeted ticket listing (`listTargeting`); older tree sources are observed through `listAll`.
|
|
252
253
|
- **1.11** Optional ticket-source search (`search`); callers refuse sources without it and never fall back to a listing.
|
|
253
254
|
- **1.12** Host-provided factory-context `fetch` and `invocationSignal` for bounded-invocation cancellation.
|
|
255
|
+
- **1.13** Optional ticket completion listing (`completionPaging`, with `TicketPageCriteria`, order `completed` and the `TicketCompletionRangeTooBroad` refusal), and the listing-time `Ticket.resolvedAt` and `Ticket.targetTitle`; callers filter the exhaustive listing for sources without it.
|
|
254
256
|
|
|
255
257
|
## 2. Create a repository-local module
|
|
256
258
|
|
|
@@ -650,7 +652,7 @@ for any other label.
|
|
|
650
652
|
## Optional ticket paging capability
|
|
651
653
|
|
|
652
654
|
Native paging is an optional API 1.9 ticket-source capability:
|
|
653
|
-
`listPage?(criteria:
|
|
655
|
+
`listPage?(criteria: TicketPageCriteria, page: TicketPage): Promise<TicketPageListing>`.
|
|
654
656
|
The SDK exports these types; the result is `TicketListing & { total: number }`.
|
|
655
657
|
Criteria retain state, labels (AND), and assignee semantics. The page has a
|
|
656
658
|
nonnegative integer `limit`, optional nonnegative integer `offset` (default 0),
|
|
@@ -674,6 +676,33 @@ File, Linear and GitHub retain fallback; the remote `HostedTicketSource`
|
|
|
674
676
|
forwards pages to the service's native paging (`list-page`), falling back only
|
|
675
677
|
against a service predating it. The POST list-ready protocol stays exhaustive.
|
|
676
678
|
|
|
679
|
+
Completion listing is an optional API 1.13 extension of native paging.
|
|
680
|
+
`listPage` takes `TicketPageCriteria`: the criteria above plus
|
|
681
|
+
`excludeLabels` (drop any ticket carrying any named label), and `since`
|
|
682
|
+
(inclusive) and `until` (exclusive) bounds on `Ticket.resolvedAt`; tickets
|
|
683
|
+
without a completion time never match. `TicketPage.order` adds `completed`:
|
|
684
|
+
tickets with `resolvedAt` first, most recent first, ties newest filed first,
|
|
685
|
+
then the rest newest filed first. Declare `completionPaging: true` only when
|
|
686
|
+
`listPage` honours all of these; callers send them only to sources declaring it
|
|
687
|
+
and otherwise filter the exhaustive listing with the SDK's shared semantics. A
|
|
688
|
+
native source may refuse a range broader than its per-request cap with
|
|
689
|
+
`TicketCompletionRangeTooBroad` (the SDK exports it and
|
|
690
|
+
`TICKET_COMPLETION_SCAN_LIMIT`); callers surface it as the
|
|
691
|
+
`completion-range-too-broad` refusal and never fall back. The shared contract
|
|
692
|
+
suite checks declared completion paging.
|
|
693
|
+
|
|
694
|
+
Tickets may carry two listing-time facts outside `revision`: `resolvedAt`, the
|
|
695
|
+
ISO-8601 time the ticket entered its completed state (only when `resolved`),
|
|
696
|
+
and `targetTitle`, the target node's title (only beside `target`). Return them
|
|
697
|
+
when your read already has them. The hosted PostgreSQL source records
|
|
698
|
+
`resolvedAt` when a ticket enters the done state, uses the last update for done
|
|
699
|
+
tickets that predate it, and projects `targetTitle` in its listing statements.
|
|
700
|
+
GitHub reports `closed_at` for completed issues and the parent title it reads
|
|
701
|
+
for targeting; Linear reports `completedAt` (or `canceledAt`) and the parent's
|
|
702
|
+
title. The file source reports no `resolvedAt`; operator listings fill a
|
|
703
|
+
missing `targetTitle` from tickets already listed, then with one `get` per
|
|
704
|
+
remaining parent.
|
|
705
|
+
|
|
677
706
|
## Optional ticket search capability
|
|
678
707
|
|
|
679
708
|
Text search is an optional API 1.11 ticket-source capability:
|
|
@@ -114,6 +114,15 @@ Placement is informational and does not change `ab dispatch` behavior.
|
|
|
114
114
|
body parsing, or resource lookup, the server validates the release-line window and known protocol identity.
|
|
115
115
|
Unsupported or missing values receive `409 {"kind":"conflict","error":"…"}`;
|
|
116
116
|
the diagnostic names the client and server package and protocol versions.
|
|
117
|
+
- Clients may send `X-Autobuild-Caller`, a diagnostic attribution of who made
|
|
118
|
+
the request: `key=value` pairs joined by `;`, at most 512 characters. Keys
|
|
119
|
+
are `kind` (`dispatcher`, `runner` or `operator`), `client`, `runner`,
|
|
120
|
+
`invocation`, `run`, `stage`, `build`, `harvest`, `execution`, `session`,
|
|
121
|
+
`phase` and `command`; each value is at most 96 characters of
|
|
122
|
+
`[A-Za-z0-9._:@+/-]`. The shipped client sends it on store, ticket, grant
|
|
123
|
+
and credential requests. A server must accept requests without it, must
|
|
124
|
+
treat it as untrusted (bound, sanitize, ignore unknown keys), and must never
|
|
125
|
+
use it for authorization or routing.
|
|
117
126
|
- Clients send `Content-Type: application/json` for requests with bodies. Every
|
|
118
127
|
response, including errors and `null` artifact results, has
|
|
119
128
|
`Content-Type: application/json`.
|
|
@@ -763,7 +772,7 @@ artifacts, and leases. `{repo}` is one percent-encoded repository id; encode
|
|
|
763
772
|
embedded `/` characters. All resource routes authorize and require the
|
|
764
773
|
repository to exist. An unknown repository returns `404 not-found` — except
|
|
765
774
|
for the build-record reads of this section (`change-position`, `builds`,
|
|
766
|
-
`changed-builds`, `build-page`, `build-digests`, `open-builds` and `rollup-values`), which are keyed
|
|
775
|
+
`changed-builds`, `build-page`, `merged-build-page`, `build-digests`, `open-builds` and `rollup-values`), which are keyed
|
|
767
776
|
to build records, not the repository journal record, so they authorize the
|
|
768
777
|
project credential but answer `200` (possibly empty) even for an unknown
|
|
769
778
|
repository, a repository without a journal record, or a repository without
|
|
@@ -787,6 +796,7 @@ builds.
|
|
|
787
796
|
| `listBuildsForRepo` | `GET /repos/{repo}/builds` | none | `200` + `BuildRecord[]` ordered by creation time, then slug |
|
|
788
797
|
| `listBuildsChangedSince` | `GET /repos/{repo}/changed-builds?since={p}` | required `since`, a canonical unsigned decimal no greater than 9223372036854775807; anything else is `400 validation` | `200 {"position": string, "builds": [{"slug": string, "position": string}]}`: the builds whose latest change position is greater than `since`, ascending by position and each once, with the repository head read in the same snapshot. Reads no event rows. An unknown repository answers `{"position": "0", "builds": []}` |
|
|
789
798
|
| `listBuildsPage` | `GET /repos/{repo}/build-page?limit={n}&cursor={c}&kind={k}&outcome=merged&activeSince={t}` | optional `limit`, a decimal integer from 1 to 100 (default 25); optional `cursor`, a `next` value this server issued for the same filters; optional `kind`, `leaf` or `node`; optional `outcome`, only `merged`; optional `activeSince`, an ISO instant with a zone. A bad limit, a malformed cursor, a cursor of the other order, or an empty or invalid filter is `400 validation` | `200 {"builds": BuildRecord[], "next": string \| null, "filters"?: {"kind"?, "outcome"?, "activeSince"?}}`: one page newest first by creation time, slug descending to break ties, with records as `builds` returns them; `next` is `null` on the last page. `kind` and `outcome` keep that order. `activeSince` keeps builds whose `updatedAt` is at or after it, ordered by `updatedAt` then slug, both descending, a superset of builds active in the window; a build written between two requests can appear twice or be skipped once, so dedupe by slug. A filtered answer echoes the normalized filters it applied as `filters`. Every page, filtered or not, costs at most `limit + 1` index entries and no event rows |
|
|
799
|
+
| `listMergedBuildsPage` | `GET /repos/{repo}/merged-build-page?limit={n}&cursor={c}&since={t}&until={t}` | optional `limit`, as for `build-page`; optional `cursor`, a `next` value this server issued for the same window; optional `since` (inclusive) and `until` (exclusive), ISO instants with a zone. A bad limit, a malformed cursor, a cursor of another order, an empty or invalid instant, or `since` after `until` is `400 validation` | `200 {"builds": [{"record": BuildRecord, "mergedAt": string, "kind": "leaf" \| "node", "pr"?: {"number", "url"}, "target"?: {"build", "ticket"}}], "next": string \| null}`: merged builds, most recently merged first (merge time, then slug, both descending). `mergedAt` is the merging `build.completed`'s `ts`; `pr` comes from the latest `pr.opened` or `finalize.completed`; `target` from `build.created`, replaced on a node by `node.parent-accepted`. Every page costs at most `limit + 1` index entries, no event rows and no reduced values |
|
|
790
800
|
| `getReducerValue` (rollup scope) | `POST /repos/{repo}/rollup-values` | a named-value request with optional `read`; see [Rollup values](#rollup-values) | `200 {"version", "cursor": 0, "value"}`: the canonical rollup; an unknown repository answers the empty value |
|
|
791
801
|
| `getRepoBuildDigests` | `GET /repos/{repo}/build-digests` | none | `200` + `BuildDigest[]`, one entry per build record of the repository (possibly empty), ordered by slug; handled before the repository-existence gate, so an unknown or journal-less repository answers `200 []` |
|
|
792
802
|
| `listOpenBuilds` | `GET /repos/{repo}/open-builds` | none | `200` + `[{"record", "digest"}]`, a build record and its `BuildDigest` for every open build of the repository (possibly empty), ordered by `createdAt` and then slug; handled before the repository-existence gate, so an unknown or journal-less repository answers `200 []` |
|
|
@@ -794,8 +804,8 @@ builds.
|
|
|
794
804
|
| `heartbeatRepo` | `POST /repos/{repo}/lease/heartbeat` | holder request | `200 {"ok": boolean}` |
|
|
795
805
|
| `releaseRepoLease` | `POST /repos/{repo}/lease/release` | holder request | `200 {"ok": true}`; a wrong holder is a successful no-op |
|
|
796
806
|
|
|
797
|
-
The `changed-builds` and `build-page` routes are additive
|
|
798
|
-
protocol version. A server on the same release line that lacks them answers
|
|
807
|
+
The `changed-builds`, `build-page` and `merged-build-page` routes are additive
|
|
808
|
+
and keep the protocol version. A server on the same release line that lacks them answers
|
|
799
809
|
`501 unsupported-operation` or `404 not-found`; the shipped client reports
|
|
800
810
|
that as a typed `BuildFeedUnsupportedError` and never falls back to listing
|
|
801
811
|
builds or reading events. The `build-page` filters are additive too. A server
|
|
@@ -35,7 +35,9 @@ Every request is `POST /tickets/<operation>`, has `Content-Type: application/jso
|
|
|
35
35
|
and requires `Authorization: Bearer <project credential>`. Authentication and
|
|
36
36
|
registration checks precede body parsing and source construction. Owner admin
|
|
37
37
|
is the explicit cross-project exception; internal operator signatures have no
|
|
38
|
-
ticket authority.
|
|
38
|
+
ticket authority. Clients may also send the optional, diagnostic
|
|
39
|
+
`X-Autobuild-Caller` attribution header described in the remote store
|
|
40
|
+
protocol's transport conventions; the service never authorizes on it.
|
|
39
41
|
|
|
40
42
|
Project credentials are opaque `abp_1_<id>_<secret>` bearer values bound to one
|
|
41
43
|
registered normalized repository. The service stores only a SHA-256 digest of
|
|
@@ -183,7 +185,7 @@ The operation names and `input` values are:
|
|
|
183
185
|
| `state-counts` | `{names: string[]}` (1–16) | `{name, tickets}[]` for the names that resolve |
|
|
184
186
|
| `list-ready` | `{labels?: string[], state?: string}` | `TicketListing` |
|
|
185
187
|
| `list-targeting` | `{nodeId: string}` | `TicketListing` of every state |
|
|
186
|
-
| `list-page` | `{criteria: {labels?, state?}, page: {limit, offset?, order?}}` | `TicketPageListing` (`{tickets, diagnostics, total}`) |
|
|
188
|
+
| `list-page` | `{criteria: {labels?, state?, excludeLabels?, since?, until?}, page: {limit, offset?, order?}}` | `TicketPageListing` (`{tickets, diagnostics, total}`) |
|
|
187
189
|
| `search` | `{text, state?, labels?, limit, cursor?}` | `{tickets: {id, title, state?, labels, kind, target?, priority?}[], cursor?, diagnostics}` |
|
|
188
190
|
| `get` | `{id}` | `Ticket \| null` |
|
|
189
191
|
| `claim` | `{id}` | `{claimed: boolean}` |
|
|
@@ -530,6 +532,39 @@ listing takes the `list-ready` path by that explicit decision.
|
|
|
530
532
|
The capability is additive. It does not change the remote BuildStore protocol
|
|
531
533
|
version, and released clients, which never send `list-page`, are unaffected.
|
|
532
534
|
|
|
535
|
+
## Completion listing
|
|
536
|
+
|
|
537
|
+
Recently completed work is listed through `list-page` with completion criteria,
|
|
538
|
+
negotiated by `x-autobuild-ticket-completion: 1`:
|
|
539
|
+
|
|
540
|
+
- **Ticket fields.** `resolvedAt` (ISO-8601, when the ticket entered its done
|
|
541
|
+
state) and `targetTitle` (the target node's title, beside `target`) appear on
|
|
542
|
+
tickets in every operation's answer, only for clients that send the header.
|
|
543
|
+
Released strict decoders never see them. PostgreSQL stamps the completion time
|
|
544
|
+
on entering the done state and clears it on leaving; a done ticket written
|
|
545
|
+
before that completes at its last update.
|
|
546
|
+
- **Criteria.** `excludeLabels` drops any ticket carrying any named label.
|
|
547
|
+
`since` (inclusive) and `until` (exclusive) bound `resolvedAt`, ISO-8601 with
|
|
548
|
+
an offset; tickets without a completion time never match. `order: "completed"`
|
|
549
|
+
is most recently completed first, ties newest filed first, then tickets
|
|
550
|
+
without a completion time, newest filed first. Any of them requires
|
|
551
|
+
`criteria.state`, or the request is a `400` validation error.
|
|
552
|
+
- **Cap.** The PostgreSQL backend accepts a state and range holding at most
|
|
553
|
+
5,000 tickets. It answers with up to two index range scans, each stopping at
|
|
554
|
+
5,001 rows: one counts the matches, the second reads the requested window. A
|
|
555
|
+
zero `limit` or a refusal stops after the first. When the count scan reaches
|
|
556
|
+
the 5,001st row, the request answers
|
|
557
|
+
`409 {kind: "conflict", code: "completion-range-too-broad", error, limit}`;
|
|
558
|
+
the client reports `TicketCompletionRangeTooBroad` with the `limit`. Narrow
|
|
559
|
+
`since`/`until`. Within the cap, `total` is exact.
|
|
560
|
+
- **Refusal.** A backing source that cannot honour completion criteria answers
|
|
561
|
+
`409` with `code: "paging-unsupported"`.
|
|
562
|
+
- **Negotiation.** Every `/tickets/*` response, including errors, carries the
|
|
563
|
+
header. A client sends completion criteria only after a response carried it
|
|
564
|
+
and `list-page` is declared; otherwise it fails with `HostedTicketPagingError`
|
|
565
|
+
(`service-predates`) before any request, and operator listings filter
|
|
566
|
+
`list-ready` instead.
|
|
567
|
+
|
|
533
568
|
## Search
|
|
534
569
|
|
|
535
570
|
`search` answers one page of compact hits from the backing source's own search,
|
package/docs/restacking.md
CHANGED
|
@@ -159,7 +159,8 @@ applies to nodes: a stale node cannot verify or merge; inventory and child merge
|
|
|
159
159
|
continue while it collects.
|
|
160
160
|
|
|
161
161
|
Restack and reconcile publication reject tracked modifications with the existing
|
|
162
|
-
clean-worktree error.
|
|
162
|
+
clean-worktree error. Before a replay, preparation handles them as described in
|
|
163
|
+
[Tracked dirt before preparation](#tracked-dirt-before-preparation). Nonignored untracked files do not block publication and
|
|
163
164
|
remain unpublished and untouched; each publication that encounters them records
|
|
164
165
|
a path-bearing `observation.recorded` followup, deduplicated by operation,
|
|
165
166
|
transaction, candidate SHA and exact path list on recovery. The phase-terminal
|
|
@@ -342,6 +343,45 @@ and `· N regenerated` or `· regeneration failed` to a node's restack lines.
|
|
|
342
343
|
`ab watch --event 'restack.*'` or `--event 'node.item-*'` shows each outcome.
|
|
343
344
|
Repositories that declare nothing restack exactly as before.
|
|
344
345
|
|
|
346
|
+
## Tracked dirt before preparation
|
|
347
|
+
|
|
348
|
+
Uncommitted changes to tracked files, typically left by `[commands].setup` on
|
|
349
|
+
a relaunch, never strand a restack or reconcile preparation:
|
|
350
|
+
|
|
351
|
+
| Dirt | Outcome |
|
|
352
|
+
|---|---|
|
|
353
|
+
| Only declared `[[generated]]` paths | Restored to `HEAD`, one `followup` observation recorded, replay proceeds |
|
|
354
|
+
| Any undeclared path | Preparation refuses, touches nothing, raises `policy/dirty-worktree` naming the undeclared paths |
|
|
355
|
+
|
|
356
|
+
The same classification runs again just before a completed automatic replay
|
|
357
|
+
or an intended candidate publishes, so a relaunch or crash at any point of the
|
|
358
|
+
replay cannot reach publication with dirt. A fresh automatic restack and a
|
|
359
|
+
fresh epilogue reconcile check before
|
|
360
|
+
`restack.prepared` or `reconcile.started`, so a refusal freezes nothing and
|
|
361
|
+
spends no phase-failure budget. Answering the escalation with guidance or a
|
|
362
|
+
bare retry returns the build to `implement`:
|
|
363
|
+
|
|
364
|
+
- **Nothing frozen.** `implement` runs with the question, its paths and the
|
|
365
|
+
answer as feedback.
|
|
366
|
+
- **Frozen, no publish intent.** The kernel records `reconcile.superseded
|
|
367
|
+
{cause: dirty-worktree}`, returns a workspace the replay left detached to
|
|
368
|
+
the build branch with the changes intact, then runs `implement`. If the
|
|
369
|
+
target also changed a dirty file, so Git cannot carry it, the changes are
|
|
370
|
+
first set aside as artifact `dirty-worktree-<escalation>`, as below. The
|
|
371
|
+
abandoned restack is decided again from the new head.
|
|
372
|
+
- **Frozen, publish intent recorded.** The candidate settles first: the
|
|
373
|
+
undeclared changes are stored as artifact `dirty-worktree-<escalation>` (a
|
|
374
|
+
byte-exact binary patch, captured without textconv or external diff
|
|
375
|
+
drivers) with observation `dirty-worktree:<escalation>:set-aside`,
|
|
376
|
+
restored, and the frozen candidate publishes as recorded. The `implement`
|
|
377
|
+
feedback names the artifact and how to re-apply it. If the set-aside runs
|
|
378
|
+
again before the restore (after a stop, or when relaunch setup rewrote a
|
|
379
|
+
path), a changed tree is stored as a new artifact revision first; it keeps
|
|
380
|
+
every file an earlier revision held, so the latest revision is complete.
|
|
381
|
+
|
|
382
|
+
Autobuild never commits or discards undeclared changes on its own, and the
|
|
383
|
+
escalation never needs an abort.
|
|
384
|
+
|
|
345
385
|
## Foreign merges
|
|
346
386
|
|
|
347
387
|
Before any replay or publication, inspect every merge's non-first-parent history,
|
|
@@ -417,6 +457,11 @@ point-reads the selected slug and, for a keyed attempt, the canonical slug deriv
|
|
|
417
457
|
from the repository, selected slug and key: one matching record and atomic
|
|
418
458
|
`build.created` retain ownership even if creation threw after committing or its
|
|
419
459
|
response was lost.
|
|
460
|
+
A bounded hosted invocation may journal an admission without a claim, when the
|
|
461
|
+
preparation would not fit before its work deadline, and stamps every intent with
|
|
462
|
+
that deadline. An attempt the deadline interrupted, with no failure or bounce
|
|
463
|
+
recorded, is carried: the next invocation resumes it first from its durable
|
|
464
|
+
boundaries, and it is never returned to Ready.
|
|
420
465
|
Unavailable or conflicting readback never authorizes release or a replacement
|
|
421
466
|
build. Pending attempts retain the original failure, latest recovery error and
|
|
422
467
|
retry deadline in the canonical repository reduced value; resolved attempts
|
package/docs/setup.md
CHANGED
|
@@ -101,19 +101,27 @@ Use the supported `vercel/sandbox/universal` image. Other managed images and
|
|
|
101
101
|
custom VCR images are rejected. Autobuild remains stack-neutral. For Vercel,
|
|
102
102
|
put repository-specific operating-system packages and machine-level tooling in
|
|
103
103
|
the ordered `[workspace.config].provisioning` list. Each strict `{ name,
|
|
104
|
-
command }` entry runs from the checkout through `sh -c` with
|
|
105
|
-
authority after pinned Bun is verified and before dependency
|
|
106
|
-
`[commands].setup`, or an agent. It runs once per fresh environment
|
|
107
|
-
on every replacement.
|
|
104
|
+
command, timeoutSeconds? }` entry runs from the checkout through `sh -c` with
|
|
105
|
+
provider root authority after pinned Bun is verified and before dependency
|
|
106
|
+
bootstrap, `[commands].setup`, or an agent. It runs once per fresh environment
|
|
107
|
+
and repeats on every replacement. A step runs under `timeoutSeconds` (default
|
|
108
|
+
600, at most 840); one that fails reports its name, redacted command and
|
|
109
|
+
output tails, and one that overruns also reports its elapsed time. Commands are declarative TOML string data, not evaluated
|
|
108
110
|
configuration logic. Local git worktrees never run this list; ensure their host
|
|
109
111
|
already has required system tooling.
|
|
110
112
|
|
|
111
113
|
Put each selected runtime's immutable install and executable/version check in
|
|
112
114
|
its `runtimeProvisioning` entry. Autobuild runs install then preflight after
|
|
113
115
|
checkout dependencies in every fresh/replacement sandbox and before the
|
|
114
|
-
readiness probe, writes the marker only after success
|
|
115
|
-
|
|
116
|
-
|
|
116
|
+
readiness probe, and writes the marker only after success. Every build-runner
|
|
117
|
+
launch and harvest relaunch reruns each selected runtime's preflight. A
|
|
118
|
+
preflight that fails in an existing sandbox runs that runtime's install and
|
|
119
|
+
then its preflight again; only a failure after that install fails the launch.
|
|
120
|
+
A failure names the runtime, selecting role/alternate, and the failed field
|
|
121
|
+
(`install` or `preflight`) with the command output, and starts no agent. A
|
|
122
|
+
`[roles]` change that selects a new runtime, or a changed pin, takes effect in
|
|
123
|
+
existing workspaces at their next launch; no abort is needed, so keep each
|
|
124
|
+
install safe to run over an older install. Runtime provisioning receives
|
|
117
125
|
allowlisted legacy API credentials named by
|
|
118
126
|
`[workspace.config].environmentVariables` and automatically supplied placeholders
|
|
119
127
|
for every declared account credential variable. Account variables need no
|
|
@@ -121,7 +129,14 @@ allowlist entry; their real credentials remain on the dispatcher host.
|
|
|
121
129
|
|
|
122
130
|
Keep package-level and checkout-level bootstrap in an idempotent
|
|
123
131
|
`[commands].setup`. It runs after system provisioning and must remain safe to
|
|
124
|
-
rerun on attachment and after every restack onto a new base.
|
|
132
|
+
rerun on attachment and after every restack onto a new base. It must not modify
|
|
133
|
+
tracked files: tracked paths it newly changes outside `[[generated]]` block the
|
|
134
|
+
build with `policy/dirty-worktree` before the next phase runs, naming the paths.
|
|
135
|
+
The check is skipped when that phase is a `reconcile`, whose resolver works on
|
|
136
|
+
its own in-progress replay, and while an answered dirty-worktree recovery is
|
|
137
|
+
pending. A restack or reconcile preparation still classifies any tracked dirt
|
|
138
|
+
before it replays. Declare tracked codegen outputs it rewrites in
|
|
139
|
+
`[[generated]]`; those are tolerated and discarded before any replay. Do not repeatedly install OS packages there. Expose only
|
|
125
140
|
required runtime credentials through
|
|
126
141
|
`[workspace.config].environmentVariables`, keep generated caches disposable,
|
|
127
142
|
and lock dependencies in the repository. A browser-capable repository should
|
|
@@ -162,7 +177,7 @@ For Vercel it identifies and permanently deletes a fresh unnamed sandbox, even
|
|
|
162
177
|
when system or runtime provisioning, setup, or a probe fails; cleanup failures
|
|
163
178
|
name the environment for manual deletion. Its `system provisioning` check lists
|
|
164
179
|
completed step names (or says none were declared) before guest setup checks. A
|
|
165
|
-
failed step reports its name, command, status,
|
|
180
|
+
failed step reports its name, command, status or timeout, stderr/stdout tails, and
|
|
166
181
|
remediation without marking the environment ready. It provisions/preflights
|
|
167
182
|
every effective primary and alternate runtime, then runs `commands.setup`, loads
|
|
168
183
|
repository plugins, and checks every
|
package/docs/ticket-sources.md
CHANGED
|
@@ -248,7 +248,7 @@ Declare `priority` only if you store all four levels natively; without it, Autob
|
|
|
248
248
|
Declare tree support only if you keep the [optional tree contract](plugin-authoring.md#optional-ticket-tree-capability) on the same port and harness: exhaustive pagination, canonical targets, revision coverage and atomic rejection.
|
|
249
249
|
|
|
250
250
|
Native paging is an optional API 1.9 ticket-source capability:
|
|
251
|
-
`listPage?(criteria:
|
|
251
|
+
`listPage?(criteria: TicketPageCriteria, page: TicketPage): Promise<TicketPageListing>`.
|
|
252
252
|
The SDK exports these types; the result is `TicketListing & { total: number }`.
|
|
253
253
|
Criteria retain state, labels (AND), and assignee semantics. The page has a
|
|
254
254
|
nonnegative integer `limit`, optional nonnegative integer `offset` (default 0),
|
|
@@ -272,6 +272,33 @@ File, Linear and GitHub retain fallback; the remote `HostedTicketSource`
|
|
|
272
272
|
forwards pages to the service's native paging (`list-page`), falling back only
|
|
273
273
|
against a service predating it. The POST list-ready protocol stays exhaustive.
|
|
274
274
|
|
|
275
|
+
Completion listing is an optional API 1.13 extension of native paging.
|
|
276
|
+
`listPage` takes `TicketPageCriteria`: the criteria above plus
|
|
277
|
+
`excludeLabels` (drop any ticket carrying any named label), and `since`
|
|
278
|
+
(inclusive) and `until` (exclusive) bounds on `Ticket.resolvedAt`; tickets
|
|
279
|
+
without a completion time never match. `TicketPage.order` adds `completed`:
|
|
280
|
+
tickets with `resolvedAt` first, most recent first, ties newest filed first,
|
|
281
|
+
then the rest newest filed first. Declare `completionPaging: true` only when
|
|
282
|
+
`listPage` honours all of these; callers send them only to sources declaring it
|
|
283
|
+
and otherwise filter the exhaustive listing with the SDK's shared semantics. A
|
|
284
|
+
native source may refuse a range broader than its per-request cap with
|
|
285
|
+
`TicketCompletionRangeTooBroad` (the SDK exports it and
|
|
286
|
+
`TICKET_COMPLETION_SCAN_LIMIT`); callers surface it as the
|
|
287
|
+
`completion-range-too-broad` refusal and never fall back. The shared contract
|
|
288
|
+
suite checks declared completion paging.
|
|
289
|
+
|
|
290
|
+
Tickets may carry two listing-time facts outside `revision`: `resolvedAt`, the
|
|
291
|
+
ISO-8601 time the ticket entered its completed state (only when `resolved`),
|
|
292
|
+
and `targetTitle`, the target node's title (only beside `target`). Return them
|
|
293
|
+
when your read already has them. The hosted PostgreSQL source records
|
|
294
|
+
`resolvedAt` when a ticket enters the done state, uses the last update for done
|
|
295
|
+
tickets that predate it, and projects `targetTitle` in its listing statements.
|
|
296
|
+
GitHub reports `closed_at` for completed issues and the parent title it reads
|
|
297
|
+
for targeting; Linear reports `completedAt` (or `canceledAt`) and the parent's
|
|
298
|
+
title. The file source reports no `resolvedAt`; operator listings fill a
|
|
299
|
+
missing `targetTitle` from tickets already listed, then with one `get` per
|
|
300
|
+
remaining parent.
|
|
301
|
+
|
|
275
302
|
Search is an optional API 1.11 ticket-source capability:
|
|
276
303
|
`search?(query: TicketSearchQuery): Promise<TicketSearchPage>`. It matches
|
|
277
304
|
every query word against titles and bodies, filters by state and labels, and
|
package/docs/troubleshooting.md
CHANGED
|
@@ -138,6 +138,21 @@ A step the invocation deadline defers is not a failure:
|
|
|
138
138
|
|
|
139
139
|
See [Vercel sandbox recovery](configuration.md#vercel-sandbox).
|
|
140
140
|
|
|
141
|
+
A ticket preparation the invocation deadline carries is not a failure either:
|
|
142
|
+
|
|
143
|
+
- The dispatch log names the ticket: `ticket <id>: preparation carried by the invocation budget`.
|
|
144
|
+
- The tick counts it as `preparationsCarried`, and the `stages:` line shows it, for example `tickets 0/22 carried FLINT-1490`.
|
|
145
|
+
- The ticket isn't handed back to Ready and no other pass claims it. The next invocation prepares it first, before settlement.
|
|
146
|
+
- Don't retry, move or re-file the ticket.
|
|
147
|
+
|
|
148
|
+
## A ticket is carried on several invocations in a row
|
|
149
|
+
|
|
150
|
+
**Symptom.** The same ticket logs `preparation carried by the invocation budget` on several invocations in a row, and no build is created.
|
|
151
|
+
|
|
152
|
+
**Cause.** The deadline keeps cutting its preparation even though it runs first, so one preparation outlasts the hosted invocation budget. The usual culprit is a slow tracker claim or spec authoring.
|
|
153
|
+
|
|
154
|
+
**Action.** Report it to the instance operator with the stage the carry line names, such as `(claim)`. Retrying the ticket doesn't help.
|
|
155
|
+
|
|
141
156
|
## A build stays STARTING with repeated deferral lines
|
|
142
157
|
|
|
143
158
|
**Symptom.** The same build logs `resume`, `provision` or `launch deferred by the invocation budget` on several invocations in a row, and stays STARTING.
|
|
@@ -150,11 +165,30 @@ A repeating `fence deferred by the invocation budget` line with an infrastructur
|
|
|
150
165
|
|
|
151
166
|
## A provision is cut off at teardown on several invocations
|
|
152
167
|
|
|
153
|
-
**Symptom.** A STARTING build
|
|
168
|
+
**Symptom.** A STARTING build records `provisioning abandoned at dispatcher teardown during <stage> after <N>s` on more than one invocation.
|
|
154
169
|
|
|
155
170
|
**Cause.** The provision is longer than one invocation. That is normal: each invocation resumes the same sandbox after its last completed stage, at the commit it cloned, so the provision still finishes.
|
|
156
171
|
|
|
157
|
-
**Action.** If
|
|
172
|
+
**Action.** If the same stage repeats, it outlasts the invocation or hangs, for example a `provisioning` step stuck on an unreachable package mirror:
|
|
173
|
+
|
|
174
|
+
1. Set that step's `timeoutSeconds` below the invocation budget. A hang then fails promptly as a charged infrastructure failure with its output, and escalates after `maxInfrastructureAttempts`.
|
|
175
|
+
2. Report the stage to the instance operator.
|
|
176
|
+
|
|
177
|
+
## A sandbox provisioning command fails or times out
|
|
178
|
+
|
|
179
|
+
**Symptom.** `bun ab build status`, `dispatch.failed`, a `requires dispatcher-authorized cleanup` message, an infrastructure failure, or a setup escalation quotes `sandbox command <cmd> exited <N>` or `sandbox command <cmd> exceeded its <T>s provisioning timeout after <E>s`.
|
|
180
|
+
|
|
181
|
+
**Reading it.** The message carries:
|
|
182
|
+
|
|
183
|
+
- `stage:` the provisioning stage, such as `checkout`, `bun install`, `system provisioning step <name>`, `dependency install` or `runtime bootstrap <runtime> preflight`
|
|
184
|
+
- `argv:` the command line, with tokens, passwords and authorization headers redacted
|
|
185
|
+
- `cwd:` the guest working directory
|
|
186
|
+
- `stderr (tail):` and `stdout (tail):` the last lines of output, or `output: unavailable (…)` when it could not be read
|
|
187
|
+
|
|
188
|
+
**Action.**
|
|
189
|
+
|
|
190
|
+
- **Exit status:** fix the cause the stderr tail names. For a `provisioning` step, reproduce with `bun ab init --validate`.
|
|
191
|
+
- **Timeout:** check the upstream service the step depends on. Raise its `timeoutSeconds` (at most 840) only when it is genuinely that slow.
|
|
158
192
|
|
|
159
193
|
## A stage keeps stopping at the work deadline
|
|
160
194
|
|
|
@@ -174,6 +208,24 @@ stages: settlement 3.1s 6/11 (executions 5/9, harvest 1/2, sandboxes 0/0) · jan
|
|
|
174
208
|
|
|
175
209
|
**Action.** Report the stage and part to the instance operator with the `stages:` lines from several invocations. A stage stopped by `share` alone is normal under load.
|
|
176
210
|
|
|
211
|
+
## Store traffic burst or database pressure
|
|
212
|
+
|
|
213
|
+
**Symptom.** The store's database is saturated, store requests answer `503`, or request volume jumps with no obvious cause.
|
|
214
|
+
|
|
215
|
+
**Reading the lines.** Every Autobuild client names itself on store and ticket requests with the [`X-Autobuild-Caller` header](remote-store-protocol.md#1-transport-and-conventions). The hosted store service logs one `"type":"autobuild.store-request"` line per request:
|
|
216
|
+
|
|
217
|
+
```json
|
|
218
|
+
{"type":"autobuild.store-request","method":"GET","path":"/repos/…/events","backend":"store","status":200,"ms":41,"caller":{"kind":"dispatcher","run":"host-dispatch-a1","stage":"janitor"},"principal":{"kind":"project","purpose":"dispatcher","credential":"…"}}
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
- **`caller.kind`:** `dispatcher` (with `invocation`, `run` and pass `stage`), `runner` (`build` or `harvest`, with the build slug or harvest run), or `operator` (`cli`, `mcp` or `web`).
|
|
222
|
+
- **`caller.stage`:** the pass stage that made the request, `setup` before a hosted run starts, or `teardown`. Work a stage starts, such as provisioning or a harvest trigger, carries that stage.
|
|
223
|
+
- **`caller: null`:** an older client or a non-Autobuild caller. `principal` still names the credential kind.
|
|
224
|
+
|
|
225
|
+
**Cause.** Usually one caller polling or replaying: a stage revisiting many builds, an operator watch, or an older client.
|
|
226
|
+
|
|
227
|
+
**Action.** Count a window of lines by `caller.kind` and `caller.stage` (or `caller.run`, `caller.build`), and report the callers and stages that dominate to the instance operator with a few sample lines.
|
|
228
|
+
|
|
177
229
|
## Remote project access
|
|
178
230
|
|
|
179
231
|
**Symptom.** Remote requests refuse a project despite a configured URL.
|
package/docs/workspaces.md
CHANGED
|
@@ -114,8 +114,9 @@ Sandbox preparation order:
|
|
|
114
114
|
5. `commands.setup`
|
|
115
115
|
|
|
116
116
|
- **Runtimes.** Every primary and alternate runtime needs a pinned install and exact-version preflight, and gets only the credentials named in `environmentVariables`, except declared [accounts](configuration-overview.md#accounts), whose credentials remain on the host and are brokered by egress policy using guest placeholders.
|
|
117
|
-
- **Repetition.** New sandboxes repeat provisioning and preflights rerun before each build-runner; keep setup idempotent.
|
|
117
|
+
- **Repetition.** New sandboxes repeat provisioning and preflights rerun before each build-runner. A failing preflight installs that runtime in place first, so a `[roles]` change reaches existing sandboxes at their next launch; keep setup and runtime installs idempotent.
|
|
118
118
|
- **Resumption.** A provision cut off by a dispatcher teardown resumes in place on the next invocation, at the commit it cloned. Stages already completed with unchanged inputs (checkout, Bun, each `provisioning` step, distribution, dependencies, runtime installs) are skipped; a stage whose inputs changed reruns with every stage after it.
|
|
119
|
+
- **Timeouts.** Each `provisioning` step runs under its `timeoutSeconds` (default 600 s, at most 840 s); Bun, distribution, dependency and runtime stages have fixed bounds. The sandbox kills a step that overruns, and provisioning fails with the stage, command, elapsed time and output so far, charged like any infrastructure failure. A dispatcher teardown instead abandons the stage uncharged and names it, with its elapsed time, in `dispatch.failed`.
|
|
119
120
|
- **Validation.** `bun ab init --validate` runs named provisioning, setup, runtime and Store checks in a disposable environment, deletes it even on failure, and starts no build. For every declared account, including unused accounts, it runs a tool-free model probe through the account's runtime (Claude Code for Claude/Kimi, Codex for ChatGPT); these probes create no ordinary build phase or persistent agent session. Hosted ChatGPT, Claude and Kimi project secrets report readiness from write-only status metadata instead; the first hosted build is the live check.
|
|
120
121
|
- **Lifetime.** `timeoutSeconds` bounds a sandbox; provider operations have their own timeouts. An intact sandbox resumes. Before replacement, the dispatcher fences it, preserves reachable unpublished commits to build-private archive refs or, where the forge refuses them, BuildStore copies, and records a receipt; the next workspace restores those commits. Loss is limited to already absent or unrecoverable work and uncommitted files; known loss appears in the next session's recovery context. See the [workspace recovery contract](architecture.md#key-boundaries).
|
|
121
122
|
|
|
@@ -155,4 +156,5 @@ The suite certifies only the basic working copy. Remote execution adds trusted s
|
|
|
155
156
|
- Publication reports confirmed SHA and cache tips and supports the required guarded rewrites.
|
|
156
157
|
- Store grants go through the host's `delegateCredential` callback; never serialize host tokens into execution identity.
|
|
157
158
|
- An optional `provisionEstimateMs` declares the expected wall time of one `provision`; a bounded dispatcher invocation does not start provisioning with less budget left.
|
|
159
|
+
- `provision` may receive `signal`, the invocation's teardown token: abort in-flight work promptly and record nothing, since the dispatcher records the abandonment. It may also receive `onProgress`: report each stage just before it runs, so a teardown can name it; never throw from it.
|
|
158
160
|
- `provision` may receive `adoptAbandoned` when the previous attempt at the same generation was cut off by a recorded dispatcher teardown. Finish that environment in place only after verifying it, resuming from verified progress and keeping the commit it already holds; otherwise throw `WorkspaceCleanupRequired`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@defrex/autobuild",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.0",
|
|
4
4
|
"description": "Agent-driven software delivery from groomed ticket to merged PR",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
"prepare": "husky",
|
|
145
145
|
"test": "bun tools/test-temp-leaks.ts unit",
|
|
146
146
|
"test:integration": "bun tools/test-temp-leaks.ts integration",
|
|
147
|
-
"typecheck": "node --max-old-space-size=
|
|
147
|
+
"typecheck": "node --max-old-space-size=8192 ./node_modules/typescript/bin/tsc --noEmit",
|
|
148
148
|
"ui:catalog": "bun packages/ui/scripts/catalog.ts",
|
|
149
149
|
"ui:tokens": "bun packages/ui/scripts/tokens.ts",
|
|
150
150
|
"ui:web": "bun packages/ui/scripts/web.ts"
|
|
@@ -162,8 +162,8 @@
|
|
|
162
162
|
},
|
|
163
163
|
"devDependencies": {
|
|
164
164
|
"@biomejs/biome": "2.5.5",
|
|
165
|
-
"@defrex/autobuild-postgres-store": "1.
|
|
166
|
-
"@defrex/autobuild-vercel-sandbox": "1.
|
|
165
|
+
"@defrex/autobuild-postgres-store": "1.18.0",
|
|
166
|
+
"@defrex/autobuild-vercel-sandbox": "1.18.0",
|
|
167
167
|
"@resvg/resvg-js": "2.6.2",
|
|
168
168
|
"@types/bun": "^1.3.14",
|
|
169
169
|
"@types/node": "^24.0.0",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { storeCallerHeaders } from '../store/caller-attribution'
|
|
1
2
|
import { join } from 'node:path'
|
|
2
3
|
import { connectedProject } from './connect'
|
|
3
4
|
import { parseLayeredConfig, readLocalConfig } from '../config/local'
|
|
@@ -55,6 +56,7 @@ export async function abAccountsLogin(
|
|
|
55
56
|
{
|
|
56
57
|
headers: {
|
|
57
58
|
authorization: `Bearer ${credential!.token}`,
|
|
59
|
+
...storeCallerHeaders(),
|
|
58
60
|
[AUTOBUILD_VERSION_HEADER]: AUTOBUILD_VERSION,
|
|
59
61
|
[REMOTE_STORE_PROTOCOL_VERSION_HEADER]: REMOTE_STORE_PROTOCOL_VERSION,
|
|
60
62
|
},
|
|
@@ -125,6 +127,7 @@ export async function abAccountsLogin(
|
|
|
125
127
|
headers: {
|
|
126
128
|
'content-type': 'application/json',
|
|
127
129
|
authorization: `Bearer ${credential!.token}`,
|
|
130
|
+
...storeCallerHeaders(),
|
|
128
131
|
[AUTOBUILD_VERSION_HEADER]: AUTOBUILD_VERSION,
|
|
129
132
|
[REMOTE_STORE_PROTOCOL_VERSION_HEADER]: REMOTE_STORE_PROTOCOL_VERSION,
|
|
130
133
|
},
|