@defrex/autobuild 1.6.0 → 1.7.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 (97) hide show
  1. package/README.md +1 -1
  2. package/SPEC.md +107 -10
  3. package/docs/agent-runtimes.md +1 -1
  4. package/docs/architecture.md +62 -22
  5. package/docs/configuration-overview.md +10 -0
  6. package/docs/configuration.md +285 -5
  7. package/docs/forges.md +1 -0
  8. package/docs/operator-api.md +19 -8
  9. package/docs/operator-surfaces.md +6 -3
  10. package/docs/plugin-authoring.md +44 -6
  11. package/docs/remote-store-protocol.md +19 -6
  12. package/docs/restacking.md +12 -7
  13. package/docs/ticket-sources.md +34 -6
  14. package/docs/tickets.md +6 -0
  15. package/docs/workspaces.md +1 -1
  16. package/package.json +3 -3
  17. package/packages/core/src/cli/attention.ts +1 -0
  18. package/packages/core/src/cli/binary-direct.ts +1 -0
  19. package/packages/core/src/cli/dispatch-frontend.ts +10 -14
  20. package/packages/core/src/cli/dispatch-preflight.ts +1 -0
  21. package/packages/core/src/cli/dispatch-repository-feed.ts +145 -109
  22. package/packages/core/src/cli/dispatch.ts +9 -3
  23. package/packages/core/src/cli/help.ts +11 -4
  24. package/packages/core/src/cli/init-validation.ts +14 -1
  25. package/packages/core/src/cli/repository-status.ts +37 -2
  26. package/packages/core/src/cli/status.ts +8 -0
  27. package/packages/core/src/cli/ticket.ts +22 -4
  28. package/packages/core/src/cli/watch.ts +2 -0
  29. package/packages/core/src/config/live.ts +4 -0
  30. package/packages/core/src/config/profiles.ts +96 -0
  31. package/packages/core/src/config/ready-assignee.ts +43 -11
  32. package/packages/core/src/config/roles.ts +33 -10
  33. package/packages/core/src/config/schema.ts +166 -24
  34. package/packages/core/src/events/compatibility.ts +3 -1
  35. package/packages/core/src/events/forge-degradation-policy.ts +16 -2
  36. package/packages/core/src/events/payloads.ts +8 -0
  37. package/packages/core/src/events/policy.ts +1 -0
  38. package/packages/core/src/events/repository.ts +17 -0
  39. package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +73 -124
  40. package/packages/core/src/kernel/build-creation.ts +29 -0
  41. package/packages/core/src/kernel/forge-health.ts +47 -0
  42. package/packages/core/src/kernel/guarded-forge.ts +76 -18
  43. package/packages/core/src/kernel/node-parent.ts +2 -0
  44. package/packages/core/src/kernel/read-facts.ts +9 -1
  45. package/packages/core/src/kernel/reducer.ts +18 -1
  46. package/packages/core/src/kernel/ticket-preparation.ts +4 -1
  47. package/packages/core/src/operator/protocol.ts +10 -0
  48. package/packages/core/src/operator/query.ts +1 -1
  49. package/packages/core/src/operator/registry.ts +25 -5
  50. package/packages/core/src/operator/sandbox-host.ts +3 -0
  51. package/packages/core/src/operator/tickets.ts +15 -3
  52. package/packages/core/src/plugin-sdk/index.ts +4 -0
  53. package/packages/core/src/ports/forge/create.ts +6 -0
  54. package/packages/core/src/ports/forge/github-transport.ts +40 -3
  55. package/packages/core/src/ports/forge/github.ts +12 -1
  56. package/packages/core/src/ports/forge/workspace-ancestry.ts +60 -0
  57. package/packages/core/src/ports/forge-failure.ts +31 -2
  58. package/packages/core/src/ports/runner/routing.ts +66 -5
  59. package/packages/core/src/ports/tickets/assignees.ts +54 -0
  60. package/packages/core/src/ports/tickets/contract.ts +164 -4
  61. package/packages/core/src/ports/tickets/create.ts +17 -3
  62. package/packages/core/src/ports/tickets/github-fake.ts +18 -2
  63. package/packages/core/src/ports/tickets/github.ts +247 -29
  64. package/packages/core/src/ports/tickets/hosted-index.ts +1 -0
  65. package/packages/core/src/ports/tickets/operations.ts +6 -1
  66. package/packages/core/src/ports/tickets/tree.ts +12 -2
  67. package/packages/core/src/ports/tickets/update.ts +6 -2
  68. package/packages/core/src/ports/types.ts +33 -3
  69. package/packages/core/src/ports/workspace/vercel-sandbox.ts +9 -0
  70. package/packages/core/src/processes/build-child.ts +28 -7
  71. package/packages/core/src/processes/build-execution-state.ts +4 -1
  72. package/packages/core/src/processes/build-runner.ts +15 -1
  73. package/packages/core/src/processes/dispatcher.ts +98 -18
  74. package/packages/core/src/processes/harvest-child.ts +4 -0
  75. package/packages/core/src/processes/harvest-runner.ts +5 -0
  76. package/packages/core/src/processes/repo-view.ts +2 -0
  77. package/packages/core/src/scenarios/harness.ts +15 -1
  78. package/packages/core/src/store/reducer-value-shapes.json +3119 -2926
  79. package/packages/core/src/store/remote/client.ts +21 -8
  80. package/packages/core/src/store/remote/index.ts +4 -0
  81. package/packages/core/src/store/remote/protocol.ts +7 -0
  82. package/packages/core/src/store/remote/released-clients.json +11 -0
  83. package/packages/core/src/store/remote/released-reducer-values/1.7.0.json +27366 -0
  84. package/packages/core/src/store/remote/released-reducer-values/index.ts +2 -0
  85. package/packages/core/src/store/repo-state-events.ts +1 -0
  86. package/packages/core/src/store/types.ts +11 -0
  87. package/packages/core/src/testing/dispatch-read-budget.ts +84 -58
  88. package/packages/core/src/testing/index.ts +2 -0
  89. package/packages/core/src/testing/reduced-read-budget.ts +72 -9
  90. package/skills/guide/SKILL.md +116 -21
  91. package/skills/guide/references/operator-api.md +19 -8
  92. package/skills/guide/references/plugin-authoring.md +44 -6
  93. package/skills/guide/references/remote-store-protocol.md +19 -6
  94. package/skills/guide/references/restacking.md +12 -7
  95. package/skills/operate/SKILL.md +29 -3
  96. package/skills/tickets/SKILL.md +18 -2
  97. package/templates/hosted-service/package.json +2 -2
@@ -17,7 +17,7 @@ node fast-forwards preserve ordered contributing identities.
17
17
 
18
18
  Destination heads come only from the authoritative forge branch; dispatcher-host
19
19
  refs are never a fallback. Failed remote reads retain the accepted observation;
20
- classified rate limits use repository forge degradation and cooldown. Changed
20
+ dispatcher-classified rate limits use repository forge degradation and cooldown. Changed
21
21
  heads require immutable commit ancestry proof against the accepted target and
22
22
  the destination base already used by replay. Missing capability or failed proof
23
23
  defers new replay. A non-descendant without kernel lineage records
@@ -221,7 +221,7 @@ not consume `maxPhaseAttempts`. A seventh transient failure records
221
221
  error and six retries. Answering that escalation opens a fresh publication episode
222
222
  for the same retained intent without resetting agent phase failures. Pending
223
223
  publication keeps its workspace through backoff and unresolved exhaustion.
224
- Classified rate limits retain repository cooldown and consume no publication
224
+ Dispatcher-classified rate limits retain repository cooldown and consume no publication
225
225
  retry allowance. Rejected pushes, lease conflicts, dirty trees and unclassified
226
226
  errors retain their existing behavior.
227
227
 
@@ -237,11 +237,14 @@ sessions do not inherit obsolete reconstruction instructions.
237
237
  ## Ticket preparation before build creation
238
238
 
239
239
  Before claiming, the dispatcher journals a repository-scoped preparation intent;
240
- a won claim and the exact selected creation slug are durable boundaries. Caught
240
+ a won claim, the selected creation slug and, when the build store attests keyed
241
+ creation, the attempt's creation key are durable boundaries. Caught
241
242
  asset-copy, spec-authoring, naming, and build-creation failures return the ticket
242
243
  to configured Ready; a nonconforming spec goes to configured Triage. Recovery
243
- checks the exact selected build first: a matching record and atomic
244
- `build.created` retain ownership even if creation threw after committing.
244
+ point-reads the selected slug and, for a keyed attempt, the canonical slug derived
245
+ from the repository, selected slug and key: one matching record and atomic
246
+ `build.created` retain ownership even if creation threw after committing or its
247
+ response was lost.
245
248
  Unavailable or conflicting readback never authorizes release or a replacement
246
249
  build. Pending attempts retain the original failure, latest recovery error and
247
250
  retry deadline in the canonical repository reduced value; resolved attempts
@@ -249,8 +252,10 @@ leave that value. Under repository ownership, each tick admits at most eight
249
252
  due recovery attempts, before intake and independently of capacity or intake
250
253
  settings, with a 30-second durable retry delay after recovery failure. Unresolved
251
254
  ticket identities remain withheld. An uncertain claim outcome or unrelated
252
- external ticket state, missing ticket/state, or conflicting slug ownership terminates
253
- automatic recovery with an `abandoned` resolution and diagnostic reason. The
255
+ external ticket state, missing ticket/state, conflicting slug ownership, builds at
256
+ both identities, or an unknown creation outcome (an unkeyed attempt on a store
257
+ that allocates slugs, where absence is not evidence) terminates automatic
258
+ recovery with an `abandoned` resolution and diagnostic reason. The
254
259
  ticket is left unchanged; an operator can leave it finished or cancelled, or
255
260
  inspect ownership and explicitly return it to Ready for another attempt. These
256
261
  cases stop provider polling and further durable diagnostic appends. The tick
@@ -113,7 +113,7 @@ rejectedState = "rejected"
113
113
 
114
114
  ### GitHub (`github`)
115
115
 
116
- Tickets are the issues of the forge repository, the GitHub repository that `origin` names, so a team grooms and tracks work where it already looks. The source authenticates as the `github` forge does: `GITHUB_TOKEN`, then `GH_TOKEN`, then the gh CLI's `gh auth login`. A fine-grained token needs Issues read and write, and Metadata read, on the repository, and a user token's user needs triage or write access: GitHub silently drops label changes from anyone below that, so a label write that doesn't come back fails with a permission error instead of reporting success. `ab init --validate` names a missing token, a token that can't read and write issues, a user who can't set labels, disabled issues, an `origin` that isn't a GitHub repository, a state that can't be a label, and a `readyAssignee` that names no user who can be assigned issues in the repository.
116
+ Tickets are the issues of the forge repository, the GitHub repository that `origin` names, so a team grooms and tracks work where it already looks. The source authenticates as the `github` forge does: `GITHUB_TOKEN`, then `GH_TOKEN`, then the gh CLI's `gh auth login`. A fine-grained token needs Issues read and write, and Metadata read, on the repository, and a user token's user needs triage or write access: GitHub silently drops label changes from anyone below that, so a label write that doesn't come back fails with a permission error instead of reporting success. `ab init --validate` names a missing token, a token that can't read and write issues, a user who can't set labels, disabled issues, an `origin` that isn't a GitHub repository, a state that can't be a label, and a `readyAssignee` or `createAssignee` that names no user who can be assigned issues in the repository, or `"me"` with a credential that has no user.
117
117
 
118
118
  <!-- seam-config:start -->
119
119
  ```toml
@@ -138,17 +138,35 @@ rejectedState = "rejected"
138
138
  - **Closing reasons.** Closed as completed, or closed before GitHub recorded reasons, is done. Closed as not planned or duplicate is in the `rejectedState` state; without `rejectedState` it reads as a fixed `not-planned` state that is never ready, never resolves a blocker and can't be moved into. Moving to done or rejected closes the issue with that reason (an issue already closed with the other reason is reopened and closed again, because GitHub changes a reason only with the state); moving to any other state opens it with exactly that state's label.
139
139
  - **Reopen goes to triage.** If a state label survived the close, the adapter strips that stale label the first time it reads the reopened issue. It tells stale from fresh by the issue's last 100 label and reopen events; an issue whose deciding event is older than that is left out of listings with a diagnostic until its state label is removed and re-added.
140
140
  - **Labels.** `readyLabels` defaults to `["autobuild"]`; `[]` removes the gate. Missing labels are created on demand. State and link labels are never part of a ticket's labels, and a write that names one is refused. The `autobuild:proposal` and `autobuild:aborted` labels that harvest and abort apply are ordinary labels, so `proposal` and `aborted` can't be states.
141
- - **Assignee.** `readyAssignee = "me"` keeps only issues assigned to the login that owns the GitHub credential; a username, including an Enterprise Managed User login such as `mona_acme`, names a specific user. The ready read itself is narrowed by assignee, an unassigned issue is never ready, and any one of several assignees matches. `"me"` costs one `GET /user` per dispatcher start, never during a tick, so a reload that enables it needs no restart unless startup couldn't resolve the credential's owner.
141
+ - **Assignee.** `readyAssignee = "me"` keeps only issues assigned to the login that owns the GitHub credential; a username, including an Enterprise Managed User login such as `mona_acme`, names a specific user. The ready read itself is narrowed by assignee, an unassigned issue is never ready, and any one of several assignees matches. While `readyAssignee` is set, each scan reports open ready issues that carry every `readyLabels` entry but have no assignee in the ticket diagnostics, which `ab repository status` and the dashboards show, naming the ten lowest-numbered and counting the rest. The report never claims or assigns them; assigning one makes it claimable. `"me"` costs one `GET /user` per dispatcher start, never during a tick, so a reload that enables it needs no restart unless startup couldn't resolve the credential's owner.
142
+ - **Assignees.** Tickets carry the issue's assignees as an `assignees` array of usernames in JSON reads, whether they were set on GitHub or through `ab`, and `ab ticket show` prints them. They aren't part of the ticket's `revision`. `--assignees` on `ab ticket create` and `ab ticket update`, and the `assignees` field of the operator `tickets.create` and `tickets.update` tools, set them: each entry is a username or `me`, at most ten entries counted before duplicates collapse, and an update replaces the whole set. `createAssignee = "me"` (or a username) assigns every ticket Autobuild creates, through `ab ticket create`, operator `tickets.create` and harvest proposals, unless the create names its own assignees; a harvest proposal goes to the owner of the filing dispatcher's credential. That pairs with `readyAssignee = "me"`, so each person's dispatcher picks up the tickets they file. A create or update fails, naming the cause and writing nothing, when `me` has no user behind the credential (a GitHub App installation token has none) or a user can't be assigned issues in the repository. GitHub silently drops assignees a token without push access sets, so a write whose assignees don't come back fails, naming the issue and saying it is unassigned; a retried harvest create adopts that issue and assigns it. A write naming assignees costs one check per user per process, `me` reuses the `readyAssignee` `GET /user`, and reads cost nothing extra.
142
143
  - **Blockers** are native issue dependencies ("blocked by"), visible on both issues, including ones added on GitHub. A blocker resolves when its issue is done. One in another repository never resolves and is named in the dependency diagnostics. An issue transferred to another repository is no longer a ticket here: its old number reads as missing, so it is never written and never resolves a blocker.
143
144
  - **Issue links.** The ticket's own issue is always a `closes` link that can't be removed. Links to other issues are labels named `autobuild-link:<intent> #<n>`, such as `autobuild-link:refs #820`, so they show on the issue and survive edits on GitHub. Each linked issue and intent adds one repository label, which appears in GitHub's label picker; unused link labels are never deleted.
144
145
  - **Comments and assets.** Dispatcher notices post as issue comments, but tickets carry no comment history, so `ab ticket show` lists none; export and import read comment history explicitly. Assets live in the BuildStore, with the usual note left as an issue comment.
145
146
  - **Nodes and targets.** A node is an issue with the exact `node` label. A ticket targets a node by being a sub-issue of the node's issue, so the node's sub-issue list on GitHub shows its children. A parent without the `node` label, or in another repository, is ordinary grouping: it gives no target, never blocks dispatch and is left untouched, so `--target` on such an issue is refused and `--no-target` doesn't remove it. Sub-issues and `node` labels added or removed on GitHub read the same as `ab ticket` writes. GitHub allows 100 direct sub-issues per issue and 8 levels of nesting. A repository label named `Node` or another casing must be renamed to `node` first.
146
147
  - **Export and import.** `ab ticket export` covers every issue, closed ones included. `ab ticket import` remaps every id to a new issue number and resumes by creation key, as the ticket migration procedure's GitHub section describes.
147
148
  - **Not supported:** guarded writes (`--expected-revision` is refused, as with Linear).
148
- - **Cost.** Dispatcher reads are conditional requests. Their validators live under the local state root, in `github-tickets/<owner>/<repo>/validators/`, and are evicted after 7 days unused, so a tick on an unchanged repository spends no primary rate-limit budget. A process without them, such as a cold hosted instance, pays one read sized by the ready candidates. A ready candidate whose parent issue isn't in the listing adds one conditional read of that parent, at most one per distinct parent. A node's completeness check reads the node issue and its sub-issues, conditionally, whatever the repository's size. Rate limits surface as the ticket-source rate-limit error, with GitHub's reset time.
149
+ - **Cost.** Dispatcher reads are conditional requests. Their validators live under the local state root, in `github-tickets/<owner>/<repo>/validators/`, and are evicted after 7 days unused, so a tick on an unchanged repository spends no primary rate-limit budget. A process without them, such as a cold hosted instance, pays one read sized by the ready candidates. A ready candidate whose parent issue isn't in the listing adds one conditional read of that parent, at most one per distinct parent. A node's completeness check reads the node issue and its sub-issues, conditionally, whatever the repository's size. With `readyAssignee` set, the unassigned-issue report adds one conditional read per scan, plus one per further page, which is free on an unchanged repository; its failure, a rate limit included, is a diagnostic that never stops assigned tickets from being listed and claimed. Rate limits surface as the ticket-source rate-limit error, with GitHub's reset time.
149
150
  - **State counts** are display-only: one fresh GraphQL request per call, plus one more for each further page of 100 `autobuild:` labels, never cached and never reading issue history, with done and rejected subject to GitHub's search-index lag. Three cases approximate. A stale reopen label counts in its label's state until the first read strips it. An issue with two or more state labels counts once in each until its labels are fixed; the first read reports it. A closure that predates GitHub's close reasons reads as done but may count as rejected or `not-planned`, and never heals.
150
151
  - **Creation keys** live in a hidden marker in the issue body. A keyed create needs `idempotencyKeyReservedAt`; harvest supplies it.
151
152
 
153
+ Issues filed directly on GitHub aren't assigned by Autobuild, so under `readyAssignee` they never become ready until someone assigns them. A small Actions workflow can assign each opened issue to its author:
154
+
155
+ ```yaml
156
+ on: { issues: { types: [opened] } }
157
+ permissions: { issues: write }
158
+ jobs:
159
+ assign:
160
+ runs-on: ubuntu-latest
161
+ steps:
162
+ - run: gh issue edit "$NUMBER" --repo "$REPO" --add-assignee "$AUTHOR"
163
+ env:
164
+ GH_TOKEN: ${{ github.token }}
165
+ NUMBER: ${{ github.event.issue.number }}
166
+ REPO: ${{ github.repository }}
167
+ AUTHOR: ${{ github.event.issue.user.login }}
168
+ ```
169
+
152
170
  ### Optional issue links
153
171
 
154
172
  The `file`, `hosted` and `github` sources store [forge issue links](tickets.md#groom-a-buildable-spec): as `issueLinks` frontmatter (`file`), transactional project data (`hosted`), or `autobuild-link:<intent> #<n>` labels (`github`), where the ticket's own issue is a `closes` link with no label. `linear` doesn't, because Linear links GitHub issues natively through its own integration; a create or update that names issue links is refused with an error naming the source, and nothing is written.
@@ -188,6 +206,8 @@ bun ab plugin test ticket-source acme
188
206
 
189
207
  Declare `readyAssignee` only if `listReady` filters by `criteria.assignee`; without it, a configured `readyAssignee` is refused, naming your source. See the [optional ready assignee capability](plugin-authoring.md#optional-ready-assignee-capability).
190
208
 
209
+ Declare `assignees` only if you store, return and verify ticket assignees; without it, a write naming assignees and a configured `createAssignee` are refused, naming your source. See the [optional assignees capability](plugin-authoring.md#optional-assignees-capability).
210
+
191
211
  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.
192
212
 
193
213
  Native paging is an optional API 1.9 ticket-source capability:
@@ -195,8 +215,11 @@ Native paging is an optional API 1.9 ticket-source capability:
195
215
  The SDK exports these types; the result is `TicketListing & { total: number }`.
196
216
  Criteria retain state, labels (AND), and assignee semantics. The page has a
197
217
  nonnegative integer `limit`, optional nonnegative integer `offset` (default 0),
198
- and optional `order: 'oldest' | 'newest'` (default oldest). Newest reverses the
199
- entire source order before offset and limit. Total counts all matches, even
218
+ and optional `order: 'oldest' | 'newest'` (default oldest). Oldest is the
219
+ source's dispatch order: with `priority`, urgent tickets first, then normal
220
+ ones, each in listing order. Newest is newest filed first: creation time
221
+ descending, regardless of urgency, with a stable tie-break. It is not the
222
+ reverse of dispatch order. Offset and limit apply after ordering. Total counts all matches, even
200
223
  with limit zero or an offset past the end. Records, diagnostics and errors
201
224
  match the exhaustive listing. The shared `describeTicketSourceContract` suite
202
225
  automatically compares declared native paging with full-read windows.
@@ -204,7 +227,12 @@ automatically compares declared native paging with full-read windows.
204
227
  Only paged operator listings select this capability. Sources without it retain
205
228
  the full-read fallback, which orders the listing before offset and limit: by
206
229
  default a stable urgent-first partition (urgent, then normal, each in source
207
- order), or for newest the reversed source order. Native errors propagate. Unpaged operator
230
+ order), or for newest the reversed listing, which is newest filed first for
231
+ sources that list in filing order (file, GitHub, Linear). The remote
232
+ `HostedTicketSource` is the exception: the hosted list-ready protocol returns
233
+ urgent tickets first and carries no filing time, so the client cannot see
234
+ filing order, and its newest pages are reversed dispatch order whenever urgent
235
+ tickets exist. Native errors propagate. Unpaged operator
208
236
  listings, CLI ticket lists and dispatcher ready scans remain exhaustive through
209
237
  `listReady`/`listAll`. The hosted PostgreSQL source counts matches without
210
238
  bodies and reads only the SQL-bounded window. File, Linear, GitHub and the remote
package/docs/tickets.md CHANGED
@@ -55,6 +55,12 @@ When a ticket must go next, such as a fix for a stuck build, mark it urgent inst
55
55
  bun ab ticket update AUT-12 --priority urgent
56
56
  ```
57
57
 
58
+ On the `github` source a ticket has assignees. `--assignees alice,me` on `ab ticket create` or `ab ticket update` sets them, where `me` is the owner of the GitHub credential. On update it replaces the whole set, `--assignees ''` clears it, and omitting the option leaves it alone. Set `[tickets].createAssignee` to assign every ticket Autobuild creates, including harvest proposals; explicit `--assignees` replace that default. `ab ticket show` prints the assignees, and JSON ticket reads carry an `assignees` array of usernames. Sources that can't store assignees refuse the option and name the source. See [Ticket sources](ticket-sources.md#shipped-adapters).
59
+
60
+ ```sh
61
+ bun ab ticket update 412 --assignees octocat
62
+ ```
63
+
58
64
 
59
65
  ## Backlog and rejected
60
66
 
@@ -126,7 +126,7 @@ export AB_GIT_READ_TOKEN='<read-only repository token>'
126
126
 
127
127
  - Use a repository-scoped read token, separate from the push identity. For a public clone, remove `gitUsernameEnv` and `gitPasswordEnv`.
128
128
  - Autobuild passes these as the authenticated Git source for [Vercel private-repository cloning](https://vercel.com/kb/guide/sandbox-private-github-repositories); don't embed credentials in the origin URL.
129
- - `environmentVariables` forwards legacy runtime API credentials; declared account credentials become placeholders even when listed here. Never forward `AB_TOKEN`, `GITHUB_TOKEN`, `GH_TOKEN`, Vercel tokens or the clone token; Autobuild supplies scoped Store authority, keeps clone secrets out of guest commands, and publishes from the host.
129
+ - `environmentVariables` forwards legacy runtime API credentials; declared account credentials become placeholders even when listed here. Never forward `AB_TOKEN`, `GITHUB_TOKEN`, `GH_TOKEN`, Vercel tokens or the clone token; Autobuild supplies scoped Store authority, keeps clone secrets out of guest commands, and publishes from the host. Guest runners always run with `AB_GITHUB_REQUIRE_CREDENTIAL=1`, which a forwarded value cannot override, so a GitHub API request from the guest without a credential fails with a typed error naming `GITHUB_TOKEN or GH_TOKEN` instead of using the sandbox address's shared anonymous quota.
130
130
 
131
131
  ## Writing your own
132
132
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defrex/autobuild",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "Agent-driven software delivery from groomed ticket to merged PR",
5
5
  "repository": {
6
6
  "type": "git",
@@ -157,8 +157,8 @@
157
157
  },
158
158
  "devDependencies": {
159
159
  "@biomejs/biome": "2.5.5",
160
- "@defrex/autobuild-postgres-store": "1.6.0",
161
- "@defrex/autobuild-vercel-sandbox": "1.6.0",
160
+ "@defrex/autobuild-postgres-store": "1.7.0",
161
+ "@defrex/autobuild-vercel-sandbox": "1.7.0",
162
162
  "@resvg/resvg-js": "2.6.2",
163
163
  "@types/bun": "^1.3.14",
164
164
  "@types/node": "^24.0.0",
@@ -62,6 +62,7 @@ export function repositoryNeedsAttention(event: RepositoryEvent): boolean {
62
62
  case 'dispatcher.runtime-rolled-back':
63
63
  case 'dispatcher.upgrade-failed':
64
64
  case 'dispatcher.kernel-git-unavailable':
65
+ case 'forge.credential-limited':
65
66
  return true
66
67
  case 'dispatcher.config-reloaded':
67
68
  return event.payload.restartRequired.length > 0
@@ -187,6 +187,7 @@ export async function runDirectBinary(
187
187
  repo: record.repo,
188
188
  name: forge.name,
189
189
  wait: true,
190
+ scope: { process: `phase session ${cliEnv.session} (build ${cliEnv.build})` },
190
191
  })
191
192
  return await runCli(argv, {
192
193
  ...unscopedDeps,
@@ -23,7 +23,6 @@ import { DispatchRepositoryFeed } from './dispatch-repository-feed'
23
23
  import { StandbyIdentityResolver } from './dispatcher-liveness'
24
24
  import { configSchema, type Config } from '../config/schema'
25
25
  import { humanActor } from '../events/envelope'
26
- import type { RepositoryEvent } from '../events/repository'
27
26
  import { reduceDispatchStatus, type DispatchStatus } from '../kernel/dispatch-status'
28
27
  import type { BuildState } from '../kernel/reducer'
29
28
  import {
@@ -210,9 +209,9 @@ export class DispatchFrontend {
210
209
 
211
210
  /** Advance the repository cursor exactly once even when polling overlaps an
212
211
  * operator action. High-frequency dispatcher status is folded from deltas;
213
- * only the low-volume settings/Harvest facts needed by the dashboard model
214
- * are retained for their existing replay reducers. */
215
- private async events(sampledPosition?: string): Promise<RepositoryEvent[]> {
212
+ * the feed retains standby identities only, and dashboard facts come from
213
+ * the canonical repository facts. */
214
+ private async advanceRepository(sampledPosition?: string): Promise<void> {
216
215
  if (this.opts.viewer) {
217
216
  const position = sampledPosition ?? (await this.reader.getRepoChangePosition(this.opts.repo))
218
217
  if (
@@ -224,7 +223,7 @@ export class DispatchFrontend {
224
223
  this.viewerReadAt = this.clock().getTime()
225
224
  }
226
225
  this.dispatchStatus = this.viewerFacts!.status ?? reduceDispatchStatus([], this.runId)
227
- return []
226
+ return
228
227
  }
229
228
  const refresh = this.eventRefreshTail.then(async () => {
230
229
  const delta = await this.repositoryFeed.refresh(false)
@@ -234,7 +233,6 @@ export class DispatchFrontend {
234
233
  })
235
234
  this.eventRefreshTail = refresh.catch(() => {})
236
235
  await refresh
237
- return this.repositoryFeed.events
238
236
  }
239
237
 
240
238
  private async report(message: string, level: 'info' | 'warning' = 'info'): Promise<void> {
@@ -367,7 +365,6 @@ export class DispatchFrontend {
367
365
  }
368
366
 
369
367
  private readonly repositoryPoll = new RepositoryPollCache<{
370
- repositoryEvents: RepositoryEvent[]
371
368
  upgrades: DispatchUpgradeState
372
369
  repositoryFacts: RepositoryReadFacts
373
370
  status: DispatchStatus
@@ -424,7 +421,7 @@ export class DispatchFrontend {
424
421
  admitted: () => this.refresh === undefined || this.refresh.admitted,
425
422
  nextPollMs: this.refresh?.intervalMs ?? 0,
426
423
  read: async ({ fullEnrichment }) => {
427
- const repositoryEvents = await this.events(sampledPosition)
424
+ await this.advanceRepository(sampledPosition)
428
425
  // Authority and rollback holds need the full durable reduction, not the
429
426
  // low-volume replay feed (which deliberately discards per-tick facts).
430
427
  const repositoryFacts =
@@ -433,7 +430,7 @@ export class DispatchFrontend {
433
430
  await readRepositoryFacts(
434
431
  this.reader,
435
432
  this.opts.repo,
436
- repositoryEvents.length || this.repositoryFeed.identities.length ? true : undefined,
433
+ this.repositoryFeed.present ? true : undefined,
437
434
  )
438
435
  ).value
439
436
  const upgrades = repositoryFacts.upgrades
@@ -465,7 +462,6 @@ export class DispatchFrontend {
465
462
  if (!this.opts.viewer) await this.repositoryFeed.save()
466
463
  if (!this.cache.isCurrent(snapshot)) return undefined
467
464
  return {
468
- repositoryEvents,
469
465
  repositoryFacts,
470
466
  upgrades,
471
467
  status,
@@ -475,7 +471,7 @@ export class DispatchFrontend {
475
471
  },
476
472
  })
477
473
  if (frame === undefined) return
478
- let { repositoryEvents, repositoryFacts, upgrades, status } = frame
474
+ let { repositoryFacts, upgrades, status } = frame
479
475
  const { config, snapshot } = frame
480
476
  this.pollViewerTriage(config)
481
477
  const standby =
@@ -495,12 +491,12 @@ export class DispatchFrontend {
495
491
  const slug = this.abortConfirmation.slug
496
492
  if (!validAbortConfirmation(snapshot.states.get(slug))) {
497
493
  await this.dismissStaleAbortConfirmation(slug)
498
- repositoryEvents = await this.events()
494
+ await this.advanceRepository()
499
495
  repositoryFacts = (
500
496
  await readRepositoryFacts(
501
497
  this.reader,
502
498
  this.opts.repo,
503
- repositoryEvents.length || this.repositoryFeed.identities.length ? true : undefined,
499
+ this.repositoryFeed.present ? true : undefined,
504
500
  )
505
501
  ).value
506
502
  upgrades = repositoryFacts.upgrades
@@ -809,7 +805,7 @@ export class DispatchFrontend {
809
805
  }
810
806
 
811
807
  private async confirmAbort(slug: string): Promise<void> {
812
- await this.events()
808
+ await this.advanceRepository()
813
809
  const ref = this.dispatchStatus.effectiveConfig
814
810
  if (ref === undefined) throw new Error('effective config is not available')
815
811
  const config = await this.loadConfig(ref.kind, ref.rev)
@@ -179,6 +179,7 @@ async function runGenerationPreflight(
179
179
  config.roles,
180
180
  config.policy.sessionBudgetSeconds,
181
181
  config.accounts,
182
+ config.profiles,
182
183
  )
183
184
  const facts = (await readDispatcherRunFacts(opened.store, opened.repo, handoff.run)).value
184
185
  const start = facts.start