@defrex/autobuild 1.5.0 → 1.6.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 (74) hide show
  1. package/README.md +1 -1
  2. package/SPEC.md +85 -14
  3. package/docs/answering-blocked-builds.md +7 -4
  4. package/docs/architecture.md +38 -10
  5. package/docs/configuration.md +55 -5
  6. package/docs/dispatcher.md +2 -2
  7. package/docs/glossary.md +1 -1
  8. package/docs/operating.md +1 -1
  9. package/docs/operator-api.md +14 -2
  10. package/docs/plugin-authoring.md +4 -0
  11. package/docs/remote-store-protocol.md +14 -4
  12. package/docs/restacking.md +4 -0
  13. package/docs/tickets.md +1 -1
  14. package/docs/troubleshooting.md +1 -1
  15. package/package.json +3 -3
  16. package/packages/core/src/cli/attention.ts +2 -0
  17. package/packages/core/src/cli/dashboard/model.ts +14 -4
  18. package/packages/core/src/cli/dashboard/poll.ts +14 -0
  19. package/packages/core/src/cli/dashboard/render.ts +3 -0
  20. package/packages/core/src/cli/dispatch-preflight.ts +4 -1
  21. package/packages/core/src/cli/dispatch-tickets.ts +47 -0
  22. package/packages/core/src/cli/dispatch-upgrade-controller.ts +3 -0
  23. package/packages/core/src/cli/dispatch.ts +368 -98
  24. package/packages/core/src/cli/help.ts +4 -2
  25. package/packages/core/src/cli/repo-lease.ts +225 -0
  26. package/packages/core/src/cli/repository-status.ts +3 -1
  27. package/packages/core/src/cli/status.ts +13 -13
  28. package/packages/core/src/cli/wait.ts +4 -1
  29. package/packages/core/src/cli/watch.ts +15 -4
  30. package/packages/core/src/config/schema.ts +38 -2
  31. package/packages/core/src/events/catalog.ts +2 -0
  32. package/packages/core/src/events/payloads.ts +15 -0
  33. package/packages/core/src/events/policy.ts +2 -0
  34. package/packages/core/src/events/repository.ts +2 -0
  35. package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +196 -230
  36. package/packages/core/src/kernel/dispatch-capacity.ts +134 -30
  37. package/packages/core/src/kernel/engine.ts +13 -6
  38. package/packages/core/src/kernel/generators/build-log.ts +9 -0
  39. package/packages/core/src/kernel/incremental-fixtures.ts +1 -0
  40. package/packages/core/src/kernel/janitor-failure.ts +85 -5
  41. package/packages/core/src/kernel/leaf-restack-state.ts +4 -2
  42. package/packages/core/src/kernel/log-index.ts +1 -1
  43. package/packages/core/src/kernel/node-landing.ts +2 -1
  44. package/packages/core/src/kernel/reducer-registry.ts +6 -1
  45. package/packages/core/src/kernel/reducer.ts +58 -4
  46. package/packages/core/src/kernel/ticket-preparation.ts +11 -7
  47. package/packages/core/src/operator/query.ts +15 -12
  48. package/packages/core/src/ports/tickets/create.ts +19 -5
  49. package/packages/core/src/ports/types.ts +4 -0
  50. package/packages/core/src/ports/workspace/commit-preservation.ts +28 -12
  51. package/packages/core/src/ports/workspace/git-worktree.ts +3 -1
  52. package/packages/core/src/ports/workspace/harvest-execution.ts +4 -2
  53. package/packages/core/src/ports/workspace/vercel-sandbox.ts +3 -0
  54. package/packages/core/src/processes/build-runner.ts +2 -1
  55. package/packages/core/src/processes/dispatcher.ts +231 -41
  56. package/packages/core/src/processes/execution-no-progress.ts +2 -0
  57. package/packages/core/src/processes/harvest-child.ts +4 -2
  58. package/packages/core/src/processes/harvest-execution-state.ts +104 -0
  59. package/packages/core/src/processes/harvest-runner.ts +246 -17
  60. package/packages/core/src/scenarios/harness.ts +145 -35
  61. package/packages/core/src/store/reduced-reads.ts +10 -0
  62. package/packages/core/src/store/reducer-value-shapes.json +1463 -1215
  63. package/packages/core/src/store/remote/released-clients.json +11 -0
  64. package/packages/core/src/store/remote/released-reducer-values/1.6.0.json +27173 -0
  65. package/packages/core/src/store/remote/released-reducer-values/index.ts +2 -0
  66. package/packages/core/src/testing/reduced-read-budget.ts +339 -2
  67. package/skills/guide/SKILL.md +53 -17
  68. package/skills/guide/references/operator-api.md +14 -2
  69. package/skills/guide/references/plugin-authoring.md +4 -0
  70. package/skills/guide/references/remote-store-protocol.md +14 -4
  71. package/skills/guide/references/restacking.md +4 -0
  72. package/skills/operate/SKILL.md +50 -11
  73. package/skills/tickets/SKILL.md +4 -2
  74. package/templates/hosted-service/package.json +2 -2
@@ -529,7 +529,7 @@ client version window are unchanged.
529
529
  | Scope | Reducers with no arguments |
530
530
  | --- | --- |
531
531
  | Build | `executionNoProgress`, `summaryRequests`, `build`, `buildDigest`, `currentPrAttachments`, `pendingPrAttachmentReclaims`, `openExecution`, `lastExecutionOutcome`, `infrastructureFailureReset`, `openWorkspace`, `setupStreak`, `openBuildWorkspace`, `currentDeferralObservation`, `dashboardFacts`, `pinnedAssets`, `buildDelegation` |
532
- | Repository | `dispatchPlacement`, `ticketPreparation`, `harvest`, `dispatchSettings`, `sandboxStates`, `openHarvestExecutions`, `autoMergeDefault`, `effectiveConfig`, `harvestDelegation` |
532
+ | Repository | `dispatchPlacement`, `ticketPreparation`, `harvest`, `dispatchSettings`, `sandboxStates`, `openHarvestExecutions`, `hostedHarvestAuthority`, `autoMergeDefault`, `effectiveConfig`, `harvestDelegation` |
533
533
 
534
534
  | Reducer | Scope | Required arguments |
535
535
  | --- | --- | --- |
@@ -542,7 +542,12 @@ another's accumulator. `effectiveConfig` returns an object with optional `run`
542
542
  and `reference: {kind, rev}`. Absence is distinct from an unreadable referenced
543
543
  artifact. Delegation values contain semantic lifecycle facts indexed by prefixed
544
544
  identifiers, not authorization decisions; request time and grace expiry are
545
- always evaluated against those facts on the service.
545
+ always evaluated against those facts on the service. `hostedHarvestAuthority`
546
+ returns `{current?: {execution, run, leaseHolder, released}}`: the latest
547
+ `harvest.execution.authorized` and whether that execution has since ended or
548
+ been released. Its size does not grow with harvest history; a hosted harvest
549
+ guest re-reads it at durable boundaries to decide whether it still holds
550
+ authority, and a server that does not serve it stops the guest.
546
551
 
547
552
  Each remaining registered reducer is explicitly excluded:
548
553
 
@@ -1266,8 +1271,13 @@ or invoke operator APIs. Harvest writes require the exact run in event payloads
1266
1271
  and artifact metadata; artifacts use the harvest kinds. Every artifact in an
1267
1272
  atomic deposit is checked before writing. Harvest streams have an immutable
1268
1273
  `harvest:<run>:<execution>:` label namespace. Addressed streams resolve their actual owner;
1269
- a guessed ID cannot bypass the boundary. Only the runner can heartbeat or re-acquire its exact
1270
- adopted repository lease holder; another current holder still fences it. Recovery acknowledgements remain dispatcher-side.
1274
+ a guessed ID cannot bypass the boundary. A harvest-runner grant may heartbeat or re-acquire
1275
+ only its exact adopted repository lease holder, and another current holder fences those lease
1276
+ calls. That lease permission is not the prepared guest's execution authority: the guest neither
1277
+ heartbeats, reclaims nor releases the invocation lease, so routine `--once` teardown or a
1278
+ successor invocation's lease acquisition alone does not fence it. The guest instead reads
1279
+ `hostedHarvestAuthority` at durable boundaries and stops when its execution authorization is
1280
+ released or replaced, or when that verification fails. Recovery acknowledgements remain dispatcher-side.
1271
1281
 
1272
1282
  Hosted ticket access is gated by grant kind. Build-runner and build-phase grants
1273
1283
  cannot call ticket routes. Harvest-phase grants may call only list-ready,
@@ -258,6 +258,10 @@ that records the abandonment reports one dispatcher diagnostic naming the
258
258
  ticket and attempt, whether the claim was confirmed or its provider outcome is
259
259
  unknown, and the recorded reason. If that tick fails for any reason, its
260
260
  failure error carries the diagnostics instead. Later ticks do not repeat it.
261
+ The `abandoned` resolution event records whether the claim was confirmed, and
262
+ default `ab watch` repository attention reports the same line once as it lands,
263
+ whether or not its tick failed; a fresh watch does not replay historical
264
+ abandonments.
261
265
  Recovery failures are
262
266
  reported without preventing janitor, lease sweep, or other dispatch recovery.
263
267
  This is not general process
@@ -116,9 +116,9 @@ Credential/process changes remain subject to the Boundaries below.
116
116
  ### Watch for attention events
117
117
 
118
118
  `ab watch --operator --json` is the standing monitor. Keep its default filter: every
119
- record calls for action. It reports failed node verification, build escalations, persistent janitor failures and merge decisions,
119
+ record calls for action. It reports failed node verification, build escalations, persistent janitor failures and their escalations, merge decisions,
120
120
  harvest escalations/recovery exhaustion, automatic upgrade failures and runtime rollbacks, rejected configuration, reloads needing
121
- restart, abnormal dispatcher stops/loss, ticket-source and forge degradation past reset (15 minutes
121
+ restart, abnormal dispatcher stops/loss, abandoned ticket preparations, ticket-source and forge degradation past reset (15 minutes
122
122
  for ticket sources without reset), and five minutes of continuous tick failures. Advertised resets
123
123
  wait for a post-reset tick to finish before requiring action; ordinary recovery
124
124
  on that retry stays silent. Source grace and cooldown-driven failures do not
@@ -224,7 +224,10 @@ use process lists to decide whether a dispatcher owns this repository. The
224
224
  identity resolves a yield message to run, pid, host, start time, and heartbeat
225
225
  age. Historical identity and a new holder's heartbeat may be unknown until its
226
226
  first attributable renewal. Source degradation or an old tick alone does not
227
- establish loss: a healthy lease can accompany a slow tick.
227
+ establish loss: a healthy lease can accompany a slow tick. `lost` can also be
228
+ transient: a dispatcher that stalled past `policy.dispatchLeaseTimeoutSeconds`
229
+ with no successor reclaims its lease on waking and returns to `held`, while one
230
+ that finds another holder stops as `superseded`.
228
231
 
229
232
  An unscoped watch, or a named watch with `--repository`, reports loss as a
230
233
  read-only observation: `{repo, build:null, state:null, observation:{type:
@@ -308,8 +311,10 @@ Read events with a cursor or a small `--events` count; logs are long.
308
311
  build status before acting. Work the consent queue by checking completeness
309
312
  and current verification, then issuing merge for the chosen merge. A merge
310
313
  acknowledgement accepts consent; it never promises that gates passed. A
311
- `merge-not-ready` or `node-incomplete` refusal records nothing; re-read
312
- status and act on the stated reason.
314
+ `merge-not-ready` or `node-incomplete` refusal records no consent and no
315
+ landing, though a node's completeness check may save an
316
+ `integration.observed` diagnostic; re-read status and act on the stated
317
+ reason.
313
318
  - Configure ordered `[[merge]]` rules for project policy through ab-guide.
314
319
  Repository auto-merge defaults and per-build auto-merge toggles are retired.
315
320
 
@@ -439,6 +444,8 @@ Treat every default-watch record as a call to act:
439
444
  - `integration.verification-failed`: inspect the failed steps, verified head and parent, then recheck current status. If the node still needs that repair, file a repair child targeting it. Each current failed cycle reports once; recovery does not backfill superseded failures. The node may have advanced after notification.
440
445
  - `escalation.raised`: inspect the question and evidence, then resolve it using
441
446
  the shared rules.
447
+ - `build.janitor-escalated`: a janitor failure outlasted its escalation limit;
448
+ handle it as described under janitor escalation attention.
442
449
  - `build.consent-ready`: inspect the one consent queue, then merge or hold the
443
450
  selected candidate under the human's policy. Unready or stale candidates
444
451
  do not produce this observation.
@@ -471,6 +478,14 @@ Treat every default-watch record as a call to act:
471
478
  scope, cursor, field path, and running version/commit. Never start or run a dispatcher.
472
479
  - Persistent source degradation: inspect the source cause and reset evidence,
473
480
  diagnose and report the continuing intake problem.
481
+ - Abandoned ticket preparation (`ticket-preparation.resolved`, outcome
482
+ `abandoned`): automatic recovery stopped and left the ticket unchanged.
483
+ Inspect the named ticket and attempt and the recorded reason. A confirmed
484
+ claim may have left the ticket in its claimed state; an unconfirmed claim's
485
+ provider outcome is unknown, so check the ticket's actual state rather than
486
+ assuming it sits in Doing. Decide whether to leave it finished or cancelled,
487
+ or return it to Ready for another attempt. Each abandonment reports once;
488
+ history does not replay.
474
489
 
475
490
  Do not re-derive history the build's events already tell you; read events
476
491
  with a cursor and keep it short.
@@ -565,6 +580,9 @@ candidates. Entries include the target, branch preview, candidate head/parent,
565
580
  verification receipts and node children/completeness. Unknown completeness is
566
581
  not zero children. A changed head or parent must regain current verification;
567
582
  unfinished or automatically authorized candidates do not ask for attention.
583
+ Queued and held candidates hold no capacity slot; one that must re-verify or
584
+ reconcile waits for a slot ahead of new ticket claims, so a full repository
585
+ delays it without failing it.
568
586
 
569
587
  Select a queue build in the terminal and use `l merge` or `o hold`, or run
570
588
  `ab merge <slug>` / `ab hold <slug>`. MCP uses `builds.control` with action `merge`
@@ -586,7 +604,7 @@ entry position: resuming suppresses the same episode, while a new candidate or
586
604
  exit/re-entry can notify again. Explicit `--event` globs remain event-only.
587
605
  Use `ab wait --for consent --for node-merged --for restack-conflicted --json`
588
606
  for one wake; state waits return immediately when already satisfied. `--for
589
- attention` also includes current failed node verification, consent readiness, janitor failure attention and merge/conflict attention.
607
+ attention` also includes current failed node verification, consent readiness, janitor failure attention, an open janitor escalation and merge/conflict attention.
590
608
  Resume event backlogs with `--since <cursor>`; keep handling emitted records
591
609
  before interpreting terminal completion.
592
610
 
@@ -599,6 +617,16 @@ Repeated classified read failures park immediately again; they do not consume
599
617
  the phase failure allowance. Default watch and attention waits deliver the new
600
618
  raise with its own event type.
601
619
 
620
+ ### Janitor escalation attention
621
+
622
+ `build.janitor-escalated` is ordinary blocked attention for a janitor failure
623
+ episode that outlasted `policy.janitorFailureEscalationSeconds`. Its question
624
+ names the failing operation, the last error, the failed attempt count and when
625
+ the episode started. Diagnose and fix the cause within the Boundaries, then
626
+ answer with a bare retry so the janitor attempts on its next tick. The janitor
627
+ keeps retrying underneath, so the escalation may also close on its own when an
628
+ attempt succeeds; reconcile current status before acting on it.
629
+
602
630
  ## Forge failure recovery
603
631
 
604
632
  A historical `publication.lost` does not prove that every copy of its candidate
@@ -642,11 +670,22 @@ build. An implement round with no commits over its base escalates at
642
670
  Janitor failures are durable per-build episodes. Eligible failures retry after
643
671
  30, 60, 120, 240 seconds, then at the configured cap (300 seconds by default).
644
672
  A classified forge rate limit is repository cooldown, not a janitor failure:
645
- neither the first limited response nor the cooldown that follows starts or ages
646
- an episode. Skipped polls preserve the episode across restart. After
647
- `policy.janitorFailureAttentionSeconds` (600 by default), `build.janitor-failing`
648
- notifies default watchers and appears on the build row. A successful attempt
649
- clears it. `policy.janitorBackoffMaxSeconds` sets the positive integer cap.
673
+ neither the first limited response nor the cooldown that follows starts an
674
+ episode or records an attempt, so a build that only waits out cooldown never
675
+ escalates. Skipped polls preserve the episode across restart. Both thresholds
676
+ below are wall-clock from the episode's first failed attempt and are checked
677
+ when an attempt fails, so cooldown inside an episode that already started still
678
+ counts. After `policy.janitorFailureAttentionSeconds` (600 by default),
679
+ `build.janitor-failing` notifies default watchers and appears on the build row.
680
+ After `policy.janitorFailureEscalationSeconds` (3600 by default), the build
681
+ raises one escalation through `build.janitor-escalated`, naming the failing
682
+ operation, the last error, the failed attempt count and when the episode
683
+ started. The build is then blocked and shows wherever open escalations show.
684
+ The janitor keeps retrying on its backoff underneath; a successful attempt
685
+ clears the attention, closes the escalation unanswered and the build continues.
686
+ Answering it with a bare retry makes the janitor attempt on its next tick. An
687
+ episode raises at most one escalation; a new episode after recovery can raise
688
+ another. `policy.janitorBackoffMaxSeconds` sets the positive integer cap.
650
689
  A dispatcher that cannot execute Git for kernel node work (a missing or
651
690
  unloadable `git` for the bare clone) records no janitor failures. It records
652
691
  one durable `dispatcher.kernel-git-unavailable` repository condition, node work
@@ -192,8 +192,10 @@ bounces. A caught failure before build creation returns it to configured Ready
192
192
  after safe ownership checks; unfinished recovery stays durably tracked and
193
193
  withheld from another claim. Uncertain ownership or externally changed/missing
194
194
  tickets end automatic recovery with an `abandoned` resolution, reported once
195
- in that tick's dispatcher diagnostics, leaving the ticket unchanged for
196
- operator inspection. See [preparation recovery](../ab-guide/references/restacking.md#ticket-preparation-before-build-creation).
195
+ in that tick's dispatcher diagnostics and once as default `ab watch`
196
+ repository attention, leaving the ticket unchanged for operator inspection.
197
+ The resolution records whether the claim was confirmed; an unconfirmed claim's
198
+ provider outcome is unknown, so the ticket may or may not sit in `doing/`. See [preparation recovery](../ab-guide/references/restacking.md#ticket-preparation-before-build-creation).
197
199
 
198
200
  **Don't hand-move anything out of `doing/`** — dispatch preparation or a build owns it. If you need to
199
201
  stop a build, that's `ab` (or a human), not `mv`.
@@ -4,8 +4,8 @@
4
4
  "build": "ab-hosted-service-build"
5
5
  },
6
6
  "dependencies": {
7
- "@defrex/autobuild-hosted-store-service": "1.5.0",
8
- "@defrex/autobuild": "1.5.0",
7
+ "@defrex/autobuild-hosted-store-service": "1.6.0",
8
+ "@defrex/autobuild": "1.6.0",
9
9
  "next": "16.1.6",
10
10
  "react": "19.2.4",
11
11
  "react-dom": "19.2.4"