@defrex/autobuild 1.5.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 (126) hide show
  1. package/README.md +1 -1
  2. package/SPEC.md +192 -24
  3. package/docs/agent-runtimes.md +1 -1
  4. package/docs/answering-blocked-builds.md +7 -4
  5. package/docs/architecture.md +100 -32
  6. package/docs/configuration-overview.md +10 -0
  7. package/docs/configuration.md +340 -10
  8. package/docs/dispatcher.md +2 -2
  9. package/docs/forges.md +1 -0
  10. package/docs/glossary.md +1 -1
  11. package/docs/operating.md +1 -1
  12. package/docs/operator-api.md +33 -10
  13. package/docs/operator-surfaces.md +6 -3
  14. package/docs/plugin-authoring.md +48 -6
  15. package/docs/remote-store-protocol.md +33 -10
  16. package/docs/restacking.md +16 -7
  17. package/docs/ticket-sources.md +34 -6
  18. package/docs/tickets.md +7 -1
  19. package/docs/troubleshooting.md +1 -1
  20. package/docs/workspaces.md +1 -1
  21. package/package.json +3 -3
  22. package/packages/core/src/cli/attention.ts +3 -0
  23. package/packages/core/src/cli/binary-direct.ts +1 -0
  24. package/packages/core/src/cli/dashboard/model.ts +14 -4
  25. package/packages/core/src/cli/dashboard/poll.ts +14 -0
  26. package/packages/core/src/cli/dashboard/render.ts +3 -0
  27. package/packages/core/src/cli/dispatch-frontend.ts +10 -14
  28. package/packages/core/src/cli/dispatch-preflight.ts +5 -1
  29. package/packages/core/src/cli/dispatch-repository-feed.ts +145 -109
  30. package/packages/core/src/cli/dispatch-tickets.ts +47 -0
  31. package/packages/core/src/cli/dispatch-upgrade-controller.ts +3 -0
  32. package/packages/core/src/cli/dispatch.ts +377 -101
  33. package/packages/core/src/cli/help.ts +15 -6
  34. package/packages/core/src/cli/init-validation.ts +14 -1
  35. package/packages/core/src/cli/repo-lease.ts +225 -0
  36. package/packages/core/src/cli/repository-status.ts +40 -3
  37. package/packages/core/src/cli/status.ts +21 -13
  38. package/packages/core/src/cli/ticket.ts +22 -4
  39. package/packages/core/src/cli/wait.ts +4 -1
  40. package/packages/core/src/cli/watch.ts +17 -4
  41. package/packages/core/src/config/live.ts +4 -0
  42. package/packages/core/src/config/profiles.ts +96 -0
  43. package/packages/core/src/config/ready-assignee.ts +43 -11
  44. package/packages/core/src/config/roles.ts +33 -10
  45. package/packages/core/src/config/schema.ts +204 -26
  46. package/packages/core/src/events/catalog.ts +2 -0
  47. package/packages/core/src/events/compatibility.ts +3 -1
  48. package/packages/core/src/events/forge-degradation-policy.ts +16 -2
  49. package/packages/core/src/events/payloads.ts +23 -0
  50. package/packages/core/src/events/policy.ts +3 -0
  51. package/packages/core/src/events/repository.ts +19 -0
  52. package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +267 -352
  53. package/packages/core/src/kernel/build-creation.ts +29 -0
  54. package/packages/core/src/kernel/dispatch-capacity.ts +134 -30
  55. package/packages/core/src/kernel/engine.ts +13 -6
  56. package/packages/core/src/kernel/forge-health.ts +47 -0
  57. package/packages/core/src/kernel/generators/build-log.ts +9 -0
  58. package/packages/core/src/kernel/guarded-forge.ts +76 -18
  59. package/packages/core/src/kernel/incremental-fixtures.ts +1 -0
  60. package/packages/core/src/kernel/janitor-failure.ts +85 -5
  61. package/packages/core/src/kernel/leaf-restack-state.ts +4 -2
  62. package/packages/core/src/kernel/log-index.ts +1 -1
  63. package/packages/core/src/kernel/node-landing.ts +2 -1
  64. package/packages/core/src/kernel/node-parent.ts +2 -0
  65. package/packages/core/src/kernel/read-facts.ts +9 -1
  66. package/packages/core/src/kernel/reducer-registry.ts +6 -1
  67. package/packages/core/src/kernel/reducer.ts +75 -4
  68. package/packages/core/src/kernel/ticket-preparation.ts +15 -8
  69. package/packages/core/src/operator/protocol.ts +10 -0
  70. package/packages/core/src/operator/query.ts +16 -13
  71. package/packages/core/src/operator/registry.ts +25 -5
  72. package/packages/core/src/operator/sandbox-host.ts +3 -0
  73. package/packages/core/src/operator/tickets.ts +15 -3
  74. package/packages/core/src/plugin-sdk/index.ts +4 -0
  75. package/packages/core/src/ports/forge/create.ts +6 -0
  76. package/packages/core/src/ports/forge/github-transport.ts +40 -3
  77. package/packages/core/src/ports/forge/github.ts +12 -1
  78. package/packages/core/src/ports/forge/workspace-ancestry.ts +60 -0
  79. package/packages/core/src/ports/forge-failure.ts +31 -2
  80. package/packages/core/src/ports/runner/routing.ts +66 -5
  81. package/packages/core/src/ports/tickets/assignees.ts +54 -0
  82. package/packages/core/src/ports/tickets/contract.ts +164 -4
  83. package/packages/core/src/ports/tickets/create.ts +35 -7
  84. package/packages/core/src/ports/tickets/github-fake.ts +18 -2
  85. package/packages/core/src/ports/tickets/github.ts +247 -29
  86. package/packages/core/src/ports/tickets/hosted-index.ts +1 -0
  87. package/packages/core/src/ports/tickets/operations.ts +6 -1
  88. package/packages/core/src/ports/tickets/tree.ts +12 -2
  89. package/packages/core/src/ports/tickets/update.ts +6 -2
  90. package/packages/core/src/ports/types.ts +37 -3
  91. package/packages/core/src/ports/workspace/commit-preservation.ts +28 -12
  92. package/packages/core/src/ports/workspace/git-worktree.ts +3 -1
  93. package/packages/core/src/ports/workspace/harvest-execution.ts +4 -2
  94. package/packages/core/src/ports/workspace/vercel-sandbox.ts +12 -0
  95. package/packages/core/src/processes/build-child.ts +28 -7
  96. package/packages/core/src/processes/build-execution-state.ts +4 -1
  97. package/packages/core/src/processes/build-runner.ts +17 -2
  98. package/packages/core/src/processes/dispatcher.ts +329 -59
  99. package/packages/core/src/processes/execution-no-progress.ts +2 -0
  100. package/packages/core/src/processes/harvest-child.ts +8 -2
  101. package/packages/core/src/processes/harvest-execution-state.ts +104 -0
  102. package/packages/core/src/processes/harvest-runner.ts +251 -17
  103. package/packages/core/src/processes/repo-view.ts +2 -0
  104. package/packages/core/src/scenarios/harness.ts +160 -36
  105. package/packages/core/src/store/reduced-reads.ts +10 -0
  106. package/packages/core/src/store/reducer-value-shapes.json +3339 -2898
  107. package/packages/core/src/store/remote/client.ts +21 -8
  108. package/packages/core/src/store/remote/index.ts +4 -0
  109. package/packages/core/src/store/remote/protocol.ts +7 -0
  110. package/packages/core/src/store/remote/released-clients.json +22 -0
  111. package/packages/core/src/store/remote/released-reducer-values/1.6.0.json +27173 -0
  112. package/packages/core/src/store/remote/released-reducer-values/1.7.0.json +27366 -0
  113. package/packages/core/src/store/remote/released-reducer-values/index.ts +4 -0
  114. package/packages/core/src/store/repo-state-events.ts +1 -0
  115. package/packages/core/src/store/types.ts +11 -0
  116. package/packages/core/src/testing/dispatch-read-budget.ts +84 -58
  117. package/packages/core/src/testing/index.ts +2 -0
  118. package/packages/core/src/testing/reduced-read-budget.ts +411 -11
  119. package/skills/guide/SKILL.md +166 -35
  120. package/skills/guide/references/operator-api.md +33 -10
  121. package/skills/guide/references/plugin-authoring.md +48 -6
  122. package/skills/guide/references/remote-store-protocol.md +33 -10
  123. package/skills/guide/references/restacking.md +16 -7
  124. package/skills/operate/SKILL.md +79 -14
  125. package/skills/tickets/SKILL.md +22 -4
  126. package/templates/hosted-service/package.json +2 -2
package/README.md CHANGED
@@ -26,7 +26,7 @@ From the repository you want built, install Autobuild as a development dependenc
26
26
  <!-- release-install:start -->
27
27
 
28
28
  ```sh
29
- bun add -d --exact @defrex/autobuild@1.5.0
29
+ bun add -d --exact @defrex/autobuild@1.7.0
30
30
  ```
31
31
 
32
32
  <!-- release-install:end -->
package/SPEC.md CHANGED
@@ -449,7 +449,7 @@ files, including development configs, remain exactly as installed.
449
449
  - **dispatcher** — watches the TicketSource for tickets passing the configured
450
450
  ready gate, claims, establishes the final conforming spec, chooses a short
451
451
  immutable build slug, provisions a workspace, and launches build-runners up
452
- to capacity. On process startup it attempts every current build for its
452
+ to capacity, which counts builds running work (§12). On process startup it attempts every current build for its
453
453
  repo, so re-running `ab dispatch` resumes durable work rather than only
454
454
  looking for new tickets. Every ordinary tick also completes queued dispatch
455
455
  records whose pre-run sequence was interrupted: it reconstructs a missing
@@ -463,11 +463,14 @@ files, including development configs, remain exactly as installed.
463
463
  outstanding recoverable harvest runs takes priority over starting new scans
464
464
  (§12). Cron-friendly.
465
465
  Before claiming, the dispatcher journals a repository-scoped preparation intent;
466
- a won claim and the exact selected creation slug are durable boundaries. Caught
466
+ a won claim, the selected creation slug and, when the build store attests keyed
467
+ creation, the attempt's creation key are durable boundaries. Caught
467
468
  asset-copy, spec-authoring, naming, and build-creation failures return the ticket
468
469
  to configured Ready; a nonconforming spec goes to configured Triage. Recovery
469
- checks the exact selected build first: a matching record and atomic
470
- `build.created` retain ownership even if creation threw after committing.
470
+ point-reads the selected slug and, for a keyed attempt, the canonical slug derived
471
+ from the repository, selected slug and key: one matching record and atomic
472
+ `build.created` retain ownership even if creation threw after committing or its
473
+ response was lost.
471
474
  Unavailable or conflicting readback never authorizes release or a replacement
472
475
  build. Pending attempts retain the original failure, latest recovery error and
473
476
  retry deadline in the canonical repository reduced value; resolved attempts
@@ -475,8 +478,10 @@ files, including development configs, remain exactly as installed.
475
478
  due recovery attempts, before intake and independently of capacity or intake
476
479
  settings, with a 30-second durable retry delay after recovery failure. Unresolved
477
480
  ticket identities remain withheld. An uncertain claim outcome or unrelated
478
- external ticket state, missing ticket/state, or conflicting slug ownership terminates
479
- automatic recovery with an `abandoned` resolution and diagnostic reason. The
481
+ external ticket state, missing ticket/state, conflicting slug ownership, builds at
482
+ both identities, or an unknown creation outcome (an unkeyed attempt on a store
483
+ that allocates slugs, where absence is not evidence) terminates automatic
484
+ recovery with an `abandoned` resolution and diagnostic reason. The
480
485
  ticket is left unchanged; an operator can leave it finished or cancelled, or
481
486
  inspect ownership and explicitly return it to Ready for another attempt. These
482
487
  cases stop provider polling and further durable diagnostic appends. The tick
@@ -484,6 +489,10 @@ files, including development configs, remain exactly as installed.
484
489
  ticket and attempt, whether the claim was confirmed or its provider outcome is
485
490
  unknown, and the recorded reason. If that tick fails for any reason, its
486
491
  failure error carries the diagnostics instead. Later ticks do not repeat it.
492
+ The `abandoned` resolution event records whether the claim was confirmed, and
493
+ default `ab watch` repository attention reports the same line once as it
494
+ lands, whether or not its tick failed; a fresh watch does not replay
495
+ historical abandonments.
487
496
  Recovery failures are
488
497
  reported without preventing janitor, lease sweep, or other dispatch recovery.
489
498
  This is not general process
@@ -1509,6 +1518,12 @@ checks actual build/session/stream ownership and filters collections server-side
1509
1518
  Explicit project mismatch is 403; missing and foreign indirect IDs share 404.
1510
1519
  Remote project build creation allocates a fresh slug and a branch in the build
1511
1520
  kind's namespace (`ab/` or `ab-node/`); the returned record is authoritative. Local adapters retain exact-slug behavior.
1521
+ A request carrying a creation key instead lands at most once at the slug derived
1522
+ from the repository, requested slug and key, so a client that lost the response
1523
+ can point-read it; a repeated key is a conflict. The service advertises this with
1524
+ the `build-creation-key-v1` health capability. A client treats a service without
1525
+ it as allocating: an unkeyed attempt whose creation outcome is unknown there ends
1526
+ recovery rather than handing the ticket back.
1512
1527
 
1513
1528
  Owners issue/list/revoke credentials with deployment-local `ab-hosted-store
1514
1529
  credentials` commands. Retired deployment-wide and repository-less operator
@@ -2180,6 +2195,45 @@ deterministic fail-safe.
2180
2195
  tuple is recorded on `session.started`; fallback starts cite the preceding target and
2181
2196
  verbatim error, while exhausted `phase.failed`/`harvest.failed` facts carry
2182
2197
  the complete ordered attempt list.
2198
+ - **Role profiles (§16.1):** `[roles]` is the repository's default for every
2199
+ build. A repository may also declare named `[profiles.<name>]` tables, each
2200
+ with exactly one ticket `label` and any number of
2201
+ `[profiles.<name>.roles.<role>]` entries for any role name, including
2202
+ verify and finalize step names and roles `[roles]` does not declare. An
2203
+ entry accepts the `[roles.<role>]` fields. For a build with that profile,
2204
+ an entry's declared fields overlay `[roles.<role>]`, and every omitted field
2205
+ takes the value the repository roles would give it: `[roles.<role>]`, then
2206
+ `[roles.default]`. A declared `alternates` list, including `[]`, replaces the
2207
+ inherited list; an omitted one inherits it, and each alternate overlays the
2208
+ profile-adjusted primary. Key selection walks the step or phase name, then
2209
+ any deprecated alias, against profile entries and `[roles]` together, so a
2210
+ profile entry on a key wins where a `[roles]` entry on that key would. A
2211
+ profile entry named `default` is refused; so are duplicate labels (trimmed,
2212
+ case-insensitive), a missing or blank label, and an entry whose effective
2213
+ runtime, model, args or account would be refused for a `[roles]` entry. The
2214
+ eager resolver validates every profile with the roles, so dispatch startup,
2215
+ `ab init --validate` and a live reload refuse the same problems.
2216
+
2217
+ The profile is **fixed when the dispatcher claims the ticket**: the label
2218
+ match runs over the labels the ready listing already returned, and the
2219
+ selected name is recorded on `build.created.profile`. Later relabelling
2220
+ never changes it. A node and each child select from their own ticket's
2221
+ labels. A ready ticket carrying two profiles' labels is not claimed; the
2222
+ scan reports it in the persisted ticket diagnostics until at most one
2223
+ profile label remains. A ticket never supplies a model, runtime or argument
2224
+ itself.
2225
+
2226
+ The profile's **contents** are read from the current configuration at each
2227
+ session boundary, like `[roles]`, so an edit reaches the in-flight builds that
2228
+ selected the profile at their next session and no other build. Every agent
2229
+ session of the build resolves through it — plan, plan review, implement,
2230
+ code review, agent verify and finalize steps, and reconcile — and
2231
+ `session.started.profile` records `{ name, configured }`. When a reload
2232
+ removes the profile, later sessions use the repository roles with
2233
+ `configured: false`, and `ab build status` says the recorded profile is no
2234
+ longer configured. A resumed session keeps its recorded target as before.
2235
+ Sessions outside a build (`slug`, `upgrade`, `harvest`, `harvest-review`)
2236
+ never use a profile.
2183
2237
  - **Transcripts come back through the interface**, not scraped from disk, so
2184
2238
  every adapter must produce one whenever its owning runner reaches the session
2185
2239
  end boundary, including turns rejected by a provider after a handle exists.
@@ -2308,10 +2362,13 @@ loops to the configured default. The value is attached only to the matching
2308
2362
  review-limit answer, so unrelated blockers answered in the same command do not
2309
2363
  acquire it and build-phase agents cannot widen their own build's loop.
2310
2364
 
2311
- Every open escalation remains an external judgment gate until an operator answers
2312
- it. The answer may come from the operator agent or a human; build-phase agents
2313
- cannot answer their own escalations. This includes all policy and setup causes;
2314
- human authorization requirements still apply. Starting either `ab dispatch` or
2365
+ Every open phase and policy escalation remains an external judgment gate until an
2366
+ operator answers it. The answer may come from the operator agent or a human;
2367
+ build-phase agents cannot answer their own escalations. This includes all policy
2368
+ and setup causes; human authorization requirements still apply. A janitor
2369
+ escalation (Forge failure recovery) is the exception: ordinary janitor retries
2370
+ continue across startup, a successful attempt closes it without an answer, and a
2371
+ bare retry only brings the next attempt forward. Starting either `ab dispatch` or
2315
2372
  `ab dispatch --once` never appends `escalation.answered` and never re-arms a
2316
2373
  budget. Startup still recovers every actionable current build and delivers
2317
2374
  pending operator commands, whose decisions take precedence over a blocked wait;
@@ -2370,6 +2427,20 @@ creation holds, capacity, intake off and repository pause — so a blocked urgen
2370
2427
  ticket never holds back normal work. Priority never preempts: an urgent ticket
2371
2428
  does not stop, pause or displace a running build.
2372
2429
 
2430
+ **What holds a slot.** `capacity` counts builds running work. A work build that
2431
+ has finished its pipeline (every verify step and every finalize post-step for
2432
+ the current spec) holds no slot while it waits for a merge decision, for merge
2433
+ gates or the forge, or on hold, and the slot goes to the next ready ticket. The
2434
+ dispatcher records the finish as an advisory `pipeline.settled` fact when the
2435
+ engine first decides `wait awaiting-pr`. A build that has not finished keeps its
2436
+ slot, even while paused, blocked or interrupted between `finalize.completed`
2437
+ and its post-steps. When a finished build must restack, re-verify or reconcile,
2438
+ it is admitted before new ticket claims, as a node is: intake reserves a slot
2439
+ for it, and its wait records nothing, consumes no attempt and raises no
2440
+ attention. Abort and pause acknowledgements are not gated. A finished build
2441
+ keeps its workspace until it merges or closes, so retained workspaces can
2442
+ exceed `capacity`; running work cannot.
2443
+
2373
2444
  Additional scheduled ingesters such as `ingest:sentry` remain an open design
2374
2445
  thread and have no shipped config surface. Observation harvest is
2375
2446
  pressure-driven: on the existing one-pass scan of repository build streams, the
@@ -2455,7 +2526,17 @@ event-level mechanics live in the repository catalog and reducer tests):
2455
2526
  has no release and its provider reports it running (or cannot answer),
2456
2527
  dispatch launches no harvest and never judges its open session. Only after
2457
2528
  settlement records the release does the next launch record an interrupted
2458
- session, once, and recovery proceeds.
2529
+ session, once, and recovery proceeds. The guest's authority is its durable
2530
+ `harvest.execution.authorized`, not the launching invocation's repository
2531
+ lease: it never claims, renews or releases that lease, so `--once`
2532
+ teardown and a successor's acquisition neither fence it nor are blocked by
2533
+ it. At durable boundaries, at most once per heartbeat interval, it re-reads
2534
+ one constant-size served value of the current authorization and exits
2535
+ `held` once its execution was released or a later execution was
2536
+ authorized. It fails closed: an unreadable or unsupported value stops it,
2537
+ and transient read failures are tolerated for at most one lease TTL.
2538
+ Before exiting it closes any open session bracket with its transcript, so
2539
+ runner loss is judged only for real interruptions.
2459
2540
  - **The harvester only proposes.** It never claims, grooms, or dispatches a
2460
2541
  proposal, and it files every one into the same configured state rather than
2461
2542
  ranking them. Humans own Triage → Ready by default. A repository that points
@@ -2619,6 +2700,27 @@ create` and `update` take `--priority urgent|normal`; operator and MCP ticket
2619
2700
  requests take `priority`; JSON ticket output always names it. Harvest files
2620
2701
  every proposal normal; grooming marks one urgent.
2621
2702
 
2703
+ **Ticket assignees.** A ticket may carry the usernames it is assigned to.
2704
+ Sources declare support with the `assignees` capability; only the GitHub source
2705
+ does, reading each issue's assignees (set on GitHub or through Autobuild alike)
2706
+ as an `assignees` array that is empty when unassigned and outside the ticket's
2707
+ revision. A write names assignees as usernames or `me`, the owner of the
2708
+ source's credential; create sets them and update replaces the whole set, an
2709
+ empty set clearing it. The source checks every user can be assigned before
2710
+ anything is written, and a write the provider accepts without the requested
2711
+ assignees fails rather than reporting success; a retried keyed create that
2712
+ adopts the existing ticket assigns it. `[tickets].createAssignee` names a
2713
+ default for every ticket Autobuild creates (`ab ticket create`, operator
2714
+ `tickets.create` and harvest proposals) that names no assignees of its own; the
2715
+ caller applies it, so a harvest proposal filed under `"me"` belongs to the
2716
+ owner of the filing dispatcher's credential, resolved at dispatcher startup and
2717
+ never during a tick. File, hosted, Linear and plugin sources without the
2718
+ capability refuse any write naming assignees, including an empty set, and a
2719
+ configured `createAssignee`, with an error naming the source, before anything
2720
+ is written; their tickets carry no `assignees` field. `ab ticket create` and
2721
+ `update` take `--assignees a,b`; operator and MCP ticket requests take
2722
+ `assignees`.
2723
+
2622
2724
  A build freezes its ticket's links into `build.created` when it claims the
2623
2725
  ticket, from the same sample as the body. Later ticket edits and spec revisions
2624
2726
  never change them. An agent in the build may downgrade one linked `closes`
@@ -2767,7 +2869,8 @@ node occupancy before the runner starts. This exception never raises the budget
2767
2869
  for new claims. Status and both dashboards report actual occupancy, configured
2768
2870
  capacity, effective display capacity and the nodes using descendant-held slots.
2769
2871
  Status, `ab builds` and both dashboards report each node waiting for a slot
2770
- ahead of new ticket claims. Idle collecting nodes remain free.
2872
+ ahead of new ticket claims, and report a finished work build waiting to run
2873
+ again the same way. Idle collecting nodes remain free.
2771
2874
 
2772
2875
  An empty node has no PR and reports `integration`, `target`, and `empty`.
2773
2876
  Once it holds commits its current parent lacks, the dispatcher opens or adopts
@@ -3153,6 +3256,25 @@ stands in for tick completion. Telemetry survives lease release. Safe shutdown
3153
3256
  uses the matching run's open observation, historical journal boundaries when
3154
3257
  absent, and refuses forced termination when the observation cannot be read.
3155
3258
 
3259
+ The repository dispatch lease lasts `policy.dispatchLeaseTimeoutSeconds`
3260
+ without renewal (60 by default) and is renewed every
3261
+ `policy.dispatchLeaseRenewalSeconds` (20 by default; it must be less than the
3262
+ timeout). A claim stores the timeout with the lease, so a reloaded pair is
3263
+ adopted at the next tick through a same-holder claim. Claims and adoption are
3264
+ serialized, and a renewal answered under an earlier pair is discarded, so the
3265
+ holder's local deadline never outlasts the stored expiry. A holder whose own
3266
+ lease lapsed — a host stall longer than the timeout, or renewals lost to a store
3267
+ outage — starts no ticket claim, launch, execution start, provisioning, forge
3268
+ write, `git push` or status publication, including from a continuation that
3269
+ resumes mid-operation; those effects are fenced where they are called. It then
3270
+ reads the repository record: when the record still names it, expired or not, it
3271
+ claims the lease again and carries on; when the record names another run, or
3272
+ there is no record (only a holder's release clears it), it stops as
3273
+ `superseded`. An expired lease of its own is never treated as a takeover, and it
3274
+ never records a `tick-yielded` naming itself. A store error is retried at the
3275
+ next renewal or tick. An effect already in flight when the stall began
3276
+ completes; cancelling it could tear external state.
3277
+
3156
3278
  Both dashboards show each accepted unfinished generation handoff, naming its source
3157
3279
  and target runtimes (version and abbreviated commit), mode and drain deadline
3158
3280
  (`unknown` for missing historical facts). A drain-mode outstanding execution
@@ -3648,7 +3770,9 @@ non-destructive execution fence for the exact workspace and execution generation
3648
3770
  It preserves unpublished branch commits and distinct detached producer candidates
3649
3771
  under immutable `refs/autobuild/archive/<build>/<sha>` refs, verifies their exact
3650
3772
  readback, and records `workspace.commits-preserved` before cleanup. Replacement
3651
- provisioning restores those exact refs before starting an agent. A preserved
3773
+ provisioning restores those exact refs before starting an agent, reading them
3774
+ from the local repository with the local-git forge and fetching each exact ref
3775
+ from the remote otherwise. A preserved
3652
3776
  branch head that the build's latest 64 replaced heads cover, as the replaced
3653
3777
  head itself or one of its ancestors, is kept only as archived objects: it is
3654
3778
  never preserved or restored as the branch, and provisioning records the skip as
@@ -3775,6 +3899,11 @@ and `verify.config-superseded` (§16.1). These facts do not change reconcile
3775
3899
  identity or its policy snapshot; replay gates still refer to the code/reconcile
3776
3900
  boundary. Superseded receipts remain historical evidence.
3777
3901
 
3902
+ `pipeline.settled { cycle }` is advisory capacity evidence. The dispatcher
3903
+ appends it once per settlement key (the later of the current verify cycle start
3904
+ and the latest `finalize.completed`) when the engine decides `wait awaiting-pr`;
3905
+ no pipeline decision reads it (§12).
3906
+
3778
3907
  ### 15.7 Post-PR lifecycle [D1 — confirmed]
3779
3908
 
3780
3909
  Walking the happy path exposed a gap in the grammar: `finalize` creates the
@@ -4158,7 +4287,7 @@ and default-attribution fields remain replay-compatible but are not new controls
4158
4287
 
4159
4288
  ```toml
4160
4289
  baseBranch = "main"
4161
- capacity = 3 # concurrent builds for this repo
4290
+ capacity = 3 # builds running work at once; builds parked for a merge decision hold no slot
4162
4291
  ticketScanIntervalSeconds = 60 # positive integer; ready scans, with tick spacing as floor
4163
4292
  forge = "github" # builtin: github | local-git; or a plugin name
4164
4293
  plugins = ["./plugins/local.ts", "@acme/autobuild-plugin"]
@@ -4216,8 +4345,15 @@ runtime = "pi"
4216
4345
  model = "moonshotai/kimi-k3"
4217
4346
  sessionBudgetSeconds = 7200 # optional role override
4218
4347
 
4348
+ [profiles.deep] # selected by a ticket labelled "deep" (§9)
4349
+ label = "deep"
4350
+ [profiles.deep.roles.implement] # overrides only the fields it names
4351
+ args = ["--effort", "high"]
4352
+
4219
4353
  [policy]
4220
4354
  upgradeDrainSeconds = 900 # local generation drain deadline, hot-reloaded
4355
+ dispatchLeaseTimeoutSeconds = 60 # repository dispatch lease lifetime without renewal
4356
+ dispatchLeaseRenewalSeconds = 20 # renewal interval; less than the timeout
4221
4357
  sessionBudgetSeconds = 3600 # non-infinite default for build agent sessions
4222
4358
  stallRounds = 3
4223
4359
  maxVerifyAttempts = 3
@@ -4271,7 +4407,7 @@ decide where a build's effective configuration is composed from:
4271
4407
  | Class | Sections | Source at deposit |
4272
4408
  |---|---|---|
4273
4409
  | Build-owned (pinned) | `[verify]` and `[verify.<step>]`, `[finalize]` and `[finalize.<step>]`, `[commands]`, `[workspace]` (provider and config, including `provisioning` and `runtimeProvisioning`) | The execution checkout at each verification cycle; launch deposits use the branch head or recorded workspace base until a cycle capture exists. The exact commit is recorded once per deposit in the effective-config artifact metadata — except in checkout mode when the worktree read cannot be attributed to the branch-head commit: because the worktree file has uncommitted edits, because the clean/dirty comparison could not be performed (non-git workspace or a transient git error), or because the branch head never carried the file. The deposit then records the source `worktree-dirty` and no commit, because no commit claims the worktree bytes (the build still runs them). |
4274
- | Deployment-owned (live) | `[roles]` (runtime, model, args, alternates, per-role `sessionBudgetSeconds`) and `[policy]` (budgets, retry bounds, stall and harvest knobs) | The dispatcher's live snapshot; an accepted reload delivers these to active builds. |
4410
+ | Deployment-owned (live) | `[roles]` (runtime, model, args, alternates, per-role `sessionBudgetSeconds`), `[profiles]` (label-selected role overlays) and `[policy]` (budgets, retry bounds, stall and harvest knobs) | The dispatcher's live snapshot; an accepted reload delivers these to active builds. |
4275
4411
  | Dispatcher-owned | `baseBranch`, `capacity`, `ticketScanIntervalSeconds`, `forge`, `plugins`, `pr`, `tickets`, `orchestrator`, `merge`, `upgrade` | The dispatcher's live snapshot; the build runner never interprets them. |
4276
4412
 
4277
4413
  Dispatcher lease sweeps may reuse parsed effective-config pins in a disposable
@@ -4591,7 +4727,8 @@ reapply the intended changes before retrying; conflicts are never merged.
4591
4727
  File and Linear revisions fingerprint kind, target, title, body, canonical label/blocker sets,
4592
4728
  state and urgent priority; file revisions also cover nonempty issue links. GitHub revisions
4593
4729
  fingerprint kind, target, title, body, canonical label/blocker sets, state and issue links,
4594
- including the ticket's own issue; GitHub tickets carry no comments. Reverting
4730
+ including the ticket's own issue; GitHub tickets carry no comments, and assignees
4731
+ are not part of a GitHub revision. Reverting
4595
4732
  identical content restores its fingerprint. File checks
4596
4733
  re-read immediately before writing, with the existing no-lock race window.
4597
4734
  Direct file edits and state-directory moves change revisions. File revisions also
@@ -4719,7 +4856,7 @@ by the shared projection vocabulary and reused by terminal and CLI text.
4719
4856
 
4720
4857
  Destination heads come only from the authoritative forge branch; dispatcher-host
4721
4858
  refs are never a fallback. Failed remote reads retain the accepted observation;
4722
- classified rate limits use repository forge degradation and cooldown. Changed
4859
+ dispatcher-classified rate limits use repository forge degradation and cooldown. Changed
4723
4860
  heads require immutable commit ancestry proof against the accepted target and
4724
4861
  the destination base already used by replay. Missing capability or failed proof
4725
4862
  defers new replay. A non-descendant without kernel lineage records
@@ -4771,7 +4908,7 @@ not consume `maxPhaseAttempts`. A seventh transient failure records
4771
4908
  error and six retries. Answering that escalation opens a fresh publication episode
4772
4909
  for the same retained intent without resetting agent phase failures. Pending
4773
4910
  publication keeps its workspace through backoff and unresolved exhaustion.
4774
- Classified rate limits retain repository cooldown and consume no publication
4911
+ Dispatcher-classified rate limits retain repository cooldown and consume no publication
4775
4912
  retry allowance. Rejected pushes, lease conflicts, dirty trees and unclassified
4776
4913
  errors retain their existing behavior.
4777
4914
 
@@ -4789,18 +4926,30 @@ their existing handling.
4789
4926
  Janitor failures are durable per-build episodes. Eligible failures retry after
4790
4927
  30, 60, 120, 240 seconds, then at the configured cap (300 seconds by default).
4791
4928
  A classified forge rate limit is repository cooldown, not a janitor failure:
4792
- neither the first limited response nor the cooldown that follows starts or ages
4793
- an episode. Skipped polls preserve the episode across restart. After
4794
- `policy.janitorFailureAttentionSeconds` (600 by default), `build.janitor-failing`
4795
- notifies default watchers and appears on the build row. A successful attempt
4796
- clears it. `policy.janitorBackoffMaxSeconds` sets the positive integer cap.
4929
+ neither the first limited response nor the cooldown that follows starts an
4930
+ episode or records an attempt, so a build that only waits out cooldown never
4931
+ escalates. Skipped polls preserve the episode across restart. Both thresholds
4932
+ below are wall-clock from the episode's first failed attempt and are checked
4933
+ when an attempt fails, so cooldown inside an episode that already started still
4934
+ counts. After `policy.janitorFailureAttentionSeconds` (600 by default),
4935
+ `build.janitor-failing` notifies default watchers and appears on the build row.
4936
+ After `policy.janitorFailureEscalationSeconds` (3600 by default), the build
4937
+ raises one escalation through `build.janitor-escalated`, naming the failing
4938
+ operation, the last error, the failed attempt count and when the episode
4939
+ started. The build is then blocked and shows wherever open escalations show.
4940
+ The janitor keeps retrying on its backoff underneath; a successful attempt
4941
+ clears the attention, closes the escalation unanswered and the build continues.
4942
+ Answering it with a bare retry makes the janitor attempt on its next tick. An
4943
+ episode raises at most one escalation; a new episode after recovery can raise
4944
+ another. `policy.janitorBackoffMaxSeconds` sets the positive integer cap.
4797
4945
  A dispatcher that cannot execute Git for kernel node work (a missing or
4798
4946
  unloadable `git` for the bare clone) records no janitor failures. It records
4799
4947
  one durable `dispatcher.kernel-git-unavailable` repository condition, node work
4800
4948
  waits, and `dispatcher.kernel-git-recovered` closes the condition once a clone
4801
4949
  succeeds.
4802
4950
 
4803
- A classified forge rate limit records repository degradation with `resetAt`.
4951
+ A rate limit the dispatcher classifies on its own authenticated request
4952
+ records repository degradation with `resetAt`.
4804
4953
  Forge work waits during cooldown; passing the deadline permits a recovery
4805
4954
  request; a successful probe records automatic recovery. An authorized operator
4806
4955
  may explicitly override erroneous recorded state with
@@ -4811,6 +4960,25 @@ success. A subsequent actual limit records a fresh cooldown. Hosted admission
4811
4960
  requires a schema-valid finite ISO `resetAt` no later than server time plus
4812
4961
  24 hours, inclusive; past deadlines remain valid. Rejection never clamps or
4813
4962
  invents a provider reset, and historical events remain readable.
4963
+
4964
+ Only the dispatcher's own forge pauses the repository. A limit on a request
4965
+ that carried no credential, or one seen by a build runner or phase session,
4966
+ says nothing about the dispatcher's credential: that process waits out its own
4967
+ reset locally (a dispatcher defers that work instead), and records one advisory
4968
+ `forge.credential-limited` fact per episode naming the process, whether the
4969
+ request was `unauthenticated` (with why) or used the process's own credential,
4970
+ and the reset. It is `ab watch` attention and appears as
4971
+ `forgeCredentialLimits` in `ab repository status` until its reset;
4972
+ `forge-clear` does not apply. Remote guests receive no forge credential: their
4973
+ GitHub API requests fail with a typed error naming `GITHUB_TOKEN or GH_TOKEN`
4974
+ instead of going out anonymously, and they prove ancestry through their
4975
+ workspace's Git. An unauthenticated limit therefore points at a process missing
4976
+ `GITHUB_TOKEN`/`GH_TOKEN` or a `gh` login, or at guest-side forge use that must
4977
+ run kernel-side. Runners and sessions still wait out a dispatcher-recorded
4978
+ cooldown, but a limit they hit on a shared token no longer pauses the
4979
+ dispatcher in advance; the dispatcher records it on its own next limited
4980
+ request.
4981
+
4814
4982
  Native merge application failures keep candidate-specific retry eligibility,
4815
4983
  including automatic decisions without a human command. Retries recheck consent,
4816
4984
  holds, verification and the exact candidate. Uncertain enables remain pending
@@ -128,7 +128,7 @@ alternates = [{ runtime = "codex", model = "gpt-6.1-sol" }]
128
128
  <!-- seam-config:end -->
129
129
 
130
130
  - **Verifier roles** use the step name (`roles.acceptance`), not the skill name; author the `verify-acceptance` skill first. Check steps run commands and need no model.
131
- - **Inheritance.** Each role inherits omitted fields from `roles.default` field by field; an explicit `args` list replaces the inherited one.
131
+ - **Inheritance.** Each role inherits omitted fields from `roles.default` field by field; an explicit `args` list replaces the inherited one. A ticket label can select a [role profile](configuration-overview.md#roles-models-and-limits) that overrides named fields for that build only.
132
132
  - **Alternates** are ordered availability routes, not extra reviewers. Availability or exhaustion failures, or a missing executable, select the next route; credential and configuration failures need repair. A fallback may cost provider independence, so check which runtime ran.
133
133
 
134
134
  ## Writing your own
@@ -36,10 +36,13 @@ normal action. The selected build's full detail names the CLI-only dismissal
36
36
  and revision commands; it does not provide a spec editor.
37
37
 
38
38
  Restarting `ab dispatch` or running `ab dispatch --once` is not an answer or a
39
- retry action. Every open escalation, including every policy and setup cause,
40
- survives dispatcher startup until your operator agent, within your instructions
41
- and authority, or you answer through one of the paths above. Startup
42
- still recovers unblocked work and acknowledges pending operator commands.
39
+ retry action. Every open phase and policy escalation, including every setup
40
+ cause, survives dispatcher startup until your operator agent, within your
41
+ instructions and authority, or you answer through one of the paths above. A
42
+ janitor escalation is the exception: its ordinary retries continue across
43
+ startup, a successful attempt closes it unanswered, and a bare retry only brings
44
+ the next attempt forward. Startup still recovers unblocked work and acknowledges
45
+ pending operator commands.
43
46
 
44
47
  ## Widening an exhausted review loop
45
48