@outerlayer/cli 0.34.0-next.20261028183303 → 0.34.0-next.20261029100612
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/README.md +7 -0
- package/dist/agent-setup-UPIHHKI2.js +32 -0
- package/dist/{artifact-link-cmd-CSVFEM5O.js → artifact-link-cmd-6LFCTDBD.js} +5 -5
- package/dist/{bridge-4GRZFXJU.js → bridge-XM4QLKIX.js} +2 -2
- package/dist/{build-SEJJWGTO.js → build-UBZNVGY2.js} +10 -10
- package/dist/{build-disk-EYRR3PBT.js → build-disk-Y3MMWFYE.js} +7 -7
- package/dist/build-info.json +1 -1
- package/dist/{builder-T7B46P7T.js → builder-SX4W5VF3.js} +6 -6
- package/dist/caller-IIA2TPAA.js +18 -0
- package/dist/{check-VKSOYRNI.js → check-PVB3GPFQ.js} +88 -70
- package/dist/{chunk-ANPNT6PM.js → chunk-2AM6Z5BP.js} +1 -1
- package/dist/{chunk-3UIXIGYT.js → chunk-2B6EKUBD.js} +4 -4
- package/dist/{chunk-QGDGGLSD.js → chunk-2F43WNKI.js} +3 -3
- package/dist/{chunk-UZEIBWTP.js → chunk-2OE4BZRF.js} +8 -8
- package/dist/{chunk-VNVZDWO3.js → chunk-352DHUTP.js} +4 -1
- package/dist/{chunk-W7E6IMEW.js → chunk-3EEJGQEJ.js} +22 -21
- package/dist/{chunk-5W2YSWIW.js → chunk-4PH4DVV4.js} +1 -1
- package/dist/{chunk-WH3FPBPO.js → chunk-4PWOZU7R.js} +82 -33
- package/dist/{chunk-ZJSNLVCE.js → chunk-545P7JY7.js} +1 -1
- package/dist/{chunk-RRXS4CWE.js → chunk-5C7QZBLI.js} +9 -7
- package/dist/{chunk-2EEW6FJN.js → chunk-5FWBAM6O.js} +1 -1
- package/dist/{chunk-T2Q7ISPE.js → chunk-5WYT3PPE.js} +1 -1
- package/dist/{chunk-ARL6X6Y4.js → chunk-62TMOXQN.js} +2 -2
- package/dist/{chunk-EA2PQRCU.js → chunk-7CIU64OH.js} +6 -6
- package/dist/{chunk-AF4E4I4T.js → chunk-7G35LX5D.js} +11 -11
- package/dist/{chunk-KH4774QT.js → chunk-7R655ODT.js} +1 -1
- package/dist/{chunk-G2JWZDFA.js → chunk-A2LHHKTT.js} +3 -3
- package/dist/{chunk-ESVW4MJY.js → chunk-AAGU5FJF.js} +1 -1
- package/dist/{chunk-QGEGLZSY.js → chunk-ADI2CCDX.js} +47 -7
- package/dist/{chunk-I2MFIT6X.js → chunk-AGMR4IQE.js} +29 -28
- package/dist/{chunk-SAAVZ2BX.js → chunk-AUVJMR3P.js} +1 -1
- package/dist/{chunk-HFOZTCTN.js → chunk-AVHPSB65.js} +7 -7
- package/dist/{chunk-KQDK4Q6A.js → chunk-CDVG2LXT.js} +10 -10
- package/dist/{chunk-TUSYOL2O.js → chunk-CJPTUU2E.js} +1 -1
- package/dist/{chunk-OYQVLQP3.js → chunk-EQ5Y2OMK.js} +16 -14
- package/dist/{chunk-MH6QLXUO.js → chunk-FJ7KTNMD.js} +1 -1
- package/dist/{chunk-KPEMNHVF.js → chunk-FNKCMOQY.js} +3 -3
- package/dist/{chunk-2O5KA67H.js → chunk-FUJUFLDC.js} +2 -2
- package/dist/{chunk-CRB3POP4.js → chunk-FZKNTIOJ.js} +1 -1
- package/dist/{chunk-YLPJOUVF.js → chunk-GANAOCHR.js} +6 -1
- package/dist/{chunk-3KGXXTMN.js → chunk-GBMTKV5B.js} +5 -5
- package/dist/{chunk-POND2SMT.js → chunk-H2GESWLW.js} +3 -3
- package/dist/{chunk-DCBFUUDL.js → chunk-HERRKKES.js} +7 -7
- package/dist/{chunk-V2S2WRGD.js → chunk-HS5QEIJT.js} +11 -11
- package/dist/{chunk-PJDQPF5N.js → chunk-HWVMRETT.js} +1 -1
- package/dist/{chunk-H7MGR2GN.js → chunk-IUPYSGCP.js} +6 -6
- package/dist/{chunk-7JSWRF5O.js → chunk-JFALOM5G.js} +10 -10
- package/dist/{chunk-XDAMLX2L.js → chunk-JQOET7TF.js} +9 -9
- package/dist/{chunk-RQ3GCCHH.js → chunk-JXXMOAJG.js} +2 -2
- package/dist/{chunk-URIZRCRY.js → chunk-KYDEBGJG.js} +1 -1
- package/dist/{chunk-GG5OE6MY.js → chunk-KZUHEN26.js} +2 -2
- package/dist/{chunk-2EHDLYSL.js → chunk-LFXLFDEA.js} +30 -22
- package/dist/chunk-LW2A24IA.js +31 -0
- package/dist/{chunk-BBJ6BM5U.js → chunk-MKSZHT6S.js} +1 -1
- package/dist/{chunk-VX7WZK7J.js → chunk-MOG4XCYS.js} +189 -121
- package/dist/{chunk-P2PNBDUT.js → chunk-NM3L4JBB.js} +4 -4
- package/dist/{chunk-TDCHUEKY.js → chunk-O7CGRDRQ.js} +5 -5
- package/dist/{chunk-KT4CN6OU.js → chunk-OHQMGLJP.js} +3 -3
- package/dist/{chunk-5BHIBJDA.js → chunk-OLM2TIOW.js} +1 -1
- package/dist/{chunk-VEVNGDTP.js → chunk-PDK35AR4.js} +2 -2
- package/dist/{chunk-RPST2GNG.js → chunk-PQ5YDDDE.js} +3 -3
- package/dist/{chunk-OKJXZXYH.js → chunk-PUSCE544.js} +6 -6
- package/dist/{chunk-ZEFNJCN3.js → chunk-QM3HMXMU.js} +2 -2
- package/dist/chunk-RW3YMQVQ.js +39 -0
- package/dist/{chunk-ZCZY3Q55.js → chunk-SHPCVBT3.js} +1 -1
- package/dist/{chunk-UXC3RQLF.js → chunk-SQGD4LYW.js} +1 -1
- package/dist/{chunk-LJEZGHCH.js → chunk-SYCZTZXD.js} +647 -211
- package/dist/{chunk-4YD7N6V3.js → chunk-TKTVKEES.js} +4 -4
- package/dist/{chunk-GH2HEEOH.js → chunk-TV2OQUWE.js} +1 -1
- package/dist/{chunk-MRLJK4GZ.js → chunk-UGPJIKN4.js} +6 -6
- package/dist/{chunk-HH3BQG65.js → chunk-UPRZREBO.js} +1 -1
- package/dist/{chunk-ROQPDCRU.js → chunk-UZGQT6OF.js} +1 -1
- package/dist/{chunk-NCOL5RYI.js → chunk-VNHBDHX7.js} +1 -1
- package/dist/{chunk-64O2NUVA.js → chunk-VO46IHB4.js} +8 -7
- package/dist/{chunk-MCPCOKHN.js → chunk-W74HQLLZ.js} +9 -9
- package/dist/{chunk-ZCA34T7R.js → chunk-WDDVPDLQ.js} +8 -8
- package/dist/{chunk-YF7W7B7Y.js → chunk-WDIZT56W.js} +38 -11
- package/dist/{chunk-CUAB7FAZ.js → chunk-WG3VIMD2.js} +8 -8
- package/dist/{chunk-IAVT7R6O.js → chunk-WJTIU2A5.js} +6 -6
- package/dist/{chunk-NXUZFHMX.js → chunk-WK4OTIAN.js} +3 -3
- package/dist/{chunk-T3XPLCJG.js → chunk-XBECMHJW.js} +1 -1
- package/dist/{chunk-54LIUIZL.js → chunk-XGSJNXH2.js} +4 -4
- package/dist/{chunk-5TXQFZHY.js → chunk-XU5BNWX7.js} +1 -1
- package/dist/{chunk-I7RZHMXW.js → chunk-YBAVN6WS.js} +3 -3
- package/dist/{chunk-ZTOJIRJH.js → chunk-YBP22LDO.js} +8 -8
- package/dist/{chunk-S6UM3N4R.js → chunk-YQHUCOUL.js} +37 -12
- package/dist/{chunk-IXRUVR25.js → chunk-YTTESG7K.js} +46 -7
- package/dist/{chunk-CKDSPW35.js → chunk-ZI2E4YMY.js} +6 -6
- package/dist/{chunk-MEIDQLXQ.js → chunk-ZI7JENTB.js} +1 -1
- package/dist/{claude-launcher-7IC6QWR5.js → claude-launcher-MMCKOBND.js} +6 -6
- package/dist/{cli-HBS2PXSS.js → cli-W4B35KDN.js} +165 -155
- package/dist/{cli-update-notice-4DLZ3655.js → cli-update-notice-T3CXRWNB.js} +3 -3
- package/dist/{command-XA6DOFL4.js → command-SKJHW4C4.js} +43 -42
- package/dist/{config-RSOCVUKC.js → config-ZDENMTEW.js} +9 -9
- package/dist/connect-cmd-APZN6F6N.js +27 -0
- package/dist/{container-start-PYW7W2N2.js → container-start-PAUJUXJX.js} +57 -56
- package/dist/{context-cleanup-CEZSKNVL.js → context-cleanup-PASDUBGW.js} +5 -5
- package/dist/{context-show-cmd-XWLTP6R4.js → context-show-cmd-OWREGUJL.js} +19 -19
- package/dist/{control-plane-launch-3MBWPYWZ.js → control-plane-launch-FV5Q6GVJ.js} +16 -16
- package/dist/{demo-record-cmd-SIKNTSGI.js → demo-record-cmd-KXLLIMOP.js} +5 -5
- package/dist/{demo-voice-cmd-SAB3QU4F.js → demo-voice-cmd-TY2OX2CZ.js} +30 -30
- package/dist/{dist-VPXROEZO.js → dist-Z6WP743R.js} +2 -2
- package/dist/{docker-YMRPMDOW.js → docker-SKD6VTBD.js} +6 -6
- package/dist/{doctor-NVHAE4LS.js → doctor-DX6N3L5T.js} +53 -42
- package/dist/emit-artifact-cmd-NFAASCXW.js +43 -0
- package/dist/emit-cmd-UOPHEUW5.js +16 -0
- package/dist/emit-criteria-cmd-TX4LKO5X.js +33 -0
- package/dist/emit-demo-cmd-FRJFQKED.js +47 -0
- package/dist/emit-finding-cmd-LO2AKL4P.js +34 -0
- package/dist/{emit-result-cmd-VCKNZ4RZ.js → emit-result-cmd-7PL4HNXL.js} +28 -28
- package/dist/emit-step-cmd-RZT6VK5U.js +33 -0
- package/dist/{exec-client-U4544U2S.js → exec-client-UHL7WPDO.js} +3 -3
- package/dist/find-unit-IBL736HQ.js +19 -0
- package/dist/{findings-cmd-PLHBAQW4.js → findings-cmd-MEU7GDRC.js} +23 -23
- package/dist/fleet-readiness-4RNICYSP.js +28 -0
- package/dist/governing-source-6DH2NLPE.js +38 -0
- package/dist/{guest-init-MI4SEME4.js → guest-init-2TTQKFFZ.js} +4 -4
- package/dist/{hook-fast-GOH4T6SN.js → hook-fast-5PNO5HRO.js} +6 -6
- package/dist/{hook-wrap-fast-7VYYAAH4.js → hook-wrap-fast-545QJSBJ.js} +3 -3
- package/dist/host-checks-FWPDGTWF.js +78 -0
- package/dist/{host-key-OMLDWLNG.js → host-key-Q5DEAP3Q.js} +3 -3
- package/dist/{image-tag-YJJONB64.js → image-tag-JWATDMIZ.js} +3 -3
- package/dist/index.js +6 -6
- package/dist/init-DWOODP2Q.js +57 -0
- package/dist/{init-W3ATJYLX.js → init-GF43ZLZI.js} +39 -38
- package/dist/{init-cmd-XJOEU2PB.js → init-cmd-LW4TECQH.js} +33 -33
- package/dist/{init-update-KX3FFQ5H.js → init-update-5PTU5IE6.js} +30 -30
- package/dist/{install-cmd-QTIIMO6B.js → install-cmd-ZEFBJH24.js} +5 -5
- package/dist/{layout-7UOBWNYO.js → layout-ZE6F2Z7W.js} +4 -4
- package/dist/login-browser-YB7AMKHR.js +13 -0
- package/dist/{logout-cmd-5WE2N5B5.js → logout-cmd-Z2PYV5LF.js} +5 -5
- package/dist/{logs-YVXVAYTD.js → logs-3YRC7HRA.js} +23 -3
- package/dist/loop-UBAR3KBZ.js +89 -0
- package/dist/machine-H4Y5X424.js +57 -0
- package/dist/{machine-skills-KYN7XJEJ.js → machine-skills-DMHU7OLO.js} +5 -5
- package/dist/{mcp-install-cmd-LD7KYAOP.js → mcp-install-cmd-23ZY4IBK.js} +5 -5
- package/dist/{mcp-serve-cmd-ECTAPDB3.js → mcp-serve-cmd-PKXIHUOX.js} +9 -9
- package/dist/{paths-M66LPPUF.js → paths-7PC3K7C3.js} +2 -2
- package/dist/{pending-7LC6XDRO.js → pending-2VIIFAP4.js} +3 -3
- package/dist/{pidfile-DSQOOAZV.js → pidfile-KQ2EJABZ.js} +3 -3
- package/dist/{record-3KKIJ3XL.js → record-IHEF6C33.js} +3 -3
- package/dist/{runner-env-EX7YUIUH.js → runner-env-KCZBSWOB.js} +11 -11
- package/dist/{runner-identity-LJWBXNM5.js → runner-identity-D5HQ22D3.js} +6 -6
- package/dist/{runner-key-CAUO4RKG.js → runner-key-N5YEMI3S.js} +38 -37
- package/dist/session-sender-GJEVFQVN.js +43 -0
- package/dist/{settings-3DBYKYQD.js → settings-XB2HYBKO.js} +2 -2
- package/dist/{spec-cmd-SAWQYHKM.js → spec-cmd-BRTO5J2C.js} +23 -23
- package/dist/{starter-pack-KB3YH4KX.js → starter-pack-WUNNS6G7.js} +9 -9
- package/dist/state-FJPSFOID.js +9 -0
- package/dist/{status-VMFS7N6A.js → status-UPEZZYCT.js} +78 -56
- package/dist/{statusline-fast-YVHG6ZLX.js → statusline-fast-E7RWVREA.js} +4 -4
- package/dist/sync-cmd-EO4TP2K7.js +42 -0
- package/dist/update-steps-46FCWHJZ.js +79 -0
- package/dist/{watch-6NRBX6VE.js → watch-EG6MYI3O.js} +28 -28
- package/dist/{work-claim-cmd-SLVX2N4L.js → work-claim-cmd-MPH5HFLT.js} +26 -26
- package/dist/work-cmd-PKEAVXJC.js +31 -0
- package/dist/work-comment-cmd-7IEOLOOK.js +32 -0
- package/dist/{work-demo-cmd-SZJIKB5J.js → work-demo-cmd-GKMBBMMM.js} +20 -20
- package/dist/{work-launch-LEQ2MPM3.js → work-launch-TTGSHLY4.js} +3 -3
- package/dist/{work-logs-cmd-MRFSBMJM.js → work-logs-cmd-44ZOKO5E.js} +20 -20
- package/dist/{work-open-pr-cmd-N7GK7FUQ.js → work-open-pr-cmd-YYQLQ7DN.js} +22 -22
- package/dist/work-pr-cmd-ILCIO22W.js +32 -0
- package/dist/work-proofs-cmd-S7HZNVFC.js +35 -0
- package/dist/{work-proofs-record-JD4DNZUW.js → work-proofs-record-RJMR37XG.js} +34 -34
- package/dist/{work-stop-cmd-M6RIGF7S.js → work-stop-cmd-5VPW7HOZ.js} +20 -20
- package/package.json +1 -1
- package/dist/agent-setup-IVXRBFVV.js +0 -32
- package/dist/connect-cmd-JFGDHFLA.js +0 -27
- package/dist/emit-artifact-cmd-TZTVQCFT.js +0 -43
- package/dist/emit-cmd-4G3443OJ.js +0 -16
- package/dist/emit-criteria-cmd-WH7JB4RQ.js +0 -33
- package/dist/emit-demo-cmd-DNUVG5N7.js +0 -47
- package/dist/emit-finding-cmd-X5CBH4ZA.js +0 -34
- package/dist/emit-step-cmd-IUXZZYKO.js +0 -33
- package/dist/find-unit-QYD2FMCP.js +0 -19
- package/dist/fleet-readiness-F65CKZY5.js +0 -28
- package/dist/governing-source-JFCTQXYK.js +0 -38
- package/dist/host-checks-HC4XXGAD.js +0 -77
- package/dist/init-JVKJTJNM.js +0 -56
- package/dist/login-browser-Q25ZNSQ3.js +0 -13
- package/dist/loop-GBTANKUW.js +0 -87
- package/dist/machine-OQOHEMJB.js +0 -56
- package/dist/session-sender-U2CTD7EX.js +0 -43
- package/dist/sync-cmd-EBJQ5LMH.js +0 -42
- package/dist/update-steps-HMSVBDKH.js +0 -78
- package/dist/work-cmd-VSHZCXHQ.js +0 -31
- package/dist/work-comment-cmd-3DCL7VHN.js +0 -32
- package/dist/work-pr-cmd-HD5OIHUU.js +0 -32
- package/dist/work-proofs-cmd-GFGENBGN.js +0 -35
|
@@ -1,36 +1,37 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { itemsSentence, criteriaOf, hostItemsOf, loadCitationFinder, testFileMatcher, MAX_TEST_FILE_BYTES, MAX_TEST_FILES, criterionInputs, uncitedIds, planCriteria, parseJudgeAnswer, inCriteriaOrder, oneLineReason, judgedItems, IdScan, firstInPathOrder, isSearchCandidate } from './chunk-
|
|
3
|
+
import { itemsSentence, criteriaOf, hostItemsOf, loadCitationFinder, testFileMatcher, MAX_TEST_FILE_BYTES, MAX_TEST_FILES, criterionInputs, uncitedIds, planCriteria, parseJudgeAnswer, inCriteriaOrder, oneLineReason, judgedItems, IdScan, firstInPathOrder, isSearchCandidate } from './chunk-2B6EKUBD.js';
|
|
4
4
|
import { readsJobState, READ_JOB_STATE_FORMATS, jobStateFormatOf } from './chunk-ZVB57WI6.js';
|
|
5
|
-
import { HELPER_PATH, DOCKERD_LOG, HELPER_RECORD } from './chunk-
|
|
5
|
+
import { HELPER_PATH, DOCKERD_LOG, HELPER_RECORD } from './chunk-H2GESWLW.js';
|
|
6
|
+
import { writeDockerClientConfig } from './chunk-MKSZHT6S.js';
|
|
6
7
|
import { zodProblem } from './chunk-I3LTIAOR.js';
|
|
7
|
-
import { senderPidfile } from './chunk-
|
|
8
|
-
import { installScrubContext } from './chunk-
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { fetchCommit, readBranchHead, diffBetween } from './chunk-OYQVLQP3.js';
|
|
13
|
-
import { waitForAgent, vmExecArgs } from './chunk-5W2YSWIW.js';
|
|
14
|
-
import { socketPathProblem, vsockLinks, LEASE_LINK, linkVsockSockets } from './chunk-ROQPDCRU.js';
|
|
15
|
-
import { describeCallFailure, resolveGoverningSource, prefetchGovernedContext, refusalCode, removeStagedContext, stageGovernedContext, pinnedSourceOf, commandWithShim, logStamp, createRunnerLog, formatDuration, removeKeptContext, retrySend, formatClock, keptContextTree, WORKFLOW_PERMISSION_REASON } from './chunk-DCBFUUDL.js';
|
|
16
|
-
import { imageBuildOf, isBuiltinContainer, isBuiltinProcess, isBuiltinVm, egressSummary, DEFAULT_CHECK_TIME_LIMIT_MINUTES, optionalEgress } from './chunk-YF7W7B7Y.js';
|
|
17
|
-
import { formatBytes, DEFAULT_CACHE_DISK, allocatedBytes } from './chunk-RRXS4CWE.js';
|
|
18
|
-
import { HASH_ARGV, parseProgramHash, JUDGE_PROGRAM, writeJobFile, readJobFile, parseSize, identityScript, identityArgs, parseIdentity, mountableHome, homeCopyScript, homeCopyArgs, childEnvironment, withAnswerProtocol, judgeCommand, MAX_REPORT_BYTES, JUDGE_MAX_TURNS, JUDGE_DIR, COMMAND_DIR, MAX_ITEMS_BYTES } from './chunk-P2PNBDUT.js';
|
|
19
|
-
import { CLAUDE_CODE_VERSION, FIRECRACKER_VERSION } from './chunk-D3CT6XQ4.js';
|
|
8
|
+
import { senderPidfile } from './chunk-O7CGRDRQ.js';
|
|
9
|
+
import { installScrubContext } from './chunk-AGMR4IQE.js';
|
|
10
|
+
import { upgradedStarterText } from './chunk-WJTIU2A5.js';
|
|
11
|
+
import { ADDED_USER, shellQuote, GH_CONFIG_YML, ghHostsYml, firstLine, provisionWithFreshFallback, itemTag, hasClaudeCredential, AssetError, obtainImage, taggedLog, planSavedState, clockOf, savedStateBase, savedStatesDir, ensureRootfs, makeBuildsDirPrivate, gitRemoteFor, startServicesFor, createLeaseChannel, createBuildDisk, machineConfig, startJailedInto, resolveAgentUser, AgentUserError, agentUidOf, userIdChangedReason, runBuildSteps, setupInputFor, runtimeStepInput, settleFailedSteps, keepRuntimeStep, keepMissingSetupScripts, createContainerRuntime, containerSenderCommand, hostCommandEnvironment, execArgv, signalInContainer, startHostServices, LEASE_SECONDS, itemScope, managedBuildSettingsFor, stopContainer, cleanupContainer, recordProofsInContainer, PROOFS_LOG, outOfMemoryReason, closeHostBuild, dropManagedClaudeKey, dropManagedBuildSettings, startCheckContainer, ranRuntimeStep, provisionRuntimes, lifecycleSteps, lifecycleFailureReason, runSetupScripts, writeEvalInput, DeliveryFailure, EVAL_INPUT_NAME, syncInContainer, copyTranscriptsFromContainer, senderAliveScript, discardUnusableState, MANAGED_UNJAILED_REASON, uidFromProbe, saveAndPrune, managedMachineLimits, withFactoryHosts, helperFirecrackerNote, said, managedClaudeKeyValuesFor, managedBuildSettingValuesFor, managedClaudeKeyValues, managedBuildSettingValues, stopJailed, deleteBuildDisk, RECORD_PROOFS_ARGV, managedClaudeKeyFor, ROOT_DISK_ID_PREFIX, copyTranscripts, writeRecord, containerJudgeEnvironment, deleteRecord, senderSignalScript, copyJudgeTree } from './chunk-4PWOZU7R.js';
|
|
12
|
+
import { fetchCommit, readBranchHead, diffBetween } from './chunk-EQ5Y2OMK.js';
|
|
20
13
|
import { isSameProcess, startTimeOf } from './chunk-JBJTC3UU.js';
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
14
|
+
import { waitForAgent, vmExecArgs } from './chunk-4PH4DVV4.js';
|
|
15
|
+
import { socketPathProblem, vsockLinks, LEASE_LINK, linkVsockSockets } from './chunk-UZGQT6OF.js';
|
|
16
|
+
import { describeCallFailure, resolveGoverningSource, prefetchGovernedContext, refusalCode, removeStagedContext, stageGovernedContext, pinnedSourceOf, commandWithShim, logStamp, createRunnerLog, formatDuration, removeKeptContext, retrySend, formatClock, keptContextTree, WORKFLOW_PERMISSION_REASON } from './chunk-HERRKKES.js';
|
|
17
|
+
import { claimCalls, spoolHomeFor, itemCalls, claimItem, leftByRunnerKey } from './chunk-RW3YMQVQ.js';
|
|
18
|
+
import { imageBuildOf, isBuiltinContainer, isBuiltinProcess, isBuiltinVm, egressSummary, DEFAULT_CHECK_TIME_LIMIT_MINUTES, DEFAULT_SETUP_MINUTES, optionalEgress } from './chunk-WDIZT56W.js';
|
|
19
|
+
import { formatBytes, DEFAULT_CACHE_DISK, allocatedBytes } from './chunk-5C7QZBLI.js';
|
|
20
|
+
import { HASH_ARGV, parseProgramHash, JUDGE_PROGRAM, writeJobFile, readJobFile, parseSize, identityScript, identityArgs, parseIdentity, mountableHome, homeCopyScript, homeCopyArgs, childEnvironment, withAnswerProtocol, judgeCommand, MAX_REPORT_BYTES, JUDGE_MAX_TURNS, JUDGE_DIR, COMMAND_DIR, MAX_ITEMS_BYTES } from './chunk-NM3L4JBB.js';
|
|
21
|
+
import { CLAUDE_CODE_VERSION, FIRECRACKER_VERSION } from './chunk-D3CT6XQ4.js';
|
|
22
|
+
import { WorkCommandError, postJson, isSignatureRefusal, getJson } from './chunk-JQOET7TF.js';
|
|
23
|
+
import { planArtifactUpload } from './chunk-PDK35AR4.js';
|
|
24
|
+
import { readCloudConfig } from './chunk-HWVMRETT.js';
|
|
25
|
+
import { signerFor } from './chunk-XU5BNWX7.js';
|
|
26
|
+
import { AGENTS_SKILLS_BASE, OUTERLAYER_SKILLS_BASE, resolvePackRoot } from './chunk-UPRZREBO.js';
|
|
27
|
+
import { scrubText } from './chunk-TV2OQUWE.js';
|
|
27
28
|
import { MAINTAINED_SKILLS } from './chunk-CDDED64E.js';
|
|
28
29
|
import { resolveVersion } from './chunk-RA3O54FC.js';
|
|
29
|
-
import { parsePolicy } from './chunk-
|
|
30
|
-
import { CheckItemsSchema } from './chunk-
|
|
31
|
-
import { homeFromEnv } from './chunk-
|
|
32
|
-
import { RUNNER_FILE_MODE, runnerDir, buildDir, vsockPath, jobConsolePath } from './chunk-
|
|
33
|
-
import { JOB_MOUNT, repositoriesOf, primaryOf, buildEnvironment, CHECKOUT_DIR, claudeCredential, AGENT_CREDENTIAL_MISSING, sharedUserEnvironment, headerVariables, authorEnvironment, withTunnelRecord, commitIdentityRecord, RELAY_PORT, repositoryPath, lifecycleWorkdir, CHECK_ITEMS_FILE, fdName, BUILD_HOME, CLAUDE_CREDENTIAL_VARIABLES, currentClaudeCredential, removedClaudeCredentialValues, managedClaudeCredential, checkEnvironment,
|
|
30
|
+
import { parsePolicy } from './chunk-5FWBAM6O.js';
|
|
31
|
+
import { CheckItemsSchema } from './chunk-YTTESG7K.js';
|
|
32
|
+
import { homeFromEnv } from './chunk-352DHUTP.js';
|
|
33
|
+
import { RUNNER_FILE_MODE, runnerDir, buildDir, orgStoreIn, vsockPath, jobConsolePath, orgHomeDir } from './chunk-YQHUCOUL.js';
|
|
34
|
+
import { JOB_MOUNT, repositoriesOf, primaryOf, buildEnvironment, CHECKOUT_DIR, claudeCredential, AGENT_CREDENTIAL_MISSING, sharedUserEnvironment, headerVariables, authorEnvironment, withTunnelRecord, commitIdentityRecord, RELAY_PORT, repositoryPath, lifecycleWorkdir, CHECK_ITEMS_FILE, fdName, BUILD_HOME, CLAUDE_CREDENTIAL_VARIABLES, currentClaudeCredential, removedClaudeCredentialValues, managedClaudeCredential, checkEnvironment, EVAL_INPUT_DIR, withMiseVariables } from './chunk-GANAOCHR.js';
|
|
34
35
|
import { RUNNER_WORDED_REASONS, UNKNOWN_TRACKING_REASON } from './chunk-MESOOLF4.js';
|
|
35
36
|
import { randomBytes, createHash } from 'crypto';
|
|
36
37
|
import { rmSync, existsSync, statSync, appendFileSync, mkdirSync, chmodSync, writeFileSync, openSync, closeSync, readFileSync, readdirSync, createReadStream, lstatSync, realpathSync, writeSync, renameSync, fstatSync, readSync } from 'fs';
|
|
@@ -311,14 +312,18 @@ function guestPortFor(runtime, state) {
|
|
|
311
312
|
stream: (argv, io) => runtime.vm.execStream(state.vsockPath, { argv, user: "root", cwd: "/", env: { PATH: ROOT_PATH } }, io)
|
|
312
313
|
};
|
|
313
314
|
}
|
|
314
|
-
function
|
|
315
|
+
function guestExecFor(input) {
|
|
315
316
|
return async (argv, workdir, opts) => {
|
|
316
317
|
const signal = opts?.timeoutMs === void 0 ? void 0 : AbortSignal.timeout(opts.timeoutMs);
|
|
317
318
|
const ran = await input.vm.exec(input.vsockPath, input.request(argv, workdir, opts?.variables), signal === void 0 ? void 0 : { signal });
|
|
318
|
-
if (opts?.
|
|
319
|
+
if (opts?.logPath !== void 0) appendFileSync(opts.logPath, ran.stdout + ran.stderr);
|
|
319
320
|
return signal?.aborted === true ? { ...ran, timedOut: true } : ran;
|
|
320
321
|
};
|
|
321
322
|
}
|
|
323
|
+
function stepExecFor(input) {
|
|
324
|
+
const exec = guestExecFor(input);
|
|
325
|
+
return (argv, workdir, opts) => exec(argv, workdir, { ...opts?.quiet === true ? {} : { logPath: input.logPath }, timeoutMs: opts?.timeoutMs, variables: opts?.variables });
|
|
326
|
+
}
|
|
322
327
|
function asRoot(runtime, state, argv, stdin) {
|
|
323
328
|
return runtime.vm.exec(state.vsockPath, { argv, user: "root", cwd: "/", env: { PATH: ROOT_PATH } }, stdin === void 0 ? void 0 : { stdin });
|
|
324
329
|
}
|
|
@@ -428,7 +433,7 @@ async function provisionMicroVm(input) {
|
|
|
428
433
|
async function provisionMicroVmOnce(input, allowRestore) {
|
|
429
434
|
const { config, runtime, item, itemKey, jobDir, log, tokens } = input;
|
|
430
435
|
const { vm } = runtime;
|
|
431
|
-
const tag =
|
|
436
|
+
const tag = itemTag({ item: item.number, organizationId: input.organizationId, claimId: input.claimId });
|
|
432
437
|
const logPath = join(jobDir, "provision.log");
|
|
433
438
|
const fail = (reason) => ({ ok: false, reason });
|
|
434
439
|
if (!hasClaudeCredential(config, runtime.hostEnv, jobDir)) return fail(AGENT_CREDENTIAL_MISSING);
|
|
@@ -452,6 +457,7 @@ async function provisionMicroVmOnce(input, allowRestore) {
|
|
|
452
457
|
if (governingSource.kind === "governed") {
|
|
453
458
|
const unfetched = await prefetchGovernedContext({
|
|
454
459
|
configPath: config.configPath,
|
|
460
|
+
...input.organizationId === void 0 ? {} : { organizationId: input.organizationId },
|
|
455
461
|
repository,
|
|
456
462
|
source: governingSource,
|
|
457
463
|
controlPlaneUrl,
|
|
@@ -476,6 +482,7 @@ async function provisionMicroVmOnce(input, allowRestore) {
|
|
|
476
482
|
repository: governingSource.kind === "governed" ? governingSource.repository : repository,
|
|
477
483
|
pinned: governingSource.kind === "governed" ? { commit: governingSource.sha, ref: governingSource.ref } : void 0,
|
|
478
484
|
governedRepository: repository,
|
|
485
|
+
...input.organizationId === void 0 ? {} : { organizationId: input.organizationId },
|
|
479
486
|
tag,
|
|
480
487
|
log,
|
|
481
488
|
aborted: input.aborted,
|
|
@@ -564,7 +571,7 @@ async function provisionMicroVmOnce(input, allowRestore) {
|
|
|
564
571
|
imageConfig = { env: madeInBuilder.env, user: madeInBuilder.user };
|
|
565
572
|
} else {
|
|
566
573
|
try {
|
|
567
|
-
state.rootfs = await ensureRootfs({ host: vm.rootfs, runnerDir: runnerDirPath, imageId: report.imageId, memoryBytes: limits.memoryBytes });
|
|
574
|
+
state.rootfs = await ensureRootfs({ host: vm.rootfs, runnerDir: orgStoreIn(runnerDirPath, input.organizationId), imageId: report.imageId, memoryBytes: limits.memoryBytes });
|
|
568
575
|
imageConfig = await vm.rootfs.imageConfig(report.imageId);
|
|
569
576
|
} catch (err) {
|
|
570
577
|
return bail(`the image could not be converted to a root disk: ${describeCallFailure(err)}`);
|
|
@@ -580,7 +587,7 @@ async function provisionMicroVmOnce(input, allowRestore) {
|
|
|
580
587
|
makeBuildsDirPrivate(buildDir2);
|
|
581
588
|
let services;
|
|
582
589
|
try {
|
|
583
|
-
const gitRemote = gitRemoteFor(runtime, { repositories, tokens, buildDir: buildDir2, log: (line) => log.line(`${tag} ${line}`) });
|
|
590
|
+
const gitRemote = gitRemoteFor(runtime, { repositories, tokens, buildDir: buildDir2, organizationId: input.organizationId, log: (line) => log.line(`${tag} ${line}`) });
|
|
584
591
|
services = await startServicesFor(runtime, config, buildDir2, jobDir, itemKey, true, gitRemote, "socket", void 0, void 0, (line) => log.line(`${tag} ${line}`));
|
|
585
592
|
runtime.tunnels.set(buildId, services);
|
|
586
593
|
} catch (err) {
|
|
@@ -759,6 +766,7 @@ async function provisionMicroVmOnce(input, allowRestore) {
|
|
|
759
766
|
aborted: input.aborted,
|
|
760
767
|
stageContext: () => stageGovernedContext({
|
|
761
768
|
config,
|
|
769
|
+
...input.organizationId === void 0 ? {} : { organizationId: input.organizationId },
|
|
762
770
|
repository,
|
|
763
771
|
source: pinnedSourceOf(governingSource),
|
|
764
772
|
buildId,
|
|
@@ -825,7 +833,7 @@ function agentVersionOf(toolsJson) {
|
|
|
825
833
|
function vmExecFor(input, argv) {
|
|
826
834
|
const state = input.job.microvm;
|
|
827
835
|
const env = buildEnvironment({
|
|
828
|
-
config: input.config,
|
|
836
|
+
config: claimCalls(input.config, input.job),
|
|
829
837
|
item: input.job.item,
|
|
830
838
|
itemKey: input.job.itemKey,
|
|
831
839
|
branch: input.job.branch,
|
|
@@ -857,7 +865,7 @@ function microVmCommandLine(input) {
|
|
|
857
865
|
async function startMicroVmCommand(input) {
|
|
858
866
|
const state = input.job.microvm;
|
|
859
867
|
const env = buildEnvironment({
|
|
860
|
-
config: input.config,
|
|
868
|
+
config: claimCalls(input.config, input.job),
|
|
861
869
|
item: input.job.item,
|
|
862
870
|
itemKey: input.job.itemKey,
|
|
863
871
|
branch: input.job.branch,
|
|
@@ -908,7 +916,7 @@ async function runCliInMicroVm(input, argv, logName, goneReason) {
|
|
|
908
916
|
if (!isRunning(runtime, state)) return { ok: false, reason: goneReason };
|
|
909
917
|
try {
|
|
910
918
|
const env = buildEnvironment({
|
|
911
|
-
config: input.config,
|
|
919
|
+
config: claimCalls(input.config, job),
|
|
912
920
|
item: job.item,
|
|
913
921
|
itemKey: job.itemKey,
|
|
914
922
|
branch: job.branch,
|
|
@@ -1044,7 +1052,7 @@ function microVmJudgeEnvironment(input) {
|
|
|
1044
1052
|
async function startCheckMicroVm(input) {
|
|
1045
1053
|
const { config, runtime, job, jobDir, tokens, log } = input;
|
|
1046
1054
|
const { vm } = runtime;
|
|
1047
|
-
const tag =
|
|
1055
|
+
const tag = `${itemTag(job)}`;
|
|
1048
1056
|
const limits = machineLimits(config, jobDir);
|
|
1049
1057
|
const built = job.microvm;
|
|
1050
1058
|
const repository = built?.repository ?? job.repository;
|
|
@@ -1096,7 +1104,7 @@ async function startCheckMicroVm(input) {
|
|
|
1096
1104
|
state.rootfs = built.rootfs;
|
|
1097
1105
|
} else {
|
|
1098
1106
|
try {
|
|
1099
|
-
state.rootfs = await ensureRootfs({ host: vm.rootfs, runnerDir: runnerDirPath, imageId: built.imageId, memoryBytes: limits.memoryBytes });
|
|
1107
|
+
state.rootfs = await ensureRootfs({ host: vm.rootfs, runnerDir: orgStoreIn(runnerDirPath, job.organizationId), imageId: built.imageId, memoryBytes: limits.memoryBytes });
|
|
1100
1108
|
} catch (err) {
|
|
1101
1109
|
return fail(`the image could not be converted to a root disk: ${describeCallFailure(err)}`);
|
|
1102
1110
|
}
|
|
@@ -1111,6 +1119,7 @@ async function startCheckMicroVm(input) {
|
|
|
1111
1119
|
repositories: repositoriesOf({ repositories: job.repositories, repository, branch }),
|
|
1112
1120
|
tokens,
|
|
1113
1121
|
buildDir: buildDir2,
|
|
1122
|
+
organizationId: job.organizationId,
|
|
1114
1123
|
log: (line) => log.line(`${tag} ${line}`),
|
|
1115
1124
|
readOnly: true
|
|
1116
1125
|
});
|
|
@@ -1204,11 +1213,11 @@ async function startCheckMicroVm(input) {
|
|
|
1204
1213
|
environment: {
|
|
1205
1214
|
state,
|
|
1206
1215
|
evalInput: { dir: evalInput.dir, deliver: deliverEvalInput },
|
|
1207
|
-
exec:
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
},
|
|
1216
|
+
exec: guestExecFor({
|
|
1217
|
+
vm,
|
|
1218
|
+
vsockPath: state.vsockPath,
|
|
1219
|
+
request: (argv, workdir, variables) => ({ argv, user: agentUser, cwd: workdir, env: execEnvironment(state.imageEnv, withMiseVariables(env, variables)) })
|
|
1220
|
+
}),
|
|
1212
1221
|
restart: async () => {
|
|
1213
1222
|
try {
|
|
1214
1223
|
if (state.jailed !== void 0) await stopJailed(vm.helper, state);
|
|
@@ -1360,6 +1369,14 @@ async function readWorkItem(config, item, fetchImpl) {
|
|
|
1360
1369
|
const { data } = await getJson(config.url, `/v1/work-items/${item}`, config.apiKey, config.appId, fetchImpl, await signerFor(config.configPath));
|
|
1361
1370
|
return data;
|
|
1362
1371
|
}
|
|
1372
|
+
function declaredPullRequest(workItem, repository) {
|
|
1373
|
+
const declared = fields(workItem).pullRequests;
|
|
1374
|
+
if (!Array.isArray(declared)) return void 0;
|
|
1375
|
+
const wanted = repository.toLowerCase();
|
|
1376
|
+
const matching = declared.map((entry) => fields(entry)).filter((entry) => typeof entry.repository === "string" && entry.repository.toLowerCase() === wanted && typeof entry.prNumber === "number" && Number.isInteger(entry.prNumber) && entry.prNumber > 0);
|
|
1377
|
+
const chosen = matching.find((entry) => entry.state === "open") ?? matching[0];
|
|
1378
|
+
return chosen === void 0 ? void 0 : chosen.prNumber;
|
|
1379
|
+
}
|
|
1363
1380
|
async function readItemEvaluation(config, item, fetchImpl) {
|
|
1364
1381
|
try {
|
|
1365
1382
|
const body = fields(await readWorkItem(config, item, fetchImpl));
|
|
@@ -1502,7 +1519,7 @@ var exitsLogged = /* @__PURE__ */ new Map();
|
|
|
1502
1519
|
var BUILD_HOME2 = "/build/home";
|
|
1503
1520
|
async function startSender(input) {
|
|
1504
1521
|
const { config, job, jobDir, deps } = input;
|
|
1505
|
-
const tag =
|
|
1522
|
+
const tag = `${itemTag(job)}`;
|
|
1506
1523
|
if (job.itemKey === void 0) return void 0;
|
|
1507
1524
|
const spawnFn = deps.spawnFn ?? spawn;
|
|
1508
1525
|
try {
|
|
@@ -1545,7 +1562,7 @@ function launchFor(config, job, jobDir, deps) {
|
|
|
1545
1562
|
if (job.container !== void 0) {
|
|
1546
1563
|
return { ...containerSenderCommand({ job, runtime: deps.runtime ?? createContainerRuntime(), config }), cwd: jobDir };
|
|
1547
1564
|
}
|
|
1548
|
-
const env = jobEnv(config, job.item, job.itemKey, jobDir, process.env, job.branch, job.commitIdentity?.author);
|
|
1565
|
+
const env = jobEnv(claimCalls(config, job), job.item, job.itemKey, jobDir, process.env, job.branch, job.commitIdentity?.author, spoolHomeFor(config, job));
|
|
1549
1566
|
const build = job.build;
|
|
1550
1567
|
const hostEnv = build === void 0 ? env : hostCommandEnvironment(env, build, config, job.commitIdentity?.hooksPath);
|
|
1551
1568
|
if (build?.exec !== void 0) {
|
|
@@ -1569,11 +1586,11 @@ async function restartSender(input) {
|
|
|
1569
1586
|
const deadline = (deps.waitMs ?? STOP_WAIT_MS) / POLL_MS;
|
|
1570
1587
|
for (let waited = 0; await running() && waited < deadline; waited += 1) await sleep(POLL_MS);
|
|
1571
1588
|
if (await running()) {
|
|
1572
|
-
deps.log.error(
|
|
1589
|
+
deps.log.error(`${itemTag(job)} the session sender an earlier runner left did not stop in time \xB7 killing it`);
|
|
1573
1590
|
await signalInContainer(runtime, state, pidfile, "KILL");
|
|
1574
1591
|
}
|
|
1575
1592
|
} catch (err) {
|
|
1576
|
-
deps.log.error(
|
|
1593
|
+
deps.log.error(`${itemTag(job)} stopping the session sender an earlier runner left failed: ${describeCallFailure(err)} \xB7 continuing`);
|
|
1577
1594
|
}
|
|
1578
1595
|
}
|
|
1579
1596
|
return startSender(input);
|
|
@@ -1622,7 +1639,7 @@ async function stopSender(input) {
|
|
|
1622
1639
|
const { job, deps } = input;
|
|
1623
1640
|
const sender = job.sender;
|
|
1624
1641
|
if (sender === void 0) return;
|
|
1625
|
-
const tag =
|
|
1642
|
+
const tag = `${itemTag(job)}`;
|
|
1626
1643
|
const sleep = deps.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
1627
1644
|
const inContainer = job.container === void 0 ? void 0 : { state: job.container, runtime: deps.runtime ?? createContainerRuntime(), pidfile: senderPidfile(BUILD_HOME2, Number(job.item)) };
|
|
1628
1645
|
const inGuest = job.microvm === void 0 ? void 0 : { state: job.microvm, runtime: deps.runtime ?? createContainerRuntime(), pidfile: senderPidfile(BUILD_HOME2, Number(job.item)) };
|
|
@@ -1658,23 +1675,26 @@ function isTailedStage(stage) {
|
|
|
1658
1675
|
}
|
|
1659
1676
|
var PROVISION_PROBLEM = /\b(warn(ing)?|error|fail(ed|ure)?|refused)\b/i;
|
|
1660
1677
|
var READ_LIMIT_BYTES = 1048576;
|
|
1661
|
-
var ITEM_LINE = /^#(\d+)
|
|
1678
|
+
var ITEM_LINE = /^#(\d+(?:@[A-Za-z0-9_-]+)?)(?![A-Za-z0-9_@-])/;
|
|
1679
|
+
function keyOf(item, scope) {
|
|
1680
|
+
return scope === void 0 ? String(Number(item)) : `${Number(item)}@${scope}`;
|
|
1681
|
+
}
|
|
1662
1682
|
var AttemptLogBook = class {
|
|
1663
1683
|
constructor(now = () => /* @__PURE__ */ new Date()) {
|
|
1664
1684
|
this.now = now;
|
|
1665
1685
|
this.dirs = /* @__PURE__ */ new Map();
|
|
1666
1686
|
this.lastByKey = /* @__PURE__ */ new Map();
|
|
1667
1687
|
}
|
|
1668
|
-
/** Starts keeping lines for `item` in `jobDirPath`. Idempotent. */
|
|
1669
|
-
open(item, jobDirPath) {
|
|
1670
|
-
this.dirs.set(
|
|
1688
|
+
/** Starts keeping lines for `item` in `jobDirPath`. Idempotent. A fleet build passes the `scope` of its organization. */
|
|
1689
|
+
open(item, jobDirPath, scope) {
|
|
1690
|
+
this.dirs.set(keyOf(item, scope), jobDirPath);
|
|
1671
1691
|
}
|
|
1672
1692
|
/** Stops keeping lines for `item`; its file stays on disk until housekeeping removes the job directory. */
|
|
1673
|
-
close(item) {
|
|
1674
|
-
const
|
|
1675
|
-
this.dirs.delete(
|
|
1676
|
-
for (const
|
|
1677
|
-
if (
|
|
1693
|
+
close(item, scope) {
|
|
1694
|
+
const key = keyOf(item, scope);
|
|
1695
|
+
this.dirs.delete(key);
|
|
1696
|
+
for (const slot of [...this.lastByKey.keys()]) {
|
|
1697
|
+
if (slot.startsWith(`${key}:`)) this.lastByKey.delete(slot);
|
|
1678
1698
|
}
|
|
1679
1699
|
}
|
|
1680
1700
|
/** The log with every line it writes for an open item also kept in that item's file. */
|
|
@@ -1691,20 +1711,21 @@ var AttemptLogBook = class {
|
|
|
1691
1711
|
};
|
|
1692
1712
|
}
|
|
1693
1713
|
/** One line for `item` that does not itself start with its number. */
|
|
1694
|
-
note(item, text2) {
|
|
1695
|
-
this.append(
|
|
1714
|
+
note(item, text2, scope) {
|
|
1715
|
+
this.append(keyOf(item, scope), text2);
|
|
1696
1716
|
}
|
|
1697
1717
|
/** One line, written only when `text` differs from the last one written under `key` for the item. */
|
|
1698
|
-
noteChanged(item, key, text2) {
|
|
1699
|
-
const
|
|
1700
|
-
const slot = `${number}:${key}`;
|
|
1718
|
+
noteChanged(item, key, text2, scope) {
|
|
1719
|
+
const slot = `${keyOf(item, scope)}:${key}`;
|
|
1701
1720
|
if (this.lastByKey.get(slot) === text2) return;
|
|
1702
1721
|
this.lastByKey.set(slot, text2);
|
|
1703
|
-
this.append(
|
|
1722
|
+
this.append(keyOf(item, scope), text2);
|
|
1704
1723
|
}
|
|
1705
1724
|
keepItemLine(text2) {
|
|
1706
1725
|
const match = ITEM_LINE.exec(text2);
|
|
1707
|
-
if (match
|
|
1726
|
+
if (match === null) return;
|
|
1727
|
+
const [number = "", scope] = match[1].split("@");
|
|
1728
|
+
this.append(keyOf(number, scope), text2);
|
|
1708
1729
|
}
|
|
1709
1730
|
append(item, text2) {
|
|
1710
1731
|
const dir = this.dirs.get(item);
|
|
@@ -1967,18 +1988,23 @@ async function hostPassedNames(config, item, fetchImpl) {
|
|
|
1967
1988
|
function environmentFor(input) {
|
|
1968
1989
|
const { config, job, jobDir, deps } = input;
|
|
1969
1990
|
if (deps.judgeEnvironment !== void 0) return deps.judgeEnvironment;
|
|
1970
|
-
if (job.container !== void 0) return containerJudgeEnvironment({ runtime: deps.runtime, config, job, jobDir, log: (line) => deps.log.line(
|
|
1991
|
+
if (job.container !== void 0) return containerJudgeEnvironment({ runtime: deps.runtime, config, job, jobDir, log: (line) => deps.log.line(`${itemTag(job)} ${line}`) });
|
|
1971
1992
|
if (job.microvm !== void 0) return microVmJudgeEnvironment({ runtime: deps.runtime, job, jobDir });
|
|
1972
1993
|
return void 0;
|
|
1973
1994
|
}
|
|
1974
1995
|
async function runJudge(input) {
|
|
1975
1996
|
const { config, job, jobDir, deps } = input;
|
|
1976
1997
|
const { runtime, log } = deps;
|
|
1977
|
-
const tag =
|
|
1998
|
+
const tag = `${itemTag(job)}`;
|
|
1978
1999
|
const now = deps.now ?? (() => /* @__PURE__ */ new Date());
|
|
1979
2000
|
const repository = job.repository ?? job.container?.repository;
|
|
1980
2001
|
if (repository === void 0) return;
|
|
1981
2002
|
const repo = repository;
|
|
2003
|
+
let itemRead;
|
|
2004
|
+
const readItem = () => itemRead ??= readWorkItem(itemCalls(config, job), job.item, deps.fetchImpl).catch((err) => {
|
|
2005
|
+
itemRead = void 0;
|
|
2006
|
+
throw err;
|
|
2007
|
+
});
|
|
1982
2008
|
const tokens = runtime.credentials.get(jobDir);
|
|
1983
2009
|
let readToken;
|
|
1984
2010
|
try {
|
|
@@ -2002,12 +2028,12 @@ async function runJudge(input) {
|
|
|
2002
2028
|
rmSync(scratch, { recursive: true, force: true });
|
|
2003
2029
|
log.line(`${tag} judge not run: the definitions could not be read: ${definitions.reason}`);
|
|
2004
2030
|
job.judgeNotRun = `the definitions could not be read: ${definitions.reason}`;
|
|
2005
|
-
const passed = await retrySend(() => hostPassedNames(config, job.item, deps.fetchImpl), { now: deps.now });
|
|
2031
|
+
const passed = await retrySend(() => hostPassedNames(itemCalls(config, job), job.item, deps.fetchImpl), { now: deps.now });
|
|
2006
2032
|
if (!passed.ok) {
|
|
2007
2033
|
log.error(`${tag} the item's host results could not be read, so none was failed: ${passed.reason}`);
|
|
2008
2034
|
return;
|
|
2009
2035
|
}
|
|
2010
|
-
const record2 = makeRecorder({ config, job, deps });
|
|
2036
|
+
const record2 = makeRecorder({ config, job, jobDir, deps });
|
|
2011
2037
|
for (const name of passed.value) await record2(name, "fail", `the definitions could not be read: ${definitions.reason}`, { idTag: "judge-unread" });
|
|
2012
2038
|
return;
|
|
2013
2039
|
}
|
|
@@ -2021,7 +2047,7 @@ async function runJudge(input) {
|
|
|
2021
2047
|
}
|
|
2022
2048
|
log.line(`${tag} judge started (${checks.map((check) => check.name).join(", ")})`);
|
|
2023
2049
|
const startedMs = now().getTime();
|
|
2024
|
-
const record = makeRecorder({ config, job, deps });
|
|
2050
|
+
const record = makeRecorder({ config, job, jobDir, deps });
|
|
2025
2051
|
const fail = (check, reason) => {
|
|
2026
2052
|
log.error(`${tag} judge failed: ${reason}`);
|
|
2027
2053
|
return record(check.name, "fail", reason);
|
|
@@ -2068,7 +2094,7 @@ async function runJudge(input) {
|
|
|
2068
2094
|
if (check.judge.subjects === "criteria") {
|
|
2069
2095
|
let workItem;
|
|
2070
2096
|
try {
|
|
2071
|
-
workItem = await
|
|
2097
|
+
workItem = await readItem();
|
|
2072
2098
|
} catch (err) {
|
|
2073
2099
|
return await fail(check, `the item's criteria could not be read: ${describeCallFailure(err)}`);
|
|
2074
2100
|
}
|
|
@@ -2233,6 +2259,15 @@ async function runJudge(input) {
|
|
|
2233
2259
|
return void 0;
|
|
2234
2260
|
}
|
|
2235
2261
|
const clientArtifactId = `host-judge-${createHash("sha256").update(`${job.claimId}:${job.startedAt}:${check.name}`).digest("hex").slice(0, 40)}`;
|
|
2262
|
+
const calls = itemCalls(config, job);
|
|
2263
|
+
let prNumber;
|
|
2264
|
+
if (config.fleet === true) {
|
|
2265
|
+
try {
|
|
2266
|
+
prNumber = declaredPullRequest(await readItem(), repo);
|
|
2267
|
+
} catch (err) {
|
|
2268
|
+
log.error(`${tag} the item's pull requests could not be read for the judge's report: ${describeCallFailure(err)}`);
|
|
2269
|
+
}
|
|
2270
|
+
}
|
|
2236
2271
|
const request = {
|
|
2237
2272
|
schemaVersion: 1,
|
|
2238
2273
|
artifact: {
|
|
@@ -2247,12 +2282,13 @@ async function runJudge(input) {
|
|
|
2247
2282
|
repository: repo,
|
|
2248
2283
|
gitRepo: repo,
|
|
2249
2284
|
gitBranch: at.branch,
|
|
2250
|
-
commitSha: at.head
|
|
2285
|
+
commitSha: at.head,
|
|
2286
|
+
...prNumber === void 0 ? {} : { prNumber }
|
|
2251
2287
|
},
|
|
2252
2288
|
blob: { data: bytes.toString("base64") }
|
|
2253
2289
|
};
|
|
2254
2290
|
const signer = await signerFor(config.configPath);
|
|
2255
|
-
const sent = await retrySend(() => postJson(
|
|
2291
|
+
const sent = await retrySend(() => postJson(calls.url, "/v1/artifacts", calls.apiKey, calls.appId, request, deps.fetchImpl, void 0, signer), { now: deps.now });
|
|
2256
2292
|
if (!sent.ok) {
|
|
2257
2293
|
log.error(`${tag} the judge's report could not be uploaded: ${sent.reason}`);
|
|
2258
2294
|
return void 0;
|
|
@@ -2265,7 +2301,7 @@ async function runJudge(input) {
|
|
|
2265
2301
|
// src/runner/job.ts
|
|
2266
2302
|
var RENEW_INTERVAL_SECONDS = 300;
|
|
2267
2303
|
var IDLE_CPU_USEC_PER_MINUTE_FLOOR = 2e6;
|
|
2268
|
-
function jobEnv(config, item, itemKey, jobDirPath, baseEnv = process.env, branch, author) {
|
|
2304
|
+
function jobEnv(config, item, itemKey, jobDirPath, baseEnv = process.env, branch, author, spoolHome) {
|
|
2269
2305
|
const secrets = new Set(headerVariables(config.build?.destinations));
|
|
2270
2306
|
const passthrough = {};
|
|
2271
2307
|
for (const [key, value] of Object.entries(baseEnv)) {
|
|
@@ -2286,6 +2322,8 @@ function jobEnv(config, item, itemKey, jobDirPath, baseEnv = process.env, branch
|
|
|
2286
2322
|
// The branch the claim named. A hook that makes its own checkout puts it
|
|
2287
2323
|
// on this branch, and the build's commands push to it.
|
|
2288
2324
|
...branch === void 0 ? {} : { OUTERLAYER_BRANCH: branch },
|
|
2325
|
+
// A fleet build's artifacts are spooled under its organization's folder, not the user's home.
|
|
2326
|
+
...spoolHome === void 0 ? {} : { OUTERLAYER_SPOOL_HOME: spoolHome },
|
|
2289
2327
|
// Git prefers these to any configuration, so a host's own git identity never authors a commit of the build.
|
|
2290
2328
|
...authorEnvironment(author)
|
|
2291
2329
|
};
|
|
@@ -2450,14 +2488,15 @@ function mergeScrubConfig(a, b) {
|
|
|
2450
2488
|
patterns: [...scrubList(a?.patterns), ...scrubList(b?.patterns)]
|
|
2451
2489
|
};
|
|
2452
2490
|
}
|
|
2453
|
-
function releaseScrub(config, home) {
|
|
2491
|
+
function releaseScrub(config, home, jobDir) {
|
|
2454
2492
|
const merged = mergeScrubConfig(config.scrub, readCloudConfig(home).scrub);
|
|
2455
2493
|
const secrets = [...headerVariables(config.build?.destinations), ...CLAUDE_CREDENTIAL_VARIABLES].map((name) => process.env[name] ?? "");
|
|
2456
|
-
const
|
|
2494
|
+
const managed = config.fleet === true ? jobDir === void 0 ? [] : [...managedClaudeKeyValuesFor(jobDir), ...managedBuildSettingValuesFor(jobDir)] : [...managedClaudeKeyValues(), ...managedBuildSettingValues()];
|
|
2495
|
+
const held = [currentClaudeCredential(process.env)?.value, ...removedClaudeCredentialValues(), ...managed].filter((value) => value !== void 0);
|
|
2457
2496
|
return { literals: [...scrubList(merged?.literals), ...secrets, ...held], patterns: scrubList(merged?.patterns) };
|
|
2458
2497
|
}
|
|
2459
|
-
function transcriptScrub(config, secrets) {
|
|
2460
|
-
const base = releaseScrub(config, homeFromEnv());
|
|
2498
|
+
function transcriptScrub(config, secrets, jobDir) {
|
|
2499
|
+
const base = releaseScrub(config, homeFromEnv(), jobDir);
|
|
2461
2500
|
return { literals: [...scrubList(base.literals), ...secrets.filter((secret) => secret !== void 0 && secret !== "")], patterns: scrubList(base.patterns) };
|
|
2462
2501
|
}
|
|
2463
2502
|
function stripUnsendableReasonChars(text2) {
|
|
@@ -2468,7 +2507,7 @@ function stripTerminalControls(text2) {
|
|
|
2468
2507
|
}
|
|
2469
2508
|
function releaseLogFor(jobDirPath, job, config) {
|
|
2470
2509
|
const home = homeFromEnv();
|
|
2471
|
-
installScrubContext(home, transcriptScrub(config, [job.itemKey, config.apiKey]));
|
|
2510
|
+
installScrubContext(home, transcriptScrub(config, [job.itemKey, config.apiKey], jobDirPath));
|
|
2472
2511
|
return buildReleaseLog(jobDirPath, job.endStage, (text2) => scrubText(stripTerminalControls(stripUnsendableReasonChars(text2))));
|
|
2473
2512
|
}
|
|
2474
2513
|
function readReasonLine(jobDirPath, config, home = homeFromEnv()) {
|
|
@@ -2478,18 +2517,18 @@ function readReasonLine(jobDirPath, config, home = homeFromEnv()) {
|
|
|
2478
2517
|
} catch {
|
|
2479
2518
|
return void 0;
|
|
2480
2519
|
}
|
|
2481
|
-
return scrubReason(raw.split(/\r\n|\r|\n/)[0] ?? "", config, home);
|
|
2520
|
+
return scrubReason(raw.split(/\r\n|\r|\n/)[0] ?? "", config, home, jobDirPath);
|
|
2482
2521
|
}
|
|
2483
|
-
function scrubReason(line, config, home = homeFromEnv()) {
|
|
2484
|
-
installScrubContext(home, releaseScrub(config, home));
|
|
2522
|
+
function scrubReason(line, config, home = homeFromEnv(), jobDir) {
|
|
2523
|
+
installScrubContext(home, releaseScrub(config, home, jobDir));
|
|
2485
2524
|
const oneLine = scrubText(stripUnsendableReasonChars(line)).replace(/[\r\n]+/g, " ");
|
|
2486
2525
|
const trimmed = cutReasonLine(oneLine).trim();
|
|
2487
2526
|
return trimmed.length > 0 ? trimmed : void 0;
|
|
2488
2527
|
}
|
|
2489
|
-
function scrubTunnelRecord(record, config) {
|
|
2528
|
+
function scrubTunnelRecord(record, config, jobDir) {
|
|
2490
2529
|
if (record === void 0) return void 0;
|
|
2491
2530
|
const home = homeFromEnv();
|
|
2492
|
-
installScrubContext(home, releaseScrub(config, home));
|
|
2531
|
+
installScrubContext(home, releaseScrub(config, home, jobDir));
|
|
2493
2532
|
return {
|
|
2494
2533
|
hosts: record.hosts.map((host) => scrubText(host)),
|
|
2495
2534
|
hostsMore: record.hostsMore,
|
|
@@ -2664,9 +2703,9 @@ function wasAlreadyReleased(result, sentOutcome, sentAtMs) {
|
|
|
2664
2703
|
const releasedAtMs = Date.parse(result.releasedAt);
|
|
2665
2704
|
return Number.isFinite(releasedAtMs) && releasedAtMs < sentAtMs - RELEASE_SKEW_MS;
|
|
2666
2705
|
}
|
|
2667
|
-
function runSync(config, item, itemKey, workdir, jobDirPath, spawnFn = spawn, branch, author) {
|
|
2706
|
+
function runSync(config, item, itemKey, workdir, jobDirPath, spawnFn = spawn, branch, author, spoolHome) {
|
|
2668
2707
|
return new Promise((resolve) => {
|
|
2669
|
-
const env = jobEnv(config, item, itemKey, jobDirPath, process.env, branch, author);
|
|
2708
|
+
const env = jobEnv(config, item, itemKey, jobDirPath, process.env, branch, author, spoolHome);
|
|
2670
2709
|
let child;
|
|
2671
2710
|
try {
|
|
2672
2711
|
child = spawnFn(process.execPath, [process.argv[1] ?? "outerlayer", "sync"], {
|
|
@@ -2688,7 +2727,7 @@ function runSync(config, item, itemKey, workdir, jobDirPath, spawnFn = spawn, br
|
|
|
2688
2727
|
}
|
|
2689
2728
|
async function runSyncViaExec(config, job, jobDirPath, spawnFn = spawn) {
|
|
2690
2729
|
const build = job.build;
|
|
2691
|
-
const env = hostCommandEnvironment(jobEnv(config, job.item, job.itemKey, jobDirPath, process.env, job.branch, job.commitIdentity?.author), build, config, job.commitIdentity?.hooksPath);
|
|
2730
|
+
const env = hostCommandEnvironment(jobEnv(claimCalls(config, job), job.item, job.itemKey, jobDirPath, process.env, job.branch, job.commitIdentity?.author, spoolHomeFor(config, job)), build, config, job.commitIdentity?.hooksPath);
|
|
2692
2731
|
try {
|
|
2693
2732
|
const result = await runHook(
|
|
2694
2733
|
build.exec,
|
|
@@ -2706,7 +2745,7 @@ async function runSyncViaExec(config, job, jobDirPath, spawnFn = spawn) {
|
|
|
2706
2745
|
}
|
|
2707
2746
|
function runRecordProofs(config, job, jobDirPath, spawnFn = spawn) {
|
|
2708
2747
|
return new Promise((resolve) => {
|
|
2709
|
-
const env = jobEnv(config, job.item, job.itemKey, jobDirPath, process.env, job.branch, job.commitIdentity?.author);
|
|
2748
|
+
const env = jobEnv(claimCalls(config, job), job.item, job.itemKey, jobDirPath, process.env, job.branch, job.commitIdentity?.author, spoolHomeFor(config, job));
|
|
2710
2749
|
let fd;
|
|
2711
2750
|
let child;
|
|
2712
2751
|
try {
|
|
@@ -2734,7 +2773,7 @@ function runRecordProofs(config, job, jobDirPath, spawnFn = spawn) {
|
|
|
2734
2773
|
}
|
|
2735
2774
|
async function runRecordProofsViaExec(config, job, jobDirPath, spawnFn = spawn) {
|
|
2736
2775
|
const build = job.build;
|
|
2737
|
-
const env = hostCommandEnvironment(jobEnv(config, job.item, job.itemKey, jobDirPath, process.env, job.branch, job.commitIdentity?.author), build, config, job.commitIdentity?.hooksPath);
|
|
2776
|
+
const env = hostCommandEnvironment(jobEnv(claimCalls(config, job), job.item, job.itemKey, jobDirPath, process.env, job.branch, job.commitIdentity?.author, spoolHomeFor(config, job)), build, config, job.commitIdentity?.hooksPath);
|
|
2738
2777
|
try {
|
|
2739
2778
|
const result = await runHook(build.exec, env, jobDirPath, join(jobDirPath, PROOFS_LOG), spawnFn, void 0, execArgv(job.workdir, [...RECORD_PROOFS_ARGV]));
|
|
2740
2779
|
return result.code === 0 ? { ok: true } : { ok: false, reason: `exit ${result.code}` };
|
|
@@ -2792,8 +2831,8 @@ async function finishJob(job, jobDirPath, outcome, config, deps, ending) {
|
|
|
2792
2831
|
const log = deps.log ?? createRunnerLog(now);
|
|
2793
2832
|
const jobFilePath = join(jobDirPath, "job.json");
|
|
2794
2833
|
const logPath = join(jobDirPath, "command.log");
|
|
2795
|
-
const tag =
|
|
2796
|
-
deps.attemptLogs?.open(job.item, jobDirPath);
|
|
2834
|
+
const tag = `${itemTag(job)}`;
|
|
2835
|
+
deps.attemptLogs?.open(job.item, jobDirPath, itemScope(job));
|
|
2797
2836
|
const valuesNotHeld = (job.managedVariables?.length ?? 0) > 0 && managedBuildSettingsFor(jobDirPath) === void 0;
|
|
2798
2837
|
if (job.sender !== void 0) {
|
|
2799
2838
|
await stopSender({ job, deps: { spawnFn, runtime: deps.container, log } });
|
|
@@ -2834,7 +2873,7 @@ async function finishJob(job, jobDirPath, outcome, config, deps, ending) {
|
|
|
2834
2873
|
writeJobFile(jobFilePath, job);
|
|
2835
2874
|
}
|
|
2836
2875
|
if (outcome !== void 0 && ending?.reason !== void 0) {
|
|
2837
|
-
job.reason = RUNNER_WORDED_REASONS.has(ending.reason) ? ending.reason : scrubReason(ending.reason, config);
|
|
2876
|
+
job.reason = RUNNER_WORDED_REASONS.has(ending.reason) ? ending.reason : scrubReason(ending.reason, config, void 0, jobDirPath);
|
|
2838
2877
|
writeJobFile(jobFilePath, job);
|
|
2839
2878
|
}
|
|
2840
2879
|
const uploadSessions = async (workdir) => {
|
|
@@ -2849,11 +2888,11 @@ async function finishJob(job, jobDirPath, outcome, config, deps, ending) {
|
|
|
2849
2888
|
} else {
|
|
2850
2889
|
log.line(`${tag} sync started`);
|
|
2851
2890
|
const startedMs = now().getTime();
|
|
2852
|
-
const sync = build !== void 0 ? await syncInContainer({ config, runtime: build.runtime, job, jobDir: jobDirPath, log: (line) => log.line(`${tag} ${line}`) }) : vmBuild !== void 0 ? await syncInMicroVm({ config, runtime: vmBuild.runtime, job, jobDir: jobDirPath }) : job.build?.exec !== void 0 ? await runSyncViaExec(config, job, jobDirPath, spawnFn) : await runSync(config, job.item, job.itemKey, workdir, jobDirPath, spawnFn, job.branch, job.commitIdentity?.author);
|
|
2891
|
+
const sync = build !== void 0 ? await syncInContainer({ config, runtime: build.runtime, job, jobDir: jobDirPath, log: (line) => log.line(`${tag} ${line}`) }) : vmBuild !== void 0 ? await syncInMicroVm({ config, runtime: vmBuild.runtime, job, jobDir: jobDirPath }) : job.build?.exec !== void 0 ? await runSyncViaExec(config, job, jobDirPath, spawnFn) : await runSync(claimCalls(config, job), job.item, job.itemKey, workdir, jobDirPath, spawnFn, job.branch, job.commitIdentity?.author, spoolHomeFor(config, job));
|
|
2853
2892
|
const took = formatDuration(now().getTime() - startedMs);
|
|
2854
2893
|
if (sync.ok) log.line(`${tag} sync ok (${took})`);
|
|
2855
2894
|
else log.error(`${tag} sync failed: ${sync.reason ?? "no reason given"} \xB7 continuing`);
|
|
2856
|
-
const left = spooledArtifactIds(deps.home ?? homeFromEnv());
|
|
2895
|
+
const left = spooledArtifactIds(deps.home ?? (job.organizationId === void 0 ? homeFromEnv() : orgHomeDir(config.configPath, job.organizationId)));
|
|
2857
2896
|
if (left.length > 0) {
|
|
2858
2897
|
job.spooledArtifacts = left.slice(0, MAX_NAMED_SPOOLED);
|
|
2859
2898
|
const named = job.spooledArtifacts.join(", ");
|
|
@@ -2900,7 +2939,7 @@ async function finishJob(job, jobDirPath, outcome, config, deps, ending) {
|
|
|
2900
2939
|
log.error(`${tag} removing an earlier attempt's check environment failed: ${describeCallFailure(err)} \xB7 continuing`);
|
|
2901
2940
|
}
|
|
2902
2941
|
}
|
|
2903
|
-
if (outcome === "ok" && !job.cleanupRan && job.proofsRan !== true && !valuesNotHeld && job.workdir !== void 0 && job.itemKey !== void 0 && await declaresRecordedProof(config, job.item, deps.fetchImpl)) {
|
|
2942
|
+
if (outcome === "ok" && !job.cleanupRan && job.proofsRan !== true && !valuesNotHeld && job.workdir !== void 0 && job.itemKey !== void 0 && await declaresRecordedProof(itemCalls(config, job), job.item, deps.fetchImpl)) {
|
|
2904
2943
|
setStage(job, jobDirPath, "proofs");
|
|
2905
2944
|
job.proofsRan = true;
|
|
2906
2945
|
writeJobFile(jobFilePath, job);
|
|
@@ -2957,7 +2996,7 @@ async function finishJob(job, jobDirPath, outcome, config, deps, ending) {
|
|
|
2957
2996
|
log.error(`${tag} could not read the build's memory events: ${describeCallFailure(err)} \xB7 continuing`);
|
|
2958
2997
|
}
|
|
2959
2998
|
if (outOfMemory !== void 0) {
|
|
2960
|
-
job.reason = scrubReason(outOfMemory, config);
|
|
2999
|
+
job.reason = scrubReason(outOfMemory, config, void 0, jobDirPath);
|
|
2961
3000
|
writeJobFile(jobFilePath, job);
|
|
2962
3001
|
}
|
|
2963
3002
|
}
|
|
@@ -3026,7 +3065,7 @@ async function finishJob(job, jobDirPath, outcome, config, deps, ending) {
|
|
|
3026
3065
|
} else {
|
|
3027
3066
|
if (!isBuiltinContainer(config.hooks.cleanup) && !isBuiltinProcess(config.hooks.cleanup) && !isBuiltinVm(config.hooks.cleanup)) {
|
|
3028
3067
|
const cleanupEnv = {
|
|
3029
|
-
...jobEnv(config, job.item, job.itemKey, jobDirPath, process.env, job.branch, job.commitIdentity?.author),
|
|
3068
|
+
...jobEnv(claimCalls(config, job), job.item, job.itemKey, jobDirPath, process.env, job.branch, job.commitIdentity?.author, spoolHomeFor(config, job)),
|
|
3030
3069
|
...job.build === void 0 ? {} : { OUTERLAYER_BUILD_DIR: job.build.buildDir },
|
|
3031
3070
|
OUTERLAYER_OUTCOME: outcome ?? "",
|
|
3032
3071
|
OUTERLAYER_LOG: logPath
|
|
@@ -3067,13 +3106,13 @@ async function finishJob(job, jobDirPath, outcome, config, deps, ending) {
|
|
|
3067
3106
|
let verdictReason;
|
|
3068
3107
|
if (outcome === "ok") {
|
|
3069
3108
|
const decision = await settleVerdict({
|
|
3070
|
-
read: () => readItemEvaluation(config, job.item, deps.fetchImpl),
|
|
3109
|
+
read: () => readItemEvaluation(itemCalls(config, job), job.item, deps.fetchImpl),
|
|
3071
3110
|
now,
|
|
3072
3111
|
sleep: deps.sleep ?? waitMs
|
|
3073
3112
|
});
|
|
3074
3113
|
if (decision.outcome === "incomplete") {
|
|
3075
3114
|
const release2 = unfinishedRelease(
|
|
3076
|
-
scrubReason(incompleteReason(decision.reason, job.judgeNotRun), config),
|
|
3115
|
+
scrubReason(incompleteReason(decision.reason, job.judgeNotRun), config, void 0, jobDirPath),
|
|
3077
3116
|
deps.container?.credentials.get(jobDirPath)?.reason
|
|
3078
3117
|
);
|
|
3079
3118
|
outcome = release2.outcome;
|
|
@@ -3086,7 +3125,7 @@ async function finishJob(job, jobDirPath, outcome, config, deps, ending) {
|
|
|
3086
3125
|
log.line(`${tag} report started \xB7 phase end`);
|
|
3087
3126
|
const reportStartedMs = now().getTime();
|
|
3088
3127
|
const reportEnv = {
|
|
3089
|
-
...jobEnv(config, job.item, job.itemKey, jobDirPath, process.env, job.branch, job.commitIdentity?.author),
|
|
3128
|
+
...jobEnv(claimCalls(config, job), job.item, job.itemKey, jobDirPath, process.env, job.branch, job.commitIdentity?.author, spoolHomeFor(config, job)),
|
|
3090
3129
|
OUTERLAYER_PHASE: "end",
|
|
3091
3130
|
OUTERLAYER_OUTCOME: outcome ?? "",
|
|
3092
3131
|
OUTERLAYER_LOG: logPath
|
|
@@ -3123,18 +3162,18 @@ async function finishJob(job, jobDirPath, outcome, config, deps, ending) {
|
|
|
3123
3162
|
if (verdictReason !== void 0) {
|
|
3124
3163
|
job.reason = verdictReason;
|
|
3125
3164
|
} else if (outOfMemory !== void 0) {
|
|
3126
|
-
job.reason = scrubReason(outOfMemory, config);
|
|
3165
|
+
job.reason = scrubReason(outOfMemory, config, void 0, jobDirPath);
|
|
3127
3166
|
} else if (ending?.reason === void 0) {
|
|
3128
3167
|
job.reason = (outcome === "ok" ? void 0 : held?.reason) ?? (isolated ? fromHook ?? job.reason : fromHook);
|
|
3129
3168
|
}
|
|
3130
3169
|
if (outcome === "failed" && job.reason === void 0 && job.commandEndReason !== void 0) {
|
|
3131
|
-
job.reason = scrubReason(job.commandEndReason, config);
|
|
3170
|
+
job.reason = scrubReason(job.commandEndReason, config, void 0, jobDirPath);
|
|
3132
3171
|
}
|
|
3133
3172
|
const cliVersion = deps.cliVersion ?? resolveVersion();
|
|
3134
3173
|
const base = job.environment ?? (job.microvm !== void 0 ? { isolation: "vm", cliVersion } : job.container === void 0 ? sharedUserEnvironment(cliVersion) : { isolation: "container", cliVersion });
|
|
3135
3174
|
if (isolated || job.build !== void 0) {
|
|
3136
3175
|
tunnelRecord ??= readTunnelRecord(join(jobDirPath, "tunnel.json"));
|
|
3137
|
-
job.environment = withTunnelRecord(base, scrubTunnelRecord(tunnelRecord, config), !isolated);
|
|
3176
|
+
job.environment = withTunnelRecord(base, scrubTunnelRecord(tunnelRecord, config, jobDirPath), !isolated);
|
|
3138
3177
|
} else {
|
|
3139
3178
|
job.environment = base;
|
|
3140
3179
|
}
|
|
@@ -3148,7 +3187,7 @@ async function finishJob(job, jobDirPath, outcome, config, deps, ending) {
|
|
|
3148
3187
|
const runnerLog = valuesNotHeld ? `The runner sends no log for this attempt: ${VALUES_NOT_HELD}.
|
|
3149
3188
|
` : releaseLogFor(jobDirPath, job, config);
|
|
3150
3189
|
const detail = outcome === void 0 ? { log: runnerLog } : { stage: job.endStage, exitCode: job.endExitCode, reason: job.reason, environment: job.environment, log: runnerLog };
|
|
3151
|
-
const release = await retrySend(() => releaseLease(config, job
|
|
3190
|
+
const release = await retrySend(() => releaseLease(claimCalls(config, job), claimItem(config, job), outcome, detail, deps.fetchImpl), {
|
|
3152
3191
|
now: deps.now,
|
|
3153
3192
|
sleep: deps.sleep
|
|
3154
3193
|
});
|
|
@@ -3162,7 +3201,7 @@ async function finishJob(job, jobDirPath, outcome, config, deps, ending) {
|
|
|
3162
3201
|
job.endedAt = endedAt.toISOString();
|
|
3163
3202
|
job.releaseFailed = release.ok ? alreadyReleased ? ALREADY_RELEASED : void 0 : release.reason;
|
|
3164
3203
|
writeJobFile(jobFilePath, job);
|
|
3165
|
-
deps.attemptLogs?.close(job.item);
|
|
3204
|
+
deps.attemptLogs?.close(job.item, itemScope(job));
|
|
3166
3205
|
const total = formatDuration(endedAt.getTime() - new Date(job.startedAt).getTime());
|
|
3167
3206
|
if (alreadyReleased) {
|
|
3168
3207
|
log.line(
|
|
@@ -3173,9 +3212,8 @@ async function finishJob(job, jobDirPath, outcome, config, deps, ending) {
|
|
|
3173
3212
|
outcome === void 0 ? `${tag} released \xB7 not attempted (provision exit 75) \xB7 ${total}` : `${tag} released \xB7 outcome ${outcome} \xB7 ${total}${egressText(tunnelRecord)}`
|
|
3174
3213
|
);
|
|
3175
3214
|
} else {
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
);
|
|
3215
|
+
const lapse = release.code === "machine_revoked" ? "the gateway ended the lease when the machine was revoked" : `the lease expires at ${formatClock(leaseExpiry(job, endedAt), endedAt)}`;
|
|
3216
|
+
log.error(`${tag} release failed after ${release.attempts} attempt(s): ${release.reason}; ${lapse}${egressText(tunnelRecord)}`);
|
|
3179
3217
|
}
|
|
3180
3218
|
return job;
|
|
3181
3219
|
}
|
|
@@ -3212,9 +3250,15 @@ async function retryFailedReleases(jobsDirPath, config, deps) {
|
|
|
3212
3250
|
if (!job || job.releaseFailed === void 0 || job.releaseFailed === ALREADY_RELEASED || isUnfinished(job)) {
|
|
3213
3251
|
continue;
|
|
3214
3252
|
}
|
|
3253
|
+
if (leftByRunnerKey(config, job)) {
|
|
3254
|
+
rmSync(join(dirPath, SCRUBBED_RELEASE_LOG), { force: true });
|
|
3255
|
+
job.releaseFailed = void 0;
|
|
3256
|
+
writeJobFile(jobFilePath, job);
|
|
3257
|
+
continue;
|
|
3258
|
+
}
|
|
3215
3259
|
const runnerLog = readScrubbedReleaseLog(dirPath) ?? releaseLogFor(dirPath, job, config);
|
|
3216
3260
|
const detail = job.outcome === void 0 ? { log: runnerLog } : { stage: job.endStage, exitCode: job.endExitCode, reason: job.reason, environment: job.environment, log: runnerLog };
|
|
3217
|
-
const release = await retrySend(() => releaseLease(config, job
|
|
3261
|
+
const release = await retrySend(() => releaseLease(claimCalls(config, job), claimItem(config, job), job.outcome, detail, deps.fetchImpl), {
|
|
3218
3262
|
now: deps.now,
|
|
3219
3263
|
sleep: deps.sleep
|
|
3220
3264
|
});
|
|
@@ -3280,6 +3324,17 @@ async function recoverLostJobs(jobsDirPath, config, deps) {
|
|
|
3280
3324
|
const recovered = [];
|
|
3281
3325
|
for (const { dirPath, job } of unfinishedJobs(jobsDirPath)) {
|
|
3282
3326
|
if (!isReadable(job)) continue;
|
|
3327
|
+
if (leftByRunnerKey(config, job)) {
|
|
3328
|
+
(deps.log ?? createRunnerLog(deps.now ?? (() => /* @__PURE__ */ new Date()))).error(
|
|
3329
|
+
`${itemTag(job)} left by a runner key: a fleet runner cannot release its lease, which lapses by itself \xB7 closing its job file`
|
|
3330
|
+
);
|
|
3331
|
+
job.outcome = "interrupted";
|
|
3332
|
+
job.endedAt = (deps.now ?? (() => /* @__PURE__ */ new Date()))().toISOString();
|
|
3333
|
+
job.reason = "an unfinished build from a runner key; a fleet runner cannot release its lease";
|
|
3334
|
+
writeJobFile(join(dirPath, "job.json"), job);
|
|
3335
|
+
recovered.push(job);
|
|
3336
|
+
continue;
|
|
3337
|
+
}
|
|
3283
3338
|
const tracking = trackingOf(job);
|
|
3284
3339
|
if (tracking !== void 0 && tracking !== "container" && tracking !== "microvm") {
|
|
3285
3340
|
recovered.push(await finishJob(job, dirPath, "interrupted", config, deps, { reason: UNKNOWN_TRACKING_REASON }));
|
|
@@ -3390,14 +3445,15 @@ function checksIn(root, log, tag) {
|
|
|
3390
3445
|
}
|
|
3391
3446
|
async function readDefinitions(input, repository, scratch, token, tokens) {
|
|
3392
3447
|
const { config, job, deps } = input;
|
|
3393
|
-
const tag =
|
|
3448
|
+
const tag = `${itemTag(job)}`;
|
|
3394
3449
|
const stage = deps.stage ?? stageGovernedContext;
|
|
3395
3450
|
const controlPlaneUrl = (controlPlane) => deps.runtime.remoteFor?.(controlPlane) ?? `${deps.runtime.github.gitUrl}/${controlPlane}.git`;
|
|
3396
3451
|
const governing = (job.container ?? job.microvm)?.governing;
|
|
3397
3452
|
const kept = keptContextTree(input.jobDir, governing);
|
|
3398
3453
|
if (kept !== void 0) return { ok: true, ...checksIn(kept, deps.log, tag) };
|
|
3399
3454
|
const staged = await stage({
|
|
3400
|
-
config,
|
|
3455
|
+
config: claimCalls(config, job),
|
|
3456
|
+
...job.organizationId === void 0 ? {} : { organizationId: job.organizationId },
|
|
3401
3457
|
repository,
|
|
3402
3458
|
...governing === void 0 ? {} : { source: { repository: governing.repository, ref: governing.ref, sha: governing.commit } },
|
|
3403
3459
|
buildId: `checks-${randomBytes(4).toString("hex")}`,
|
|
@@ -3440,21 +3496,22 @@ function noCleanEnvironment(job) {
|
|
|
3440
3496
|
return `the host has no clean environment for checks: this build ran under ${ran}, and checks run only in a new container or microVM from a build's image`;
|
|
3441
3497
|
}
|
|
3442
3498
|
function makeRecorder(input) {
|
|
3443
|
-
const { config, job, deps } = input;
|
|
3444
|
-
const tag =
|
|
3499
|
+
const { config, job, deps, jobDir } = input;
|
|
3500
|
+
const tag = `${itemTag(job)}`;
|
|
3445
3501
|
const now = deps.now ?? (() => /* @__PURE__ */ new Date());
|
|
3502
|
+
const calls = itemCalls(config, job);
|
|
3446
3503
|
let signer;
|
|
3447
3504
|
return async (name, result, sentence, opts = {}) => {
|
|
3448
3505
|
signer ??= await signerFor(config.configPath);
|
|
3449
3506
|
const keyTail = opts.keyTail ?? "";
|
|
3450
|
-
const body = sentence === void 0 ? void 0 : cutReasonLine(`${scrubReason(sentence, config) ?? "check failed"}${keyTail}`);
|
|
3507
|
+
const body = sentence === void 0 ? void 0 : cutReasonLine(`${scrubReason(sentence, config, void 0, jobDir) ?? "check failed"}${keyTail}`);
|
|
3451
3508
|
const clientEmitId = `host-${createHash("sha256").update(`${job.claimId}:${job.startedAt}:${name}${opts.idTag === void 0 ? "" : `:${opts.idTag}`}`).digest("hex").slice(0, 40)}`;
|
|
3452
3509
|
const sent = await retrySend(
|
|
3453
3510
|
() => postJson(
|
|
3454
|
-
|
|
3511
|
+
calls.url,
|
|
3455
3512
|
"/v1/emitted-results",
|
|
3456
|
-
|
|
3457
|
-
|
|
3513
|
+
calls.apiKey,
|
|
3514
|
+
calls.appId,
|
|
3458
3515
|
{
|
|
3459
3516
|
schemaVersion: 1,
|
|
3460
3517
|
// A field left undefined is not sent: the request is JSON.
|
|
@@ -3473,7 +3530,7 @@ function makeRecorder(input) {
|
|
|
3473
3530
|
async function runHostChecks(input) {
|
|
3474
3531
|
const { config, job, jobDir, deps } = input;
|
|
3475
3532
|
const { runtime, log } = deps;
|
|
3476
|
-
const tag =
|
|
3533
|
+
const tag = `${itemTag(job)}`;
|
|
3477
3534
|
const now = deps.now ?? (() => /* @__PURE__ */ new Date());
|
|
3478
3535
|
const repository = job.repository ?? job.container?.repository;
|
|
3479
3536
|
if (repository === void 0) return;
|
|
@@ -3508,7 +3565,7 @@ async function runHostChecks(input) {
|
|
|
3508
3565
|
}
|
|
3509
3566
|
log.line(`${tag} checks started (${checks.map((check) => check.name).join(", ")})`);
|
|
3510
3567
|
const startedMs = now().getTime();
|
|
3511
|
-
const recorder = makeRecorder({ config, job, deps });
|
|
3568
|
+
const recorder = makeRecorder({ config, job, jobDir, deps });
|
|
3512
3569
|
const record = (check, result, sentence, keyTail = "", items) => recorder(check.name, result, sentence, { keyTail, items });
|
|
3513
3570
|
const failAll = async (reason, keyTail = "") => {
|
|
3514
3571
|
log.error(`${tag} checks failed: ${reason}${keyTail}`);
|
|
@@ -3570,7 +3627,7 @@ async function runHostChecks(input) {
|
|
|
3570
3627
|
let variables;
|
|
3571
3628
|
const setup = async () => {
|
|
3572
3629
|
const started = job.microvm !== void 0 ? await startCheckMicroVm({
|
|
3573
|
-
config,
|
|
3630
|
+
config: claimCalls(config, job),
|
|
3574
3631
|
runtime,
|
|
3575
3632
|
job,
|
|
3576
3633
|
jobDir,
|
|
@@ -3662,6 +3719,17 @@ async function runHostChecks(input) {
|
|
|
3662
3719
|
}
|
|
3663
3720
|
if (typeof settled === "string") return await failAll(settled);
|
|
3664
3721
|
const ready = settled;
|
|
3722
|
+
const setupMinutes = config.build?.setupMinutes ?? DEFAULT_SETUP_MINUTES;
|
|
3723
|
+
const prepared = await runSetupScripts({
|
|
3724
|
+
repositories: [...repositoriesToCheckOut.filter((entry) => entry.primary), ...repositoriesToCheckOut.filter((entry) => !entry.primary)],
|
|
3725
|
+
exec: (argv, workdir, opts) => ready.exec(argv, workdir, { logPath: opts?.quiet === true ? void 0 : environmentLog, timeoutMs: opts?.timeoutMs, variables }),
|
|
3726
|
+
log,
|
|
3727
|
+
tag: `${tag} checks`,
|
|
3728
|
+
timeoutMs: setupMinutes * 6e4,
|
|
3729
|
+
limitMinutes: setupMinutes,
|
|
3730
|
+
aborted: () => false
|
|
3731
|
+
});
|
|
3732
|
+
if (!prepared.ok) return await failAll(`the check environment could not be prepared: ${prepared.reason}`);
|
|
3665
3733
|
try {
|
|
3666
3734
|
await writeEvalInput({
|
|
3667
3735
|
job,
|
|
@@ -3671,8 +3739,8 @@ async function runHostChecks(input) {
|
|
|
3671
3739
|
readToken,
|
|
3672
3740
|
branchHead: primaryHead ?? (job.container ?? job.microvm)?.startCommit ?? "",
|
|
3673
3741
|
transcripts,
|
|
3674
|
-
scrub: transcriptScrub(config, [config.apiKey, job.itemKey, readToken]),
|
|
3675
|
-
readWorkItem: () => readWorkItem(config, job.item, deps.fetchImpl),
|
|
3742
|
+
scrub: transcriptScrub(config, [config.apiKey, job.itemKey, readToken], jobDir),
|
|
3743
|
+
readWorkItem: () => readWorkItem(itemCalls(config, job), job.item, deps.fetchImpl),
|
|
3676
3744
|
fetchDiff: deps.fetchDiff ?? ((input2) => diffBetween(input2)),
|
|
3677
3745
|
log
|
|
3678
3746
|
});
|
|
@@ -3714,7 +3782,7 @@ async function runHostChecks(input) {
|
|
|
3714
3782
|
continue;
|
|
3715
3783
|
}
|
|
3716
3784
|
const read = await ready.exec(["head", "-c", String(MAX_CHECK_ITEMS_BYTES + 1), CHECK_ITEMS_FILE], CHECKOUT_DIR);
|
|
3717
|
-
const items = commandItems(read, (text2) => scrubReason(text2, config) ?? text2);
|
|
3785
|
+
const items = commandItems(read, (text2) => scrubReason(text2, config, void 0, jobDir) ?? text2);
|
|
3718
3786
|
if (!items.ok) {
|
|
3719
3787
|
await record(check, "fail", items.reason);
|
|
3720
3788
|
continue;
|
|
@@ -3730,7 +3798,7 @@ async function runHostChecks(input) {
|
|
|
3730
3798
|
continue;
|
|
3731
3799
|
}
|
|
3732
3800
|
const last = lastLine(outcome.stderr) ?? lastLine(outcome.stdout);
|
|
3733
|
-
const scrubbed = last === void 0 ? void 0 : scrubReason(last, config);
|
|
3801
|
+
const scrubbed = last === void 0 ? void 0 : scrubReason(last, config, void 0, jobDir);
|
|
3734
3802
|
await record(check, "fail", `exited ${outcome.status}${scrubbed === void 0 ? " with no output" : `: ${cutReasonLine(scrubbed, 140)}`}`, "", items.items);
|
|
3735
3803
|
}
|
|
3736
3804
|
} catch (err) {
|