@smoothbricks/nx-plugin 0.7.12 → 0.7.14

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 (89) hide show
  1. package/README.md +91 -27
  2. package/dist/.build-inputs.json +20 -12
  3. package/dist/built-output-packages.d.ts +27 -0
  4. package/dist/built-output-packages.d.ts.map +1 -0
  5. package/dist/built-output-packages.js +97 -0
  6. package/dist/cross-check-policy.d.ts +13 -1
  7. package/dist/cross-check-policy.d.ts.map +1 -1
  8. package/dist/cross-check-policy.js +13 -1
  9. package/dist/executors/bounded-exec/admission-queue.d.ts +68 -0
  10. package/dist/executors/bounded-exec/admission-queue.d.ts.map +1 -0
  11. package/dist/executors/bounded-exec/admission-queue.js +131 -0
  12. package/dist/executors/bounded-exec/cpu-grant.d.ts +14 -0
  13. package/dist/executors/bounded-exec/cpu-grant.d.ts.map +1 -0
  14. package/dist/executors/bounded-exec/cpu-grant.js +18 -0
  15. package/dist/executors/bounded-exec/cpu-pool.d.ts +1 -14
  16. package/dist/executors/bounded-exec/cpu-pool.d.ts.map +1 -1
  17. package/dist/executors/bounded-exec/cpu-pool.js +2 -49
  18. package/dist/executors/bounded-exec/executor.d.ts +5 -12
  19. package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
  20. package/dist/executors/bounded-exec/executor.js +51 -154
  21. package/dist/executors/bounded-exec/memory-retry.d.ts +39 -0
  22. package/dist/executors/bounded-exec/memory-retry.d.ts.map +1 -0
  23. package/dist/executors/bounded-exec/memory-retry.js +33 -0
  24. package/dist/executors/bounded-exec/parent-grant.d.ts +43 -0
  25. package/dist/executors/bounded-exec/parent-grant.d.ts.map +1 -0
  26. package/dist/executors/bounded-exec/parent-grant.js +37 -0
  27. package/dist/executors/bounded-exec/peak-charge.d.ts +17 -0
  28. package/dist/executors/bounded-exec/peak-charge.d.ts.map +1 -0
  29. package/dist/executors/bounded-exec/peak-charge.js +20 -0
  30. package/dist/executors/bounded-exec/pool-environment.d.ts +25 -0
  31. package/dist/executors/bounded-exec/pool-environment.d.ts.map +1 -0
  32. package/dist/executors/bounded-exec/pool-environment.js +34 -0
  33. package/dist/executors/bounded-exec/run-cpu-pool.d.ts.map +1 -1
  34. package/dist/executors/bounded-exec/run-cpu-pool.js +1 -1
  35. package/dist/executors/bounded-exec/verdict.d.ts +3 -18
  36. package/dist/executors/bounded-exec/verdict.d.ts.map +1 -1
  37. package/dist/executors/bounded-exec/verdict.js +4 -25
  38. package/dist/index.d.ts +4 -1
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +97 -31
  41. package/dist/managed-files/ci-workflow.d.ts +29 -5
  42. package/dist/managed-files/ci-workflow.d.ts.map +1 -1
  43. package/dist/managed-files/ci-workflow.js +111 -16
  44. package/dist/managed-files/context.d.ts.map +1 -1
  45. package/dist/managed-files/context.js +1 -0
  46. package/dist/managed-files/files.d.ts +3 -1
  47. package/dist/managed-files/files.d.ts.map +1 -1
  48. package/dist/managed-files/files.js +2 -0
  49. package/dist/managed-files/publish-workflow.d.ts +6 -1
  50. package/dist/managed-files/publish-workflow.d.ts.map +1 -1
  51. package/dist/managed-files/publish-workflow.js +16 -11
  52. package/dist/owned-installation.d.ts.map +1 -1
  53. package/dist/owned-installation.js +48 -14
  54. package/dist/typecheck-route.d.ts +28 -0
  55. package/dist/typecheck-route.d.ts.map +1 -0
  56. package/dist/typecheck-route.js +109 -0
  57. package/dist/workspace-manifest.d.ts +50 -5
  58. package/dist/workspace-manifest.d.ts.map +1 -1
  59. package/executors.json +10 -0
  60. package/managed/raw/patches/ttsc@0.34.1.patch +93 -8
  61. package/managed/raw/tooling/direnv/apple-developer.sh +8 -1
  62. package/managed/raw/tooling/direnv/compiler-variables.sh +1 -1
  63. package/managed/raw/tooling/direnv/github-actions-bootstrap.sh +4 -2
  64. package/managed/raw/tooling/direnv/secret-references.ts +19 -5
  65. package/managed/raw/tooling/git-hooks/pre-push.sh +20 -10
  66. package/managed/templates/github/actions/forgejo-artifact.cjs +9 -9
  67. package/managed/templates/github/actions/setup-devenv/action.yml +53 -0
  68. package/package.json +2 -2
  69. package/src/built-output-packages.ts +125 -0
  70. package/src/cross-check-policy.ts +14 -1
  71. package/src/executors/bounded-exec/admission-queue.ts +163 -0
  72. package/src/executors/bounded-exec/cpu-grant.ts +32 -0
  73. package/src/executors/bounded-exec/cpu-pool.ts +2 -33
  74. package/src/executors/bounded-exec/executor.ts +60 -201
  75. package/src/executors/bounded-exec/memory-retry.ts +63 -0
  76. package/src/executors/bounded-exec/parent-grant.ts +75 -0
  77. package/src/executors/bounded-exec/peak-charge.ts +25 -0
  78. package/src/executors/bounded-exec/pool-environment.ts +45 -0
  79. package/src/executors/bounded-exec/run-cpu-pool.ts +2 -1
  80. package/src/executors/bounded-exec/verdict.ts +7 -35
  81. package/src/index.ts +105 -31
  82. package/src/managed-files/ci-workflow.ts +143 -16
  83. package/src/managed-files/context.ts +1 -0
  84. package/src/managed-files/files.ts +5 -0
  85. package/src/managed-files/publish-workflow.ts +26 -10
  86. package/src/owned-installation.ts +63 -14
  87. package/src/typecheck-route.ts +64 -0
  88. package/src/workspace-manifest.ts +56 -5
  89. package/test-timings.json +141 -139
@@ -7,23 +7,27 @@ import { createInterface } from 'node:readline';
7
7
  import { Duplex, Readable } from 'node:stream';
8
8
  import { workspaceDataDirectoryForWorkspace } from 'nx/src/utils/cache-directory.js';
9
9
  import { DEADLINE_PATIENCE, describeMembersLeft, killProcessGroup, processGroupHasMembers, signalProcessGroup, } from '../../process-group.js';
10
- import { admissionWaitMs, earliestBound, NO_ADMISSION_WAIT, stepAdmissionWait, stepBounds, UNARMED, } from './bounds.js';
11
- import { CPU_POOL_ENV, createCpuPool, readInheritedCpuPool, takeParentCpuTokens, } from './cpu-pool.js';
10
+ import { AdmissionObservation } from './admission-queue.js';
11
+ import { earliestBound, stepBounds, UNARMED } from './bounds.js';
12
+ import { createCpuPool } from './cpu-pool.js';
12
13
  import { GATEWAY_SOCKET } from './gateway-lease.js';
13
14
  import { captureHangDiagnostics, HANG_CAPTURE_MS } from './hang-diagnostics.js';
14
15
  import { PEAK_FD, peakWaiter, readWaiterReport, underWaiter } from './leaf-peak.js';
15
16
  import { askedCores, MBX_GRANT_FD, mbxIdleGated, mbxLeaf, mbxPool, withCountedReservation, withMbxLeaf, } from './mbx-pool.js';
16
- import { MBX_QUEUE_POLL_MS, snapshotMbxQueue } from './mbx-queue.js';
17
17
  import { describeUnserved, RESERVATIONS_ENV, reserveCores, runEndpoint } from './mbx-reservations.js';
18
+ import { killedFromOutside, runUntilNotKilledForMemory } from './memory-retry.js';
18
19
  import { createNoSpaceWatch } from './no-space.js';
19
20
  import { COWSHED_EXECUTABLE_ENV, cowshedSubtreeOwner, HANDLE_FD, readAdmission, SUPERVISOR_SOCKET_ENV, } from './owned-subtree.js';
21
+ import { askParentPool, describeGrant } from './parent-grant.js';
22
+ import { readLastPeak } from './peak-charge.js';
23
+ import { CPU_POOL_ENV, readInheritedCpuPool } from './pool-environment.js';
20
24
  import { createRunProgress, withProgressReport, withTestResultReport } from './progress.js';
21
25
  import { createHostCommands, describeCoverageGap, describeRamTempError, describeSignalled, LEFTOVER_GRACE_MS, PRODUCTION, RAM_TEMP_CAPACITY_BYTES, RamTempVolume, ramTempPaths, } from './ram-temp.js';
22
26
  import { createRunnerLifecycle, withFixtureLifecycle, withRunnerLifecycle } from './runner-lifecycle.js';
23
27
  import { CPU_TOKENS_ENV, runnerDemand, sizeRunner, sizeRunnerToGrant } from './runner-sizing.js';
24
28
  import { checkRuntimePin, describeRuntimePinRefusal } from './runtime-pin.js';
25
29
  import { createTestResultWriter } from './test-result-writer.js';
26
- import { BUN_TEST, clearTaskDirectory, describeAdmissionQueue, describeNoSpace, JUNIT_FILE, JUNIT_REPORT_ENV, judgeOperationalFailure, judgeRun, readJunitReport, readLastPeak, taskDirectory, withJunitReport, writeRecord, } from './verdict.js';
30
+ import { BUN_TEST, clearTaskDirectory, describeNoSpace, JUNIT_FILE, JUNIT_REPORT_ENV, judgeOperationalFailure, judgeRun, readJunitReport, taskDirectory, withJunitReport, writeRecord, } from './verdict.js';
27
31
  const DEFAULT_KILL_AFTER_MS = 10_000;
28
32
  const REAP_AFTER_FORCE_KILL_MS = 2_000;
29
33
  /** The pool descriptor: only a grant may give it, so neither the target's nor the inherited environment passes it on. */
@@ -147,24 +151,10 @@ export async function runBoundedExec(options, context, killer, tempVolume, inher
147
151
  // pool, read once before a run's clear removes them: a command run again after a kill is charged by the record the
148
152
  // killed run replaced, not by the peak it reached before it was killed.
149
153
  const lastPeak = directory !== null && inherited !== null ? await readLastPeak(directory) : null;
150
- const run = (alone) => runCommand(options, context, killer, tempVolume, inherited, captureDiagnostics, owner, queueHost, {
154
+ return runUntilNotKilledForMemory((alone) => runCommand(options, context, killer, tempVolume, inherited, captureDiagnostics, owner, queueHost, {
151
155
  lastPeak,
152
156
  alone,
153
- });
154
- const first = await run(false);
155
- if (first.killedForMemory !== true || inherited === null) {
156
- return first;
157
- }
158
- // The kernel killed the leaf: a SIGKILL this executor did not send. It runs once more, alone in its run's pool, so
159
- // what it was killed beside is not there to be killed with it.
160
- const note = `cowshed: the kernel killed the command for memory (a SIGKILL this executor did not send${context.record === undefined ? '' : `: ${context.record.task.id}`}); running it once more, alone in its run's pool\n`;
161
- process.stderr.write(note);
162
- const again = await run(true);
163
- return {
164
- success: again.success,
165
- terminalOutput: `${first.terminalOutput}${note}${again.terminalOutput}`,
166
- ...(again.killedForMemory === true ? { killedForMemory: true } : {}),
167
- };
157
+ }), inherited !== null, context.record?.task.id);
168
158
  }
169
159
  /** One run of the command, from the pool's grant to its record. */
170
160
  async function runCommand(options, context, killer, tempVolume, inherited, captureDiagnostics, owner, queueHost, attempt) {
@@ -395,26 +385,16 @@ async function runCommand(options, context, killer, tempVolume, inherited, captu
395
385
  const asked = Date.now();
396
386
  // A pool that answered and refused is a live budget, and running beside it would count the run twice: the run fails
397
387
  // instead. A pool whose endpoint is gone (its holder exited) lends nothing, and the run goes on as asked.
398
- let grant = null;
399
- let parentRefusal = null;
400
- let parentWait;
401
- if (inherited !== null) {
402
- const fromParent = await takeParentCpuTokens(inherited, demand.want, charge, {
403
- parallelism: chargeParallelism ?? undefined,
404
- alone: attempt.alone ? true : undefined,
405
- task: context.record?.task.id,
406
- });
407
- if (fromParent.granted) {
408
- grant = fromParent;
409
- }
410
- else if (fromParent.cause === 'absent') {
411
- appendStderr(`cowshed: cpu-pool parent pool absent: ${fromParent.reason}; running the command as asked\n`);
412
- }
413
- else {
414
- parentRefusal = fromParent.reason;
415
- parentWait = fromParent.wait;
416
- }
417
- }
388
+ const parent = await askParentPool(inherited, {
389
+ want: demand.want,
390
+ charge,
391
+ parallelism: chargeParallelism,
392
+ alone: attempt.alone,
393
+ task: context.record?.task.id,
394
+ });
395
+ for (const said of parent.said)
396
+ appendStderr(said);
397
+ const { grant, refusal: parentRefusal, wait: parentWait } = parent;
418
398
  const waitedMs = Date.now() - asked;
419
399
  let cpu;
420
400
  let sized = { command: requested, env: {} };
@@ -425,9 +405,8 @@ async function runCommand(options, context, killer, tempVolume, inherited, captu
425
405
  if (grant !== null) {
426
406
  sized = sizeRunner(demand, requested, grant.tokens);
427
407
  cpu = { tokens: grant.tokens, want: demand.want, waitedMs };
428
- appendStderr(`cowshed: cpu-pool wait done elapsed=${waitedMs}ms status=ok tokens=${grant.tokens}/${demand.want} runner=${demand.kind} memory=${charge ?? 'none'}${grant.charged !== null && grant.charged !== charge ? ` charged=${grant.charged}` : ''}\n`);
429
- if (grant.oversized !== null) {
430
- appendStderr(`cowshed: cpu-pool granted while nothing else holds memory: this task's last peak of ${charge} bytes alone exceeds the run's ${grant.oversized.memory} bytes\n`);
408
+ for (const said of describeGrant(grant, { waitedMs, want: demand.want, runner: demand.kind, charge })) {
409
+ appendStderr(said);
431
410
  }
432
411
  }
433
412
  else if (leaf?.kind === 'reserve') {
@@ -458,32 +437,15 @@ async function runCommand(options, context, killer, tempVolume, inherited, captu
458
437
  })();
459
438
  return cpuReleased;
460
439
  };
461
- let mbxAdmitted = false;
462
- let admissionWait = NO_ADMISSION_WAIT;
463
- let lastQueueRequests = [];
464
- /**
465
- * Why the last admission snapshot failed, while the one after it has not succeeded; null otherwise. A snapshot only
466
- * decides whether waiting on mbx admission is credited against the idle bound, so a failed one withholds that credit
467
- * and ends nothing: the bounds decide, and an idle expiry names it.
468
- */
469
- let unconfirmedAdmission = null;
470
- /** When the last successful snapshot completed (`Date.now()`): credit runs to it and no further. */
471
- let confirmedAdmissionAt = null;
472
- // A reserved leaf's own request on its run's endpoint is its admission wait; a Cargo leaf's comes from mbx's report.
473
- const queueWait = () => mbxAdmitted || (lastQueueRequests.length === 0 && reservation === null)
474
- ? null
475
- : {
476
- waitedMs: admissionWaitMs(admissionWait, performance.now()),
477
- requests: lastQueueRequests,
478
- };
479
- const queueAbort = new AbortController();
480
- let queueTimer;
481
- let queueSnapshot = null;
482
- const stopQueueObservation = () => {
483
- admissionWait = stepAdmissionWait(admissionWait, { kind: 'stop', at: performance.now() });
484
- clearInterval(queueTimer);
485
- queueAbort.abort();
486
- };
440
+ const queue = new AdmissionObservation({
441
+ over: () => state.settled || state.expiry !== null,
442
+ pid: () => child.pid,
443
+ environment: () => mergeEnv(lease?.directory ?? ordinaryTemp, env),
444
+ tell,
445
+ step: (event) => stepTo(event),
446
+ testing: () => isTesting(),
447
+ queueHost,
448
+ });
487
449
  // Records the run's verdict when it has a task to record as. An `expiry` is set only when a bound ended the run.
488
450
  // Observation and ownership failures remain operational even after valid queue evidence; cancellation alone does not.
489
451
  const recordRun = async (exitCode, expiry, elapsedMs, operational, noSpace, lockWaits, peakBytes) => {
@@ -506,7 +468,7 @@ async function runCommand(options, context, killer, tempVolume, inherited, captu
506
468
  appendStderr(`bounded-exec: ${error}\n`);
507
469
  }
508
470
  });
509
- const admissionQueue = queueWait();
471
+ const admissionQueue = queue.queueWait(reservation !== null);
510
472
  const verdict = operational || resultFailure !== null
511
473
  ? judgeOperationalFailure(exitCode, report)
512
474
  : judgeRun({
@@ -777,7 +739,7 @@ async function runCommand(options, context, killer, tempVolume, inherited, captu
777
739
  try {
778
740
  // Drain an older poll, then take a fresh bounded snapshot before idle can end queued work. Total and fixture
779
741
  // ceilings remain armed while this observation runs.
780
- await refreshQueue(true);
742
+ await queue.refresh(true);
781
743
  }
782
744
  finally {
783
745
  checkingIdle = false;
@@ -808,70 +770,6 @@ async function runCommand(options, context, killer, tempVolume, inherited, captu
808
770
  }
809
771
  armBoundTimer();
810
772
  };
811
- let lastQueueDiagnostic = '';
812
- let lastQueueDiagnosticAt = null;
813
- let lastSnapshotDiagnostics = '';
814
- const unconfirmAdmission = (detail) => {
815
- if (state.settled || state.expiry !== null || queueAbort.signal.aborted)
816
- return;
817
- if (unconfirmedAdmission !== detail) {
818
- tell(`bounded-exec: mbx admission snapshot failed: ${detail}; admission is unconfirmed, so this wait earns no idle credit until a snapshot succeeds\n`);
819
- }
820
- unconfirmedAdmission = detail;
821
- lastQueueRequests = [];
822
- admissionWait = stepAdmissionWait(admissionWait, { kind: 'snapshot', at: performance.now(), waiting: false });
823
- // The wait since the last confirmed snapshot is unconfirmed: the idle bound resumes from that snapshot.
824
- stepTo({ kind: 'admission-queue', at: confirmedAdmissionAt ?? Date.now(), waiting: false, testing: isTesting() });
825
- };
826
- const refreshQueue = async (fresh) => {
827
- if (fresh && queueSnapshot !== null)
828
- await queueSnapshot;
829
- if (state.settled || state.expiry !== null || queueAbort.signal.aborted || child.pid === undefined)
830
- return;
831
- const pid = child.pid;
832
- queueSnapshot ??= (async () => {
833
- const snapshot = await snapshotMbxQueue(pid, mergeEnv(lease?.directory ?? ordinaryTemp, env), queueAbort.signal, queueHost);
834
- if (state.settled || state.expiry !== null || queueAbort.signal.aborted)
835
- return;
836
- if (!snapshot.ok) {
837
- unconfirmAdmission(snapshot.detail);
838
- return;
839
- }
840
- const diagnostics = snapshot.diagnostics?.join('; ') ?? '';
841
- if (diagnostics !== '' && diagnostics !== lastSnapshotDiagnostics)
842
- tell(`bounded-exec: ${diagnostics}\n`);
843
- lastSnapshotDiagnostics = diagnostics;
844
- const waiting = snapshot.requests.length > 0;
845
- const observedAt = Date.now();
846
- const observedWaitAt = performance.now();
847
- admissionWait = stepAdmissionWait(admissionWait, { kind: 'snapshot', at: observedWaitAt, waiting });
848
- unconfirmedAdmission = null;
849
- confirmedAdmissionAt = observedAt;
850
- if (waiting) {
851
- lastQueueRequests = snapshot.requests;
852
- const positions = JSON.stringify(snapshot.requests);
853
- if (positions !== lastQueueDiagnostic ||
854
- lastQueueDiagnosticAt === null ||
855
- Date.now() - lastQueueDiagnosticAt >= HANG_CAPTURE_MS) {
856
- const waitedMs = admissionWaitMs(admissionWait, observedWaitAt);
857
- tell(`cowshed: mbx ${describeAdmissionQueue({ waitedMs, requests: snapshot.requests })}\n`);
858
- lastQueueDiagnostic = positions;
859
- lastQueueDiagnosticAt = Date.now();
860
- }
861
- }
862
- else {
863
- lastQueueDiagnostic = '';
864
- }
865
- stepTo({ kind: 'admission-queue', at: observedAt, waiting, testing: isTesting() });
866
- })()
867
- .catch((error) => {
868
- unconfirmAdmission(error instanceof Error ? error.message : String(error));
869
- })
870
- .finally(() => {
871
- queueSnapshot = null;
872
- });
873
- await queueSnapshot;
874
- };
875
773
  // Only the CHILD's own output is read for progress. The diagnostics below go
876
774
  // through appendStderr as well, and re-arming on those would let a teardown
877
775
  // message extend the very bound that just fired.
@@ -969,9 +867,9 @@ async function runCommand(options, context, killer, tempVolume, inherited, captu
969
867
  clearTimeout(boundTimer);
970
868
  // Preserve explicit live membership before cancellation removes the queued process. A failed bounded observation
971
869
  // leaves the admission unconfirmed, never a manufactured queue or admission.
972
- signalCleanup = (leaf?.kind !== 'cargo' ? Promise.resolve() : refreshQueue(false))
870
+ signalCleanup = (leaf?.kind !== 'cargo' ? Promise.resolve() : queue.refresh(false))
973
871
  .finally(() => {
974
- stopQueueObservation();
872
+ queue.stop();
975
873
  return killChildTree();
976
874
  })
977
875
  .finally(releaseCpu)
@@ -1001,12 +899,12 @@ async function runCommand(options, context, killer, tempVolume, inherited, captu
1001
899
  child.once('error', (error) => {
1002
900
  appendStderr(`${error.message}\n`);
1003
901
  state.settled = true;
1004
- stopQueueObservation();
902
+ queue.stop();
1005
903
  resolve({ code: 1, signal: null });
1006
904
  });
1007
905
  child.once(hooked === null ? 'exit' : 'close', (code, signal) => {
1008
906
  state.settled = true;
1009
- stopQueueObservation();
907
+ queue.stop();
1010
908
  resolve({ code, signal });
1011
909
  });
1012
910
  });
@@ -1025,9 +923,9 @@ async function runCommand(options, context, killer, tempVolume, inherited, captu
1025
923
  appendStderr(bound.kind === 'idle'
1026
924
  ? `\nCommand made no progress: no test finished for ${bound.limitMs}ms (idleTimeoutMs=${bound.limitMs}) after ${elapsedMs}ms of runtime; ${bound.tests.length > 0
1027
925
  ? `still running: ${bound.tests.join(', ')}`
1028
- : 'the runner named no test still running'} (cwd=${cwd}): ${command}\n${unconfirmedAdmission === null
926
+ : 'the runner named no test still running'} (cwd=${cwd}): ${command}\n${queue.unconfirmed === null
1029
927
  ? ''
1030
- : `The last mbx admission snapshot failed (${unconfirmedAdmission}), so the wait it could not confirm earned no idle credit\n`}`
928
+ : `The last mbx admission snapshot failed (${queue.unconfirmed}), so the wait it could not confirm earned no idle credit\n`}`
1031
929
  : bound.kind === 'fixture'
1032
930
  ? `\nFixture command timed out after ${elapsedMs}ms (fixtureTimeoutMs=${bound.limitMs}, cwd=${cwd}): ${segment ?? command}\n`
1033
931
  : `\nCommand timed out after ${elapsedMs}ms (timeoutMs=${bound.limitMs}, cwd=${cwd}): ${command}\n`);
@@ -1150,7 +1048,7 @@ async function runCommand(options, context, killer, tempVolume, inherited, captu
1150
1048
  channel.end();
1151
1049
  return;
1152
1050
  }
1153
- admissionWait = stepAdmissionWait(admissionWait, { kind: 'snapshot', at: performance.now(), waiting: true });
1051
+ queue.waiting();
1154
1052
  tell(`cowshed: mbx reserve wait start cpus=${cpus} priority=${reservedLeaf.priority}\n`);
1155
1053
  const held = reserveCores(endpoint, cpus, reservedLeaf.priority);
1156
1054
  reservation = held;
@@ -1163,7 +1061,7 @@ async function runCommand(options, context, killer, tempVolume, inherited, captu
1163
1061
  // A run that ended while it waited gives the grant back with its CPU (`releaseCpu`).
1164
1062
  if (state.settled || state.expiry !== null)
1165
1063
  return;
1166
- mbxAdmitted = true;
1064
+ queue.admitted = true;
1167
1065
  tell(`cowshed: mbx reserve granted elapsed=${Date.now() - startedAt}ms priority=${reservedLeaf.priority}\n`);
1168
1066
  channel.end(`${granted.cpus}\n`);
1169
1067
  stepTo({ kind: 'granted', at: Date.now(), testing: isTesting(), fixture: !fixtureDone });
@@ -1182,7 +1080,7 @@ async function runCommand(options, context, killer, tempVolume, inherited, captu
1182
1080
  for (const byte of chunk) {
1183
1081
  if (byte === 103) {
1184
1082
  if (!said) {
1185
- mbxAdmitted = true;
1083
+ queue.admitted = true;
1186
1084
  said = true;
1187
1085
  tell(`cowshed: mbx cargo granted elapsed=${Date.now() - startedAt}ms\n`);
1188
1086
  }
@@ -1198,10 +1096,7 @@ async function runCommand(options, context, killer, tempVolume, inherited, captu
1198
1096
  }
1199
1097
  });
1200
1098
  // Only mbx's activity report says whether a Cargo leaf's compiler or test waits in the pool.
1201
- queueTimer = setInterval(() => {
1202
- void refreshQueue(false);
1203
- }, MBX_QUEUE_POLL_MS);
1204
- void refreshQueue(false);
1099
+ queue.poll();
1205
1100
  }
1206
1101
  }
1207
1102
  // A grant's connection is a ledger entry, not the command's owner: the lending parent's exit ends it, and what runs
@@ -1222,8 +1117,8 @@ async function runCommand(options, context, killer, tempVolume, inherited, captu
1222
1117
  await signalCleanup;
1223
1118
  return { success: false, terminalOutput: outputChunks.join('') };
1224
1119
  }
1225
- stopQueueObservation();
1226
- await queueSnapshot;
1120
+ queue.stop();
1121
+ await queue.idle();
1227
1122
  await termination;
1228
1123
  clearTimeout(boundTimer);
1229
1124
  cancelCapture();
@@ -1270,10 +1165,12 @@ async function runCommand(options, context, killer, tempVolume, inherited, captu
1270
1165
  // branch later exited 0: its verdict is an ordinary operational failure, never a successful or silently unbounded run.
1271
1166
  const operationalFailure = state.poolCloseError !== null || lifecycleFailure !== null || state.retireError !== null;
1272
1167
  await recordRun(code, state.expiry, Date.now() - startedAt, operationalFailure, seen, state.lockWaits, peakBytes);
1273
- // A SIGKILL this executor did not send, to a command that no bound of this executor ended, came from outside it. In a
1274
- // run's cgroup the one that sends it to a leaf is the kernel's OOM killer. The exit code alone says nothing of who
1275
- // sent it: a bound's own force-kill ends in 137 too, and is why `sentSignal` is read first.
1276
- const killedForMemory = !state.sentSignal && state.expiry === null && (exitSignal === 'SIGKILL' || code === 137);
1168
+ const killedForMemory = killedFromOutside({
1169
+ sentSignal: state.sentSignal,
1170
+ bounded: state.expiry !== null,
1171
+ exitSignal,
1172
+ code,
1173
+ });
1277
1174
  return {
1278
1175
  success: !operationalFailure && resultFailure === null && state.expiry === null && code === 0,
1279
1176
  terminalOutput: outputChunks.join(''),
@@ -0,0 +1,39 @@
1
+ /**
2
+ * A run again after the kernel killed the command for memory (specs/cowshed/05_gateway.md, "Host scheduling"). Only
3
+ * when a pool lent the run its tokens and a SIGKILL that no bound of this executor and no signal it sent caused ended
4
+ * it: the command runs once more, alone in its run's pool, so what it was killed beside is not there to be killed with
5
+ * it. This decides whether a command runs a second time and how its two outputs join, never what it runs: the key
6
+ * leaves it out (README, "Bounded exec key").
7
+ */
8
+ /** How one run of the command ended. */
9
+ export interface RunOutcome {
10
+ success: boolean;
11
+ terminalOutput: string;
12
+ /**
13
+ * The command died of a SIGKILL that no bound of this executor and no signal it sent caused: the kernel's OOM killer,
14
+ * which sends it to a leaf in a run's cgroup. Set on the last run of the command only when it was killed again.
15
+ */
16
+ killedForMemory?: boolean;
17
+ }
18
+ /** What a run read of how its command ended and what this executor did to it. */
19
+ export interface Ending {
20
+ /** This executor sent the command's process group a signal. */
21
+ readonly sentSignal: boolean;
22
+ /** A bound of this executor ended the run. */
23
+ readonly bounded: boolean;
24
+ readonly exitSignal: NodeJS.Signals | null;
25
+ /** The exit status, or the status a signal folds to. */
26
+ readonly code: number;
27
+ }
28
+ /**
29
+ * A SIGKILL this executor did not send, to a command that no bound of this executor ended, came from outside it. In a
30
+ * run's cgroup the one that sends it to a leaf is the kernel's OOM killer. The exit code alone says nothing of who sent
31
+ * it: a bound's own force-kill ends in 137 too, and is why `sentSignal` is read first.
32
+ */
33
+ export declare function killedFromOutside(ending: Ending): boolean;
34
+ /**
35
+ * Run the command; when the kernel killed it for memory and a pool lent it tokens, run it once more alone, and join the
36
+ * two runs' output with a note naming the task.
37
+ */
38
+ export declare function runUntilNotKilledForMemory(run: (alone: boolean) => Promise<RunOutcome>, pooled: boolean, task: string | undefined): Promise<RunOutcome>;
39
+ //# sourceMappingURL=memory-retry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-retry.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/memory-retry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,wCAAwC;AACxC,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,iFAAiF;AACjF,MAAM,WAAW,MAAM;IACrB,+DAA+D;IAC/D,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,8CAA8C;IAC9C,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;IAC3C,wDAAwD;IACxD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED;;;GAGG;AACH,wBAAsB,0BAA0B,CAC9C,GAAG,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,UAAU,CAAC,EAC5C,MAAM,EAAE,OAAO,EACf,IAAI,EAAE,MAAM,GAAG,SAAS,GACvB,OAAO,CAAC,UAAU,CAAC,CAerB"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * A run again after the kernel killed the command for memory (specs/cowshed/05_gateway.md, "Host scheduling"). Only
3
+ * when a pool lent the run its tokens and a SIGKILL that no bound of this executor and no signal it sent caused ended
4
+ * it: the command runs once more, alone in its run's pool, so what it was killed beside is not there to be killed with
5
+ * it. This decides whether a command runs a second time and how its two outputs join, never what it runs: the key
6
+ * leaves it out (README, "Bounded exec key").
7
+ */
8
+ /**
9
+ * A SIGKILL this executor did not send, to a command that no bound of this executor ended, came from outside it. In a
10
+ * run's cgroup the one that sends it to a leaf is the kernel's OOM killer. The exit code alone says nothing of who sent
11
+ * it: a bound's own force-kill ends in 137 too, and is why `sentSignal` is read first.
12
+ */
13
+ export function killedFromOutside(ending) {
14
+ return !ending.sentSignal && !ending.bounded && (ending.exitSignal === 'SIGKILL' || ending.code === 137);
15
+ }
16
+ /**
17
+ * Run the command; when the kernel killed it for memory and a pool lent it tokens, run it once more alone, and join the
18
+ * two runs' output with a note naming the task.
19
+ */
20
+ export async function runUntilNotKilledForMemory(run, pooled, task) {
21
+ const first = await run(false);
22
+ if (first.killedForMemory !== true || !pooled) {
23
+ return first;
24
+ }
25
+ const note = `cowshed: the kernel killed the command for memory (a SIGKILL this executor did not send${task === undefined ? '' : `: ${task}`}); running it once more, alone in its run's pool\n`;
26
+ process.stderr.write(note);
27
+ const again = await run(true);
28
+ return {
29
+ success: again.success,
30
+ terminalOutput: `${first.terminalOutput}${note}${again.terminalOutput}`,
31
+ ...(again.killedForMemory === true ? { killedForMemory: true } : {}),
32
+ };
33
+ }
@@ -0,0 +1,43 @@
1
+ import { type TokenGrant } from './cpu-pool.js';
2
+ import type { CpuWaitRow } from './lease-wait.js';
3
+ import type { InheritedCpuPool } from './pool-environment.js';
4
+ /**
5
+ * What a run asks its parent's CPU pool and says of the answer. How many tokens the pool lends, how long the run waits
6
+ * and what it is charged are values that differ between runs of one task key; what a token count does to the command is
7
+ * `runner-sizing.ts`'s, keyed (README, "Bounded exec key").
8
+ */
9
+ /** Tokens a parent pool lent, held until released. */
10
+ export type GrantedTokens = Extract<TokenGrant, {
11
+ granted: true;
12
+ }>;
13
+ /** The parent pool's answer to a run: a grant, a refusal that fails the run, or neither, and what to say of it. */
14
+ export interface ParentGrant {
15
+ readonly grant: GrantedTokens | null;
16
+ /** A pool that answered and refused is a live budget, and the run fails rather than run beside it. */
17
+ readonly refusal: string | null;
18
+ readonly wait: CpuWaitRow | undefined;
19
+ /** What the run says, in order. */
20
+ readonly said: readonly string[];
21
+ }
22
+ /** What a run asks for: its count, what its task's last recorded peak charges it, and whether it runs alone. */
23
+ export interface Ask {
24
+ readonly want: number;
25
+ readonly charge: number | null;
26
+ /** The tokens the task was lent when its recorded peak was measured. */
27
+ readonly parallelism: number | null;
28
+ readonly alone: boolean;
29
+ readonly task: string | undefined;
30
+ }
31
+ /**
32
+ * Ask the parent pool for the run's tokens. A run that inherits no pool runs as asked and says nothing; a pool whose
33
+ * endpoint is gone (its holder exited) lends nothing, and the run goes on as asked.
34
+ */
35
+ export declare function askParentPool(inherited: InheritedCpuPool | null, ask: Ask): Promise<ParentGrant>;
36
+ /** What a run says once its grant is in hand. */
37
+ export declare function describeGrant(grant: GrantedTokens, run: {
38
+ waitedMs: number;
39
+ want: number;
40
+ runner: string;
41
+ charge: number | null;
42
+ }): string[];
43
+ //# sourceMappingURL=parent-grant.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parent-grant.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/parent-grant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAuB,MAAM,eAAe,CAAC;AACrE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D;;;;GAIG;AAEH,sDAAsD;AACtD,MAAM,MAAM,aAAa,GAAG,OAAO,CAAC,UAAU,EAAE;IAAE,OAAO,EAAE,IAAI,CAAA;CAAE,CAAC,CAAC;AAEnE,mHAAmH;AACnH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,CAAC;IACrC,sGAAsG;IACtG,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS,CAAC;IACtC,mCAAmC;IACnC,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;CAClC;AAED,gHAAgH;AAChH,MAAM,WAAW,GAAG;IAClB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,wEAAwE;IACxE,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;CACnC;AAED;;;GAGG;AACH,wBAAsB,aAAa,CAAC,SAAS,EAAE,gBAAgB,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,WAAW,CAAC,CAqBtG;AAED,iDAAiD;AACjD,wBAAgB,aAAa,CAC3B,KAAK,EAAE,aAAa,EACpB,GAAG,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAC7E,MAAM,EAAE,CAUV"}
@@ -0,0 +1,37 @@
1
+ import { takeParentCpuTokens } from './cpu-pool.js';
2
+ /**
3
+ * Ask the parent pool for the run's tokens. A run that inherits no pool runs as asked and says nothing; a pool whose
4
+ * endpoint is gone (its holder exited) lends nothing, and the run goes on as asked.
5
+ */
6
+ export async function askParentPool(inherited, ask) {
7
+ if (inherited === null) {
8
+ return { grant: null, refusal: null, wait: undefined, said: [] };
9
+ }
10
+ const answer = await takeParentCpuTokens(inherited, ask.want, ask.charge, {
11
+ parallelism: ask.parallelism ?? undefined,
12
+ alone: ask.alone ? true : undefined,
13
+ task: ask.task,
14
+ });
15
+ if (answer.granted) {
16
+ return { grant: answer, refusal: null, wait: undefined, said: [] };
17
+ }
18
+ if (answer.cause === 'absent') {
19
+ return {
20
+ grant: null,
21
+ refusal: null,
22
+ wait: undefined,
23
+ said: [`cowshed: cpu-pool parent pool absent: ${answer.reason}; running the command as asked\n`],
24
+ };
25
+ }
26
+ return { grant: null, refusal: answer.reason, wait: answer.wait, said: [] };
27
+ }
28
+ /** What a run says once its grant is in hand. */
29
+ export function describeGrant(grant, run) {
30
+ const said = [
31
+ `cowshed: cpu-pool wait done elapsed=${run.waitedMs}ms status=ok tokens=${grant.tokens}/${run.want} runner=${run.runner} memory=${run.charge ?? 'none'}${grant.charged !== null && grant.charged !== run.charge ? ` charged=${grant.charged}` : ''}\n`,
32
+ ];
33
+ if (grant.oversized !== null) {
34
+ said.push(`cowshed: cpu-pool granted while nothing else holds memory: this task's last peak of ${run.charge} bytes alone exceeds the run's ${grant.oversized.memory} bytes\n`);
35
+ }
36
+ return said;
37
+ }
@@ -0,0 +1,17 @@
1
+ /** What the task's last record charges its next run: the peak and the parallelism it was measured under. */
2
+ export type LastPeak = {
3
+ ok: true;
4
+ peakBytes: number | null;
5
+ parallelism: number | null;
6
+ } | {
7
+ ok: false;
8
+ error: string;
9
+ };
10
+ /**
11
+ * The peak the task's last record in `directory` names: its charge in its run's pool. Null when the task has no record
12
+ * or its record no peak; a record that cannot be read is an error naming it, never a charge of nothing. It decides what a
13
+ * pool charges a run, a value that differs between runs of one task key, so the key leaves it out (README, "Bounded
14
+ * exec key").
15
+ */
16
+ export declare function readLastPeak(directory: string): Promise<LastPeak>;
17
+ //# sourceMappingURL=peak-charge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"peak-charge.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/peak-charge.ts"],"names":[],"mappings":"AAGA,4GAA4G;AAC5G,MAAM,MAAM,QAAQ,GAChB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAClE;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjC;;;;;GAKG;AACH,wBAAsB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAUvE"}
@@ -0,0 +1,20 @@
1
+ import { join } from 'node:path';
2
+ import { readRecord, VERDICT_FILE } from './verdict.js';
3
+ /**
4
+ * The peak the task's last record in `directory` names: its charge in its run's pool. Null when the task has no record
5
+ * or its record no peak; a record that cannot be read is an error naming it, never a charge of nothing. It decides what a
6
+ * pool charges a run, a value that differs between runs of one task key, so the key leaves it out (README, "Bounded
7
+ * exec key").
8
+ */
9
+ export async function readLastPeak(directory) {
10
+ try {
11
+ const record = await readRecord(directory);
12
+ return { ok: true, peakBytes: record?.peakBytes ?? null, parallelism: record?.cpu?.tokens ?? null };
13
+ }
14
+ catch (error) {
15
+ return {
16
+ ok: false,
17
+ error: `the task's last record ${join(directory, VERDICT_FILE)} cannot be read: ${error instanceof Error ? error.message : String(error)}`,
18
+ };
19
+ }
20
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * What a CPU pool puts in a command's environment (cpu-pool.ts serves the pool; this module decides what the command
3
+ * sees of it, so it is keyed: executors.json lists cpu-pool.js as output-neutral, which it may only be while it writes
4
+ * no variable the command reads).
5
+ */
6
+ /** The environment name a child reads its parent's pool endpoint from; its count is `CPU_TOKENS_ENV`. */
7
+ export declare const CPU_POOL_ENV = "BOUNDED_EXEC_CPU_POOL";
8
+ /** An inherited pool descriptor; only a grant from its endpoint proves a live allocation. */
9
+ export interface InheritedCpuPool {
10
+ readonly socket: string;
11
+ /** The count the parent names beside its endpoint. */
12
+ readonly tokens: number;
13
+ }
14
+ /**
15
+ * The inherited descriptor, or null when malformed or absent. A missing or bare count, or an empty
16
+ * or NUL-bearing endpoint, proves no allocation; the count is a positive whole number. A valid
17
+ * descriptor still needs a live endpoint grant.
18
+ */
19
+ export declare function readInheritedCpuPool(environment: Readonly<NodeJS.ProcessEnv>): InheritedCpuPool | null;
20
+ /**
21
+ * The environment a child of a pool inherits to reach it: its endpoint, the count the pool holds, and its make
22
+ * jobserver, which Cargo and make read from the fifo; `-j` with a jobserver names no count of its own.
23
+ */
24
+ export declare function poolEnvironment(socketPath: string, tokens: number, fifoPath: string): Record<string, string>;
25
+ //# sourceMappingURL=pool-environment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pool-environment.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/pool-environment.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,yGAAyG;AACzG,eAAO,MAAM,YAAY,0BAA0B,CAAC;AAEpD,6FAA6F;AAC7F,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,sDAAsD;IACtD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,gBAAgB,GAAG,IAAI,CAOtG;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAQ5G"}
@@ -0,0 +1,34 @@
1
+ import { CPU_TOKENS_ENV, parseInheritedTokens } from './runner-sizing.js';
2
+ /**
3
+ * What a CPU pool puts in a command's environment (cpu-pool.ts serves the pool; this module decides what the command
4
+ * sees of it, so it is keyed: executors.json lists cpu-pool.js as output-neutral, which it may only be while it writes
5
+ * no variable the command reads).
6
+ */
7
+ /** The environment name a child reads its parent's pool endpoint from; its count is `CPU_TOKENS_ENV`. */
8
+ export const CPU_POOL_ENV = 'BOUNDED_EXEC_CPU_POOL';
9
+ /**
10
+ * The inherited descriptor, or null when malformed or absent. A missing or bare count, or an empty
11
+ * or NUL-bearing endpoint, proves no allocation; the count is a positive whole number. A valid
12
+ * descriptor still needs a live endpoint grant.
13
+ */
14
+ export function readInheritedCpuPool(environment) {
15
+ const socket = environment[CPU_POOL_ENV];
16
+ const tokens = parseInheritedTokens(environment[CPU_TOKENS_ENV]);
17
+ if (socket === undefined || socket.length === 0 || socket.includes('\0') || tokens === null) {
18
+ return null;
19
+ }
20
+ return { socket, tokens };
21
+ }
22
+ /**
23
+ * The environment a child of a pool inherits to reach it: its endpoint, the count the pool holds, and its make
24
+ * jobserver, which Cargo and make read from the fifo; `-j` with a jobserver names no count of its own.
25
+ */
26
+ export function poolEnvironment(socketPath, tokens, fifoPath) {
27
+ const jobserverFlags = `-j --jobserver-auth=fifo:${fifoPath}`;
28
+ return {
29
+ [CPU_POOL_ENV]: socketPath,
30
+ [CPU_TOKENS_ENV]: String(tokens),
31
+ CARGO_MAKEFLAGS: jobserverFlags,
32
+ MAKEFLAGS: jobserverFlags,
33
+ };
34
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"run-cpu-pool.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/run-cpu-pool.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,MAAM,4CAA4C,CAAC;AAGtH,OAAO,EAAkB,KAAK,gBAAgB,EAAsC,MAAM,kBAAkB,CAAC;AAqD7G;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAM5F;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,IAAI,CAAC,wBAAwB,EAAE,IAAI,CAAC,EAC7C,GAAG,GAAE,MAAM,CAAC,UAAwB,EACpC,KAAK,GAAE,MAA+B,EACtC,UAAU,GAAE,MAAM,OAAO,CAAC,gBAAgB,CAAiB,GAC1D,OAAO,CAAC,IAAI,CAAC,CAoBf;AAoED,uEAAuE;AACvE,wBAAsB,eAAe,CAAC,OAAO,EAAE,IAAI,CAAC,yBAAyB,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAUnG"}
1
+ {"version":3,"file":"run-cpu-pool.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/run-cpu-pool.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,MAAM,4CAA4C,CAAC;AAGtH,OAAO,EAAkB,KAAK,gBAAgB,EAAsC,MAAM,kBAAkB,CAAC;AAsD7G;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAM5F;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,IAAI,CAAC,wBAAwB,EAAE,IAAI,CAAC,EAC7C,GAAG,GAAE,MAAM,CAAC,UAAwB,EACpC,KAAK,GAAE,MAA+B,EACtC,UAAU,GAAE,MAAM,OAAO,CAAC,gBAAgB,CAAiB,GAC1D,OAAO,CAAC,IAAI,CAAC,CAoBf;AAoED,uEAAuE;AACvE,wBAAsB,eAAe,CAAC,OAAO,EAAE,IAAI,CAAC,yBAAyB,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAUnG"}
@@ -2,9 +2,9 @@ import { availableParallelism } from 'node:os';
2
2
  import { fileURLToPath } from 'node:url';
3
3
  import { Worker } from 'node:worker_threads';
4
4
  import { logger } from 'nx/src/devkit-exports.js';
5
- import { readInheritedCpuPool } from './cpu-pool.js';
6
5
  import { RunMemoryUnreadable, readRunMemory } from './host-memory.js';
7
6
  import { mbxPool } from './mbx-pool.js';
7
+ import { readInheritedCpuPool } from './pool-environment.js';
8
8
  import { CPU_TOKENS_ENV, parseInheritedTokens } from './runner-sizing.js';
9
9
  /**
10
10
  * The CPU pool of an Nx run (specs/cowshed/05_gateway.md, "Host scheduling", "Parallelism inside a job", "Every Nx run