@outerlayer/cli 0.40.0-next.20261117022943 → 0.40.0-next.20261117034333
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-setup-UU3NQZ3A.js +41 -0
- package/dist/{agent-subcommand-JGANAEB4.js → agent-subcommand-MW4TF4SG.js} +4 -4
- package/dist/{artifact-link-cmd-K6VFGMIO.js → artifact-link-cmd-XUHNVFVU.js} +2 -2
- package/dist/{bridge-YHCQBKZC.js → bridge-WEK2IMAD.js} +7 -7
- package/dist/{build-SSIBPHPA.js → build-LJSUCORB.js} +13 -13
- package/dist/{build-disk-KI2JOKAK.js → build-disk-S2XHWSDH.js} +11 -11
- package/dist/build-info.json +1 -1
- package/dist/{builder-I562HT2D.js → builder-TCRJKB2W.js} +10 -10
- package/dist/caller-VJBDXZXG.js +23 -0
- package/dist/{check-YDBHBTOS.js → check-Z6GAY2C4.js} +58 -61
- package/dist/{chunk-SBSH253O.js → chunk-2QFZBWBP.js} +1 -1
- package/dist/{chunk-UMFSHU72.js → chunk-33DTLCL6.js} +2 -2
- package/dist/{chunk-6RJBLCPV.js → chunk-33RKRHJG.js} +1 -1
- package/dist/{chunk-YI2HDVUL.js → chunk-3ETI7MKK.js} +4 -4
- package/dist/{chunk-PEN7Y4PB.js → chunk-3PXV4I75.js} +3 -3
- package/dist/{chunk-UXAB2OEM.js → chunk-4FTRLX6A.js} +5 -5
- package/dist/{chunk-CEHT2FCU.js → chunk-5EWESACE.js} +2 -2
- package/dist/{chunk-XAOZFBXK.js → chunk-5O7P6VXS.js} +1 -1
- package/dist/{chunk-DHB3M244.js → chunk-6GJMRVMX.js} +1 -1
- package/dist/{chunk-QI6YUQWR.js → chunk-6NODVJGM.js} +3 -3
- package/dist/{chunk-VJCILU3C.js → chunk-6QXGAGQY.js} +1 -1
- package/dist/{chunk-MCJRTOAL.js → chunk-6ZBUQIJA.js} +1 -1
- package/dist/{chunk-NB2BDENG.js → chunk-7PIUTUXI.js} +3 -3
- package/dist/{chunk-OF6XMZHO.js → chunk-7QIQ7QR3.js} +1 -1
- package/dist/{chunk-J4F4V3G2.js → chunk-ABXHYH2Y.js} +6 -6
- package/dist/{chunk-G3HBBHIK.js → chunk-ABY722KN.js} +1 -1
- package/dist/{chunk-JSN2DMPB.js → chunk-AGKUDDIN.js} +1 -1
- package/dist/{chunk-UELSHBQH.js → chunk-AH2BO6Q6.js} +6 -6
- package/dist/{chunk-6DO34552.js → chunk-BEK2BZAI.js} +6 -6
- package/dist/{chunk-3WMULGB4.js → chunk-BZFRU6M7.js} +8 -8
- package/dist/{chunk-MCUI6RHU.js → chunk-CH3PO7UY.js} +10 -2
- package/dist/{chunk-PC2FA62W.js → chunk-CNMC4OXO.js} +7 -7
- package/dist/{chunk-AL6CJD2X.js → chunk-CW6H5JXV.js} +8 -8
- package/dist/{chunk-C6EPHJIV.js → chunk-D2QNQOFX.js} +1 -1
- package/dist/{chunk-3YMOSZRN.js → chunk-D3CALDGC.js} +1 -1
- package/dist/{chunk-HQPB4ZMS.js → chunk-EBWA6KIE.js} +1 -1
- package/dist/{chunk-DQV2XTBD.js → chunk-EU6JHHES.js} +368 -245
- package/dist/{chunk-D5JM2VPO.js → chunk-F4PRZBBJ.js} +2 -2
- package/dist/{chunk-CFIYOLCT.js → chunk-F6J3ACXH.js} +6 -6
- package/dist/{chunk-DV44KCM6.js → chunk-FG2E3HES.js} +1 -1
- package/dist/{chunk-XDWJOYC4.js → chunk-FLHDVJAV.js} +5 -5
- package/dist/{chunk-P2I6YVJV.js → chunk-GBLNHZ3E.js} +4 -4
- package/dist/{chunk-QVTGSGQ5.js → chunk-GQI5N56J.js} +2 -2
- package/dist/{chunk-JE23PLDE.js → chunk-H2THCHUP.js} +1 -1
- package/dist/{chunk-732WJDYG.js → chunk-H4JQKCVP.js} +9 -9
- package/dist/{chunk-UNGZ25QF.js → chunk-H6L6SWMN.js} +2 -2
- package/dist/{chunk-TWUEZPWP.js → chunk-HI6R4XYD.js} +2 -2
- package/dist/{chunk-6P23FS2Z.js → chunk-HSGZ4JEV.js} +1 -1
- package/dist/{chunk-UAOLY4EP.js → chunk-I7ZQKMKG.js} +1 -1
- package/dist/{chunk-JBGASRRE.js → chunk-IQYAPM4S.js} +7 -7
- package/dist/{chunk-ONDONSBT.js → chunk-K6THWLSJ.js} +1 -1
- package/dist/{chunk-DMWGWD26.js → chunk-KCLFDN26.js} +3 -3
- package/dist/{chunk-OY4EJVUH.js → chunk-KDVQGQXM.js} +1 -1
- package/dist/{chunk-IEDCYMPH.js → chunk-LYHR47YE.js} +2 -2
- package/dist/{chunk-MJGBRYDH.js → chunk-MBOQJTOS.js} +11 -6
- package/dist/{chunk-TL5HRSMD.js → chunk-MEZVLRJK.js} +19 -77
- package/dist/{chunk-DSUD4K5N.js → chunk-MG2Y5XYV.js} +267 -211
- package/dist/{chunk-DG7525WL.js → chunk-NWWED36F.js} +1 -1
- package/dist/{chunk-DUQIP32K.js → chunk-P7OXJ3ZD.js} +5 -5
- package/dist/{chunk-XLU5ZOTK.js → chunk-PB4QDL6Q.js} +4 -4
- package/dist/{chunk-YUR7GV5L.js → chunk-PHC24VUU.js} +5 -5
- package/dist/{chunk-YSHMGQRD.js → chunk-PZZS6DHY.js} +8 -8
- package/dist/{chunk-PWHKJ24U.js → chunk-QJI56HI2.js} +7 -7
- package/dist/{chunk-7H5JQFWQ.js → chunk-RUSF2YGL.js} +6 -6
- package/dist/{chunk-CWJ26A6W.js → chunk-S4CX66JO.js} +1 -1
- package/dist/{chunk-H7EBNQGW.js → chunk-SK4BESZM.js} +1 -1
- package/dist/{chunk-NE5PE3Q7.js → chunk-TTBG7YZW.js} +7 -7
- package/dist/{chunk-FKC5D6CA.js → chunk-TZNIDZGI.js} +1 -1
- package/dist/{chunk-Q6MCI3BQ.js → chunk-UAZBE4O3.js} +10 -10
- package/dist/{chunk-DLYCHCKQ.js → chunk-UE42G3QY.js} +1 -1
- package/dist/{chunk-GOJ2SPKB.js → chunk-UFGV3JZ5.js} +1 -1
- package/dist/{chunk-2EJED3QQ.js → chunk-UN7RXMOB.js} +4 -4
- package/dist/{chunk-BBJC4R6E.js → chunk-UUVURKWB.js} +4 -4
- package/dist/{chunk-UQWBHNTZ.js → chunk-V6UDJVVD.js} +3 -3
- package/dist/{chunk-SCI6U7CV.js → chunk-V77IQKWK.js} +19 -19
- package/dist/{chunk-BCBZHDMW.js → chunk-VG6FUXGK.js} +1 -1
- package/dist/{chunk-BB73O6OW.js → chunk-WEPLWKV6.js} +3 -3
- package/dist/{chunk-6367NG5G.js → chunk-WZ6K327V.js} +7 -7
- package/dist/{chunk-IOUBTUS2.js → chunk-X6BGCNE3.js} +8 -8
- package/dist/{chunk-RO5YUUN2.js → chunk-XT6LWXJ2.js} +1 -1
- package/dist/{chunk-4FUTEM37.js → chunk-YICV7DAE.js} +3 -3
- package/dist/{chunk-45JV3EMA.js → chunk-ZASDJ7F5.js} +6 -8
- package/dist/{chunk-YNNTU5IZ.js → chunk-ZIN6G7DS.js} +1 -1
- package/dist/{chunk-O2324X34.js → chunk-ZQTMWBLA.js} +1 -1
- package/dist/{chunk-77JLN6GC.js → chunk-ZYIVNB6B.js} +7 -8
- package/dist/{claude-launcher-TWKHBR6F.js → claude-launcher-HWC5S5HD.js} +7 -7
- package/dist/{cli-SSHQSIPV.js → cli-TWF7CU3E.js} +168 -168
- package/dist/{command-W6BEIPAJ.js → command-KGYVPB7B.js} +52 -52
- package/dist/{config-HYSU7MD3.js → config-J4VSNOH4.js} +12 -12
- package/dist/{connect-cmd-O4ATJTQV.js → connect-cmd-LPC6J27D.js} +13 -13
- package/dist/{container-start-4KRTW3QU.js → container-start-O6BAIQGT.js} +49 -49
- package/dist/{context-cleanup-SK445SLA.js → context-cleanup-VWJSWUJB.js} +4 -4
- package/dist/{context-show-cmd-D3GXL65K.js → context-show-cmd-B427F3M4.js} +14 -14
- package/dist/{control-plane-launch-KVROM6BY.js → control-plane-launch-WV253P7I.js} +14 -14
- package/dist/{demo-record-cmd-UMHWHDZ4.js → demo-record-cmd-YRND2HVT.js} +8 -8
- package/dist/{demo-voice-cmd-GBI52Y73.js → demo-voice-cmd-TUIXJ7CY.js} +20 -20
- package/dist/{dist-775TDFCK.js → dist-UV2JOW3N.js} +2 -2
- package/dist/{docker-B76MDGCW.js → docker-6NO5B657.js} +10 -10
- package/dist/{doctor-QV3BJKRZ.js → doctor-V3Z5CR5Q.js} +60 -65
- package/dist/{emit-artifact-cmd-X4AKVBS2.js → emit-artifact-cmd-MWDEBRB2.js} +19 -19
- package/dist/{emit-cmd-A6ZGOPLZ.js → emit-cmd-2ADJWBJP.js} +7 -7
- package/dist/{emit-criteria-cmd-UKZBMIK6.js → emit-criteria-cmd-35O7KR37.js} +16 -16
- package/dist/{emit-demo-cmd-QC56Y6P2.js → emit-demo-cmd-HJCW3JEA.js} +20 -20
- package/dist/{emit-finding-cmd-DL2Y7BEV.js → emit-finding-cmd-Q4SN3OA7.js} +16 -16
- package/dist/{emit-result-cmd-VPWAJBN6.js → emit-result-cmd-7VEMDT2P.js} +18 -18
- package/dist/{emit-step-cmd-REP4IS3F.js → emit-step-cmd-DYQM5OQA.js} +16 -16
- package/dist/{exec-client-KBOKVUU5.js → exec-client-6WGSNY56.js} +8 -8
- package/dist/{chunk-6TF4QU7M.js → find-unit-6BX4K4WV.js} +19 -2
- package/dist/{findings-cmd-BXAXOQB6.js → findings-cmd-WHQBJZNA.js} +16 -16
- package/dist/{fleet-readiness-EDJDDAEB.js → fleet-readiness-A67D5OP4.js} +14 -14
- package/dist/{governing-source-AG7KDIIG.js → governing-source-C4BMFNFZ.js} +21 -21
- package/dist/{guest-init-DUOJUQFY.js → guest-init-ZWEJGXQS.js} +9 -9
- package/dist/{hook-fast-ZVZWP7OQ.js → hook-fast-SZ5L3ZJK.js} +1 -1
- package/dist/{hook-install-VF3X2ZXN.js → hook-install-63GJ3OUI.js} +4 -4
- package/dist/host-checks-SYD7WFUN.js +82 -0
- package/dist/host-key-AYXCAME4.js +18 -0
- package/dist/{image-tag-BTK5342G.js → image-tag-6HQDPX45.js} +8 -8
- package/dist/index.js +4 -4
- package/dist/{init-OZ4JNNOI.js → init-KOG5S5KX.js} +47 -47
- package/dist/init-ULMPF7MK.js +82 -0
- package/dist/{init-agent-GNX5OIZX.js → init-agent-XIDQULDZ.js} +47 -47
- package/dist/init-cmd-P7FYHTLS.js +53 -0
- package/dist/{init-update-ZJSTM46T.js → init-update-7SBDG65Z.js} +24 -24
- package/dist/install-cmd-TWYZTNRV.js +26 -0
- package/dist/launch-agent-5MCXT6QN.js +26 -0
- package/dist/{layout-BG6MFUS3.js → layout-2MIQCJ3U.js} +4 -4
- package/dist/{login-browser-OA4R4PEQ.js → login-browser-ZYWUIEOQ.js} +2 -2
- package/dist/{logs-L5GX5BWF.js → logs-SP6RPVCP.js} +7 -7
- package/dist/loop-OU2U7SUJ.js +92 -0
- package/dist/machine-NE34TJIO.js +82 -0
- package/dist/{machine-skills-B7KO47CH.js → machine-skills-UYWZXOZI.js} +4 -4
- package/dist/{mcp-install-cmd-JXD6Q7NN.js → mcp-install-cmd-U2SEWH66.js} +4 -4
- package/dist/{mcp-serve-cmd-3B3KWYHN.js → mcp-serve-cmd-VAQL3CJB.js} +9 -9
- package/dist/{paths-26SZBIOA.js → paths-G7LFPGQQ.js} +7 -7
- package/dist/pending-OEAYMKZO.js +18 -0
- package/dist/{pidfile-22HCQHLJ.js → pidfile-FIVR2HKB.js} +8 -8
- package/dist/{record-HFUJLNOV.js → record-K3I7V46A.js} +8 -8
- package/dist/{relay-V5GHEWT3.js → relay-AQBBQJ5I.js} +5 -5
- package/dist/{relay-protocol-2S2EAHYH.js → relay-protocol-XZ7WESQL.js} +5 -5
- package/dist/{run-cmd-G4LA2YZR.js → run-cmd-BRUSQKEA.js} +16 -16
- package/dist/{runner-agents-CLDURIBZ.js → runner-agents-KF6EECFW.js} +4 -4
- package/dist/runner-env-XAO7EBCK.js +24 -0
- package/dist/{runner-identity-V4IUTSCJ.js → runner-identity-JM3ZQ2PJ.js} +10 -10
- package/dist/{runner-key-FQDBMYII.js → runner-key-P6FUFO6Y.js} +47 -47
- package/dist/{session-sender-AAQXJLNE.js → session-sender-N3U3ZTL3.js} +19 -19
- package/dist/{setup-cmd-4CKPSEJD.js → setup-cmd-F7Y4SFTK.js} +14 -14
- package/dist/{setup-wiring-INA66DBJ.js → setup-wiring-LU6AY2QA.js} +54 -54
- package/dist/{spec-cmd-V2FPAZJ7.js → spec-cmd-ZNXNMAYA.js} +17 -17
- package/dist/{starter-pack-WOD4WMUX.js → starter-pack-NEQLRMTX.js} +5 -5
- package/dist/state-VXN7EX2K.js +18 -0
- package/dist/{status-MC2SJQ57.js → status-N326EK5I.js} +47 -47
- package/dist/{sync-cmd-2TLRGEXR.js → sync-cmd-KG7YQGM6.js} +18 -18
- package/dist/update-steps-YQQXESUZ.js +83 -0
- package/dist/{watch-GQAIYCFW.js → watch-3VJ363V2.js} +18 -18
- package/dist/{work-claim-cmd-SI3UTDLB.js → work-claim-cmd-MXWB5NG6.js} +23 -23
- package/dist/{work-cmd-LA5ZBMBQ.js → work-cmd-X55AAJG2.js} +16 -16
- package/dist/{work-comment-cmd-NP6USSKX.js → work-comment-cmd-7AL5KEVJ.js} +18 -18
- package/dist/{work-demo-cmd-KZDTXCYM.js → work-demo-cmd-6UFGGEMI.js} +16 -16
- package/dist/{work-logs-cmd-3BX5MK2E.js → work-logs-cmd-DCAV3J7A.js} +16 -16
- package/dist/{work-mock-cmd-IT3IKALB.js → work-mock-cmd-O7KFTS65.js} +16 -16
- package/dist/{work-needs-attention-cmd-BDIFC7I4.js → work-needs-attention-cmd-OD5PTHLX.js} +16 -16
- package/dist/{work-no-change-cmd-A65QOBQ2.js → work-no-change-cmd-ABYXIOZT.js} +16 -16
- package/dist/{work-open-pr-cmd-CGSCDYHI.js → work-open-pr-cmd-WRFHZXVM.js} +17 -17
- package/dist/{work-pr-cmd-DZKJLYLF.js → work-pr-cmd-VEH4HP7P.js} +16 -16
- package/dist/{work-proofs-cmd-OJXWHUMP.js → work-proofs-cmd-TKA3J2II.js} +18 -18
- package/dist/{work-proofs-record-J6WOOW3R.js → work-proofs-record-WTBSJLET.js} +24 -24
- package/dist/{work-stop-cmd-RJESQDZN.js → work-stop-cmd-WF7R6ILK.js} +16 -16
- package/package.json +1 -1
- package/skill-pack/maintained/outerlayer-review/SKILL.md +5 -2
- package/skill-pack/maintained/outerlayer-review/references/consolidation.md +80 -0
- package/dist/agent-setup-5UMGRTAY.js +0 -41
- package/dist/caller-VTVQPOGC.js +0 -23
- package/dist/find-unit-5PUEPP5J.js +0 -24
- package/dist/host-checks-AS2C5HR2.js +0 -82
- package/dist/host-key-MNYYPKBU.js +0 -18
- package/dist/init-H2GOMKCC.js +0 -82
- package/dist/init-cmd-CM7UKGRG.js +0 -53
- package/dist/install-cmd-U4PP4YQE.js +0 -26
- package/dist/launch-agent-BIAPDAVB.js +0 -26
- package/dist/loop-3F3PNYOH.js +0 -92
- package/dist/machine-CCB2PQIM.js +0 -82
- package/dist/pending-Y62PXWTU.js +0 -18
- package/dist/runner-env-RQ3SKLKL.js +0 -24
- package/dist/state-PSFO26DS.js +0 -18
- package/dist/update-steps-JZE3OGKB.js +0 -83
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { RUNNER_PROTOCOL } from './chunk-
|
|
4
|
-
import { MAX_TEST_FILE_BYTES, itemsSentence, criteriaOf, hostItemsOf, loadCitationFinder, testFileMatcher, planCriteria, wholeItems, judgeGroups, failedItems, inCriteriaOrder, testsByCriterion, oneLineReason, criterionInputs, parseJudgeAnswer, judgedItems } from './chunk-
|
|
3
|
+
import { RUNNER_PROTOCOL } from './chunk-EBWA6KIE.js';
|
|
4
|
+
import { MAX_TEST_FILE_BYTES, itemsSentence, criteriaOf, hostItemsOf, loadCitationFinder, testFileMatcher, planCriteria, wholeItems, judgeGroups, failedItems, inCriteriaOrder, testsByCriterion, oneLineReason, criterionInputs, parseJudgeAnswer, judgedItems } from './chunk-MBOQJTOS.js';
|
|
5
5
|
import { zodProblem } from './chunk-I3LTIAOR.js';
|
|
6
6
|
import { sha256OfFile, downloadPinned, VoiceDownloadError } from './chunk-2PGI6RDE.js';
|
|
7
|
-
import { hasStoredCredential, storedCredentialVariables, storeAgentCredential, isAgentName, credentialFromStdin } from './chunk-
|
|
8
|
-
import { upgradedStarterText } from './chunk-
|
|
9
|
-
import { HELPER_PATH, HELPER_RECORD, DOCKERD_LOG } from './chunk-
|
|
10
|
-
import { writeDockerClientConfig } from './chunk-
|
|
11
|
-
import { senderPidfile } from './chunk-
|
|
12
|
-
import { installScrubContext } from './chunk-
|
|
7
|
+
import { hasStoredCredential, storedCredentialVariables, storeAgentCredential, isAgentName, credentialFromStdin } from './chunk-FLHDVJAV.js';
|
|
8
|
+
import { upgradedStarterText } from './chunk-PHC24VUU.js';
|
|
9
|
+
import { HELPER_PATH, HELPER_RECORD, DOCKERD_LOG } from './chunk-3PXV4I75.js';
|
|
10
|
+
import { writeDockerClientConfig } from './chunk-AGKUDDIN.js';
|
|
11
|
+
import { senderPidfile } from './chunk-UN7RXMOB.js';
|
|
12
|
+
import { installScrubContext } from './chunk-H4JQKCVP.js';
|
|
13
13
|
import { readsJobState, READ_JOB_STATE_FORMATS, jobStateFormatOf } from './chunk-B4XB5QFD.js';
|
|
14
|
-
import { runnerImageVersion } from './chunk-
|
|
15
|
-
import { claimCalls, spoolHomeFor, itemCalls, claimItem, leftByRunnerKey, configForJob } from './chunk-
|
|
14
|
+
import { runnerImageVersion } from './chunk-UE42G3QY.js';
|
|
15
|
+
import { claimCalls, spoolHomeFor, itemCalls, claimItem, leftByRunnerKey, configForJob } from './chunk-HI6R4XYD.js';
|
|
16
16
|
import { receiveFiles } from './chunk-NN33FYXG.js';
|
|
17
|
-
import { readDefaultBranchFiles, readDefaultBranchHead, buildRepositoryImage, readRepositoryRecipe, fetchCommit, readBranchHead, diffBetween, prepareImageBuild, KEY_PREFIX, TAG_HOST, SHARED_OWNER, SHARED_NAME, universalBase, metadataFromLabels, writeRecord } from './chunk-
|
|
18
|
-
import { FETCHED_DIR, toolsDockerfile, FETCHED_FFMPEG, FETCHED_GH, FETCHED_TINI, FETCHED_HEADLESS_SHELL, FETCHED_PLAYWRIGHT_FFMPEG, FETCHED_VOICE_DIR } from './chunk-
|
|
17
|
+
import { readDefaultBranchFiles, readDefaultBranchHead, buildRepositoryImage, readRepositoryRecipe, fetchCommit, readBranchHead, diffBetween, prepareImageBuild, KEY_PREFIX, TAG_HOST, SHARED_OWNER, SHARED_NAME, universalBase, metadataFromLabels, writeRecord } from './chunk-WZ6K327V.js';
|
|
18
|
+
import { FETCHED_DIR, toolsDockerfile, FETCHED_FFMPEG, FETCHED_GH, FETCHED_TINI, FETCHED_HEADLESS_SHELL, FETCHED_PLAYWRIGHT_FFMPEG, FETCHED_VOICE_DIR } from './chunk-UUVURKWB.js';
|
|
19
19
|
import { isSameProcess, startTimeOf } from './chunk-JBJTC3UU.js';
|
|
20
20
|
import { currentCliBuild } from './chunk-OGFGZQA3.js';
|
|
21
|
-
import { vmExecArgs, runExec, execCapture, waitForAgent } from './chunk-
|
|
22
|
-
import { socketPathProblem, vsockLinks, linkVsockSockets, GUEST_CID, LEASE_LINK } from './chunk-
|
|
23
|
-
import { describeCallFailure, shortClaim, retrySend, commandWithShim, logStamp, createRunnerLog, formatDuration, removeKeptContext, formatClock, stageGovernedContext, keptContextTree, removeStagedContext, WORKFLOW_PERMISSION_REASON, refusalCode, SELF_GOVERNED, resolveGoverningSource, prefetchGovernedContext, controlPlaneTokenFailure, keepStagedContext, pinnedSourceOf, shimScript } from './chunk-
|
|
24
|
-
import { postJson, getJson, WorkCommandError, isSignatureRefusal } from './chunk-
|
|
25
|
-
import { keyRunnerFactory, runnerCredentialProblem, builtinKind, readOnlyOption, optionalEgress, readsOnly, isBuiltinContainer, isBuiltinVm, isBuiltinSandbox, egressSummary, DEFAULT_WORKSPACE_KEEP_DAYS, readOnlyRemoteOf, DEFAULT_CHECK_TIME_LIMIT_MINUTES, DEFAULT_SETUP_MINUTES, allowHostProblem, systemClock, emptyEgressCounts, hostAllowed, sandboxTimeLimitMinutes, networkOf, imageBuildOf, machineSizeOf, sandboxSizeOf, DEFAULT_SAVED_STATE_MAX_BYTES } from './chunk-
|
|
26
|
-
import { formatBytes, volumeBytes, allocatedBytes, DEFAULT_BUILD_DISK, DEFAULT_CACHE_DISK, freeBytes } from './chunk-
|
|
27
|
-
import { said, NETWORK_HELPER_MEMORY, firstLine, writeJobFile, readJobFile, spawnRun, RUNNER_LABEL, BUILD_LABEL, createDockerHost, builderSpec, childEnvironment, containerExecArgs, readDu, JUDGE_DIR, JUDGE_ITEMS, answerFileName, hashJudgeProgram, NETWORK_READY_FILE, MAX_ITEMS_BYTES, MAX_REPORT_BYTES, JUDGE_REPORT, withAnswerProtocol, JUDGE_TREE, runnerLabelValue, parseSize, readJobFileChecked, networkHelperName, prepareRunArgs, containerRunArgs, judgeCommand, WORKSPACE_LABEL, homeCopyRunArgs, networkHelperRunArgs, JUDGE_MAX_TURNS, identityScript, identityArgs, parseIdentity, mountableHome, homeCopyScript, homeCopyArgs, COMMAND_DIR,
|
|
28
|
-
import { universalImagePending,
|
|
29
|
-
import { sanitizeTerminal, planArtifactUpload } from './chunk-
|
|
30
|
-
import { sharedSkillNames, skillConflictMessage } from './chunk-
|
|
21
|
+
import { vmExecArgs, runExec, execCapture, waitForAgent } from './chunk-D3CALDGC.js';
|
|
22
|
+
import { socketPathProblem, vsockLinks, linkVsockSockets, GUEST_CID, LEASE_LINK } from './chunk-YICV7DAE.js';
|
|
23
|
+
import { describeCallFailure, shortClaim, retrySend, commandWithShim, logStamp, createRunnerLog, formatDuration, removeKeptContext, formatClock, stageGovernedContext, keptContextTree, removeStagedContext, WORKFLOW_PERMISSION_REASON, refusalCode, SELF_GOVERNED, resolveGoverningSource, prefetchGovernedContext, controlPlaneTokenFailure, keepStagedContext, pinnedSourceOf, shimScript } from './chunk-CW6H5JXV.js';
|
|
24
|
+
import { postJson, getJson, WorkCommandError, isSignatureRefusal } from './chunk-X6BGCNE3.js';
|
|
25
|
+
import { keyRunnerFactory, runnerCredentialProblem, builtinKind, readOnlyOption, optionalEgress, readsOnly, isBuiltinContainer, isBuiltinVm, isBuiltinSandbox, egressSummary, DEFAULT_WORKSPACE_KEEP_DAYS, readOnlyRemoteOf, DEFAULT_CHECK_TIME_LIMIT_MINUTES, DEFAULT_SETUP_MINUTES, allowHostProblem, systemClock, emptyEgressCounts, hostAllowed, sandboxTimeLimitMinutes, networkOf, imageBuildOf, machineSizeOf, sandboxSizeOf, DEFAULT_SAVED_STATE_MAX_BYTES } from './chunk-ZASDJ7F5.js';
|
|
26
|
+
import { formatBytes, volumeBytes, allocatedBytes, DEFAULT_BUILD_DISK, DEFAULT_CACHE_DISK, freeBytes } from './chunk-33DTLCL6.js';
|
|
27
|
+
import { said, NETWORK_HELPER_MEMORY, firstLine, writeJobFile, readJobFile, spawnRun, RUNNER_LABEL, BUILD_LABEL, createDockerHost, builderSpec, childEnvironment, containerExecArgs, readDu, JUDGE_DIR, JUDGE_ITEMS, answerFileName, hashJudgeProgram, NETWORK_READY_FILE, MAX_ITEMS_BYTES, MAX_REPORT_BYTES, JUDGE_REPORT, withAnswerProtocol, JUDGE_TREE, runnerLabelValue, parseSize, readJobFileChecked, networkHelperName, prepareRunArgs, containerRunArgs, judgeCommand, WORKSPACE_LABEL, homeCopyRunArgs, networkHelperRunArgs, JUDGE_MAX_TURNS, identityScript, identityArgs, parseIdentity, mountableHome, homeCopyScript, homeCopyArgs, COMMAND_DIR, identityRunArgs, judgeProgramRecord, SAVED_STATE_LABEL } from './chunk-PZZS6DHY.js';
|
|
28
|
+
import { universalImagePending, writeSanitizedRecipe, classifyProperties, RecipeError, DOCKER_FEATURE } from './chunk-K6THWLSJ.js';
|
|
29
|
+
import { sanitizeTerminal, planArtifactUpload } from './chunk-FG2E3HES.js';
|
|
30
|
+
import { sharedSkillNames, skillConflictMessage } from './chunk-XT6LWXJ2.js';
|
|
31
31
|
import { readCloudConfig } from './chunk-HWVMRETT.js';
|
|
32
|
-
import { signerFor } from './chunk-
|
|
33
|
-
import { sessionsDir, vmAssetsDir, RUNNER_DIR_MODE, RUNNER_FILE_MODE, runnerDir, workspacesDir, jobsDir, storeScopes, spoolDir, orgStoreIn, rootfsDir, imagesDir, builderCacheDiskPath, buildsDir, buildDir, ghConfigDir, runnerDirOfBuild, mirrorDir, orgHomeDir, jobConsolePath, vsockPath, builderConsolePath, rootfsPathFor, diskTemplatesDir, deliveryDir, SHIM_DIR } from './chunk-
|
|
34
|
-
import { BUILD_HOME, dataPlaneOf, sandboxCallOf, SandboxError, repositoriesOf, JOB_MOUNT, heldBuildAuthority, IMAGE_BUNDLES, writeTrustFiles, buildEnvironment, trustEnvironment, CHECKOUT_DIR, parseIsolation, containerLocalAddress, destinationEnvironment, withHooksPath, startBuildServices, checkoutPath, headerVariables, authorEnvironment, sharedUserEnvironment, withTunnelRecord, commitIdentityRecord, RELAY_PORT, repositoryPath, lifecycleWorkdir, CHECK_ITEMS_FILE, parseProxied, readBundleScript, applyTrust,
|
|
35
|
-
import { agentCredential, managedAgentCredential, RUNNER_WORDED_REASONS, UNKNOWN_TRACKING_REASON, UNKNOWN_TRANSPORT_REASON, RELAY_USER, builtInNames, currentAgentCredential, removedAgentCredentialValues, realFdStorePort, MAX_MALFORMED_SESSIONS, MALFORMED_REASON, JOIN_WAIT_MS, MAX_OPEN_STREAMS, STREAM_RESET_RATE, STREAM_RESET_BURST, STREAM_WINDOW, SESSION_WINDOW, targetOfPath, AGENT_CREDENTIAL_MISSING, fdName, RELAY_ID, DOCKER_DESKTOP_REASON } from './chunk-
|
|
32
|
+
import { signerFor } from './chunk-6ZBUQIJA.js';
|
|
33
|
+
import { sessionsDir, vmAssetsDir, RUNNER_DIR_MODE, RUNNER_FILE_MODE, runnerDir, workspacesDir, jobsDir, storeScopes, spoolDir, orgStoreIn, rootfsDir, imagesDir, builderCacheDiskPath, buildsDir, buildDir, ghConfigDir, runnerDirOfBuild, mirrorDir, orgHomeDir, jobConsolePath, vsockPath, builderConsolePath, rootfsPathFor, diskTemplatesDir, deliveryDir, SHIM_DIR } from './chunk-H2THCHUP.js';
|
|
34
|
+
import { BUILD_HOME, dataPlaneOf, sandboxCallOf, SandboxError, repositoriesOf, JOB_MOUNT, heldBuildAuthority, IMAGE_BUNDLES, writeTrustFiles, buildEnvironment, trustEnvironment, CHECKOUT_DIR, parseIsolation, containerLocalAddress, destinationEnvironment, withHooksPath, startBuildServices, checkoutPath, headerVariables, authorEnvironment, sharedUserEnvironment, withTunnelRecord, commitIdentityRecord, RELAY_PORT, repositoryPath, lifecycleWorkdir, CHECK_ITEMS_FILE, parseProxied, readBundleScript, applyTrust, proxyEnvironment, describeSandboxError, dropBuildAuthority, sandboxSettingsFrom, createSandboxClient, hostKeyOf, buildAuthorityFor, checkEnvironment, withMiseVariables, primaryOf, variablesFor, carried6to4, classifyAddress, EVAL_INPUT_DIR, isMiseVariableAllowed, retryAfterMsOf, variableForPath, droppedRequestHeaders, hasDotDotSegment, routeNameOf, providerMayAnswerLater, toolProxyEnvironment } from './chunk-ZYIVNB6B.js';
|
|
35
|
+
import { agentCredential, managedAgentCredential, RUNNER_WORDED_REASONS, UNKNOWN_TRACKING_REASON, UNKNOWN_TRANSPORT_REASON, RELAY_USER, builtInNames, currentAgentCredential, removedAgentCredentialValues, realFdStorePort, MAX_MALFORMED_SESSIONS, MALFORMED_REASON, JOIN_WAIT_MS, MAX_OPEN_STREAMS, STREAM_RESET_RATE, STREAM_RESET_BURST, STREAM_WINDOW, SESSION_WINDOW, targetOfPath, AGENT_CREDENTIAL_MISSING, fdName, RELAY_ID, DOCKER_DESKTOP_REASON } from './chunk-GQI5N56J.js';
|
|
36
36
|
import { versionAtLeast } from './chunk-F3J4UKBF.js';
|
|
37
|
-
import { jobAgent, firecrackerArch, MICROVM_ARCHES, FIRECRACKER_VERSION, hostHelperPinned, builderDiskPinned, guestAssetsPinned, runnerAgentNamed, credentialForms, orList, credentialShapes, agentCommands, defaultCommandLine, credentialAgent, GUEST_HELPER_SHA256, GUEST_ASSETS_BASE_URL, GUEST_KERNEL_SHA256, JAILER_BINARY_SHA256, FIRECRACKER_BINARY_SHA256, FIRECRACKER_SHA256, GUEST_ASSETS_VERSION, BUILDER_DISK_VERSION, credentialHandOffKey, strippedVariables, runnerAgents, judgeAgent, networkHelperPinned, NETWORK_HELPER_SHA256, universalImagePinned, UNIVERSAL_IMAGE, FFMPEG_STATIC, FFMPEG_BUILD_TAG, GH_SHA256, GH_VERSION, TINI_SHA256, TINI_VERSION, HEADLESS_SHELL, HEADLESS_SHELL_BASE_URL, PLAYWRIGHT_FFMPEG, PLAYWRIGHT_FFMPEG_BASE_URL, VOICE_PACK_FILES, BUILDER_DISK_SHA256, BUILDER_DISK_BASE_URL, DEFAULT_BASE_IMAGE, agentVersionOf } from './chunk-
|
|
38
|
-
import { sessionFolderIn, legacyAgent, defaultAgents, parsePolicy, AGENTS_SKILLS_BASE, OUTERLAYER_SKILLS_BASE, orderSessions, extractFacts, sessionsToTimeline, resolvePackRoot } from './chunk-
|
|
37
|
+
import { jobAgent, firecrackerArch, MICROVM_ARCHES, FIRECRACKER_VERSION, hostHelperPinned, builderDiskPinned, guestAssetsPinned, runnerAgentNamed, credentialForms, orList, credentialShapes, agentCommands, defaultCommandLine, credentialAgent, GUEST_HELPER_SHA256, GUEST_ASSETS_BASE_URL, GUEST_KERNEL_SHA256, JAILER_BINARY_SHA256, FIRECRACKER_BINARY_SHA256, FIRECRACKER_SHA256, GUEST_ASSETS_VERSION, BUILDER_DISK_VERSION, credentialHandOffKey, strippedVariables, runnerAgents, judgeAgent, networkHelperPinned, NETWORK_HELPER_SHA256, universalImagePinned, UNIVERSAL_IMAGE, FFMPEG_STATIC, FFMPEG_BUILD_TAG, GH_SHA256, GH_VERSION, TINI_SHA256, TINI_VERSION, HEADLESS_SHELL, HEADLESS_SHELL_BASE_URL, PLAYWRIGHT_FFMPEG, PLAYWRIGHT_FFMPEG_BASE_URL, VOICE_PACK_FILES, BUILDER_DISK_SHA256, BUILDER_DISK_BASE_URL, DEFAULT_BASE_IMAGE, agentVersionOf } from './chunk-7QIQ7QR3.js';
|
|
38
|
+
import { sessionFolderIn, legacyAgent, defaultAgents, parsePolicy, AGENTS_SKILLS_BASE, OUTERLAYER_SKILLS_BASE, orderSessions, extractFacts, sessionsToTimeline, resolvePackRoot } from './chunk-5EWESACE.js';
|
|
39
39
|
import { MAINTAINED_SKILLS } from './chunk-VSBG7MMU.js';
|
|
40
40
|
import { resolveVersion } from './chunk-RA3O54FC.js';
|
|
41
41
|
import { homeFromEnv } from './chunk-352DHUTP.js';
|
|
42
|
-
import { scrubText, MIN_SCRUBBED_LITERAL, setCustomScrubbers, setLocalIdentity, setRepoRoot, forkFor, scrubDeep } from './chunk-
|
|
43
|
-
import { CheckItemsSchema, CODE_REVIEW_NAME, CRITERIA_JUDGE_NAME, JUDGE_NOT_RUN_ITEM_ID, CHECK_ITEM_REASON_MAX_LENGTH, CHECK_ITEM_HREF_MAX_LENGTH, downconvertSession } from './chunk-
|
|
42
|
+
import { scrubText, MIN_SCRUBBED_LITERAL, setCustomScrubbers, setLocalIdentity, setRepoRoot, forkFor, scrubDeep } from './chunk-ZIN6G7DS.js';
|
|
43
|
+
import { CheckItemsSchema, CODE_REVIEW_NAME, CRITERIA_JUDGE_NAME, JUDGE_NOT_RUN_ITEM_ID, CHECK_ITEM_REASON_MAX_LENGTH, CHECK_ITEM_HREF_MAX_LENGTH, downconvertSession } from './chunk-CH3PO7UY.js';
|
|
44
44
|
import { randomUUID, randomBytes, createHash } from 'crypto';
|
|
45
45
|
import { rmSync, mkdirSync, existsSync, readFileSync, mkdtempSync, statSync, appendFileSync, writeFileSync, readdirSync, accessSync, constants, openSync, closeSync, lstatSync, chmodSync, renameSync, rmdirSync, createReadStream, unlinkSync, realpathSync, writeSync, truncateSync, cpSync, copyFileSync, fstatSync, readSync, createWriteStream, linkSync } from 'fs';
|
|
46
46
|
import { join, dirname, isAbsolute, delimiter, basename, sep, relative, resolve } from 'path';
|
|
@@ -398,7 +398,7 @@ function managedClaudeKeyValuesFor(jobDir) {
|
|
|
398
398
|
}
|
|
399
399
|
function hasClaudeCredential(config, hostEnv, jobDir, agents, job) {
|
|
400
400
|
if (jobAgent(job, agents)?.adapter.credentials === void 0) return true;
|
|
401
|
-
return config.
|
|
401
|
+
return config.fleet === true ? managedClaudeKeyFor(jobDir) !== void 0 : agentCredential(hostEnv, {}, agents) !== void 0;
|
|
402
402
|
}
|
|
403
403
|
|
|
404
404
|
// src/runner/managed-build-settings.ts
|
|
@@ -461,14 +461,6 @@ function dropManagedBuildSettings(jobDir) {
|
|
|
461
461
|
held2.delete(jobDir);
|
|
462
462
|
dropBuildAuthority(jobDir);
|
|
463
463
|
}
|
|
464
|
-
function ensureBuildAuthority(jobDir) {
|
|
465
|
-
if (jobDir !== void 0 && (held2.get(jobDir)?.proxied?.length ?? 0) > 0) buildAuthorityFor(jobDir);
|
|
466
|
-
}
|
|
467
|
-
function proxiedEnvironment(jobDir) {
|
|
468
|
-
const env = {};
|
|
469
|
-
for (const variable of held2.get(jobDir)?.proxied ?? []) env[variable.name] = STAND_IN;
|
|
470
|
-
return env;
|
|
471
|
-
}
|
|
472
464
|
function managedBuildSettingValuesFor(jobDir) {
|
|
473
465
|
const settings = held2.get(jobDir);
|
|
474
466
|
return [...new Set([...settings?.variables ?? [], ...settings?.proxied ?? []].map(({ value }) => value))];
|
|
@@ -476,7 +468,7 @@ function managedBuildSettingValuesFor(jobDir) {
|
|
|
476
468
|
function factoryVariablesOf(config, jobDir) {
|
|
477
469
|
const variables = held2.get(jobDir)?.variables;
|
|
478
470
|
if (variables !== void 0) return variables;
|
|
479
|
-
return config.
|
|
471
|
+
return config.fleet === true ? [] : void 0;
|
|
480
472
|
}
|
|
481
473
|
function managedMachineLimits(settings) {
|
|
482
474
|
const { vcpus, memoryGiB, diskGB } = settings.machine;
|
|
@@ -1462,7 +1454,8 @@ function createGatewaySandboxClient(opts) {
|
|
|
1462
1454
|
secret: typeof raw.secret === "string" ? raw.secret : "",
|
|
1463
1455
|
urlToken: typeof raw.urlToken === "string" ? raw.urlToken : "",
|
|
1464
1456
|
metadata: typeof raw.metadata === "object" && raw.metadata !== null ? raw.metadata : {},
|
|
1465
|
-
...raw.machine === "small" || raw.machine === "large" ? { machine: raw.machine } : {}
|
|
1457
|
+
...raw.machine === "small" || raw.machine === "large" ? { machine: raw.machine } : {},
|
|
1458
|
+
...typeof raw.fromState === "string" || raw.fromState === null ? { fromState: raw.fromState } : {}
|
|
1466
1459
|
};
|
|
1467
1460
|
}
|
|
1468
1461
|
async function gateway(factory, send) {
|
|
@@ -1507,7 +1500,9 @@ function createGatewaySandboxClient(opts) {
|
|
|
1507
1500
|
idleMinutes: input.idleMinutes,
|
|
1508
1501
|
timeLimitMinutes: input.timeLimitMinutes,
|
|
1509
1502
|
metadata: input.metadata,
|
|
1510
|
-
...input.resume === void 0 ? {} : { resume: input.resume }
|
|
1503
|
+
...input.resume === void 0 ? {} : { resume: input.resume },
|
|
1504
|
+
// The gateway starts the sandbox from this saved state, and its answer's `fromState` says whether it did.
|
|
1505
|
+
...input.fromState === void 0 ? {} : { fromState: input.fromState }
|
|
1511
1506
|
}),
|
|
1512
1507
|
input.factory
|
|
1513
1508
|
);
|
|
@@ -1767,7 +1762,7 @@ function createLeaseChannel(valueMs) {
|
|
|
1767
1762
|
|
|
1768
1763
|
// src/runner/run-job.ts
|
|
1769
1764
|
function runIsolation(config) {
|
|
1770
|
-
if (config.fleet === true ||
|
|
1765
|
+
if (config.fleet === true || !config.queues.includes("implement")) return void 0;
|
|
1771
1766
|
if (config.sandbox?.provider === "outerlayer") return void 0;
|
|
1772
1767
|
if (isBuiltinContainer(config.hooks.provision)) return "container";
|
|
1773
1768
|
if (isBuiltinVm(config.hooks.provision) || isBuiltinSandbox(config.hooks.provision)) return "vm";
|
|
@@ -3027,10 +3022,14 @@ function checkoutNotAtDefaultHead(checkouts) {
|
|
|
3027
3022
|
function selectExpired(records, nowMs) {
|
|
3028
3023
|
return records.filter((record) => nowMs - savedAtOf(record) >= SAVED_STATE_MAX_AGE_MS);
|
|
3029
3024
|
}
|
|
3025
|
+
function holdsHostDisk(record) {
|
|
3026
|
+
return record.kind !== "sandbox";
|
|
3027
|
+
}
|
|
3030
3028
|
function selectToFit(records, maxBytes) {
|
|
3031
|
-
|
|
3029
|
+
const onHost = records.filter(holdsHostDisk);
|
|
3030
|
+
let total = onHost.reduce((sum, record) => sum + record.bytes, 0);
|
|
3032
3031
|
const selected = [];
|
|
3033
|
-
for (const record of oldestFirst(
|
|
3032
|
+
for (const record of oldestFirst(onHost)) {
|
|
3034
3033
|
if (total <= maxBytes) break;
|
|
3035
3034
|
selected.push(record);
|
|
3036
3035
|
total -= record.bytes;
|
|
@@ -3785,7 +3784,8 @@ function writeRecord2(dir, record) {
|
|
|
3785
3784
|
function isRecord(value) {
|
|
3786
3785
|
if (typeof value !== "object" || value === null) return false;
|
|
3787
3786
|
const r = value;
|
|
3788
|
-
return typeof r.id === "string" && (r.kind === "volume" || r.kind === "tar" || r.kind === "disk"
|
|
3787
|
+
return typeof r.id === "string" && (r.kind === "volume" || r.kind === "tar" || r.kind === "disk" || r.kind === "sandbox") && // A sandbox state is of no use without the volume its build's container mounts.
|
|
3788
|
+
(r.kind !== "sandbox" || typeof r.volume === "string") && typeof r.savedAt === "string" && Number.isFinite(Date.parse(r.savedAt)) && typeof r.bytes === "number" && typeof r.baseKey === "string" && typeof r.key === "string" && typeof r.fileHashes === "object" && r.fileHashes !== null && typeof r.complete === "boolean";
|
|
3789
3789
|
}
|
|
3790
3790
|
function readRecords(dir) {
|
|
3791
3791
|
let names;
|
|
@@ -4188,6 +4188,82 @@ async function discardUnusableItemDisk(input) {
|
|
|
4188
4188
|
await discardItemDisk(input.kept, input.removeVolume, input.onError, input.endSandbox);
|
|
4189
4189
|
return { retryFresh: true, reason: `the kept disk of claim ${shortClaim(input.kept.record.claimId)} could not be used: ${input.reason}`, itemDisk: input.why };
|
|
4190
4190
|
}
|
|
4191
|
+
function savedStateBase(report) {
|
|
4192
|
+
const digest = report.recipe === "default" ? report.base?.digest : void 0;
|
|
4193
|
+
return digest === void 0 ? void 0 : { digest };
|
|
4194
|
+
}
|
|
4195
|
+
function managedSandboxBase(input) {
|
|
4196
|
+
const { remoteUser, containerEnv, lifecycle } = input.apply;
|
|
4197
|
+
const applied = JSON.stringify({ remoteUser: remoteUser ?? null, containerEnv: Object.entries(containerEnv).sort(([a], [b]) => a < b ? -1 : 1), lifecycle });
|
|
4198
|
+
const digest = createHash("sha256").update(applied).digest("hex");
|
|
4199
|
+
return { digest: `managed-sandbox ${input.image} ${input.machine} docker=${input.docker} ${digest}` };
|
|
4200
|
+
}
|
|
4201
|
+
var OWN_ACCOUNT_REASON = "its sandbox is on the runner's own provider account";
|
|
4202
|
+
function savedStateMaxOf(config) {
|
|
4203
|
+
return config.housekeeping?.savedStateMax ?? DEFAULT_SAVED_STATE_MAX_BYTES;
|
|
4204
|
+
}
|
|
4205
|
+
async function planSavedState(input) {
|
|
4206
|
+
const { config, runtime, log } = input;
|
|
4207
|
+
const refused2 = savingRefusedBecause({ universalImage: input.base !== void 0, fleet: config.fleet === true, savedStateMax: savedStateMaxOf(config) });
|
|
4208
|
+
if (refused2 !== void 0 || input.base === void 0) {
|
|
4209
|
+
const why = (input.base === void 0 ? input.noBase : void 0) ?? refused2 ?? "its image comes from a devcontainer file";
|
|
4210
|
+
log(`this build saves no state: ${why}`);
|
|
4211
|
+
return { keyCommits: {}, noSave: why };
|
|
4212
|
+
}
|
|
4213
|
+
const root = runnerDir(config.configPath);
|
|
4214
|
+
const repositories = [];
|
|
4215
|
+
const keyCommits = {};
|
|
4216
|
+
for (const entry of input.repositories) {
|
|
4217
|
+
let token;
|
|
4218
|
+
try {
|
|
4219
|
+
token = entry.primary ? await input.tokens.token("read") : await input.tokens.token("read", entry.repository);
|
|
4220
|
+
} catch (err) {
|
|
4221
|
+
return unread(`the read token for ${entry.repository} could not be had: ${describeCallFailure(err)}`, log);
|
|
4222
|
+
}
|
|
4223
|
+
const [owner = "", name = ""] = entry.repository.split("/");
|
|
4224
|
+
const read = await runtime.readKeyFiles({
|
|
4225
|
+
remote: runtime.remoteFor?.(entry.repository) ?? `${runtime.github.gitUrl}/${entry.repository}.git`,
|
|
4226
|
+
dir: join(root, "key-files", owner, name),
|
|
4227
|
+
paths: keyFilePaths(),
|
|
4228
|
+
token
|
|
4229
|
+
});
|
|
4230
|
+
if (!read.ok) return unread(read.reason, log);
|
|
4231
|
+
keyCommits[entry.repository] = read.commit;
|
|
4232
|
+
repositories.push({ repository: entry.repository, commit: read.commit, files: read.files });
|
|
4233
|
+
}
|
|
4234
|
+
const key = stateKey({
|
|
4235
|
+
factory: keyRunnerFactory(config),
|
|
4236
|
+
repositories,
|
|
4237
|
+
imageDigest: input.base.digest,
|
|
4238
|
+
diskBytes: input.diskBytes
|
|
4239
|
+
});
|
|
4240
|
+
const found = lookup(readRecords(savedStatesDir(root)), key, input.now.getTime());
|
|
4241
|
+
if (found.kind !== "none" && found.record.kind === "tar") {
|
|
4242
|
+
try {
|
|
4243
|
+
await removeSavedState(found.record, { dir: savedStatesDir(root), removeVolume: async () => void 0 });
|
|
4244
|
+
log(`saved state ${found.record.id} is a tar file, which this runner no longer restores; removed it; starting from a fresh disk`);
|
|
4245
|
+
} catch (err) {
|
|
4246
|
+
log(`saved state ${found.record.id} is a tar file, which this runner no longer restores, and it could not be removed: ${describeCallFailure(err)}; starting from a fresh disk`);
|
|
4247
|
+
}
|
|
4248
|
+
return { key, keyCommits };
|
|
4249
|
+
}
|
|
4250
|
+
if (found.kind === "usable" && input.allowRestore) {
|
|
4251
|
+
log(`starting from saved state ${found.record.id}, saved ${formatDuration(found.ageMs)} ago`);
|
|
4252
|
+
return { key, keyCommits, restore: { record: found.record, ageMs: found.ageMs } };
|
|
4253
|
+
}
|
|
4254
|
+
if (found.kind === "expired") {
|
|
4255
|
+
log(`saved state ${found.record.id} is ${formatDuration(found.ageMs)} old, past the limit of ${SAVED_STATE_MAX_AGE_MS / 864e5} days; starting from a fresh disk`);
|
|
4256
|
+
} else if (found.kind === "changed") {
|
|
4257
|
+
log(`the setup script or version files changed on the default branch since saved state ${found.record.id}: ${found.files.join(", ")}; starting from a fresh disk`);
|
|
4258
|
+
} else if (found.kind === "none") {
|
|
4259
|
+
log("no saved state matches this build's key; starting from a fresh disk");
|
|
4260
|
+
}
|
|
4261
|
+
return { key, keyCommits };
|
|
4262
|
+
}
|
|
4263
|
+
function unread(reason, log) {
|
|
4264
|
+
log(`this build starts from no saved state and saves none: ${reason}`);
|
|
4265
|
+
return { keyCommits: {}, noSave: `its key files could not be read: ${reason}` };
|
|
4266
|
+
}
|
|
4191
4267
|
|
|
4192
4268
|
// src/runner/sandbox/sweep.ts
|
|
4193
4269
|
var RUNNER_METADATA = "outerlayerRunner";
|
|
@@ -4747,7 +4823,7 @@ async function cleanupSandbox(runtime, state, keepDisk) {
|
|
|
4747
4823
|
if (failures.length > 0) throw new Error(failures.join("; "));
|
|
4748
4824
|
return kept;
|
|
4749
4825
|
}
|
|
4750
|
-
var PROXIED_IN_SANDBOX_REASON = "the factory has a proxied variable, and a sandbox build cannot use one yet. Remove the proxied variable from the factory's build settings
|
|
4826
|
+
var PROXIED_IN_SANDBOX_REASON = "the factory has a proxied variable, and a sandbox build cannot use one yet. Remove the proxied variable from the factory's build settings";
|
|
4751
4827
|
function sandboxSizeFor(config, jobDir) {
|
|
4752
4828
|
const settings = managedBuildSettingsFor(jobDir);
|
|
4753
4829
|
if (settings === void 0 && config.sandbox?.provider === "outerlayer") return { ok: true, size: machineSizeOf("small") };
|
|
@@ -4832,14 +4908,44 @@ async function readSandboxRecipe(input) {
|
|
|
4832
4908
|
return err.code === "repository_unreadable" && readToken !== void 0 ? { ok: false, reason: err.message, transient: true } : { ok: false, reason: err.message };
|
|
4833
4909
|
}
|
|
4834
4910
|
}
|
|
4911
|
+
async function checkStateSandbox(input) {
|
|
4912
|
+
const { sandboxClient, sandbox } = input;
|
|
4913
|
+
const found = await commandIn(sandboxClient, sandbox, volumeExistsLine(input.volume));
|
|
4914
|
+
if (found.exitCode !== 0) return `the sandbox holds no volume ${input.volume} (exit ${found.exitCode ?? "none"})${said(found.stderr)}`;
|
|
4915
|
+
const step = clockStep(await commandIn(sandboxClient, sandbox, READ_CLOCK_LINE), input.nowMs);
|
|
4916
|
+
if ("failed" in step) return step.failed;
|
|
4917
|
+
if (step.set === void 0) return void 0;
|
|
4918
|
+
const set = await commandIn(sandboxClient, sandbox, step.set);
|
|
4919
|
+
if (set.exitCode !== 0) return `the sandbox's clock could not be set (exit ${set.exitCode ?? "none"})${said(set.stderr)}`;
|
|
4920
|
+
input.log(`set the clock of sandbox ${sandbox.id}, which a saved state starts at the moment of its save`);
|
|
4921
|
+
return void 0;
|
|
4922
|
+
}
|
|
4923
|
+
function volumeExistsLine(volume) {
|
|
4924
|
+
return `sudo docker volume inspect ${quote(volume)} >/dev/null`;
|
|
4925
|
+
}
|
|
4926
|
+
function stateRefusalReason(err) {
|
|
4927
|
+
if (!(err instanceof SandboxError) || err.code !== "sandbox_state_unusable") return void 0;
|
|
4928
|
+
return err.reason ?? describeSandboxError(err);
|
|
4929
|
+
}
|
|
4930
|
+
function madeFromState(sandbox, stateId) {
|
|
4931
|
+
return stateId !== void 0 && sandbox.fromState === stateId;
|
|
4932
|
+
}
|
|
4933
|
+
var MAX_CLOCK_SKEW_MS = 5e3;
|
|
4934
|
+
var READ_CLOCK_LINE = "date -u +%s";
|
|
4935
|
+
function clockStep(probe, nowMs) {
|
|
4936
|
+
const text2 = probe.stdout.trim();
|
|
4937
|
+
if (probe.exitCode !== 0 || !/^\d+$/.test(text2)) return { failed: `the sandbox's clock could not be read (exit ${probe.exitCode ?? "none"})${said(probe.stderr)}` };
|
|
4938
|
+
if (Math.abs(Number(text2) * 1e3 - nowMs) <= MAX_CLOCK_SKEW_MS) return {};
|
|
4939
|
+
return { set: `sudo date -u -s @${Math.round(nowMs / 1e3)}` };
|
|
4940
|
+
}
|
|
4835
4941
|
async function provisionSandbox(input) {
|
|
4836
4942
|
const tag = itemTag({ item: input.item.number, organizationId: input.organizationId, claimId: input.claimId });
|
|
4837
4943
|
return provisionWithFreshFallback({
|
|
4838
|
-
attempt: (
|
|
4944
|
+
attempt: (allowRestore, itemDiskFailed) => provisionSandboxOnce(input, allowRestore, itemDiskFailed),
|
|
4839
4945
|
log: (line2) => input.log.line(`${tag} ${line2}`)
|
|
4840
4946
|
});
|
|
4841
4947
|
}
|
|
4842
|
-
async function provisionSandboxOnce(input, itemDiskFailed) {
|
|
4948
|
+
async function provisionSandboxOnce(input, allowRestore, itemDiskFailed) {
|
|
4843
4949
|
const { config, runtime, item, itemKey, jobDir, log, tokens } = input;
|
|
4844
4950
|
const tag = itemTag({ item: item.number, organizationId: input.organizationId, claimId: input.claimId });
|
|
4845
4951
|
const logPath = join(jobDir, "provision.log");
|
|
@@ -4892,6 +4998,20 @@ async function provisionSandboxOnce(input, itemDiskFailed) {
|
|
|
4892
4998
|
let keptDisk = itemDisk.kept;
|
|
4893
4999
|
let diskState = itemDisk.state;
|
|
4894
5000
|
if (itemDisk.state?.restored === false) log.line(`${tag} this job starts without a kept disk: ${DISK_REASON_TEXT[itemDisk.state.reason]}`);
|
|
5001
|
+
const tagged = (line2) => log.line(`${tag} ${line2}`);
|
|
5002
|
+
let plan = keptDisk !== void 0 ? keptDiskPlan() : input.queue === "review" ? { keyCommits: {}, noSave: "a code review runs no setup" } : await planSavedState({
|
|
5003
|
+
config,
|
|
5004
|
+
repositories,
|
|
5005
|
+
base: managed ? managedSandboxBase({ image: own.image, machine: managedBuildSettingsFor(jobDir)?.machine.size ?? "small", docker: own.docker, apply }) : void 0,
|
|
5006
|
+
noBase: OWN_ACCOUNT_REASON,
|
|
5007
|
+
runtime,
|
|
5008
|
+
tokens,
|
|
5009
|
+
now: clockOf(input.now)(),
|
|
5010
|
+
diskBytes: 0,
|
|
5011
|
+
allowRestore,
|
|
5012
|
+
log: tagged
|
|
5013
|
+
});
|
|
5014
|
+
let fromState = plan.restore?.record;
|
|
4895
5015
|
const buildId = randomBytes(6).toString("hex");
|
|
4896
5016
|
const runnerId = runnerLabelValue(config.configPath);
|
|
4897
5017
|
const name = sandboxNameOf(runnerId, buildId);
|
|
@@ -4952,6 +5072,11 @@ async function provisionSandboxOnce(input, itemDiskFailed) {
|
|
|
4952
5072
|
await bail(reason);
|
|
4953
5073
|
return discardUnusableItemDisk({ kept: keptDisk, reason, why, removeVolume: async () => void 0, endSandbox: (id) => sandboxClient.end(id), onError: (line2) => log.error(`${tag} ${line2}`) });
|
|
4954
5074
|
};
|
|
5075
|
+
const giveUpState = async (record, reason) => {
|
|
5076
|
+
await bail(reason);
|
|
5077
|
+
return discardUnusableState({ record, reason, dir: savedStatesDir(runnerDir(config.configPath)), removeVolume: async () => void 0, onError: (line2) => log.error(`${tag} ${line2}`) });
|
|
5078
|
+
};
|
|
5079
|
+
const end = (reason, aborted2 = false) => fromState !== void 0 && !aborted2 ? giveUpState(fromState, reason) : bail(reason, aborted2);
|
|
4955
5080
|
const forgetManagedDisk = async (id, err) => {
|
|
4956
5081
|
const reason = `the kept sandbox ${id} could not be resumed: ${err.reason ?? describeSandboxError(err)}`;
|
|
4957
5082
|
await bail(reason);
|
|
@@ -5004,19 +5129,33 @@ async function provisionSandboxOnce(input, itemDiskFailed) {
|
|
|
5004
5129
|
let sandbox;
|
|
5005
5130
|
runtime.sandbox.creating.add(buildId);
|
|
5006
5131
|
try {
|
|
5132
|
+
const createOnce = async () => sandboxClient.create({
|
|
5133
|
+
name,
|
|
5134
|
+
from: own.snapshot,
|
|
5135
|
+
...sized.size,
|
|
5136
|
+
diskGib: await sandboxDiskGib(sandboxClient, own.snapshot, sized.size.diskGib, (line2) => log.line(`${tag} ${line2}`)),
|
|
5137
|
+
idleMinutes: own.idleMinutes,
|
|
5138
|
+
timeLimitMinutes: sandboxTimeLimitMinutes(config.timeLimitMinutes),
|
|
5139
|
+
network: networkOf(own.allowHosts),
|
|
5140
|
+
metadata: { [RUNNER_METADATA]: runnerId, [BUILD_METADATA]: buildId },
|
|
5141
|
+
...sandboxClaimOf(config, item.number, input.workItemId, managedBuildSettingsFor(jobDir)),
|
|
5142
|
+
...resume === void 0 ? {} : { resume },
|
|
5143
|
+
...fromState === void 0 ? {} : { fromState: fromState.id }
|
|
5144
|
+
});
|
|
5007
5145
|
sandbox = resumed ?? await createWhenAllowed({
|
|
5008
|
-
create: async () =>
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
|
|
5146
|
+
create: async () => {
|
|
5147
|
+
try {
|
|
5148
|
+
return await createOnce();
|
|
5149
|
+
} catch (err) {
|
|
5150
|
+
const refusal = stateRefusalReason(err);
|
|
5151
|
+
if (fromState === void 0 || refusal === void 0) throw err;
|
|
5152
|
+
await discardUnusableState({ record: fromState, reason: refusal, dir: savedStatesDir(runnerDir(config.configPath)), removeVolume: async () => void 0, onError: (line2) => log.error(`${tag} ${line2}`) });
|
|
5153
|
+
tagged(`the gateway cannot start a sandbox from saved state ${fromState.id}: ${refusal} \xB7 removed its record, and asking for a sandbox from the base snapshot`);
|
|
5154
|
+
fromState = void 0;
|
|
5155
|
+
plan = { ...plan, restore: void 0 };
|
|
5156
|
+
return createOnce();
|
|
5157
|
+
}
|
|
5158
|
+
},
|
|
5020
5159
|
sleep: runtime.sandbox.sleep,
|
|
5021
5160
|
aborted: input.aborted,
|
|
5022
5161
|
log: (line2) => log.line(`${tag} ${line2}`)
|
|
@@ -5042,7 +5181,9 @@ async function provisionSandboxOnce(input, itemDiskFailed) {
|
|
|
5042
5181
|
return { ok: false, reason: held3, held: true };
|
|
5043
5182
|
}
|
|
5044
5183
|
const transient = late?.kind !== "timed_out" && late?.kind !== "ended" && err instanceof SandboxError && providerMayAnswerLater(err);
|
|
5045
|
-
|
|
5184
|
+
const refused2 = `The provider refused to create the sandbox: ${slowStartReason(late) ?? (err instanceof SandboxError ? describeSandboxError(err) : describeCallFailure(err))}`;
|
|
5185
|
+
if (fromState !== void 0) return giveUpState(fromState, refused2);
|
|
5186
|
+
return bail(refused2, false, transient, err instanceof SandboxError ? err.retryAfterMs : void 0);
|
|
5046
5187
|
}
|
|
5047
5188
|
sandbox = late.sandbox;
|
|
5048
5189
|
}
|
|
@@ -5056,6 +5197,14 @@ async function provisionSandboxOnce(input, itemDiskFailed) {
|
|
|
5056
5197
|
volumeName = container;
|
|
5057
5198
|
containerState.volume = container;
|
|
5058
5199
|
}
|
|
5200
|
+
if (fromState !== void 0 && !madeFromState(sandbox, fromState.id)) {
|
|
5201
|
+
tagged(`the gateway's sandbox ${sandbox.id} was not made from saved state ${fromState.id} \xB7 this build starts with no saved state`);
|
|
5202
|
+
fromState = void 0;
|
|
5203
|
+
plan = { ...plan, restore: void 0 };
|
|
5204
|
+
} else if (fromState?.volume !== void 0) {
|
|
5205
|
+
volumeName = fromState.volume;
|
|
5206
|
+
containerState.volume = fromState.volume;
|
|
5207
|
+
}
|
|
5059
5208
|
if (resumed === void 0 && !hasStarted(sandbox.state)) {
|
|
5060
5209
|
const started2 = await awaitStartById({
|
|
5061
5210
|
client: sandboxClient,
|
|
@@ -5075,7 +5224,7 @@ async function provisionSandboxOnce(input, itemDiskFailed) {
|
|
|
5075
5224
|
log.error(`${tag} could not end sandbox ${sandbox.id}: ${describeCallFailure(err)} \xB7 the next sweep ends it`);
|
|
5076
5225
|
}
|
|
5077
5226
|
if (started2.kind === "aborted") return bail("", true);
|
|
5078
|
-
return
|
|
5227
|
+
return end(slowStartReason(started2) ?? `sandbox ${sandbox.id} did not start`);
|
|
5079
5228
|
}
|
|
5080
5229
|
}
|
|
5081
5230
|
runtime.sandbox.sandboxes.set(buildId, sandbox);
|
|
@@ -5084,11 +5233,17 @@ async function provisionSandboxOnce(input, itemDiskFailed) {
|
|
|
5084
5233
|
input.save(state, environment);
|
|
5085
5234
|
runtime.sandbox.creating.delete(buildId);
|
|
5086
5235
|
runtime.sandbox.resuming.delete(sandbox.id);
|
|
5087
|
-
log.line(
|
|
5236
|
+
log.line(
|
|
5237
|
+
resumed !== void 0 ? `${tag} restored the disk that claim ${shortClaim(keptDisk.record.claimId)} kept: sandbox ${sandbox.id} resumed` : fromState !== void 0 && plan.restore !== void 0 ? `${tag} starting from saved state ${fromState.id}, saved ${formatDuration(plan.restore.ageMs)} ago: sandbox ${sandbox.id} created from it \xB7 ${name}` : `${tag} sandbox ${sandbox.id} created \xB7 ${name}`
|
|
5238
|
+
);
|
|
5088
5239
|
if (input.aborted()) return bail("", true);
|
|
5240
|
+
if (fromState !== void 0) {
|
|
5241
|
+
const unusable = await checkStateSandbox({ sandboxClient, sandbox, volume: volumeName, nowMs: clockOf(input.now)().getTime(), log: tagged });
|
|
5242
|
+
if (unusable !== void 0) return giveUpState(fromState, unusable);
|
|
5243
|
+
}
|
|
5089
5244
|
const sandboxed = runtimeInSandbox(runtime, sandbox);
|
|
5090
5245
|
const { host } = sandboxed;
|
|
5091
|
-
const dockerFailed = (what, result) =>
|
|
5246
|
+
const dockerFailed = (what, result) => end(`${what} failed (exit ${result.status})${said(result.stderr)}`);
|
|
5092
5247
|
const joinSecret = randomBytes(32);
|
|
5093
5248
|
runtime.sandbox.joinSecrets.set(buildId, joinSecret);
|
|
5094
5249
|
const packDir = join(runtime.cliBuild().distDir, "..", "skill-pack");
|
|
@@ -5097,26 +5252,26 @@ async function provisionSandboxOnce(input, itemDiskFailed) {
|
|
|
5097
5252
|
const packageFile = existsSync(packagePath) ? packagePath : void 0;
|
|
5098
5253
|
try {
|
|
5099
5254
|
const made = await sandboxClient.command(sandbox, `sudo mkdir -p ${CLI_DIR} && sudo chown -R "$(id -u):$(id -g)" ${SANDBOX_DIR}`);
|
|
5100
|
-
if (made.exitCode !== 0) return
|
|
5255
|
+
if (made.exitCode !== 0) return end(`making ${SANDBOX_DIR} in the sandbox failed (exit ${made.exitCode ?? "none"})${said(made.stderr)}`);
|
|
5101
5256
|
await sandboxClient.upload(sandbox, `${SANDBOX_DIR}/dist.tgz`, gzipSync(packFolder(runtime.cliBuild().distDir)));
|
|
5102
5257
|
if (skillPack !== void 0) {
|
|
5103
5258
|
await sandboxClient.upload(sandbox, `${SANDBOX_DIR}/skill-pack.tgz`, gzipSync(packFolder(skillPack)));
|
|
5104
5259
|
const placed = await sandboxClient.command(sandbox, `mkdir -p ${SKILL_PACK_DIR} && tar xzf ${SANDBOX_DIR}/skill-pack.tgz -C ${SKILL_PACK_DIR} && rm -f ${SANDBOX_DIR}/skill-pack.tgz`);
|
|
5105
|
-
if (placed.exitCode !== 0) return
|
|
5260
|
+
if (placed.exitCode !== 0) return end(`putting the skill pack in the sandbox failed (exit ${placed.exitCode ?? "none"})${said(placed.stderr)}`);
|
|
5106
5261
|
}
|
|
5107
5262
|
if (packageFile !== void 0) await sandboxClient.upload(sandbox, PACKAGE_FILE, readFileSync(packageFile));
|
|
5108
5263
|
await sandboxClient.upload(sandbox, SECRET_FILE, joinSecret);
|
|
5109
5264
|
const unpacked = await sandboxClient.command(sandbox, `tar xzf ${SANDBOX_DIR}/dist.tgz -C ${CLI_DIR} && rm -f ${SANDBOX_DIR}/dist.tgz && sudo chown 60100:60100 ${SECRET_FILE} && sudo chmod 400 ${SECRET_FILE}`);
|
|
5110
|
-
if (unpacked.exitCode !== 0) return
|
|
5265
|
+
if (unpacked.exitCode !== 0) return end(`putting the CLI in the sandbox failed (exit ${unpacked.exitCode ?? "none"})${said(unpacked.stderr)}`);
|
|
5111
5266
|
} catch (err) {
|
|
5112
|
-
return
|
|
5267
|
+
return end(`putting the CLI in the sandbox failed: ${err instanceof SandboxError ? describeSandboxError(err) : describeCallFailure(err)}`);
|
|
5113
5268
|
}
|
|
5114
5269
|
if (own.docker) {
|
|
5115
5270
|
const set = await commandIn(sandboxClient, sandbox, daemonSetupLine());
|
|
5116
|
-
if (set.exitCode !== 0) return
|
|
5271
|
+
if (set.exitCode !== 0) return end(`setting the Docker daemon's proxy in the sandbox failed (exit ${set.exitCode ?? "none"})${said(set.stderr)}`);
|
|
5117
5272
|
}
|
|
5118
5273
|
const engine = await host.version();
|
|
5119
|
-
if (engine === null) return
|
|
5274
|
+
if (engine === null) return end("Docker is not available in the sandbox: `docker version` failed");
|
|
5120
5275
|
const limits2 = containerLimitsOf(containerSizeOf(sandbox, sized.size), config.build);
|
|
5121
5276
|
const volume = await host.createVolume(volumeName, { [BUILD_LABEL]: buildId, [RUNNER_LABEL]: runnerId });
|
|
5122
5277
|
if (volume.status !== 0) return dockerFailed("creating the build's volume", volume);
|
|
@@ -5138,21 +5293,26 @@ async function provisionSandboxOnce(input, itemDiskFailed) {
|
|
|
5138
5293
|
let dockerGroup;
|
|
5139
5294
|
if (own.docker) {
|
|
5140
5295
|
const mounted = await commandIn(sandboxClient, sandbox, hostMountLine(volumeName));
|
|
5141
|
-
if (mounted.exitCode !== 0) return
|
|
5296
|
+
if (mounted.exitCode !== 0) return end(`mounting the build's volume at ${HOST_BUILD_DIR} in the sandbox failed (exit ${mounted.exitCode ?? "none"})${said(mounted.stderr)}`);
|
|
5142
5297
|
const group = await commandIn(sandboxClient, sandbox, `stat -c %g ${DOCKER_SOCKET}`);
|
|
5143
5298
|
dockerGroup = group.stdout.trim();
|
|
5144
|
-
if (group.exitCode !== 0 || !/^\d+$/.test(dockerGroup)) return
|
|
5299
|
+
if (group.exitCode !== 0 || !/^\d+$/.test(dockerGroup)) return end(`reading the group of the Docker socket in the sandbox failed (exit ${group.exitCode ?? "none"})${said(group.stderr)}`);
|
|
5145
5300
|
}
|
|
5146
5301
|
const imageConfig = await host.imageConfig(image);
|
|
5147
5302
|
const resolved = await resolveBuildUser(sandboxed, runInput, { remoteUser: apply.remoteUser, imageUser: imageConfig.user }, logPath);
|
|
5148
|
-
if (!resolved.ok) return
|
|
5303
|
+
if (!resolved.ok) return end(resolved.reason);
|
|
5149
5304
|
containerState.agentUser = resolved.user;
|
|
5150
5305
|
if (resolved.home !== void 0) containerState.home = resolved.home;
|
|
5151
5306
|
const agentUser = resolved.user;
|
|
5307
|
+
if (fromState !== void 0) {
|
|
5308
|
+
const probe = await host.run(identityRunArgs({ ...runInput, user: ADDED_USER }, agentUser), { logPath });
|
|
5309
|
+
const changed = userIdChangedReason(fromState.agentUid, probe.status === 0 ? parseIdentity(probe.stdout)?.uid ?? void 0 : void 0);
|
|
5310
|
+
if (changed !== void 0) return giveUpState(fromState, changed);
|
|
5311
|
+
}
|
|
5152
5312
|
input.save(state, environment);
|
|
5153
5313
|
if (input.aborted()) return bail("", true);
|
|
5154
5314
|
const network = await startSandboxNetwork({ runtime, sandboxed, sandboxClient, sandbox, runnerDir: runnerDir(config.configPath), build: { buildId, runnerId, container, image, limits: limits2 }, logPath, docker: own.docker });
|
|
5155
|
-
if ("failed" in network) return
|
|
5315
|
+
if ("failed" in network) return end(network.failed);
|
|
5156
5316
|
if ("none" in network) log.line(`${tag} ${noHelperLine(network.none)}`);
|
|
5157
5317
|
else containerState.network = network.helper;
|
|
5158
5318
|
const runArgs = containerRunArgs({ ...runInput, home: containerState.home, network: containerState.network }, runtime.agents);
|
|
@@ -5160,9 +5320,9 @@ async function provisionSandboxOnce(input, itemDiskFailed) {
|
|
|
5160
5320
|
if (started.status !== 0) return dockerFailed("starting the build's container", started);
|
|
5161
5321
|
joinRelay(runtime, sandbox, { buildId, container }, services.streams, joinSecret, (line2) => log.line(`${tag} ${line2}`));
|
|
5162
5322
|
if (input.aborted()) return bail("", true);
|
|
5163
|
-
if (!await waitForRelay(sandboxed, container)) return
|
|
5323
|
+
if (!await waitForRelay(sandboxed, container)) return end("the relay in the build's container did not start");
|
|
5164
5324
|
const ghDelivered = await deliverJobFiles(sandboxed, containerState, ["gh"], secrets);
|
|
5165
|
-
if (!ghDelivered.ok) return
|
|
5325
|
+
if (!ghDelivered.ok) return end(ghDelivered.reason);
|
|
5166
5326
|
keepGhConfigCurrent(tokens, buildDir2, (err) => log.error(`${tag} the read token could not be written for gh: ${describeCallFailure(err)}`), {
|
|
5167
5327
|
runtime: sandboxed,
|
|
5168
5328
|
state: containerState,
|
|
@@ -5182,6 +5342,7 @@ async function provisionSandboxOnce(input, itemDiskFailed) {
|
|
|
5182
5342
|
return endedAtLimit(ran) ? { ...ran, timedOut: true } : ran;
|
|
5183
5343
|
};
|
|
5184
5344
|
const setupMinutes = config.build?.setupMinutes ?? DEFAULT_SETUP_MINUTES;
|
|
5345
|
+
let setupPassed = false;
|
|
5185
5346
|
const steps = await runBuildSteps({
|
|
5186
5347
|
repository,
|
|
5187
5348
|
branch: primary.branch,
|
|
@@ -5217,10 +5378,19 @@ async function provisionSandboxOnce(input, itemDiskFailed) {
|
|
|
5217
5378
|
...input.requireBuildSkill === true ? { requireBuildSkill: true } : {},
|
|
5218
5379
|
// The image in the sandbox is the universal image, so the build chooses and installs its runtimes.
|
|
5219
5380
|
...runtimeStepInput({ base: {} }, services),
|
|
5220
|
-
// A kept disk holds the checkouts already: each is switched to the branch
|
|
5221
|
-
|
|
5381
|
+
// A kept disk or a saved state holds the checkouts already: each is switched to the branch. A kept disk keeps its
|
|
5382
|
+
// untracked files. A saved state is not the work item's disk, so its untracked files go and its ignored ones stay.
|
|
5383
|
+
setup: setupInputFor({ setupMinutes, plan, saveState: void 0, fromItemDisk: keptDisk !== void 0 }),
|
|
5384
|
+
// From here on a failure is the build's own, not the saved state's.
|
|
5385
|
+
afterSave: async () => {
|
|
5386
|
+
setupPassed = true;
|
|
5387
|
+
return { ok: true };
|
|
5388
|
+
}
|
|
5222
5389
|
});
|
|
5223
|
-
if (!steps.ok)
|
|
5390
|
+
if (!steps.ok) {
|
|
5391
|
+
if (fromState !== void 0 && !setupPassed && steps.aborted !== true) return giveUpState(fromState, steps.reason);
|
|
5392
|
+
return settleFailedSteps(steps, { giveUp: (reason) => giveUpItemDisk(reason, "checkout_not_switched"), bail });
|
|
5393
|
+
}
|
|
5224
5394
|
containerState.startCommit = steps.startCommit;
|
|
5225
5395
|
keepRuntimeStep(containerState, steps);
|
|
5226
5396
|
keepMissingSetupScripts(containerState, steps);
|
|
@@ -5514,75 +5684,6 @@ function syncInSandbox(input) {
|
|
|
5514
5684
|
function recordProofsInSandbox(input) {
|
|
5515
5685
|
return runCliInSandbox(input, [...RECORD_PROOFS_ARGV], PROOFS_LOG);
|
|
5516
5686
|
}
|
|
5517
|
-
function savedStateBase(report) {
|
|
5518
|
-
const digest = report.recipe === "default" ? report.base?.digest : void 0;
|
|
5519
|
-
return digest === void 0 ? void 0 : { digest };
|
|
5520
|
-
}
|
|
5521
|
-
function savedStateMaxOf(config) {
|
|
5522
|
-
return config.housekeeping?.savedStateMax ?? DEFAULT_SAVED_STATE_MAX_BYTES;
|
|
5523
|
-
}
|
|
5524
|
-
async function planSavedState(input) {
|
|
5525
|
-
const { config, runtime, log } = input;
|
|
5526
|
-
const refused2 = savingRefusedBecause({ universalImage: input.base !== void 0, fleet: config.fleet === true, savedStateMax: savedStateMaxOf(config) });
|
|
5527
|
-
if (refused2 !== void 0 || input.base === void 0) {
|
|
5528
|
-
const why = refused2 ?? "its image comes from a devcontainer file";
|
|
5529
|
-
log(`this build saves no state: ${why}`);
|
|
5530
|
-
return { keyCommits: {}, noSave: why };
|
|
5531
|
-
}
|
|
5532
|
-
const root = runnerDir(config.configPath);
|
|
5533
|
-
const repositories = [];
|
|
5534
|
-
const keyCommits = {};
|
|
5535
|
-
for (const entry of input.repositories) {
|
|
5536
|
-
let token;
|
|
5537
|
-
try {
|
|
5538
|
-
token = entry.primary ? await input.tokens.token("read") : await input.tokens.token("read", entry.repository);
|
|
5539
|
-
} catch (err) {
|
|
5540
|
-
return unread(`the read token for ${entry.repository} could not be had: ${describeCallFailure(err)}`, log);
|
|
5541
|
-
}
|
|
5542
|
-
const [owner = "", name = ""] = entry.repository.split("/");
|
|
5543
|
-
const read = await runtime.readKeyFiles({
|
|
5544
|
-
remote: runtime.remoteFor?.(entry.repository) ?? `${runtime.github.gitUrl}/${entry.repository}.git`,
|
|
5545
|
-
dir: join(root, "key-files", owner, name),
|
|
5546
|
-
paths: keyFilePaths(),
|
|
5547
|
-
token
|
|
5548
|
-
});
|
|
5549
|
-
if (!read.ok) return unread(read.reason, log);
|
|
5550
|
-
keyCommits[entry.repository] = read.commit;
|
|
5551
|
-
repositories.push({ repository: entry.repository, commit: read.commit, files: read.files });
|
|
5552
|
-
}
|
|
5553
|
-
const key = stateKey({
|
|
5554
|
-
factory: keyRunnerFactory(config),
|
|
5555
|
-
repositories,
|
|
5556
|
-
imageDigest: input.base.digest,
|
|
5557
|
-
diskBytes: input.diskBytes
|
|
5558
|
-
});
|
|
5559
|
-
const found = lookup(readRecords(savedStatesDir(root)), key, input.now.getTime());
|
|
5560
|
-
if (found.kind !== "none" && found.record.kind === "tar") {
|
|
5561
|
-
try {
|
|
5562
|
-
await removeSavedState(found.record, { dir: savedStatesDir(root), removeVolume: async () => void 0 });
|
|
5563
|
-
log(`saved state ${found.record.id} is a tar file, which this runner no longer restores; removed it; starting from a fresh disk`);
|
|
5564
|
-
} catch (err) {
|
|
5565
|
-
log(`saved state ${found.record.id} is a tar file, which this runner no longer restores, and it could not be removed: ${describeCallFailure(err)}; starting from a fresh disk`);
|
|
5566
|
-
}
|
|
5567
|
-
return { key, keyCommits };
|
|
5568
|
-
}
|
|
5569
|
-
if (found.kind === "usable" && input.allowRestore) {
|
|
5570
|
-
log(`starting from saved state ${found.record.id}, saved ${formatDuration(found.ageMs)} ago`);
|
|
5571
|
-
return { key, keyCommits, restore: { record: found.record, ageMs: found.ageMs } };
|
|
5572
|
-
}
|
|
5573
|
-
if (found.kind === "expired") {
|
|
5574
|
-
log(`saved state ${found.record.id} is ${formatDuration(found.ageMs)} old, past the limit of ${SAVED_STATE_MAX_AGE_MS / 864e5} days; starting from a fresh disk`);
|
|
5575
|
-
} else if (found.kind === "changed") {
|
|
5576
|
-
log(`the setup script or version files changed on the default branch since saved state ${found.record.id}: ${found.files.join(", ")}; starting from a fresh disk`);
|
|
5577
|
-
} else if (found.kind === "none") {
|
|
5578
|
-
log("no saved state matches this build's key; starting from a fresh disk");
|
|
5579
|
-
}
|
|
5580
|
-
return { key, keyCommits };
|
|
5581
|
-
}
|
|
5582
|
-
function unread(reason, log) {
|
|
5583
|
-
log(`this build starts from no saved state and saves none: ${reason}`);
|
|
5584
|
-
return { keyCommits: {}, noSave: `its key files could not be read: ${reason}` };
|
|
5585
|
-
}
|
|
5586
5687
|
var FREEZE_DEADLINE_SECONDS = 12 * 60;
|
|
5587
5688
|
function freezeScript() {
|
|
5588
5689
|
return [
|
|
@@ -5877,7 +5978,6 @@ function makeBuildsDirPrivate(buildDir2) {
|
|
|
5877
5978
|
const stat = statSync(builds);
|
|
5878
5979
|
if (stat.uid === process.getuid?.() && (stat.mode & 18) !== 0) chmodSync(builds, 448);
|
|
5879
5980
|
}
|
|
5880
|
-
var MANAGED_UNJAILED_REASON = "the root helper does not answer, and a managed runner starts no build without the jailer. The build did not start; restore the helper with `outerlayer runner install --service --replace`";
|
|
5881
5981
|
var MAX_TREE_FILES = 2e4;
|
|
5882
5982
|
var MAX_TREE_FILE_BYTES = 1024 * 1024;
|
|
5883
5983
|
function copyJudgeTree(from, to, limits2 = { files: MAX_TREE_FILES, bytes: MAX_TREE_FILE_BYTES }) {
|
|
@@ -5902,7 +6002,6 @@ function copyJudgeTree(from, to, limits2 = { files: MAX_TREE_FILES, bytes: MAX_T
|
|
|
5902
6002
|
}
|
|
5903
6003
|
|
|
5904
6004
|
// src/runner/microvm/hooks.ts
|
|
5905
|
-
var MANAGED_NO_BUILDER_DISK_REASON = "this release of the CLI pins no builder root disk, and a managed runner builds its images in a builder microVM, never on the host. The build did not start; update the CLI";
|
|
5906
6005
|
var DEFAULT_MEMORY = "8g";
|
|
5907
6006
|
var DEFAULT_DISK = "40g";
|
|
5908
6007
|
var DEFAULT_CPUS = 4;
|
|
@@ -5920,9 +6019,7 @@ var GUEST_PATH2 = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
|
|
5920
6019
|
function buildMemoryBytes(config) {
|
|
5921
6020
|
return parseSize(config.build?.memory ?? DEFAULT_MEMORY) ?? parseSize(DEFAULT_MEMORY);
|
|
5922
6021
|
}
|
|
5923
|
-
function machineLimits(config
|
|
5924
|
-
const settings = managedBuildSettingsFor(jobDir);
|
|
5925
|
-
if (settings !== void 0) return managedMachineLimits(settings);
|
|
6022
|
+
function machineLimits(config) {
|
|
5926
6023
|
return {
|
|
5927
6024
|
cpus: config.build?.cpus ?? DEFAULT_CPUS,
|
|
5928
6025
|
memoryBytes: buildMemoryBytes(config),
|
|
@@ -5932,18 +6029,14 @@ function machineLimits(config, jobDir) {
|
|
|
5932
6029
|
function recordedLimits(limits2) {
|
|
5933
6030
|
return { memoryBytes: limits2.memoryBytes, diskBytes: limits2.diskBytes };
|
|
5934
6031
|
}
|
|
5935
|
-
function
|
|
5936
|
-
return managedBuildSettingsFor(jobDir) === void 0 ? config.build?.memory : `${limits2.memoryBytes / 1024 ** 3}g`;
|
|
5937
|
-
}
|
|
5938
|
-
function builderMachineFor(config, jobDir, assets, limits2) {
|
|
6032
|
+
function builderMachineFor(config, assets, limits2) {
|
|
5939
6033
|
return {
|
|
5940
6034
|
kernel: assets.kernel,
|
|
5941
6035
|
firecracker: assets.firecracker,
|
|
5942
6036
|
limits: { ...limits2, cacheDiskBytes: parseSize(config.build?.cacheDisk ?? DEFAULT_CACHE_DISK) ?? parseSize(DEFAULT_CACHE_DISK) },
|
|
5943
|
-
memory:
|
|
5944
|
-
allowHosts:
|
|
6037
|
+
memory: config.build?.memory,
|
|
6038
|
+
allowHosts: config.build?.allowHosts,
|
|
5945
6039
|
...optionalEgress(config),
|
|
5946
|
-
managed: config.managed === true,
|
|
5947
6040
|
timeLimitMinutes: config.timeLimitMinutes
|
|
5948
6041
|
};
|
|
5949
6042
|
}
|
|
@@ -6063,13 +6156,12 @@ function vmAlive(runtime, state) {
|
|
|
6063
6156
|
if (state.jailed !== void 0) return runtime.vm.helper.alive(state.jailed.unit);
|
|
6064
6157
|
return state.firecracker !== void 0 && runtime.vm.firecracker.alive(state.firecracker);
|
|
6065
6158
|
}
|
|
6066
|
-
async function helperFor(runtime, log
|
|
6159
|
+
async function helperFor(runtime, log) {
|
|
6067
6160
|
const probe = await runtime.vm.helper.probe();
|
|
6068
6161
|
if (probe.ok) {
|
|
6069
6162
|
if (probe.firecracker !== FIRECRACKER_VERSION) log(`${helperFirecrackerNote(probe.firecracker)}; run \`outerlayer runner install --service --replace\` to update it`);
|
|
6070
6163
|
return probe.client;
|
|
6071
6164
|
}
|
|
6072
|
-
if (managed) return void 0;
|
|
6073
6165
|
if (probe.reason === "unsupported") log(probe.detail);
|
|
6074
6166
|
else if (probe.unreachable === true) log(`${probe.detail}, so this build runs without the jailer`);
|
|
6075
6167
|
return void 0;
|
|
@@ -6123,7 +6215,6 @@ async function provisionMicroVm(input) {
|
|
|
6123
6215
|
}
|
|
6124
6216
|
async function provisionMicroVmOnce(input, allowRestore, itemDiskFailed) {
|
|
6125
6217
|
const { config, runtime, item, itemKey, jobDir, log, tokens } = input;
|
|
6126
|
-
const managed = config.managed === true;
|
|
6127
6218
|
const { vm } = runtime;
|
|
6128
6219
|
const tag = itemTag({ item: item.number, organizationId: input.organizationId, claimId: input.claimId });
|
|
6129
6220
|
const logPath = join(jobDir, "provision.log");
|
|
@@ -6159,11 +6250,10 @@ async function provisionMicroVmOnce(input, allowRestore, itemDiskFailed) {
|
|
|
6159
6250
|
});
|
|
6160
6251
|
if (unfetched !== void 0) return { ok: false, reason: unfetched.reason, ...unfetched.transient ? { transient: true } : {} };
|
|
6161
6252
|
}
|
|
6162
|
-
const limits2 = machineLimits(config
|
|
6163
|
-
const memoryText =
|
|
6253
|
+
const limits2 = machineLimits(config);
|
|
6254
|
+
const memoryText = config.build?.memory;
|
|
6164
6255
|
let buildsInBuilder = imageBuildOf(config) === "vm";
|
|
6165
6256
|
if (buildsInBuilder && !vm.builderDiskPinned()) {
|
|
6166
|
-
if (config.managed === true) return fail(MANAGED_NO_BUILDER_DISK_REASON);
|
|
6167
6257
|
log.line(`${tag} this release of the CLI pins no builder root disk, so the image builds on the host, as it does with runner.build.imageBuild set to host`);
|
|
6168
6258
|
buildsInBuilder = false;
|
|
6169
6259
|
}
|
|
@@ -6181,7 +6271,7 @@ async function provisionMicroVmOnce(input, allowRestore, itemDiskFailed) {
|
|
|
6181
6271
|
deadlineMs: input.deadlineMs,
|
|
6182
6272
|
now: input.now,
|
|
6183
6273
|
guestHelper: { path: assets.helper, sha256: assets.helperSha256 },
|
|
6184
|
-
...buildsInBuilder ? { inBuilder: builderMachineFor(config,
|
|
6274
|
+
...buildsInBuilder ? { inBuilder: builderMachineFor(config, assets, limits2) } : {},
|
|
6185
6275
|
...input.queue === "review" ? { universal: true } : {}
|
|
6186
6276
|
});
|
|
6187
6277
|
if (!obtained.ok) return obtained.aborted === true ? { ok: false, reason: obtained.reason, aborted: true } : fail(obtained.reason);
|
|
@@ -6217,7 +6307,6 @@ async function provisionMicroVmOnce(input, allowRestore, itemDiskFailed) {
|
|
|
6217
6307
|
...governingSource.kind === "governed" ? { governing: { repository: governingSource.repository, ref: governingSource.ref, commit: governingSource.sha } } : {},
|
|
6218
6308
|
...report.docker === true ? { docker: true } : {}
|
|
6219
6309
|
};
|
|
6220
|
-
ensureBuildAuthority(jobDir);
|
|
6221
6310
|
const envInput = {
|
|
6222
6311
|
config,
|
|
6223
6312
|
item: item.number,
|
|
@@ -6230,8 +6319,6 @@ async function provisionMicroVmOnce(input, allowRestore, itemDiskFailed) {
|
|
|
6230
6319
|
...input.job === void 0 ? {} : { job: input.job },
|
|
6231
6320
|
containerEnv: report.apply.containerEnv,
|
|
6232
6321
|
builtIns: true,
|
|
6233
|
-
factoryVariables: factoryVariablesOf(config, jobDir),
|
|
6234
|
-
proxiedEnvironment: proxiedEnvironment(jobDir),
|
|
6235
6322
|
trustEnvironment: trustEnvironment(jobDir)
|
|
6236
6323
|
};
|
|
6237
6324
|
const env = buildEnvironment(envInput);
|
|
@@ -6314,8 +6401,7 @@ async function provisionMicroVmOnce(input, allowRestore, itemDiskFailed) {
|
|
|
6314
6401
|
}
|
|
6315
6402
|
}
|
|
6316
6403
|
const configPath = join(buildDir2, "vm.json");
|
|
6317
|
-
const helper = await helperFor(runtime, (line2) => log.line(`${tag} ${line2}`)
|
|
6318
|
-
if (helper === void 0 && config.managed === true) return bail(MANAGED_UNJAILED_REASON);
|
|
6404
|
+
const helper = await helperFor(runtime, (line2) => log.line(`${tag} ${line2}`));
|
|
6319
6405
|
try {
|
|
6320
6406
|
if (helper === void 0) linkVsockSockets({ buildDir: buildDir2, vsockPath: state.vsockPath, links: served });
|
|
6321
6407
|
const restore = plan.restore?.record;
|
|
@@ -6414,8 +6500,6 @@ async function provisionMicroVmOnce(input, allowRestore, itemDiskFailed) {
|
|
|
6414
6500
|
return bail(`the build's read token for ${entry.repository} could not be had: ${refusalCode(err)}`);
|
|
6415
6501
|
}
|
|
6416
6502
|
}
|
|
6417
|
-
let ghHeld = managed;
|
|
6418
|
-
let heldToken;
|
|
6419
6503
|
const pushGhConfig = (token, onFailure) => {
|
|
6420
6504
|
pushes = pushes.then(async () => {
|
|
6421
6505
|
if (!vmAlive(runtime, state)) return;
|
|
@@ -6424,10 +6508,6 @@ async function provisionMicroVmOnce(input, allowRestore, itemDiskFailed) {
|
|
|
6424
6508
|
return pushes;
|
|
6425
6509
|
};
|
|
6426
6510
|
tokens.onRead((token) => {
|
|
6427
|
-
if (ghHeld) {
|
|
6428
|
-
heldToken = token;
|
|
6429
|
-
return;
|
|
6430
|
-
}
|
|
6431
6511
|
void pushGhConfig(token, reportWrite);
|
|
6432
6512
|
});
|
|
6433
6513
|
await pushes;
|
|
@@ -6435,17 +6515,6 @@ async function provisionMicroVmOnce(input, allowRestore, itemDiskFailed) {
|
|
|
6435
6515
|
if (firstWriteFailure !== void 0) return bail(`the build's gh configuration could not be written: ${describeCallFailure(firstWriteFailure)}`);
|
|
6436
6516
|
tokens.markUsed("read");
|
|
6437
6517
|
environment.credentials = tokens.used();
|
|
6438
|
-
const releaseGhConfig = async () => {
|
|
6439
|
-
ghHeld = false;
|
|
6440
|
-
if (heldToken === void 0) return { ok: true };
|
|
6441
|
-
let failure3;
|
|
6442
|
-
await pushGhConfig(heldToken, (err) => {
|
|
6443
|
-
failure3 = err;
|
|
6444
|
-
reportWrite(err);
|
|
6445
|
-
});
|
|
6446
|
-
heldToken = void 0;
|
|
6447
|
-
return failure3 === void 0 ? { ok: true } : { ok: false, reason: `the build's gh configuration could not be written: ${describeCallFailure(failure3)}` };
|
|
6448
|
-
};
|
|
6449
6518
|
const uidOf = async (user) => {
|
|
6450
6519
|
const probe = await asRoot(runtime, state, ["id", "-u", user]);
|
|
6451
6520
|
return uidFromProbe(probe);
|
|
@@ -6505,12 +6574,11 @@ async function provisionMicroVmOnce(input, allowRestore, itemDiskFailed) {
|
|
|
6505
6574
|
removeVolume: async () => void 0,
|
|
6506
6575
|
log: tagged
|
|
6507
6576
|
});
|
|
6508
|
-
const stepEnv = managed ? buildEnvironment({ ...envInput, factoryVariables: [] }) : env;
|
|
6509
6577
|
const request = (argv, workdir, variables) => ({
|
|
6510
6578
|
argv,
|
|
6511
6579
|
user: agentUser,
|
|
6512
6580
|
cwd: workdir,
|
|
6513
|
-
env: execEnvironment(state.imageEnv, withMiseVariables(
|
|
6581
|
+
env: execEnvironment(state.imageEnv, withMiseVariables(env, variables))
|
|
6514
6582
|
});
|
|
6515
6583
|
const steps = await runBuildSteps({
|
|
6516
6584
|
repository,
|
|
@@ -6552,8 +6620,7 @@ async function provisionMicroVmOnce(input, allowRestore, itemDiskFailed) {
|
|
|
6552
6620
|
...input.requireBuildSkill === true ? { requireBuildSkill: true } : {},
|
|
6553
6621
|
// A build on the universal image, or on an image built from it, chooses and installs its runtimes.
|
|
6554
6622
|
...runtimeStepInput(report, services),
|
|
6555
|
-
setup: setupInputFor({ setupMinutes: config.build?.setupMinutes, plan, saveState,
|
|
6556
|
-
afterSave: releaseGhConfig
|
|
6623
|
+
setup: setupInputFor({ setupMinutes: config.build?.setupMinutes, plan, saveState, fromItemDisk: keptDisk !== void 0 })
|
|
6557
6624
|
});
|
|
6558
6625
|
if (!steps.ok) return settleFailedSteps(steps, { giveUp: (reason, fromItemDisk) => fromItemDisk ? giveUpItemDisk(reason, "checkout_not_switched") : giveUpState(reason), bail });
|
|
6559
6626
|
state.startCommit = steps.startCommit;
|
|
@@ -6603,8 +6670,6 @@ function vmExecFor(input, argv) {
|
|
|
6603
6670
|
miseVariables: state.miseVariables,
|
|
6604
6671
|
builtIns: state.builtIns === true,
|
|
6605
6672
|
identity: input.job.commitIdentity,
|
|
6606
|
-
factoryVariables: factoryVariablesOf(input.config, input.jobDir),
|
|
6607
|
-
proxiedEnvironment: proxiedEnvironment(input.jobDir),
|
|
6608
6673
|
trustEnvironment: trustEnvironment(input.jobDir)
|
|
6609
6674
|
});
|
|
6610
6675
|
const env = applyTrust(withExtraEnv(built, input.extraEnv), state.imageEnv);
|
|
@@ -6654,8 +6719,6 @@ async function startMicroVmCommand(input) {
|
|
|
6654
6719
|
miseVariables: state.miseVariables,
|
|
6655
6720
|
builtIns: state.builtIns === true,
|
|
6656
6721
|
identity: input.job.commitIdentity,
|
|
6657
|
-
factoryVariables: factoryVariablesOf(input.config, input.jobDir),
|
|
6658
|
-
proxiedEnvironment: proxiedEnvironment(input.jobDir),
|
|
6659
6722
|
trustEnvironment: trustEnvironment(input.jobDir)
|
|
6660
6723
|
}), input.extraEnv);
|
|
6661
6724
|
const commandDir = state.commandDir ?? MICROVM_COMMAND_DIR;
|
|
@@ -6712,8 +6775,6 @@ async function runCliInMicroVm(input, argv, logName, goneReason2) {
|
|
|
6712
6775
|
miseVariables: state.miseVariables,
|
|
6713
6776
|
builtIns: state.builtIns === true,
|
|
6714
6777
|
identity: job.commitIdentity,
|
|
6715
|
-
factoryVariables: factoryVariablesOf(input.config, input.jobDir),
|
|
6716
|
-
proxiedEnvironment: proxiedEnvironment(input.jobDir),
|
|
6717
6778
|
trustEnvironment: trustEnvironment(input.jobDir)
|
|
6718
6779
|
});
|
|
6719
6780
|
const result = await runtime.vm.exec(state.vsockPath, {
|
|
@@ -6836,7 +6897,7 @@ async function startCheckMicroVm(input) {
|
|
|
6836
6897
|
const { config, runtime, job, jobDir, tokens, log } = input;
|
|
6837
6898
|
const { vm } = runtime;
|
|
6838
6899
|
const tag = `${itemTag(job)}`;
|
|
6839
|
-
const limits2 = machineLimits(config
|
|
6900
|
+
const limits2 = machineLimits(config);
|
|
6840
6901
|
const built = job.microvm;
|
|
6841
6902
|
const repository = built?.repository ?? job.repository;
|
|
6842
6903
|
if (built === void 0 || built.imageId === void 0 || repository === void 0 || job.branch === void 0) {
|
|
@@ -6913,8 +6974,7 @@ async function startCheckMicroVm(input) {
|
|
|
6913
6974
|
if (abandoned()) return fail(ABANDONED);
|
|
6914
6975
|
const links = vsockLinks({ destinations: config.build?.destinations?.length ?? 0, builtIns: false });
|
|
6915
6976
|
const configPath = join(buildDir2, "vm.json");
|
|
6916
|
-
const helper = await helperFor(runtime, (line2) => log.line(`${tag} ${line2}`)
|
|
6917
|
-
if (helper === void 0 && config.managed === true) return fail(MANAGED_UNJAILED_REASON);
|
|
6977
|
+
const helper = await helperFor(runtime, (line2) => log.line(`${tag} ${line2}`));
|
|
6918
6978
|
try {
|
|
6919
6979
|
if (helper === void 0) linkVsockSockets({ buildDir: buildDir2, vsockPath: state.vsockPath, links });
|
|
6920
6980
|
await createBuildDisk({ host: vm.rootfs, runnerDir: runnerDirPath, bytes: limits2.diskBytes, dest: state.buildDisk, memoryBytes: limits2.memoryBytes });
|
|
@@ -6988,9 +7048,6 @@ async function startCheckMicroVm(input) {
|
|
|
6988
7048
|
repository,
|
|
6989
7049
|
hostEnv: runtime.hostEnv,
|
|
6990
7050
|
containerEnv: built.containerEnv ?? {},
|
|
6991
|
-
// The checks of a managed build get its factory's variables, as its command did, and none of the runner's own.
|
|
6992
|
-
factoryVariables: factoryVariablesOf(config, jobDir),
|
|
6993
|
-
proxiedEnvironment: proxiedEnvironment(jobDir),
|
|
6994
7051
|
trustEnvironment: trustEnvironment(jobDir)
|
|
6995
7052
|
});
|
|
6996
7053
|
const evalInput = { dir: join(checksDir, EVAL_INPUT_NAME), delivered: false };
|
|
@@ -8675,7 +8732,7 @@ function noDiskReason(job, config) {
|
|
|
8675
8732
|
if (job.queue === "review") return "a code review reads one commit and leaves nothing to continue";
|
|
8676
8733
|
if (readsOnly(job.queue)) return `${job.queue === "criteria" ? "a criteria job" : "a revision"} reads each repository at its default branch and leaves nothing to continue`;
|
|
8677
8734
|
if (job.reason === "disk_limit_exceeded" || job.reason === "disk_check_failed") return "the build passed its disk limit, so a rerun would start from a full disk";
|
|
8678
|
-
if (config.
|
|
8735
|
+
if (config.fleet === true && (job.managedVariables?.length ?? 0) > 0) return "the build held a factory build variable, and the runner cannot remove a value that a command stored in an encoded form";
|
|
8679
8736
|
return void 0;
|
|
8680
8737
|
}
|
|
8681
8738
|
function target(input, imageId, diskBytes) {
|
|
@@ -8794,7 +8851,7 @@ function isCommit(text2) {
|
|
|
8794
8851
|
return /^(?:[0-9a-f]{40}|[0-9a-f]{64})$/.test(text2);
|
|
8795
8852
|
}
|
|
8796
8853
|
function keepsWork(job, config) {
|
|
8797
|
-
return !(config.
|
|
8854
|
+
return !(config.fleet === true && (job.managedVariables?.length ?? 0) > 0);
|
|
8798
8855
|
}
|
|
8799
8856
|
function homeLine() {
|
|
8800
8857
|
return `HOME="\${HOME:-${BUILD_HOME}}"; export HOME`;
|
|
@@ -9228,7 +9285,7 @@ async function hostPassedNames(config, item, fetchImpl) {
|
|
|
9228
9285
|
return [...latest].filter(([, result]) => result === "pass").map(([name]) => name);
|
|
9229
9286
|
}
|
|
9230
9287
|
function judgeCredential(config, jobDir, runtime) {
|
|
9231
|
-
return config.
|
|
9288
|
+
return config.fleet === true && managedClaudeKeyFor(jobDir) !== void 0 ? managedAgentCredential(runtime.agents) : agentCredential(runtime.hostEnv, {}, runtime.agents);
|
|
9232
9289
|
}
|
|
9233
9290
|
function environmentFor(input) {
|
|
9234
9291
|
const { config, job, jobDir, deps } = input;
|
|
@@ -11734,7 +11791,6 @@ async function buildInBuilder(opts, deps, prepared) {
|
|
|
11734
11791
|
const toolFilesDir = await ports.toolFiles(runner);
|
|
11735
11792
|
const probe = await ports.helper.probe();
|
|
11736
11793
|
const helper = probe.ok ? probe.client : void 0;
|
|
11737
|
-
if (helper === void 0 && opts.managed === true) throw new RecipeError("image_builder_unavailable", MANAGED_UNJAILED_REASON);
|
|
11738
11794
|
const id = randomBytes(6).toString("hex");
|
|
11739
11795
|
const dir = buildDir(opts.configPath, id);
|
|
11740
11796
|
const state = { buildId: id, buildDir: dir, vsockPath: vsockPath(dir) };
|
|
@@ -14223,4 +14279,4 @@ async function runHostChecks(input) {
|
|
|
14223
14279
|
}
|
|
14224
14280
|
}
|
|
14225
14281
|
|
|
14226
|
-
export { ADOPTED_FETCH_RETRY_WINDOW_MS, ALREADY_RELEASED, AttemptLogBook, EXIT_CODE_FILE, GUEST_USAGE_INTERVAL_MS, HELPER_ENV, KIND_LABEL, LEASE_SECONDS, MAX_CHECK_ITEMS_BYTES, MICROVM_COMMAND_DIR, MIN_ENGINE_MAJOR, PLACEHOLDER_MARKER, RENEW_INTERVAL_SECONDS, RunnerInitError, SandboxContainerStoppedError, SandboxGoneError, agentCredentialCheck, appendCommandLog, attemptNote, builtOf, checksIn, claimPermissionProblem, claimRun, commandItems, commandLogOffset, containerCommandExec, createContainerRuntime, createGatewaySandboxClient, createHousekeepingDocker, createLeaseChannel, currentSkillCommand, decideHostBuildSkill, deliverCommitHooks, deliverContainerHooks, deliverExecMaven, deliverJobFiles, deliverSandboxHooks, describeHookEnd, describeMachineDocker, detectMachine, ensureFirecrackerAndJailer, ensureNetworkReady, ensureTunnel, environmentFor, execArgv, execCommandLine, fetchManagedBuildSettings, fetchManagedClaudeKey, filesAreCopied, finishJob, foldSample, formerSkillProblem, formerSkillQueues, freeItemDisksUntil, gatewayRefusalReason, gitRemoteFor, heldSandboxClaimsOf, helperFirecrackerNote, helperSocketPath, holdManagedBuildSettings, holdManagedClaudeKey, hookLimitsFor, hostCommandEnvironment, hostEnvironment, housekeepingDockerIfReachable, inSandbox, inTeardown, installTrust, isContainerTracked, isGroupAlive, isIdle, isIsolatedJob, isJudgeCheck, isMicroVmTracked, isPlaceholderCommand, isReadable, isSandboxTracked, isTimedOut, isTracked, isUnfinished, itemScope, itemTag, jobEnv, jobRecordsClaim, jobTimeLimitMinutes, judgeCredential, judgeProbe, keepGhConfigCurrent, keptCommitsLine, keptSandboxIds, keptSessionDir, leaseExpiresAtMs, leaseTimeLeftMs, lifecycleFailureReason, lifecycleSteps, listAdoptableJobs, listItemDisks, listTrackedJobs, listUnreadableJobs, listenOnBroker, makeRecorder, managedBuildSettingsFor, measureDisk, microVmArchSupported, microVmAssetsPinned, microVmCommandLine, microVmOomKills, missingPermissionFix, missingPermissionOf, modellessProblem, modellessQueues, nativeWindowsSandboxRefusal, needsAgentCredential, needsBuildSkill, needsRenew, outcomeFromExitCode, parseCpuList, permissionModeProblem, permissionModeProblems, placeholderProblem, placeholderQueues, prepareBranch, prepareResume, prepareRunnerInit, probeCommand, probeHelper, probeMicroVmCommand, probeSandboxCommand, provisionContainer, provisionEnvironment, provisionMicroVm, provisionSandbox, reachDockerStep, readConfigObject, readCpuUsec, readDefinitions, readProvisionOut, readRecords, readWorkItem, recordsProofsOnly, recoverLostJobs, rejoinSandboxBuild, releaseLease, removeOldestUntil, removeRunnerBlock, renewLease, renewRun, resolveHostBuild, restartSender, restoreSessionIntoContainer, restoreSessionIntoMicroVm, restoreSessionIntoSandbox, restoreWork, retryFailedReleases, runCommand, runCommandOf, runDecision, runHook, runHostChecks, runHousekeeping, runRunnerInit, runWithSpawn, sampleGuest, savedStatesDir, scrubReason, serveLease, sessionGuestOfContainer, sessionGuestOfMicroVm, sessionGuestOfSandbox, setStage, setUpRunnerCgroup, shellQuote, startHostServices, startMicroVmCommand, startSandboxCommand, startSender, startServicesFor, stopOrphanedMicroVms, stoppedHelperReason, stripTerminalControls, supportsContainerBuilds, supportsMicroVmBuilds, sweepImageBuilders, sweepSandboxes, testProofIn, timeoutAfter, treeFileText, unfinishedJobs,
|
|
14282
|
+
export { ADOPTED_FETCH_RETRY_WINDOW_MS, ALREADY_RELEASED, AttemptLogBook, EXIT_CODE_FILE, GUEST_USAGE_INTERVAL_MS, HELPER_ENV, KIND_LABEL, LEASE_SECONDS, MAX_CHECK_ITEMS_BYTES, MICROVM_COMMAND_DIR, MIN_ENGINE_MAJOR, PLACEHOLDER_MARKER, RENEW_INTERVAL_SECONDS, RunnerInitError, SandboxContainerStoppedError, SandboxGoneError, agentCredentialCheck, appendCommandLog, attemptNote, builtOf, checksIn, claimPermissionProblem, claimRun, commandItems, commandLogOffset, containerCommandExec, createContainerRuntime, createGatewaySandboxClient, createHousekeepingDocker, createLeaseChannel, currentSkillCommand, decideHostBuildSkill, deliverCommitHooks, deliverContainerHooks, deliverExecMaven, deliverJobFiles, deliverSandboxHooks, describeHookEnd, describeMachineDocker, detectMachine, ensureFirecrackerAndJailer, ensureNetworkReady, ensureTunnel, environmentFor, execArgv, execCommandLine, fetchManagedBuildSettings, fetchManagedClaudeKey, filesAreCopied, finishJob, foldSample, formerSkillProblem, formerSkillQueues, freeItemDisksUntil, gatewayRefusalReason, gitRemoteFor, heldSandboxClaimsOf, helperFirecrackerNote, helperSocketPath, holdManagedBuildSettings, holdManagedClaudeKey, holdsHostDisk, hookLimitsFor, hostCommandEnvironment, hostEnvironment, housekeepingDockerIfReachable, inSandbox, inTeardown, installTrust, isContainerTracked, isGroupAlive, isIdle, isIsolatedJob, isJudgeCheck, isMicroVmTracked, isPlaceholderCommand, isReadable, isSandboxTracked, isTimedOut, isTracked, isUnfinished, itemScope, itemTag, jobEnv, jobRecordsClaim, jobTimeLimitMinutes, judgeCredential, judgeProbe, keepGhConfigCurrent, keptCommitsLine, keptSandboxIds, keptSessionDir, leaseExpiresAtMs, leaseTimeLeftMs, lifecycleFailureReason, lifecycleSteps, listAdoptableJobs, listItemDisks, listTrackedJobs, listUnreadableJobs, listenOnBroker, makeRecorder, managedBuildSettingsFor, measureDisk, microVmArchSupported, microVmAssetsPinned, microVmCommandLine, microVmOomKills, missingPermissionFix, missingPermissionOf, modellessProblem, modellessQueues, nativeWindowsSandboxRefusal, needsAgentCredential, needsBuildSkill, needsRenew, outcomeFromExitCode, parseCpuList, permissionModeProblem, permissionModeProblems, placeholderProblem, placeholderQueues, prepareBranch, prepareResume, prepareRunnerInit, probeCommand, probeHelper, probeMicroVmCommand, probeSandboxCommand, provisionContainer, provisionEnvironment, provisionMicroVm, provisionSandbox, reachDockerStep, readConfigObject, readCpuUsec, readDefinitions, readProvisionOut, readRecords, readWorkItem, recordsProofsOnly, recoverLostJobs, rejoinSandboxBuild, releaseLease, removeOldestUntil, removeRunnerBlock, renewLease, renewRun, resolveHostBuild, restartSender, restoreSessionIntoContainer, restoreSessionIntoMicroVm, restoreSessionIntoSandbox, restoreWork, retryFailedReleases, runCommand, runCommandOf, runDecision, runHook, runHostChecks, runHousekeeping, runRunnerInit, runWithSpawn, sampleGuest, savedStatesDir, scrubReason, serveLease, sessionGuestOfContainer, sessionGuestOfMicroVm, sessionGuestOfSandbox, setStage, setUpRunnerCgroup, shellQuote, startHostServices, startMicroVmCommand, startSandboxCommand, startSender, startServicesFor, stopOrphanedMicroVms, stoppedHelperReason, stripTerminalControls, supportsContainerBuilds, supportsMicroVmBuilds, sweepImageBuilders, sweepSandboxes, testProofIn, timeoutAfter, treeFileText, unfinishedJobs, vmAlive, withJobTimeLimit, withTunnelLog, workRestoredEnv, workdirProblem, writeGuestGhConfig, writeRunnerInit };
|