@defrex/autobuild 1.7.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 (115) 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-state.ts +50 -2
  59. package/packages/core/src/kernel/log-index.ts +27 -1
  60. package/packages/core/src/kernel/node-polling.ts +13 -3
  61. package/packages/core/src/kernel/node-restack-state.ts +8 -1
  62. package/packages/core/src/kernel/node-restack-transaction.ts +45 -0
  63. package/packages/core/src/kernel/read-deferrals.ts +3 -1
  64. package/packages/core/src/kernel/read-facts.ts +28 -1
  65. package/packages/core/src/kernel/reducer-registry.ts +22 -1
  66. package/packages/core/src/kernel/reducer.ts +316 -17
  67. package/packages/core/src/kernel/target-observation.ts +2 -5
  68. package/packages/core/src/kernel/terminal-guard.ts +52 -3
  69. package/packages/core/src/kernel/ticket-handbacks.ts +40 -0
  70. package/packages/core/src/kernel/ticket-preparation.ts +12 -1
  71. package/packages/core/src/kernel/ticket-wait.ts +345 -0
  72. package/packages/core/src/kernel/verify-applicability.ts +9 -19
  73. package/packages/core/src/ontology.ts +1 -0
  74. package/packages/core/src/operator/annotations.ts +6 -0
  75. package/packages/core/src/operator/index.ts +3 -0
  76. package/packages/core/src/operator/protocol.ts +15 -2
  77. package/packages/core/src/operator/registry.ts +97 -5
  78. package/packages/core/src/operator/repository-events.ts +67 -0
  79. package/packages/core/src/ports/tickets/fake.ts +5 -0
  80. package/packages/core/src/ports/types.ts +3 -2
  81. package/packages/core/src/processes/build-execution-state.ts +30 -1
  82. package/packages/core/src/processes/build-runner.ts +150 -18
  83. package/packages/core/src/processes/dispatcher.ts +739 -97
  84. package/packages/core/src/processes/execution-no-progress.ts +22 -2
  85. package/packages/core/src/processes/phase-failure-budget.ts +1 -0
  86. package/packages/core/src/processes/publication-state.ts +6 -1
  87. package/packages/core/src/store/digest.ts +41 -2
  88. package/packages/core/src/store/reduced-reads.ts +4 -1
  89. package/packages/core/src/store/reducer-value-shapes.json +10108 -8432
  90. package/packages/core/src/store/remote/client.ts +28 -2
  91. package/packages/core/src/store/remote/protocol.ts +11 -1
  92. package/packages/core/src/store/remote/released-clients.json +11 -0
  93. package/packages/core/src/store/remote/released-reducer-values/1.8.0.json +29043 -0
  94. package/packages/core/src/store/remote/released-reducer-values/index.ts +2 -0
  95. package/packages/core/src/store/repo-state-events.ts +2 -0
  96. package/packages/core/src/store/types.ts +16 -0
  97. package/packages/core/src/testing/reduced-read-budget.ts +347 -0
  98. package/skills/code-review/SKILL.md +8 -0
  99. package/skills/finalize/SKILL.md +4 -0
  100. package/skills/guide/SKILL.md +125 -26
  101. package/skills/guide/references/integration-tree.md +7 -4
  102. package/skills/guide/references/merge-policy.md +78 -6
  103. package/skills/guide/references/migration-1.0.md +4 -2
  104. package/skills/guide/references/operator-api.md +26 -5
  105. package/skills/guide/references/plugin-authoring.md +1 -1
  106. package/skills/guide/references/remote-store-protocol.md +9 -1
  107. package/skills/guide/references/restacking.md +23 -4
  108. package/skills/guide/references/ticket-dependencies.md +9 -4
  109. package/skills/implement/SKILL.md +15 -1
  110. package/skills/operate/SKILL.md +104 -13
  111. package/skills/plan/SKILL.md +17 -2
  112. package/skills/plan-review/SKILL.md +8 -0
  113. package/skills/reconcile/SKILL.md +21 -5
  114. package/skills/tickets/SKILL.md +5 -4
  115. package/templates/hosted-service/package.json +2 -2
@@ -708,6 +708,30 @@ boundary in the reducer and log index, independently of reconcile identity.
708
708
  The advisory `pipeline.settled` fact records that the engine reached a leaf's
709
709
  `wait awaiting-pr`; `kernel/dispatch-capacity.ts` reads it so a finished build
710
710
  parked for its merge decision holds no slot.
711
+ Ticket waits (SPEC §11) span four seams. `cli/terminals.ts` (`waitOn`, routed
712
+ as `ab wait-on`) appends the agent's terminal `wait.requested`; the build
713
+ digest marks it pending. The dispatcher's lease-sweep pass validates a pending
714
+ request against the ticket source, adds `blockedBy`, and appends `wait.entered`
715
+ or `wait.refused`. `kernel/ticket-wait.ts` holds the reduced-state predicates
716
+ the engine, capacity, `ab context` and `ab build status` share: a pending
717
+ request decides `wait ticket-wait`, an entered wait parks the leaf without a
718
+ slot, and an ended one requests a `resume` slot. The digest's `ticketWait`
719
+ names each open wait, and the dispatcher's `releaseTicketWaits` stage, run once
720
+ per tick before the lease sweep's per-build pass, checks them all with one
721
+ batched `dependencyStates` read: all completed appends `wait.ended {cause:
722
+ automatic}`, and a rejected or deleted ticket raises `policy/wait-unresolvable`,
723
+ which the reducer reads as the wait's end (`ticketWaitRelease` decides). An implement declaration
724
+ publishes first: `waitOn` pushes locally before the fact, or deposits
725
+ `publication.requested {operation: wait}` that `cli/publication-settlement.ts`
726
+ completes with `wait.published`; `serviceWaitRequest` enters the wait only
727
+ after that. `waitResumeRestackCycle` in the same module is the engine's
728
+ wait-resume restack predicate, decided ahead of the plan and code loops against
729
+ `leafBaseInUse` (`kernel/leaf-restack-state.ts`), which target observation
730
+ shares. The runner's `restack()` replays published work through the guarded
731
+ automatic restack, fast-forwards an unpublished branch that has no commits the
732
+ target lacks and no uncommitted tracked changes (`advanceWaitResume`,
733
+ `restack.advanced`) and otherwise fails without discarding local work, and first supersedes a reconcile occurrence whose session
734
+ waited (`supersedeReconcile`, `reconcile.superseded`).
711
735
  The runner refreshes after workspace mutation and before constructing members;
712
736
  concurrent siblings settle before another stage is selected. Recovery and
713
737
  readiness compose live deployment settings onto the captured artifact revision.
@@ -1039,7 +1063,15 @@ defers destructive abort, discard, and terminal-PR cleanup while that lease is
1039
1063
  live, then resumes the event-checkpointed janitor saga that closes an unmerged PR,
1040
1064
  releases the workspace, deletes exact remote/local branch
1041
1065
  refs, unions `autobuild:aborted` into current ticket labels, returns the ticket to
1042
- Triage, and appends abandoned completion last. Forge close/delete operations are
1066
+ its destination, and appends abandoned completion last. The destination is
1067
+ `tickets.triageState` by default (and always for dashboard aborts); an abort
1068
+ requested with `--to ready` selects `tickets.readyState`, keeping `blockedBy`,
1069
+ unless the current ticket body fails the spec standard, in which case it falls
1070
+ back to triage and records the requested role and missing parts. The
1071
+ `abort.ticket-returned` checkpoint commits the move and comment, then the
1072
+ repository `ticket.handed-back` report is appended before abandoned completion;
1073
+ once that report exists the dispatcher writes nothing more to the ticket, so it
1074
+ is the safe boundary for a subsequent ticket move. Forge close/delete operations are
1043
1075
  optional API 1.2 capabilities so older plugins load but leave cleanup visibly due.
1044
1076
  AgentRunner failure causes and the exhaustion contract fixture are additive
1045
1077
  plugin API 1.3 surfaces; legacy failures without a cause retain permanent-bit
@@ -1644,8 +1676,10 @@ If a leaf spec revision arrives during an unfinished reconcile, the same reconci
1644
1676
  ### Leaf and reconcile restacking
1645
1677
 
1646
1678
  The kernel prepares a detached replay of one net build change on the base frozen
1647
- by `reconcile.started`. The contribution baseline is the initial branch-cut base
1648
- or latest successfully published restack/reconcile base. The resolver continues that one replay;
1679
+ by `reconcile.started`. The contribution baseline is the initial branch-cut base,
1680
+ the latest successfully published restack/reconcile base, or the target a
1681
+ `restack.advanced` fast-forward moved an unpublished branch onto, whichever is
1682
+ newest (`leafRestackedBase` and `leafBaseInUse`). The resolver continues that one replay;
1649
1683
  completion requires one parent at the frozen base and the build identity trailer.
1650
1684
  Historical merge completions retain their original shape and semantics.
1651
1685
 
@@ -1668,8 +1702,16 @@ A contended rewrite preserves the observed work and retries on the same base.
1668
1702
 
1669
1703
  `kernel/leaf-restack-state.ts` projects target observations, frozen transactions
1670
1704
  and cycle gates into the log index and persisted build facts. The engine selects
1671
- automatic kernel work before any verify action and after finalize post-steps when
1672
- the target moves. `reconcile-restack.ts` shares collapse, detached replay,
1705
+ automatic kernel work before any verify action, after finalize post-steps when
1706
+ the target moves, and, for an ended ticket wait whose accepted target differs
1707
+ from the base in use, before the declaring phase resumes (`wait-resume`, ahead
1708
+ of the plan and code loops). A wait-resume with no published work fast-forwards
1709
+ the local branch and records `restack.advanced` instead of replaying, only when
1710
+ that branch has no commits the target lacks and the workspace has no
1711
+ uncommitted tracked changes; a wait
1712
+ declared by an unintended reconcile occurrence on a moved target first abandons
1713
+ that occurrence with `reconcile.superseded`, then replays onto the new target
1714
+ (see Ticket waits above). `reconcile-restack.ts` shares collapse, detached replay,
1673
1715
  archive-before-replacement and expected-head publication mechanics. Automatic
1674
1716
  transactions emit `restack.*`; clean completion never starts a reconcile cycle.
1675
1717
  Pre-PR conflicts adopt the prepared replay through ordinary reconcile. Initial
@@ -1688,6 +1730,12 @@ Object packs retain newly introduced replay trees/blobs as well as commit bytes.
1688
1730
  Replay retention stores thin Git packs in bounded binary chunks, with a fixed-size completion manifest written only after every chunk is acknowledged. Digest-keyed chunks make interrupted writes retryable; incomplete uploads are never restored. Recovery validates all chunk sizes and the pack digest before installation, and requires the base objects (restoring node prefixes in order). Existing single-artifact base64 packs remain readable. Retained replay artifacts are read only when the requested commit is missing locally, never by idle polling.
1689
1731
 
1690
1732
 
1733
+ `kernel/head-paths.ts` records `head.paths-recorded` for every candidate head a
1734
+ build produces (finalize, post-step pushes, restacks, reconciles, node rewrites
1735
+ and integration cycles) before the write that establishes it, with the complete
1736
+ path sets in a `head-paths` artifact; `kernel/head-paths-state.ts` folds bounded
1737
+ summaries into build state and answers the current candidate's paths without Git.
1738
+
1691
1739
  GitHub archive push/fresh-fetch and rewrite contracts are manual opt-in cases in
1692
1740
  `ports/forge/github.live.integration.test.ts`, using `AB_RUN_LIVE_PORT_CONTRACTS=1` and an
1693
1741
  explicit disposable `AB_GITHUB_CONTRACT_REPO`. Offline transport tests are not
@@ -1814,8 +1862,15 @@ escape hatches independent of completeness and verification.
1814
1862
  ### Merge authorization
1815
1863
 
1816
1864
  The pure evaluator in `kernel/landing-policy.ts` chooses the first matching
1817
- `[[merge]]` rule. `kernel/landing-state.ts` reduces immutable candidate
1818
- decisions and persistent hold/merge commands. The dispatcher owns readiness,
1865
+ `[[merge]]` rule. Its `paths` and `within` predicates read the candidate
1866
+ head's recorded path facts (`kernel/head-paths-state.ts`), never git, and a
1867
+ reached path rule without recorded paths returns a deferral.
1868
+ `kernel/landing-state.ts` reduces immutable candidate decisions, deferrals and
1869
+ persistent hold/merge commands, keeping the path-predicate rule a consent was
1870
+ given under. `kernel/consent-revocation.ts` matches a reconcile's recorded
1871
+ resolution against that rule and appends `landing.consent-revoked` at the two
1872
+ places a resolution is recorded: leaf reconcile completion (`cli/terminals.ts`)
1873
+ and the node rewrite (`kernel/node-restack-transaction.ts`). The dispatcher owns readiness,
1819
1874
  ticket label sampling and native-state convergence. `kernel/landing-publication.ts`
1820
1875
  confirms native cancellation at local and trusted remote head-publication seams.
1821
1876
  Node merges retain the existing writer serialization and gate proof.
package/docs/cli.md CHANGED
@@ -47,6 +47,7 @@ Run `bun ab <command>`; `bun ab help <command>` lists flags and subcommands. See
47
47
  - `done` — Complete a producer phase.
48
48
  - `verdict` — Complete a review or verification phase.
49
49
  - `escalate` — Park the build with a question for external judgment.
50
+ - `wait-on` — Park the build on other tickets without holding a slot; it ends when the tickets complete or an operator answers.
50
51
  - `harvest` — Inspect or drive observation harvesting.
51
52
 
52
53
  Phase commands (`context`, `done`, `verdict`) use runner-scoped session authority: the runner starts phase agents, never your operator agent. See [Skills](skills.md).
@@ -203,7 +203,7 @@ advisory and does not revoke a still-valid credential.
203
203
  ## Admission and merge
204
204
 
205
205
  - **Tickets.** `[tickets]` sets the source and readiness criteria for admitting work.
206
- - **Merge.** Ordered, first-match `[[merge]]` rules on source and destination select automatic merge or explicit consent. See [Integrating related work](integration-overview.md#policy-authorizes-merge) for matching and defaults, [Working with your operator agent](operating.md) for consent and hold commands.
206
+ - **Merge.** Ordered, first-match `[[merge]]` rules on source, destination, label and changed paths select automatic merge or explicit consent. See [Integrating related work](integration-overview.md#policy-authorizes-merge) for matching and defaults, [Working with your operator agent](operating.md) for consent and hold commands.
207
207
  - **Reloads.** Build execution configuration is pinned; dispatcher policy and role settings reload live.
208
208
  - **Secrets** stay out of committed TOML.
209
209
 
@@ -443,7 +443,7 @@ any table header.
443
443
  - **Required:** Optional
444
444
  - **Reload:** Hot: next dispatcher action captures the accepted value. A running invocation keeps its captured values.
445
445
 
446
- **Description:** Builds running work at once for this repository. A build that finished its pipeline holds no slot while it waits for a merge decision; it is admitted ahead of new claims when it must run again. Unfinished paused and blocked work retains slots. Node reconcile and verification exclude their own blocked/paused descendants at admission; new claims use total occupancy. See [integration capacity](integration-tree.md).
446
+ **Description:** Builds running work at once for this repository. A build that finished its pipeline holds no slot while it waits for a merge decision, nor does a build waiting on other tickets; either is admitted ahead of new claims when it must run again. Other unfinished paused and blocked work retains slots. Node reconcile and verification exclude their own blocked/paused descendants at admission; new claims use total occupancy. See [integration capacity](integration-tree.md).
447
447
 
448
448
  **Constraints:** safe integer; > 0
449
449
 
@@ -704,7 +704,12 @@ fallback.
704
704
 
705
705
  An ordered list of strict merge rules. Predicates within one rule are ANDed;
706
706
  the first matching rule wins. Omitted predicates match everything. With no
707
- matching rule, leaves default to `auto` and nodes to `consent`.
707
+ matching rule, leaves default to `auto` and nodes to `consent`. Besides
708
+ `from`, `into` and `label`, a rule can match the paths a candidate head
709
+ changes: `paths` when any changed path matches, `within` when every one does.
710
+ Path selectors use the `[verify.<step>].paths` grammar. A head without
711
+ recorded changed paths defers a decision that reaches a path rule. See
712
+ [changed paths](merge-policy.md#changed-paths).
708
713
 
709
714
  The deprecated `[[landing]]` spelling accepts identical rules and emits a migration warning.
710
715
  Do not declare both spellings, even as empty arrays. `ab upgrade` migrates the
@@ -764,6 +769,32 @@ old key without changing policy values or order. See [deprecated spellings](merg
764
769
 
765
770
  **Constraints:** label must be nonblank (labels match exactly, including case)
766
771
 
772
+ #### `merge[].paths`
773
+
774
+ **TOML key:** `merge[].paths`
775
+
776
+ - **Type:** `array of string`
777
+ - **Default:** `omitted`
778
+ - **Required:** Optional
779
+ - **Reload:** Hot: next dispatcher action captures the accepted value. A running invocation keeps its captured values.
780
+
781
+ **Description:** Match when at least one changed path matches a selector. Same glob grammar and case sensitivity as `[verify.<step>].paths`.
782
+
783
+ **Constraints:** minimum length 1; Each item: Positive repository-relative globs with literal characters, *, ?, and whole-segment ** only. No NUL, absolute paths, backslashes, negation, empty or traversal segments, character classes, brace expansion or extglobs.
784
+
785
+ #### `merge[].within`
786
+
787
+ **TOML key:** `merge[].within`
788
+
789
+ - **Type:** `array of string`
790
+ - **Default:** `omitted`
791
+ - **Required:** Optional
792
+ - **Reload:** Hot: next dispatcher action captures the accepted value. A running invocation keeps its captured values.
793
+
794
+ **Description:** Match when every changed path matches a selector and at least one path changed.
795
+
796
+ **Constraints:** minimum length 1; Each item: Positive repository-relative globs with literal characters, *, ?, and whole-segment ** only. No NUL, absolute paths, backslashes, negation, empty or traversal segments, character classes, brace expansion or extglobs.
797
+
767
798
  #### `merge[].mode`
768
799
 
769
800
  **TOML key:** `merge[].mode`
@@ -3161,7 +3192,7 @@ state. Within a present table, `source` is required; `hosted` and `github` defau
3161
3192
  - **Required:** Optional
3162
3193
  - **Reload:** Hot: next dispatcher action captures the accepted value. A running invocation keeps its captured values.
3163
3194
 
3164
- **Description:** State used for spec-gate bounces, aborts, and closed-unmerged PRs.
3195
+ **Description:** State used for spec-gate bounces, aborts (unless `ab abort --to ready` with a ticket that meets the spec standard), and closed-unmerged PRs.
3165
3196
 
3166
3197
  **Constraints:** minimum length 1; state must be nonblank; Omission resolves to Backlog for Linear, triage for hosted and github, Triage for file/plugin sources.
3167
3198
 
@@ -3891,10 +3922,11 @@ action. Check the gates in this order:
3891
3922
  same source. This includes harvest proposals filed directly into the ready
3892
3923
  state. Plain dispatch output reports unresolved ids and cycles.
3893
3924
  6. **Capacity:** every unfinished build for this repository—including paused
3894
- and blocked builds—uses a slot. A build that has finished its pipeline and
3895
- waits for a merge decision holds none, but one that must re-verify or
3896
- reconcile is admitted ahead of new claims and reserves a slot while it
3897
- waits. Inspect `ab repository status`, `ab builds --queued` and
3925
+ builds and builds blocked on a question—uses a slot. A build that has
3926
+ finished its pipeline and waits for a merge decision holds none, and neither
3927
+ does a build waiting on other tickets. One that must re-verify or reconcile,
3928
+ or whose ticket wait ended, is admitted ahead of new claims and reserves a
3929
+ slot while it waits. Inspect `ab repository status`, `ab builds --queued` and
3898
3930
  `ab build status <slug>` rather than looking only for a live process.
3899
3931
  7. **Duplicate work:** a ready ticket already represented by an active build is
3900
3932
  deliberately excluded from the queue.
@@ -3971,9 +4003,17 @@ merge methods and forge capability requirements.
3971
4003
  `ab hold <slug>` durably suppresses merge and revokes previous consent, even
3972
4004
  before readiness. `ab merge <slug>` requires readiness, clears hold, and consents
3973
4005
  to this build/node merge into its effective destination. Consent survives head
3974
- replacement, restacking, verification and re-finalization until another hold or
3975
- completion. Accepted node reparenting revokes consent; holds survive.
4006
+ replacement, clean restacking, verification and re-finalization until another
4007
+ hold or completion. Consent given under a rule with `paths` or `within`
4008
+ predicates is revoked when a reconcile's own edits (its recorded resolution)
4009
+ touch a file those predicates match; `landing.consent-revoked` raises default
4010
+ attention naming the files and both heads, and the build returns to the consent
4011
+ queue for its new head. Accepted node reparenting revokes consent; holds survive.
3976
4012
  It is consent to the merge, not approval of an immutable diff.
4013
+ The optional `ab merge <slug> --head <sha>` (operator `head`) refuses with
4014
+ `head-mismatch`, recording nothing, unless `<sha>` (full or at least seven
4015
+ characters) is the current candidate head. The consented head is the head of
4016
+ the recorded decision the consent named; `--head` does not change survival.
3977
4017
  Commands and acknowledgements are sequence-correlated; hold acknowledgement
3978
4018
  requires confirmed native cancellation, while merge acknowledgement accepts
3979
4019
  consent without claiming that merge gates passed. The same actions are available
@@ -50,7 +50,7 @@ A ticket is claimed when it passes every gate:
50
50
 
51
51
  Others stay queued. Urgent tickets are claimed before normal ones, each in the source's order; priority never preempts a running build. See [Tickets and specs](tickets.md) for grooming and [Intake and harvest](intake.md) for proposed work.
52
52
 
53
- Each build gets its own workspace (local git worktree or remote sandbox) and a build-runner that owns its pipeline. Capacity caps the builds running work: a work build holds a slot until it finishes its pipeline (verification and finalize), even while paused or blocked. Once it waits for a merge decision it holds none; if its target moves or its PR conflicts, it waits for a slot ahead of new claims to restack, re-verify or reconcile. It keeps its workspace until it merges or closes, so retained workspaces can exceed `capacity` while running work cannot. An integration node holds a slot only while it verifies, not while collecting children. See [the integration tree](integration-overview.md).
53
+ Each build gets its own workspace (local git worktree or remote sandbox) and a build-runner that owns its pipeline. Capacity caps the builds running work: a work build holds a slot until it finishes its pipeline (verification and finalize), even while paused or blocked on a question. Once it waits for a merge decision it holds none; if its target moves or its PR conflicts, it waits for a slot ahead of new claims to restack, re-verify or reconcile. A work build waiting on other tickets (`ab wait-on`) also holds none, and when the wait ends it waits for a slot ahead of new claims to resume. Finished and waiting builds keep their workspaces, so retained workspaces can exceed `capacity` while running work cannot. An integration node holds a slot only while it verifies, not while collecting children. See [the integration tree](integration-overview.md).
54
54
 
55
55
 
56
56
  ## The log is the source of truth
@@ -58,7 +58,7 @@ bun ab ticket block <id> <blocker-id>
58
58
 
59
59
  ## Policy authorizes merge
60
60
 
61
- Ordered `[[merge]]` rules in `autobuild.toml` select `auto` or `consent`; the first match wins. Rules match source kind (`from`), destination (`into`), and ticket `label`. Without a match, leaves default to `auto` and nodes to `consent`.
61
+ Ordered `[[merge]]` rules in `autobuild.toml` select `auto` or `consent`; the first match wins. Rules match source kind (`from`), destination (`into`), ticket `label`, and changed paths (`paths`, `within`). Without a match, leaves default to `auto` and nodes to `consent`.
62
62
 
63
63
  ```toml
64
64
  # Leaves merge on the root automatically; everything else needs consent.
@@ -73,7 +73,7 @@ mode = "consent"
73
73
 
74
74
  Your operator agent manages consent:
75
75
 
76
- - `ab merge <slug>` records consent to a ready merge and clears a hold.
76
+ - `ab merge <slug>` records consent to a ready merge and clears a hold. `--head <sha>` refuses unless `<sha>` is the current candidate head.
77
77
  - `ab hold <slug>` suppresses merge, even before readiness, and withdraws consent.
78
78
 
79
79
  Neither control, nor automatic authorization, bypasses readiness, verification, forge checks, protection, or merge gates.
@@ -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
 
package/docs/operating.md CHANGED
@@ -74,7 +74,7 @@ sequence positions behind its head. If a cursor is too old, re-arm without
74
74
  recover the unavailable historical gap; status reconciliation does not restore
75
75
  one-off events from that gap.
76
76
 
77
- - **Default filter:** actionable attention only, such as escalations and ready merges awaiting consent. Add `--event` globs for routine lifecycle events.
77
+ - **Default filter:** actionable attention only, such as escalations and ready merges awaiting consent. Add `--event` globs for routine lifecycle events. Ticket waits beginning and ending are routine: follow them with `--event 'wait.*' --event escalation.answered`. A `wait-unresolvable` escalation, raised when a waited ticket is rejected or deleted, is ordinary attention.
78
78
  - **Starts now:** a fresh watch ignores history, so check current status too.
79
79
  - **Resumable:** pass the opaque cursor from the JSON output back with `--since` to receive events recorded while away within the hosted window described above. The final JSON line always carries one.
80
80
  - **Duration:** 30 minutes by default; `--timeout 0` keeps it open.
@@ -124,7 +124,8 @@ bun ab hold my-build
124
124
 
125
125
  - **`merge`** requires a ready build, clears its hold and grants consent to merge into its destination.
126
126
  - **`hold`** suppresses merge and revokes consent, even before the build is ready.
127
- - **Persistence:** consent survives head changes, restacks, verification and re-finalization until a hold or completion. Accepted node reparenting revokes it.
127
+ - **Reviewed head:** `merge --head <sha>` records consent only while `<sha>` is the current candidate head; otherwise it refuses with `head-mismatch` and records nothing.
128
+ - **Persistence:** consent survives head changes, clean restacks, verification and re-finalization until a hold or completion. Consent given under a `paths` or `within` rule is revoked, with `landing.consent-revoked` attention, when a reconcile's own edits touch a file the rule protects. Accepted node reparenting also revokes it.
128
129
 
129
130
  ## Choose an operator surface
130
131
 
@@ -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
@@ -38,6 +38,16 @@ bun ab build status example-build --json
38
38
  - Presence is advisory and allows multiple registrations. MCP repository status marks it `unavailable`, which is not evidence of absence. Termination attempts withdrawal; routine timeout/count re-arms keep the five-minute grace. SIGKILL and failed withdrawal rely on TTL expiry.
39
39
  - Dashboard and API share one lifecycle vocabulary.
40
40
 
41
+ When a leaf with an open pull request waits on the PR but has no landing decision for its current candidate, `ab build status <slug>` prints a `landing: undecided — <reason>` line, and `--json` includes an optional `landingUndecided` string. The reason names what is holding the decision back:
42
+
43
+ - an open session, a pause, a terminal state, an open escalation, or a pending pause or abort request;
44
+ - a compatibility deferral;
45
+ - a failed dispatcher janitor attempt, with its message and next attempt time;
46
+ - a latest build pipeline configuration the dispatcher cannot read, even when the build's verification pin is still readable;
47
+ - no recorded base for the merge candidate.
48
+
49
+ If none of these apply, the line says no refusal is recorded and the dispatcher decides at its next janitor poll. Repository-wide forge deferrals appear in `ab repository status`. When a decision is recorded for the current candidate, the line and the field are no longer shown.
50
+
41
51
  A local CLI can use a remote Store:
42
52
 
43
53
  <!-- seam-config:start -->
@@ -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