@defrex/autobuild 1.20.0 → 1.21.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.
package/README.md CHANGED
@@ -26,7 +26,7 @@ From the repository you want built, install Autobuild as a development dependenc
26
26
  <!-- release-install:start -->
27
27
 
28
28
  ```sh
29
- bun add -d --exact @defrex/autobuild@1.20.0
29
+ bun add -d --exact @defrex/autobuild@1.21.0
30
30
  ```
31
31
 
32
32
  <!-- release-install:end -->
package/SPEC.md CHANGED
@@ -2112,7 +2112,12 @@ tickets, parked admission, ticket waits) keep their order. In a bounded pass a
2112
2112
  node's integration receipts are recovered at the start of its own janitor
2113
2113
  visit, and listings are not filtered for mixed-version deferral: the build a
2114
2114
  decision reads, writes or acts on is checked itself, at most once a pass. Each
2115
- bounded pass logs `stages:` with each stage's time and items; a pass the work
2115
+ bounded pass logs `stages:` with each stage's time and items, and names every
2116
+ parked admission a stage decided with its level and outcome (`admitted`,
2117
+ `deferred` or `carried`, the last on intake, where the retry would have run);
2118
+ the deferred stage also decides parked admissions an earlier pass carried
2119
+ (§12 "Slot admission order"). The durable stage record keeps at most 1000
2120
+ admissions per stage and counts the rest as `admissionsOmitted`. A pass the work
2116
2121
  deadline cuts short logs `tick: work deadline reached during <stage>` with the
2117
2122
  part in flight and how far it got, records that partial summary in teardown,
2118
2123
  and `ab repository status` shows the latest pass as `last pass stages:`.
@@ -3416,7 +3421,35 @@ nothing and keeps the build's reservation against claims at its level; it
3416
3421
  makes that tick's admission scan due, and the deferred admissions are retried
3417
3422
  after the tick's dispatch only when that scan decided claims at every level
3418
3423
  (its claim loop ran to the end, or it proved no ticket could claim or count as
3419
- demand). Otherwise they are decided again on a later tick. A forced scan is
3424
+ demand). Otherwise an unbounded tick decides them again on a later tick. A
3425
+ bounded pass, which is a fresh process with no memory of the last one, carries
3426
+ instead every deferral whose retry did not run (its intake did not decide
3427
+ claims, the budget was spent, or the pass never reached intake): the
3428
+ `dispatcher.work-deferred` fact's `parked` entry names each deferred leaf, at
3429
+ most 64, with the occupancy its deferring measurement saw. That occupancy is
3430
+ the repository change position read before the measurement, the builds holding
3431
+ a slot, those requesting one with their level, and the open nodes whose slot
3432
+ state can change without an event on the node because it reads a clock or a
3433
+ lease (a value with no recorded admission, a never-admitted node whose legacy
3434
+ runner a live lease can evidence, and a due proposal whose eligibility reads
3435
+ the clock). The next bounded pass decides those leaves first, in its deferred
3436
+ stage, and never defers them again. It rebuilds occupancy without measuring
3437
+ the fleet: one changed-builds feed call since that position, then one reduced
3438
+ read for each recorded holder, waiter and clock-dependent node, each build
3439
+ changed since and each carried leaf. Every other open build has not changed
3440
+ and its slot state reads no clock, so it still holds and requests nothing. It
3441
+ decides against the latest durable claim demand, pending start requests,
3442
+ unresolved carried preparations and higher-level waiters, so a carried leaf
3443
+ yields to recorded higher-level demand exactly as the order says. A parked
3444
+ leaf therefore waits at most one extra pass for an intake that never
3445
+ completes. The trade is stale demand: a higher-level ticket that became ready
3446
+ after the latest admission scan can lose one slot to a carried leaf once.
3447
+ Without a usable occupancy (none recorded because it exceeded 256 holders, 64
3448
+ waiters or 64 clock-dependent nodes, or the feed reports a reset), the carried
3449
+ leaf only stays undeferred for that pass and the lease sweep decides it on its
3450
+ ordinary visit. A decided entry, admitted or not, leaves the fact; the fact is
3451
+ written at most once per pass and only when the entry changes, and an
3452
+ unbounded tick leaves it unchanged. A forced scan is
3420
3453
  bounded per deferral state: an unchanged set of deferred builds and occupancy
3421
3454
  lists again only when a scan is due on its own. Only gate-passing tickets
3422
3455
  count, so a ticket blocked on a dependency reserves nothing at any level. Free
@@ -322,7 +322,9 @@ values. Reads after an append or lost conditional append consult that boundary
322
322
  again, so no process-local memo suppresses a required delta. The adapter owns
323
323
  cache persistence and recovery; the view neither writes work bundles nor hydrates
324
324
  whole logs for decisions. The dispatcher's discovery (`refresh`) uses persisted
325
- build digests, including for settled builds. Operator passes discover through
325
+ build digests, including for settled builds. Within an epoch, a write or lease
326
+ change through the view re-reads only that build's record and digest, never the
327
+ whole roster. Operator passes discover through
326
328
  `refreshOpen` and the store's `listOpenBuilds`, which never reads a settled
327
329
  build. Raw methods forward actual cursor event output.
328
330
 
@@ -1026,6 +1028,28 @@ deferral key, and `admitDeferredParked` retries the deferred admissions only
1026
1028
  after the scan decided claims at every level: a leaf
1027
1029
  through the build sweep, a node reconcile through `cascadeNode`, any other node
1028
1030
  need through `admitNode`, and a proposal through `admitProposers`.
1031
+ A bounded pass carries the leaf deferrals whose retry did not run (#1435).
1032
+ `leafAdmission` records each deferred leaf in `pendingParkedRetries`, and keeps
1033
+ the latest deferring measurement's occupancy as a witness (`witnessOf`): the
1034
+ repository change position read once before the first such measurement, the
1035
+ holders, the waiters with their levels, and the nodes `nodeSlotTimeDependent`
1036
+ names, the only node slot states that read a clock or a lease.
1037
+ `finalizeParkedCarries` runs once per pass, from `tick()` or from bounded
1038
+ teardown's `settleCutStarts`. It moves what remains into the hint's `parked`
1039
+ entry through `persistDeferrals`, names it on the intake stage record
1040
+ (`PassStageTracker.carriedAdmission`) and adds one deferred-diagnostics line
1041
+ per leaf. The next bounded pass loads the entry, closes the admission boundary
1042
+ for those slugs in `slotAdmission`, and `serviceCarriedAdmissions` in the
1043
+ deferred stage rebuilds occupancy from the witness plus one
1044
+ `listBuildsChangedSince` call, reading facts (`capacityBuildOf`) only for the
1045
+ witness and changed builds and the carried slugs. It then sweeps each carried
1046
+ leaf, highest level first, with that occupancy passed to `leafAdmission` as
1047
+ `measured`; the lease sweep skips it through `tickPrioritized`. Without a
1048
+ usable witness the carried leaf keeps only its closed boundary for the sweep's
1049
+ ordinary visit. Every parked admission a stage decides is recorded through
1050
+ `PassStageTracker.admission` as `admitted` or `deferred`. The in-memory record
1051
+ is uncapped; `boundStageRecords` bounds the durable copy to 1000 per stage with
1052
+ `admissionsOmitted`.
1029
1053
  Ticket waits (SPEC §11) span four seams. `cli/terminals.ts` (`waitOn`, routed
1030
1054
  as `ab wait-on`) appends the agent's terminal `wait.requested`; the build
1031
1055
  digest marks it pending. The dispatcher's lease-sweep pass validates a pending
@@ -100,7 +100,12 @@ Deferred work is every start a pass admitted but didn't finish (a ticket
100
100
  preparation, a provision, a launch the work deadline cut, or a stopped-sandbox
101
101
  recovery); the next invocation runs it first. A ticket preparation that won't
102
102
  fit, or that the deadline cuts, keeps its ticket and is never handed back to
103
- Ready.
103
+ Ready. A parked leaf build that waited for this pass's intake to rank ticket
104
+ claims, when that intake didn't finish, is carried too. A later invocation
105
+ decides it without waiting for intake: first, when it can rebuild slot
106
+ occupancy from what the pass recorded, otherwise on the lease sweep's ordinary
107
+ visit. It's admitted only into a free slot that no recorded higher-level ticket
108
+ demand, start request or waiter takes.
104
109
 
105
110
  ### Origin-mode dispatcher with remote workspaces
106
111
 
@@ -75,7 +75,7 @@ A free slot goes, in order, to:
75
75
  - **Build level.** A build takes its ticket's level. A build started by a non-`manual` request takes the request's level; `manual` never becomes a build level. A ticket with a pending non-`manual` request is claimed only by that request, at its tier, ahead of that level's ready tickets.
76
76
  - **Optimization attempts.** [Attempts](optimization-nodes.md#attempts) claim at the node's current level, any of the four. A later `ab priority` on the node affects attempts claimed afterwards; an already claimed attempt keeps its level.
77
77
  - **Changing a build.** `ab priority <slug> urgent|high|normal|low` (or the `builds.control` action `priority`) changes an active build's level, for example to expedite a waiting reconcile that now blocks other work, or to defer one with `low`. It never changes the ticket.
78
- - **Reservations.** A pending start request reserves its slot ahead of the tiers below it until it settles or is cancelled. Lower-level waiting work waits while gate-passing higher-level tickets are ready, until the dispatcher has offered them the free slots that tick. A ticket blocked on a dependency reserves nothing at any level.
78
+ - **Reservations.** A pending start request reserves its slot ahead of the tiers below it until it settles or is cancelled. Lower-level waiting work waits while gate-passing higher-level tickets are ready, until the dispatcher has offered them the free slots that tick. When a hosted pass's intake doesn't finish, a parked leaf build held back this way is carried: a later pass decides it without waiting for intake, against the last recorded ticket demand. Waiting nodes and proposals aren't carried; they still wait for a pass whose intake finishes. A ticket blocked on a dependency reserves nothing at any level.
79
79
  - **Unread start requests.** A tick reads at most eight `manual` and `urgent` requests and eight `high`, `normal` and `low` requests. While a request at a level is left unread, nothing below that level is admitted that tick, and that level's ready tickets wait too. That level's waiting work still goes first. A later tick reads the request once the requests ahead of it settle.
80
80
  - **No preemption.** Priority orders free slots only: it never interrupts a running build.
81
81
  - **Status.** `ab repository status`, `ab builds` and both dashboards show each waiter's level, pending start requests by tier, and higher-level ticket claims waiting ahead of lower-level waiting work.
@@ -203,6 +203,12 @@ stages: settlement 3.1s 6/11 (executions 5/9, harvest 1/2, sandboxes 0/0) · jan
203
203
  - **Time and items:** each stage's seconds and the items it reached out of those it listed.
204
204
  - **`(share)`:** the stage used its share of the window and stopped starting items. In settlement, the janitor, hand-backs, dispatch recovery, resume and the lease sweep, the loop continues on the next invocation after the last item it started, so it works through its whole listing over successive passes. Priority-ordered loops (node admission, start requests, ready tickets, ticket waits) start from the top again.
205
205
  - **`(deadline)`:** the work deadline stopped the pass inside that stage. The `tick: work deadline reached during …` line names the part in flight, such as `settlement: harvest 1 of 2 (6 of 11 overall)`.
206
+ - **Parked admissions:** a stage that decided parked builds names them after its items, grouped by outcome, each with its level, for example `sweep 41.0s 12/30 (waits 0/0, sweep 12/30) (share) admitted a-fix high; deferred b-docs normal`.
207
+ - `deferred`: the build waited for this pass's intake to rank ticket claims.
208
+ - `carried`: that intake didn't finish, so a later pass decides the build without waiting for intake. A `build <slug> (<level>): parked admission carried to the next pass` line names it too.
209
+ - `admitted`: the build took a slot. A carried build is decided on the next pass's `deferred` stage when that pass can rebuild slot occupancy, otherwise on its ordinary `sweep` visit. Either way it's admitted only into a free slot that higher-level ticket demand, start requests or waiters don't take.
210
+
211
+ `ab priority <slug> urgent` isn't needed to unstick such a build.
206
212
 
207
213
  **Cause.** One visit in the named stage takes most of the window: usually a slow forge or provider call for one build.
208
214
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defrex/autobuild",
3
- "version": "1.20.0",
3
+ "version": "1.21.0",
4
4
  "description": "Agent-driven software delivery from groomed ticket to merged PR",
5
5
  "repository": {
6
6
  "type": "git",
@@ -162,8 +162,8 @@
162
162
  },
163
163
  "devDependencies": {
164
164
  "@biomejs/biome": "2.5.5",
165
- "@defrex/autobuild-postgres-store": "1.20.0",
166
- "@defrex/autobuild-vercel-sandbox": "1.20.0",
165
+ "@defrex/autobuild-postgres-store": "1.21.0",
166
+ "@defrex/autobuild-vercel-sandbox": "1.21.0",
167
167
  "@resvg/resvg-js": "2.6.2",
168
168
  "@types/bun": "^1.3.14",
169
169
  "@types/node": "^24.0.0",
@@ -242,6 +242,7 @@ import {
242
242
  type TickReport,
243
243
  } from '../processes/dispatcher'
244
244
  import {
245
+ boundStageRecords,
245
246
  formatDeadlineStop,
246
247
  formatPassStages,
247
248
  type PassStageRecord,
@@ -3580,6 +3581,7 @@ class DispatchLoop {
3580
3581
  deferredDiagnostics: _deferredDiagnostics,
3581
3582
  ...counters
3582
3583
  } = merged
3584
+ if (counters.stages !== undefined) counters.stages = boundStageRecords(counters.stages)
3583
3585
  const completed = {
3584
3586
  actor: DISPATCHER,
3585
3587
  type: 'dispatcher.tick-completed' as const,
@@ -5889,6 +5891,7 @@ class DispatchLoop {
5889
5891
  deferredDiagnostics: _deferredDiagnostics,
5890
5892
  ...counters
5891
5893
  } = partial
5894
+ if (counters.stages !== undefined) counters.stages = boundStageRecords(counters.stages)
5892
5895
  await this.teardownWrite(budget)(() =>
5893
5896
  this.finishTick({ outcome: 'completed', counters }, []),
5894
5897
  )
@@ -99,6 +99,9 @@ export const ROTATED_PASS_PARTS = [
99
99
  const passCount = z.number().int().nonnegative()
100
100
  const passStopSchema = z.enum(['share', 'deadline'])
101
101
  const passCarriedSchema = z.array(z.string().min(1)).max(8)
102
+ const buildLevelSchema = z.enum(['urgent', 'high', 'normal', 'low'])
103
+ /** Most parked admissions one durable stage record names (#1435). */
104
+ export const MAX_STAGE_ADMISSIONS = 1000
102
105
  const passStageRecordSchema = z.strictObject({
103
106
  stage: z.enum(PASS_STAGE_NAMES),
104
107
  ms: passCount,
@@ -107,6 +110,21 @@ const passStageRecordSchema = z.strictObject({
107
110
  stopped: passStopSchema.optional(),
108
111
  /** Tickets whose preparation the stage carried to the next pass (#1431). */
109
112
  carried: passCarriedSchema.optional(),
113
+ /** Parked admissions this stage decided (#1435): each build once, with its
114
+ * level and latest outcome, and the part that decided it. */
115
+ admissions: z
116
+ .array(
117
+ z.strictObject({
118
+ slug: z.string().min(1),
119
+ level: buildLevelSchema,
120
+ outcome: z.enum(['admitted', 'deferred', 'carried']),
121
+ part: z.enum(PASS_STAGE_PART_NAMES).optional(),
122
+ }),
123
+ )
124
+ .max(MAX_STAGE_ADMISSIONS)
125
+ .optional(),
126
+ /** Admissions beyond the ones stored; the dispatch log named them all. */
127
+ admissionsOmitted: passCount.optional(),
110
128
  parts: z
111
129
  .array(
112
130
  z.strictObject({
@@ -593,7 +611,11 @@ export const dispatcherStatusEventPayloadSchemas = {
593
611
  * intake journaled but did not start because the preparation would not fit
594
612
  * before the work deadline, or a preparation the deadline cut. The next
595
613
  * tick resumes each attempt first from its durable boundaries; absent when
596
- * none is carried. */
614
+ * none is carried. `parked` names parked leaves whose slot admission a
615
+ * bounded pass deferred and whose retry did not run (#1435), with the
616
+ * occupancy that pass measured: the next bounded pass decides them first,
617
+ * from that occupancy plus the builds changed since its position, against
618
+ * the latest durable claim demand. Absent when none is carried. */
597
619
  'dispatcher.work-deferred': z.strictObject({
598
620
  builds: z
599
621
  .array(
@@ -608,6 +630,28 @@ export const dispatcherStatusEventPayloadSchemas = {
608
630
  .array(z.strictObject({ ticket: ticketRefSchema, attempt: z.string().min(1) }))
609
631
  .max(8)
610
632
  .optional(),
633
+ parked: z
634
+ .strictObject({
635
+ /** Leaves whose parked admission a bounded pass deferred and did not retry. */
636
+ slugs: z.array(z.string().min(1)).min(1).max(64),
637
+ /** The occupancy the deferring pass measured; absent means none is usable. */
638
+ witness: z
639
+ .strictObject({
640
+ /** Repository change position taken before that measurement. */
641
+ position: z.string().min(1),
642
+ /** Builds holding a slot then. */
643
+ holders: z.array(z.string().min(1)).max(256),
644
+ /** Builds requesting a slot then, with their level. */
645
+ waiters: z
646
+ .array(z.strictObject({ slug: z.string().min(1), level: buildLevelSchema }))
647
+ .max(64),
648
+ /** Open nodes whose slot state can change without an event on
649
+ * the node (`nodeSlotTimeDependent`); the next pass re-reads them. */
650
+ volatile: z.array(z.string().min(1)).max(64),
651
+ })
652
+ .optional(),
653
+ })
654
+ .optional(),
611
655
  }),
612
656
  /** A latest-only scheduling hint: where each rotated loop of a bounded
613
657
  * pass continues on the next pass, the key of the last item it started.
@@ -0,0 +1,115 @@
1
+ {
2
+ "records": [
3
+ {
4
+ "name": "repositoryReadFacts",
5
+ "identity": "repositoryReadFacts",
6
+ "revisions": [
7
+ "repositoryAttention/fold/u6bhzf2af0",
8
+ "repositoryReadFacts/fold/0xl1c98cpy",
9
+ "repositoryReadFacts/fold/3vtj9fjj4k",
10
+ "repositoryReadFacts/fold/4gnmhbji3n",
11
+ "repositoryReadFacts/fold/5porrk9y1h",
12
+ "repositoryReadFacts/fold/c51adpvz2s",
13
+ "repositoryReadFacts/fold/fk3ka9gb3z",
14
+ "repositoryReadFacts/fold/vvcfmd23zp",
15
+ "repositoryReadFacts/shape/5yo149tiqz",
16
+ "repositoryReadFacts/shape/70jpyc3nd3",
17
+ "repositoryReadFacts/shape/7hbgb52kw8",
18
+ "repositoryReadFacts/shape/de4i5wkgb2",
19
+ "repositoryReadFacts/shape/e2u2pgiup3",
20
+ "repositoryReadFacts/shape/ez3eddcdoo",
21
+ "repositoryReadFacts/shape/hgw4spz5c0",
22
+ "repositoryReadFacts/shape/l3uobdw03l",
23
+ "repositoryReadFacts/shape/mggr8x6l5z",
24
+ "repositoryReadFacts/shape/o7791nz2gt",
25
+ "repositoryReadFacts/shape/se5kk44boc",
26
+ "repositoryReadFacts/shape/unl0u1aq73",
27
+ "repositoryReadFacts/shape/xyn7875cxw",
28
+ "sandboxStates/fold/hjdgop7xoh",
29
+ "sandboxStates/shape/gbrf8k4qxq",
30
+ "ticketPreparation/shape/3hfd72gfgz",
31
+ "ticketPreparation/shape/o2u9rxe2bv",
32
+ "ticketStarts/fold/8fp156vze2",
33
+ "ticketStarts/fold/eglrhnb0ta",
34
+ "ticketStarts/shape/dzxrbuuq7e",
35
+ "ticketStarts/shape/eecofz22vy"
36
+ ],
37
+ "entries": {
38
+ "017d8dd5bb6dd80b": "9b19c8eb254d503fbe74d8de7039566f",
39
+ "10a4657408d4e121": "218f9c92364c4b9176b70c9bee8a29f8",
40
+ "1411d1cdbdd9911e": "a5b60fa55d3c1d3999e4ee947878bd23",
41
+ "1444fe1fa7fc802c": "81c89822174d63012aa06ad744fae9e6",
42
+ "178e12f1759b7552": "61197c43eb41d8451ce5182402f23373",
43
+ "1921f86f752428c9": "abf8d370c9d94b6a50ab70d52d33454b",
44
+ "1972c1d66008ef6b": "56c634f6d1a0076256c385b2a9feab7c",
45
+ "19e8e43e7f3f1a06": "b18b2ccd2d11b39684f2fc991526b0d6",
46
+ "21ce2c0bf58318e1": "8eedb8f516b89cb65230c9cedb1bd903",
47
+ "293dcb3a94fb3470": "203e641af713b42a0e5369f9486f2301",
48
+ "2ab7436356267118": "fc4031327a07006ccdc946bf07aba04f",
49
+ "2d084641735caaff": "1061299214f493d5d51f9c11afae68ab",
50
+ "3237bcecf68e5db9": "79f6d09249036fd77dc5d3400e18124a",
51
+ "33d0cc593610e56f": "bd88ed40c1ada79d8657af1b339a6a9f",
52
+ "35cf9ccc4478b2d2": "5a2279bc99403d0f7d40cede4c8bb573",
53
+ "3649e7bd1203f154": "9d3742c0e29c7a3e999c9c9a8c6eac27",
54
+ "38c75099d9191471": "203e641af713b42a0e5369f9486f2301",
55
+ "431c9bb2ee8838e0": "0715d441ad523323105867bf09108797",
56
+ "49064fc079964a5c": "844ca8b44174ab640ce17a713b580d7d",
57
+ "4932c70a2af97faf": "0c732c6ead43fcb8d5f34159ac5e0e0b",
58
+ "4f00c0f2c8afd159": "9688f560966f37d57b4177bf5aa4b7f0",
59
+ "516a5a7aadf97587": "e63f56f546ed51d4e04df1e86c9fc476",
60
+ "536085773daf6b58": "57901f1d28ee614272cc8915a80e38ff",
61
+ "59ffaa6974094c72": "d1757ea5344f9164aca22e3ca6ca165a",
62
+ "5f0ca42af862c4ee": "840d8a2c1947ef0941e1ab8bf3afd42e",
63
+ "6118031132db9bfc": "8c44d3ef5b8a0241b5c712f994d56907",
64
+ "643d70429ce03dad": "c2b7bfc98da1427b6a3858d814d3f57b",
65
+ "677ea92572c29082": "4067b95ee98f33bc298d71c7489fabba",
66
+ "6ae5bf60504d6467": "58975765e668c4f361659977261d56ed",
67
+ "6bd6275061aaffa5": "c84c2528779e3ecc21e549e0ef2adedd",
68
+ "6efdc8defc75fccb": "d5b512d4f4c16b9d4bcadbee8f8206ad",
69
+ "7833e42d16301424": "b32c86839cd9044a4d7757d51b62db14",
70
+ "7d4edad0614adaf1": "54a48a0b441082d54a07d786c217153e",
71
+ "837365898d04f45a": "54a48a0b441082d54a07d786c217153e",
72
+ "85f9f0c921b8b5bb": "0926918433e11ebd637e34dae2a2d615",
73
+ "8879f57a24733897": "58975765e668c4f361659977261d56ed",
74
+ "88cb9e71bdec972d": "3f7ed5a476e6457efedb7cdf6412fd23",
75
+ "89625654b02e9ac1": "bac4fc52c015d8cb7b9f833dda540b85",
76
+ "8cc15eb1807c0157": "10c221f0b9db3782b1dca2ed6eb1f5c9",
77
+ "8ced97c44bc0af3a": "d998291081ba51e1bef3205aae7595ef",
78
+ "8d4144004720b9f8": "ef6389a96f072b54e91a0e0f19c827b8",
79
+ "8db633ead1807f8b": "c4fe43ef3276b5877db1b08a38d607cb",
80
+ "8e42cdbd0994ab0c": "e12aa5b2f6373eceb51f303a929e8d5a",
81
+ "9539b995af5c54a9": "1061299214f493d5d51f9c11afae68ab",
82
+ "9ee3919fbd4f9458": "a553618f38080bfcb814cb4a5416cfb1",
83
+ "a0b32c12e4e6edb6": "d323237478cd65b159eda1faab172bcf",
84
+ "a55218252707bdd3": "54a48a0b441082d54a07d786c217153e",
85
+ "a98af134be2da8a9": "9a0830cc47de7a66b3c2f1a85a7eb852",
86
+ "af953392d81911da": "58975765e668c4f361659977261d56ed",
87
+ "b0d877c44810ecb0": "64a155224f6c8526212f92f64e7ef575",
88
+ "be211f0e31a65006": "64a155224f6c8526212f92f64e7ef575",
89
+ "c68b7ee2e2610f30": "05034ebd16ae9bf93b398663b30aea92",
90
+ "c7f7e0378aeea237": "1061299214f493d5d51f9c11afae68ab",
91
+ "c98cb1659eb142b6": "64a155224f6c8526212f92f64e7ef575",
92
+ "ca830adf06ed55a1": "54a48a0b441082d54a07d786c217153e",
93
+ "cb3a219f33e437ca": "feab7b027da5be2ecf041dd93fb55f1d",
94
+ "cf1e0c0d82567e0c": "cac9aba9f25adeb55568e902396839a4",
95
+ "d1432a819d8e48c5": "203e641af713b42a0e5369f9486f2301",
96
+ "d185ed6aa9192aff": "235467b1c87a46b383a7fa8550d8a2f8",
97
+ "d5d5ccca80a893d8": "0fdfd82c7426fd151bbb7544cd415187",
98
+ "d873fad29d6c7e55": "3f7ed5a476e6457efedb7cdf6412fd23",
99
+ "e2f18fa32fe1f6d0": "e5878dff98f5f30c5f82c1656fa82737",
100
+ "e37393fed29e84c5": "b32c86839cd9044a4d7757d51b62db14",
101
+ "e6a8585e2a054ff6": "ed2947f48b407a9a4f3bbfd151d8bc63",
102
+ "eb7ddd5319d09e27": "e7fa56dec140a7688e4a7d470b419aba",
103
+ "eca4959b2b87ae15": "5d66240a5fdec0ca59deafae16615bc5",
104
+ "ee10d7959ec4843c": "7a0b8bf4fb7a11ea26c5431bc205f96d",
105
+ "ef1b68347966ab26": "3f7ed5a476e6457efedb7cdf6412fd23",
106
+ "f3e55425cc41f230": "54a48a0b441082d54a07d786c217153e",
107
+ "f5b9ace9b59351e7": "3f7ed5a476e6457efedb7cdf6412fd23",
108
+ "f8155387eb5f375c": "5c119a1b47ade210ed5517f68b3babfc",
109
+ "fa8f1475a55be935": "8ecd3e416726e4af9b75f8eaa983f171",
110
+ "fb21116a15d0b1f1": "22c5ba7ef2445e8d6a9e7bbeb1b06d52",
111
+ "fe95444fbeabe592": "4b033ccb2ce1d4edc32bb44601049293"
112
+ }
113
+ }
114
+ ]
115
+ }
@@ -278,7 +278,9 @@ function tiersAtOrAbove(level: BuildPriority): readonly StartTier[] {
278
278
  return START_TIERS.slice(0, START_TIERS.indexOf(level) + 1)
279
279
  }
280
280
 
281
- /** A node's provisioning marker or continuation, or a live lease: a runner is working. */
281
+ /** A node's provisioning marker or continuation, or a live lease: a runner is working.
282
+ * Reads the clock and a lease: a node whose slot state reaches this is
283
+ * named by `nodeSlotTimeDependent`. */
282
284
  function runnerAllocated(build: CapacityBuild, now: Date): boolean {
283
285
  return (
284
286
  !!build.provisioning ||
@@ -558,7 +560,9 @@ export function legacyNodeRunner(build: CapacityBuild, now: Date): boolean {
558
560
  return legacyNodeRunnerNeed(build, now) !== undefined
559
561
  }
560
562
 
561
- /** The need a legacy node runner (`legacyNodeRunner`) is adopted for. */
563
+ /** The need a legacy node runner (`legacyNodeRunner`) is adopted for. Its
564
+ * evidence can be a live lease: such a node is named by
565
+ * `nodeSlotTimeDependent`. */
562
566
  export function legacyNodeRunnerNeed(build: CapacityBuild, now: Date): NodeSlotNeed | undefined {
563
567
  const { state } = build
564
568
  if (
@@ -657,12 +661,37 @@ export function nodeSlotNeed(build: CapacityBuild, now: Date): NodeSlotNeed | un
657
661
  if (nodeMeasurementDue(state)) return measurementNeed(state)
658
662
  // A stale request (stopped, spent or shrunk below its room) reserves
659
663
  // nothing; the dispatcher withdraws it. A started session was admitted
660
- // already and resumes whatever its eligibility.
664
+ // already and resumes whatever its eligibility. The clock read here is
665
+ // why a due proposal is `nodeSlotTimeDependent`.
661
666
  if (proposeAdmissible(state.optimization, now)) return proposeNeed(state)
662
667
  if (integrationAdmissible(state) && integrationNeedsRunner(state)) return integrationNeed(state)
663
668
  return undefined
664
669
  }
665
670
 
671
+ /** Whether a node's slot state (`occupiesCapacity`, `slotRequest`) can
672
+ * change without an event on the node: it reads the clock or a lease. True
673
+ * for a value with no `slotAdmittedSeq` (the older rule calls
674
+ * `runnerAllocated`), for a never-admitted node with a runner need (a
675
+ * legacy runner's evidence can be a live lease), and for an optimization
676
+ * node whose proposal request is due (`proposeAdmissible` reads the clock).
677
+ * Every other input is a pure function of the node's events:
678
+ * `nodeRunnerNeeds`, `nodeOutsideWait`, an admitted node's `nodeHoldsSlot`,
679
+ * `proposeStarted`, `nodeMeasurementDue` and `integrationAdmissible`. A
680
+ * bounded pass re-reads such nodes when it rebuilds an earlier pass's
681
+ * occupancy (#1435); a new clock or lease input on these paths belongs here.
682
+ * False for leaves and terminal builds: a leaf's slot state takes no clock. */
683
+ export function nodeSlotTimeDependent(state: BuildState): boolean {
684
+ if (state.kind !== 'node' || terminal(state)) return false
685
+ if (state.slotAdmittedSeq === undefined) return true
686
+ if (
687
+ state.slotAdmittedNeed === undefined &&
688
+ !nodeOutsideWait(state) &&
689
+ nodeRunnerNeeds(state).length > 0
690
+ )
691
+ return true
692
+ return proposeRunDue(state.optimization)
693
+ }
694
+
666
695
  /** A nonterminal build's slot state, or undefined when it is unknown: a
667
696
  * `done` build reports none, and a value from a server older than durable
668
697
  * admission (no `slotAdmittedSeq`, which every current reducer sets on
@@ -109,4 +109,6 @@ export const REDUCER_REVISIONS: Readonly<Record<string, string>> = {
109
109
  'buildStreamSeed/shape/65yse1vuyo': '#1452 session.suspended carries the ended execution',
110
110
  'dashboardFacts/shape/d0avr35e2j': '#1452 session.suspended carries the ended execution',
111
111
  'buildDigest/shape/gfei8y6315': 'buildDigest tracks open workspace for releasePending (#1443)',
112
+ 'repositoryReadFacts/shape/de4i5wkgb2': '#1435 deferredWork carries parked admissions',
113
+ 'repositoryReadFacts/fold/c51adpvz2s': '#1435 deferredWork carries parked admissions',
112
114
  }
@@ -89,13 +89,17 @@ export interface RepositoryReadAcc {
89
89
  scanSeq?: number
90
90
  scan?: Extract<RepositoryEvent, { type: 'dispatcher.ticket-scan-completed' }>['payload']
91
91
  /** The latest `dispatcher.work-deferred` hint: builds the next tick sweeps
92
- * first, and carried ticket-preparation attempts it resumes first. */
92
+ * first, carried ticket-preparation attempts it resumes first, and carried
93
+ * parked admissions it decides first (#1435). */
93
94
  deferredWork?: {
94
95
  seq: number
95
96
  builds: Extract<RepositoryEvent, { type: 'dispatcher.work-deferred' }>['payload']['builds']
96
97
  tickets?: NonNullable<
97
98
  Extract<RepositoryEvent, { type: 'dispatcher.work-deferred' }>['payload']['tickets']
98
99
  >
100
+ parked?: NonNullable<
101
+ Extract<RepositoryEvent, { type: 'dispatcher.work-deferred' }>['payload']['parked']
102
+ >
99
103
  }
100
104
  /** The latest `dispatcher.pass-cursors` hint: where each rotated loop of
101
105
  * the next bounded pass continues. */
@@ -266,6 +270,7 @@ export const repositoryReadFactsReducer = defineReducer({
266
270
  seq: event.seq,
267
271
  builds: event.payload.builds,
268
272
  ...(event.payload.tickets !== undefined ? { tickets: event.payload.tickets } : {}),
273
+ ...(event.payload.parked !== undefined ? { parked: event.payload.parked } : {}),
269
274
  }
270
275
  if (event.type === 'dispatcher.pass-cursors')
271
276
  acc.passCursors = { seq: event.seq, cursors: event.payload.cursors }