@outerlayer/cli 0.40.0-next.20261117031847 → 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-SNGOSV4D.js → agent-subcommand-MW4TF4SG.js} +4 -4
- package/dist/{artifact-link-cmd-K6VFGMIO.js → artifact-link-cmd-XUHNVFVU.js} +2 -2
- package/dist/{bridge-C5FNHUYF.js → bridge-WEK2IMAD.js} +7 -7
- package/dist/{build-YFKCYJR6.js → build-LJSUCORB.js} +13 -13
- package/dist/{build-disk-ZRWIYYVO.js → build-disk-S2XHWSDH.js} +11 -11
- package/dist/build-info.json +1 -1
- package/dist/{builder-334EUQCE.js → builder-TCRJKB2W.js} +10 -10
- package/dist/caller-VJBDXZXG.js +23 -0
- package/dist/{check-LGB3BWZ7.js → check-Z6GAY2C4.js} +55 -55
- package/dist/{chunk-SBSH253O.js → chunk-2QFZBWBP.js} +1 -1
- package/dist/{chunk-5LDYQLE3.js → chunk-33DTLCL6.js} +2 -2
- package/dist/{chunk-6RJBLCPV.js → chunk-33RKRHJG.js} +1 -1
- package/dist/{chunk-CVSREZEZ.js → chunk-3ETI7MKK.js} +4 -4
- package/dist/{chunk-M7RI6IMR.js → chunk-3PXV4I75.js} +3 -3
- package/dist/{chunk-WNQMNFJG.js → chunk-4FTRLX6A.js} +5 -5
- package/dist/{chunk-CEHT2FCU.js → chunk-5EWESACE.js} +2 -2
- package/dist/{chunk-5SAJ23BY.js → chunk-5O7P6VXS.js} +1 -1
- package/dist/{chunk-DHB3M244.js → chunk-6GJMRVMX.js} +1 -1
- package/dist/{chunk-DRF45IQZ.js → chunk-6NODVJGM.js} +3 -3
- package/dist/{chunk-QAZOUTEM.js → chunk-6QXGAGQY.js} +1 -1
- package/dist/{chunk-NLOUOUZV.js → chunk-6ZBUQIJA.js} +1 -1
- package/dist/{chunk-Z3IDEUCC.js → chunk-7PIUTUXI.js} +3 -3
- package/dist/{chunk-OF6XMZHO.js → chunk-7QIQ7QR3.js} +1 -1
- package/dist/{chunk-QVQWIKDP.js → chunk-ABXHYH2Y.js} +6 -6
- package/dist/{chunk-G3HBBHIK.js → chunk-ABY722KN.js} +1 -1
- package/dist/{chunk-62EOPMMA.js → chunk-AGKUDDIN.js} +1 -1
- package/dist/{chunk-ERFVB3TJ.js → chunk-AH2BO6Q6.js} +6 -6
- package/dist/{chunk-GZLNKW2J.js → chunk-BEK2BZAI.js} +6 -6
- package/dist/{chunk-DQQID2EX.js → chunk-BZFRU6M7.js} +8 -8
- package/dist/{chunk-MCUI6RHU.js → chunk-CH3PO7UY.js} +10 -2
- package/dist/{chunk-OUVDFJ3T.js → chunk-CNMC4OXO.js} +7 -7
- package/dist/{chunk-CJCGE7TW.js → chunk-CW6H5JXV.js} +8 -8
- package/dist/{chunk-2MSLNM5V.js → chunk-D2QNQOFX.js} +1 -1
- package/dist/{chunk-F2I2GQMF.js → chunk-D3CALDGC.js} +1 -1
- package/dist/{chunk-HQPB4ZMS.js → chunk-EBWA6KIE.js} +1 -1
- package/dist/{chunk-2VVSAKM3.js → chunk-EU6JHHES.js} +338 -97
- package/dist/{chunk-EO7KUUKZ.js → chunk-F4PRZBBJ.js} +2 -2
- package/dist/{chunk-WT74ZSRC.js → chunk-F6J3ACXH.js} +6 -6
- package/dist/{chunk-DV44KCM6.js → chunk-FG2E3HES.js} +1 -1
- package/dist/{chunk-6JRDP6O4.js → chunk-FLHDVJAV.js} +5 -5
- package/dist/{chunk-CGYKQEPN.js → chunk-GBLNHZ3E.js} +4 -4
- package/dist/{chunk-QVTGSGQ5.js → chunk-GQI5N56J.js} +2 -2
- package/dist/{chunk-3IHZYNZW.js → chunk-H2THCHUP.js} +1 -1
- package/dist/{chunk-FPUFOQEH.js → chunk-H4JQKCVP.js} +9 -9
- package/dist/{chunk-UNGZ25QF.js → chunk-H6L6SWMN.js} +2 -2
- package/dist/{chunk-WYD6XWET.js → chunk-HI6R4XYD.js} +2 -2
- package/dist/{chunk-6P23FS2Z.js → chunk-HSGZ4JEV.js} +1 -1
- package/dist/{chunk-QIO2NIX2.js → chunk-I7ZQKMKG.js} +1 -1
- package/dist/{chunk-PIJWOPSG.js → chunk-IQYAPM4S.js} +7 -7
- package/dist/{chunk-ONDONSBT.js → chunk-K6THWLSJ.js} +1 -1
- package/dist/{chunk-2F3RZT5L.js → chunk-KCLFDN26.js} +3 -3
- package/dist/{chunk-OY4EJVUH.js → chunk-KDVQGQXM.js} +1 -1
- package/dist/{chunk-IWPU2TDY.js → chunk-LYHR47YE.js} +2 -2
- package/dist/{chunk-MJGBRYDH.js → chunk-MBOQJTOS.js} +11 -6
- package/dist/{chunk-NWYQ7PKS.js → chunk-MEZVLRJK.js} +10 -10
- package/dist/{chunk-T3NBGNP5.js → chunk-MG2Y5XYV.js} +247 -138
- package/dist/{chunk-J6WQ6POX.js → chunk-NWWED36F.js} +1 -1
- package/dist/{chunk-AAOM7S3Z.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-R4IC7BKJ.js → chunk-PZZS6DHY.js} +8 -8
- package/dist/{chunk-A72OH6K3.js → chunk-QJI56HI2.js} +7 -7
- package/dist/{chunk-F7EYCXY4.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-OCXVMUXA.js → chunk-TTBG7YZW.js} +7 -7
- package/dist/{chunk-ROMZCAG7.js → chunk-TZNIDZGI.js} +1 -1
- package/dist/{chunk-IQTMXXKU.js → chunk-UAZBE4O3.js} +10 -10
- package/dist/{chunk-6MF44FPF.js → chunk-UE42G3QY.js} +1 -1
- package/dist/{chunk-GOJ2SPKB.js → chunk-UFGV3JZ5.js} +1 -1
- package/dist/{chunk-JGSIVQVE.js → chunk-UN7RXMOB.js} +4 -4
- package/dist/{chunk-OVF475U5.js → chunk-UUVURKWB.js} +4 -4
- package/dist/{chunk-OIAWDKSR.js → chunk-V6UDJVVD.js} +3 -3
- package/dist/{chunk-WZRXXOWB.js → chunk-V77IQKWK.js} +17 -17
- package/dist/{chunk-NO3JPGJW.js → chunk-VG6FUXGK.js} +1 -1
- package/dist/{chunk-4WRECUUH.js → chunk-WEPLWKV6.js} +3 -3
- package/dist/{chunk-3TQVQKQ2.js → chunk-WZ6K327V.js} +7 -7
- package/dist/{chunk-DOJGTDZU.js → chunk-X6BGCNE3.js} +8 -8
- package/dist/{chunk-RO5YUUN2.js → chunk-XT6LWXJ2.js} +1 -1
- package/dist/{chunk-KDKMVWHJ.js → chunk-YICV7DAE.js} +3 -3
- package/dist/{chunk-ZTZFWQBG.js → chunk-ZASDJ7F5.js} +4 -4
- package/dist/{chunk-YNNTU5IZ.js → chunk-ZIN6G7DS.js} +1 -1
- package/dist/{chunk-O2324X34.js → chunk-ZQTMWBLA.js} +1 -1
- package/dist/{chunk-JDAH6YHU.js → chunk-ZYIVNB6B.js} +5 -5
- package/dist/{claude-launcher-3H5XSXVA.js → claude-launcher-HWC5S5HD.js} +7 -7
- package/dist/{cli-FRR5Q3IX.js → cli-TWF7CU3E.js} +168 -168
- package/dist/{command-Y5FG3FWC.js → command-KGYVPB7B.js} +52 -52
- package/dist/{config-V6VQOSHM.js → config-J4VSNOH4.js} +12 -12
- package/dist/{connect-cmd-AU2IGAYG.js → connect-cmd-LPC6J27D.js} +13 -13
- package/dist/{container-start-Z6OCZPUC.js → container-start-O6BAIQGT.js} +49 -49
- package/dist/{context-cleanup-SK445SLA.js → context-cleanup-VWJSWUJB.js} +4 -4
- package/dist/{context-show-cmd-Z6YW2XPG.js → context-show-cmd-B427F3M4.js} +14 -14
- package/dist/{control-plane-launch-CNGKWYLK.js → control-plane-launch-WV253P7I.js} +14 -14
- package/dist/{demo-record-cmd-VEMSRUVR.js → demo-record-cmd-YRND2HVT.js} +8 -8
- package/dist/{demo-voice-cmd-ABNZ6H7V.js → demo-voice-cmd-TUIXJ7CY.js} +20 -20
- package/dist/{dist-775TDFCK.js → dist-UV2JOW3N.js} +2 -2
- package/dist/{docker-UHQ4LAJE.js → docker-6NO5B657.js} +10 -10
- package/dist/{doctor-B7XTBO53.js → doctor-V3Z5CR5Q.js} +51 -51
- package/dist/{emit-artifact-cmd-WLBQOFGX.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-S533NEY4.js → emit-criteria-cmd-35O7KR37.js} +16 -16
- package/dist/{emit-demo-cmd-K4JY5PDP.js → emit-demo-cmd-HJCW3JEA.js} +20 -20
- package/dist/{emit-finding-cmd-C7RZGGVJ.js → emit-finding-cmd-Q4SN3OA7.js} +16 -16
- package/dist/{emit-result-cmd-5NLUDBXM.js → emit-result-cmd-7VEMDT2P.js} +18 -18
- package/dist/{emit-step-cmd-Q7VIXGYQ.js → emit-step-cmd-DYQM5OQA.js} +16 -16
- package/dist/{exec-client-RR6F42IB.js → exec-client-6WGSNY56.js} +8 -8
- package/dist/{find-unit-WRHK3H5X.js → find-unit-6BX4K4WV.js} +13 -13
- package/dist/{findings-cmd-74MN2Q7K.js → findings-cmd-WHQBJZNA.js} +16 -16
- package/dist/{fleet-readiness-R6B3PYU7.js → fleet-readiness-A67D5OP4.js} +14 -14
- package/dist/{governing-source-M2HYH7ZN.js → governing-source-C4BMFNFZ.js} +21 -21
- package/dist/{guest-init-QEWU2H7W.js → guest-init-ZWEJGXQS.js} +9 -9
- package/dist/{hook-fast-GPW7D4MD.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-LKOD5GRQ.js → image-tag-6HQDPX45.js} +8 -8
- package/dist/index.js +4 -4
- package/dist/{init-UO4SOY57.js → init-KOG5S5KX.js} +47 -47
- package/dist/init-ULMPF7MK.js +82 -0
- package/dist/{init-agent-JVMIDIXN.js → init-agent-XIDQULDZ.js} +47 -47
- package/dist/init-cmd-P7FYHTLS.js +53 -0
- package/dist/{init-update-BRUFAWCA.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-WNZZNFA3.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-4D4P6IA7.js → mcp-serve-cmd-VAQL3CJB.js} +9 -9
- package/dist/{paths-I7LDWR3Q.js → paths-G7LFPGQQ.js} +7 -7
- package/dist/{pending-L65HTOAV.js → pending-OEAYMKZO.js} +8 -8
- package/dist/{pidfile-SNTRLZ2Z.js → pidfile-FIVR2HKB.js} +8 -8
- package/dist/{record-QJPGOWYX.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-YY34QRDU.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-2374JAQF.js → runner-identity-JM3ZQ2PJ.js} +10 -10
- package/dist/{runner-key-JRZ5N4IM.js → runner-key-P6FUFO6Y.js} +47 -47
- package/dist/{session-sender-CUM4SRT7.js → session-sender-N3U3ZTL3.js} +19 -19
- package/dist/{setup-cmd-5ICCOGTJ.js → setup-cmd-F7Y4SFTK.js} +14 -14
- package/dist/{setup-wiring-CEGNPVS5.js → setup-wiring-LU6AY2QA.js} +54 -54
- package/dist/{spec-cmd-6ACWBET6.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-H677WBLM.js → status-N326EK5I.js} +47 -47
- package/dist/{sync-cmd-5UMBZRKI.js → sync-cmd-KG7YQGM6.js} +18 -18
- package/dist/update-steps-YQQXESUZ.js +83 -0
- package/dist/{watch-34LOYMEQ.js → watch-3VJ363V2.js} +18 -18
- package/dist/{work-claim-cmd-NRHTDJC3.js → work-claim-cmd-MXWB5NG6.js} +23 -23
- package/dist/{work-cmd-NBYW3LBP.js → work-cmd-X55AAJG2.js} +16 -16
- package/dist/{work-comment-cmd-J4CG33NA.js → work-comment-cmd-7AL5KEVJ.js} +18 -18
- package/dist/{work-demo-cmd-APJDOTHV.js → work-demo-cmd-6UFGGEMI.js} +16 -16
- package/dist/{work-logs-cmd-FL7DOHUU.js → work-logs-cmd-DCAV3J7A.js} +16 -16
- package/dist/{work-mock-cmd-4MAYOAQS.js → work-mock-cmd-O7KFTS65.js} +16 -16
- package/dist/{work-needs-attention-cmd-LG5MFGPW.js → work-needs-attention-cmd-OD5PTHLX.js} +16 -16
- package/dist/{work-no-change-cmd-QATDFQ46.js → work-no-change-cmd-ABYXIOZT.js} +16 -16
- package/dist/{work-open-pr-cmd-FV43THW5.js → work-open-pr-cmd-WRFHZXVM.js} +17 -17
- package/dist/{work-pr-cmd-53VAE7HD.js → work-pr-cmd-VEH4HP7P.js} +16 -16
- package/dist/{work-proofs-cmd-4SF7WZC3.js → work-proofs-cmd-TKA3J2II.js} +18 -18
- package/dist/{work-proofs-record-IGKVQOLA.js → work-proofs-record-WTBSJLET.js} +24 -24
- package/dist/{work-stop-cmd-V5SPVTY4.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-E3NJKG6H.js +0 -41
- package/dist/caller-6PMFDU4O.js +0 -23
- package/dist/host-checks-PKOVCAGU.js +0 -82
- package/dist/host-key-HICYSAZ5.js +0 -18
- package/dist/init-DFC5GUE5.js +0 -82
- package/dist/init-cmd-WTJ7KOQ5.js +0 -53
- package/dist/install-cmd-2H4QK5O7.js +0 -26
- package/dist/launch-agent-HPWRSGXZ.js +0 -26
- package/dist/loop-WO37TJ5C.js +0 -92
- package/dist/machine-ZXCUPCDS.js +0 -82
- package/dist/runner-env-ACRSRRBW.js +0 -24
- package/dist/state-TUO74X72.js +0 -18
- package/dist/update-steps-XCDL66FA.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, writeSanitizedRecipe, classifyProperties, RecipeError, DOCKER_FEATURE } from './chunk-
|
|
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, 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-
|
|
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';
|
|
@@ -1454,7 +1454,8 @@ function createGatewaySandboxClient(opts) {
|
|
|
1454
1454
|
secret: typeof raw.secret === "string" ? raw.secret : "",
|
|
1455
1455
|
urlToken: typeof raw.urlToken === "string" ? raw.urlToken : "",
|
|
1456
1456
|
metadata: typeof raw.metadata === "object" && raw.metadata !== null ? raw.metadata : {},
|
|
1457
|
-
...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 } : {}
|
|
1458
1459
|
};
|
|
1459
1460
|
}
|
|
1460
1461
|
async function gateway(factory, send) {
|
|
@@ -1499,7 +1500,9 @@ function createGatewaySandboxClient(opts) {
|
|
|
1499
1500
|
idleMinutes: input.idleMinutes,
|
|
1500
1501
|
timeLimitMinutes: input.timeLimitMinutes,
|
|
1501
1502
|
metadata: input.metadata,
|
|
1502
|
-
...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 }
|
|
1503
1506
|
}),
|
|
1504
1507
|
input.factory
|
|
1505
1508
|
);
|
|
@@ -3019,10 +3022,14 @@ function checkoutNotAtDefaultHead(checkouts) {
|
|
|
3019
3022
|
function selectExpired(records, nowMs) {
|
|
3020
3023
|
return records.filter((record) => nowMs - savedAtOf(record) >= SAVED_STATE_MAX_AGE_MS);
|
|
3021
3024
|
}
|
|
3025
|
+
function holdsHostDisk(record) {
|
|
3026
|
+
return record.kind !== "sandbox";
|
|
3027
|
+
}
|
|
3022
3028
|
function selectToFit(records, maxBytes) {
|
|
3023
|
-
|
|
3029
|
+
const onHost = records.filter(holdsHostDisk);
|
|
3030
|
+
let total = onHost.reduce((sum, record) => sum + record.bytes, 0);
|
|
3024
3031
|
const selected = [];
|
|
3025
|
-
for (const record of oldestFirst(
|
|
3032
|
+
for (const record of oldestFirst(onHost)) {
|
|
3026
3033
|
if (total <= maxBytes) break;
|
|
3027
3034
|
selected.push(record);
|
|
3028
3035
|
total -= record.bytes;
|
|
@@ -3777,7 +3784,8 @@ function writeRecord2(dir, record) {
|
|
|
3777
3784
|
function isRecord(value) {
|
|
3778
3785
|
if (typeof value !== "object" || value === null) return false;
|
|
3779
3786
|
const r = value;
|
|
3780
|
-
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";
|
|
3781
3789
|
}
|
|
3782
3790
|
function readRecords(dir) {
|
|
3783
3791
|
let names;
|
|
@@ -4180,6 +4188,82 @@ async function discardUnusableItemDisk(input) {
|
|
|
4180
4188
|
await discardItemDisk(input.kept, input.removeVolume, input.onError, input.endSandbox);
|
|
4181
4189
|
return { retryFresh: true, reason: `the kept disk of claim ${shortClaim(input.kept.record.claimId)} could not be used: ${input.reason}`, itemDisk: input.why };
|
|
4182
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
|
+
}
|
|
4183
4267
|
|
|
4184
4268
|
// src/runner/sandbox/sweep.ts
|
|
4185
4269
|
var RUNNER_METADATA = "outerlayerRunner";
|
|
@@ -4824,14 +4908,44 @@ async function readSandboxRecipe(input) {
|
|
|
4824
4908
|
return err.code === "repository_unreadable" && readToken !== void 0 ? { ok: false, reason: err.message, transient: true } : { ok: false, reason: err.message };
|
|
4825
4909
|
}
|
|
4826
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
|
+
}
|
|
4827
4941
|
async function provisionSandbox(input) {
|
|
4828
4942
|
const tag = itemTag({ item: input.item.number, organizationId: input.organizationId, claimId: input.claimId });
|
|
4829
4943
|
return provisionWithFreshFallback({
|
|
4830
|
-
attempt: (
|
|
4944
|
+
attempt: (allowRestore, itemDiskFailed) => provisionSandboxOnce(input, allowRestore, itemDiskFailed),
|
|
4831
4945
|
log: (line2) => input.log.line(`${tag} ${line2}`)
|
|
4832
4946
|
});
|
|
4833
4947
|
}
|
|
4834
|
-
async function provisionSandboxOnce(input, itemDiskFailed) {
|
|
4948
|
+
async function provisionSandboxOnce(input, allowRestore, itemDiskFailed) {
|
|
4835
4949
|
const { config, runtime, item, itemKey, jobDir, log, tokens } = input;
|
|
4836
4950
|
const tag = itemTag({ item: item.number, organizationId: input.organizationId, claimId: input.claimId });
|
|
4837
4951
|
const logPath = join(jobDir, "provision.log");
|
|
@@ -4884,6 +4998,20 @@ async function provisionSandboxOnce(input, itemDiskFailed) {
|
|
|
4884
4998
|
let keptDisk = itemDisk.kept;
|
|
4885
4999
|
let diskState = itemDisk.state;
|
|
4886
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;
|
|
4887
5015
|
const buildId = randomBytes(6).toString("hex");
|
|
4888
5016
|
const runnerId = runnerLabelValue(config.configPath);
|
|
4889
5017
|
const name = sandboxNameOf(runnerId, buildId);
|
|
@@ -4944,6 +5072,11 @@ async function provisionSandboxOnce(input, itemDiskFailed) {
|
|
|
4944
5072
|
await bail(reason);
|
|
4945
5073
|
return discardUnusableItemDisk({ kept: keptDisk, reason, why, removeVolume: async () => void 0, endSandbox: (id) => sandboxClient.end(id), onError: (line2) => log.error(`${tag} ${line2}`) });
|
|
4946
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);
|
|
4947
5080
|
const forgetManagedDisk = async (id, err) => {
|
|
4948
5081
|
const reason = `the kept sandbox ${id} could not be resumed: ${err.reason ?? describeSandboxError(err)}`;
|
|
4949
5082
|
await bail(reason);
|
|
@@ -4996,19 +5129,33 @@ async function provisionSandboxOnce(input, itemDiskFailed) {
|
|
|
4996
5129
|
let sandbox;
|
|
4997
5130
|
runtime.sandbox.creating.add(buildId);
|
|
4998
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
|
+
});
|
|
4999
5145
|
sandbox = resumed ?? await createWhenAllowed({
|
|
5000
|
-
create: async () =>
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
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
|
+
},
|
|
5012
5159
|
sleep: runtime.sandbox.sleep,
|
|
5013
5160
|
aborted: input.aborted,
|
|
5014
5161
|
log: (line2) => log.line(`${tag} ${line2}`)
|
|
@@ -5034,7 +5181,9 @@ async function provisionSandboxOnce(input, itemDiskFailed) {
|
|
|
5034
5181
|
return { ok: false, reason: held3, held: true };
|
|
5035
5182
|
}
|
|
5036
5183
|
const transient = late?.kind !== "timed_out" && late?.kind !== "ended" && err instanceof SandboxError && providerMayAnswerLater(err);
|
|
5037
|
-
|
|
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);
|
|
5038
5187
|
}
|
|
5039
5188
|
sandbox = late.sandbox;
|
|
5040
5189
|
}
|
|
@@ -5048,6 +5197,14 @@ async function provisionSandboxOnce(input, itemDiskFailed) {
|
|
|
5048
5197
|
volumeName = container;
|
|
5049
5198
|
containerState.volume = container;
|
|
5050
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
|
+
}
|
|
5051
5208
|
if (resumed === void 0 && !hasStarted(sandbox.state)) {
|
|
5052
5209
|
const started2 = await awaitStartById({
|
|
5053
5210
|
client: sandboxClient,
|
|
@@ -5067,7 +5224,7 @@ async function provisionSandboxOnce(input, itemDiskFailed) {
|
|
|
5067
5224
|
log.error(`${tag} could not end sandbox ${sandbox.id}: ${describeCallFailure(err)} \xB7 the next sweep ends it`);
|
|
5068
5225
|
}
|
|
5069
5226
|
if (started2.kind === "aborted") return bail("", true);
|
|
5070
|
-
return
|
|
5227
|
+
return end(slowStartReason(started2) ?? `sandbox ${sandbox.id} did not start`);
|
|
5071
5228
|
}
|
|
5072
5229
|
}
|
|
5073
5230
|
runtime.sandbox.sandboxes.set(buildId, sandbox);
|
|
@@ -5076,11 +5233,17 @@ async function provisionSandboxOnce(input, itemDiskFailed) {
|
|
|
5076
5233
|
input.save(state, environment);
|
|
5077
5234
|
runtime.sandbox.creating.delete(buildId);
|
|
5078
5235
|
runtime.sandbox.resuming.delete(sandbox.id);
|
|
5079
|
-
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
|
+
);
|
|
5080
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
|
+
}
|
|
5081
5244
|
const sandboxed = runtimeInSandbox(runtime, sandbox);
|
|
5082
5245
|
const { host } = sandboxed;
|
|
5083
|
-
const dockerFailed = (what, result) =>
|
|
5246
|
+
const dockerFailed = (what, result) => end(`${what} failed (exit ${result.status})${said(result.stderr)}`);
|
|
5084
5247
|
const joinSecret = randomBytes(32);
|
|
5085
5248
|
runtime.sandbox.joinSecrets.set(buildId, joinSecret);
|
|
5086
5249
|
const packDir = join(runtime.cliBuild().distDir, "..", "skill-pack");
|
|
@@ -5089,26 +5252,26 @@ async function provisionSandboxOnce(input, itemDiskFailed) {
|
|
|
5089
5252
|
const packageFile = existsSync(packagePath) ? packagePath : void 0;
|
|
5090
5253
|
try {
|
|
5091
5254
|
const made = await sandboxClient.command(sandbox, `sudo mkdir -p ${CLI_DIR} && sudo chown -R "$(id -u):$(id -g)" ${SANDBOX_DIR}`);
|
|
5092
|
-
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)}`);
|
|
5093
5256
|
await sandboxClient.upload(sandbox, `${SANDBOX_DIR}/dist.tgz`, gzipSync(packFolder(runtime.cliBuild().distDir)));
|
|
5094
5257
|
if (skillPack !== void 0) {
|
|
5095
5258
|
await sandboxClient.upload(sandbox, `${SANDBOX_DIR}/skill-pack.tgz`, gzipSync(packFolder(skillPack)));
|
|
5096
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`);
|
|
5097
|
-
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)}`);
|
|
5098
5261
|
}
|
|
5099
5262
|
if (packageFile !== void 0) await sandboxClient.upload(sandbox, PACKAGE_FILE, readFileSync(packageFile));
|
|
5100
5263
|
await sandboxClient.upload(sandbox, SECRET_FILE, joinSecret);
|
|
5101
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}`);
|
|
5102
|
-
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)}`);
|
|
5103
5266
|
} catch (err) {
|
|
5104
|
-
return
|
|
5267
|
+
return end(`putting the CLI in the sandbox failed: ${err instanceof SandboxError ? describeSandboxError(err) : describeCallFailure(err)}`);
|
|
5105
5268
|
}
|
|
5106
5269
|
if (own.docker) {
|
|
5107
5270
|
const set = await commandIn(sandboxClient, sandbox, daemonSetupLine());
|
|
5108
|
-
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)}`);
|
|
5109
5272
|
}
|
|
5110
5273
|
const engine = await host.version();
|
|
5111
|
-
if (engine === null) return
|
|
5274
|
+
if (engine === null) return end("Docker is not available in the sandbox: `docker version` failed");
|
|
5112
5275
|
const limits2 = containerLimitsOf(containerSizeOf(sandbox, sized.size), config.build);
|
|
5113
5276
|
const volume = await host.createVolume(volumeName, { [BUILD_LABEL]: buildId, [RUNNER_LABEL]: runnerId });
|
|
5114
5277
|
if (volume.status !== 0) return dockerFailed("creating the build's volume", volume);
|
|
@@ -5130,21 +5293,26 @@ async function provisionSandboxOnce(input, itemDiskFailed) {
|
|
|
5130
5293
|
let dockerGroup;
|
|
5131
5294
|
if (own.docker) {
|
|
5132
5295
|
const mounted = await commandIn(sandboxClient, sandbox, hostMountLine(volumeName));
|
|
5133
|
-
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)}`);
|
|
5134
5297
|
const group = await commandIn(sandboxClient, sandbox, `stat -c %g ${DOCKER_SOCKET}`);
|
|
5135
5298
|
dockerGroup = group.stdout.trim();
|
|
5136
|
-
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)}`);
|
|
5137
5300
|
}
|
|
5138
5301
|
const imageConfig = await host.imageConfig(image);
|
|
5139
5302
|
const resolved = await resolveBuildUser(sandboxed, runInput, { remoteUser: apply.remoteUser, imageUser: imageConfig.user }, logPath);
|
|
5140
|
-
if (!resolved.ok) return
|
|
5303
|
+
if (!resolved.ok) return end(resolved.reason);
|
|
5141
5304
|
containerState.agentUser = resolved.user;
|
|
5142
5305
|
if (resolved.home !== void 0) containerState.home = resolved.home;
|
|
5143
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
|
+
}
|
|
5144
5312
|
input.save(state, environment);
|
|
5145
5313
|
if (input.aborted()) return bail("", true);
|
|
5146
5314
|
const network = await startSandboxNetwork({ runtime, sandboxed, sandboxClient, sandbox, runnerDir: runnerDir(config.configPath), build: { buildId, runnerId, container, image, limits: limits2 }, logPath, docker: own.docker });
|
|
5147
|
-
if ("failed" in network) return
|
|
5315
|
+
if ("failed" in network) return end(network.failed);
|
|
5148
5316
|
if ("none" in network) log.line(`${tag} ${noHelperLine(network.none)}`);
|
|
5149
5317
|
else containerState.network = network.helper;
|
|
5150
5318
|
const runArgs = containerRunArgs({ ...runInput, home: containerState.home, network: containerState.network }, runtime.agents);
|
|
@@ -5152,9 +5320,9 @@ async function provisionSandboxOnce(input, itemDiskFailed) {
|
|
|
5152
5320
|
if (started.status !== 0) return dockerFailed("starting the build's container", started);
|
|
5153
5321
|
joinRelay(runtime, sandbox, { buildId, container }, services.streams, joinSecret, (line2) => log.line(`${tag} ${line2}`));
|
|
5154
5322
|
if (input.aborted()) return bail("", true);
|
|
5155
|
-
if (!await waitForRelay(sandboxed, container)) return
|
|
5323
|
+
if (!await waitForRelay(sandboxed, container)) return end("the relay in the build's container did not start");
|
|
5156
5324
|
const ghDelivered = await deliverJobFiles(sandboxed, containerState, ["gh"], secrets);
|
|
5157
|
-
if (!ghDelivered.ok) return
|
|
5325
|
+
if (!ghDelivered.ok) return end(ghDelivered.reason);
|
|
5158
5326
|
keepGhConfigCurrent(tokens, buildDir2, (err) => log.error(`${tag} the read token could not be written for gh: ${describeCallFailure(err)}`), {
|
|
5159
5327
|
runtime: sandboxed,
|
|
5160
5328
|
state: containerState,
|
|
@@ -5174,6 +5342,7 @@ async function provisionSandboxOnce(input, itemDiskFailed) {
|
|
|
5174
5342
|
return endedAtLimit(ran) ? { ...ran, timedOut: true } : ran;
|
|
5175
5343
|
};
|
|
5176
5344
|
const setupMinutes = config.build?.setupMinutes ?? DEFAULT_SETUP_MINUTES;
|
|
5345
|
+
let setupPassed = false;
|
|
5177
5346
|
const steps = await runBuildSteps({
|
|
5178
5347
|
repository,
|
|
5179
5348
|
branch: primary.branch,
|
|
@@ -5209,10 +5378,19 @@ async function provisionSandboxOnce(input, itemDiskFailed) {
|
|
|
5209
5378
|
...input.requireBuildSkill === true ? { requireBuildSkill: true } : {},
|
|
5210
5379
|
// The image in the sandbox is the universal image, so the build chooses and installs its runtimes.
|
|
5211
5380
|
...runtimeStepInput({ base: {} }, services),
|
|
5212
|
-
// A kept disk holds the checkouts already: each is switched to the branch
|
|
5213
|
-
|
|
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
|
+
}
|
|
5214
5389
|
});
|
|
5215
|
-
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
|
+
}
|
|
5216
5394
|
containerState.startCommit = steps.startCommit;
|
|
5217
5395
|
keepRuntimeStep(containerState, steps);
|
|
5218
5396
|
keepMissingSetupScripts(containerState, steps);
|
|
@@ -5506,75 +5684,6 @@ function syncInSandbox(input) {
|
|
|
5506
5684
|
function recordProofsInSandbox(input) {
|
|
5507
5685
|
return runCliInSandbox(input, [...RECORD_PROOFS_ARGV], PROOFS_LOG);
|
|
5508
5686
|
}
|
|
5509
|
-
function savedStateBase(report) {
|
|
5510
|
-
const digest = report.recipe === "default" ? report.base?.digest : void 0;
|
|
5511
|
-
return digest === void 0 ? void 0 : { digest };
|
|
5512
|
-
}
|
|
5513
|
-
function savedStateMaxOf(config) {
|
|
5514
|
-
return config.housekeeping?.savedStateMax ?? DEFAULT_SAVED_STATE_MAX_BYTES;
|
|
5515
|
-
}
|
|
5516
|
-
async function planSavedState(input) {
|
|
5517
|
-
const { config, runtime, log } = input;
|
|
5518
|
-
const refused2 = savingRefusedBecause({ universalImage: input.base !== void 0, fleet: config.fleet === true, savedStateMax: savedStateMaxOf(config) });
|
|
5519
|
-
if (refused2 !== void 0 || input.base === void 0) {
|
|
5520
|
-
const why = refused2 ?? "its image comes from a devcontainer file";
|
|
5521
|
-
log(`this build saves no state: ${why}`);
|
|
5522
|
-
return { keyCommits: {}, noSave: why };
|
|
5523
|
-
}
|
|
5524
|
-
const root = runnerDir(config.configPath);
|
|
5525
|
-
const repositories = [];
|
|
5526
|
-
const keyCommits = {};
|
|
5527
|
-
for (const entry of input.repositories) {
|
|
5528
|
-
let token;
|
|
5529
|
-
try {
|
|
5530
|
-
token = entry.primary ? await input.tokens.token("read") : await input.tokens.token("read", entry.repository);
|
|
5531
|
-
} catch (err) {
|
|
5532
|
-
return unread(`the read token for ${entry.repository} could not be had: ${describeCallFailure(err)}`, log);
|
|
5533
|
-
}
|
|
5534
|
-
const [owner = "", name = ""] = entry.repository.split("/");
|
|
5535
|
-
const read = await runtime.readKeyFiles({
|
|
5536
|
-
remote: runtime.remoteFor?.(entry.repository) ?? `${runtime.github.gitUrl}/${entry.repository}.git`,
|
|
5537
|
-
dir: join(root, "key-files", owner, name),
|
|
5538
|
-
paths: keyFilePaths(),
|
|
5539
|
-
token
|
|
5540
|
-
});
|
|
5541
|
-
if (!read.ok) return unread(read.reason, log);
|
|
5542
|
-
keyCommits[entry.repository] = read.commit;
|
|
5543
|
-
repositories.push({ repository: entry.repository, commit: read.commit, files: read.files });
|
|
5544
|
-
}
|
|
5545
|
-
const key = stateKey({
|
|
5546
|
-
factory: keyRunnerFactory(config),
|
|
5547
|
-
repositories,
|
|
5548
|
-
imageDigest: input.base.digest,
|
|
5549
|
-
diskBytes: input.diskBytes
|
|
5550
|
-
});
|
|
5551
|
-
const found = lookup(readRecords(savedStatesDir(root)), key, input.now.getTime());
|
|
5552
|
-
if (found.kind !== "none" && found.record.kind === "tar") {
|
|
5553
|
-
try {
|
|
5554
|
-
await removeSavedState(found.record, { dir: savedStatesDir(root), removeVolume: async () => void 0 });
|
|
5555
|
-
log(`saved state ${found.record.id} is a tar file, which this runner no longer restores; removed it; starting from a fresh disk`);
|
|
5556
|
-
} catch (err) {
|
|
5557
|
-
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`);
|
|
5558
|
-
}
|
|
5559
|
-
return { key, keyCommits };
|
|
5560
|
-
}
|
|
5561
|
-
if (found.kind === "usable" && input.allowRestore) {
|
|
5562
|
-
log(`starting from saved state ${found.record.id}, saved ${formatDuration(found.ageMs)} ago`);
|
|
5563
|
-
return { key, keyCommits, restore: { record: found.record, ageMs: found.ageMs } };
|
|
5564
|
-
}
|
|
5565
|
-
if (found.kind === "expired") {
|
|
5566
|
-
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`);
|
|
5567
|
-
} else if (found.kind === "changed") {
|
|
5568
|
-
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`);
|
|
5569
|
-
} else if (found.kind === "none") {
|
|
5570
|
-
log("no saved state matches this build's key; starting from a fresh disk");
|
|
5571
|
-
}
|
|
5572
|
-
return { key, keyCommits };
|
|
5573
|
-
}
|
|
5574
|
-
function unread(reason, log) {
|
|
5575
|
-
log(`this build starts from no saved state and saves none: ${reason}`);
|
|
5576
|
-
return { keyCommits: {}, noSave: `its key files could not be read: ${reason}` };
|
|
5577
|
-
}
|
|
5578
5687
|
var FREEZE_DEADLINE_SECONDS = 12 * 60;
|
|
5579
5688
|
function freezeScript() {
|
|
5580
5689
|
return [
|
|
@@ -14170,4 +14279,4 @@ async function runHostChecks(input) {
|
|
|
14170
14279
|
}
|
|
14171
14280
|
}
|
|
14172
14281
|
|
|
14173
|
-
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, vmAlive, withJobTimeLimit, withTunnelLog, workRestoredEnv, workdirProblem, writeGuestGhConfig, writeRunnerInit };
|
|
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 };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
3
|
import { readCloudConfigStrict, readCloudConfig, cloudConfigPath } from './chunk-HWVMRETT.js';
|
|
4
|
-
import { signRunnerRequest, signerFor } from './chunk-
|
|
4
|
+
import { signRunnerRequest, signerFor } from './chunk-6ZBUQIJA.js';
|
|
5
5
|
import { readRepoConnection, findGitDirs } from './chunk-BJ3KTMDH.js';
|
|
6
6
|
import { PLAIN_VERSION, recordCliVersion, removeRecordedVersion } from './chunk-Z7J7JWGF.js';
|
|
7
7
|
import { cliInvocation } from './chunk-FZKNTIOJ.js';
|