@outerlayer/cli 0.41.2-next.20261119010339 → 0.42.0-next.20261119032403

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 (37) hide show
  1. package/README.md +1 -1
  2. package/dist/build-info.json +1 -1
  3. package/dist/{caller-ZUQVRQMY.js → caller-WLYRCJKR.js} +1 -1
  4. package/dist/{check-BXJBIMLW.js → check-ZCF7AI73.js} +7 -7
  5. package/dist/{chunk-7HH6C45Q.js → chunk-3IRBKL4B.js} +1 -1
  6. package/dist/{chunk-DQ3IKV5Q.js → chunk-AGB4OA6T.js} +119 -33
  7. package/dist/{chunk-OLXB2YMX.js → chunk-CW74N36I.js} +1 -1
  8. package/dist/{chunk-X6WL4AQY.js → chunk-EIAE4HE5.js} +1 -1
  9. package/dist/{chunk-U5MLUAY3.js → chunk-J5FVUVGR.js} +1 -1
  10. package/dist/{chunk-Z27PY2OJ.js → chunk-TG5ITPUR.js} +1 -1
  11. package/dist/{chunk-AAL7FZPH.js → chunk-UAERR4NB.js} +1 -1
  12. package/dist/{chunk-S3VUP7LF.js → chunk-V3T36H4O.js} +2 -2
  13. package/dist/{chunk-7TDLQUJ5.js → chunk-W2TGACUB.js} +1 -1
  14. package/dist/{chunk-72NCZTEG.js → chunk-WTI5JAZ3.js} +2 -2
  15. package/dist/{chunk-RCE5YQFT.js → chunk-XI635QEJ.js} +117 -59
  16. package/dist/{chunk-3ZZSQG2A.js → chunk-YBPEOKBK.js} +1 -1
  17. package/dist/{cli-7QRILUMX.js → cli-376NPUD5.js} +29 -29
  18. package/dist/{command-TOAYBFFZ.js → command-6IRYBERW.js} +4 -4
  19. package/dist/{container-start-6FSO54P4.js → container-start-UGVA5X7P.js} +5 -5
  20. package/dist/{doctor-XDN7XS64.js → doctor-IBYJAM6B.js} +5 -5
  21. package/dist/{host-checks-XGFTDLLF.js → host-checks-KFUGD4FC.js} +3 -3
  22. package/dist/index.js +1 -1
  23. package/dist/{init-VOKKIEKX.js → init-R45QKBSR.js} +3 -3
  24. package/dist/{init-JU5GZJWH.js → init-VBAY7DST.js} +3 -3
  25. package/dist/{init-agent-XMC3ZJWR.js → init-agent-GA3TKIWH.js} +3 -3
  26. package/dist/{init-cmd-CKMBOAZ5.js → init-cmd-TOS5IA2V.js} +2 -2
  27. package/dist/{loop-WPT6ILVY.js → loop-OODXAKC6.js} +7 -7
  28. package/dist/{machine-BZBJNTTU.js → machine-NUZIF5L5.js} +3 -3
  29. package/dist/{runner-key-LTA6PHOI.js → runner-key-4UXNGDJA.js} +3 -3
  30. package/dist/{setup-cmd-ANDLH2E7.js → setup-cmd-HAYSPZJQ.js} +4 -4
  31. package/dist/{setup-wiring-4YSYU7OV.js → setup-wiring-HABXYP6Y.js} +6 -6
  32. package/dist/{status-4MTM45CS.js → status-CM3K7FBG.js} +3 -3
  33. package/dist/{update-steps-GJ6WGON2.js → update-steps-PDYCC5HX.js} +4 -4
  34. package/dist/{work-claim-cmd-BZ5RFKVN.js → work-claim-cmd-JURSVSEI.js} +1 -1
  35. package/dist/{work-proofs-cmd-FIEPKCPW.js → work-proofs-cmd-FSPZ64EK.js} +1 -1
  36. package/dist/{work-proofs-record-BQ7EAT5R.js → work-proofs-record-I36WZHH3.js} +1 -1
  37. package/package.json +1 -1
package/README.md CHANGED
@@ -696,7 +696,7 @@ moves, that pass stops counting and a fresh review is needed. The evidence
696
696
  status check's title says where the review stands. The status check on GitHub
697
697
  never waits for the review: it completes once OuterLayer's judges finish. With
698
698
  the factory's "Block the merge when a check fails" switch on (Settings, then
699
- Build settings), a person's request for changes fails it.
699
+ Repositories), a person's request for changes fails it.
700
700
 
701
701
  A criterion thread is scoped to one acceptance criterion rather than the
702
702
  whole item: an agent attaches proof with `outerlayer work comment
@@ -1 +1 @@
1
- {"id":"2026-11-19T01:10:25.003Z","root":"/home/runner/work/outerlayer/outerlayer","pkg":"outerlayer"}
1
+ {"id":"2026-11-19T03:30:54.554Z","root":"/home/runner/work/outerlayer/outerlayer","pkg":"outerlayer"}
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- export { claimCalls, claimItem, configForJob, itemCalls, leftByRunnerKey, runnerCalls, spoolHomeFor } from './chunk-S3VUP7LF.js';
3
+ export { claimCalls, claimItem, configForJob, itemCalls, leftByRunnerKey, runnerCalls, spoolHomeFor } from './chunk-V3T36H4O.js';
4
4
  import './chunk-TRZOAT7E.js';
5
5
  import './chunk-MYDYQUJD.js';
6
6
  import './chunk-EYN62KZW.js';
@@ -1,17 +1,17 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { probeCredentials } from './chunk-DQ3IKV5Q.js';
3
+ import { probeCredentials } from './chunk-AGB4OA6T.js';
4
4
  import './chunk-6YBI24YT.js';
5
5
  import './chunk-E7R2GIAW.js';
6
- import './chunk-U5MLUAY3.js';
7
- import './chunk-3ZZSQG2A.js';
6
+ import './chunk-J5FVUVGR.js';
7
+ import './chunk-YBPEOKBK.js';
8
8
  import './chunk-TXKHD4Q6.js';
9
9
  import './chunk-GFXXAXPF.js';
10
10
  import './chunk-AVYR5USX.js';
11
- import { fleetConfigProblem, managedProblems, managedFactsOf, askFleetMachine, fleetQueuesWithoutAgent, fleetQueuesWithoutAgentNote } from './chunk-OLXB2YMX.js';
11
+ import { fleetConfigProblem, managedProblems, managedFactsOf, askFleetMachine, fleetQueuesWithoutAgent, fleetQueuesWithoutAgentNote } from './chunk-CW74N36I.js';
12
12
  import './chunk-CYQSTT5N.js';
13
- import { createGatewaySandboxClient, gatewayRefusalReason, placeholderQueues, placeholderProblem, permissionModeProblems, permissionModeProblem, needsAgentCredential, agentCredentialCheck, credentialVerdict, claimPermissionProblem, formerSkillQueues, modellessQueues, formerSkillProblem, modellessProblem } from './chunk-RCE5YQFT.js';
14
- import './chunk-7TDLQUJ5.js';
13
+ import { createGatewaySandboxClient, gatewayRefusalReason, placeholderQueues, placeholderProblem, permissionModeProblems, permissionModeProblem, needsAgentCredential, agentCredentialCheck, credentialVerdict, claimPermissionProblem, formerSkillQueues, modellessQueues, formerSkillProblem, modellessProblem } from './chunk-XI635QEJ.js';
14
+ import './chunk-W2TGACUB.js';
15
15
  import './chunk-2QK7L3WV.js';
16
16
  import './chunk-2PGI6RDE.js';
17
17
  import './chunk-57MLWALQ.js';
@@ -25,7 +25,7 @@ import './chunk-C2PZOLN7.js';
25
25
  import './chunk-B4XB5QFD.js';
26
26
  import './chunk-NXYTICCS.js';
27
27
  import './chunk-TQMI335S.js';
28
- import './chunk-S3VUP7LF.js';
28
+ import './chunk-V3T36H4O.js';
29
29
  import './chunk-NN33FYXG.js';
30
30
  import './chunk-XETFYRKD.js';
31
31
  import './chunk-CQKCNDPP.js';
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { helperSocketPath } from './chunk-RCE5YQFT.js';
3
+ import { helperSocketPath } from './chunk-XI635QEJ.js';
4
4
  import { UNIT_MARKER } from './chunk-ETBEMXPC.js';
5
5
  import { runnerDir } from './chunk-5PRVTL54.js';
6
6
  import { createHash } from 'crypto';
@@ -2,21 +2,21 @@
2
2
  import { createRequire } from 'node:module';
3
3
  import { readHousekeepingRecord, writeHousekeepingRecord } from './chunk-6YBI24YT.js';
4
4
  import { fetchVersionMeta, npmVersion, npmSupportsProvenance, fetchTarballDigest, fetchProvenance, installVersion, auditSignatures } from './chunk-E7R2GIAW.js';
5
- import { reportFailedStart, fitImageBuildMemory } from './chunk-U5MLUAY3.js';
6
- import { renderUpdateSteps } from './chunk-3ZZSQG2A.js';
5
+ import { reportFailedStart, fitImageBuildMemory } from './chunk-J5FVUVGR.js';
6
+ import { renderUpdateSteps } from './chunk-YBPEOKBK.js';
7
7
  import { decideInstalledSwitch } from './chunk-TXKHD4Q6.js';
8
8
  import { writeFleetState } from './chunk-GFXXAXPF.js';
9
9
  import { writePendingUpdate } from './chunk-AVYR5USX.js';
10
- import { fleetConfigProblem, realBlockedProbes, checkBlockedWithSlots, askFleetMachine } from './chunk-OLXB2YMX.js';
10
+ import { fleetConfigProblem, realBlockedProbes, checkBlockedWithSlots, askFleetMachine } from './chunk-CW74N36I.js';
11
11
  import { writeMarker, readMarker, currentVersion, removeMarker, isInLayout, startedThroughCurrent, entryIn, versionDir, switchCurrent, cleanVersions, stagingDir } from './chunk-CYQSTT5N.js';
12
- import { leaseTimeLeftMs, createContainerRuntime, heldSandboxClaimsOf, unfinishedJobs, withTunnelLog, itemTag, releaseLease, runDecision, claimRun, LEASE_SECONDS, isUnfinished, prepareResume, restoreSessionIntoMicroVm, restoreSessionIntoContainer, restoreSessionIntoSandbox, restoreWork, keptSessionDir, workRestoredEnv, sessionGuestOfMicroVm, sessionGuestOfContainer, sessionGuestOfSandbox, recordsProofsOnly, itemScope, attemptNote, noteMissingCredential, fetchManagedBuildSettings, holdManagedBuildSettings, setStage, jobEnv, runHook, describeHookEnd, needsBuildSkill, provisionContainer, leaseExpiresAtMs, withJobTimeLimit, deliverContainerHooks, provisionSandbox, deliverSandboxHooks, provisionMicroVm, deliverCommitHooks, provisionEnvironment, readProvisionOut, resolveHostBuild, workdirProblem, listenOnBroker, hostEnvironment, deliverExecMaven, runWithSpawn, hostCommandEnvironment, lifecycleSteps, execArgv, lifecycleFailureReason, decideHostBuildSkill, prepareBranch, keptCommitsLine, runCommandFor, currentSkillCommand, formerSkillProblem, commandLogOffset, startSandboxCommand, MICROVM_COMMAND_DIR, startMicroVmCommand, microVmCommandLine, runCommand, containerCommandExec, execCommandLine, startSender, commandEndReasonOf, holdManagedKey, startHostServices, finishJob, sampleGuest, foldSample, isSandboxTracked, isContainerTracked, isMicroVmTracked, probeSandboxCommand, probeMicroVmCommand, probeCommand, appendCommandLog, judgeProbe, SandboxGoneError, SandboxContainerStoppedError, EXIT_CODE_FILE, isTracked, isGroupAlive, outcomeFromExitCode, isIsolatedJob, jobTimeLimitMinutes, isTimedOut, readCpuUsec, isIdle, HELPER_ENV, setUpRunnerCgroup, stopOrphanedMicroVms, sweepImageBuilders, listUnreadableJobs, listAdoptableJobs, retryFailedReleases, recoverLostJobs, GUEST_USAGE_INTERVAL_MS, vmAlive, filesAreCopied, inSandbox, listItemDisks, hookLimitsFor, runCommandOf, AttemptLogBook, fetchManagedModelKey, environmentFor, builtOf, judgeCredential, missingJudgeCredential, reviewFiles, readWorkItem, issueText, storedProblemsText, territories, territoryBrief, dropNonProblems, mergeAnswers, carriedProblems, unreviewedItem, makeRecorder, microVmOomKills, needsRenew, renewRun, renewLease, RENEW_INTERVAL_SECONDS, stoppedHelperReason, measureDisk, listTrackedJobs, sweepSandboxes, keptSandboxIds, parseCpuList, ensureTunnel, keepGhConfigCurrent, restartSender, rejoinSandboxBuild, createHousekeepingDocker, housekeepingDockerIfReachable, runHousekeeping, shellQuote, jobRecordsClaim, freeItemDisksUntil, savedStatesDir, readRecords, holdsHostDisk, removeOldestUntil, treeFileText, scrubReason, superviseRuns, NO_LOG, timeoutAfter, unreviewedFiles, markdownSection, ensureNetworkReady, ADOPTED_FETCH_RETRY_WINDOW_MS, managedBuildSettingsFor, gitRemoteFor, startServicesFor, installTrust, createLeaseChannel, serveLease, writeGuestGhConfig, deliverJobFiles, inTeardown } from './chunk-RCE5YQFT.js';
13
- import { RUNNER_PROTOCOL } from './chunk-7TDLQUJ5.js';
12
+ import { leaseTimeLeftMs, createContainerRuntime, heldSandboxClaimsOf, unfinishedJobs, withTunnelLog, itemTag, releaseLease, runCommandOf, runDecision, claimRun, LEASE_SECONDS, isUnfinished, prepareResume, restoreSessionIntoMicroVm, restoreSessionIntoContainer, restoreSessionIntoSandbox, restoreWork, keptSessionDir, workRestoredEnv, sessionGuestOfMicroVm, sessionGuestOfContainer, sessionGuestOfSandbox, recordsProofsOnly, itemScope, attemptNote, noteMissingCredential, fetchManagedBuildSettings, holdManagedBuildSettings, setStage, jobEnv, runHook, describeHookEnd, needsBuildSkill, provisionContainer, leaseExpiresAtMs, withJobTimeLimit, deliverContainerHooks, provisionSandbox, deliverSandboxHooks, provisionMicroVm, deliverCommitHooks, provisionEnvironment, readProvisionOut, resolveHostBuild, workdirProblem, listenOnBroker, hostEnvironment, deliverExecMaven, runWithSpawn, hostCommandEnvironment, lifecycleSteps, execArgv, lifecycleFailureReason, decideHostBuildSkill, prepareBranch, keptCommitsLine, runCommandFor, currentSkillCommand, formerSkillProblem, commandLogOffset, startSandboxCommand, MICROVM_COMMAND_DIR, startMicroVmCommand, microVmCommandLine, runCommand, containerCommandExec, execCommandLine, startSender, commandEndReasonOf, holdManagedKey, startHostServices, finishJob, sampleGuest, foldSample, isSandboxTracked, isContainerTracked, isMicroVmTracked, probeSandboxCommand, probeMicroVmCommand, probeCommand, appendCommandLog, judgeProbe, SandboxGoneError, SandboxContainerStoppedError, EXIT_CODE_FILE, isTracked, isGroupAlive, outcomeFromExitCode, isIsolatedJob, jobTimeLimitMinutes, isTimedOut, readCpuUsec, isIdle, HELPER_ENV, setUpRunnerCgroup, stopOrphanedMicroVms, sweepImageBuilders, listUnreadableJobs, listAdoptableJobs, retryFailedReleases, recoverLostJobs, GUEST_USAGE_INTERVAL_MS, vmAlive, filesAreCopied, inSandbox, releaseRun, listItemDisks, hookLimitsFor, SANDBOX_NOT_PREPARED, AttemptLogBook, fetchManagedModelKey, managedFaultReason, environmentFor, builtOf, judgeCredential, missingJudgeCredential, reviewFiles, readWorkItem, issueText, storedProblemsText, territories, territoryBrief, dropNonProblems, mergeAnswers, carriedProblems, unreviewedItem, makeRecorder, microVmOomKills, needsRenew, renewRun, renewLease, RENEW_INTERVAL_SECONDS, stoppedHelperReason, measureDisk, listTrackedJobs, sweepSandboxes, keptSandboxIds, parseCpuList, ensureTunnel, keepGhConfigCurrent, restartSender, rejoinSandboxBuild, createHousekeepingDocker, housekeepingDockerIfReachable, runHousekeeping, shellQuote, jobRecordsClaim, freeItemDisksUntil, savedStatesDir, readRecords, holdsHostDisk, removeOldestUntil, treeFileText, scrubReason, superviseRuns, NO_LOG, timeoutAfter, unreviewedFiles, markdownSection, ensureNetworkReady, ADOPTED_FETCH_RETRY_WINDOW_MS, managedBuildSettingsFor, gitRemoteFor, startServicesFor, installTrust, createLeaseChannel, serveLease, writeGuestGhConfig, deliverJobFiles, parseRunClaim, inTeardown } from './chunk-XI635QEJ.js';
13
+ import { RUNNER_PROTOCOL } from './chunk-W2TGACUB.js';
14
14
  import { criteriaOf, diffLines, loadCitationFinder, wholeItems, itemsSentence, oneLineReason, treePath, parseJudgeAnswer, wholeEntries, lineInDiff } from './chunk-2QK7L3WV.js';
15
15
  import { RepoFilter } from './chunk-AFU6UF34.js';
16
16
  import { JOB_STATE_FORMAT, readsJobState, jobStateFormatOf } from './chunk-B4XB5QFD.js';
17
17
  import { imageTag, writeUpdateStatus, pullInstruction, tagToPull } from './chunk-NXYTICCS.js';
18
18
  import { isVersion, compareVersions, satisfiesRange } from './chunk-TQMI335S.js';
19
- import { claimCalls, claimItem, spoolHomeFor, leftByRunnerKey, runnerCalls, itemCalls, configForJob } from './chunk-S3VUP7LF.js';
19
+ import { claimCalls, claimItem, spoolHomeFor, leftByRunnerKey, runnerCalls, itemCalls, configForJob } from './chunk-V3T36H4O.js';
20
20
  import { fetchCommit, readBranchHead, diffBetween, readDefaultBranchFiles } from './chunk-XETFYRKD.js';
21
21
  import { claimPidFile, releasePidFile, writePidFile, readPidFile } from './chunk-NRR4YLHI.js';
22
22
  import { startTimeOf, isSameProcess } from './chunk-JBJTC3UU.js';
@@ -146,6 +146,19 @@ function parseClaim(value) {
146
146
  }
147
147
  return { data, id, kind, workItemId, number, appId, organizationId, size };
148
148
  }
149
+ function parseRun(value, runKey) {
150
+ if (value === null || value === void 0) return void 0;
151
+ if (typeof value !== "object" || Array.isArray(value)) return { malformed: true };
152
+ const data = value;
153
+ const { id, appId, organizationId } = data;
154
+ const named = {
155
+ ...typeof id === "string" && id !== "" ? { id } : {},
156
+ ...typeof appId === "string" && appId !== "" ? { appId } : {}
157
+ };
158
+ const parsed = parseRunClaim(value, runKey);
159
+ if (parsed.kind !== "claimed" || typeof appId !== "string" || appId === "" || typeof organizationId !== "string" || organizationId === "") return { malformed: true, ...named };
160
+ return { run: parsed.run, runKey: parsed.runKey, appId, organizationId };
161
+ }
149
162
  function parseStops(value) {
150
163
  if (!Array.isArray(value)) return [];
151
164
  const stops = [];
@@ -158,8 +171,10 @@ function parseStops(value) {
158
171
  }
159
172
  function parseAnswer(data) {
160
173
  const reservation = Object(data.reservation);
174
+ const run = Object(data.run);
161
175
  return {
162
176
  claim: parseClaim(data.claim),
177
+ run: parseRun(data.run, run.runKey),
163
178
  stops: parseStops(data.stops),
164
179
  reservation: typeof reservation.workItemId === "string" && (reservation.size === "small" || reservation.size === "large") ? { workItemId: reservation.workItemId, size: reservation.size } : null,
165
180
  ...typeof data.reason === "string" ? { reason: data.reason } : {},
@@ -217,6 +232,25 @@ function noteReason(ports, memory, answer) {
217
232
  memory.loggedReasons.add(key);
218
233
  ports.log.error(`the gateway did not claim work item ${answer.reasonWorkItemId ?? "(not named)"} for this machine: ${answer.reason}`);
219
234
  }
235
+ async function takeRun(ports, answer) {
236
+ const end = async (id, appId) => {
237
+ const ended = id !== void 0 && appId !== void 0 ? await ports.endRun({ id, appId }) : false;
238
+ return ended ? "the run was ended as failed" : "the run could not be ended, so it stays held until its lease lapses";
239
+ };
240
+ if ("malformed" in answer) {
241
+ ports.log.error(`the gateway's run lacked what a fleet runner needs (its id, factory, organization, key and limits); update the runner \xB7 ${await end(answer.id, answer.appId)}`);
242
+ return false;
243
+ }
244
+ if (ports.draining()) {
245
+ ports.log.line(`the runner is draining; ${await end(answer.run.id, answer.appId)} (run ${answer.run.id})`);
246
+ return false;
247
+ }
248
+ if (ports.waitsAfterProvision()) {
249
+ ports.log.line(`the runner takes no work after a provision that failed; ${await end(answer.run.id, answer.appId)} (run ${answer.run.id})`);
250
+ return false;
251
+ }
252
+ return ports.startRun(answer);
253
+ }
220
254
  async function runFleetTick(ports, memory) {
221
255
  ports.reload();
222
256
  if (!await checkFleet(ports, memory)) return;
@@ -231,7 +265,7 @@ async function runFleetTick(ports, memory) {
231
265
  if (answer === void 0) return;
232
266
  memory.last = {
233
267
  calledAt: ports.now().toISOString(),
234
- claimId: answer.claim !== void 0 && "id" in answer.claim ? answer.claim.id : null,
268
+ claimId: answer.claim !== void 0 && "id" in answer.claim ? answer.claim.id : answer.run !== void 0 && "run" in answer.run ? answer.run.run.id : null,
235
269
  reservation: answer.reservation,
236
270
  stops: answer.stops.length,
237
271
  ...answer.reason === void 0 ? {} : { reason: answer.reason }
@@ -239,6 +273,12 @@ async function runFleetTick(ports, memory) {
239
273
  record(ports, memory);
240
274
  if (answer.stops.length > 0) ports.applyStops(answer.stops);
241
275
  noteReason(ports, memory, answer);
276
+ if (answer.claim === void 0 && answer.run !== void 0) {
277
+ const started2 = await takeRun(ports, answer.run);
278
+ if (!started2 || held || ports.draining()) return;
279
+ if (ports.provisionEnds() > provisionEnds) return;
280
+ continue;
281
+ }
242
282
  if (answer.claim === void 0) return;
243
283
  if ("malformed" in answer.claim) {
244
284
  const { workItemId, appId } = answer.claim;
@@ -284,6 +324,14 @@ async function runFleetKeepalive(ports, memory, minGapMs) {
284
324
  record(ports, memory);
285
325
  if (answer.stops.length > 0) ports.applyStops(answer.stops);
286
326
  noteReason(ports, memory, answer);
327
+ if (answer.claim === void 0 && answer.run !== void 0) {
328
+ const run = "malformed" in answer.run ? answer.run : { id: answer.run.run.id, appId: answer.run.appId };
329
+ const ended = run.id !== void 0 && run.appId !== void 0 ? await ports.endRun({ id: run.id, appId: run.appId }) : false;
330
+ ports.log.error(
331
+ `the gateway handed out run ${run.id ?? "(not named)"} to a call that reported no free room \xB7 ` + (ended ? "the run was ended as failed" : "the run could not be ended, so it stays held until its lease lapses")
332
+ );
333
+ return;
334
+ }
287
335
  if (answer.claim === void 0) return;
288
336
  const { workItemId, appId } = answer.claim;
289
337
  const released = workItemId !== void 0 && appId !== void 0 ? await ports.release({ workItemId, appId }) : false;
@@ -3040,6 +3088,13 @@ async function fleetHeld(state) {
3040
3088
  return holdAfterProvisionRetry(state);
3041
3089
  }
3042
3090
  var CLAIM_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
3091
+ async function endFleetRun(state, run) {
3092
+ const ended = await retrySend(() => releaseRun(claimCalls(state.config, { appId: run.appId, queue: "run" }), run.id, "failed", state.deps.fetchImpl), {
3093
+ now: state.deps.now,
3094
+ sleep: state.deps.sleep
3095
+ });
3096
+ return ended.ok;
3097
+ }
3043
3098
  function fleetClaimIds(ids) {
3044
3099
  return ids.filter((id) => CLAIM_ID.test(id));
3045
3100
  }
@@ -3071,6 +3126,17 @@ function fleetPortsOf(state) {
3071
3126
  });
3072
3127
  return attempt.kind === "started" && attempt.provisionFailed !== true;
3073
3128
  },
3129
+ startRun: async (answer) => {
3130
+ if (runCommandOf(state.config, state.deps.agents) === void 0) {
3131
+ reportRepeating(state, "the run command", "takes no run of a schedule automation: the agent that runner.commands.implement starts has no command for a run \xB7 set runner.commands.run in the config file");
3132
+ await endFleetRun(state, { id: answer.run.id, appId: answer.appId });
3133
+ return false;
3134
+ }
3135
+ reportRepeating(state, "the run command", void 0);
3136
+ const started = await startClaimedRun(state, answer.run, answer.runKey, { workItemId: answer.run.id, appId: answer.appId, organizationId: answer.organizationId, size: "small" });
3137
+ return started === "started";
3138
+ },
3139
+ endRun: (run) => endFleetRun(state, run),
3074
3140
  release: async (claim) => {
3075
3141
  const released = await retrySend(() => releaseLease(claimCalls(state.config, { appId: claim.appId }), claim.workItemId, void 0, {}, state.deps.fetchImpl), {
3076
3142
  now: state.deps.now,
@@ -3326,7 +3392,6 @@ async function tryClaimAndStartRun(state) {
3326
3392
  }
3327
3393
  const { isolation } = decision;
3328
3394
  reportRepeating(state, "the run command", void 0);
3329
- const log = logOf(state);
3330
3395
  const hostKey = await loadHostKey(state.config.configPath);
3331
3396
  const cliVersion = state.deps.cliVersion ?? resolveVersion();
3332
3397
  const claim = await retrySend(() => claimRun({ config: state.config, isolation, cliVersion, ...hostKey === void 0 ? {} : { hostKey: hostKey.hostKey, signer: hostKey.signer }, fetchImpl: state.deps.fetchImpl }), {
@@ -3350,7 +3415,10 @@ async function tryClaimAndStartRun(state) {
3350
3415
  reportRepeating(state, "the run claim", answer.reason);
3351
3416
  return "stop";
3352
3417
  }
3353
- const { run, runKey } = answer;
3418
+ return await startClaimedRun(state, answer.run, answer.runKey) === "none" ? "none" : "started";
3419
+ }
3420
+ async function startClaimedRun(state, run, runKey, fleet) {
3421
+ const log = logOf(state);
3354
3422
  if (claimIsAlreadyRunning(state, run.id)) {
3355
3423
  log.line(`#${run.id} skipped: the run is already running here`);
3356
3424
  return "none";
@@ -3358,30 +3426,40 @@ async function tryClaimAndStartRun(state) {
3358
3426
  const branch = `outerlayer/run-${run.id.slice(0, 8)}`;
3359
3427
  const item = { id: run.id, number: run.id, trackerKey: run.id, specRepository: run.repository };
3360
3428
  const tag = itemTag({ item: run.id, claimId: run.id });
3361
- try {
3362
- await startJob(
3363
- state,
3364
- item,
3365
- "run",
3366
- run.id,
3367
- runKey,
3368
- branch,
3369
- void 0,
3370
- [{ repository: run.repository.toLowerCase(), branch, primary: true }],
3371
- void 0,
3372
- void 0,
3373
- void 0,
3374
- void 0,
3375
- { instructions: run.instructions, issuesLeft: run.issuesLeft, timeLimitSeconds: run.timeLimitSeconds }
3376
- );
3377
- } catch (err) {
3429
+ const starting = startJob(
3430
+ state,
3431
+ item,
3432
+ "run",
3433
+ run.id,
3434
+ runKey,
3435
+ branch,
3436
+ void 0,
3437
+ [{ repository: run.repository.toLowerCase(), branch, primary: true }],
3438
+ fleet,
3439
+ void 0,
3440
+ void 0,
3441
+ void 0,
3442
+ { instructions: run.instructions, issuesLeft: run.issuesLeft, timeLimitSeconds: run.timeLimitSeconds }
3443
+ );
3444
+ const endStranded = async (err) => {
3378
3445
  const stranded = [...state.jobs.values()].find((active) => active.job.claimId === run.id);
3379
- if (stranded === void 0) throw err;
3446
+ if (stranded === void 0) return false;
3380
3447
  const reason = `provision failed: ${describeCallFailure(err)}`;
3381
3448
  log.error(`${tag} ${reason} \xB7 ending job as failed`);
3382
3449
  await endJob(state, stranded, "failed", { stage: "provision", reason });
3450
+ return true;
3451
+ };
3452
+ if (provisionsBesideOthers(state.config)) {
3453
+ endWhenStartFails(starting, endStranded, (line) => log.error(`${tag} ${line}`));
3454
+ return "started";
3455
+ }
3456
+ try {
3457
+ await starting;
3458
+ } catch (err) {
3459
+ if (!await endStranded(err)) throw err;
3460
+ return "provision_failed";
3383
3461
  }
3384
- return "started";
3462
+ return [...state.jobs.values()].some((active) => active.job.claimId === run.id) ? "started" : "provision_failed";
3385
3463
  }
3386
3464
  var CLAIM_REFUSAL_CODES = new Set(
3387
3465
  "pull_request_from_fork pull_request_on_default_branch pull_request_ambiguous pull_request_repository_not_connected repository_not_reachable branch_claimed_elsewhere".split(" ")
@@ -3751,7 +3829,12 @@ async function startJob(state, item, queue, claimId, itemKey, branch, identity,
3751
3829
  await endOnManagedRefusal(state, active, held.refused, { what: held.what, was: "was" });
3752
3830
  return;
3753
3831
  }
3754
- const settings = await fetchManagedBuildSettings(claimCalls(state.config, active.job), claimItem(state.config, active.job), { fetchImpl: state.deps.fetchImpl, now: state.deps.now, sleep: state.deps.sleep });
3832
+ const settings = await fetchManagedBuildSettings(claimCalls(state.config, active.job), claimItem(state.config, active.job), {
3833
+ run: active.job.queue === "run",
3834
+ fetchImpl: state.deps.fetchImpl,
3835
+ now: state.deps.now,
3836
+ sleep: state.deps.sleep
3837
+ });
3755
3838
  if (active.ending) return;
3756
3839
  if (!settings.ok) {
3757
3840
  await endOnManagedRefusal(state, active, settings, { what: "settings", was: "were" });
@@ -3895,7 +3978,7 @@ async function startJob(state, item, queue, claimId, itemKey, branch, identity,
3895
3978
  installCommitHooks(active.job, log, tag);
3896
3979
  const hooksDelivered = await deliverSandboxHooks(runtimeOf(state), provisioned.state, dirPath);
3897
3980
  if (!hooksDelivered.ok) {
3898
- await endOnProvisionFailure(state, active, tokens, provisionTook, hooksDelivered);
3981
+ await endOnProvisionFailure(state, active, tokens, provisionTook, { ...hooksDelivered, fault: SANDBOX_NOT_PREPARED });
3899
3982
  return;
3900
3983
  }
3901
3984
  } else if (vmMode) {
@@ -4253,6 +4336,7 @@ async function holdManagedKeys(state, job, dirPath, options) {
4253
4336
  const labelOf = (provider) => PROVIDERS[provider]?.label ?? provider;
4254
4337
  const ask = (provider) => fetchManagedModelKey(claimCalls(state.config, job), claimItem(state.config, job), {
4255
4338
  provider,
4339
+ run: job.queue === "run",
4256
4340
  fetchImpl: state.deps.fetchImpl,
4257
4341
  now: state.deps.now,
4258
4342
  sleep: state.deps.sleep,
@@ -4331,6 +4415,8 @@ function waitText(waitMs) {
4331
4415
  }
4332
4416
  async function endOnProvisionFailure(state, active, tokens, took, failure) {
4333
4417
  const { reason } = failure;
4418
+ const fault = state.config.fleet === true ? failure.fault : void 0;
4419
+ const failed2 = (released) => fault === void 0 ? { stage: "provision", reason: released } : { stage: "provision", reason: managedFaultReason(fault), cause: fault.cause };
4334
4420
  const log = logOf(state);
4335
4421
  const tag = `${itemTag(active.job)}`;
4336
4422
  const key = retryKeyOf(active.job);
@@ -4342,13 +4428,13 @@ async function endOnProvisionFailure(state, active, tokens, took, failure) {
4342
4428
  if (failure.transient !== true && !tokens.controlPlaneUnavailable()) {
4343
4429
  state.provisionRetries?.delete(key);
4344
4430
  log.error(`${tag} provision failed (${took}): ${reason} \xB7 ending job as failed`);
4345
- await endJob(state, active, "failed", { stage: "provision", reason });
4431
+ await endJob(state, active, "failed", failed2(reason));
4346
4432
  return;
4347
4433
  }
4348
4434
  const decision = noteProvisionRetry(state.provisionRetries ??= /* @__PURE__ */ new Map(), key, reason, nowOf(state).getTime(), failure.retryAfterMs);
4349
4435
  if (decision.kind === "give_up") {
4350
4436
  log.error(`${tag} provision failed (${took}): ${reason} \xB7 it failed this way ${decision.failures} times in a row \xB7 ending job as failed`);
4351
- await endJob(state, active, "failed", { stage: "provision", reason: decision.reason });
4437
+ await endJob(state, active, "failed", failed2(decision.reason));
4352
4438
  return;
4353
4439
  }
4354
4440
  state.provisionRetryHold = decision.hold;
@@ -5091,7 +5177,7 @@ async function startRunner(configPath, deps, startup) {
5091
5177
  check: update.check ? () => update.check(configPath) : async () => {
5092
5178
  const held = runnerAgents(deps.agents).flatMap((agent) => heldAgentCredential(agent.descriptor.id) ?? []);
5093
5179
  const env = { ...process.env, ...Object.fromEntries(held.map((credential) => [credential.variable, credential.value])) };
5094
- return (await import('./check-BXJBIMLW.js')).runRunnerCheck(configPath, { fetchImpl: deps.fetchImpl, env });
5180
+ return (await import('./check-ZCF7AI73.js')).runRunnerCheck(configPath, { fetchImpl: deps.fetchImpl, env });
5095
5181
  },
5096
5182
  now: () => (deps.now ?? (() => /* @__PURE__ */ new Date()))().getTime(),
5097
5183
  log
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { placeholderQueues, placeholderProblem } from './chunk-RCE5YQFT.js';
3
+ import { placeholderQueues, placeholderProblem } from './chunk-XI635QEJ.js';
4
4
  import { checkFit } from './chunk-ETBEMXPC.js';
5
5
  import { getJson, WorkCommandError } from './chunk-ASAIS67T.js';
6
6
  import { isBuiltinSandbox, builtinKind, EGRESS_SWITCHABLE_KEYS, keepsHostBuilder } from './chunk-TRZOAT7E.js';
@@ -1084,7 +1084,7 @@ async function gatherDoctorChecks(options = {}) {
1084
1084
  const { runnerVmCheck } = await import('./doctor-53F2PYY7.js');
1085
1085
  checks.push(runnerVmCheck(configPath, { lima: realLima(), home: homeFromEnv(), instance: runnerVm.instance }));
1086
1086
  } else if (hasRunnerBlock(configPath)) {
1087
- const { runnerHostChecks } = await import('./doctor-XDN7XS64.js');
1087
+ const { runnerHostChecks } = await import('./doctor-IBYJAM6B.js');
1088
1088
  const gateway = (() => {
1089
1089
  try {
1090
1090
  const loaded = loadRunnerConfig(configPath);
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { scrubReason, stripTerminalControls } from './chunk-RCE5YQFT.js';
3
+ import { scrubReason, stripTerminalControls } from './chunk-XI635QEJ.js';
4
4
  import { checkFit, RUNNER_RESERVE_BYTES } from './chunk-ETBEMXPC.js';
5
5
  import { RunnerAlreadyRunningError, readPidFile } from './chunk-NRR4YLHI.js';
6
6
  import { isSameProcess } from './chunk-JBJTC3UU.js';
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { summarizeChecks, summaryText, renderDoctorText } from './chunk-X6WL4AQY.js';
3
+ import { summarizeChecks, summaryText, renderDoctorText } from './chunk-EIAE4HE5.js';
4
4
  import { shellFunctionInstalled, removeShellFunction, installShellFunction, SHELL_FUNCTION_LINE } from './chunk-UWRXRSCE.js';
5
5
  import { runConnect, hasUncommittedSetup, commitCommandsFor } from './chunk-7O37CF6M.js';
6
6
  import { C } from './chunk-2AM6Z5BP.js';
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { buildSkillPaths } from './chunk-RCE5YQFT.js';
3
+ import { buildSkillPaths } from './chunk-XI635QEJ.js';
4
4
  import { ignoreRuleFor } from './chunk-ZN3RUNOZ.js';
5
5
  import { linkedBranches, setupCommitPaths, commitCommandsFor, ownerAndName } from './chunk-7O37CF6M.js';
6
6
  import { sanitizeTerminal } from './chunk-V3NMSDOC.js';
@@ -18,7 +18,7 @@ function runnerCalls(config) {
18
18
  return config;
19
19
  }
20
20
  function claimCalls(config, job) {
21
- if (job.queue === "run") return withoutBuildAccess(runnerCalls(config));
21
+ if (job.queue === "run") return withoutBuildAccess(config.fleet === true ? { ...config, appId: factoryOf(job) } : runnerCalls(config));
22
22
  if (config.fleet !== true) return runnerCalls(config);
23
23
  return { ...config, appId: factoryOf(job) };
24
24
  }
@@ -36,7 +36,7 @@ function itemCalls(config, job) {
36
36
  return { ...config, apiKey: job.itemKey, appId: factoryOf(job) };
37
37
  }
38
38
  function claimItem(config, job) {
39
- if (config.fleet !== true) return job.item;
39
+ if (config.fleet !== true || job.queue === "run") return job.item;
40
40
  if (job.workItemId === void 0 || job.workItemId === "") throw new RunnerConfigError("a fleet build's job file names no work item id; the claim carries it");
41
41
  return job.workItemId;
42
42
  }
@@ -4,6 +4,6 @@ import { createRequire } from 'node:module';
4
4
  createRequire(import.meta.url);
5
5
 
6
6
  // src/runner/protocol.ts
7
- var RUNNER_PROTOCOL = 72;
7
+ var RUNNER_PROTOCOL = 74;
8
8
 
9
9
  export { RUNNER_PROTOCOL };
@@ -130,7 +130,7 @@ async function judgeCheckName(cwd) {
130
130
  const dir = governingDir(cwd);
131
131
  if (dir === void 0) return {};
132
132
  if (!existsSync(dir)) return { note: `the governed context at ${dir} is not readable` };
133
- const { checksIn } = await import('./host-checks-XGFTDLLF.js');
133
+ const { checksIn } = await import('./host-checks-KFUGD4FC.js');
134
134
  const quiet = { line: () => void 0, error: () => void 0 };
135
135
  const check = checksIn(dir, quiet, "").checks.find((c) => c.judge.subjects === "criteria");
136
136
  return check === void 0 ? {} : { name: check.name };
@@ -366,7 +366,7 @@ async function runWorkProofs(opts) {
366
366
  async function runWorkProofsCommand(opts) {
367
367
  try {
368
368
  if (opts.record || opts.check) {
369
- const { runWorkProofsRecord } = await import('./work-proofs-record-BQ7EAT5R.js');
369
+ const { runWorkProofsRecord } = await import('./work-proofs-record-I36WZHH3.js');
370
370
  const result2 = await runWorkProofsRecord(opts);
371
371
  process.exitCode = result2.exitCode;
372
372
  return;