forgedock 1.66.0 → 1.68.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 (173) hide show
  1. package/bin/config-schema.mjs +3 -0
  2. package/bin/engine/outcome-codes.mjs +2 -0
  3. package/bin/engine-cli.mjs +193 -27
  4. package/bin/engine.mjs +10 -0
  5. package/bin/forgedock.mjs +24 -1
  6. package/bin/help-text.mjs +4 -3
  7. package/bin/introspect-schedule.mjs +98 -0
  8. package/bin/introspect-schedule.test.mjs +67 -0
  9. package/bin/lean/admission.mjs +21 -0
  10. package/bin/lean/admission.test.mjs +30 -0
  11. package/bin/lean/advisory.test.mjs +64 -0
  12. package/bin/lean/amendment-schema.mjs +30 -0
  13. package/bin/lean/attempts.mjs +162 -0
  14. package/bin/lean/attempts.test.mjs +141 -0
  15. package/bin/lean/basered.mjs +81 -0
  16. package/bin/lean/basered.test.mjs +68 -1
  17. package/bin/lean/batch-health.mjs +20 -12
  18. package/bin/lean/batch-health.test.mjs +55 -11
  19. package/bin/lean/batch.mjs +45 -0
  20. package/bin/lean/batch.test.mjs +105 -5
  21. package/bin/lean/capwait.mjs +14 -3
  22. package/bin/lean/capwait.test.mjs +20 -0
  23. package/bin/lean/ci-gate.mjs +2 -90
  24. package/bin/lean/ci-gate.test.mjs +1 -127
  25. package/bin/lean/ci-precheck.mjs +25 -8
  26. package/bin/lean/ci-precheck.test.mjs +24 -0
  27. package/bin/lean/clear-breaker.mjs +14 -0
  28. package/bin/lean/clear-breaker.test.mjs +4 -3
  29. package/bin/lean/commentstate.mjs +46 -0
  30. package/bin/lean/commentstate.test.mjs +43 -0
  31. package/bin/lean/concurrency.mjs +89 -0
  32. package/bin/lean/concurrency.test.mjs +113 -0
  33. package/bin/lean/conformance.e2e.test.mjs +13 -8
  34. package/bin/lean/conformance.mjs +73 -181
  35. package/bin/lean/conformance.test.mjs +61 -345
  36. package/bin/lean/depcache.mjs +100 -10
  37. package/bin/lean/depcache.test.mjs +105 -0
  38. package/bin/lean/docsgate.mjs +0 -32
  39. package/bin/lean/docsgate.test.mjs +2 -23
  40. package/bin/lean/effects-cap.test.mjs +9 -1
  41. package/bin/lean/effects-killtree.test.mjs +35 -0
  42. package/bin/lean/effects.mjs +42 -24
  43. package/bin/lean/efficiency.mjs +162 -0
  44. package/bin/lean/efficiency.test.mjs +79 -0
  45. package/bin/lean/engine-readmit.test.mjs +35 -0
  46. package/bin/lean/envgap.mjs +93 -0
  47. package/bin/lean/envgap.test.mjs +53 -0
  48. package/bin/lean/execution.mjs +41 -17
  49. package/bin/lean/execution.test.mjs +58 -0
  50. package/bin/lean/failure-census.mjs +170 -0
  51. package/bin/lean/failure-census.test.mjs +59 -0
  52. package/bin/lean/failure-stop.mjs +46 -0
  53. package/bin/lean/failure-stop.test.mjs +45 -0
  54. package/bin/lean/fixtures/capacity-storm.json +609 -0
  55. package/bin/lean/guardgate.test.mjs +2 -3
  56. package/bin/lean/heavy.mjs +33 -4
  57. package/bin/lean/heavy.test.mjs +38 -6
  58. package/bin/lean/hotarea.mjs +0 -36
  59. package/bin/lean/hotarea.test.mjs +1 -22
  60. package/bin/lean/issuewatch-verify.mjs +19 -4
  61. package/bin/lean/issuewatch.mjs +21 -4
  62. package/bin/lean/issuewatch.test.mjs +48 -1
  63. package/bin/lean/lane-audit-gap.mjs +66 -0
  64. package/bin/lean/lane-audit-gap.test.mjs +59 -0
  65. package/bin/lean/lane-audit-llm.mjs +5 -0
  66. package/bin/lean/lane-audit-query.mjs +47 -0
  67. package/bin/lean/lane-audit-query.test.mjs +44 -0
  68. package/bin/lean/lane-audit-signatures.mjs +33 -0
  69. package/bin/lean/lane-audit.mjs +110 -0
  70. package/bin/lean/lane-audit.test.mjs +97 -0
  71. package/bin/lean/lane-recovery.test.mjs +33 -0
  72. package/bin/lean/lanecheck.mjs +5 -3
  73. package/bin/lean/lanecheck.test.mjs +6 -0
  74. package/bin/lean/lean.mjs +311 -154
  75. package/bin/lean/lean.test.mjs +530 -223
  76. package/bin/lean/limits.mjs +17 -0
  77. package/bin/lean/limits.test.mjs +15 -1
  78. package/bin/lean/live-execution.mjs +21 -2
  79. package/bin/lean/live-execution.test.mjs +39 -0
  80. package/bin/lean/liveness.mjs +37 -0
  81. package/bin/lean/liveness.test.mjs +33 -0
  82. package/bin/lean/orchestrate-attempts.test.mjs +82 -0
  83. package/bin/lean/orchestrate-envhold.test.mjs +47 -0
  84. package/bin/lean/orchestrate-heldroot.test.mjs +72 -0
  85. package/bin/lean/orchestrate-hostfallback.test.mjs +59 -1
  86. package/bin/lean/orchestrate-overload-recovery.test.mjs +37 -0
  87. package/bin/lean/orchestrate-pause.test.mjs +76 -1
  88. package/bin/lean/orchestrate-reconcile.test.mjs +164 -0
  89. package/bin/lean/orchestrate-relaunch-gates.test.mjs +57 -0
  90. package/bin/lean/orchestrate-stacking.test.mjs +10 -0
  91. package/bin/lean/orchestrate.mjs +344 -45
  92. package/bin/lean/phaseledger.mjs +6 -0
  93. package/bin/lean/phaseledger.test.mjs +13 -1
  94. package/bin/lean/postdeploy-check.test.mjs +1 -3
  95. package/bin/lean/precheck.mjs +20 -0
  96. package/bin/lean/preflight.mjs +100 -11
  97. package/bin/lean/preflight.test.mjs +44 -4
  98. package/bin/lean/prompts.mjs +13 -28
  99. package/bin/lean/reconcile.mjs +90 -0
  100. package/bin/lean/recurrence.mjs +6 -112
  101. package/bin/lean/recurrence.test.mjs +11 -92
  102. package/bin/lean/release-flakes.mjs +14 -2
  103. package/bin/lean/release-flakes.test.mjs +17 -1
  104. package/bin/lean/release-ledger.mjs +19 -1
  105. package/bin/lean/release-ledger.test.mjs +23 -0
  106. package/bin/lean/release-preflight.mjs +28 -0
  107. package/bin/lean/release-preflight.test.mjs +42 -1
  108. package/bin/lean/release-review.mjs +40 -5
  109. package/bin/lean/release-review.test.mjs +43 -2
  110. package/bin/lean/release.mjs +43 -14
  111. package/bin/lean/release.test.mjs +32 -0
  112. package/bin/lean/retry.mjs +1 -1
  113. package/bin/lean/retry.test.mjs +6 -1
  114. package/bin/lean/rotator.mjs +9 -0
  115. package/bin/lean/rotator.test.mjs +11 -1
  116. package/bin/lean/sandbox-remote.mjs +49 -11
  117. package/bin/lean/sched.mjs +19 -0
  118. package/bin/lean/sched.test.mjs +11 -1
  119. package/bin/lean/schedd-health.mjs +4 -4
  120. package/bin/lean/schedd-health.test.mjs +8 -4
  121. package/bin/lean/schedd.mjs +45 -8
  122. package/bin/lean/schedd.test.mjs +120 -7
  123. package/bin/lean/selfreview.mjs +1 -1
  124. package/bin/lean/slo.mjs +126 -0
  125. package/bin/lean/slo.test.mjs +112 -0
  126. package/bin/lean/statuscomment.mjs +40 -0
  127. package/bin/lean/statuscomment.test.mjs +48 -1
  128. package/bin/lean/validate-catalog.mjs +108 -0
  129. package/bin/lean/validate-catalog.test.mjs +46 -1
  130. package/bin/lean/verify.mjs +3 -2
  131. package/bin/pool/affinity.test.mjs +91 -0
  132. package/bin/pool/agent.mjs +144 -10
  133. package/bin/pool/cache-sweep.mjs +31 -10
  134. package/bin/pool/ci-autoscale.mjs +160 -0
  135. package/bin/pool/cli.mjs +53 -9
  136. package/bin/pool/docker.mjs +3 -0
  137. package/bin/pool/engine-placement.test.mjs +94 -0
  138. package/bin/pool/lane-target.mjs +41 -0
  139. package/bin/pool/lane-tools.mjs +26 -0
  140. package/bin/pool/lane-tools.test.mjs +9 -0
  141. package/bin/pool/mirror-seed.mjs +15 -11
  142. package/bin/pool/router.mjs +88 -32
  143. package/bin/pool/version.mjs +29 -2
  144. package/bin/review-staging.mjs +11 -3
  145. package/bin/runner.mjs +59 -11
  146. package/bin/stats/attempts.mjs +54 -0
  147. package/bin/stats/attempts.test.mjs +30 -0
  148. package/bin/stats/churn.mjs +49 -0
  149. package/bin/stats/churn.test.mjs +31 -0
  150. package/bin/stats/index.mjs +11 -3
  151. package/bin/stats/release.mjs +7 -0
  152. package/bin/stats/release.test.mjs +20 -0
  153. package/bin/stats/scorecard.mjs +187 -0
  154. package/bin/stats/scorecard.test.mjs +89 -0
  155. package/commands/orchestrate.md +21 -18
  156. package/docs/CONFIG.md +41 -0
  157. package/docs/OUTCOME-CODES.md +2 -0
  158. package/docs/STATS.md +17 -0
  159. package/package.json +1 -1
  160. package/pool/image/Dockerfile +14 -2
  161. package/pool/image/manifest.json +25 -0
  162. package/pool/image/mirror.sh +11 -2
  163. package/pool/install/install-agent.ps1 +11 -4
  164. package/scripts/check-devdocs-freshness.sh +1 -1
  165. package/scripts/ci-local/adapters/github-actions.mjs +8 -0
  166. package/scripts/ci-local/cli.mjs +1 -1
  167. package/scripts/ci-local/plan.mjs +3 -2
  168. package/scripts/ci-local.test.sh +11 -0
  169. package/scripts/failure-census.mjs +67 -0
  170. package/scripts/review-finalize.sh +5 -5
  171. package/scripts/review-finalize.test.sh +8 -1
  172. package/scripts/verify-phase-trail.sh +11 -0
  173. package/scripts/verify-phase-trail.test.sh +9 -0
@@ -0,0 +1,609 @@
1
+ {
2
+ "note": "recorded 503 storm: the pool refuses every launch attempt (60s retry timer) until t=420s, then load clears; times are ms from storm start",
3
+ "lanes": 6,
4
+ "pollMs": 10000,
5
+ "clearsAtMs": 420000,
6
+ "endMs": 900000,
7
+ "codes": [
8
+ "pool.host_load",
9
+ "pool.host_mem",
10
+ "pool.projected_peak",
11
+ "pool.disk_low"
12
+ ],
13
+ "attempts": [
14
+ {
15
+ "lane": 1,
16
+ "at": 1000,
17
+ "code": "pool.host_mem",
18
+ "live": {
19
+ "load_per_core": 2.1,
20
+ "mem_available_gb": 1.2
21
+ }
22
+ },
23
+ {
24
+ "lane": 1,
25
+ "at": 61000,
26
+ "code": "pool.projected_peak",
27
+ "live": {
28
+ "load_per_core": 2.1,
29
+ "mem_available_gb": 1.2
30
+ }
31
+ },
32
+ {
33
+ "lane": 1,
34
+ "at": 121000,
35
+ "code": "pool.disk_low",
36
+ "live": {
37
+ "load_per_core": 2.1,
38
+ "mem_available_gb": 1.2
39
+ }
40
+ },
41
+ {
42
+ "lane": 1,
43
+ "at": 181000,
44
+ "code": "pool.host_load",
45
+ "live": {
46
+ "load_per_core": 2.1,
47
+ "mem_available_gb": 1.2
48
+ }
49
+ },
50
+ {
51
+ "lane": 1,
52
+ "at": 241000,
53
+ "code": "pool.host_mem",
54
+ "live": {
55
+ "load_per_core": 2.1,
56
+ "mem_available_gb": 1.2
57
+ }
58
+ },
59
+ {
60
+ "lane": 1,
61
+ "at": 301000,
62
+ "code": "pool.projected_peak",
63
+ "live": {
64
+ "load_per_core": 2.1,
65
+ "mem_available_gb": 1.2
66
+ }
67
+ },
68
+ {
69
+ "lane": 1,
70
+ "at": 361000,
71
+ "code": "pool.disk_low",
72
+ "live": {
73
+ "load_per_core": 2.1,
74
+ "mem_available_gb": 1.2
75
+ }
76
+ },
77
+ {
78
+ "lane": 1,
79
+ "at": 421000,
80
+ "code": "pool.host_load",
81
+ "live": {
82
+ "load_per_core": 0.6,
83
+ "mem_available_gb": 9
84
+ }
85
+ },
86
+ {
87
+ "lane": 1,
88
+ "at": 481000,
89
+ "code": "pool.host_mem",
90
+ "live": {
91
+ "load_per_core": 0.6,
92
+ "mem_available_gb": 9
93
+ }
94
+ },
95
+ {
96
+ "lane": 1,
97
+ "at": 541000,
98
+ "code": "pool.projected_peak",
99
+ "live": {
100
+ "load_per_core": 0.6,
101
+ "mem_available_gb": 9
102
+ }
103
+ },
104
+ {
105
+ "lane": 1,
106
+ "at": 601000,
107
+ "code": "pool.disk_low",
108
+ "live": {
109
+ "load_per_core": 0.6,
110
+ "mem_available_gb": 9
111
+ }
112
+ },
113
+ {
114
+ "lane": 2,
115
+ "at": 2000,
116
+ "code": "pool.projected_peak",
117
+ "live": {
118
+ "load_per_core": 2.1,
119
+ "mem_available_gb": 1.2
120
+ }
121
+ },
122
+ {
123
+ "lane": 2,
124
+ "at": 62000,
125
+ "code": "pool.disk_low",
126
+ "live": {
127
+ "load_per_core": 2.1,
128
+ "mem_available_gb": 1.2
129
+ }
130
+ },
131
+ {
132
+ "lane": 2,
133
+ "at": 122000,
134
+ "code": "pool.host_load",
135
+ "live": {
136
+ "load_per_core": 2.1,
137
+ "mem_available_gb": 1.2
138
+ }
139
+ },
140
+ {
141
+ "lane": 2,
142
+ "at": 182000,
143
+ "code": "pool.host_mem",
144
+ "live": {
145
+ "load_per_core": 2.1,
146
+ "mem_available_gb": 1.2
147
+ }
148
+ },
149
+ {
150
+ "lane": 2,
151
+ "at": 242000,
152
+ "code": "pool.projected_peak",
153
+ "live": {
154
+ "load_per_core": 2.1,
155
+ "mem_available_gb": 1.2
156
+ }
157
+ },
158
+ {
159
+ "lane": 2,
160
+ "at": 302000,
161
+ "code": "pool.disk_low",
162
+ "live": {
163
+ "load_per_core": 2.1,
164
+ "mem_available_gb": 1.2
165
+ }
166
+ },
167
+ {
168
+ "lane": 2,
169
+ "at": 362000,
170
+ "code": "pool.host_load",
171
+ "live": {
172
+ "load_per_core": 2.1,
173
+ "mem_available_gb": 1.2
174
+ }
175
+ },
176
+ {
177
+ "lane": 2,
178
+ "at": 422000,
179
+ "code": "pool.host_mem",
180
+ "live": {
181
+ "load_per_core": 0.6,
182
+ "mem_available_gb": 9
183
+ }
184
+ },
185
+ {
186
+ "lane": 2,
187
+ "at": 482000,
188
+ "code": "pool.projected_peak",
189
+ "live": {
190
+ "load_per_core": 0.6,
191
+ "mem_available_gb": 9
192
+ }
193
+ },
194
+ {
195
+ "lane": 2,
196
+ "at": 542000,
197
+ "code": "pool.disk_low",
198
+ "live": {
199
+ "load_per_core": 0.6,
200
+ "mem_available_gb": 9
201
+ }
202
+ },
203
+ {
204
+ "lane": 2,
205
+ "at": 602000,
206
+ "code": "pool.host_load",
207
+ "live": {
208
+ "load_per_core": 0.6,
209
+ "mem_available_gb": 9
210
+ }
211
+ },
212
+ {
213
+ "lane": 3,
214
+ "at": 3000,
215
+ "code": "pool.disk_low",
216
+ "live": {
217
+ "load_per_core": 2.1,
218
+ "mem_available_gb": 1.2
219
+ }
220
+ },
221
+ {
222
+ "lane": 3,
223
+ "at": 63000,
224
+ "code": "pool.host_load",
225
+ "live": {
226
+ "load_per_core": 2.1,
227
+ "mem_available_gb": 1.2
228
+ }
229
+ },
230
+ {
231
+ "lane": 3,
232
+ "at": 123000,
233
+ "code": "pool.host_mem",
234
+ "live": {
235
+ "load_per_core": 2.1,
236
+ "mem_available_gb": 1.2
237
+ }
238
+ },
239
+ {
240
+ "lane": 3,
241
+ "at": 183000,
242
+ "code": "pool.projected_peak",
243
+ "live": {
244
+ "load_per_core": 2.1,
245
+ "mem_available_gb": 1.2
246
+ }
247
+ },
248
+ {
249
+ "lane": 3,
250
+ "at": 243000,
251
+ "code": "pool.disk_low",
252
+ "live": {
253
+ "load_per_core": 2.1,
254
+ "mem_available_gb": 1.2
255
+ }
256
+ },
257
+ {
258
+ "lane": 3,
259
+ "at": 303000,
260
+ "code": "pool.host_load",
261
+ "live": {
262
+ "load_per_core": 2.1,
263
+ "mem_available_gb": 1.2
264
+ }
265
+ },
266
+ {
267
+ "lane": 3,
268
+ "at": 363000,
269
+ "code": "pool.host_mem",
270
+ "live": {
271
+ "load_per_core": 2.1,
272
+ "mem_available_gb": 1.2
273
+ }
274
+ },
275
+ {
276
+ "lane": 3,
277
+ "at": 423000,
278
+ "code": "pool.projected_peak",
279
+ "live": {
280
+ "load_per_core": 0.6,
281
+ "mem_available_gb": 9
282
+ }
283
+ },
284
+ {
285
+ "lane": 3,
286
+ "at": 483000,
287
+ "code": "pool.disk_low",
288
+ "live": {
289
+ "load_per_core": 0.6,
290
+ "mem_available_gb": 9
291
+ }
292
+ },
293
+ {
294
+ "lane": 3,
295
+ "at": 543000,
296
+ "code": "pool.host_load",
297
+ "live": {
298
+ "load_per_core": 0.6,
299
+ "mem_available_gb": 9
300
+ }
301
+ },
302
+ {
303
+ "lane": 3,
304
+ "at": 603000,
305
+ "code": "pool.host_mem",
306
+ "live": {
307
+ "load_per_core": 0.6,
308
+ "mem_available_gb": 9
309
+ }
310
+ },
311
+ {
312
+ "lane": 4,
313
+ "at": 4000,
314
+ "code": "pool.host_load",
315
+ "live": {
316
+ "load_per_core": 2.1,
317
+ "mem_available_gb": 1.2
318
+ }
319
+ },
320
+ {
321
+ "lane": 4,
322
+ "at": 64000,
323
+ "code": "pool.host_mem",
324
+ "live": {
325
+ "load_per_core": 2.1,
326
+ "mem_available_gb": 1.2
327
+ }
328
+ },
329
+ {
330
+ "lane": 4,
331
+ "at": 124000,
332
+ "code": "pool.projected_peak",
333
+ "live": {
334
+ "load_per_core": 2.1,
335
+ "mem_available_gb": 1.2
336
+ }
337
+ },
338
+ {
339
+ "lane": 4,
340
+ "at": 184000,
341
+ "code": "pool.disk_low",
342
+ "live": {
343
+ "load_per_core": 2.1,
344
+ "mem_available_gb": 1.2
345
+ }
346
+ },
347
+ {
348
+ "lane": 4,
349
+ "at": 244000,
350
+ "code": "pool.host_load",
351
+ "live": {
352
+ "load_per_core": 2.1,
353
+ "mem_available_gb": 1.2
354
+ }
355
+ },
356
+ {
357
+ "lane": 4,
358
+ "at": 304000,
359
+ "code": "pool.host_mem",
360
+ "live": {
361
+ "load_per_core": 2.1,
362
+ "mem_available_gb": 1.2
363
+ }
364
+ },
365
+ {
366
+ "lane": 4,
367
+ "at": 364000,
368
+ "code": "pool.projected_peak",
369
+ "live": {
370
+ "load_per_core": 2.1,
371
+ "mem_available_gb": 1.2
372
+ }
373
+ },
374
+ {
375
+ "lane": 4,
376
+ "at": 424000,
377
+ "code": "pool.disk_low",
378
+ "live": {
379
+ "load_per_core": 0.6,
380
+ "mem_available_gb": 9
381
+ }
382
+ },
383
+ {
384
+ "lane": 4,
385
+ "at": 484000,
386
+ "code": "pool.host_load",
387
+ "live": {
388
+ "load_per_core": 0.6,
389
+ "mem_available_gb": 9
390
+ }
391
+ },
392
+ {
393
+ "lane": 4,
394
+ "at": 544000,
395
+ "code": "pool.host_mem",
396
+ "live": {
397
+ "load_per_core": 0.6,
398
+ "mem_available_gb": 9
399
+ }
400
+ },
401
+ {
402
+ "lane": 4,
403
+ "at": 604000,
404
+ "code": "pool.projected_peak",
405
+ "live": {
406
+ "load_per_core": 0.6,
407
+ "mem_available_gb": 9
408
+ }
409
+ },
410
+ {
411
+ "lane": 5,
412
+ "at": 5000,
413
+ "code": "pool.host_mem",
414
+ "live": {
415
+ "load_per_core": 2.1,
416
+ "mem_available_gb": 1.2
417
+ }
418
+ },
419
+ {
420
+ "lane": 5,
421
+ "at": 65000,
422
+ "code": "pool.projected_peak",
423
+ "live": {
424
+ "load_per_core": 2.1,
425
+ "mem_available_gb": 1.2
426
+ }
427
+ },
428
+ {
429
+ "lane": 5,
430
+ "at": 125000,
431
+ "code": "pool.disk_low",
432
+ "live": {
433
+ "load_per_core": 2.1,
434
+ "mem_available_gb": 1.2
435
+ }
436
+ },
437
+ {
438
+ "lane": 5,
439
+ "at": 185000,
440
+ "code": "pool.host_load",
441
+ "live": {
442
+ "load_per_core": 2.1,
443
+ "mem_available_gb": 1.2
444
+ }
445
+ },
446
+ {
447
+ "lane": 5,
448
+ "at": 245000,
449
+ "code": "pool.host_mem",
450
+ "live": {
451
+ "load_per_core": 2.1,
452
+ "mem_available_gb": 1.2
453
+ }
454
+ },
455
+ {
456
+ "lane": 5,
457
+ "at": 305000,
458
+ "code": "pool.projected_peak",
459
+ "live": {
460
+ "load_per_core": 2.1,
461
+ "mem_available_gb": 1.2
462
+ }
463
+ },
464
+ {
465
+ "lane": 5,
466
+ "at": 365000,
467
+ "code": "pool.disk_low",
468
+ "live": {
469
+ "load_per_core": 2.1,
470
+ "mem_available_gb": 1.2
471
+ }
472
+ },
473
+ {
474
+ "lane": 5,
475
+ "at": 425000,
476
+ "code": "pool.host_load",
477
+ "live": {
478
+ "load_per_core": 0.6,
479
+ "mem_available_gb": 9
480
+ }
481
+ },
482
+ {
483
+ "lane": 5,
484
+ "at": 485000,
485
+ "code": "pool.host_mem",
486
+ "live": {
487
+ "load_per_core": 0.6,
488
+ "mem_available_gb": 9
489
+ }
490
+ },
491
+ {
492
+ "lane": 5,
493
+ "at": 545000,
494
+ "code": "pool.projected_peak",
495
+ "live": {
496
+ "load_per_core": 0.6,
497
+ "mem_available_gb": 9
498
+ }
499
+ },
500
+ {
501
+ "lane": 5,
502
+ "at": 605000,
503
+ "code": "pool.disk_low",
504
+ "live": {
505
+ "load_per_core": 0.6,
506
+ "mem_available_gb": 9
507
+ }
508
+ },
509
+ {
510
+ "lane": 6,
511
+ "at": 6000,
512
+ "code": "pool.projected_peak",
513
+ "live": {
514
+ "load_per_core": 2.1,
515
+ "mem_available_gb": 1.2
516
+ }
517
+ },
518
+ {
519
+ "lane": 6,
520
+ "at": 66000,
521
+ "code": "pool.disk_low",
522
+ "live": {
523
+ "load_per_core": 2.1,
524
+ "mem_available_gb": 1.2
525
+ }
526
+ },
527
+ {
528
+ "lane": 6,
529
+ "at": 126000,
530
+ "code": "pool.host_load",
531
+ "live": {
532
+ "load_per_core": 2.1,
533
+ "mem_available_gb": 1.2
534
+ }
535
+ },
536
+ {
537
+ "lane": 6,
538
+ "at": 186000,
539
+ "code": "pool.host_mem",
540
+ "live": {
541
+ "load_per_core": 2.1,
542
+ "mem_available_gb": 1.2
543
+ }
544
+ },
545
+ {
546
+ "lane": 6,
547
+ "at": 246000,
548
+ "code": "pool.projected_peak",
549
+ "live": {
550
+ "load_per_core": 2.1,
551
+ "mem_available_gb": 1.2
552
+ }
553
+ },
554
+ {
555
+ "lane": 6,
556
+ "at": 306000,
557
+ "code": "pool.disk_low",
558
+ "live": {
559
+ "load_per_core": 2.1,
560
+ "mem_available_gb": 1.2
561
+ }
562
+ },
563
+ {
564
+ "lane": 6,
565
+ "at": 366000,
566
+ "code": "pool.host_load",
567
+ "live": {
568
+ "load_per_core": 2.1,
569
+ "mem_available_gb": 1.2
570
+ }
571
+ },
572
+ {
573
+ "lane": 6,
574
+ "at": 426000,
575
+ "code": "pool.host_mem",
576
+ "live": {
577
+ "load_per_core": 0.6,
578
+ "mem_available_gb": 9
579
+ }
580
+ },
581
+ {
582
+ "lane": 6,
583
+ "at": 486000,
584
+ "code": "pool.projected_peak",
585
+ "live": {
586
+ "load_per_core": 0.6,
587
+ "mem_available_gb": 9
588
+ }
589
+ },
590
+ {
591
+ "lane": 6,
592
+ "at": 546000,
593
+ "code": "pool.disk_low",
594
+ "live": {
595
+ "load_per_core": 0.6,
596
+ "mem_available_gb": 9
597
+ }
598
+ },
599
+ {
600
+ "lane": 6,
601
+ "at": 606000,
602
+ "code": "pool.host_load",
603
+ "live": {
604
+ "load_per_core": 0.6,
605
+ "mem_available_gb": 9
606
+ }
607
+ }
608
+ ]
609
+ }
@@ -83,10 +83,9 @@ test("an accepted supersedes amendment passes the precheck and names the superse
83
83
  assert.deepEqual(supersededIds(a.contract, []), [], "only selected guards are retired");
84
84
  });
85
85
 
86
- test("a supersedes amendment without a guard id is rejected", () => {
86
+ test("a supersedes amendment without a guard id is not applied (#6083)", () => {
87
87
  const a = applyAmendments({ requirements: [], deliverables: [] }, [{ kind: "supersedes", why: "x" }, { kind: "supersedes", guard: "abc", why: "x" }]);
88
- assert.equal(a.problems.length, 2);
89
- assert.match(a.problems[0], /needs guard/);
88
+ assert.deepEqual(a.contract.supersedes ?? [], []);
90
89
  });
91
90
 
92
91
  test("a lane touching no guarded hunk selects nothing and runs no git or test", async () => {
@@ -25,7 +25,7 @@ import { fileURLToPath, pathToFileURL } from "node:url";
25
25
  import { writeAtomic } from "./batch.mjs";
26
26
  import { schedDir, pidAlive, DEFAULT_PRIORITY } from "./sched.mjs";
27
27
  import { which } from "./toolchain.mjs";
28
- import { hostParallelism } from "./admission.mjs";
28
+ import { hostParallelism, quotaCores } from "./admission.mjs";
29
29
  import { lowerPriority } from "./hostload.mjs";
30
30
 
31
31
  export const HEAVY_DEFAULTS = Object.freeze({ enabled: true, max: null, step_mem_mb: 2048, reserve_mb: 1024, ramp_s: 60, max_wait_s: 1800 });
@@ -253,6 +253,33 @@ export async function acquireHeavy(h, entry = {}, { pollMs = HEAVY_POLL_MS, slee
253
253
  }
254
254
  }
255
255
 
256
+ /**
257
+ * #6047: remote-token backend, chosen when CS_HEAVY_BASE (the pool agent's per-sandbox /heavy route) is set. Acquire polls
258
+ * while the agent denies, renews the lease on a timer, release is best effort; an unreachable or erroring agent, or a wait past
259
+ * `maxWaitMs`, fails open (the step runs, `failOpen: true`). `fetchFn` returns {status, json()}.
260
+ */
261
+ export async function acquireRemote({ base, credToken = "", fetchFn = (u, o) => fetch(u, o), sleep = (ms) => new Promise((r) => setTimeout(r, ms)), now = () => Date.now(), pollMs = 5000, renewMs = 60000, maxWaitMs = HEAVY_DEFAULTS.max_wait_s * 1000, setTimer = setInterval, clearTimer = clearInterval } = {}) {
262
+ const call = async (action, body) => {
263
+ const r = await fetchFn(`${base}/${action}`, { method: "POST", headers: { "content-type": "application/json", authorization: `Bearer ${credToken}` }, body: JSON.stringify(body ?? {}), signal: AbortSignal.timeout(10000) });
264
+ if (r.status !== 200) throw new Error(`heavy ${action}: HTTP ${r.status}`);
265
+ return r.json();
266
+ };
267
+ const t0 = now(), open = { waitMs: 0, queued: 0, holders: 1, release: () => {} };
268
+ for (;;) {
269
+ let r;
270
+ try { r = await call("acquire"); } catch { return { ...open, waitMs: now() - t0, failOpen: true }; }
271
+ if (r?.granted && r.token) {
272
+ const token = r.token, timer = setTimer(() => { call("renew", { token }).catch(() => {}); }, renewMs);
273
+ timer?.unref?.();
274
+ let released = false;
275
+ return { ...open, waitMs: now() - t0, token, release: () => { if (released) return; released = true; clearTimer(timer); call("release", { token }).catch(() => {}); } };
276
+ }
277
+ if (now() - t0 >= maxWaitMs) return { ...open, waitMs: now() - t0, failOpen: true, timedOut: true };
278
+ await sleep(Math.min(pollMs, Math.max(1, Number(r?.retry_after_s) * 1000 || pollMs)));
279
+ }
280
+ }
281
+ const cgroupRead = (f) => readFileSync(f, "utf8");
282
+
256
283
  /** Default lane effect: `acquire(entry, cfg)` → {waitMs, queued, release()} (cfg = the lane's forge.yaml heavy keys); `stats()`; `lane(pids)` (#4405). */
257
284
  export function makeHeavyIo({ dir = schedDir(), env = process.env, host } = {}) {
258
285
  const open = (cfg) => openHeavy(dir, { cfg, env, ...(host ? { host } : {}) });
@@ -385,7 +412,7 @@ export function labelDockerArgs(name, args, env = {}) {
385
412
  * CLI body: `run --name <n> -- <real> args...`. Pass-through when FORGE_HEAVY_HELD is set or the step is llm; else
386
413
  * acquire, run with FORGE_HEAVY_HELD=1 and FORGE_HOST_PARALLELISM from live holders, release, propagate the exit.
387
414
  */
388
- export async function runWrapped(argv, { env: env0 = process.env, open = openHeavy, run = spawnInherit, host } = {}) {
415
+ export async function runWrapped(argv, { env: env0 = process.env, open = openHeavy, run = spawnInherit, host, remote = acquireRemote, read = cgroupRead } = {}) {
389
416
  let env = env0;
390
417
  const sep = argv.indexOf("--");
391
418
  if (argv[0] !== "run" || sep < 0 || !argv[sep + 1]) throw new Error("usage: heavy.mjs run --name <name> -- <command> [args...]");
@@ -398,12 +425,14 @@ export async function runWrapped(argv, { env: env0 = process.env, open = openHea
398
425
  cmd = g0.cmd; env = g0.env; args = labelDockerArgs(name, args, env);
399
426
  if (env.FORGE_HEAVY_HELD || env.FORGE_HEAVY_DISABLED === "1" || classifyStep(name, args) === "llm") return run(cmd, args, env);
400
427
  const hostP = host ?? defaultHost();
401
- const h = open(env.FORGEDOCK_SCHED_DIR || schedDir(env), { env, host: hostP });
402
428
  const priority = Number.isFinite(Number(env.FORGE_LANE_PRIORITY)) && String(env.FORGE_LANE_PRIORITY).trim() !== "" ? Number(env.FORGE_LANE_PRIORITY) : DEFAULT_PRIORITY;
403
429
  const phase = env.FORGE_LANE_PHASE || "step";
404
- const g = await acquireHeavy(h, { issue: Number(env.FORGE_LANE_ISSUE) || null, phase, priority, mb: c.step_mem_mb });
430
+ const useRemote = Boolean(env.CS_HEAVY_BASE); // #6047: the pool agent's token semaphore; fail-open, else the local file semaphore
431
+ const g = useRemote ? await remote({ base: env.CS_HEAVY_BASE, credToken: env.CS_CRED_TOKEN ?? "", maxWaitMs: c.max_wait_s * 1000 })
432
+ : await acquireHeavy(open(env.FORGEDOCK_SCHED_DIR || schedDir(env), { env, host: hostP }), { issue: Number(env.FORGE_LANE_ISSUE) || null, phase, priority, mb: c.step_mem_mb });
405
433
  if (env.FORGE_HEAVY_WAITS) { try { appendFileSync(env.FORGE_HEAVY_WAITS, JSON.stringify({ phase, name, waitMs: g.waitMs, queued: g.queued }) + "\n"); } catch { /* metrics are best effort */ } }
406
434
  let cores = 1; try { cores = hostP.cores() || 1; } catch { /* 1 */ }
435
+ cores = quotaCores({ cores, read, env }); // #6047: the container's CPU quota, never the VM
407
436
  const childEnv = { ...env, FORGE_HEAVY_HELD: "1",
408
437
  ...(env.FORGE_HEAVY_PARALLELISM_PINNED === "1" ? {} : { FORGE_HOST_PARALLELISM: String(hostParallelism({ cores, lanes: g.holders })) }) };
409
438
  // #5174: a gated step runs at nice 10 / ionice idle so local test runners and installs do not starve the schedd event loop.