@defrex/autobuild 1.6.0 → 1.8.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 (165) hide show
  1. package/README.md +1 -1
  2. package/SPEC.md +423 -57
  3. package/docs/agent-runtimes.md +1 -1
  4. package/docs/answering-blocked-builds.md +44 -3
  5. package/docs/architecture.md +124 -29
  6. package/docs/cli.md +1 -0
  7. package/docs/configuration-overview.md +11 -1
  8. package/docs/configuration.md +334 -14
  9. package/docs/dispatcher.md +1 -1
  10. package/docs/forges.md +1 -0
  11. package/docs/integration-overview.md +2 -2
  12. package/docs/integration-tree.md +7 -4
  13. package/docs/merge-policy.md +78 -6
  14. package/docs/migration-1.0.md +4 -2
  15. package/docs/operating.md +3 -2
  16. package/docs/operator-api.md +45 -13
  17. package/docs/operator-surfaces.md +16 -3
  18. package/docs/plugin-authoring.md +45 -7
  19. package/docs/remote-store-protocol.md +28 -7
  20. package/docs/restacking.md +35 -11
  21. package/docs/ticket-dependencies.md +9 -4
  22. package/docs/ticket-sources.md +34 -6
  23. package/docs/tickets.md +7 -1
  24. package/docs/troubleshooting.md +1 -1
  25. package/docs/workspaces.md +1 -1
  26. package/package.json +3 -3
  27. package/packages/core/src/cli/attention.ts +2 -0
  28. package/packages/core/src/cli/binary-direct.ts +1 -0
  29. package/packages/core/src/cli/build-control.ts +65 -7
  30. package/packages/core/src/cli/context.ts +55 -14
  31. package/packages/core/src/cli/dashboard/actions.ts +13 -4
  32. package/packages/core/src/cli/dashboard/landing-display.ts +32 -8
  33. package/packages/core/src/cli/dashboard/model.ts +61 -8
  34. package/packages/core/src/cli/dashboard/render.ts +28 -3
  35. package/packages/core/src/cli/dashboard/tree.ts +9 -1
  36. package/packages/core/src/cli/dispatch-frontend.ts +10 -14
  37. package/packages/core/src/cli/dispatch-preflight.ts +1 -0
  38. package/packages/core/src/cli/dispatch-repository-feed.ts +145 -109
  39. package/packages/core/src/cli/dispatch.ts +9 -3
  40. package/packages/core/src/cli/help.ts +80 -11
  41. package/packages/core/src/cli/init-validation.ts +14 -1
  42. package/packages/core/src/cli/landings.ts +1 -1
  43. package/packages/core/src/cli/main.ts +60 -9
  44. package/packages/core/src/cli/publication-settlement.ts +10 -0
  45. package/packages/core/src/cli/repository-status.ts +37 -2
  46. package/packages/core/src/cli/status.ts +186 -12
  47. package/packages/core/src/cli/terminals.ts +197 -4
  48. package/packages/core/src/cli/ticket.ts +22 -4
  49. package/packages/core/src/cli/wait.ts +1 -0
  50. package/packages/core/src/cli/watch.ts +73 -0
  51. package/packages/core/src/config/landing.ts +12 -0
  52. package/packages/core/src/config/live.ts +4 -0
  53. package/packages/core/src/config/path-selectors.ts +68 -0
  54. package/packages/core/src/config/profiles.ts +96 -0
  55. package/packages/core/src/config/ready-assignee.ts +43 -11
  56. package/packages/core/src/config/roles.ts +33 -10
  57. package/packages/core/src/config/schema.ts +205 -81
  58. package/packages/core/src/events/catalog.ts +17 -3
  59. package/packages/core/src/events/compatibility.ts +4 -1
  60. package/packages/core/src/events/forge-degradation-policy.ts +16 -2
  61. package/packages/core/src/events/head-paths-limits.ts +25 -0
  62. package/packages/core/src/events/payloads.ts +323 -20
  63. package/packages/core/src/events/policy.ts +22 -0
  64. package/packages/core/src/events/repository.ts +47 -1
  65. package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +320 -130
  66. package/packages/core/src/kernel/build-creation.ts +29 -0
  67. package/packages/core/src/kernel/consent-revocation.ts +72 -0
  68. package/packages/core/src/kernel/dispatch-capacity.ts +19 -8
  69. package/packages/core/src/kernel/engine.ts +48 -8
  70. package/packages/core/src/kernel/forge-health.ts +47 -0
  71. package/packages/core/src/kernel/guarded-forge.ts +76 -18
  72. package/packages/core/src/kernel/head-paths-state.ts +63 -0
  73. package/packages/core/src/kernel/head-paths.ts +401 -0
  74. package/packages/core/src/kernel/landing-policy-identity.ts +20 -0
  75. package/packages/core/src/kernel/landing-policy.ts +55 -2
  76. package/packages/core/src/kernel/landing-readiness.ts +104 -9
  77. package/packages/core/src/kernel/landing-state.ts +44 -4
  78. package/packages/core/src/kernel/leaf-restack-state.ts +50 -2
  79. package/packages/core/src/kernel/log-index.ts +27 -1
  80. package/packages/core/src/kernel/node-parent.ts +2 -0
  81. package/packages/core/src/kernel/node-polling.ts +13 -3
  82. package/packages/core/src/kernel/node-restack-state.ts +8 -1
  83. package/packages/core/src/kernel/node-restack-transaction.ts +45 -0
  84. package/packages/core/src/kernel/read-deferrals.ts +3 -1
  85. package/packages/core/src/kernel/read-facts.ts +37 -2
  86. package/packages/core/src/kernel/reducer-registry.ts +22 -1
  87. package/packages/core/src/kernel/reducer.ts +332 -16
  88. package/packages/core/src/kernel/target-observation.ts +2 -5
  89. package/packages/core/src/kernel/terminal-guard.ts +52 -3
  90. package/packages/core/src/kernel/ticket-handbacks.ts +40 -0
  91. package/packages/core/src/kernel/ticket-preparation.ts +15 -1
  92. package/packages/core/src/kernel/ticket-wait.ts +345 -0
  93. package/packages/core/src/kernel/verify-applicability.ts +9 -19
  94. package/packages/core/src/ontology.ts +1 -0
  95. package/packages/core/src/operator/annotations.ts +6 -0
  96. package/packages/core/src/operator/index.ts +3 -0
  97. package/packages/core/src/operator/protocol.ts +25 -2
  98. package/packages/core/src/operator/query.ts +1 -1
  99. package/packages/core/src/operator/registry.ts +122 -10
  100. package/packages/core/src/operator/repository-events.ts +67 -0
  101. package/packages/core/src/operator/sandbox-host.ts +3 -0
  102. package/packages/core/src/operator/tickets.ts +15 -3
  103. package/packages/core/src/plugin-sdk/index.ts +4 -0
  104. package/packages/core/src/ports/forge/create.ts +6 -0
  105. package/packages/core/src/ports/forge/github-transport.ts +40 -3
  106. package/packages/core/src/ports/forge/github.ts +12 -1
  107. package/packages/core/src/ports/forge/workspace-ancestry.ts +60 -0
  108. package/packages/core/src/ports/forge-failure.ts +31 -2
  109. package/packages/core/src/ports/runner/routing.ts +66 -5
  110. package/packages/core/src/ports/tickets/assignees.ts +54 -0
  111. package/packages/core/src/ports/tickets/contract.ts +164 -4
  112. package/packages/core/src/ports/tickets/create.ts +17 -3
  113. package/packages/core/src/ports/tickets/fake.ts +5 -0
  114. package/packages/core/src/ports/tickets/github-fake.ts +18 -2
  115. package/packages/core/src/ports/tickets/github.ts +247 -29
  116. package/packages/core/src/ports/tickets/hosted-index.ts +1 -0
  117. package/packages/core/src/ports/tickets/operations.ts +6 -1
  118. package/packages/core/src/ports/tickets/tree.ts +12 -2
  119. package/packages/core/src/ports/tickets/update.ts +6 -2
  120. package/packages/core/src/ports/types.ts +36 -5
  121. package/packages/core/src/ports/workspace/vercel-sandbox.ts +9 -0
  122. package/packages/core/src/processes/build-child.ts +28 -7
  123. package/packages/core/src/processes/build-execution-state.ts +34 -2
  124. package/packages/core/src/processes/build-runner.ts +165 -19
  125. package/packages/core/src/processes/dispatcher.ts +837 -115
  126. package/packages/core/src/processes/execution-no-progress.ts +22 -2
  127. package/packages/core/src/processes/harvest-child.ts +4 -0
  128. package/packages/core/src/processes/harvest-runner.ts +5 -0
  129. package/packages/core/src/processes/phase-failure-budget.ts +1 -0
  130. package/packages/core/src/processes/publication-state.ts +6 -1
  131. package/packages/core/src/processes/repo-view.ts +2 -0
  132. package/packages/core/src/scenarios/harness.ts +15 -1
  133. package/packages/core/src/store/digest.ts +41 -2
  134. package/packages/core/src/store/reduced-reads.ts +4 -1
  135. package/packages/core/src/store/reducer-value-shapes.json +10310 -8441
  136. package/packages/core/src/store/remote/client.ts +49 -10
  137. package/packages/core/src/store/remote/index.ts +4 -0
  138. package/packages/core/src/store/remote/protocol.ts +18 -1
  139. package/packages/core/src/store/remote/released-clients.json +22 -0
  140. package/packages/core/src/store/remote/released-reducer-values/1.7.0.json +27366 -0
  141. package/packages/core/src/store/remote/released-reducer-values/1.8.0.json +29043 -0
  142. package/packages/core/src/store/remote/released-reducer-values/index.ts +4 -0
  143. package/packages/core/src/store/repo-state-events.ts +3 -0
  144. package/packages/core/src/store/types.ts +27 -0
  145. package/packages/core/src/testing/dispatch-read-budget.ts +84 -58
  146. package/packages/core/src/testing/index.ts +2 -0
  147. package/packages/core/src/testing/reduced-read-budget.ts +419 -9
  148. package/skills/code-review/SKILL.md +8 -0
  149. package/skills/finalize/SKILL.md +4 -0
  150. package/skills/guide/SKILL.md +241 -47
  151. package/skills/guide/references/integration-tree.md +7 -4
  152. package/skills/guide/references/merge-policy.md +78 -6
  153. package/skills/guide/references/migration-1.0.md +4 -2
  154. package/skills/guide/references/operator-api.md +45 -13
  155. package/skills/guide/references/plugin-authoring.md +45 -7
  156. package/skills/guide/references/remote-store-protocol.md +28 -7
  157. package/skills/guide/references/restacking.md +35 -11
  158. package/skills/guide/references/ticket-dependencies.md +9 -4
  159. package/skills/implement/SKILL.md +15 -1
  160. package/skills/operate/SKILL.md +133 -16
  161. package/skills/plan/SKILL.md +17 -2
  162. package/skills/plan-review/SKILL.md +8 -0
  163. package/skills/reconcile/SKILL.md +21 -5
  164. package/skills/tickets/SKILL.md +23 -6
  165. package/templates/hosted-service/package.json +2 -2
@@ -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
@@ -7,13 +7,13 @@ Every action below is sessionless, records a human-authored fact, and accepts
7
7
 
8
8
  | Need | Command | Effect |
9
9
  |---|---|---|
10
- | Give the phase a decision or missing information | `ab answer <slug> <text>` | Records `guidance`. In a review loop it feeds the next producer round. |
11
- | Try again without guidance | `ab answer <slug>` | Records a bare `retry`; no prose is delivered to an agent. |
10
+ | Give the phase a decision or missing information | `ab answer <slug> <text>` | Records `guidance`. In a review loop it feeds the next producer round; a ticket wait's answer instead resumes the phase that declared it, including the same review round. |
11
+ | Try again without guidance | `ab answer <slug>` | Records a bare `retry`; no prose is delivered to an agent, except that a ticket wait's resumed phase still gets a one-line summary and its `wait` block. |
12
12
  | Widen an exhausted review loop | `ab answer <slug> [<text>] --review-round-ceiling <n>` | Answers the open `review-round-limit` escalation and replaces the configured cap with absolute ceiling `n` for that loop and spec revision only. |
13
13
  | Retire a review disagreement | `ab answer <slug> --dismiss` | Records `dismiss-finding` for each escalation that cites a real finding id. The next reviewer is told not to re-raise that chain. |
14
14
  | Replace the build contract from a file | `ab answer <slug> --revise-spec <file>` | Records the replacement as the next spec revision and restarts leaves at `plan`; nodes recollect and verify. |
15
15
  | Re-import an amended ticket | `ab answer <slug> --revise-spec-from-ticket` | Reads the build's recorded ticket and performs the same revision. |
16
- | Abandon the build | `ab abort <slug>` | Irrevocably requests abort; cleanup returns the ticket to Triage. |
16
+ | Abandon the build | `ab abort <slug> [--to ready] [--reason <text>]` | Irrevocably requests abort; cleanup returns the ticket to Triage, or with `--to ready` to Ready with its blockers kept, and then reports `ticket.handed-back`. Ready requires the current ticket to meet the spec standard; otherwise cleanup returns it to Triage, and the comment and event name the requested destination and the missing parts. |
17
17
 
18
18
  The dashboard's blocked-build `r` shortcut requests an inline answer step that
19
19
  supports guidance and a blank retry. While that step is open, it is exclusive
@@ -44,6 +44,47 @@ startup, a successful attempt closes it unanswered, and a bare retry only brings
44
44
  the next attempt forward. Startup still recovers unblocked work and acknowledges
45
45
  pending operator commands.
46
46
 
47
+ ## Ending a ticket wait
48
+
49
+ A build whose agent ran `ab wait-on` asks to wait on other tickets. Until the
50
+ dispatcher validates the request on its next tick, the build keeps its
51
+ capacity slot and `ab build status <slug>` reports the wait as requested. A
52
+ refused request writes nothing to the source ticket; the request and its
53
+ refusal stay in the build log, and the declaring phase re-runs with the
54
+ refusal as guidance.
55
+
56
+ Once accepted, the build's escalation question begins `Waiting on`,
57
+ `ab build status <slug>` shows a `waiting on:` line naming the tickets, its
58
+ ticket lists those tickets in `blockedBy`, and the build holds no capacity
59
+ slot. `ab builds` and both dashboards show it as `waiting` on those tickets
60
+ rather than as a blocked question; in `ab builds --json` its `status` stays
61
+ `blocked` and a `wait` field names the tickets. On either dashboard, `r` or
62
+ RESUME on a waiting build answers it. The dispatcher ends the wait on its
63
+ first tick after every named ticket completes; a wait with some tickets still
64
+ open stays in place. To end it early, for example when the work landed another
65
+ way, `ab answer <slug> <text>` or a bare `ab answer <slug>` ends the wait.
66
+ Either way the build takes the next free slot ahead of new ticket claims. If its target
67
+ branch has moved past the base the build's work sits on, the build first
68
+ restacks onto the target's current head so the resumed phase sees the merged blockers; a conflicting
69
+ restack shows as `reconcile` and resolves first. The phase that declared the
70
+ wait then re-runs at the same round or attempt. Its `guidance.json` carries a
71
+ `wait` block naming the tickets, the reason, and how the wait ended.
72
+
73
+ If a named ticket is rejected or deleted, the wait can never end by itself.
74
+ The dispatcher then ends it with an ordinary `wait-unresolvable` escalation
75
+ that names the ticket and why, and the build shows as blocked in the default
76
+ attention filter. Answer it with guidance to resume the declaring phase without
77
+ that ticket, revise the spec, or abort. Guidance resumes the same phase with
78
+ the same `wait` block.
79
+
80
+ A wait declared in `implement` first publishes the build's commits, so the
81
+ agent must commit or discard its changes before running `ab wait-on`; the
82
+ command refuses a dirty worktree. When a local push fails, the command
83
+ records no wait and the same session can fix the failure and run it again.
84
+ When a remote publication is lost before the wait is entered, the dispatcher refuses the
85
+ wait with cause `publication-lost` and implement re-runs with the refusal as
86
+ guidance.
87
+
47
88
  ## Widening an exhausted review loop
48
89
 
49
90
  `--review-round-ceiling` is available only while the selected build has one open
@@ -708,6 +708,30 @@ boundary in the reducer and log index, independently of reconcile identity.
708
708
  The advisory `pipeline.settled` fact records that the engine reached a leaf's
709
709
  `wait awaiting-pr`; `kernel/dispatch-capacity.ts` reads it so a finished build
710
710
  parked for its merge decision holds no slot.
711
+ Ticket waits (SPEC §11) span four seams. `cli/terminals.ts` (`waitOn`, routed
712
+ as `ab wait-on`) appends the agent's terminal `wait.requested`; the build
713
+ digest marks it pending. The dispatcher's lease-sweep pass validates a pending
714
+ request against the ticket source, adds `blockedBy`, and appends `wait.entered`
715
+ or `wait.refused`. `kernel/ticket-wait.ts` holds the reduced-state predicates
716
+ the engine, capacity, `ab context` and `ab build status` share: a pending
717
+ request decides `wait ticket-wait`, an entered wait parks the leaf without a
718
+ slot, and an ended one requests a `resume` slot. The digest's `ticketWait`
719
+ names each open wait, and the dispatcher's `releaseTicketWaits` stage, run once
720
+ per tick before the lease sweep's per-build pass, checks them all with one
721
+ batched `dependencyStates` read: all completed appends `wait.ended {cause:
722
+ automatic}`, and a rejected or deleted ticket raises `policy/wait-unresolvable`,
723
+ which the reducer reads as the wait's end (`ticketWaitRelease` decides). An implement declaration
724
+ publishes first: `waitOn` pushes locally before the fact, or deposits
725
+ `publication.requested {operation: wait}` that `cli/publication-settlement.ts`
726
+ completes with `wait.published`; `serviceWaitRequest` enters the wait only
727
+ after that. `waitResumeRestackCycle` in the same module is the engine's
728
+ wait-resume restack predicate, decided ahead of the plan and code loops against
729
+ `leafBaseInUse` (`kernel/leaf-restack-state.ts`), which target observation
730
+ shares. The runner's `restack()` replays published work through the guarded
731
+ automatic restack, fast-forwards an unpublished branch that has no commits the
732
+ target lacks and no uncommitted tracked changes (`advanceWaitResume`,
733
+ `restack.advanced`) and otherwise fails without discarding local work, and first supersedes a reconcile occurrence whose session
734
+ waited (`supersedeReconcile`, `reconcile.superseded`).
711
735
  The runner refreshes after workspace mutation and before constructing members;
712
736
  concurrent siblings settle before another stage is selected. Recovery and
713
737
  readiness compose live deployment settings onto the captured artifact revision.
@@ -1039,7 +1063,15 @@ defers destructive abort, discard, and terminal-PR cleanup while that lease is
1039
1063
  live, then resumes the event-checkpointed janitor saga that closes an unmerged PR,
1040
1064
  releases the workspace, deletes exact remote/local branch
1041
1065
  refs, unions `autobuild:aborted` into current ticket labels, returns the ticket to
1042
- Triage, and appends abandoned completion last. Forge close/delete operations are
1066
+ its destination, and appends abandoned completion last. The destination is
1067
+ `tickets.triageState` by default (and always for dashboard aborts); an abort
1068
+ requested with `--to ready` selects `tickets.readyState`, keeping `blockedBy`,
1069
+ unless the current ticket body fails the spec standard, in which case it falls
1070
+ back to triage and records the requested role and missing parts. The
1071
+ `abort.ticket-returned` checkpoint commits the move and comment, then the
1072
+ repository `ticket.handed-back` report is appended before abandoned completion;
1073
+ once that report exists the dispatcher writes nothing more to the ticket, so it
1074
+ is the safe boundary for a subsequent ticket move. Forge close/delete operations are
1043
1075
  optional API 1.2 capabilities so older plugins load but leave cleanup visibly due.
1044
1076
  AgentRunner failure causes and the exhaustion contract fixture are additive
1045
1077
  plugin API 1.3 surfaces; legacy failures without a cause retain permanent-bit
@@ -1092,7 +1124,10 @@ adapter operation, so slug naming, provisioning, runners, and Harvest cannot
1092
1124
  block input.
1093
1125
 
1094
1126
  Startup restores a validated `dispatchFrontend` checkpoint incrementally only
1095
- when its cursor is within the 1,000-event repository tail window. A missing,
1127
+ when its cursor is within the 1,000-event repository tail window. When no
1128
+ current (reducer version 5) checkpoint exists, startup reads a legacy version-4
1129
+ row once: it discards that row's dashboard-event cache, keeps its identities and
1130
+ holder, and the next save replaces the row with version 5 at the same cursor. A missing,
1096
1131
  invalid, unreadable or stale checkpoint, and cursor expiry, instead reseed from
1097
1132
  the canonical `repositoryReadFacts` value: its latest run start and the sampled
1098
1133
  holder's start become the retained identities, and its cursor starts one
@@ -1106,13 +1141,17 @@ selection, including concurrent appends; cursor expiry permits one additional
1106
1141
  canonical reseed, never historical gap replay. Steady-state reads and save
1107
1142
  cadence are unchanged.
1108
1143
 
1109
- The frontend's `dispatchFrontend` checkpoint retains dashboard facts plus only
1110
- the latest run-started fact and the sampled lease holder's start (deduplicated).
1111
- Its dashboard facts are a cache of facts after the feed's restoration point,
1112
- not presentation authority: settings, Harvest, handoffs and upgrades, ticket
1113
- migrations and missing accounts all render from canonical repository facts.
1114
- Identity history is always partial, including normalized legacy version-4
1115
- caches; a missing holder is resolved through the bounded per-run reduced read.
1144
+ The frontend's `dispatchFrontend` checkpoint (reducer version 5) retains
1145
+ identities only: the latest run-started fact and the sampled lease holder's
1146
+ start (deduplicated), plus the holder name. It holds no dashboard-event cache,
1147
+ so its size is fixed by those identities however much Harvest, settings,
1148
+ handoff or migration history accumulates. Settings, Harvest, handoffs and
1149
+ upgrades, ticket migrations and missing accounts all render from canonical
1150
+ repository facts. Identity history is always partial, including normalized
1151
+ legacy version-4 caches; a missing holder is resolved through the bounded
1152
+ per-run reduced read. An older client ignores a version-5 row and reseeds
1153
+ canonically, and the store refuses its version-4 writes over that row, which
1154
+ settles them.
1116
1155
  Successful lease samples select or clear the retained holder; failed metadata
1117
1156
  reads preserve the last selection. Snapshot saves track cursor and effective
1118
1157
  retained-state changes locally: written, refused and unsupported attempts settle
@@ -1123,7 +1162,8 @@ only its captured projection is acknowledged. Teardown forces a dirty save past
1123
1162
  the time gate, while settled state stays quiet. Equal-cursor refusal does not
1124
1163
  make correlation durable: restart reconstructs it through bounded holder lookup,
1125
1164
  and the next advancing-cursor checkpoint carries it without relaxing snapshot
1126
- ordering. A validated, already normalized restored checkpoint starts clean.
1165
+ ordering. A validated version-5 checkpoint whose identities are already
1166
+ normalized starts clean; a normalized legacy version-4 row starts dirty.
1127
1167
 
1128
1168
  `packages/core/src/cli/dashboard/refresh.ts` owns the shared presentation read
1129
1169
  scheduler for both terminal paths: focused by default, independent of focus for
@@ -1293,13 +1333,21 @@ and `ab context` writes them under `$AB_CONTEXT_DIR/assets/`.
1293
1333
  through `repositoryReadFacts`; `processes/dispatcher.ts` retries them under the
1294
1334
  existing repository ownership before intake. This pre-record recovery differs
1295
1335
  from `dispatch.failed`, which completes an already established build.
1336
+ `kernel/build-creation.ts` derives the keyed canonical slug that the dispatcher and
1337
+ the hosted server share. The optional `BuildStore.buildCreationIdentity` port says
1338
+ whether a store creates at the exact slug (method absent), at that derived slug for
1339
+ a keyed request (`keyed`), or at an allocated slug a client may never learn
1340
+ (`allocated`).
1296
1341
 
1297
1342
  Before claiming, the dispatcher journals a repository-scoped preparation intent;
1298
- a won claim and the exact selected creation slug are durable boundaries. Caught
1343
+ a won claim, the selected creation slug and, when the build store attests keyed
1344
+ creation, the attempt's creation key are durable boundaries. Caught
1299
1345
  asset-copy, spec-authoring, naming, and build-creation failures return the ticket
1300
1346
  to configured Ready; a nonconforming spec goes to configured Triage. Recovery
1301
- checks the exact selected build first: a matching record and atomic
1302
- `build.created` retain ownership even if creation threw after committing.
1347
+ point-reads the selected slug and, for a keyed attempt, the canonical slug derived
1348
+ from the repository, selected slug and key: one matching record and atomic
1349
+ `build.created` retain ownership even if creation threw after committing or its
1350
+ response was lost.
1303
1351
  Unavailable or conflicting readback never authorizes release or a replacement
1304
1352
  build. Pending attempts retain the original failure, latest recovery error and
1305
1353
  retry deadline in the canonical repository reduced value; resolved attempts
@@ -1307,8 +1355,10 @@ leave that value. Under repository ownership, each tick admits at most eight
1307
1355
  due recovery attempts, before intake and independently of capacity or intake
1308
1356
  settings, with a 30-second durable retry delay after recovery failure. Unresolved
1309
1357
  ticket identities remain withheld. An uncertain claim outcome or unrelated
1310
- external ticket state, missing ticket/state, or conflicting slug ownership terminates
1311
- automatic recovery with an `abandoned` resolution and diagnostic reason. The
1358
+ external ticket state, missing ticket/state, conflicting slug ownership, builds at
1359
+ both identities, or an unknown creation outcome (an unkeyed attempt on a store
1360
+ that allocates slugs, where absence is not evidence) terminates automatic
1361
+ recovery with an `abandoned` resolution and diagnostic reason. The
1312
1362
  ticket is left unchanged; an operator can leave it finished or cancelled, or
1313
1363
  inspect ownership and explicitly return it to Ready for another attempt. These
1314
1364
  cases stop provider polling and further durable diagnostic appends. The tick
@@ -1482,11 +1532,13 @@ validates issuance, durable lifecycle bindings and the 60-second terminal grace;
1482
1532
  principals. `remote-store-server.ts` enforces resource mutations before deposits,
1483
1533
  including body-selected and addressed-stream resources. Operator routes reject
1484
1534
  these principals. Build-runner and build-phase grants may append only the
1485
- kernel's `dispatcher.forge-degraded` repository fact, in their own project
1486
- (the exact repository in the delegated claim, enforced by the preceding
1487
- `requireProject` check),
1488
- so runner/CLI guards can record a newly observed rate limit and wait for
1489
- durable dispatcher recovery. This exception grants no repository administration,
1535
+ kernel's `forge.credential-limited` and `dispatcher.forge-degraded` repository
1536
+ facts, in their own project (the exact repository in the delegated claim,
1537
+ enforced by the preceding `requireProject` check), so runner/CLI guards can
1538
+ report a newly observed rate limit as attention. Current guards are
1539
+ process-scoped (`kernel/guarded-forge.ts`) and record only
1540
+ `forge.credential-limited`; the `dispatcher.forge-degraded` admission remains
1541
+ for runners pinned to older releases. This exception grants no repository administration,
1490
1542
  recovery, lease, or other journal writes. The agent-visible build-scoped Store
1491
1543
  still denies repository writes. Ticket routes deny build grants and allow harvest grants only the reads and
1492
1544
  runner filing operations they require. Ticket sources and assets are partitioned
@@ -1624,8 +1676,10 @@ If a leaf spec revision arrives during an unfinished reconcile, the same reconci
1624
1676
  ### Leaf and reconcile restacking
1625
1677
 
1626
1678
  The kernel prepares a detached replay of one net build change on the base frozen
1627
- by `reconcile.started`. The contribution baseline is the initial branch-cut base
1628
- or latest successfully published restack/reconcile base. The resolver continues that one replay;
1679
+ by `reconcile.started`. The contribution baseline is the initial branch-cut base,
1680
+ the latest successfully published restack/reconcile base, or the target a
1681
+ `restack.advanced` fast-forward moved an unpublished branch onto, whichever is
1682
+ newest (`leafRestackedBase` and `leafBaseInUse`). The resolver continues that one replay;
1629
1683
  completion requires one parent at the frozen base and the build identity trailer.
1630
1684
  Historical merge completions retain their original shape and semantics.
1631
1685
 
@@ -1648,8 +1702,16 @@ A contended rewrite preserves the observed work and retries on the same base.
1648
1702
 
1649
1703
  `kernel/leaf-restack-state.ts` projects target observations, frozen transactions
1650
1704
  and cycle gates into the log index and persisted build facts. The engine selects
1651
- automatic kernel work before any verify action and after finalize post-steps when
1652
- the target moves. `reconcile-restack.ts` shares collapse, detached replay,
1705
+ automatic kernel work before any verify action, after finalize post-steps when
1706
+ the target moves, and, for an ended ticket wait whose accepted target differs
1707
+ from the base in use, before the declaring phase resumes (`wait-resume`, ahead
1708
+ of the plan and code loops). A wait-resume with no published work fast-forwards
1709
+ the local branch and records `restack.advanced` instead of replaying, only when
1710
+ that branch has no commits the target lacks and the workspace has no
1711
+ uncommitted tracked changes; a wait
1712
+ declared by an unintended reconcile occurrence on a moved target first abandons
1713
+ that occurrence with `reconcile.superseded`, then replays onto the new target
1714
+ (see Ticket waits above). `reconcile-restack.ts` shares collapse, detached replay,
1653
1715
  archive-before-replacement and expected-head publication mechanics. Automatic
1654
1716
  transactions emit `restack.*`; clean completion never starts a reconcile cycle.
1655
1717
  Pre-PR conflicts adopt the prepared replay through ordinary reconcile. Initial
@@ -1668,6 +1730,12 @@ Object packs retain newly introduced replay trees/blobs as well as commit bytes.
1668
1730
  Replay retention stores thin Git packs in bounded binary chunks, with a fixed-size completion manifest written only after every chunk is acknowledged. Digest-keyed chunks make interrupted writes retryable; incomplete uploads are never restored. Recovery validates all chunk sizes and the pack digest before installation, and requires the base objects (restoring node prefixes in order). Existing single-artifact base64 packs remain readable. Retained replay artifacts are read only when the requested commit is missing locally, never by idle polling.
1669
1731
 
1670
1732
 
1733
+ `kernel/head-paths.ts` records `head.paths-recorded` for every candidate head a
1734
+ build produces (finalize, post-step pushes, restacks, reconciles, node rewrites
1735
+ and integration cycles) before the write that establishes it, with the complete
1736
+ path sets in a `head-paths` artifact; `kernel/head-paths-state.ts` folds bounded
1737
+ summaries into build state and answers the current candidate's paths without Git.
1738
+
1671
1739
  GitHub archive push/fresh-fetch and rewrite contracts are manual opt-in cases in
1672
1740
  `ports/forge/github.live.integration.test.ts`, using `AB_RUN_LIVE_PORT_CONTRACTS=1` and an
1673
1741
  explicit disposable `AB_GITHUB_CONTRACT_REPO`. Offline transport tests are not
@@ -1794,8 +1862,15 @@ escape hatches independent of completeness and verification.
1794
1862
  ### Merge authorization
1795
1863
 
1796
1864
  The pure evaluator in `kernel/landing-policy.ts` chooses the first matching
1797
- `[[merge]]` rule. `kernel/landing-state.ts` reduces immutable candidate
1798
- decisions and persistent hold/merge commands. The dispatcher owns readiness,
1865
+ `[[merge]]` rule. Its `paths` and `within` predicates read the candidate
1866
+ head's recorded path facts (`kernel/head-paths-state.ts`), never git, and a
1867
+ reached path rule without recorded paths returns a deferral.
1868
+ `kernel/landing-state.ts` reduces immutable candidate decisions, deferrals and
1869
+ persistent hold/merge commands, keeping the path-predicate rule a consent was
1870
+ given under. `kernel/consent-revocation.ts` matches a reconcile's recorded
1871
+ resolution against that rule and appends `landing.consent-revoked` at the two
1872
+ places a resolution is recorded: leaf reconcile completion (`cli/terminals.ts`)
1873
+ and the node rewrite (`kernel/node-restack-transaction.ts`). The dispatcher owns readiness,
1799
1874
  ticket label sampling and native-state convergence. `kernel/landing-publication.ts`
1800
1875
  confirms native cancellation at local and trusted remote head-publication seams.
1801
1876
  Node merges retain the existing writer serialization and gate proof.
@@ -1897,7 +1972,7 @@ execution and unchanged-base progress budgets retain their existing accounting.
1897
1972
 
1898
1973
  Destination heads come only from the authoritative forge branch; dispatcher-host
1899
1974
  refs are never a fallback. Failed remote reads retain the accepted observation;
1900
- classified rate limits use repository forge degradation and cooldown. Changed
1975
+ dispatcher-classified rate limits use repository forge degradation and cooldown. Changed
1901
1976
  heads require immutable commit ancestry proof against the accepted target and
1902
1977
  the destination base already used by replay. Missing capability or failed proof
1903
1978
  defers new replay. A non-descendant without kernel lineage records
@@ -1955,7 +2030,7 @@ not consume `maxPhaseAttempts`. A seventh transient failure records
1955
2030
  error and six retries. Answering that escalation opens a fresh publication episode
1956
2031
  for the same retained intent without resetting agent phase failures. Pending
1957
2032
  publication keeps its workspace through backoff and unresolved exhaustion.
1958
- Classified rate limits retain repository cooldown and consume no publication
2033
+ Dispatcher-classified rate limits retain repository cooldown and consume no publication
1959
2034
  retry allowance. Rejected pushes, lease conflicts, dirty trees and unclassified
1960
2035
  errors retain their existing behavior.
1961
2036
 
@@ -1997,7 +2072,8 @@ one durable `dispatcher.kernel-git-unavailable` repository condition, node work
1997
2072
  waits, and `dispatcher.kernel-git-recovered` closes the condition once a clone
1998
2073
  succeeds.
1999
2074
 
2000
- A classified forge rate limit records repository degradation with `resetAt`.
2075
+ A rate limit the dispatcher classifies on its own authenticated request
2076
+ records repository degradation with `resetAt`.
2001
2077
  Forge work waits during cooldown; passing the deadline permits a recovery
2002
2078
  request; a successful probe records automatic recovery. An authorized operator
2003
2079
  may explicitly override erroneous recorded state with
@@ -2008,6 +2084,25 @@ success. A subsequent actual limit records a fresh cooldown. Hosted admission
2008
2084
  requires a schema-valid finite ISO `resetAt` no later than server time plus
2009
2085
  24 hours, inclusive; past deadlines remain valid. Rejection never clamps or
2010
2086
  invents a provider reset, and historical events remain readable.
2087
+
2088
+ Only the dispatcher's own forge pauses the repository. A limit on a request
2089
+ that carried no credential, or one seen by a build runner or phase session,
2090
+ says nothing about the dispatcher's credential: that process waits out its own
2091
+ reset locally (a dispatcher defers that work instead), and records one advisory
2092
+ `forge.credential-limited` fact per episode naming the process, whether the
2093
+ request was `unauthenticated` (with why) or used the process's own credential,
2094
+ and the reset. It is `ab watch` attention and appears as
2095
+ `forgeCredentialLimits` in `ab repository status` until its reset;
2096
+ `forge-clear` does not apply. Remote guests receive no forge credential: their
2097
+ GitHub API requests fail with a typed error naming `GITHUB_TOKEN or GH_TOKEN`
2098
+ instead of going out anonymously, and they prove ancestry through their
2099
+ workspace's Git. An unauthenticated limit therefore points at a process missing
2100
+ `GITHUB_TOKEN`/`GH_TOKEN` or a `gh` login, or at guest-side forge use that must
2101
+ run kernel-side. Runners and sessions still wait out a dispatcher-recorded
2102
+ cooldown, but a limit they hit on a shared token no longer pauses the
2103
+ dispatcher in advance; the dispatcher records it on its own next limited
2104
+ request.
2105
+
2011
2106
  Native merge application failures keep candidate-specific retry eligibility,
2012
2107
  including automatic decisions without a human command. Retries recheck consent,
2013
2108
  holds, verification and the exact candidate. Uncertain enables remain pending
package/docs/cli.md CHANGED
@@ -47,6 +47,7 @@ Run `bun ab <command>`; `bun ab help <command>` lists flags and subcommands. See
47
47
  - `done` — Complete a producer phase.
48
48
  - `verdict` — Complete a review or verification phase.
49
49
  - `escalate` — Park the build with a question for external judgment.
50
+ - `wait-on` — Park the build on other tickets without holding a slot; it ends when the tickets complete or an operator answers.
50
51
  - `harvest` — Inspect or drive observation harvesting.
51
52
 
52
53
  Phase commands (`context`, `done`, `verdict`) use runner-scoped session authority: the runner starts phase agents, never your operator agent. See [Skills](skills.md).
@@ -63,6 +63,16 @@ sessionBudgetSeconds = 3600
63
63
  - **Capacity** bounds concurrent work.
64
64
  - **Policy limits** bound review rounds, retries and session budgets, and decide when automation stops for attention.
65
65
 
66
+ Roles apply to every build. A label-selected **profile** gives the builds of tickets carrying its label their own overrides, and everything it leaves out still comes from `[roles]`:
67
+
68
+ ```toml
69
+ [profiles.deep]
70
+ label = "deep"
71
+
72
+ [profiles.deep.roles.implement]
73
+ model = "claude-opus-5-5"
74
+ ```
75
+
66
76
 
67
77
  ## Accounts
68
78
 
@@ -193,7 +203,7 @@ advisory and does not revoke a still-valid credential.
193
203
  ## Admission and merge
194
204
 
195
205
  - **Tickets.** `[tickets]` sets the source and readiness criteria for admitting work.
196
- - **Merge.** Ordered, first-match `[[merge]]` rules on source and destination select automatic merge or explicit consent. See [Integrating related work](integration-overview.md#policy-authorizes-merge) for matching and defaults, [Working with your operator agent](operating.md) for consent and hold commands.
206
+ - **Merge.** Ordered, first-match `[[merge]]` rules on source, destination, label and changed paths select automatic merge or explicit consent. See [Integrating related work](integration-overview.md#policy-authorizes-merge) for matching and defaults, [Working with your operator agent](operating.md) for consent and hold commands.
197
207
  - **Reloads.** Build execution configuration is pinned; dispatcher policy and role settings reload live.
198
208
  - **Secrets** stay out of committed TOML.
199
209