@defrex/autobuild 1.17.0 → 1.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/README.md +1 -1
  2. package/SPEC.md +85 -11
  3. package/docs/architecture.md +57 -11
  4. package/docs/configuration.md +11 -3
  5. package/docs/dispatcher-hosting.md +5 -3
  6. package/docs/operator-api.md +14 -1
  7. package/docs/plugin-authoring.md +29 -1
  8. package/docs/remote-ticket-protocol.md +34 -1
  9. package/docs/restacking.md +5 -0
  10. package/docs/setup.md +9 -3
  11. package/docs/ticket-sources.md +28 -1
  12. package/docs/troubleshooting.md +15 -0
  13. package/docs/workspaces.md +1 -1
  14. package/package.json +4 -4
  15. package/packages/core/src/cli/dashboard/refresh.ts +8 -0
  16. package/packages/core/src/cli/dispatch.ts +2 -0
  17. package/packages/core/src/config/schema.ts +2 -1
  18. package/packages/core/src/events/catalog-identity.ts +3 -1
  19. package/packages/core/src/events/payloads.ts +7 -1
  20. package/packages/core/src/events/repository.ts +37 -1
  21. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/d41044cb2e54809c.json +194 -0
  22. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/e012e9e8f3e82935.json +424 -0
  23. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/e0f89f52e48cbf62.json +197 -0
  24. package/packages/core/src/kernel/janitor-failure.ts +1 -0
  25. package/packages/core/src/kernel/reducer-revisions.ts +9 -0
  26. package/packages/core/src/kernel/reducer.ts +6 -0
  27. package/packages/core/src/kernel/repository-read-facts.ts +9 -2
  28. package/packages/core/src/kernel/session-settlement.ts +82 -0
  29. package/packages/core/src/kernel/ticket-preparation.ts +10 -0
  30. package/packages/core/src/operator/registry.ts +64 -9
  31. package/packages/core/src/operator/tickets.ts +139 -25
  32. package/packages/core/src/plugin-sdk/index.ts +4 -0
  33. package/packages/core/src/plugins/manifest.ts +1 -1
  34. package/packages/core/src/ports/tickets/completion.ts +71 -0
  35. package/packages/core/src/ports/tickets/contract.ts +73 -0
  36. package/packages/core/src/ports/tickets/github-fake.ts +8 -0
  37. package/packages/core/src/ports/tickets/github-issues.ts +1 -0
  38. package/packages/core/src/ports/tickets/github.ts +18 -6
  39. package/packages/core/src/ports/tickets/hosted-index.ts +8 -0
  40. package/packages/core/src/ports/tickets/linear.ts +18 -2
  41. package/packages/core/src/ports/tickets/remote-protocol.ts +37 -8
  42. package/packages/core/src/ports/tickets/remote.ts +41 -3
  43. package/packages/core/src/ports/tickets/tree.ts +11 -1
  44. package/packages/core/src/ports/types.ts +32 -4
  45. package/packages/core/src/ports/workspace/vercel-sandbox.ts +78 -25
  46. package/packages/core/src/processes/build-runner.ts +100 -29
  47. package/packages/core/src/processes/dispatcher.ts +1016 -279
  48. package/packages/core/src/processes/execution-settlement.ts +30 -0
  49. package/packages/core/src/processes/pass-stages.ts +32 -6
  50. package/packages/core/src/store/reducer-value-shapes.json +8440 -8346
  51. package/packages/core/src/store/remote/released-clients.json +22 -0
  52. package/packages/core/src/store/remote/released-reducer-values/1.18.0.json +36436 -0
  53. package/packages/core/src/store/remote/released-reducer-values/1.19.0.json +36461 -0
  54. package/packages/core/src/store/remote/released-reducer-values/index.ts +20 -16
  55. package/packages/core/src/testing/dispatch-read-budget.ts +143 -16
  56. package/packages/core/src/testing/index.ts +2 -0
  57. package/packages/core/src/testing/reduced-read-budget.ts +234 -2
  58. package/skills/guide/SKILL.md +45 -15
  59. package/skills/guide/references/operator-api.md +14 -1
  60. package/skills/guide/references/plugin-authoring.md +29 -1
  61. package/skills/guide/references/remote-ticket-protocol.md +34 -1
  62. package/skills/guide/references/restacking.md +5 -0
  63. package/skills/guide/references/setup.md +9 -3
  64. package/skills/operate/SKILL.md +18 -1
  65. package/templates/hosted-service/package.json +2 -2
@@ -185,7 +185,8 @@ spec → plan ⇄ plan-review → implement ⇄ code-review → verify:* → fin
185
185
  - **`verify:*`** — ordered stages, each containing one or more step phases.
186
186
  Members run concurrently and the next stage waits for every pass or skip.
187
187
  Normal transitions drain agent session settlement before stage-local shutdown;
188
- parent shutdown and session budgets remain active.
188
+ parent shutdown and session budgets remain active. A member's session is
189
+ ended once its step has an outcome, before the next stage or finalize.
189
190
  A failed stage sends every failed report to `implement` after its siblings
190
191
  settle; an optional `failFast` failure cancels unfinished siblings.
191
192
  - **`finalize`** — the agent writes the PR description; the kernel opens the
@@ -886,8 +887,11 @@ Every effective primary/alternate runtime needs a strict
886
887
  `runtimeProvisioning` entry with pinned `install` and exact-version `preflight`
887
888
  commands; runtime names remain open for plugins. Install/preflight runs before
888
889
  the marker in every fresh/replacement/readiness sandbox, and preflight reruns
889
- before every child. Failures name the runtime, role/alternate, and field and
890
- start no agent. Keep runtime installation out of `commands.setup`. Pi over
890
+ before every child. A relaunch whose preflight fails installs that runtime in
891
+ place and preflights again, so a `[roles]` change takes effect in existing
892
+ workspaces at their next launch; only a failure after that install fails the
893
+ launch. Failures name the runtime, role/alternate, and field (`install` or
894
+ `preflight`) with the command output and start no agent. Keep runtime installation out of `commands.setup`. Pi over
891
895
  `vercel-ai-gateway/...` uses `AI_GATEWAY_API_KEY`; never copy Pi state or Pi OAuth refresh tokens. Claude Code can select named [accounts](references/accounts.md): subscription tokens or region-bound Kimi Code keys stay on the dispatcher, with placeholders in the guest and exact-host/header egress transforms. Use the unmodified runtime, your own subscription and ordinary individual usage. Provision Claude/Kimi credentials manually; Autobuild never invokes `claude setup-token`. Codex can explicitly select a ChatGPT Plus/Pro account authorized with `bun ab accounts login NAME [--local|--project]`; exactly one dispatcher or hosted refreshing secret owns its renewal. The clone identity is upload-pack-only and
892
896
  scrubbed from Git config before an agent starts. Agents cannot push. Remote phase terminals deposit a durable
893
897
  publication request and park; that successful `ab done` is the one terminal and
@@ -1062,7 +1066,9 @@ relaunch cost but prevent cancelled descendants from writing during implement.
1062
1066
  Restart reruns only members without outcomes, keeping the same attempt and every
1063
1067
  recorded outcome. One failed cycle spends one verify-attempt unit.
1064
1068
  On normal transitions, terminal-reached agent turns finish their trailing artifacts,
1065
- transcript and session settlement before stage-local interruption. Fail-fast and
1069
+ transcript and session settlement before stage-local interruption. A member's
1070
+ session is ended once its step has an outcome, before the next stage or finalize
1071
+ starts — `reclaimed` when the adapter yields no transcript. Fail-fast and
1066
1072
  actual execution shutdown still interrupt promptly; session budgets remain enforced.
1067
1073
 
1068
1074
  `verify.stage-failed` is the decisive full-feedback receipt. The legacy
@@ -1299,6 +1305,16 @@ the release, the entry keeps the cut execution's instance, and the next
1299
1305
  invocation fences or releases it before anything else. A carried build keeps
1300
1306
  its slot. Its entry retires without launching anything when the build is
1301
1307
  aborted, discarded, paused or no longer needs the start.
1308
+ Ticket preparations are carried too. Intake starts a preparation only with
1309
+ about 30 s left before the work deadline. Otherwise it records the admission
1310
+ without claiming, logs `ticket <id>: preparation carried by the invocation
1311
+ budget`, counts it as `preparationsCarried` and stops claiming. A preparation
1312
+ the deadline cuts before its build exists is carried the same way. The next
1313
+ invocation prepares the same attempt first, from where it stopped, without
1314
+ re-checking capacity. A carried ticket keeps its slot and is held from other
1315
+ claims until its preparation resolves, even across several invocations, and is
1316
+ never handed back to Ready for the interruption. It is released untouched if it left
1317
+ Ready or gained unresolved blockers before its claim.
1302
1318
  No stage consumes a bounded invocation: each starts items only within its share
1303
1319
  of the time left when it begins (half for deferred work, the janitor and the
1304
1320
  lease sweep, a quarter for the others; intake runs to the work deadline), and
@@ -2629,7 +2645,7 @@ subcommands accept `--json`, which emits one bare JSON value and no prose: a
2629
2645
  `Ticket[]` for `list`, and the complete resulting `Ticket` for `create`,
2630
2646
  `update`, `block`, `unblock`, `show`, or `move`.
2631
2647
 
2632
- Paged operator ticket listings may use the optional API 1.9 `TicketSource.listPage(criteria, page)` capability; without it, the operator reads the full listing and slices it. Native errors propagate. CLI ticket lists and dispatcher ready scans remain exhaustive through `listReady`/`listAll`. PostgreSQL pages natively, and the remote `HostedTicketSource` forwards pages to it through the service's `list-page` operation, falling back only against a service predating it; file, Linear and GitHub retain fallback. The POST list-ready protocol stays exhaustive. See the [custom source contract](references/plugin-authoring.md) for types and contract coverage.
2648
+ Paged operator ticket listings may use the optional API 1.9 `TicketSource.listPage(criteria, page)` capability; without it, the operator reads the full listing and slices it. Native errors propagate. CLI ticket lists and dispatcher ready scans remain exhaustive through `listReady`/`listAll`. PostgreSQL pages natively, and the remote `HostedTicketSource` forwards pages to it through the service's `list-page` operation, falling back only against a service predating it; file, Linear and GitHub retain fallback. The POST list-ready protocol stays exhaustive. Completion filters (`since`/`until` over `resolvedAt`, `excludeLabels`, order `completed`) reach `listPage` only on sources declaring the API 1.13 `completionPaging`; the hosted source answers them with at most two range scans, each bounded at 5,001 rows, and refuses ranges over 5,000 tickets with `completion-range-too-broad`, while other sources are filtered over the full listing. See the [custom source contract](references/plugin-authoring.md) for types and contract coverage.
2633
2649
 
2634
2650
  ### Ticket assets
2635
2651
 
@@ -3211,7 +3227,8 @@ an operator may move it as soon as the event arrives. Act on that event, not on
3211
3227
  `build.aborted` or the build leaving `ab builds`: cleanup is asynchronous. Every
3212
3228
  other non-completion hand-back reports the same event once after its move —
3213
3229
  spec-gate bounces (`spec-bounce`, with `missing`), preparation recovery
3214
- returning a confirmed claim to Ready (`preparation-failed`), closed-unmerged
3230
+ returning a confirmed claim to Ready (`preparation-failed`; never for a
3231
+ preparation the work deadline cut or deferred, which is carried), closed-unmerged
3215
3232
  PRs (`pr-closed`) and discards (`discard`). Missing
3216
3233
  Forge cleanup capabilities or provider outages leave cleanup pending with an
3217
3234
  actionable diagnostic for the next tick.
@@ -3506,12 +3523,23 @@ Recovery retries an unaccepted attempt using its inherited handle. Suspended
3506
3523
  sessions reject old credentials permanently. `session.resume-fallback` records
3507
3524
  why native continuation could not be used (including remote workspaces), then
3508
3525
  ordinary fresh-session recovery applies. Unrelated open sessions are reclaimed
3509
- without inventing transcripts. A running, unblocked, unpaused build with no live
3510
- execution or lease and an eligible open bracket is actionable cleanup even when
3511
- the engine waits on a PR. The next admitted sweep attaches through ordinary
3512
- reclamation; live provider executions, intentionally suspended sessions and idle
3513
- collecting nodes are excluded. Ended healthy workspaces are reused; lost ones
3514
- follow fenced recovery. Detection reads reduced facts, never historical events.
3526
+ without inventing transcripts. An execution that ends never leaves its sessions
3527
+ open: with no execution open and no live lease, the dispatcher settles every
3528
+ open session in place at its next sweep or janitor visit, without a runner,
3529
+ including on a paused, blocked or aborted build. A done or aborted build, or
3530
+ one with an abort pending, resumes nothing, so every such session is ended
3531
+ `reclaimed`. Otherwise an unfinished occurrence with a native
3532
+ handle — the one the engine runs next, or one with no terminal yet while a
3533
+ pause or escalation holds the build — is suspended (`shutdown`, naming the
3534
+ ended execution) and resumes as a runner loss; every other open session is
3535
+ ended `reclaimed`. A session left
3536
+ open by an ended execution therefore never holds a landing decision. A running,
3537
+ unblocked, unpaused build with an open bracket and no recorded execution is
3538
+ still actionable cleanup even when the engine waits on a PR: the next admitted
3539
+ sweep attaches through ordinary reclamation. Live provider executions,
3540
+ intentionally suspended sessions and idle collecting nodes are excluded. Ended
3541
+ healthy workspaces are reused; lost ones follow fenced recovery. Detection reads
3542
+ reduced facts, never historical events.
3515
3543
  Dashboard history shows suspended and resumed
3516
3544
  segments separately, with their individual transcript refs and usage.
3517
3545
 
@@ -3615,7 +3643,9 @@ The default watch reports actionable conditions only:
3615
3643
  historical ones, and nothing clears or acknowledges it.
3616
3644
  - Repository `ticket.handed-back`: the dispatcher returned a claimed or ready
3617
3645
  ticket other than as completion, and the move is committed. `cause` is
3618
- `abort`, `spec-bounce`, `preparation-failed`, `pr-closed` or `discard`; the
3646
+ `abort`, `spec-bounce`, `preparation-failed`, `pr-closed` or `discard`
3647
+ (`preparation-failed` never for a preparation the work deadline cut or
3648
+ deferred; that one is carried); the
3619
3649
  payload carries the ticket, the build slug (or the preparation attempt), the
3620
3650
  destination `state` and `role`, `requested` when an abort to ready fell back,
3621
3651
  the spec-standard parts `missing`, and the operator's `reason`. Each hand-back
@@ -3927,8 +3957,8 @@ status, lease health, routing, or recovery.
3927
3957
  | Lease | Meaning |
3928
3958
  |---|---|
3929
3959
  | `held` | A runner holds an unexpired lease. The runner is live; inspect `PROGRESS` to see when it last wrote a durable fact. |
3930
- | `expired` | The lease ran out; ownership is stale. A provider-proved live execution is left alone. `running` + `expired` is the **stale** case: the status is not lying, it simply has no "runner died" fact to record. Re-attachment depends on the current engine decision: the lease sweep re-attaches actionable runner work, including eligible orphaned open-session cleanup on an engine wait, while a merged or closed PR awaits repository-level completion with no runner re-attachment pending. |
3931
- | `no-lease` | **Not necessarily dead.** A build that has not yet claimed its first lease reads this way, and the lease sweep deliberately grants an absent lease a first-claim grace window before acting. Proved-ended executions with pending engine work or eligible orphaned bracket cleanup bypass that grace; live leases still win. A freshly launched build is the common case — read it together with progress, not alone. |
3960
+ | `expired` | The lease ran out; ownership is stale. A provider-proved live execution is left alone. `running` + `expired` is the **stale** case: the status is not lying, it simply has no "runner died" fact to record. Re-attachment depends on the current engine decision: the lease sweep re-attaches actionable runner work, while open sessions of an ended execution are settled in place without a runner, and a merged or closed PR awaits repository-level completion with no runner re-attachment pending. |
3961
+ | `no-lease` | **Not necessarily dead.** A build that has not yet claimed its first lease reads this way, and the lease sweep deliberately grants an absent lease a first-claim grace window before acting. Proved-ended executions with pending engine work or open sessions bypass that grace, and those sessions are settled in place; live leases still win. A freshly launched build is the common case — read it together with progress, not alone. |
3932
3962
 
3933
3963
  So `running` + `held` confirms liveness, while its progress age says whether
3934
3964
  the durable log is moving. For `running` + `expired`, inspect the build detail
@@ -93,7 +93,7 @@ raw session-event append. External operator harnesses own agent execution.
93
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. |
94
94
  | `GET …/harvest/status` | Harvest gate, runs, steps, recovery, and attention projection. |
95
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. |
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. |
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. |
97
97
  | `GET …/tickets/states` | Full state metadata `{name,tickets,about?}[]`, including empty states (`tickets.states` in MCP). |
98
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. |
99
99
 
@@ -874,6 +874,19 @@ are successful cleanup; provider errors never count as completed deletion.
874
874
 
875
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.
876
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
+
877
890
 
878
891
  ### Forge cooldown admission and explicit recovery
879
892
 
@@ -252,6 +252,7 @@ A plugin relying on a capability declares an `apiVersion` range containing its v
252
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`.
253
253
  - **1.11** Optional ticket-source search (`search`); callers refuse sources without it and never fall back to a listing.
254
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.
255
256
 
256
257
  ## 2. Create a repository-local module
257
258
 
@@ -651,7 +652,7 @@ for any other label.
651
652
  ## Optional ticket paging capability
652
653
 
653
654
  Native paging is an optional API 1.9 ticket-source capability:
654
- `listPage?(criteria: TicketCriteria, page: TicketPage): Promise<TicketPageListing>`.
655
+ `listPage?(criteria: TicketPageCriteria, page: TicketPage): Promise<TicketPageListing>`.
655
656
  The SDK exports these types; the result is `TicketListing & { total: number }`.
656
657
  Criteria retain state, labels (AND), and assignee semantics. The page has a
657
658
  nonnegative integer `limit`, optional nonnegative integer `offset` (default 0),
@@ -675,6 +676,33 @@ File, Linear and GitHub retain fallback; the remote `HostedTicketSource`
675
676
  forwards pages to the service's native paging (`list-page`), falling back only
676
677
  against a service predating it. The POST list-ready protocol stays exhaustive.
677
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
+
678
706
  ## Optional ticket search capability
679
707
 
680
708
  Text search is an optional API 1.11 ticket-source capability:
@@ -185,7 +185,7 @@ The operation names and `input` values are:
185
185
  | `state-counts` | `{names: string[]}` (1–16) | `{name, tickets}[]` for the names that resolve |
186
186
  | `list-ready` | `{labels?: string[], state?: string}` | `TicketListing` |
187
187
  | `list-targeting` | `{nodeId: string}` | `TicketListing` of every state |
188
- | `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}`) |
189
189
  | `search` | `{text, state?, labels?, limit, cursor?}` | `{tickets: {id, title, state?, labels, kind, target?, priority?}[], cursor?, diagnostics}` |
190
190
  | `get` | `{id}` | `Ticket \| null` |
191
191
  | `claim` | `{id}` | `{claimed: boolean}` |
@@ -532,6 +532,39 @@ listing takes the `list-ready` path by that explicit decision.
532
532
  The capability is additive. It does not change the remote BuildStore protocol
533
533
  version, and released clients, which never send `list-page`, are unaffected.
534
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
+
535
568
  ## Search
536
569
 
537
570
  `search` answers one page of compact hits from the backing source's own search,
@@ -457,6 +457,11 @@ point-reads the selected slug and, for a keyed attempt, the canonical slug deriv
457
457
  from the repository, selected slug and key: one matching record and atomic
458
458
  `build.created` retain ownership even if creation threw after committing or its
459
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.
460
465
  Unavailable or conflicting readback never authorizes release or a replacement
461
466
  build. Pending attempts retain the original failure, latest recovery error and
462
467
  retry deadline in the canonical repository reduced value; resolved attempts
@@ -113,9 +113,15 @@ already has required system tooling.
113
113
  Put each selected runtime's immutable install and executable/version check in
114
114
  its `runtimeProvisioning` entry. Autobuild runs install then preflight after
115
115
  checkout dependencies in every fresh/replacement sandbox and before the
116
- readiness probe, writes the marker only after success, and reruns every
117
- preflight before each build runner. A failure names the runtime, selecting
118
- role/alternate, and field and starts no agent. Runtime provisioning receives
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
119
125
  allowlisted legacy API credentials named by
120
126
  `[workspace.config].environmentVariables` and automatically supplied placeholders
121
127
  for every declared account credential variable. Account variables need no
@@ -640,6 +640,11 @@ that does the job, and say what you are doing before you do it:
640
640
  - `tickets.list`, `tickets.get` — read the ticket queue and one ticket, with
641
641
  its current assets. A long
642
642
  queue pages with `limit`, `offset` and `order`; `total` counts every match.
643
+ For a "what shipped" digest, pass `since`/`until` (the state defaults to
644
+ done), `order: "completed"`, `excludeLabels` for repository-defined
645
+ categories, and `summary: true` to drop bodies; tickets carry `resolvedAt`,
646
+ and children carry `targetTitle`. On a hosted source, a range over 5,000
647
+ tickets refuses with `code: "completion-range-too-broad"`, so narrow it.
643
648
  - `tickets.search` — search ticket titles and bodies across every state, with
644
649
  optional `state`, `labels`, `limit` and `cursor`. Use it to check for
645
650
  duplicates before `tickets.create`. A source without search refuses with
@@ -784,7 +789,8 @@ Treat every default-watch record as a call to act:
784
789
  - Ticket hand-back (`ticket.handed-back`): the dispatcher returned a claimed or
785
790
  ready ticket other than as completion, and the move is already committed.
786
791
  `cause` is `abort`, `spec-bounce`, `preparation-failed`, `pr-closed` or
787
- `discard`; `state` and `role` say where it went, `requested` the role an abort
792
+ `discard`. A preparation the work deadline cut or deferred is carried, never
793
+ handed back as `preparation-failed`. `state` and `role` say where it went, `requested` the role an abort
788
794
  asked for when it fell back, `missing` the spec-standard parts, and `reason`
789
795
  the operator's text. An abort to ready needs nothing more. For triage, groom
790
796
  the ticket and move it on when intended; for a spec bounce, fix the missing
@@ -1146,6 +1152,11 @@ slow cold resume of a stopped sandbox: retry, or suggest raising
1146
1152
  `recoveryTimeoutMs` within the hosted invocation budget. `at step fence` or
1147
1153
  `at step cleanup` points at sandbox or provider state worth checking before a
1148
1154
  retry; `at step preserve` at the checkout, forge credentials or branch.
1155
+ `during start` with `runtime "X" install failed after its preflight failed` or
1156
+ `runtime "X" preflight failed after install` means the configured
1157
+ `runtimeProvisioning.X` install or preflight is broken, or its pin is wrong:
1158
+ fix the config, then retry. A role change by itself never needs an abort; the
1159
+ next launch installs the newly selected runtime.
1149
1160
  A dispatch log line `build X: resume deferred by the invocation budget` (or
1150
1161
  `provision deferred`, or `launch deferred` for a launch the work deadline cut),
1151
1162
  counted as `recoveryDeferred` or `provisioningDeferred`, is normal: nothing is
@@ -1154,6 +1165,12 @@ first. The same build deferring across several invocations means the hosted
1154
1165
  budget cannot fit that work: report it, and do not retry it. A `fence` line that
1155
1166
  repeats with an infrastructure failure at step `fence` means the provider
1156
1167
  cannot confirm the sandbox stopped: check the sandbox.
1168
+ A line `ticket X: preparation carried by the invocation budget`, counted as
1169
+ `preparationsCarried`, is normal too: the hosted invocation had no time to
1170
+ finish preparing that ticket, so it holds the ticket and the next invocation
1171
+ prepares it first. Do not retry, move or re-file the ticket. The same ticket
1172
+ carried across several invocations means its preparation outlasts the hosted
1173
+ budget: report it with the stage the line names.
1157
1174
  Each hosted invocation logs `stages:` with time and items per stage, and `ab
1158
1175
  repository status` shows the latest as `last pass stages:`. `(share)` on a
1159
1176
  stage is normal under load. Settlement, janitor, hand-back, recovery, resume
@@ -4,8 +4,8 @@
4
4
  "build": "ab-hosted-service-build"
5
5
  },
6
6
  "dependencies": {
7
- "@defrex/autobuild-hosted-store-service": "1.17.0",
8
- "@defrex/autobuild": "1.17.0",
7
+ "@defrex/autobuild-hosted-store-service": "1.19.0",
8
+ "@defrex/autobuild": "1.19.0",
9
9
  "next": "16.1.6",
10
10
  "react": "19.2.4",
11
11
  "react-dom": "19.2.4"