@defrex/autobuild 1.19.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.
Files changed (63) hide show
  1. package/README.md +1 -1
  2. package/SPEC.md +88 -11
  3. package/docs/architecture.md +48 -8
  4. package/docs/assets/headline-wide.png +0 -0
  5. package/docs/dispatcher-hosting.md +6 -1
  6. package/docs/dispatcher.md +2 -2
  7. package/docs/merge-policy.md +2 -1
  8. package/docs/operator-surfaces.md +1 -1
  9. package/docs/plugin-authoring.md +11 -4
  10. package/docs/process-ownership.md +43 -0
  11. package/docs/remote-store-protocol.md +7 -0
  12. package/docs/restacking.md +11 -2
  13. package/docs/setup.md +7 -2
  14. package/docs/troubleshooting.md +6 -0
  15. package/docs/verification.md +1 -1
  16. package/package.json +3 -3
  17. package/packages/core/src/cli/dashboard/model.ts +1 -0
  18. package/packages/core/src/cli/dashboard/vocabulary.ts +3 -0
  19. package/packages/core/src/cli/dispatch.ts +3 -0
  20. package/packages/core/src/events/repository.ts +45 -1
  21. package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +1 -0
  22. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/3f0c4e6d1d54e5bf.json +92 -0
  23. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/b440840a01ea216f.json +115 -0
  24. package/packages/core/src/kernel/dispatch-capacity.ts +47 -6
  25. package/packages/core/src/kernel/engine.ts +15 -2
  26. package/packages/core/src/kernel/janitor-failure.ts +1 -0
  27. package/packages/core/src/kernel/reducer-revisions.ts +3 -0
  28. package/packages/core/src/kernel/repository-read-facts.ts +6 -1
  29. package/packages/core/src/processes/build-runner.ts +67 -7
  30. package/packages/core/src/processes/check-termination.ts +44 -0
  31. package/packages/core/src/processes/dispatcher.ts +472 -57
  32. package/packages/core/src/processes/pass-stages.ts +94 -4
  33. package/packages/core/src/processes/publication-loss.ts +29 -0
  34. package/packages/core/src/processes/repo-view.ts +50 -10
  35. package/packages/core/src/store/contract.ts +43 -0
  36. package/packages/core/src/store/digest.ts +19 -1
  37. package/packages/core/src/store/reducer-value-shapes.json +5605 -5454
  38. package/packages/core/src/store/remote/protocol.ts +3 -0
  39. package/packages/core/src/store/remote/released-clients.json +22 -0
  40. package/packages/core/src/store/remote/released-reducer-values/1.20.0.json +36469 -0
  41. package/packages/core/src/store/remote/released-reducer-values/1.21.0.json +36612 -0
  42. package/packages/core/src/store/remote/released-reducer-values/index.ts +18 -14
  43. package/packages/core/src/store/types.ts +5 -0
  44. package/packages/core/src/testing/reduced-read-budget.ts +412 -2
  45. package/skills/code-review/SKILL.md +5 -0
  46. package/skills/finalize/SKILL.md +5 -0
  47. package/skills/guide/SKILL.md +36 -9
  48. package/skills/guide/references/merge-policy.md +2 -1
  49. package/skills/guide/references/plugin-authoring.md +11 -4
  50. package/skills/guide/references/process-ownership.md +43 -0
  51. package/skills/guide/references/remote-store-protocol.md +7 -0
  52. package/skills/guide/references/restacking.md +11 -2
  53. package/skills/guide/references/setup.md +7 -2
  54. package/skills/harvest/SKILL.md +5 -0
  55. package/skills/harvest-review/SKILL.md +5 -0
  56. package/skills/implement/SKILL.md +5 -0
  57. package/skills/judge/SKILL.md +4 -0
  58. package/skills/operate/SKILL.md +12 -0
  59. package/skills/plan/SKILL.md +5 -0
  60. package/skills/plan-review/SKILL.md +5 -0
  61. package/skills/propose/SKILL.md +5 -0
  62. package/skills/reconcile/SKILL.md +5 -0
  63. package/templates/hosted-service/package.json +2 -2
@@ -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.
@@ -8520,6 +8520,7 @@
8520
8520
  "$.reclaimed: array",
8521
8521
  "$.terminal: string",
8522
8522
  "$.ticketWait: undefined",
8523
+ "$.workspaceOpen: boolean",
8523
8524
  "$: object"
8524
8525
  ],
8525
8526
  "sandboxStates": [
@@ -0,0 +1,92 @@
1
+ {
2
+ "records": [
3
+ {
4
+ "name": "buildDigest",
5
+ "identity": "buildDigest",
6
+ "revisions": [
7
+ "buildDigest/fold/2lfn4ripe4",
8
+ "buildDigest/fold/8fy0afqcn5",
9
+ "buildDigest/fold/r14f4ydbcd",
10
+ "buildDigest/shape/7dw02b53nl",
11
+ "buildDigest/shape/gfei8y6315",
12
+ "buildDigest/shape/qr2vs0xtvj"
13
+ ],
14
+ "entries": {
15
+ "017d8dd5bb6dd80b": "a2d0d3d0a39f884b33fe5b29c625af68",
16
+ "10a4657408d4e121": "a2d0d3d0a39f884b33fe5b29c625af68",
17
+ "1411d1cdbdd9911e": "a2d0d3d0a39f884b33fe5b29c625af68",
18
+ "1444fe1fa7fc802c": "a2d0d3d0a39f884b33fe5b29c625af68",
19
+ "178e12f1759b7552": "a2d0d3d0a39f884b33fe5b29c625af68",
20
+ "1921f86f752428c9": "a2d0d3d0a39f884b33fe5b29c625af68",
21
+ "1972c1d66008ef6b": "a2d0d3d0a39f884b33fe5b29c625af68",
22
+ "19e8e43e7f3f1a06": "a2d0d3d0a39f884b33fe5b29c625af68",
23
+ "21ce2c0bf58318e1": "a2d0d3d0a39f884b33fe5b29c625af68",
24
+ "293dcb3a94fb3470": "d31462f05a2e2dae5c72b866f1a5aed7",
25
+ "2ab7436356267118": "a2d0d3d0a39f884b33fe5b29c625af68",
26
+ "2d084641735caaff": "a2d0d3d0a39f884b33fe5b29c625af68",
27
+ "3237bcecf68e5db9": "a2d0d3d0a39f884b33fe5b29c625af68",
28
+ "33d0cc593610e56f": "733ce596c7746a0eafa1a42bd9002fa2",
29
+ "35cf9ccc4478b2d2": "a2d0d3d0a39f884b33fe5b29c625af68",
30
+ "3649e7bd1203f154": "a2d0d3d0a39f884b33fe5b29c625af68",
31
+ "38c75099d9191471": "c5ea86ea0f58a25ad232aaab30bf5f24",
32
+ "431c9bb2ee8838e0": "a2d0d3d0a39f884b33fe5b29c625af68",
33
+ "49064fc079964a5c": "21786745663a1f172058676e1f4ac3d3",
34
+ "4932c70a2af97faf": "a2d0d3d0a39f884b33fe5b29c625af68",
35
+ "4f00c0f2c8afd159": "a2d0d3d0a39f884b33fe5b29c625af68",
36
+ "516a5a7aadf97587": "a2d0d3d0a39f884b33fe5b29c625af68",
37
+ "536085773daf6b58": "4406d99a8a9b53c1f06df3b54b3252fd",
38
+ "59ffaa6974094c72": "a2d0d3d0a39f884b33fe5b29c625af68",
39
+ "5f0ca42af862c4ee": "097ce77f4c3f47f1507131bbb69eb1a4",
40
+ "6118031132db9bfc": "a2d0d3d0a39f884b33fe5b29c625af68",
41
+ "643d70429ce03dad": "097ce77f4c3f47f1507131bbb69eb1a4",
42
+ "677ea92572c29082": "a2d0d3d0a39f884b33fe5b29c625af68",
43
+ "6ae5bf60504d6467": "670a882990170585207e95b5cdcf1c93",
44
+ "6bd6275061aaffa5": "a2d0d3d0a39f884b33fe5b29c625af68",
45
+ "6efdc8defc75fccb": "a2d0d3d0a39f884b33fe5b29c625af68",
46
+ "7833e42d16301424": "1fb775713fd7c044e18d0f949b13eea6",
47
+ "7d4edad0614adaf1": "a2d0d3d0a39f884b33fe5b29c625af68",
48
+ "837365898d04f45a": "a2d0d3d0a39f884b33fe5b29c625af68",
49
+ "85f9f0c921b8b5bb": "2fba78b7f57b8e4cc307a5abbb86a6c0",
50
+ "8879f57a24733897": "76cac9107e404e323c125d37254e84e9",
51
+ "88cb9e71bdec972d": "5484ba6742bece7b2e0ba8819fc89848",
52
+ "89625654b02e9ac1": "a2d0d3d0a39f884b33fe5b29c625af68",
53
+ "8cc15eb1807c0157": "a2d0d3d0a39f884b33fe5b29c625af68",
54
+ "8ced97c44bc0af3a": "a2d0d3d0a39f884b33fe5b29c625af68",
55
+ "8d4144004720b9f8": "a2d0d3d0a39f884b33fe5b29c625af68",
56
+ "8db633ead1807f8b": "a2d0d3d0a39f884b33fe5b29c625af68",
57
+ "8e42cdbd0994ab0c": "a2d0d3d0a39f884b33fe5b29c625af68",
58
+ "9539b995af5c54a9": "a2d0d3d0a39f884b33fe5b29c625af68",
59
+ "9ee3919fbd4f9458": "a2d0d3d0a39f884b33fe5b29c625af68",
60
+ "a0b32c12e4e6edb6": "a2d0d3d0a39f884b33fe5b29c625af68",
61
+ "a55218252707bdd3": "689bac6f9b5c7bd90d9524eaca58122f",
62
+ "a98af134be2da8a9": "a2d0d3d0a39f884b33fe5b29c625af68",
63
+ "af953392d81911da": "b7371c4e191ae3cd4dcfdd8209937329",
64
+ "b0d877c44810ecb0": "a2d0d3d0a39f884b33fe5b29c625af68",
65
+ "be211f0e31a65006": "67e0fa2cfa5adc5fb40bd74d7cc310e4",
66
+ "c68b7ee2e2610f30": "a2d0d3d0a39f884b33fe5b29c625af68",
67
+ "c7f7e0378aeea237": "a2d0d3d0a39f884b33fe5b29c625af68",
68
+ "c98cb1659eb142b6": "a2d0d3d0a39f884b33fe5b29c625af68",
69
+ "ca830adf06ed55a1": "d05cca66d0eb8361e95db1567f15266d",
70
+ "cb3a219f33e437ca": "a2d0d3d0a39f884b33fe5b29c625af68",
71
+ "cf1e0c0d82567e0c": "a2d0d3d0a39f884b33fe5b29c625af68",
72
+ "d1432a819d8e48c5": "ded9c93e2c31e63ecda783a1c14603be",
73
+ "d185ed6aa9192aff": "a2d0d3d0a39f884b33fe5b29c625af68",
74
+ "d5d5ccca80a893d8": "097ce77f4c3f47f1507131bbb69eb1a4",
75
+ "d873fad29d6c7e55": "a2d0d3d0a39f884b33fe5b29c625af68",
76
+ "e2f18fa32fe1f6d0": "a2d0d3d0a39f884b33fe5b29c625af68",
77
+ "e37393fed29e84c5": "a2d0d3d0a39f884b33fe5b29c625af68",
78
+ "e6a8585e2a054ff6": "a2d0d3d0a39f884b33fe5b29c625af68",
79
+ "eb7ddd5319d09e27": "a2d0d3d0a39f884b33fe5b29c625af68",
80
+ "eca4959b2b87ae15": "f226faf9a216209468a09e99297331ad",
81
+ "ee10d7959ec4843c": "a2d0d3d0a39f884b33fe5b29c625af68",
82
+ "ef1b68347966ab26": "a2d0d3d0a39f884b33fe5b29c625af68",
83
+ "f3e55425cc41f230": "d05cca66d0eb8361e95db1567f15266d",
84
+ "f5b9ace9b59351e7": "a2d0d3d0a39f884b33fe5b29c625af68",
85
+ "f8155387eb5f375c": "92337ee35b617424d494c23dff1be345",
86
+ "fa8f1475a55be935": "a2d0d3d0a39f884b33fe5b29c625af68",
87
+ "fb21116a15d0b1f1": "a2d0d3d0a39f884b33fe5b29c625af68",
88
+ "fe95444fbeabe592": "a2d0d3d0a39f884b33fe5b29c625af68"
89
+ }
90
+ }
91
+ ]
92
+ }
@@ -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
+ }
@@ -42,7 +42,8 @@ import {
42
42
  * Release follows state; acquisition never does, so a leaf whose outside
43
43
  * wait ended asks for a slot (`slotRequest`) and holds none until it is
44
44
  * admitted again. Runner liveness plays no part in a leaf's hold (only launch
45
- * records and execution facts do), and its workspace never counts. A node
45
+ * records and execution facts do), and its workspace never counts. A build
46
+ * whose PR merged holds and requests no slot (`prMerged`). A node
46
47
  * holds a slot only once the dispatcher admitted it for a runner need it still has (`nodeHoldsSlot`); a workspace,
47
48
  * a lease or a provisioning marker never takes one. */
48
49
  export interface CapacityBuild {
@@ -277,7 +278,9 @@ function tiersAtOrAbove(level: BuildPriority): readonly StartTier[] {
277
278
  return START_TIERS.slice(0, START_TIERS.indexOf(level) + 1)
278
279
  }
279
280
 
280
- /** 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`. */
281
284
  function runnerAllocated(build: CapacityBuild, now: Date): boolean {
282
285
  return (
283
286
  !!build.provisioning ||
@@ -296,6 +299,13 @@ function terminal(state: BuildState): boolean {
296
299
  return state.status === 'done' || state.status === 'aborted'
297
300
  }
298
301
 
302
+ /** The build's PR merged: its work is on the target, and only completion and
303
+ * cleanup remain, which are the dispatcher's own and need no runner. A merged
304
+ * build holds and requests no slot, even before `build.completed`. */
305
+ function prMerged(state: BuildState): boolean {
306
+ return state.prState === 'merged'
307
+ }
308
+
299
309
  /** A nonterminal leaf that finished its pipeline (every verify step and
300
310
  * finalize post-step) for the current spec at least once, as recorded by
301
311
  * `pipeline.settled`. A spec revision after settlement makes it unfinished,
@@ -406,6 +416,7 @@ function blockedOnlyByEscalations(build: LeafSlotFacts): boolean {
406
416
  export function leafHoldsSlot(build: LeafSlotFacts): boolean {
407
417
  return (
408
418
  !terminal(build.state) &&
419
+ !prMerged(build.state) &&
409
420
  slotAdmitted(build.state) &&
410
421
  (!leafOutsideWait(build) ||
411
422
  (blockedOnlyByEscalations(build) && escalationCarried(escalationCarryInput(build.state))))
@@ -526,7 +537,8 @@ export function nodeOutsideWait(state: BuildState): boolean {
526
537
  * provisioning marker or live lease. */
527
538
  export function nodeHoldsSlot(build: CapacityBuild, now: Date): boolean {
528
539
  const { state } = build
529
- if (state.kind !== 'node' || terminal(state) || nodeOutsideWait(state)) return false
540
+ if (state.kind !== 'node' || terminal(state) || prMerged(state) || nodeOutsideWait(state))
541
+ return false
530
542
  const needs = nodeRunnerNeeds(state)
531
543
  if (state.slotAdmittedSeq === undefined) return needs.length > 0 && runnerAllocated(build, now)
532
544
  const need = state.slotAdmittedNeed
@@ -548,7 +560,9 @@ export function legacyNodeRunner(build: CapacityBuild, now: Date): boolean {
548
560
  return legacyNodeRunnerNeed(build, now) !== undefined
549
561
  }
550
562
 
551
- /** 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`. */
552
566
  export function legacyNodeRunnerNeed(build: CapacityBuild, now: Date): NodeSlotNeed | undefined {
553
567
  const { state } = build
554
568
  if (
@@ -580,7 +594,7 @@ export function legacyNodeRunnerNeed(build: CapacityBuild, now: Date): NodeSlotN
580
594
 
581
595
  export function occupiesCapacity(build: CapacityBuild, now: Date): boolean {
582
596
  const { state } = build
583
- if (terminal(state)) return false
597
+ if (terminal(state) || prMerged(state)) return false
584
598
  if (state.kind !== 'node') return leafHoldsSlot(build)
585
599
  return nodeHoldsSlot(build, now) || legacyNodeRunner(build, now)
586
600
  }
@@ -591,6 +605,7 @@ export function leafSlotRequest(build: LeafSlotFacts): SlotRequest | undefined {
591
605
  const { state } = build
592
606
  if (
593
607
  terminal(state) ||
608
+ prMerged(state) ||
594
609
  leafHoldsSlot(build) ||
595
610
  leafOutsideWait(build) ||
596
611
  // Mixed-version deferral withholds every decision, admission included.
@@ -630,6 +645,7 @@ export function nodeSlotNeed(build: CapacityBuild, now: Date): NodeSlotNeed | un
630
645
  state.kind !== 'node' ||
631
646
  state.status === 'done' ||
632
647
  state.status === 'aborted' ||
648
+ prMerged(state) ||
633
649
  state.status === 'paused' ||
634
650
  state.status === 'blocked' ||
635
651
  // Mixed-version deferral withholds every decision, admission included.
@@ -645,12 +661,37 @@ export function nodeSlotNeed(build: CapacityBuild, now: Date): NodeSlotNeed | un
645
661
  if (nodeMeasurementDue(state)) return measurementNeed(state)
646
662
  // A stale request (stopped, spent or shrunk below its room) reserves
647
663
  // nothing; the dispatcher withdraws it. A started session was admitted
648
- // 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`.
649
666
  if (proposeAdmissible(state.optimization, now)) return proposeNeed(state)
650
667
  if (integrationAdmissible(state) && integrationNeedsRunner(state)) return integrationNeed(state)
651
668
  return undefined
652
669
  }
653
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
+
654
695
  /** A nonterminal build's slot state, or undefined when it is unknown: a
655
696
  * `done` build reports none, and a value from a server older than durable
656
697
  * admission (no `slotAdmittedSeq`, which every current reducer sets on
@@ -243,7 +243,12 @@ export function decideNextFromFacts(state: BuildState, log: LogIndex, config: Co
243
243
  // A requested measurement runs only once the pipeline has nothing else to
244
244
  // do, so restack, re-verify and reconcile keep their precedence over it. A
245
245
  // request whose baseline a later `target.moved` superseded runs nothing.
246
- if (decision.kind === 'wait' && decision.reason === 'awaiting-pr' && state.kind !== 'node') {
246
+ if (
247
+ decision.kind === 'wait' &&
248
+ decision.reason === 'awaiting-pr' &&
249
+ state.kind !== 'node' &&
250
+ state.prState !== 'merged'
251
+ ) {
247
252
  const request = pendingMeasurementRequest(state)
248
253
  if (request !== undefined) return { kind: 'run-measurement', request }
249
254
  }
@@ -310,6 +315,12 @@ function decideNextInternal(state: BuildState, log: LogIndex, config: Config): D
310
315
  return { kind: 'acknowledge', command: 'pause' }
311
316
  }
312
317
 
318
+ // A merged leaf's work is on the target: nothing runs for it again, whatever
319
+ // its pipeline last decided. The janitor completes it and releases its
320
+ // workspace (§15.7); no runner, restack or measurement is needed.
321
+ if (state.kind !== 'node' && state.prState === 'merged')
322
+ return { kind: 'wait', reason: 'awaiting-pr' }
323
+
313
324
  // A declared ticket wait parks the build until the dispatcher validates it
314
325
  // (SPEC §11 "Ticket waits"): accepted, it becomes an open escalation below;
315
326
  // refused, the declaring phase re-runs with the refusal as guidance.
@@ -1054,9 +1065,11 @@ function decideNextInternal(state: BuildState, log: LogIndex, config: Config): D
1054
1065
 
1055
1066
  /** The §9 awaiting-landing restack condition: the target moved since the
1056
1067
  * build's last restack base, or a target post-step landed after it. Shared
1057
- * with dispatch capacity, which admits a parked build that must restack. */
1068
+ * with dispatch capacity, which admits a parked build that must restack. A
1069
+ * merged PR has nothing to restack: its work is already on the target. */
1058
1070
  export function landingRestackDue(state: BuildState, log: Pick<LogIndex, 'restack'>): boolean {
1059
1071
  return (
1072
+ state.prState !== 'merged' &&
1060
1073
  log.restack.target !== undefined &&
1061
1074
  (log.restack.target.sha !== leafRestackedBase(log.restack) ||
1062
1075
  (state.target !== undefined &&
@@ -34,6 +34,7 @@ export type JanitorOperation =
34
34
  | 'PR check'
35
35
  | 'attempt rejection'
36
36
  | 'session settlement'
37
+ | 'merged workspace release'
37
38
 
38
39
  /** A build's janitor attempt is due: no episode, an answered escalation asked
39
40
  * for a retry, or the backoff has elapsed. */
@@ -108,4 +108,7 @@ export const REDUCER_REVISIONS: Readonly<Record<string, string>> = {
108
108
  'buildReadFacts/shape/ubvhths92u': '#1452 session.suspended carries the ended execution',
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
+ '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',
111
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 }
@@ -139,6 +139,11 @@ import { refreshSummaryBoundary } from '../cli/pr-summary-publication'
139
139
  * - The D5 retry guard also covers agent-verify steps (keyed `verify:<step>`,
140
140
  * round = attempt): a no-terminal or provider-failed verify session would
141
141
  * otherwise re-run forever, since its `verify.completed` never lands.
142
+ * - An orderly stop that interrupts a `run-check` (the runner's own
143
+ * `shutdownSignal`, which includes a stage's interruption) records nothing,
144
+ * re-checked immediately before the `verify.completed` append; the relaunch
145
+ * reruns the member at the same attempt. A non-zero exit or a signal kill
146
+ * while the runner's own shutdown is not in effect is still a failed cycle.
142
147
  * - A throwing Exec in `run-check` propagates: deterministic checks carry no
143
148
  * session to fail (§8.2), and a crashed runner's dangling `verify.started`
144
149
  * simply re-runs the check on re-attach (§15.6-C) — the same crash model
@@ -185,7 +190,8 @@ import type {
185
190
  } from '../ports/types'
186
191
  import { BUILD_EXECUTION_LEASE_TTL_MS } from '../ports/workspace/build-execution'
187
192
  import { phaseScratchRejection, scratchPathsTouchedInRange } from '../ports/workspace/phase-scratch'
188
- import type { Exec } from '../ports/workspace/git-worktree'
193
+ import type { Exec, ExecResult } from '../ports/workspace/git-worktree'
194
+ import { describeCheckTermination } from './check-termination'
189
195
  import type { BuildScopedStore, Clock } from '../store/types'
190
196
  import {
191
197
  attemptPanelId,
@@ -442,6 +448,13 @@ function errorMessage(error: unknown): string {
442
448
  return error instanceof Error ? error.message : String(error)
443
449
  }
444
450
 
451
+ /** A failed check's combined output, capped to its tail. */
452
+ function reportTail(result: ExecResult): string {
453
+ const output = [result.stdout, result.stderr].filter((s) => s !== '').join('\n')
454
+ const content = output.length > REPORT_TAIL_CHARS ? output.slice(-REPORT_TAIL_CHARS) : output
455
+ return content || '(no output)'
456
+ }
457
+
445
458
  /** Bound one captured diff section: unchanged within the cap, otherwise the
446
459
  * first FINALIZE_DIFF_CAPTURE_CAP characters plus an explicit truncation
447
460
  * marker, so truncation is visible in the record itself. */
@@ -4552,7 +4565,10 @@ export class BuildRunner {
4552
4565
 
4553
4566
  /** Deterministic check (§8.2): NO session, NO CLI — the kernel runs the
4554
4567
  * command directly with `AB_VERIFY_BASE` set to the verify diff base, or
4555
- * unset when none exists; a failure deposits the output tail as the report. */
4568
+ * unset when none exists; a failure deposits the output tail as the report.
4569
+ * A signal-killed command's report names the signal and whether the
4570
+ * runner's own shutdown was in effect when it died; one the shutdown
4571
+ * stopped leaves an uncounted report and no event. */
4556
4572
  private async runCheck(decision: RunCheckDecision): Promise<void> {
4557
4573
  await this.withKernelPhaseFailure(verifyPhase(decision.step), decision.attempt, () =>
4558
4574
  this.runCheckOperation(decision),
@@ -4590,6 +4606,11 @@ export class BuildRunner {
4590
4606
  const signals = [this.deps.shutdownSignal, landing?.signal].filter(
4591
4607
  (signal): signal is AbortSignal => signal !== undefined,
4592
4608
  )
4609
+ // An orderly dispatcher stop (drain, deadline teardown, or a stage
4610
+ // interrupted by pause) records nothing: the relaunched execution reruns
4611
+ // this member at the same attempt (#1458).
4612
+ const interrupted = () =>
4613
+ this.deps.shutdownSignal?.aborted === true || landing?.signal.aborted === true
4593
4614
  let result: Awaited<ReturnType<typeof exec>>
4594
4615
  try {
4595
4616
  result = await exec(['sh', '-c', command], {
@@ -4601,12 +4622,22 @@ export class BuildRunner {
4601
4622
  } finally {
4602
4623
  if (this.checkAbort === landing) this.checkAbort = undefined
4603
4624
  }
4604
- if (this.deps.shutdownSignal?.aborted || landing?.signal.aborted) return
4625
+ // Sampled where the command died, before any await: whether the runner's
4626
+ // own shutdown could have sent a terminating signal.
4627
+ const runnerShutdown = this.deps.shutdownSignal?.aborted === true
4628
+ if (runnerShutdown) {
4629
+ await this.depositInterruptedCheckReport(step, attempt, command, result)
4630
+ return
4631
+ }
4632
+ if (landing?.signal.aborted) return
4605
4633
  await this.withVerifyWrite(async () => {
4606
4634
  const state = (await readBuildFacts(store, slug)).value.state
4607
4635
  const key = verifyMemberKey(step, attempt)
4608
4636
  if (state.verifyStage.cancellations[key] || state.verifyStage.outcomes[key]) return
4609
4637
  if (nodeLanded(state)) return
4638
+ // A stop can land during the awaits above. Keep this re-check the last
4639
+ // statement before the append, with no await between them.
4640
+ if (interrupted()) return
4610
4641
  if (result.exitCode === 0) {
4611
4642
  await store.append(slug, {
4612
4643
  actor: KERNEL,
@@ -4616,8 +4647,8 @@ export class BuildRunner {
4616
4647
  return
4617
4648
  }
4618
4649
 
4619
- const output = [result.stdout, result.stderr].filter((s) => s !== '').join('\n')
4620
- const content = output.length > REPORT_TAIL_CHARS ? output.slice(-REPORT_TAIL_CHARS) : output
4650
+ const termination = describeCheckTermination(result.exitCode, false)
4651
+ const tail = reportTail(result)
4621
4652
  // Atomic deposit (D6): report artifact + verify.completed in one bundle;
4622
4653
  // the report routes back to implement via the engine (§15.6-A).
4623
4654
  await store.appendWithArtifacts(
@@ -4625,8 +4656,14 @@ export class BuildRunner {
4625
4656
  [
4626
4657
  {
4627
4658
  kind: verifyReportKind(step),
4628
- content: content || '(no output)',
4629
- metadata: { step, attempt, command, exitCode: result.exitCode },
4659
+ content: termination ? `${termination.line}\n${tail}` : tail,
4660
+ metadata: {
4661
+ step,
4662
+ attempt,
4663
+ command,
4664
+ exitCode: result.exitCode,
4665
+ ...termination?.metadata,
4666
+ },
4630
4667
  },
4631
4668
  ],
4632
4669
  (deposited) => {
@@ -4648,6 +4685,29 @@ export class BuildRunner {
4648
4685
  })
4649
4686
  }
4650
4687
 
4688
+ /** A check the runner's own shutdown killed by signal leaves an uncounted
4689
+ * report: an artifact revision with no event, so no `verify.completed`, no
4690
+ * failed cycle and no spent attempt. Best-effort — the stop stays orderly
4691
+ * when the store refuses the write. */
4692
+ private async depositInterruptedCheckReport(
4693
+ step: string,
4694
+ attempt: number,
4695
+ command: string,
4696
+ result: ExecResult,
4697
+ ): Promise<void> {
4698
+ const termination = describeCheckTermination(result.exitCode, true)
4699
+ if (termination === undefined) return
4700
+ try {
4701
+ await this.deps.store.putArtifact(this.deps.slug, {
4702
+ kind: verifyReportKind(step),
4703
+ content: `${termination.line}\n${reportTail(result)}`,
4704
+ metadata: { step, attempt, command, exitCode: result.exitCode, ...termination.metadata },
4705
+ })
4706
+ } catch {
4707
+ // A lost diagnosis must never turn an orderly stop into phase.failed.
4708
+ }
4709
+ }
4710
+
4651
4711
  /** Agent-verify step (§5): a session with a pass/fail/skip verdict. */
4652
4712
  private async runAgentVerify(decision: RunAgentVerifyDecision): Promise<void> {
4653
4713
  await this.withKernelPhaseFailure(verifyPhase(decision.step), decision.attempt, () =>