@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
package/SPEC.md CHANGED
@@ -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
@@ -701,15 +706,18 @@ Leaf branches are collapsed into one build change and restacked onto the frozen
701
706
  target branch's current head at verify entry, before any verifier or exclusion.
702
707
  This is kernel work within the fixed grammar, not another phase. A verify failure
703
708
  returns to implementation; its new commits append to the canonical change, and
704
- the next approved cycle collapses and restacks again. While waiting to merge after
705
- finalize and its post-steps, an observed target move also schedules a restack.
709
+ the next approved cycle collapses and restacks again. A build resuming from a
710
+ ticket wait (§11 "Ticket waits") first restacks onto the target's current head
711
+ when the target moved, so the resumed phase sees the merged blockers. While
712
+ waiting to merge after finalize and its post-steps, an observed target move
713
+ also schedules a restack.
706
714
  For a node-targeted leaf, published finalize-step commits also schedule one
707
715
  waiting restack, even when the target SHA is unchanged, so guarded merge
708
716
  preserves one canonical build identity.
709
717
  Clean waiting restacks retain existing verification when build-owned config is
710
718
  unchanged (§16.1), including when replay replaces the pin commit's ancestry.
711
- Conflicts use reconcile and its captured post-reconcile policy. A conflict before initial verification cannot
712
- skip initial checks through that policy.
719
+ Conflicts use reconcile and its captured post-reconcile policy. A conflict before initial verification,
720
+ including one at a wait resume, cannot skip initial checks through that policy.
713
721
 
714
722
 
715
723
  ## 6. The spec
@@ -1215,7 +1223,7 @@ The base-selection invariants make this safe with Git:
1215
1223
  back to the local base and records the diagnostic.
1216
1224
  - **Re-provisioning resumes; eligible restacks rewrite.** Provisioning alone
1217
1225
  resumes the published branch. The kernel collapses and restacks at verify
1218
- entry and after target moves while awaiting merge. The first
1226
+ entry, at a ticket-wait resume, and after target moves while awaiting merge. The first
1219
1227
  `workspace.provisioned` base stays immutable branch-cut provenance; later
1220
1228
  `existing` facts are resume evidence, not new cuts. A remote workspace lost
1221
1229
  before publication may be freshly cut again; the latest `remote` or `local`
@@ -1224,10 +1232,14 @@ The base-selection invariants make this safe with Git:
1224
1232
  - **Review loops keep their starting effective base.** The initial loop uses
1225
1233
  the latest fresh cut; after a successful verify-entry restack, later failure
1226
1234
  loops use that restacked contribution base. Plan, implementation and
1227
- code-review never rewrite the branch. Previously recorded review ranges
1228
- remain immutable, including between rounds.
1235
+ code-review never rewrite the branch; the one exception is the kernel's
1236
+ wait-resume restack between phases, after which the resumed loop uses the
1237
+ restacked base. Previously recorded review ranges remain immutable,
1238
+ including between rounds.
1229
1239
  - **Each implementation completion records its proven contribution boundary.**
1230
- `ab done` uses the current projected contribution base, falling back to the
1240
+ `ab done` uses the current projected contribution base (the completed
1241
+ range's base, else `implement.contributionBase`, the base a wait-resume
1242
+ restack or fast-forward moved an uncompleted build onto), falling back to the
1231
1243
  latest fresh-cut provisioning base (`remote` or `local`, never an `existing`
1232
1244
  resume). It validates that immutable base against HEAD and records it verbatim.
1233
1245
  A moving or rewritten destination never changes the review range, and review
@@ -1242,7 +1254,8 @@ The base-selection invariants make this safe with Git:
1242
1254
  to code review and every agent verify step. Node integration cycles retain
1243
1255
  their separate range semantics.
1244
1256
  - **Verification names its actual base.** Successful restack or reconcile
1245
- publication promotes the contribution/path base. Every new verify start and
1257
+ publication promotes the contribution/path base, as does a wait-resume
1258
+ fast-forward (`restack.advanced`). Every new verify start and
1246
1259
  result, including skips, cites the cycle's base and head. Those citations stay
1247
1260
  frozen throughout the cycle and survive clean waiting restacks; historical
1248
1261
  facts without citations remain readable. Upstream-only paths are excluded.
@@ -1513,6 +1526,12 @@ checks actual build/session/stream ownership and filters collections server-side
1513
1526
  Explicit project mismatch is 403; missing and foreign indirect IDs share 404.
1514
1527
  Remote project build creation allocates a fresh slug and a branch in the build
1515
1528
  kind's namespace (`ab/` or `ab-node/`); the returned record is authoritative. Local adapters retain exact-slug behavior.
1529
+ A request carrying a creation key instead lands at most once at the slug derived
1530
+ from the repository, requested slug and key, so a client that lost the response
1531
+ can point-read it; a repeated key is a conflict. The service advertises this with
1532
+ the `build-creation-key-v1` health capability. A client treats a service without
1533
+ it as allocating: an unkeyed attempt whose creation outcome is unknown there ends
1534
+ recovery rather than handing the ticket back.
1516
1535
 
1517
1536
  Owners issue/list/revoke credentials with deployment-local `ab-hosted-store
1518
1537
  credentials` commands. Retired deployment-wide and repository-less operator
@@ -1730,7 +1749,8 @@ an internal runner option, not an accepted `[policy]` TOML key. Reconcile
1730
1749
  execution and unchanged-base progress budgets retain their existing accounting.
1731
1750
 
1732
1751
  **Every phase ends with exactly one terminal command** — `done`, `verdict`,
1733
- or `escalate`. The CLI rejects a second terminal call, and each terminal
1752
+ or `escalate`, or in a work build `wait-on`, which declares a ticket wait
1753
+ (§11). The CLI rejects a second terminal call, and each terminal
1734
1754
  validates its preconditions before emitting the phase event (no `done`
1735
1755
  without the required artifacts; no `done` on a dirty worktree in
1736
1756
  `implement`). A normally completed turn that ends **without** any terminal
@@ -2184,6 +2204,45 @@ deterministic fail-safe.
2184
2204
  tuple is recorded on `session.started`; fallback starts cite the preceding target and
2185
2205
  verbatim error, while exhausted `phase.failed`/`harvest.failed` facts carry
2186
2206
  the complete ordered attempt list.
2207
+ - **Role profiles (§16.1):** `[roles]` is the repository's default for every
2208
+ build. A repository may also declare named `[profiles.<name>]` tables, each
2209
+ with exactly one ticket `label` and any number of
2210
+ `[profiles.<name>.roles.<role>]` entries for any role name, including
2211
+ verify and finalize step names and roles `[roles]` does not declare. An
2212
+ entry accepts the `[roles.<role>]` fields. For a build with that profile,
2213
+ an entry's declared fields overlay `[roles.<role>]`, and every omitted field
2214
+ takes the value the repository roles would give it: `[roles.<role>]`, then
2215
+ `[roles.default]`. A declared `alternates` list, including `[]`, replaces the
2216
+ inherited list; an omitted one inherits it, and each alternate overlays the
2217
+ profile-adjusted primary. Key selection walks the step or phase name, then
2218
+ any deprecated alias, against profile entries and `[roles]` together, so a
2219
+ profile entry on a key wins where a `[roles]` entry on that key would. A
2220
+ profile entry named `default` is refused; so are duplicate labels (trimmed,
2221
+ case-insensitive), a missing or blank label, and an entry whose effective
2222
+ runtime, model, args or account would be refused for a `[roles]` entry. The
2223
+ eager resolver validates every profile with the roles, so dispatch startup,
2224
+ `ab init --validate` and a live reload refuse the same problems.
2225
+
2226
+ The profile is **fixed when the dispatcher claims the ticket**: the label
2227
+ match runs over the labels the ready listing already returned, and the
2228
+ selected name is recorded on `build.created.profile`. Later relabelling
2229
+ never changes it. A node and each child select from their own ticket's
2230
+ labels. A ready ticket carrying two profiles' labels is not claimed; the
2231
+ scan reports it in the persisted ticket diagnostics until at most one
2232
+ profile label remains. A ticket never supplies a model, runtime or argument
2233
+ itself.
2234
+
2235
+ The profile's **contents** are read from the current configuration at each
2236
+ session boundary, like `[roles]`, so an edit reaches the in-flight builds that
2237
+ selected the profile at their next session and no other build. Every agent
2238
+ session of the build resolves through it — plan, plan review, implement,
2239
+ code review, agent verify and finalize steps, and reconcile — and
2240
+ `session.started.profile` records `{ name, configured }`. When a reload
2241
+ removes the profile, later sessions use the repository roles with
2242
+ `configured: false`, and `ab build status` says the recorded profile is no
2243
+ longer configured. A resumed session keeps its recorded target as before.
2244
+ Sessions outside a build (`slug`, `upgrade`, `harvest`, `harvest-review`)
2245
+ never use a profile.
2187
2246
  - **Transcripts come back through the interface**, not scraped from disk, so
2188
2247
  every adapter must produce one whenever its owning runner reaches the session
2189
2248
  end boundary, including turns rejected by a provider after a handle exists.
@@ -2338,8 +2397,8 @@ Answering `phase-attempt-limit` or `non-retryable-phase-failure` re-arms only
2338
2397
  the matching phase and `round`; a missing round cannot broaden either cause.
2339
2398
  `review-round-limit` retains the same matching-round effect.
2340
2399
  `verify-failure-limit` is the explicit phase-level case and re-arms every
2341
- phase-runner failure round for its verify target. `reconcile-no-progress` and
2342
- `setup-failure-limit` have no phase-runner failure-budget effect (setup's own
2400
+ phase-runner failure round for its verify target. `reconcile-no-progress`,
2401
+ `setup-failure-limit` and `wait-unresolvable` have no phase-runner failure-budget effect (setup's own
2343
2402
  answer/retry accounting remains separate). Agent and stall raises, and
2344
2403
  cause-less historical policy raises, retain the legacy shape rule: a matching
2345
2404
  round resets that round and an absent round resets all rounds for the target.
@@ -2358,6 +2417,160 @@ even if it is also roundless. Cause-less historical roundless
2358
2417
  without migration. Routing uses these typed event fields and never parses the
2359
2418
  human-facing `question`.
2360
2419
 
2420
+ **Ticket waits.** A phase agent in a work build that cannot proceed until other
2421
+ tickets complete ends its session with `ab wait-on <ticket-id>... --reason
2422
+ <text>` instead of an escalation. The command is a terminal (§8.4). It checks
2423
+ only what needs no ticket source — 1 to 20 unique nonblank ids, a nonblank
2424
+ reason, no prior terminal in the session, a work build, and not the build's own
2425
+ recorded ticket id — and appends one `wait.requested {id, phase, round,
2426
+ tickets, reason, publication?}` as the session's agent actor. A build holds one ticket wait
2427
+ at a time: while another session's request is undecided or its wait is open,
2428
+ the command is refused with no write, checked against the same log prefix the
2429
+ append commits to, so of two concurrent verifiers only one declares and the
2430
+ other keeps its ordinary terminals. A session therefore needs only
2431
+ its build-phase store grant, local or hosted; it never holds a ticket-source
2432
+ credential for a wait.
2433
+
2434
+ An `implement` declaration first makes the session's commits durable, so a
2435
+ resume replays only published work. It requires a clean worktree, as `ab done`
2436
+ does. When HEAD is ahead of the published head (or of the contribution base
2437
+ before any publication), it publishes HEAD through the implement terminal's
2438
+ guarded publication. A local workspace pushes before the fact: a failed push
2439
+ throws, writes nothing and leaves the same session retryable, and the request
2440
+ records `publication {branch, base, sha, settlement: published}`. A remote
2441
+ workspace first deposits `publication.requested {operation: wait, id, branch,
2442
+ sha, base}` and records `settlement: requested`; the dispatcher's settlement
2443
+ stage publishes it and appends `wait.published {id, sha}`. The dispatcher
2444
+ enters such a wait only after `wait.published`. A recorded `publication.lost`
2445
+ refuses it with cause `publication-lost`, and the declaring phase re-runs with
2446
+ that refusal as guidance. Other phases author no branch commits and publish
2447
+ nothing.
2448
+
2449
+ The dispatcher holds the ticket source, so it validates every request on its
2450
+ next tick, for local and hosted builds alike. The build digest marks a request
2451
+ without an outcome (`waitPending`), and only such a build is read further. Until
2452
+ the request is decided, the engine decides `wait ticket-wait` and the build
2453
+ keeps its slot. The dispatcher resolves each id through the source and refuses
2454
+ the request when an id is unknown, is the build's own ticket after
2455
+ canonicalisation, has already completed, or the build has no source ticket. A
2456
+ refusal appends `wait.refused {id, cause, tickets, message}` naming the
2457
+ offending ids (cause `unknown-ticket`, `own-ticket`, `completed`,
2458
+ `no-source-ticket` or `publication-lost`). Nothing is written to the ticket and no wait begins; the
2459
+ declaring phase re-runs at the same round or attempt, with the refusal message
2460
+ as its guidance. Accepted, the dispatcher adds every id not already in the
2461
+ build ticket's `blockedBy` (so a retry after a lost append adds no duplicate),
2462
+ then appends `wait.entered {id, escalation, tickets, reason, question}` with
2463
+ the canonical ticket refs. A ticket-source failure writes nothing, reports a
2464
+ diagnostic and is retried on the next tick.
2465
+
2466
+ An entered wait opens an escalation with id `escalation`, the declaring phase
2467
+ and round, `source: agent`, the declaring session and the waited tickets as
2468
+ `refs`; its question begins `Waiting on`. The build is `blocked`. A work build
2469
+ whose only open escalation is its wait, and which has no runner working, holds
2470
+ no capacity slot and keeps its branch, workspace and completed phase work
2471
+ (§12 "What holds a slot"). A wait ends at its first end fact: an
2472
+ `escalation.answered` on its escalation with any resolution (cause
2473
+ `operator`), `wait.ended {id, cause, message}`, whose `cause` is
2474
+ `automatic` when its blockers completed or `operator` when an operator surface
2475
+ ends it without answering, or the dispatcher's unresolvable raise below (cause
2476
+ `unresolvable`). `wait.ended` closes the escalation as `guidance`
2477
+ with its message as the answer; an end for an unknown, already ended or
2478
+ superseded wait is ignored. Answering a wait never resets a phase-failure
2479
+ budget.
2480
+
2481
+ The dispatcher ends waits itself. The build digest carries `ticketWait {id,
2482
+ escalation, tickets}` exactly while an entered wait is open: set by
2483
+ `wait.entered`, cleared by a matching `wait.ended`, by an answer to its
2484
+ escalation, or by a `wait-unresolvable` raise. Once per tick, before the lease
2485
+ sweep's per-build pass and whether or not the repository is paused, the
2486
+ dispatcher collects the open waits of nonterminal work builds from the digests
2487
+ the tick already read, resolves each ref through the repository's ticket
2488
+ migrations, and reads the union of their ids in one batched
2489
+ `dependencyStates` call with the rejected-role overlay (§12). No open wait
2490
+ means no call, and the stage reads no event rows. Per wait:
2491
+
2492
+ - every ticket exists, is resolved and is not rejected: `wait.ended {id,
2493
+ cause: automatic, message}`, appended conditionally on the build's reduced
2494
+ `lastSeq`, ends the wait on the tick after the last ticket completes;
2495
+ - any ticket is rejected or no longer exists: one `escalation.raised {source:
2496
+ policy, policyCause: wait-unresolvable, phase, round, question, refs}` with
2497
+ the wait's phase and round, the offending ids as `refs`, and a question
2498
+ naming each ticket and why it can never complete;
2499
+ - otherwise some ticket is still pending, and the wait stays in place. A
2500
+ partially completed wait is never released.
2501
+
2502
+ The reducer reads a `wait-unresolvable` raise against an open wait as its end:
2503
+ `wait.ended` becomes `{cause: unresolvable, seq, message: question}`, the
2504
+ wait's own escalation closes as answered `guidance` with the question as its
2505
+ answer, and the new escalation carries the wait's `wait: {id}` marker. The
2506
+ build is `blocked` on an ordinary policy escalation, in the default attention
2507
+ filter, and holds its slot. Because the digest clears on the raise it is never
2508
+ raised twice. Its answer routes and delivers like a wait answer: a reviewer
2509
+ resumes the same review round, the session's `guidance.json` carries the
2510
+ `wait` block, and after the answer the ended wait requests its resume slot; a
2511
+ `revise-spec` answer waits for the revision and `abort` aborts. A raise against
2512
+ a wait that is not open records an ordinary escalation. A source failure writes
2513
+ nothing, reports a diagnostic and is retried on the next tick. Hosted clients
2514
+ read `ticketWait` from the digest wire answer; an older service that omits it
2515
+ yields no automatic release, and operators still end waits by answering.
2516
+
2517
+ An ended wait requests a `resume` slot and is admitted before new ticket
2518
+ claims, as a parked finished build is; a `revise-spec` answer instead waits for
2519
+ the revision. The dispatcher observes the leaf's target when it launches the
2520
+ resume. Before the declaring phase resumes, and ahead of the plan and code
2521
+ loops, the engine decides a `restack` with trigger `wait-resume` and cycle
2522
+ `wait.ended`'s seq when the accepted target differs from the base the build's
2523
+ work sits on. When the target has not moved, no restack runs. A build with
2524
+ published work replays it through the guarded automatic restack (`restack.*`
2525
+ facts carry the `wait-resume` trigger); a conflict runs `reconcile` for that
2526
+ transaction, which counts as initial verification, and the declaring phase
2527
+ resumes after `restack.completed`. A build with nothing published, whose local
2528
+ branch has no commits the target lacks and whose workspace has no uncommitted
2529
+ tracked changes (plan, plan-review, implement before its first commit),
2530
+ fast-forwards its local branch to the fresh target snapshot and records `restack.advanced
2531
+ {trigger, cycle, observation, branch, from, to}`; nothing is written remotely
2532
+ and no conflict is possible. That fact promotes the contribution base for the
2533
+ implement terminal, conditional verification and later restack decisions. A
2534
+ Unpublished local commits or uncommitted tracked changes fail the restack
2535
+ rather than being discarded. The decision is taken once per wait end: a target move after the build
2536
+ resumed never restacks a running phase.
2537
+
2538
+ A reconcile session that declares a wait leaves its occurrence frozen onto its
2539
+ original target. When the wait ends with the target moved, and the occurrence
2540
+ has recorded no publish intent, the kernel supersedes it: the runner aborts the
2541
+ pending replay, discarding the resolver's undeposited resolution, and records
2542
+ `reconcile.superseded {attempt, cycle, cause: wait-resume, restackId?}`, which
2543
+ closes the occurrence and any automatic restack it belonged to without a
2544
+ completion. It then runs the wait-resume restack from the unchanged published
2545
+ head, so the resumed reconcile session resolves a replay onto the current
2546
+ target, or none when the replay is clean. With the target unchanged the same
2547
+ attempt resumes with its replay intact.
2548
+
2549
+ The engine's ordinary rules then re-run the declaring phase: a
2550
+ producer at the same round, a reviewer at the same review round, an agent
2551
+ verifier at the same step and attempt, and finalize or reconcile. Guidance
2552
+ reaches the session through its usual carrier, and its
2553
+ `$AB_CONTEXT_DIR/guidance.json` gains a `wait` block — `{id, tickets, reason,
2554
+ outcome: refused | ended, cause, message}` — whenever the guidance is the
2555
+ wait's refusal or answer (including the answer to its `wait-unresolvable`
2556
+ escalation), or when the wait ended without guidance text. A
2557
+ review phase's wait resumes that review round and never feeds the next
2558
+ producer. `ab build status` shows a requested, open, or ended-but-not-resumed
2559
+ wait and the tickets it names. Node builds cannot declare waits.
2560
+
2561
+ The wait's reduced state is part of the build state contract:
2562
+ `waitRequest {id, session, phase, round, tickets, reason, seq, publication?,
2563
+ outcome?}`, where `publication` is `{branch, base, sha, published, requestSeq?,
2564
+ lost?}`, and
2565
+ `outcome` is `{kind: entered, seq}` or `{kind: refused, cause, tickets,
2566
+ message, seq}`, and `wait {id, escalation, session, phase, round, tickets,
2567
+ reason, enteredSeq, enteredAt, ended?: {cause: operator | automatic |
2568
+ unresolvable, seq, message}, resumedSeq?}`.
2569
+ Each holds only the latest request or entered wait. `resumedSeq` is the first
2570
+ `session.started`, `spec.revised`, wait-resume `restack.prepared` or
2571
+ `restack.advanced` after the end; from then on the build holds a slot again. Open and answered escalation records carry `wait: {id}` as the
2572
+ wait marker, including the `wait-unresolvable` escalation that ended the wait.
2573
+
2361
2574
  ## 12. The outer loop
2362
2575
 
2363
2576
  ```
@@ -2382,14 +2595,18 @@ has finished its pipeline (every verify step and every finalize post-step for
2382
2595
  the current spec) holds no slot while it waits for a merge decision, for merge
2383
2596
  gates or the forge, or on hold, and the slot goes to the next ready ticket. The
2384
2597
  dispatcher records the finish as an advisory `pipeline.settled` fact when the
2385
- engine first decides `wait awaiting-pr`. A build that has not finished keeps its
2386
- slot, even while paused, blocked or interrupted between `finalize.completed`
2387
- and its post-steps. When a finished build must restack, re-verify or reconcile,
2388
- it is admitted before new ticket claims, as a node is: intake reserves a slot
2389
- for it, and its wait records nothing, consumes no attempt and raises no
2390
- attention. Abort and pause acknowledgements are not gated. A finished build
2391
- keeps its workspace until it merges or closes, so retained workspaces can
2392
- exceed `capacity`; running work cannot.
2598
+ engine first decides `wait awaiting-pr`. A work build waiting on other tickets
2599
+ (an entered ticket wait, §11) with no runner working also holds no slot, and
2600
+ keeps its branch, workspace and completed phase work. Any other build that has
2601
+ not finished keeps its slot, even while paused, blocked on a question, waiting
2602
+ for the dispatcher to check a ticket wait, or interrupted between
2603
+ `finalize.completed` and its post-steps. When a finished build must restack,
2604
+ re-verify or reconcile, or a ticket wait ends, the build is admitted before new
2605
+ ticket claims, as a node is: intake reserves a slot for it (`resume` for an
2606
+ ended wait), and its wait records nothing, consumes no attempt and raises no
2607
+ attention. Abort and pause acknowledgements are not gated. A finished or
2608
+ waiting build keeps its workspace, so retained workspaces can exceed
2609
+ `capacity`; running work cannot.
2393
2610
 
2394
2611
  Additional scheduled ingesters such as `ingest:sentry` remain an open design
2395
2612
  thread and have no shipped config surface. Observation harvest is
@@ -2546,7 +2763,12 @@ The TicketSource **initiates and receives projections; it is never consulted
2546
2763
  mid-build and never used as artifact storage.** Dispatch reads the ticket
2547
2764
  (including the spec) as part of initiation — at claim time, or on a later tick
2548
2765
  while an interrupted dispatch still lacks its imported spec. After import, the
2549
- build never reads the tracker again. Human-legibility projections (spec
2766
+ build never reads the tracker again. The one mid-build consultation is the
2767
+ dispatcher's, not the build's: validating a declared ticket wait resolves its
2768
+ ids and records them in the build ticket's `blockedBy`, and while waits are
2769
+ open one batched dependency read per tick checks whether their tickets
2770
+ completed (§11 "Ticket waits").
2771
+ Human-legibility projections (spec
2550
2772
  posted as a comment, final summary, status transitions) flow outward only.
2551
2773
  This keeps the abstraction honest: a file-based TicketSource with nowhere to
2552
2774
  put blobs must be fully workable.
@@ -2613,7 +2835,8 @@ and reviewer, while the filing read is authoritative. Both paths remain
2613
2835
  initiation, so the never-consulted-mid-build rule is untouched. A
2614
2836
  dependency-blocked ticket stays
2615
2837
  queued source work rather than becoming a blocked build: the runtime `blocked`
2616
- status is for builds awaiting a human.
2838
+ status is for builds awaiting a human or waiting on other tickets after they
2839
+ started (§11 "Ticket waits").
2617
2840
 
2618
2841
  **Forge issue links.** A ticket may record the forge issues it addresses, each
2619
2842
  as `{issue, intent}`: `issue` is a positive issue number and `intent` is
@@ -2650,6 +2873,27 @@ create` and `update` take `--priority urgent|normal`; operator and MCP ticket
2650
2873
  requests take `priority`; JSON ticket output always names it. Harvest files
2651
2874
  every proposal normal; grooming marks one urgent.
2652
2875
 
2876
+ **Ticket assignees.** A ticket may carry the usernames it is assigned to.
2877
+ Sources declare support with the `assignees` capability; only the GitHub source
2878
+ does, reading each issue's assignees (set on GitHub or through Autobuild alike)
2879
+ as an `assignees` array that is empty when unassigned and outside the ticket's
2880
+ revision. A write names assignees as usernames or `me`, the owner of the
2881
+ source's credential; create sets them and update replaces the whole set, an
2882
+ empty set clearing it. The source checks every user can be assigned before
2883
+ anything is written, and a write the provider accepts without the requested
2884
+ assignees fails rather than reporting success; a retried keyed create that
2885
+ adopts the existing ticket assigns it. `[tickets].createAssignee` names a
2886
+ default for every ticket Autobuild creates (`ab ticket create`, operator
2887
+ `tickets.create` and harvest proposals) that names no assignees of its own; the
2888
+ caller applies it, so a harvest proposal filed under `"me"` belongs to the
2889
+ owner of the filing dispatcher's credential, resolved at dispatcher startup and
2890
+ never during a tick. File, hosted, Linear and plugin sources without the
2891
+ capability refuse any write naming assignees, including an empty set, and a
2892
+ configured `createAssignee`, with an error naming the source, before anything
2893
+ is written; their tickets carry no `assignees` field. `ab ticket create` and
2894
+ `update` take `--assignees a,b`; operator and MCP ticket requests take
2895
+ `assignees`.
2896
+
2653
2897
  A build freezes its ticket's links into `build.created` when it claims the
2654
2898
  ticket, from the same sample as the body. Later ticket edits and spec revisions
2655
2899
  never change them. An agent in the build may downgrade one linked `closes`
@@ -2793,7 +3037,8 @@ idle node polling, so a slot freed in any tick goes to the node, not to a new
2793
3037
  claim. Its candidate occupancy excludes itself and capacity-bearing blocked or
2794
3038
  paused descendants, following accepted source-qualified build target ancestry.
2795
3039
  Running descendants and unrelated builds still count; ordinary blocked and
2796
- paused work retains its slot for every other admission. Provisioning reserves
3040
+ paused work retains its slot for every other admission, except a work build
3041
+ parked by a ticket wait, which holds none. Provisioning reserves
2797
3042
  node occupancy before the runner starts. This exception never raises the budget
2798
3043
  for new claims. Status and both dashboards report actual occupancy, configured
2799
3044
  capacity, effective display capacity and the nodes using descendant-held slots.
@@ -2846,7 +3091,8 @@ Human forge merges are an explicit escape hatch, even while incomplete, paused
2846
3091
  or unverified. The janitor records human provenance and whether the actual merged
2847
3092
  head had a successful cycle, then completes the node ticket.
2848
3093
  Closing without merge or aborting closes admission and returns the ticket to
2849
- triage; children already claimed retain their frozen base. Nested nodes work.
3094
+ triage (or ready, when the abort asks for it); children already claimed retain
3095
+ their frozen base. Nested nodes work.
2850
3096
  A forge plugin needs node branch creation, comparison and
2851
3097
  head-read capabilities to admit node tickets.
2852
3098
 
@@ -2899,7 +3145,7 @@ dependency presence requires an ancestor change; on `ab restack <node>`; or on
2899
3145
  accepted re-parenting. There is no eager mode or cadence option. Nested nodes
2900
3146
  need their own demand. Existing frozen transactions, including ones reserved
2901
3147
  before upgrade, finish first; later demand coalesces onto the latest parent.
2902
- Leaves keep verify-entry and awaiting-merge restacks for every target.
3148
+ Leaves keep verify-entry, wait-resume and awaiting-merge restacks for every target.
2903
3149
 
2904
3150
  Presence demand uses change identities, never ticket resolution alone. It follows
2905
3151
  only the path from the nearest proven ancestor source down to the dependent's
@@ -3224,7 +3470,7 @@ durable failure. A human may discard only such a queued build. Discard is
3224
3470
  dispatcher cleanup, returns the ticket to its
3225
3471
  configured Ready state, and completes with
3226
3472
  `discarded`; it is deliberately distinct from abort, which returns work to
3227
- Triage for human judgment. Any selected nonterminal build can be aborted from
3473
+ Triage for human judgment by default, or to Ready when the operator asks. Any selected nonterminal build can be aborted from
3228
3474
  the list or detail view with `a`; Enter confirms and Escape cancels, so the first
3229
3475
  keypress never writes destructive intent. CLI and dashboard both append the same
3230
3476
  `build.abort-requested` fact through the shared control service. The concrete
@@ -3333,9 +3579,9 @@ with illustrative members:
3333
3579
 
3334
3580
  | Family | Examples |
3335
3581
  |---|---|
3336
- | Build lifecycle | `build.created` (carrying `assets`, the claim-time pin, §6.3), `workspace.provisioned`, `workspace.cleanup-required`, `workspace.fenced`, `workspace.commits-preserved`, `workspace.commits-lost`, `workspace.released`, `execution.started`, `execution.ended`, `infrastructure.failed`, `infrastructure.cleanup-attempted`, `dispatch.comment-posted`, `dispatch.failed`, `runner.attached`, `runner.runtime-recorded`, `runner.setup-failed`, `abort.remote-branch-deleted`, `abort.local-branch-deleted`, `abort.ticket-returned`, `build.completed` |
3337
- | Operator commands [D2] | `build.pause-requested` → `build.paused`; `build.discard-requested`; `build.hold-requested`; `build.land-requested` → `landing.command-acknowledged`; `escalation.answered` (optionally carrying a validated `reviewRoundCeiling`, or the `assets` sampled with a revise-from-ticket authorization) |
3338
- | Merge policy | `landing.decided` (candidate, matched rule/default, labels, target, mode); `landing.native-enable-started`; `landing.native-applied` |
3582
+ | Build lifecycle | `build.created` (carrying `assets`, the claim-time pin, §6.3), `workspace.provisioned`, `workspace.cleanup-required`, `workspace.fenced`, `workspace.commits-preserved`, `workspace.commits-lost`, `workspace.released`, `execution.started`, `execution.ended`, `infrastructure.failed`, `infrastructure.cleanup-attempted`, `dispatch.comment-posted`, `dispatch.failed`, `runner.attached`, `runner.runtime-recorded`, `runner.setup-failed`, `abort.remote-branch-deleted`, `abort.local-branch-deleted`, `abort.ticket-returned`, `build.ticket-returned`, `build.completed` |
3583
+ | Operator commands [D2] | `build.abort-requested {reason?, to?}` → `build.aborted`; `build.pause-requested` → `build.paused`; `build.discard-requested`; `build.hold-requested`; `build.land-requested` → `landing.command-acknowledged`; `escalation.answered` (optionally carrying a validated `reviewRoundCeiling`, or the `assets` sampled with a revise-from-ticket authorization) |
3584
+ | Merge policy | `landing.decided` (candidate, matched rule/default, labels, target, mode, matched `paths?` summary); advisory `landing.deferred` (candidate, reason, rule, policy); kernel `landing.consent-revoked {commandSeq, source, rule, previousHead, head, consentedHead?, paths}`; `landing.native-enable-started`; `landing.native-applied` |
3339
3585
  | Spec | `spec.imported`, `spec.authored`, `spec.revised` (either positive `escalation` sequence or exclusive `operator: {user, via?}` provenance for an idle node; optionally carrying `assets`, a re-pin of the ticket's assets, §6.3) |
3340
3586
  | Sessions | `session.started` (including optional write-ahead continuation intent, budget ceiling, and the effective first `prompt` the bracket sent: the start prompt, the live continuation message, or the interruption notice); `session.suspended` with partial transcript and active duration; `session.resumed` acceptance (stale reports are inert); reasoned `session.resume-fallback`; kernel-only `session.native-handle-recorded` with bracket and native execution identity; `session.ended` with transcript ref and usage (ordinary completion — the analysis corpus), or `session.ended {outcome: reclaimed, reclaimedBy: {instance, resumedFromSeq}}` (explicit transcriptless takeover) |
3341
3587
  | Plan/code loops | `plan.started` … `plan-review.verdict`; `implement.started` … `code-review.verdict` |
@@ -3343,20 +3589,43 @@ with illustrative members:
3343
3589
  | Integration attention | Kernel/dispatcher `integration.verification-failed {id, head, parent, steps, guidance}`: one durable failed-cycle notification, recovered from exact verification receipts |
3344
3590
  | PR summary | Kernel-authored `pr-summary.requested {occurrence, boundary}`, `pr-summary.attempted {occurrence, boundary, pr}`, `pr-summary.result {attempt, outcome, eligibleAfter?}`, `pr-summary.settled {request, disposition}`; sequence identities correlate durable starts, completed boundaries, attempts, and handoffs (§7.5) |
3345
3591
  | PR attachments | `pr-attachment.designated`, `pr-attachment.hosted`, `pr-attachment.reclaimed`, `pr-attachment.reclaim-failed` |
3346
- | Leaf restacking | `target.moved {branch, sha, lineage?}`, `target.rewritten {branch, previousSha, sha}`, `target.rewrite-cleared {branch, sha, lineage?}`, advisory `target.distance {branch, sha, head, count}`, `restack.prepared`, `restack.replayed`, `restack.publish-intended`, `restack.rewritten`, `restack.contended`, `restack.completed` |
3347
- | Post-PR [D1] | `pr.merged`, `pr.conflicted`, `reconcile.progress-checked`, `reconcile.started`, `reconcile.prepared`, `reconcile.replayed`, `reconcile.publish-intended`, `reconcile.rewritten`, `reconcile.contended`, `reconcile.completed` |
3592
+ | Leaf restacking | `target.moved {branch, sha, lineage?}`, `target.rewritten {branch, previousSha, sha}`, `target.rewrite-cleared {branch, sha, lineage?}`, advisory `target.distance {branch, sha, head, count}`, `restack.prepared`, `restack.replayed`, `restack.publish-intended`, `restack.rewritten`, `restack.contended`, `restack.completed` (trigger `verify-entry`, `wait-resume` or `awaiting-landing`), `restack.advanced {trigger: wait-resume, cycle, observation, branch, from, to}` |
3593
+ | Head path facts | advisory `head.paths-recorded {source, head, destination, mergeBase, total, preview, resolution?, artifact}` |
3594
+ | Post-PR [D1] | `pr.merged`, `pr.conflicted`, `reconcile.progress-checked`, `reconcile.started`, `reconcile.prepared`, `reconcile.replayed`, `reconcile.publish-intended`, `reconcile.rewritten`, `reconcile.contended`, `reconcile.completed`, kernel `reconcile.superseded {attempt, cycle, cause: wait-resume, restackId?}` (§11 "Ticket waits") |
3348
3595
  | Cross-cutting | `observation.recorded`, `escalation.raised`, `phase.failed`, `session.build-read-failed`, `session.build-read-recovered`, `phase.deferred`, `phase.deferral-escalated` |
3349
- | Repository journal | dispatcher setting facts; run lifecycle, effective config, tick/queue diagnostics, reload and runner outcomes; the `harvest.*` workflow, recovery, and ledger facts |
3596
+ | Ticket waits (§11) | Agent `wait.requested {id, phase, round, tickets, reason, publication?: {branch, base, sha, settlement: published \| requested}}`; dispatcher `wait.published {id, sha}`, `wait.refused {id, cause: unknown-ticket \| own-ticket \| completed \| no-source-ticket \| publication-lost, tickets, message}` and `wait.entered {id, escalation, tickets, reason, question}`; dispatcher, kernel or human `wait.ended {id, cause: operator \| automatic, message}`; dispatcher policy `escalation.raised {policyCause: wait-unresolvable}` ends an open wait whose ticket was rejected or deleted |
3597
+ | Repository journal | dispatcher setting facts; run lifecycle, effective config, tick/queue diagnostics, reload and runner outcomes; the `harvest.*` workflow, recovery, and ledger facts; `ticket-preparation.*` claim boundaries; `ticket.handed-back` and `ticket.handback-settled` |
3350
3598
 
3351
3599
  Abort cleanup is a dispatcher-owned ordered saga. While an execution lease is
3352
3600
  live, the janitor defers the saga so it cannot race process-tree teardown. Once
3353
3601
  that supervisor releases the lease, or an abruptly orphaned lease expires, cleanup
3354
3602
  closes an open unmerged PR without overriding a racing merge, releases the workspace,
3355
3603
  deletes the exact published remote branch and exact local branch, unions the
3356
- `autobuild:aborted` label into the current ticket labels, posts an abort notice, and returns the ticket to
3357
- configured Triage, and only then completes as `abandoned`. External effects are
3604
+ `autobuild:aborted` label into the current ticket labels, moves the ticket once
3605
+ to its destination and posts an abort notice, reports the hand-back, and only
3606
+ then completes as `abandoned`. The destination is configured Triage unless the
3607
+ request carried `to: ready`; then the ticket moves straight to configured Ready
3608
+ with its blockers untouched, or falls back to Triage, listing the missing parts,
3609
+ when its body no longer conforms to the spec standard. External effects are
3358
3610
  idempotent and the three `abort.*` facts checkpoint projections across crashes;
3359
- missing Forge capabilities or outages leave the remainder due on the next tick.
3611
+ `abort.ticket-returned` records the destination, the requested role, the reason
3612
+ and the missing parts, so a retry reports exactly what the committed move did
3613
+ and never writes the ticket again. Missing Forge capabilities or outages leave
3614
+ the remainder due on the next tick.
3615
+
3616
+ Every dispatcher hand-back of a claimed or ready ticket other than completion —
3617
+ abort, spec-standard bounce, preparation recovery returning a confirmed claim,
3618
+ closed-unmerged PR and discard — appends one repository `ticket.handed-back`
3619
+ only after its move is committed, and it is default watch attention. A build
3620
+ hand-back's identity is its slug: closed-PR and discard moves checkpoint as
3621
+ `build.ticket-returned`, and the dispatcher refreshes its repository view and
3622
+ skips the report when the reduced set of reported, unsettled identities already
3623
+ holds the slug, so an append whose acknowledgement was lost is never repeated.
3624
+ `ticket.handback-settled` follows `build.completed` and prunes the identity; a
3625
+ failed settlement is retried by a later tick, which keeps the reduced value
3626
+ bounded by in-flight hand-backs. A preparation hand-back's identity is its
3627
+ attempt, marked reported in the preparation reduction and pruned by its
3628
+ resolution.
3360
3629
 
3361
3630
  One deliberate subtlety worth recording: `pr.conflicted.baseSha` is
3362
3631
  detection-time evidence, while `reconcile.progress-checked.baseSha` is the
@@ -3511,8 +3780,13 @@ runner is attached; it does not acquire a leaf pipeline.
3511
3780
 
3512
3781
  `status ∈ queued | running | collecting | paused | blocked | done | aborted`, plus
3513
3782
  `{phase, round, openEscalations[], reviewRoundCeilings?, pr?, autoMerge,
3514
- lastEvent}`. `blocked` ≡ an `escalation.raised` without a matching
3515
- `escalation.answered`, matched by id. `reviewRoundCeilings` projects valid
3783
+ lastEvent}`. `blocked` ≡ an open escalation: an `escalation.raised` (or the
3784
+ escalation a `phase.deferral-escalated` or `wait.entered` opens) without a
3785
+ matching `escalation.answered`, matched by id; a ticket wait's escalation also
3786
+ closes on `wait.ended` and on a `wait-unresolvable` raise. `waitRequest` and
3787
+ `wait` project the latest ticket-wait request and entered wait (§11 "Ticket
3788
+ waits"); `wait.ended?: {cause: operator | automatic | unresolvable, seq,
3789
+ message}` is the wait's first end. `reviewRoundCeilings` projects valid
3516
3790
  review-limit answers independently for the plan and code loops after the latest
3517
3791
  `spec.revised`; status and dashboard surfaces expose any projected values.
3518
3792
  `paused` ≡ a `build.paused` without a later `build.resumed`, and takes
@@ -3905,6 +4179,28 @@ until publication. Confirmed publication reattaches the matching workspace HEAD
3905
4179
  to the build branch so a later verify → implement cycle can publish normally.
3906
4180
  Missing third-party forge capabilities refuse actionably.
3907
4181
 
4182
+ Every candidate head a build produces records the paths it changes, once per
4183
+ head, before the write that establishes it: finalize and finalize post-step
4184
+ pushes, automatic restacks, leaf reconciles, node rewrites and node
4185
+ integration cycles, on local and remote execution. `head.paths-recorded`
4186
+ names the producing `source`, the `head`, the `destination` it would land on
4187
+ and their `mergeBase`. Its paths are every path that differs between the
4188
+ merge base and the head with rename detection off, so a rename counts its old
4189
+ and new path and a deletion counts its path. A reconcile-produced head also
4190
+ carries `resolution`: the paths where the resolved head differs from the
4191
+ purely mechanical three-way replay of the build's change onto the
4192
+ destination, conflict markers included. Conflicted files the resolver
4193
+ settled and any extra edits count; changes that arrived cleanly from the
4194
+ destination do not. The complete sets live in an atomically deposited
4195
+ `head-paths` artifact; the event and build state carry only the exact
4196
+ `total` and a sorted `preview` of at most 100 paths, and build state keeps
4197
+ the newest four summaries, first per head. A head is "not recorded" until
4198
+ such a fact names it, which is distinct from "recorded and empty"; heads a
4199
+ build did not produce and heads that predate the fact read as not recorded.
4200
+ The dispatcher never derives the fact on a poll; merge-rule path predicates
4201
+ read it, and a reconcile's `resolution` decides protected consent revocation
4202
+ (§15.7).
4203
+
3908
4204
  Automatic leaf transactions use `restack.*`, independently of reconcile attempt
3909
4205
  numbers. Preparation freezes the trigger, verify-cycle boundary, absorbed target
3910
4206
  observation, old base/head, target base, single-change commit, workspace/local
@@ -3981,25 +4277,63 @@ observable regardless of trailer evidence.
3981
4277
 
3982
4278
  Ordered `[[merge]]` rules in `autobuild.toml` decide authorization. Each rule
3983
4279
  requires `mode = "auto" | "consent"` and may match `into = "root" | "node" |
3984
- <node-ticket-id>`, `from = "leaf" | "node"`, and an exact, case-sensitive
3985
- `label`. Predicates are ANDed; the first matching rule wins. Omitted predicates
3986
- match anything. With no match, leaves use auto and nodes require consent.
4280
+ <node-ticket-id>`, `from = "leaf" | "node"`, an exact, case-sensitive
4281
+ `label`, and the paths the candidate head changes: `paths` matches when at
4282
+ least one changed path matches a selector, `within` when every changed path
4283
+ matches and at least one path changed. Path selectors share the
4284
+ `[verify.<step>].paths` grammar and case sensitivity, and an invalid selector
4285
+ is rejected at load naming its rule index. Predicates are ANDed; the first
4286
+ matching rule wins. Omitted predicates match anything. With no match, leaves
4287
+ use auto and nodes require consent.
3987
4288
  The target is the immutable destination frozen at claim, not a ticket's current
3988
4289
  parent. Labels are sampled from a successful source-ticket read at readiness;
3989
4290
  unavailable ticket data defers the decision instead of supplying empty labels.
3990
4291
 
4292
+ Path predicates read only the candidate head's recorded head path fact: the
4293
+ reduced summary, plus one read of the complete `head-paths` artifact at
4294
+ decision time when a reached path rule needs paths beyond the preview. When
4295
+ evaluation reaches a path rule whose head has no recorded fact, the
4296
+ dispatcher appends one advisory `landing.deferred {candidate, reason, rule,
4297
+ policy}` and decides nothing; it never evaluates the head as an empty change.
4298
+ The deferral holds without further reads or evaluation until the candidate or
4299
+ the `[[merge]]` rules' identity changes, and `ab build status` explains it. A
4300
+ recorded empty change matches neither predicate. Protective path rules belong
4301
+ first, because first match still wins.
4302
+
3991
4303
  A leaf becomes ready after verification and finalize on a current base; a node
3992
- must be complete and verified at its exact head and parent. `landing.decided`
4304
+ must be complete and verified at its exact head and parent. A pending pause or
4305
+ abort defers readiness; a resume that only cancelled a never-acknowledged pause
4306
+ does not. `landing.decided`
3993
4307
  records that candidate, the sampled labels, resulting mode, and the full matched
3994
- rule and index (or explicit default). Editing configuration cannot change this
3995
- recorded decision. A replacement candidate gets a new decision once ready.
4308
+ rule and index (or explicit default). When the matched rule has a path
4309
+ predicate it also records the changed paths its selectors matched: the exact
4310
+ total and the first 20, sorted. Editing configuration cannot change this
4311
+ recorded decision. A replacement candidate gets a new decision once ready,
4312
+ evaluated on its own changed paths, and that decision governs: native
4313
+ auto-merge armed under the old decision is cancelled before a replacement head
4314
+ is published.
3996
4315
  Policy is live dispatcher configuration, outside the pinned execution pipeline.
3997
4316
 
3998
4317
  `ab hold <slug>` durably suppresses merge and revokes previous consent, even
3999
4318
  before readiness. `ab merge <slug>` requires readiness, clears hold, and consents
4000
4319
  to this build/node merge into its frozen destination. Consent survives head
4001
- replacement, restacking, verification and re-finalization until another hold or
4002
- completion. It is consent to the merge, not approval of an immutable diff.
4320
+ replacement, clean restacking, verification and re-finalization until another
4321
+ hold or completion. It is consent to the merge, not approval of an immutable diff.
4322
+ Consent given under a rule with `paths` or `within` predicates is the exception:
4323
+ the consent records that rule, and when a reconcile's own edits (its recorded
4324
+ `resolution`) touch a file those predicates match, the kernel appends
4325
+ decisive `landing.consent-revoked` naming the consent, rule, matched paths
4326
+ (sorted, first 20 plus total), and the previous and new heads. It is written
4327
+ where the leaf reconcile completion or node rewrite records the new head, before
4328
+ its publication intent, from recorded facts only; no poll derives it. The fact
4329
+ removes that consent only, so the build returns to the consent queue for its new
4330
+ head and needs fresh consent. Clean restacks record no resolution and keep
4331
+ consent, as do reconciles that edit no matched file and consent under rules
4332
+ without path predicates. Accepted node reparenting also revokes consent.
4333
+ The optional `ab merge <slug> --head <sha>` (operator `head`) refuses with
4334
+ `head-mismatch`, recording nothing, unless `<sha>` (full or at least seven
4335
+ characters) is the current candidate head. The consented head is the head of
4336
+ the recorded decision the consent named; `--head` does not change survival.
4003
4337
  Commands and acknowledgements are sequence-correlated; hold acknowledgement
4004
4338
  requires confirmed native cancellation, while merge acknowledgement accepts
4005
4339
  consent without claiming that merge gates passed. The same actions are available
@@ -4204,8 +4538,12 @@ ordinary boundary reload resumes.
4204
4538
 
4205
4539
  Merge policy is an ordered `[[merge]]` array. Each rule requires
4206
4540
  `mode = "auto" | "consent"` and may match `into = "root" | "node" | <node-ticket-id>`,
4207
- `from = "leaf" | "node"`, and an exact, case-sensitive `label`. Predicates
4541
+ `from = "leaf" | "node"`, an exact, case-sensitive `label`, and changed-path
4542
+ predicates `paths` (any changed path matches) and `within` (every changed path
4543
+ matches, at least one changed) over the candidate head's recorded paths, with
4544
+ the `[verify.<step>].paths` selector grammar. Predicates
4208
4545
  within a rule are ANDed; omitted predicates are wildcards; first match wins.
4546
+ A reached path rule without recorded paths defers the decision (§15.7).
4209
4547
  The destination is the frozen target identity, and labels are sampled when
4210
4548
  readiness is recorded. No matching rule, including no rules, means leaf auto /
4211
4549
  node consent. Policy is hot dispatcher-owned configuration, not pinned build
@@ -4274,6 +4612,11 @@ runtime = "pi"
4274
4612
  model = "moonshotai/kimi-k3"
4275
4613
  sessionBudgetSeconds = 7200 # optional role override
4276
4614
 
4615
+ [profiles.deep] # selected by a ticket labelled "deep" (§9)
4616
+ label = "deep"
4617
+ [profiles.deep.roles.implement] # overrides only the fields it names
4618
+ args = ["--effort", "high"]
4619
+
4277
4620
  [policy]
4278
4621
  upgradeDrainSeconds = 900 # local generation drain deadline, hot-reloaded
4279
4622
  dispatchLeaseTimeoutSeconds = 60 # repository dispatch lease lifetime without renewal
@@ -4331,7 +4674,7 @@ decide where a build's effective configuration is composed from:
4331
4674
  | Class | Sections | Source at deposit |
4332
4675
  |---|---|---|
4333
4676
  | 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). |
4334
- | 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. |
4677
+ | 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. |
4335
4678
  | Dispatcher-owned | `baseBranch`, `capacity`, `ticketScanIntervalSeconds`, `forge`, `plugins`, `pr`, `tickets`, `orchestrator`, `merge`, `upgrade` | The dispatcher's live snapshot; the build runner never interprets them. |
4336
4679
 
4337
4680
  Dispatcher lease sweeps may reuse parsed effective-config pins in a disposable
@@ -4651,7 +4994,8 @@ reapply the intended changes before retrying; conflicts are never merged.
4651
4994
  File and Linear revisions fingerprint kind, target, title, body, canonical label/blocker sets,
4652
4995
  state and urgent priority; file revisions also cover nonempty issue links. GitHub revisions
4653
4996
  fingerprint kind, target, title, body, canonical label/blocker sets, state and issue links,
4654
- including the ticket's own issue; GitHub tickets carry no comments. Reverting
4997
+ including the ticket's own issue; GitHub tickets carry no comments, and assignees
4998
+ are not part of a GitHub revision. Reverting
4655
4999
  identical content restores its fingerprint. File checks
4656
5000
  re-read immediately before writing, with the existing no-lock race window.
4657
5001
  Direct file edits and state-directory moves change revisions. File revisions also
@@ -4756,11 +5100,13 @@ The web dashboard consumes shared terminology without introducing a tree surface
4756
5100
  `ab merges [--json] [--store <ref>]` and registry `merges.list` expose the
4757
5101
  same deterministic, repository-scoped ready consent/held candidates. A recorded
4758
5102
  current decision is required; auto-authorized and consented candidates are absent.
5103
+ Queue entries and build status show the current candidate head and the head
5104
+ consent was given at (null without consent).
4759
5105
  Source `ab ticket tree` / `tickets.tree` enumerate all ticket states with listing
4760
5106
  diagnostics; effective build targets remain frozen independently of source metadata.
4761
5107
 
4762
5108
  Default watch attention includes `integration.verification-failed`, `integration.landed`, `node.item-conflicted`,
4763
- and conflicted `restack.replayed`. Derived `build.consent-ready` observations
5109
+ `landing.consent-revoked`, and conflicted `restack.replayed`. Derived `build.consent-ready` observations
4764
5110
  carry target, branch, candidate and the durable readiness entry position in the
4765
5111
  existing cursor envelope. Cursor identities retain readiness episodes across
4766
5112
  restart; a new candidate or exit/re-entry can wake again. Explicit event globs
@@ -4779,7 +5125,7 @@ by the shared projection vocabulary and reused by terminal and CLI text.
4779
5125
 
4780
5126
  Destination heads come only from the authoritative forge branch; dispatcher-host
4781
5127
  refs are never a fallback. Failed remote reads retain the accepted observation;
4782
- classified rate limits use repository forge degradation and cooldown. Changed
5128
+ dispatcher-classified rate limits use repository forge degradation and cooldown. Changed
4783
5129
  heads require immutable commit ancestry proof against the accepted target and
4784
5130
  the destination base already used by replay. Missing capability or failed proof
4785
5131
  defers new replay. A non-descendant without kernel lineage records
@@ -4831,7 +5177,7 @@ not consume `maxPhaseAttempts`. A seventh transient failure records
4831
5177
  error and six retries. Answering that escalation opens a fresh publication episode
4832
5178
  for the same retained intent without resetting agent phase failures. Pending
4833
5179
  publication keeps its workspace through backoff and unresolved exhaustion.
4834
- Classified rate limits retain repository cooldown and consume no publication
5180
+ Dispatcher-classified rate limits retain repository cooldown and consume no publication
4835
5181
  retry allowance. Rejected pushes, lease conflicts, dirty trees and unclassified
4836
5182
  errors retain their existing behavior.
4837
5183
 
@@ -4871,7 +5217,8 @@ one durable `dispatcher.kernel-git-unavailable` repository condition, node work
4871
5217
  waits, and `dispatcher.kernel-git-recovered` closes the condition once a clone
4872
5218
  succeeds.
4873
5219
 
4874
- A classified forge rate limit records repository degradation with `resetAt`.
5220
+ A rate limit the dispatcher classifies on its own authenticated request
5221
+ records repository degradation with `resetAt`.
4875
5222
  Forge work waits during cooldown; passing the deadline permits a recovery
4876
5223
  request; a successful probe records automatic recovery. An authorized operator
4877
5224
  may explicitly override erroneous recorded state with
@@ -4882,6 +5229,25 @@ success. A subsequent actual limit records a fresh cooldown. Hosted admission
4882
5229
  requires a schema-valid finite ISO `resetAt` no later than server time plus
4883
5230
  24 hours, inclusive; past deadlines remain valid. Rejection never clamps or
4884
5231
  invents a provider reset, and historical events remain readable.
5232
+
5233
+ Only the dispatcher's own forge pauses the repository. A limit on a request
5234
+ that carried no credential, or one seen by a build runner or phase session,
5235
+ says nothing about the dispatcher's credential: that process waits out its own
5236
+ reset locally (a dispatcher defers that work instead), and records one advisory
5237
+ `forge.credential-limited` fact per episode naming the process, whether the
5238
+ request was `unauthenticated` (with why) or used the process's own credential,
5239
+ and the reset. It is `ab watch` attention and appears as
5240
+ `forgeCredentialLimits` in `ab repository status` until its reset;
5241
+ `forge-clear` does not apply. Remote guests receive no forge credential: their
5242
+ GitHub API requests fail with a typed error naming `GITHUB_TOKEN or GH_TOKEN`
5243
+ instead of going out anonymously, and they prove ancestry through their
5244
+ workspace's Git. An unauthenticated limit therefore points at a process missing
5245
+ `GITHUB_TOKEN`/`GH_TOKEN` or a `gh` login, or at guest-side forge use that must
5246
+ run kernel-side. Runners and sessions still wait out a dispatcher-recorded
5247
+ cooldown, but a limit they hit on a shared token no longer pauses the
5248
+ dispatcher in advance; the dispatcher records it on its own next limited
5249
+ request.
5250
+
4885
5251
  Native merge application failures keep candidate-specific retry eligibility,
4886
5252
  including automatic decisions without a human command. Retries recheck consent,
4887
5253
  holds, verification and the exact candidate. Uncertain enables remain pending