@defrex/autobuild 1.7.0 → 1.8.1

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 (116) hide show
  1. package/README.md +1 -1
  2. package/SPEC.md +316 -47
  3. package/docs/answering-blocked-builds.md +44 -3
  4. package/docs/architecture.md +62 -7
  5. package/docs/cli.md +1 -0
  6. package/docs/configuration-overview.md +1 -1
  7. package/docs/configuration.md +49 -9
  8. package/docs/dispatcher.md +1 -1
  9. package/docs/integration-overview.md +2 -2
  10. package/docs/integration-tree.md +7 -4
  11. package/docs/merge-policy.md +78 -6
  12. package/docs/migration-1.0.md +4 -2
  13. package/docs/operating.md +3 -2
  14. package/docs/operator-api.md +26 -5
  15. package/docs/operator-surfaces.md +10 -0
  16. package/docs/plugin-authoring.md +1 -1
  17. package/docs/remote-store-protocol.md +9 -1
  18. package/docs/restacking.md +23 -4
  19. package/docs/ticket-dependencies.md +9 -4
  20. package/docs/tickets.md +1 -1
  21. package/docs/troubleshooting.md +1 -1
  22. package/package.json +3 -3
  23. package/packages/core/src/cli/attention.ts +1 -0
  24. package/packages/core/src/cli/build-control.ts +65 -7
  25. package/packages/core/src/cli/context.ts +55 -14
  26. package/packages/core/src/cli/dashboard/actions.ts +13 -4
  27. package/packages/core/src/cli/dashboard/landing-display.ts +32 -8
  28. package/packages/core/src/cli/dashboard/model.ts +61 -8
  29. package/packages/core/src/cli/dashboard/render.ts +28 -3
  30. package/packages/core/src/cli/dashboard/tree.ts +9 -1
  31. package/packages/core/src/cli/help.ts +69 -7
  32. package/packages/core/src/cli/landings.ts +1 -1
  33. package/packages/core/src/cli/main.ts +60 -9
  34. package/packages/core/src/cli/publication-settlement.ts +10 -0
  35. package/packages/core/src/cli/status.ts +178 -12
  36. package/packages/core/src/cli/terminals.ts +197 -4
  37. package/packages/core/src/cli/wait.ts +1 -0
  38. package/packages/core/src/cli/watch.ts +71 -0
  39. package/packages/core/src/config/landing.ts +12 -0
  40. package/packages/core/src/config/path-selectors.ts +68 -0
  41. package/packages/core/src/config/schema.ts +40 -58
  42. package/packages/core/src/events/catalog.ts +17 -3
  43. package/packages/core/src/events/compatibility.ts +2 -1
  44. package/packages/core/src/events/head-paths-limits.ts +25 -0
  45. package/packages/core/src/events/payloads.ts +315 -20
  46. package/packages/core/src/events/policy.ts +21 -0
  47. package/packages/core/src/events/repository.ts +30 -1
  48. package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +247 -6
  49. package/packages/core/src/kernel/consent-revocation.ts +72 -0
  50. package/packages/core/src/kernel/dispatch-capacity.ts +19 -8
  51. package/packages/core/src/kernel/engine.ts +48 -8
  52. package/packages/core/src/kernel/head-paths-state.ts +63 -0
  53. package/packages/core/src/kernel/head-paths.ts +401 -0
  54. package/packages/core/src/kernel/landing-policy-identity.ts +20 -0
  55. package/packages/core/src/kernel/landing-policy.ts +55 -2
  56. package/packages/core/src/kernel/landing-readiness.ts +104 -9
  57. package/packages/core/src/kernel/landing-state.ts +44 -4
  58. package/packages/core/src/kernel/leaf-restack-base.ts +34 -0
  59. package/packages/core/src/kernel/leaf-restack-state.ts +22 -2
  60. package/packages/core/src/kernel/log-index.ts +27 -1
  61. package/packages/core/src/kernel/node-polling.ts +13 -3
  62. package/packages/core/src/kernel/node-restack-state.ts +8 -1
  63. package/packages/core/src/kernel/node-restack-transaction.ts +45 -0
  64. package/packages/core/src/kernel/read-deferrals.ts +3 -1
  65. package/packages/core/src/kernel/read-facts.ts +28 -1
  66. package/packages/core/src/kernel/reducer-registry.ts +22 -1
  67. package/packages/core/src/kernel/reducer.ts +316 -17
  68. package/packages/core/src/kernel/target-observation.ts +2 -5
  69. package/packages/core/src/kernel/terminal-guard.ts +52 -3
  70. package/packages/core/src/kernel/ticket-handbacks.ts +40 -0
  71. package/packages/core/src/kernel/ticket-preparation.ts +12 -1
  72. package/packages/core/src/kernel/ticket-wait.ts +345 -0
  73. package/packages/core/src/kernel/verify-applicability.ts +9 -19
  74. package/packages/core/src/ontology.ts +1 -0
  75. package/packages/core/src/operator/annotations.ts +6 -0
  76. package/packages/core/src/operator/index.ts +3 -0
  77. package/packages/core/src/operator/protocol.ts +15 -2
  78. package/packages/core/src/operator/registry.ts +97 -5
  79. package/packages/core/src/operator/repository-events.ts +67 -0
  80. package/packages/core/src/ports/tickets/fake.ts +5 -0
  81. package/packages/core/src/ports/types.ts +3 -2
  82. package/packages/core/src/processes/build-execution-state.ts +30 -1
  83. package/packages/core/src/processes/build-runner.ts +150 -18
  84. package/packages/core/src/processes/dispatcher.ts +739 -97
  85. package/packages/core/src/processes/execution-no-progress.ts +22 -2
  86. package/packages/core/src/processes/phase-failure-budget.ts +1 -0
  87. package/packages/core/src/processes/publication-state.ts +6 -1
  88. package/packages/core/src/store/digest.ts +41 -2
  89. package/packages/core/src/store/reduced-reads.ts +4 -1
  90. package/packages/core/src/store/reducer-value-shapes.json +10108 -8432
  91. package/packages/core/src/store/remote/client.ts +28 -2
  92. package/packages/core/src/store/remote/protocol.ts +11 -1
  93. package/packages/core/src/store/remote/released-clients.json +22 -0
  94. package/packages/core/src/store/remote/released-reducer-values/1.8.0.json +29043 -0
  95. package/packages/core/src/store/remote/released-reducer-values/index.ts +2 -0
  96. package/packages/core/src/store/repo-state-events.ts +2 -0
  97. package/packages/core/src/store/types.ts +16 -0
  98. package/packages/core/src/testing/reduced-read-budget.ts +347 -0
  99. package/skills/code-review/SKILL.md +8 -0
  100. package/skills/finalize/SKILL.md +4 -0
  101. package/skills/guide/SKILL.md +125 -26
  102. package/skills/guide/references/integration-tree.md +7 -4
  103. package/skills/guide/references/merge-policy.md +78 -6
  104. package/skills/guide/references/migration-1.0.md +4 -2
  105. package/skills/guide/references/operator-api.md +26 -5
  106. package/skills/guide/references/plugin-authoring.md +1 -1
  107. package/skills/guide/references/remote-store-protocol.md +9 -1
  108. package/skills/guide/references/restacking.md +23 -4
  109. package/skills/guide/references/ticket-dependencies.md +9 -4
  110. package/skills/implement/SKILL.md +15 -1
  111. package/skills/operate/SKILL.md +104 -13
  112. package/skills/plan/SKILL.md +17 -2
  113. package/skills/plan-review/SKILL.md +8 -0
  114. package/skills/reconcile/SKILL.md +21 -5
  115. package/skills/tickets/SKILL.md +5 -4
  116. package/templates/hosted-service/package.json +2 -2
@@ -83,11 +83,40 @@ spec → plan ⇄ plan-review → implement ⇄ code-review → verify:* → fin
83
83
  gate — urgent tickets first, then normal ones, each in the source's order —
84
84
  chooses a short immutable slug from the final conforming spec, and
85
85
  starts builds up to the top-level `capacity` bound, after slots reserved for
86
- integration nodes awaiting verification or reconcile and for finished builds
87
- waiting to re-verify or reconcile. `capacity` counts builds running work: a
88
- build that finished its pipeline holds no slot while it waits for a merge
89
- decision, though it keeps its workspace until it merges or closes. Priority
90
- never preempts a running build.
86
+ integration nodes awaiting verification or reconcile, for finished builds
87
+ waiting to re-verify or reconcile, and for builds whose ticket wait ended.
88
+ `capacity` counts builds running work: a build that finished its pipeline
89
+ holds no slot while it waits for a merge decision, though it keeps its
90
+ workspace until it merges or closes. Priority never preempts a running build.
91
+ - **Ticket waits.** A work build that cannot proceed until other tickets
92
+ complete parks without a slot. A phase agent ends its session with
93
+ `ab wait-on <ticket-id>... --reason <text>`, a terminal that needs no
94
+ ticket credential. In `implement` it requires a clean worktree and first
95
+ publishes the build's commits; a failed local push writes nothing, and a
96
+ lost remote publication refuses the wait. The dispatcher checks the ids on its next tick, while the
97
+ build keeps its slot: an unknown id, the build's own ticket or an already
98
+ completed ticket is refused, nothing is written to the ticket, and the
99
+ declaring phase re-runs with the refusal as its guidance. Accepted, the ids
100
+ join the build ticket's `blockedBy`, the build is blocked on an escalation
101
+ whose question begins `Waiting on`, and it holds no slot while keeping its
102
+ branch, workspace and completed phase work. The dispatcher ends the wait
103
+ (cause `automatic`) on its first tick after every named ticket completes;
104
+ while any is still open the wait stays in place. A named ticket that is
105
+ rejected or deleted can never complete: the dispatcher instead raises an
106
+ ordinary policy escalation, `wait-unresolvable`, naming the ticket and why.
107
+ It ends the wait (cause `unresolvable`), shows in the default attention
108
+ filter, and its answer resumes the declaring phase like a wait answer. An
109
+ operator may still end a wait early by answering its escalation (cause
110
+ `operator`). The build then takes a slot
111
+ ahead of new ticket claims. If its target moved, it first restacks onto the
112
+ target's current head (published work is replayed as one change, and a
113
+ conflict reconciles first; with nothing published, the branch fast-forwards
114
+ only when it has no commits the target lacks and no uncommitted tracked
115
+ changes, and otherwise the restack fails without discarding them), so the
116
+ resumed phase sees the merged blockers; an unchanged target resumes without
117
+ a restack. The declaring phase then re-runs at the same round or attempt. `ab build status` shows a `waiting on:` line naming the tickets,
118
+ and `ab builds` and both dashboards show the build as `waiting` on them.
119
+ Node builds cannot declare waits.
91
120
  - **Failed preparation.** Durable preparation facts protect the claim-to-build
92
121
  interval. Caught failures return tickets to Ready (invalid specs to Triage),
93
122
  after build-ownership readback at the selected slug and, for a keyed attempt,
@@ -135,7 +164,8 @@ spec → plan ⇄ plan-review → implement ⇄ code-review → verify:* → fin
135
164
  content-producing step commits selected files locally and finishes clean;
136
165
  the runner pushes the exact descendant SHA and confirms forge readback before recording success.
137
166
  - **Restacking and epilogue.** The kernel replays one net leaf change at verify
138
- entry and when its destination moves while awaiting merge. Clean replay
167
+ entry, when a ticket wait ends and its destination moved, and when its
168
+ destination moves while awaiting merge. Clean replay
139
169
  starts no agent; conflicts enter `reconcile`, then verification. The leaf
140
170
  terminates **merged** or **closed**. Transient leaf publication failures park
141
171
  on a durable six-retry schedule, independently of agent phase attempts.
@@ -401,7 +431,7 @@ The distinctions that change an administrator's answer:
401
431
  pending request and leave the same session retryable. A push
402
432
  happens at the implement terminal boundary or after the runner validates a
403
433
  successful content-producing finalize post-step. History rewrites (reconcile,
404
- leaf verify-entry and waiting restacks, and node restacks on demand; see
434
+ leaf verify-entry, wait-resume and waiting restacks, and node restacks on demand; see
405
435
  [restacking](references/restacking.md)) replace a branch only with an exact
406
436
  expected-head guard after archiving every recorded Git tip under
407
437
  `refs/autobuild/archive/<slug>/<sha>`.
@@ -496,7 +526,7 @@ under the preceding table.
496
526
  |---|---|---|---|
497
527
  | `baseBranch` | `"main"` | nonempty string | The branch builds branch from and target with their PR; what `reconcile` replays the build change onto. |
498
528
  | `ticketScanIntervalSeconds` | `60` | positive integer seconds | Hot-reloaded ready scan cadence; tick spacing is the floor, and same-repository merge/completion/abort forces an early scan. |
499
- | `capacity` | `1` | positive integer | Maximum builds running work at once for this repository; builds parked for a merge decision hold no slot. |
529
+ | `capacity` | `1` | positive integer | Maximum builds running work at once for this repository; builds parked for a merge decision or waiting on other tickets hold no slot. |
500
530
  | `forge` | `"github"` | nonblank string | Selects shipped `github` or `local-git`, or a plugin-registered Forge adapter. `github` authenticates with `GITHUB_TOKEN`, then `GH_TOKEN`, then the gh CLI's stored login. |
501
531
  | `plugins` | `[]` | array of unique nonblank module specifiers | Trusted Bun plugin modules loaded before dispatch, `ab ticket`, and scoped phase wiring. |
502
532
 
@@ -548,8 +578,18 @@ Rules are strict and blank predicates are rejected with their array index.
548
578
  | `into` | No | `root`, any `node`, or an exact frozen destination node ticket id. |
549
579
  | `from` | No | `leaf` or `node`. |
550
580
  | `label` | No | Exact, case-sensitive source ticket label sampled at readiness. |
581
+ | `paths` | No | Globs; matches when at least one path the candidate head changes matches. |
582
+ | `within` | No | Globs; matches when every changed path matches and at least one changed. |
551
583
  | `mode` | Yes | `auto` or `consent`. |
552
584
 
585
+ `paths` and `within` use the `[verify.<step>].paths` selector grammar, and
586
+ each candidate head is decided on its own recorded changed paths. When
587
+ evaluation reaches a path rule and the head's paths are not recorded, the
588
+ decision is deferred and `ab build status` says why; it is never treated as an
589
+ empty change. Put protective path rules first: a `paths` rule holding
590
+ sensitive files belongs ahead of a `within` rule releasing documentation. See
591
+ [merge policy](references/merge-policy.md#changed-paths).
592
+
553
593
  Help the human choose policy around their release process. A solo team can
554
594
  use one catch-all `mode = "auto"` rule. A team requiring a human's review
555
595
  for every merge can use one catch-all `mode = "consent"` rule. For release
@@ -1322,8 +1362,8 @@ own-build-read deferral and its answer resets no phase failures; reconcile no-pr
1322
1362
  while `round` remains occurrence scope. Answering a runner-failure cause re-arms
1323
1363
  only its matching phase and round. The phase-level `verify-failure-limit` cause
1324
1364
  explicitly re-arms all rounds for its verify target, while
1325
- `reconcile-no-progress`, `publication-retry-limit` and the setup-only cause reset
1326
- no phase-runner failures.
1365
+ `reconcile-no-progress`, `publication-retry-limit`, `wait-unresolvable` and the
1366
+ setup-only cause reset no phase-runner failures.
1327
1367
  The closed cause map forces every future policy condition to choose one of these
1328
1368
  semantics instead of inheriting behavior from a missing `round`. Runner failures
1329
1369
  while checking progress or refreshing the base therefore remain counted after a
@@ -1373,7 +1413,7 @@ state eligible.
1373
1413
  | `claimedState` | hosted, github: `doing` | optional nonempty string; forbidden by `file`, allowed for plugins | Workflow state `claim()` moves a ticket to when a build starts. |
1374
1414
  | `doneState` | hosted, github: `"done"` | optional nonblank string | Project completion state and merged-ticket transition; hosted and github tickets only. A github ticket is done when its issue is closed as completed. |
1375
1415
  | `createState` | — | optional, nonempty string | Default state for new tickets when a create does not name one. Absent = the provider's default (Linear: the team's default, e.g. Backlog; file: Triage; github: triage). |
1376
- | `triageState` | — | optional, nonempty string | State the dispatcher hands tickets back to for human triage — spec-gate bounces, aborted builds, closed-unmerged PRs. Absent = Linear: Backlog; hosted, github: triage; file/plugin: Triage. Must name a state the tracker actually has — a Linear team only has "Triage" when its triage feature is enabled. |
1416
+ | `triageState` | — | optional, nonempty string | State the dispatcher hands tickets back to for human triage — spec-gate bounces, aborted builds (unless `ab abort --to ready`), closed-unmerged PRs. Absent = Linear: Backlog; hosted, github: triage; file/plugin: Triage. Must name a state the tracker actually has — a Linear team only has "Triage" when its triage feature is enabled. |
1377
1417
  | `proposalState` | — | optional, nonempty string | State observation harvest files approved proposals into. Absent = the resolved `triageState`, which keeps the human grooming gate. Setting it to `readyState` waives that gate: harvested proposals dispatch without being read. Keep it distinct from `triageState` — see below. |
1378
1418
  | `backlogState` | — | optional nonblank string; every source | State that holds deliberately deferred work: the backlog role. Recommended (`ab init` writes `"backlog"` for file, hosted and github); unset means the role does not exist. Must differ, case-insensitively, from the ready, claimed, done, triage and proposal states and from `rejectedState`. |
1379
1419
  | `rejectedState` | — | optional nonblank string; every source | State that holds considered-and-declined work: the rejected role. Recommended (`ab init` writes `"rejected"` for file, hosted and github). On github it is an issue closed as not planned or duplicate. A ticket in it never resolves a blocker, even if the source counts it complete, and never keeps a node incomplete. Same distinctness rule. |
@@ -2177,8 +2217,12 @@ restack state and conflicting files remain in detail, along with every child's
2177
2217
  ticket id, title and live phase (or queued/merged), open-first counts, verification
2178
2218
  steps and current outcomes, repair instructions, and the merge rule. Cancelled
2179
2219
  children are omitted; historical missing titles or filenames are explicit.
2180
- A work build that finished its pipeline and must re-verify or reconcile shows
2181
- the same slot-wait alert on its row, and `ab builds` appends it to the phase.
2220
+ A work build that finished its pipeline and must re-verify or reconcile, or
2221
+ whose ticket wait ended (`resume`), shows the same slot-wait alert on its row,
2222
+ and `ab builds` appends it to the phase. A build whose only open escalation is
2223
+ its open ticket wait shows `WAITING` and a yellow (amber on the web)
2224
+ `waiting on <ids> — <reason>` line, distinct from a red `BLOCKED` question;
2225
+ `r` / RESUME answers the wait and ends it early.
2182
2226
 
2183
2227
 
2184
2228
  On a TTY, execution-mode `ab dispatch` renders one fixed interactive frame that fills the
@@ -2206,7 +2250,8 @@ while it runs. It keeps its last good value through failed reads and through
2206
2250
  headless ticks that publish no count, and shows `–` until its first read
2207
2251
  succeeds or when the source has no state counts (Linear). `queue` is the
2208
2252
  ready-ticket queue depth, and `active` is occupied capacity (every unfinished
2209
- build, plus finished builds running work again) against root `capacity`. Observation pressure is not a header counter: the
2253
+ build except one waiting on tickets, plus finished builds running work again)
2254
+ against root `capacity`. Observation pressure is not a header counter: the
2210
2255
  Harvest row shows a run's observations, and `ab harvest status` reports
2211
2256
  Harvest state.
2212
2257
  The execution-mode frontend checkpoints only the latest run start and the sampled
@@ -2291,7 +2336,8 @@ while remote or unsupported sessions rerun fresh with a recorded fallback reason
2291
2336
  Without a live agent, acknowledgement still waits for a safe boundary. During
2292
2337
  that window `p` appends
2293
2338
  the opposing resume request, cancels the stale pause, and projects the build
2294
- back to `RUNNING`. An acknowledged paused build offers only `r resume` and reads
2339
+ back to `RUNNING`. The cancelling resume holds back nothing, including merge
2340
+ readiness. An acknowledged paused build offers only `r resume` and reads
2295
2341
  `RESUMING` until the kernel acknowledges that request; there is no gesture to
2296
2342
  cancel a pending resume. Blocked takes visual precedence, including when the
2297
2343
  build is also operator-paused, and `r` opens the existing feedback field. Keys
@@ -2340,7 +2386,10 @@ dispatcher records an immutable decision when each candidate becomes ready.
2340
2386
  No rules means leaf auto / node consent. There is no claim-time default
2341
2387
  seeding or fan-out over existing builds. `ab merge <slug>` supplies consent to
2342
2388
  that merge and frozen destination; it survives replacement heads until hold
2343
- or completion. `ab hold <slug>` suppresses policy and withdraws consent.
2389
+ or completion, except that consent given under a rule with `paths` or `within`
2390
+ predicates is revoked (`landing.consent-revoked`) when a reconcile's own edits
2391
+ touch a file those predicates match. `--head <sha>` refuses with `head-mismatch`, recording nothing,
2392
+ unless `<sha>` is the current candidate head. `ab hold <slug>` suppresses policy and withdraws consent.
2344
2393
  The old `--auto-merge` / `--no-auto-merge` flags and `ab auto-merge` command
2345
2394
  are retired and return actionable errors; use merge rules and hold/merge.
2346
2395
 
@@ -2398,7 +2447,7 @@ to the build's event log and apply the same write-time checks.
2398
2447
  | Resume | `ab resume <slug> [--store <ref>]` | Select a `PAUSED` build and press `r`. | `build.resume-requested` |
2399
2448
  | Pause all | `ab pause --all [--store <ref>] [--json]` | Select the global row and press `p`. | `dispatcher.pause-set` (first), `dispatcher.intake-set`, then one `build.pause-requested` per `RUNNING` build |
2400
2449
  | Resume all | `ab resume --all [--store <ref>] [--json]` | Select the global row and press `r`. | `dispatcher.pause-set` (first), `dispatcher.intake-set`, then one `build.resume-requested` per `PAUSED` build |
2401
- | Consent to merge | `ab merge <slug> [--store <ref>]` | Select a ready build and press `l`. | `build.land-requested`, then `landing.command-acknowledged` |
2450
+ | Consent to merge | `ab merge <slug> [--head <sha>] [--store <ref>]` | Select a ready build and press `l`. | `build.land-requested`, then `landing.command-acknowledged` |
2402
2451
  | Restack node | `ab restack <node> [--store <ref>]` | CLI/tool request; normal safety gates apply. | `node.restack-requested`, then `node.restack-satisfied` |
2403
2452
  | Hold merge | `ab hold <slug> [--store <ref>]` | Select a build and press `o`, including before readiness. | `build.hold-requested`, then `landing.command-acknowledged` after native cancellation |
2404
2453
  | Answer blockers with guidance | `ab answer <slug> <text> [--store <ref>]` | Select a blocked build, press `r`, enter text, then Enter. | One `escalation.answered` with `resolution: guidance` per applicable blocker. |
@@ -2406,7 +2455,7 @@ to the build's event log and apply the same write-time checks.
2406
2455
  | Dismiss cited finding chains | `ab answer <slug> --dismiss [--store <ref>]` | CLI only; build detail names the command. | One `escalation.answered` with `resolution: dismiss-finding` per blocker that cites a real review finding. |
2407
2456
  | Revise spec from a file | `ab answer <slug> --revise-spec <file> [--store <ref>]` | CLI only; build detail names the command. | For leaves, human `escalation.answered` then kernel `spec.revised`; eligible nodes publish `spec.revised` with operator provenance. |
2408
2457
  | Re-import revised ticket spec | `ab answer <slug> --revise-spec-from-ticket [--store <ref>]` | CLI only; build detail names the command. | The same leaf answer or direct node `spec.revised` protocol. |
2409
- | Abort | `ab abort <slug> [--store <ref>]` | Select any non-terminal build and press `a`, then Enter to confirm (Escape cancels). | `build.abort-requested` |
2458
+ | Abort | `ab abort <slug> [--to triage\|ready] [--reason <text>] [--store <ref>]` | Select any non-terminal build and press `a`, then Enter to confirm (Escape cancels); the dashboard aborts to triage. | `build.abort-requested`, then repository `ticket.handed-back` after cleanup moves the ticket |
2410
2459
 
2411
2460
  The two `--all` forms and the global-row keys are one walk behind two surfaces.
2412
2461
  The repository pause is written first and intake second, both absolutely —
@@ -2425,9 +2474,10 @@ to park.
2425
2474
 
2426
2475
  Discard is dashboard-only and queued-only. After any launching execution has
2427
2476
  released its process-tree lease, the dispatcher releases a partial workspace,
2428
- returns the ticket to `[tickets].readyState`, and completes the old build as
2429
- `discarded`; a later tick may claim the ticket into a fresh build. This is not
2430
- abort: abort returns the ticket to Triage.
2477
+ returns the ticket to `[tickets].readyState`, reports one `ticket.handed-back`
2478
+ (cause `discard`), and completes the old build as `discarded`; a later tick may
2479
+ claim the ticket into a fresh build. This is not abort: abort hands the ticket
2480
+ back to Triage unless it asks for ready.
2431
2481
 
2432
2482
  Abort accepts queued, running, paused, or blocked builds. A live turn receives a
2433
2483
  cancellation signal and the runner acknowledges the request. Its execution
@@ -2438,9 +2488,25 @@ for runner suspension without a wall-clock force-exit deadline.
2438
2488
  The dispatcher defers cleanup while that lease is live, then performs the
2439
2489
  checkpointed, retry-safe cleanup: close an open unmerged PR, release the workspace,
2440
2490
  delete the exact remote and local build branches, preserve existing ticket labels
2441
- while adding `autobuild:aborted`, return the ticket to configured Triage, and post
2442
- an abort notice before
2443
- completing as `abandoned`. Missing
2491
+ while adding `autobuild:aborted`, hand the ticket back, and post an abort notice
2492
+ before completing as `abandoned`. The ticket moves once, straight to its
2493
+ destination: configured Triage by default, or `[tickets].readyState` with
2494
+ `ab abort --to ready` (or the registry's `to: "ready"`), with its `blockedBy`
2495
+ list unchanged, so a build waiting on other work gives up its slot and
2496
+ redispatches once its blockers merge. A ticket that no longer conforms to the
2497
+ spec standard falls back to Triage; the notice says so and lists what is
2498
+ missing. `--reason` is recorded on the request and quoted in the notice. A
2499
+ repeated identical abort is a no-op; a different destination or reason is
2500
+ refused. After the move is checkpointed the dispatcher appends one repository
2501
+ `ticket.handed-back` event carrying the ticket, build, `cause: abort`,
2502
+ destination `state` and `role`, `requested` when it fell back, `missing`, and
2503
+ `reason`; no later dispatcher write for that hand-back touches the ticket, so
2504
+ an operator may move it as soon as the event arrives. Act on that event, not on
2505
+ `build.aborted` or the build leaving `ab builds`: cleanup is asynchronous. Every
2506
+ other non-completion hand-back reports the same event once after its move —
2507
+ spec-gate bounces (`spec-bounce`, with `missing`), preparation recovery
2508
+ returning a confirmed claim to Ready (`preparation-failed`), closed-unmerged
2509
+ PRs (`pr-closed`) and discards (`discard`). Missing
2444
2510
  Forge cleanup capabilities or provider outages leave cleanup pending with an
2445
2511
  actionable diagnostic for the next tick.
2446
2512
 
@@ -2486,6 +2552,16 @@ newest is eligible: it durably supersedes older answers, which do not resurface
2486
2552
  after the winner is delivered. Destinations remain independent, and a new
2487
2553
  answer recorded after an earlier delivery is eligible for the next appropriate
2488
2554
  run. `finalize` and `reconcile` receive their own answers on their next attempt.
2555
+ An answer to a ticket wait's escalation, with any resolution, ends the wait
2556
+ early; the dispatcher ends it on its own once every waited ticket completes,
2557
+ or raises a `wait-unresolvable` escalation, whose answer routes the same way,
2558
+ when one is rejected or deleted. Either way the phase that declared it resumes at the same round or attempt once it
2559
+ holds a slot, on a checkout restacked onto the target's current head when the
2560
+ target moved; a reviewer's wait resumes that review round and never feeds the
2561
+ next producer. Its `$AB_CONTEXT_DIR/guidance.json` carries a `wait` block
2562
+ (`id`, `tickets`, `reason`, `outcome` `ended` or `refused`, `cause`,
2563
+ `message`), even after a bare retry or a `wait.ended`, which leave a one-line
2564
+ summary as the answer. A refused wait writes the same file with the refusal.
2489
2565
  In each of these routed cases, `ab context`
2490
2566
  writes the answer to `$AB_CONTEXT_DIR/guidance.json` in the build's workspace, and the
2491
2567
  receiving skill treats it as authoritative feedback for that round or attempt.
@@ -2493,8 +2569,8 @@ A producer round has one immediate feedback kind: on a guidance round,
2493
2569
  `$AB_CONTEXT_DIR/guidance.json` takes precedence over findings or the legacy
2494
2570
  single-report feedback. A referenced `verifyStageFailure` receipt remains
2495
2571
  available alongside guidance, with every failed report and cancelled/not-run
2496
- member; it is not erased by feedback precedence. A bare retry writes no
2497
- `$AB_CONTEXT_DIR/guidance.json` and displaces nothing: the resumed round still gets whatever
2572
+ member; it is not erased by feedback precedence. Except for a ticket wait, a
2573
+ bare retry writes no `$AB_CONTEXT_DIR/guidance.json` and displaces nothing: the resumed round still gets whatever
2498
2574
  the loop was already routing, such as the last review round's findings.
2499
2575
 
2500
2576
  `--dismiss` is per escalation. It answers only blockers that cite at least one
@@ -2644,6 +2720,13 @@ changes — falling back to the local workspace's `autobuild.toml` only when no
2644
2720
  deposit exists; the decision is reported unavailable only when neither source
2645
2721
  can supply a configuration, and that message names the missing artifact kind
2646
2722
  rather than a workspace path.
2723
+ An open-PR leaf parked on the PR with no landing decision for its current
2724
+ candidate shows a `landing: undecided` line (`landingUndecided` in JSON) naming
2725
+ why the dispatcher has not decided: an open session, a pause, an open
2726
+ escalation, a pending pause or abort request, a compatibility deferral, a failed
2727
+ dispatcher janitor attempt with its message and next attempt time, or a build
2728
+ pipeline configuration the dispatcher cannot read. Otherwise it says no refusal
2729
+ is recorded and the decision is due at the next poll.
2647
2730
  Observations are shown without `--events`; for `forge = "local-git"`, this is where a deferred merge
2648
2731
  names uncommitted work that collides with the squash. Autobuild leaves that work
2649
2732
  untouched and later dispatcher ticks retry automatically after the operator
@@ -2735,6 +2818,10 @@ The default watch reports actionable conditions only:
2735
2818
  is required. A read deferral asks for CLI/store repair before retry or guidance.
2736
2819
  A `build.janitor-escalated` escalation needs no answer to recover; a bare
2737
2820
  retry answer only brings the next attempt forward.
2821
+ - Build `landing.consent-revoked`: a reconcile's own edits touched files
2822
+ protected by the `paths` or `within` rule the merge consent was given under.
2823
+ It names the matched files and the previous and new heads; the build returns
2824
+ to the consent queue and needs fresh consent for its new head.
2738
2825
  - Build `build.merge-decision`: a finalized open PR
2739
2826
  with a recorded consent decision awaiting consent, an explicit hold, or a
2740
2827
  current actionable merge-gate deferral. Policy decisions not yet recorded and
@@ -2754,6 +2841,13 @@ The default watch reports actionable conditions only:
2754
2841
  events written before `claimed` existed report the certainty as not recorded.
2755
2842
  Each abandonment reports once as it lands; a fresh watch does not replay
2756
2843
  historical ones, and nothing clears or acknowledges it.
2844
+ - Repository `ticket.handed-back`: the dispatcher returned a claimed or ready
2845
+ ticket other than as completion, and the move is committed. `cause` is
2846
+ `abort`, `spec-bounce`, `preparation-failed`, `pr-closed` or `discard`; the
2847
+ payload carries the ticket, the build slug (or the preparation attempt), the
2848
+ destination `state` and `role`, `requested` when an abort to ready fell back,
2849
+ the spec-standard parts `missing`, and the operator's `reason`. Each hand-back
2850
+ emits it once; moving the ticket on receipt is never overridden.
2757
2851
  - `dispatcher.ticket-source-persistent`: degradation past its advertised
2758
2852
  reset time, once a tick started at or after reset has completed or failed
2759
2853
  with the episode still open; crossing reset alone is silent. Without a reset,
@@ -2988,6 +3082,11 @@ and acknowledge the lost historical gap. Never fall back to cursor zero.
2988
3082
  Checkpoint integrity errors are terminal; retired seed generations require an
2989
3083
  upgrade/restart and fresh attachment. Explicit MCP `builds.events` history is
2990
3084
  paged at 256 events with `cursor` and `hasMore`; follow every continuation.
3085
+ MCP `repository.events` is a connected agent's repository attention watch: it
3086
+ reads at most 256 journal positions after its cursor, with an optional wait of
3087
+ at most 30 seconds, and by default returns exactly the repository records this
3088
+ default watch reports. Its cursor advances past filtered events; omit it once
3089
+ for a baseline, and treat `cursor-too-old` as above.
2991
3090
 
2992
3091
  **`ab harvest status [--events N] [--json] [--store <ref>]`** projects the
2993
3092
  **`ab harvest status [--events N] [--json] [--store <ref>]`** projects the
@@ -38,8 +38,9 @@ still need the presence evidence described above and in
38
38
 
39
39
  Read the consuming repository's `autobuild.toml` and evaluate its effective
40
40
  [merge policy](merge-policy.md) for the actual ticket kinds, destinations and
41
- labels. Ordered `[[merge]]` rules use the first match; `from`, `into` and `label`
42
- predicates are ANDed, with omitted predicates acting as wildcards. Without a
41
+ labels. Ordered `[[merge]]` rules use the first match; `from`, `into`, `label`,
42
+ `paths` and `within` predicates are ANDed, with omitted predicates acting as
43
+ wildcards. `paths` and `within` match the paths the candidate head changes. Without a
43
44
  match, leaves default to auto and nodes to consent. Explain the resulting merge
44
45
  and consent flow to the human in plain terms. Ask when grooming does not make the
45
46
  destination choice clear. This decision is separate from workflow-state placement
@@ -105,7 +106,8 @@ idle node polling, so a slot freed in any tick goes to the node, not to a new
105
106
  claim. Its candidate occupancy excludes itself and capacity-bearing blocked or
106
107
  paused descendants, following accepted source-qualified build target ancestry.
107
108
  Running descendants and unrelated builds still count; ordinary blocked and
108
- paused work retains its slot for every other admission. Provisioning reserves
109
+ paused work retains its slot for every other admission, except a work build
110
+ parked by a ticket wait, which holds none. Provisioning reserves
109
111
  node occupancy before the runner starts. This exception never raises the budget
110
112
  for new claims. Status and both dashboards report actual occupancy, configured
111
113
  capacity, effective display capacity and the nodes using descendant-held slots.
@@ -178,7 +180,8 @@ own issue; landed child commits keep their own messages.
178
180
  Human forge merges are an explicit escape hatch, including while incomplete,
179
181
  paused or unverified. The janitor records human provenance and whether the actual
180
182
  merged head was verified, then completes the ticket. Closing without merge or
181
- aborting closes admission and returns the ticket to triage; already claimed
183
+ aborting closes admission and returns the ticket to triage (or ready with
184
+ `ab abort --to ready`); already claimed
182
185
  children retain their frozen destination.
183
186
 
184
187
  ### Node verification context
@@ -9,24 +9,64 @@ predicates are ANDed, omissions are wildcards, and the first match wins.
9
9
  | `from` | `leaf` or `node` |
10
10
  | `into` | `root`, any `node`, or an exact destination node ticket id |
11
11
  | `label` | An exact, case-sensitive source ticket label |
12
+ | `paths` | At least one changed path matches a selector |
13
+ | `within` | Every changed path matches a selector, and at least one path changed |
12
14
 
13
15
  Blank destinations and labels are invalid. With no match, leaves use auto and
14
16
  nodes consent. Destination means the frozen effective destination, not mutable
15
17
  source metadata. Successful source reads supply labels at readiness; unavailable
16
18
  data defers the decision rather than pretending labels are empty.
17
19
 
20
+ ### Changed paths
21
+
22
+ `paths` and `within` take the same selectors as `[verify.<step>].paths`:
23
+ positive, repository-relative, case-sensitive globs with `*`, `?` and
24
+ whole-segment `**`. An invalid selector is rejected when the configuration
25
+ loads, naming its rule, such as `merge[1].paths[0]`. The changed paths are the
26
+ ones the candidate head changes against its merge base with the destination,
27
+ as the build recorded when it produced that head. A rename counts both paths
28
+ and a deletion counts its path. Each candidate head is decided on its own
29
+ paths, and `landing.decided` records the paths the matched rule's selectors
30
+ matched: the first 20, sorted, with a total.
31
+
32
+ Evaluation never guesses a change. When it reaches a rule with a path
33
+ predicate and the candidate head's paths are not recorded, the decision is
34
+ deferred, recorded once and shown in `ab build status`; it is never evaluated
35
+ as an empty change. Only heads a build publishes are recorded, so a head
36
+ pushed to the branch outside a build stays deferred until the build publishes
37
+ a recorded head. A recorded empty change matches neither predicate. Rules
38
+ without path predicates decide without the fact.
39
+
40
+ First match still wins, so **protective rules belong first**: put a `paths`
41
+ rule that holds sensitive files ahead of any `within` rule that releases the
42
+ rest. See [Protected paths](#protected-paths).
43
+
18
44
  A leaf is ready after verification and finalize on a current base; a node must
19
45
  be complete and verified at its exact head and parent. `landing.decided` retains
20
46
  that candidate, labels, mode and the full matched rule/index or explicit default.
21
47
  Editing configuration does not revise that decision. A replacement candidate
22
- gets a fresh decision. Policy is live dispatcher configuration, separate from
23
- the pinned execution pipeline.
48
+ gets a fresh decision, evaluated on its own changed paths, and that decision
49
+ governs. A reconcile or restack head can therefore match a different rule: a
50
+ documentation change that merged automatically waits for consent once its new
51
+ head touches a protected file. Native auto-merge armed under the old decision
52
+ is cancelled before the new head is published. Policy is live dispatcher
53
+ configuration, separate from the pinned execution pipeline.
24
54
 
25
55
  `ab hold <slug>` suppresses merge and revokes consent, even before readiness.
26
56
  `ab merge <slug>` requires readiness, clears hold and consents to this merge
27
- into its destination. Consent survives head replacement, restacking, verification
28
- and re-finalization until hold or completion; it approves the merge rather than
29
- an immutable diff. Accepted node reparenting revokes it. Commands and receipts
57
+ into its destination. Consent survives head replacement, clean restacking,
58
+ verification and re-finalization until hold or completion; it approves the merge
59
+ rather than an immutable diff. Consent given under a rule with `paths` or
60
+ `within` predicates is revoked when a reconcile's own edits (its recorded
61
+ resolution) touch a file those predicates match: `landing.consent-revoked`
62
+ raises default attention naming the files and both heads, and the build returns
63
+ to the consent queue for its new head. Accepted node reparenting also revokes
64
+ consent.
65
+ `ab merge <slug> --head <sha>` binds consent to the head the reviewer saw: it
66
+ refuses with `head-mismatch`, recording nothing, unless `<sha>` (full or at
67
+ least seven characters) is the current candidate head. Build status and the
68
+ consent queue show the current candidate head beside the head consent was
69
+ given at; `--head` does not change survival. Commands and receipts
30
70
  are sequence-correlated: hold acknowledgement confirms native cancellation;
31
71
  merge acknowledgement does not claim gates passed. MCP/operator tools offer the
32
72
  same actions; the terminal uses `l`/`o`. These controls record durable actions; merge consent does not mean the merge gates have passed.
@@ -99,6 +139,38 @@ other leaves match rule 3. `Review` does not match `review`. Moving the catch-al
99
139
  to the front would shadow both safeguards and automatically authorize nodes too.
100
140
  Authorization never bypasses verification, checks, protection or merge gates.
101
141
 
142
+ ### Protected paths
143
+
144
+ ```toml
145
+ baseBranch = "main"
146
+
147
+ [[merge]]
148
+ paths = ["autobuild.toml", ".agents/**", "SPEC.md", "docs/policy/**"]
149
+ mode = "consent"
150
+
151
+ [[merge]]
152
+ within = ["docs/**", "README.md"]
153
+ mode = "auto"
154
+
155
+ [[merge]]
156
+ mode = "consent"
157
+
158
+ [tickets]
159
+ source = "file"
160
+ readyState = "ready"
161
+ ```
162
+
163
+ Rule 1 holds any change that touches a protected file, whatever else it
164
+ changes. Rule 2 merges changes confined to documentation automatically. Every
165
+ other change matches rule 3 and waits for consent. Protective rules belong
166
+ first: placed after rule 2, a documentation change under `docs/policy/**` would
167
+ match rule 2 and merge automatically.
168
+
169
+ Consent given under rule 1 lasts only while the reviewed protected change does.
170
+ A clean restack keeps it, and so does a reconcile that resolves conflicts
171
+ without editing a protected file. A reconcile whose resolution edits a protected
172
+ file revokes it, and the new head needs fresh consent.
173
+
102
174
  ## Merge methods
103
175
 
104
176
  Root-target leaves squash into one identity-bearing commit per build.
@@ -192,5 +264,5 @@ unsupported spellings require the reported manual edit before retrying.
192
264
 
193
265
  MCP discovery offers `merges.list` and its deprecated alias `landings.list`.
194
266
  `builds.control` accepts canonical `merge` and deprecated `land` actions through
195
- both MCP bindings. HTTP control bodies and durable event fields retain their
267
+ both MCP bindings, with an optional `head` that binds consent like `--head`. HTTP control bodies and durable event fields retain their
196
268
  existing wire names, including `land`, `landing.decided`, and `integration.landed`.
@@ -52,8 +52,10 @@ Execution pipeline configuration stays owned by the build and is re-pinned
52
52
  from its checkout at each verify cycle; live dispatcher
53
53
  merge policy is separate. A recorded readiness decision retains its rule
54
54
  snapshot despite configuration edits; a new candidate receives a new decision.
55
- Explicit consent persists through replay and re-verification until hold or
56
- completion, except accepted node reparenting revokes it.
55
+ Explicit consent persists through clean replay and re-verification until hold
56
+ or completion, except accepted node reparenting revokes it, and a reconcile
57
+ whose own edits touch files protected by the consent rule's `paths` or `within`
58
+ predicates revokes it.
57
59
 
58
60
  ## The reversed rebase ban
59
61
 
@@ -124,7 +124,7 @@ JSON bodies are strict: unknown fields are rejected.
124
124
 
125
125
  | Method and path | Body |
126
126
  |---|---|
127
- | `POST …/builds/{slug}/control` | `{"action":"pause"\|"cancel-pause"\|"resume"\|"abort"\|"discard"\|"land"\|"hold"}` |
127
+ | `POST …/builds/{slug}/control` | `{"action":"pause"\|"cancel-pause"\|"resume"\|"abort"\|"discard"\|"land"\|"hold"}`; `land` alone accepts an optional `"head":"<sha>"` (full or at least seven characters) that binds consent to that candidate head. Abort alone also accepts `"to":"triage"\|"ready"` (default triage) and a `"reason"` of 1–2000 characters after trimming, as `ab abort --to/--reason` does. Ready requires the current ticket to meet the spec standard; otherwise cleanup returns it to triage and the hand-back comment and `ticket.handed-back` event carry the `requested` role and `missing` parts. Repeating an identical pending abort is idempotent; a repeat with a different destination or reason is refused. |
128
128
  | `POST …/builds/{slug}/restack` | Empty body; durable node restack demand. |
129
129
  | `POST …/builds/{slug}/answer` | One answer variant described below. |
130
130
  | `PUT …/settings/intake` | `{"enabled":boolean}` |
@@ -225,7 +225,9 @@ refusal` and preserve the shared `BuildControlError` code and exact reason text.
225
225
  A `land` control whose merge candidate is not ready is refused with code
226
226
  `merge-not-ready`, and its reason names the unmet condition; a node that fails
227
227
  the live completeness check is refused with code `node-incomplete`, naming any
228
- open children. Neither records consent or starts a merge, so refresh the
228
+ open children. A `land` whose `head` is not the current candidate head is
229
+ refused with code `head-mismatch`, and its reason names the current head.
230
+ None of these records consent or starts a merge, so refresh the
229
231
  build's status and retry once the reason is resolved.
230
232
  A partial bulk failure uses code `bulk-partial` and includes the durable write
231
233
  progress and unattempted builds. Unexpected failures are `500 internal`.
@@ -288,8 +290,10 @@ The default watch reports actionable conditions only:
288
290
  - `build.janitor-escalated`: a build's janitor failure episode outlasted `policy.janitorFailureEscalationSeconds` and raised one escalation naming the operation, last error, attempt count and episode start. The janitor keeps retrying; a successful attempt closes the escalation, and a bare retry answer attempts on the next tick.
289
291
  - `dispatcher.forge-persistent`: forge degradation remains after a completed post-reset retry opportunity; successful recovery clears it.
290
292
 
291
- - Build `escalation.raised`, `integration.landed`, `node.item-conflicted`, `target.rewritten`, or
292
- conflicted `restack.replayed` events. `build.consent-ready` is the single
293
+ - Build `escalation.raised`, `integration.landed`, `node.item-conflicted`, `target.rewritten`,
294
+ `landing.consent-revoked` (protected merge consent revoked by a reconcile's
295
+ edits, naming the matched files and both heads), or conflicted
296
+ `restack.replayed` events. `build.consent-ready` is the single
293
297
  signal for a ready consent or held merge, including first repository-wide
294
298
  discovery. Its target has the queue entry shape `{kind, branch, ticket?, build?}`.
295
299
  Unready and stale candidates stay silent. `build.merge-decision` remains for
@@ -310,6 +314,12 @@ The default watch reports actionable conditions only:
310
314
  events written before `claimed` existed report the certainty as not recorded.
311
315
  Each abandonment reports once as it lands; a fresh watch does not replay
312
316
  historical ones, and nothing clears or acknowledges it.
317
+ - Repository `ticket.handed-back`: a claimed or ready ticket was returned other
318
+ than as completion (`cause` `abort`, `spec-bounce`, `preparation-failed`,
319
+ `pr-closed` or `discard`), with its destination `state` and `role`, the build
320
+ or preparation attempt, and any `requested` role, `missing` spec parts and
321
+ `reason`. It is appended once, only after the move is committed, so moving
322
+ the ticket on receipt is never overridden.
313
323
  - `dispatcher.ticket-source-persistent`: degradation past its advertised
314
324
  reset time, once a tick started at or after reset has completed or failed
315
325
  with the episode still open; crossing reset alone is silent. Without a reset,
@@ -371,6 +381,15 @@ complete history without omission. Waiting remains bounded and applies only
371
381
  when no events are available. Repository event reads have a 1,000-position
372
382
  window; build history itself remains available through explicit pages.
373
383
 
384
+ The MCP `repository.events` tool delivers the same repository attention to a
385
+ connected agent. It takes `{repo, cursor?, waitSeconds?, filter?}` and returns
386
+ `{events, cursor, hasMore}`: one bounded read of at most 256 journal positions
387
+ after `cursor`, filtered by default (`filter: "attention"`) to exactly the
388
+ repository records the CLI default watch reports, or every event with
389
+ `filter: "all"`. The returned cursor is the last scanned position, so it
390
+ advances past filtered events. Omitting `cursor` returns no events and a
391
+ baseline cursor; an expired cursor fails with `code: "cursor-too-old"`.
392
+
374
393
 
375
394
  Hosted ticket tools resolve independent project ticket policy, including its
376
395
  backlog and rejected roles for role moves, before legacy uploaded configuration. Queue, detail, state discovery and mutations work before any build
@@ -389,7 +408,9 @@ to CLI, HTTP and MCP alike; unsupported sources refuse even explicit defaults
389
408
  or clears before changing other fields. Dispatch routing is unchanged.
390
409
 
391
410
  HTTP merge controls retain the wire actions `land` and `hold` with acknowledged durable state. Merge
392
- requires readiness and survives restacks; hold persists until merge. Repository
411
+ requires readiness and survives clean restacks, except that a reconcile editing
412
+ files protected by the consent rule's `paths` or `within` predicates revokes it;
413
+ hold persists until merge. Repository
393
414
  auto-merge settings are retired; configure ordered `[[merge]]` rules.
394
415
 
395
416
  Default attention includes `build.janitor-failing`, `build.janitor-escalated` and
@@ -31,7 +31,7 @@ All four manifest maps have production selectors. Omitted forge and workspace se
31
31
 
32
32
  ### `ticket-source`
33
33
 
34
- Lists, gets and claims tickets to start builds; receives comments, transitions, creates and updates. Owns lifecycle names, dependency completion, idempotent creation with a stable external creation-key projection, and partial-list diagnostics. Never consulted mid-build; not artifact storage.
34
+ Lists, gets and claims tickets to start builds; receives comments, transitions, creates and updates. Owns lifecycle names, dependency completion, idempotent creation with a stable external creation-key projection, and partial-list diagnostics. A build never consults it mid-build. The dispatcher reads tickets and adds blockers to validate a declared ticket wait, and while any ticket wait is open it makes one batched `dependencyStates` read per tick to release waits whose tickets completed and escalate waits on rejected or deleted tickets. Not artifact storage.
35
35
 
36
36
  ### `agent-runtime`
37
37
 
@@ -721,7 +721,7 @@ without a journal record, or a repository without builds.
721
721
  | `ensureRepo` | `POST /repos` | `{"repo": string}` with a nonempty id | `200` + `RepositoryRecord`; idempotently returns the existing record |
722
722
  | `getRepo` | `GET /repos/{repo}` | none | `200` + `RepositoryRecord`; absent is `404` (the shipped client maps this to `null`) |
723
723
  | `appendRepo` | `POST /repos/{repo}/events` | event write | `201` + repository event envelope |
724
- | `getRepoEvents` | `GET /repos/{repo}/events?since={n}&wait={s}` | optional `since` query value, parsed as in section 3; absence defaults to `0`. Optional `wait` in whole seconds, per the event-wait rules of section 3 | `200` + envelopes with `seq > since`, up to the frozen head; `409 cursor-too-old` below `max(0, head - 1000)` |
724
+ | `getRepoEvents` / `getRepositoryTail` | `GET /repos/{repo}/events?since={n}&through={n}&wait={s}` | optional `since` query value, parsed as in section 3; absence defaults to `0`. Optional `wait` in whole seconds, per the event-wait rules of section 3 | `200` + envelopes with `seq > since`, up to the frozen head; optional `through` caps the response at `seq <= through`; `409 cursor-too-old` below `max(0, head - 1000)` |
725
725
  | `getRepoStateEvents` | `GET /repos/{repo}/state-events` | none | `200` + the bounded repository-journal subset (AUT-489): every durable event type (`ticket-preparation.*`, `harvest.*`, `orchestrator.sandbox.*`, the three dispatcher setting types, and cross-generation handoff correlation facts: target-prepared, yield-requested, upgrade-failed, handoff-started, terminal-released, takeover, drain-deadline, drain-settled and handoff-completed) plus the latest-only `dispatcher.ticket-scan-completed` and `dispatcher.placement-set` facts and, when the journal has one, the tail from the latest `dispatcher.run-started`, in increasing sequence order; served inside the repository-existence gate like `GET events`, so an unknown repository is `404` |
726
726
  | `getReducerSnapshot` (repo scope) | `GET /repos/{repo}/snapshots/{reducer}?version={n}` | required `version` query value, a positive integer; `reducer` is a registry name (`^[A-Za-z][A-Za-z0-9._-]{0,63}$`) | `200` + `{"version", "cursor", "state"}` or `200 null` when absent, written by another reducer version, ahead of the journal's tail, or the repository has no journal record; an unknown repository is `404`, which the shipped client also maps to `null` |
727
727
  | `putReducerSnapshot` (repo scope) | `PUT /repos/{repo}/snapshots/{reducer}` | `{"version": int >= 1, "cursor": int >= 0, "state": JSON}`, at most 16 MiB (`413` above) | `200 {"written": boolean}`; the stored cursor never decreases, so a write at an equal or lower cursor (or an equal cursor at an equal or lower version) and one past the journal's tail answer `written: false` |
@@ -781,6 +781,14 @@ protocol version: older clients ignore it. A client that needs it and gets an
781
781
  answer without it, from an older service, fails with a typed error instead of
782
782
  reading each build's facts.
783
783
 
784
+ `waitPending` (`true` while a declared ticket wait awaits the dispatcher's
785
+ check) and `ticketWait` (`{id, escalation, tickets}` while an entered ticket
786
+ wait is open) let a hosted dispatcher service ticket waits from digests alone.
787
+ Both are additive and keep the protocol version; older clients ignore them. An
788
+ older service that omits `ticketWait` yields no automatic release: open waits
789
+ then end only when an operator answers them, and the client never rebuilds the
790
+ field from events.
791
+
784
792
  The digest is derived from the event log on every call — the server persists
785
793
  nothing and there is no refresh step. Protocol version `3` reshaped the
786
794
  digest's `observations` from bare sequence numbers to `{seq, ts}` pairs and