@outerlayer/cli 0.38.0-next.20261111182110 → 0.38.0-next.20261111231234
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 +4 -0
- package/dist/agent-setup-3GY4FFSC.js +40 -0
- package/dist/{agent-subcommand-NZFPV3MV.js → agent-subcommand-VDN4AFAJ.js} +5 -5
- package/dist/{artifact-link-cmd-L4BXSQQP.js → artifact-link-cmd-A7SROEQS.js} +2 -2
- package/dist/{bridge-OBIGQXDH.js → bridge-QUQYCBQN.js} +8 -8
- package/dist/{build-4IYEB6OE.js → build-SD44TP2B.js} +14 -14
- package/dist/{build-disk-2MOEPIZF.js → build-disk-4PCVGMAT.js} +12 -12
- package/dist/build-info.json +1 -1
- package/dist/{builder-SVI2D35R.js → builder-JG2DHKSN.js} +11 -11
- package/dist/caller-A2K7SLSL.js +23 -0
- package/dist/{check-XIJ2MOWV.js → check-JNQVYVHI.js} +58 -58
- package/dist/{chunk-QHYCF36K.js → chunk-26BFN6DH.js} +1 -1
- package/dist/{chunk-3YJJ2JDV.js → chunk-2UCTMANO.js} +1 -1
- package/dist/{chunk-MOA4PGYL.js → chunk-2VJVPP5Y.js} +1 -1
- package/dist/{chunk-KA4BMGBR.js → chunk-3C23ZPWR.js} +2 -2
- package/dist/{chunk-TH3K67SR.js → chunk-3T7PXUHN.js} +9 -9
- package/dist/{chunk-ZC2BXXKB.js → chunk-3VWX5BYV.js} +17 -16
- package/dist/{chunk-36XB56GG.js → chunk-43R7JHQI.js} +5 -5
- package/dist/{chunk-SIGBRVEF.js → chunk-4FHDVWKO.js} +18 -5
- package/dist/{chunk-MOFT7QCR.js → chunk-4T2NBVC4.js} +5 -5
- package/dist/{chunk-6FQSV7ZK.js → chunk-5NK2KKG6.js} +3 -3
- package/dist/{chunk-NEXKR5RR.js → chunk-5NVF5TAL.js} +6 -1
- package/dist/{chunk-6GZL5RIV.js → chunk-5OSY3LK3.js} +30 -13
- package/dist/{chunk-OKAAVLLW.js → chunk-5TMM2K23.js} +4 -4
- package/dist/{chunk-PBHAM73F.js → chunk-5UFAWMET.js} +3 -3
- package/dist/{chunk-KR34GXEH.js → chunk-6FB7NTJK.js} +1 -1
- package/dist/{chunk-VNHCN75M.js → chunk-6X2BSMRM.js} +1 -1
- package/dist/{chunk-JDOEEKPN.js → chunk-722KABMV.js} +25 -9
- package/dist/{chunk-IN7QCBO5.js → chunk-7DIYEB3X.js} +6 -6
- package/dist/{chunk-6XORUAR7.js → chunk-7GJEQXOH.js} +1 -1
- package/dist/{chunk-J345NEVJ.js → chunk-A4NWDCWS.js} +5 -5
- package/dist/{chunk-LW5RIKAV.js → chunk-B2SHUO6J.js} +1 -1
- package/dist/{chunk-UWLCJZ45.js → chunk-BBRXFXBB.js} +1 -1
- package/dist/{chunk-3SHX2D37.js → chunk-BJIJYPGC.js} +5 -5
- package/dist/{chunk-N3KGXHV4.js → chunk-BUT777XB.js} +1 -1
- package/dist/{chunk-XAVR7JHO.js → chunk-C4R6LMPQ.js} +10 -10
- package/dist/{chunk-BECC4325.js → chunk-DLUBSTLW.js} +8 -8
- package/dist/{chunk-DKRZZBKI.js → chunk-DZFIRKDZ.js} +3 -3
- package/dist/{chunk-TMROYEP4.js → chunk-ECNWHXIO.js} +4 -4
- package/dist/{chunk-NFPJ2XC2.js → chunk-EJ7ZXBXS.js} +3 -3
- package/dist/{chunk-ATEMEVFF.js → chunk-ELPP5OHC.js} +1 -1
- package/dist/{chunk-6BXJESQF.js → chunk-ERG3WCEC.js} +9 -9
- package/dist/{chunk-QBJ7MMOT.js → chunk-EUHUIIGT.js} +16 -5
- package/dist/{chunk-FQPGZOH3.js → chunk-FUZEOWF4.js} +1 -1
- package/dist/{chunk-ZQII2ZRP.js → chunk-I5U6CFH4.js} +1 -1
- package/dist/{chunk-WV4T6ZOQ.js → chunk-I62FX622.js} +2 -2
- package/dist/{chunk-ORLJK7UT.js → chunk-IGBPPM7F.js} +7 -7
- package/dist/{chunk-36M66QKN.js → chunk-J6KKJGR7.js} +2 -1
- package/dist/{chunk-DULO2L5B.js → chunk-JIANCWJ3.js} +1 -1
- package/dist/{chunk-6XMC6R4W.js → chunk-KVWFAAAQ.js} +1 -1
- package/dist/{chunk-USINHGZI.js → chunk-KZU5WQK5.js} +3 -3
- package/dist/{chunk-I45HTSSA.js → chunk-LVELQ635.js} +1 -1
- package/dist/{chunk-RHPEAVKR.js → chunk-MVERFCX4.js} +1 -1
- package/dist/{chunk-BIMHESZG.js → chunk-N6BNN6ZD.js} +1 -1
- package/dist/{chunk-AJ3YUM23.js → chunk-NDQC2WUJ.js} +1 -1
- package/dist/{chunk-ABRGN5OA.js → chunk-NO4N4D32.js} +4 -4
- package/dist/{chunk-33XLQIV4.js → chunk-NRDFBOKE.js} +3 -3
- package/dist/{chunk-LVNMKOWI.js → chunk-OAPWDSBW.js} +2 -2
- package/dist/{chunk-CT4PKI24.js → chunk-OTWTUHWY.js} +339 -113
- package/dist/{chunk-UPUHL3KC.js → chunk-OYRAQXRQ.js} +7 -7
- package/dist/{chunk-DKTXQ7XQ.js → chunk-PCGU6T7J.js} +2 -2
- package/dist/{chunk-OPCFOIZJ.js → chunk-POBH5YCG.js} +1 -1
- package/dist/{chunk-LKLP5YMH.js → chunk-Q7J4T2VP.js} +7 -7
- package/dist/{chunk-PDPBWX67.js → chunk-QYLBGMTA.js} +17 -6
- package/dist/{chunk-3Z5KBFBB.js → chunk-RCK2MJRG.js} +2 -2
- package/dist/{chunk-F3RBGMHL.js → chunk-RUX4M4AX.js} +1 -1
- package/dist/{chunk-QENFVQ7O.js → chunk-SFSE6YDX.js} +56 -16
- package/dist/{chunk-NJ6IJFKR.js → chunk-SLORYOL4.js} +1 -1
- package/dist/{chunk-QH5NV7EQ.js → chunk-T4FSZ7LA.js} +7 -7
- package/dist/{chunk-4G5SYPK2.js → chunk-UXARYJQ4.js} +1 -1
- package/dist/{chunk-CZDYUKA6.js → chunk-VBSKVGWP.js} +7 -7
- package/dist/{chunk-D5GR3U2O.js → chunk-VRDHLSR2.js} +10 -10
- package/dist/{chunk-AMFCM4H7.js → chunk-VV445Q2R.js} +3 -3
- package/dist/{chunk-UKEJBA5Y.js → chunk-W7BF2RXV.js} +4 -4
- package/dist/{chunk-7GUD2FIF.js → chunk-WFYKTAXZ.js} +1 -1
- package/dist/{chunk-4AEOP5PD.js → chunk-WG5OBUIZ.js} +6 -6
- package/dist/{chunk-IHM7K6RS.js → chunk-Y25ONBS6.js} +4 -4
- package/dist/{chunk-BATSP67Z.js → chunk-Y5S6EUGK.js} +6 -6
- package/dist/{chunk-6YOXYZC2.js → chunk-YZVNZWKD.js} +7 -7
- package/dist/{chunk-CAQSGGPJ.js → chunk-Z42UKOZ6.js} +6 -6
- package/dist/{chunk-SASWFX22.js → chunk-Z7XFVFW2.js} +1 -1
- package/dist/{chunk-3BEMKOFH.js → chunk-ZCX43KZ5.js} +1 -1
- package/dist/{chunk-VQ6ZKSNL.js → chunk-ZH5YLKO6.js} +1 -1
- package/dist/{chunk-QMCWSBQO.js → chunk-ZJHWXRT4.js} +2 -2
- package/dist/{chunk-DE3NQAR7.js → chunk-ZU6LNR3G.js} +3 -3
- package/dist/{chunk-R3S2A7YF.js → chunk-ZUUA6ZGD.js} +97 -49
- package/dist/{claude-launcher-GIT7VNYK.js → claude-launcher-5ALZD5WD.js} +8 -8
- package/dist/{cli-Y5CRBNQQ.js → cli-OUL7NQWX.js} +172 -162
- package/dist/{cli-update-notice-OC4SOSZE.js → cli-update-notice-XZ7I7OWP.js} +2 -2
- package/dist/{command-2RX7FULE.js → command-ASXZLHXU.js} +53 -53
- package/dist/config-5KMNGNK5.js +22 -0
- package/dist/{connect-cmd-DSP6HJRP.js → connect-cmd-XR7XPGQ6.js} +15 -15
- package/dist/{container-start-DFFZVSGX.js → container-start-6FHPPHMU.js} +51 -51
- package/dist/{context-cleanup-FIQMPC6F.js → context-cleanup-HHMQV7KH.js} +5 -5
- package/dist/{context-show-cmd-BPZX3OUE.js → context-show-cmd-4EKSCIF4.js} +16 -16
- package/dist/{control-plane-launch-IIHRG233.js → control-plane-launch-AJPCKLBL.js} +16 -16
- package/dist/{demo-record-cmd-PI7QDFRP.js → demo-record-cmd-LVZOYPR7.js} +9 -9
- package/dist/{demo-voice-cmd-CMCPERTJ.js → demo-voice-cmd-DT6VFD2U.js} +22 -22
- package/dist/{dist-JSSJSW2B.js → dist-7JDEWP5U.js} +2 -2
- package/dist/docker-T7A6GZDD.js +20 -0
- package/dist/{doctor-ZVHGEA3C.js → doctor-FATFZWEA.js} +53 -53
- package/dist/emit-artifact-cmd-B5ZYJKFM.js +44 -0
- package/dist/{emit-cmd-QGVMVSLS.js → emit-cmd-P2XWWVFP.js} +8 -8
- package/dist/emit-criteria-cmd-RHFJYNSU.js +35 -0
- package/dist/{emit-demo-cmd-KLYEKCB3.js → emit-demo-cmd-WELKVLD4.js} +22 -22
- package/dist/{emit-finding-cmd-FZWK3Y4Q.js → emit-finding-cmd-KRNEWZQP.js} +18 -18
- package/dist/{emit-result-cmd-TODAXDFJ.js → emit-result-cmd-NQ6LAE4Z.js} +20 -20
- package/dist/{emit-step-cmd-QI52ZB57.js → emit-step-cmd-HKOYFSYL.js} +18 -18
- package/dist/{exec-client-YQCKCZGW.js → exec-client-2JSXFMEW.js} +9 -9
- package/dist/find-unit-3QYPTK6A.js +24 -0
- package/dist/{findings-cmd-O7I2GKRO.js → findings-cmd-EF4QXYRT.js} +18 -18
- package/dist/{fleet-readiness-BY7PY5FF.js → fleet-readiness-NBYN45IT.js} +16 -16
- package/dist/governing-source-C7MY7KB2.js +41 -0
- package/dist/guest-init-FX2NUAW6.js +20 -0
- package/dist/{hook-fast-3BGU6BF2.js → hook-fast-JZKCKSXB.js} +3 -3
- package/dist/{hook-install-6H6W4UM2.js → hook-install-R66RP7ME.js} +5 -5
- package/dist/host-checks-CZGNR4VC.js +80 -0
- package/dist/host-key-ACYKDZ4X.js +18 -0
- package/dist/{image-tag-IJKYPT6D.js → image-tag-H5CZTC42.js} +9 -9
- package/dist/index.js +4 -4
- package/dist/{init-65RN5X55.js → init-5S6A2SYN.js} +49 -49
- package/dist/init-WDYDTJW2.js +80 -0
- package/dist/{init-agent-R4ZOEFI3.js → init-agent-PJFH7OFD.js} +49 -49
- package/dist/{init-cmd-L4EFMAQ4.js → init-cmd-5SCU7AVL.js} +29 -29
- package/dist/{init-update-ACLVXFS7.js → init-update-NXDPWHK6.js} +26 -26
- package/dist/install-cmd-TMUNQF7U.js +21 -0
- package/dist/{layout-MBCG2IHB.js → layout-LTYJDJ5J.js} +5 -5
- package/dist/{login-browser-COSWHZEC.js → login-browser-LSZKECIB.js} +2 -2
- package/dist/{logs-VX2SXLJH.js → logs-ZEXFSBVF.js} +8 -8
- package/dist/loop-Q76PDO7L.js +90 -0
- package/dist/machine-GI6SZMEK.js +80 -0
- package/dist/{machine-skills-RPKQK52T.js → machine-skills-CYCZGBAM.js} +5 -5
- package/dist/{mcp-install-cmd-GN2K2JM3.js → mcp-install-cmd-TVIOPOIO.js} +5 -5
- package/dist/{mcp-serve-cmd-P34CQIBX.js → mcp-serve-cmd-OCQLRUAK.js} +11 -11
- package/dist/{paths-HV3G2EHE.js → paths-IB5XFML7.js} +8 -8
- package/dist/pending-TX4VIF6P.js +18 -0
- package/dist/{pidfile-4ZG5I7ZR.js → pidfile-VET4I455.js} +9 -9
- package/dist/{record-3XWPD2UP.js → record-3V3HQRGY.js} +9 -9
- package/dist/{relay-ZOWT4YLQ.js → relay-V7LX2WR6.js} +6 -6
- package/dist/{relay-protocol-FDFEVLQT.js → relay-protocol-QGEWESBF.js} +6 -6
- package/dist/{run-cmd-ZVNOKJB3.js → run-cmd-M5THCWDD.js} +18 -18
- package/dist/{runner-agents-3NUGNJD6.js → runner-agents-OTYZ73WU.js} +5 -5
- package/dist/runner-env-3QPJQ2H2.js +24 -0
- package/dist/{runner-identity-F2Z3TXJ7.js → runner-identity-GTWFQEIN.js} +11 -11
- package/dist/{runner-key-AOK7W733.js → runner-key-ZXNXWBSP.js} +49 -49
- package/dist/{session-sender-V3INPB34.js → session-sender-AEUNLU5R.js} +21 -21
- package/dist/{spec-cmd-LYGXRFVY.js → spec-cmd-4EB45ELL.js} +109 -22
- package/dist/{starter-pack-7QA7J5FT.js → starter-pack-HMJWEIVX.js} +6 -6
- package/dist/state-O3A3CIDQ.js +18 -0
- package/dist/{status-SPPT7WU5.js → status-R4JD34DO.js} +49 -49
- package/dist/{sync-cmd-EDSOKOXS.js → sync-cmd-2HOFZYI6.js} +20 -20
- package/dist/update-steps-CGWJJ2IA.js +81 -0
- package/dist/{watch-GBDNXFAK.js → watch-ZY62C5WB.js} +20 -20
- package/dist/{work-claim-cmd-SHKDYS7J.js → work-claim-cmd-4KQYRNRC.js} +27 -27
- package/dist/work-cmd-GNYWSA2O.js +33 -0
- package/dist/work-comment-cmd-7D3DHQ3O.js +39 -0
- package/dist/{work-demo-cmd-YJ654BQP.js → work-demo-cmd-PDILNMRF.js} +18 -18
- package/dist/{work-logs-cmd-RUNYYALP.js → work-logs-cmd-ER3AYV62.js} +18 -18
- package/dist/{work-needs-attention-cmd-NRDFGJPP.js → work-needs-attention-cmd-MAFPEANV.js} +18 -18
- package/dist/{work-no-change-cmd-FDA7PYB7.js → work-no-change-cmd-GDN5EE6N.js} +18 -18
- package/dist/{work-open-pr-cmd-LEWPNTW5.js → work-open-pr-cmd-56TRIE5I.js} +19 -19
- package/dist/work-pr-cmd-W3T6ELML.js +34 -0
- package/dist/{work-proofs-cmd-QKIEJJRF.js → work-proofs-cmd-Y2OMM37N.js} +20 -20
- package/dist/{work-proofs-record-2M4A5OIF.js → work-proofs-record-I2VLOMRD.js} +26 -26
- package/dist/{work-stop-cmd-HH2SSJIO.js → work-stop-cmd-PREZOSNY.js} +18 -18
- package/package.json +3 -3
- package/skill-pack/maintained/outerlayer-amend/references/threads.md +10 -4
- package/skill-pack/maintained/outerlayer-build/SKILL.md +8 -0
- package/skill-pack/maintained/outerlayer-build/references/agent-briefs.md +1 -1
- package/skill-pack/maintained/outerlayer-build/references/code-review-judge.md +15 -5
- package/skill-pack/maintained/outerlayer-revise/SKILL.md +68 -0
- package/skill-pack/maintained/outerlayer-spec/SKILL.md +149 -0
- package/skill-pack/maintained/outerlayer-spec/references/revise-an-issue.md +14 -0
- package/skill-pack/shipped.json +1 -0
- package/skill-pack/template/spec/SKILL.md +5 -120
- package/dist/agent-setup-U4XTZO56.js +0 -40
- package/dist/caller-PW7R46M7.js +0 -23
- package/dist/config-AOOR5BPQ.js +0 -22
- package/dist/docker-6MPPSTR4.js +0 -20
- package/dist/emit-artifact-cmd-VJ3C36RU.js +0 -44
- package/dist/emit-criteria-cmd-UOHOOSVV.js +0 -35
- package/dist/find-unit-YT25OH3F.js +0 -24
- package/dist/governing-source-XRLJFSPE.js +0 -41
- package/dist/guest-init-X2HLNETS.js +0 -20
- package/dist/host-checks-U5JKQQMM.js +0 -80
- package/dist/host-key-KQ6JWRB4.js +0 -18
- package/dist/init-CYTHJSTQ.js +0 -80
- package/dist/install-cmd-DHIVJEBO.js +0 -21
- package/dist/loop-4ATDJGQV.js +0 -90
- package/dist/machine-UIA7MN3U.js +0 -80
- package/dist/pending-I2EJ7TMY.js +0 -18
- package/dist/runner-env-JS2WDB5L.js +0 -24
- package/dist/state-64OMLIN4.js +0 -18
- package/dist/update-steps-XPEATLFQ.js +0 -81
- package/dist/work-cmd-QR62TX6Q.js +0 -33
- package/dist/work-comment-cmd-DUDVMT6U.js +0 -39
- package/dist/work-pr-cmd-Y4O34WDA.js +0 -34
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { itemsSentence, criteriaOf, hostItemsOf, loadCitationFinder, testFileMatcher, planCriteria, wholeItems, judgeGroups, failedItems, inCriteriaOrder, testsByCriterion, oneLineReason, criterionInputs, parseJudgeAnswer, judgedItems, openPullRequests, MAX_TEST_FILE_BYTES } from './chunk-
|
|
4
|
-
import { RUNNER_PROTOCOL } from './chunk-
|
|
3
|
+
import { itemsSentence, criteriaOf, hostItemsOf, loadCitationFinder, testFileMatcher, planCriteria, wholeItems, judgeGroups, failedItems, inCriteriaOrder, testsByCriterion, oneLineReason, criterionInputs, parseJudgeAnswer, judgedItems, openPullRequests, MAX_TEST_FILE_BYTES, wholeEntries } from './chunk-722KABMV.js';
|
|
4
|
+
import { RUNNER_PROTOCOL } from './chunk-KVWFAAAQ.js';
|
|
5
5
|
import { sha256OfFile, downloadPinned, VoiceDownloadError } from './chunk-2PGI6RDE.js';
|
|
6
6
|
import { zodProblem } from './chunk-I3LTIAOR.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-A4NWDCWS.js';
|
|
8
|
+
import { upgradedStarterText } from './chunk-4T2NBVC4.js';
|
|
9
|
+
import { HELPER_PATH, HELPER_RECORD, DOCKERD_LOG } from './chunk-DZFIRKDZ.js';
|
|
10
|
+
import { writeDockerClientConfig } from './chunk-N6BNN6ZD.js';
|
|
11
|
+
import { senderPidfile } from './chunk-ECNWHXIO.js';
|
|
12
|
+
import { installScrubContext } from './chunk-3T7PXUHN.js';
|
|
13
13
|
import { readsJobState, READ_JOB_STATE_FORMATS, jobStateFormatOf } from './chunk-ZVB57WI6.js';
|
|
14
|
-
import { runnerImageVersion } from './chunk-
|
|
15
|
-
import { claimCalls, spoolHomeFor, itemCalls, claimItem, leftByRunnerKey, configForJob } from './chunk-
|
|
14
|
+
import { runnerImageVersion } from './chunk-UXARYJQ4.js';
|
|
15
|
+
import { claimCalls, spoolHomeFor, itemCalls, claimItem, leftByRunnerKey, configForJob } from './chunk-RCK2MJRG.js';
|
|
16
16
|
import { receiveFiles } from './chunk-NN33FYXG.js';
|
|
17
|
-
import { readDefaultBranchFiles, readDefaultBranchHead, buildRepositoryImage, 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, fetchCommit, readBranchHead, diffBetween, prepareImageBuild, KEY_PREFIX, TAG_HOST, SHARED_OWNER, SHARED_NAME, universalBase, metadataFromLabels, writeRecord } from './chunk-Q7J4T2VP.js';
|
|
18
|
+
import { FETCHED_DIR, toolsDockerfile, FETCHED_FFMPEG, FETCHED_GH, FETCHED_TINI, FETCHED_HEADLESS_SHELL, FETCHED_PLAYWRIGHT_FFMPEG, FETCHED_VOICE_DIR } from './chunk-NO4N4D32.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, WorkCommandError, isSignatureRefusal, getJson } from './chunk-
|
|
25
|
-
import { isBuiltinContainer, isBuiltinVm, isBuiltinSandbox, keyRunnerFactory, runnerCredentialProblem, builtinKind, optionalEgress, egressSummary, DEFAULT_WORKSPACE_KEEP_DAYS, DEFAULT_CHECK_TIME_LIMIT_MINUTES, DEFAULT_SETUP_MINUTES, allowHostProblem, systemClock, emptyEgressCounts, hostAllowed, sandboxSizeOf, sandboxTimeLimitMinutes, networkOf, imageBuildOf, DEFAULT_SAVED_STATE_MAX_BYTES } from './chunk-
|
|
26
|
-
import { formatBytes, volumeBytes, allocatedBytes, DEFAULT_BUILD_DISK, DEFAULT_CACHE_DISK, freeBytes } from './chunk-
|
|
27
|
-
import { firstLine, writeJobFile, readJobFile, spawnRun, RUNNER_LABEL, BUILD_LABEL, said, NETWORK_HELPER_MEMORY, createDockerHost, builderSpec, childEnvironment, containerExecArgs, readDu, withAnswerProtocol, JUDGE_TREE, MAX_REPORT_BYTES, runnerLabelValue, parseSize, readJobFileChecked, NETWORK_READY_FILE, networkHelperName, prepareRunArgs, containerRunArgs, judgeCommand, JUDGE_DIR, WORKSPACE_LABEL, homeCopyRunArgs, networkHelperRunArgs, JUDGE_MAX_TURNS, JUDGE_ITEMS, answerFileName, hashJudgeProgram, identityScript, identityArgs, parseIdentity, mountableHome, homeCopyScript, homeCopyArgs, COMMAND_DIR, judgeProgramRecord, MAX_ITEMS_BYTES, JUDGE_REPORT, identityRunArgs, SAVED_STATE_LABEL } from './chunk-
|
|
28
|
-
import { universalImagePending, RecipeError, writeSanitizedRecipe, classifyProperties, DOCKER_FEATURE } from './chunk-
|
|
29
|
-
import { sanitizeTerminal, planArtifactUpload } from './chunk-
|
|
30
|
-
import { sharedSkillNames, skillConflictMessage } from './chunk-
|
|
21
|
+
import { vmExecArgs, runExec, execCapture, waitForAgent } from './chunk-BBRXFXBB.js';
|
|
22
|
+
import { socketPathProblem, vsockLinks, linkVsockSockets, GUEST_CID, LEASE_LINK } from './chunk-NRDFBOKE.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-VBSKVGWP.js';
|
|
24
|
+
import { postJson, WorkCommandError, isSignatureRefusal, getJson } from './chunk-5OSY3LK3.js';
|
|
25
|
+
import { isBuiltinContainer, isBuiltinVm, isBuiltinSandbox, keyRunnerFactory, runnerCredentialProblem, builtinKind, optionalEgress, egressSummary, DEFAULT_WORKSPACE_KEEP_DAYS, readOnlyRemoteOf, DEFAULT_CHECK_TIME_LIMIT_MINUTES, DEFAULT_SETUP_MINUTES, allowHostProblem, systemClock, emptyEgressCounts, hostAllowed, sandboxSizeOf, readOnlyOption, sandboxTimeLimitMinutes, networkOf, imageBuildOf, DEFAULT_SAVED_STATE_MAX_BYTES } from './chunk-EUHUIIGT.js';
|
|
26
|
+
import { formatBytes, volumeBytes, allocatedBytes, DEFAULT_BUILD_DISK, DEFAULT_CACHE_DISK, freeBytes } from './chunk-3C23ZPWR.js';
|
|
27
|
+
import { firstLine, writeJobFile, readJobFile, spawnRun, RUNNER_LABEL, BUILD_LABEL, said, NETWORK_HELPER_MEMORY, createDockerHost, builderSpec, childEnvironment, containerExecArgs, readDu, withAnswerProtocol, JUDGE_TREE, MAX_REPORT_BYTES, runnerLabelValue, parseSize, readJobFileChecked, NETWORK_READY_FILE, networkHelperName, prepareRunArgs, containerRunArgs, judgeCommand, JUDGE_DIR, WORKSPACE_LABEL, homeCopyRunArgs, networkHelperRunArgs, JUDGE_MAX_TURNS, JUDGE_ITEMS, answerFileName, hashJudgeProgram, identityScript, identityArgs, parseIdentity, mountableHome, homeCopyScript, homeCopyArgs, COMMAND_DIR, judgeProgramRecord, MAX_ITEMS_BYTES, JUDGE_REPORT, identityRunArgs, SAVED_STATE_LABEL } from './chunk-ERG3WCEC.js';
|
|
28
|
+
import { universalImagePending, RecipeError, writeSanitizedRecipe, classifyProperties, DOCKER_FEATURE } from './chunk-FUZEOWF4.js';
|
|
29
|
+
import { sanitizeTerminal, planArtifactUpload } from './chunk-26BFN6DH.js';
|
|
30
|
+
import { sharedSkillNames, skillConflictMessage } from './chunk-I62FX622.js';
|
|
31
31
|
import { readCloudConfig } from './chunk-HWVMRETT.js';
|
|
32
|
-
import { signerFor } from './chunk-
|
|
33
|
-
import { vmAssetsDir, RUNNER_DIR_MODE, RUNNER_FILE_MODE, runnerDir, workspacesDir, jobsDir, storeScopes, spoolDir, orgStoreIn, rootfsDir, imagesDir, sessionsDir, builderCacheDiskPath, buildsDir, buildDir, ghConfigDir, runnerDirOfBuild, mirrorDir, orgHomeDir, jobConsolePath, vsockPath, builderConsolePath, rootfsPathFor, diskTemplatesDir, deliveryDir, SHIM_DIR } from './chunk-
|
|
34
|
-
import { BUILD_HOME, SandboxError, JOB_MOUNT, heldBuildAuthority, IMAGE_BUNDLES, writeTrustFiles, buildEnvironment, trustEnvironment, CHECKOUT_DIR, parseIsolation, containerLocalAddress, destinationEnvironment, withHooksPath, startBuildServices, headerVariables, authorEnvironment, sharedUserEnvironment, withTunnelRecord, commitIdentityRecord, repositoriesOf, RELAY_PORT, repositoryPath, lifecycleWorkdir, CHECK_ITEMS_FILE, parseProxied, readBundleScript, applyTrust, STAND_IN, proxyEnvironment, describeSandboxError, dropBuildAuthority, sandboxSettingsFrom, createSandboxClient, hostKeyOf, buildAuthorityFor, checkEnvironment, withMiseVariables, checkoutPath, primaryOf, variablesFor, carried6to4, classifyAddress, EVAL_INPUT_DIR, isMiseVariableAllowed, variableForPath, droppedRequestHeaders, hasDotDotSegment, routeNameOf, toolProxyEnvironment } from './chunk-
|
|
35
|
-
import { agentCredential, RUNNER_WORDED_REASONS, UNKNOWN_TRACKING_REASON, UNKNOWN_TRANSPORT_REASON, RELAY_USER, currentAgentCredential, removedAgentCredentialValues, managedAgentCredential, realFdStorePort, builtInNames, 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-I5U6CFH4.js';
|
|
33
|
+
import { vmAssetsDir, RUNNER_DIR_MODE, RUNNER_FILE_MODE, runnerDir, workspacesDir, jobsDir, storeScopes, spoolDir, orgStoreIn, rootfsDir, imagesDir, sessionsDir, builderCacheDiskPath, buildsDir, buildDir, ghConfigDir, runnerDirOfBuild, mirrorDir, orgHomeDir, jobConsolePath, vsockPath, builderConsolePath, rootfsPathFor, diskTemplatesDir, deliveryDir, SHIM_DIR } from './chunk-JIANCWJ3.js';
|
|
34
|
+
import { BUILD_HOME, SandboxError, JOB_MOUNT, heldBuildAuthority, IMAGE_BUNDLES, writeTrustFiles, buildEnvironment, trustEnvironment, CHECKOUT_DIR, parseIsolation, containerLocalAddress, destinationEnvironment, withHooksPath, startBuildServices, headerVariables, authorEnvironment, sharedUserEnvironment, withTunnelRecord, commitIdentityRecord, repositoriesOf, RELAY_PORT, repositoryPath, lifecycleWorkdir, CHECK_ITEMS_FILE, parseProxied, readBundleScript, applyTrust, STAND_IN, proxyEnvironment, describeSandboxError, dropBuildAuthority, sandboxSettingsFrom, createSandboxClient, hostKeyOf, buildAuthorityFor, checkEnvironment, withMiseVariables, checkoutPath, primaryOf, variablesFor, carried6to4, classifyAddress, EVAL_INPUT_DIR, isMiseVariableAllowed, variableForPath, droppedRequestHeaders, hasDotDotSegment, routeNameOf, toolProxyEnvironment } from './chunk-4FHDVWKO.js';
|
|
35
|
+
import { agentCredential, RUNNER_WORDED_REASONS, UNKNOWN_TRACKING_REASON, UNKNOWN_TRANSPORT_REASON, RELAY_USER, currentAgentCredential, removedAgentCredentialValues, managedAgentCredential, realFdStorePort, builtInNames, 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-EJ7ZXBXS.js';
|
|
36
36
|
import { versionAtLeast } from './chunk-SF2TBJBP.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-
|
|
39
|
-
import { MAINTAINED_SKILLS } 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-J6KKJGR7.js';
|
|
38
|
+
import { sessionFolderIn, legacyAgent, defaultAgents, parsePolicy, AGENTS_SKILLS_BASE, OUTERLAYER_SKILLS_BASE, orderSessions, extractFacts, sessionsToTimeline, resolvePackRoot } from './chunk-QYLBGMTA.js';
|
|
39
|
+
import { MAINTAINED_SKILLS } from './chunk-ELPP5OHC.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, JUDGE_NOT_RUN_ITEM_ID, REVIEWED_COMMIT_ITEM_ID, CHECK_ITEM_REASON_MAX_LENGTH, UNREVIEWED_FILES_ITEM_ID, CHECK_ITEM_HREF_MAX_LENGTH, downconvertSession } from './chunk-
|
|
42
|
+
import { scrubText, MIN_SCRUBBED_LITERAL, setCustomScrubbers, setLocalIdentity, setRepoRoot, forkFor, scrubDeep } from './chunk-7GJEQXOH.js';
|
|
43
|
+
import { CheckItemsSchema, CODE_REVIEW_NAME, JUDGE_NOT_RUN_ITEM_ID, REVIEWED_COMMIT_ITEM_ID, CHECK_ITEM_REASON_MAX_LENGTH, UNREVIEWED_FILES_ITEM_ID, problemKind, CODE_REVIEW_PROBLEMS_MAX, CHECK_ITEM_HREF_MAX_LENGTH, downconvertSession } from './chunk-5NVF5TAL.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, renameSync, rmdirSync, createReadStream, lstatSync, unlinkSync, chmodSync, realpathSync, writeSync, truncateSync, cpSync, fstatSync, readSync, createWriteStream, copyFileSync, linkSync } from 'fs';
|
|
46
46
|
import { join, dirname, isAbsolute, delimiter, basename, sep, relative, resolve } from 'path';
|
|
@@ -73,6 +73,7 @@ var RESUME_DIR = "/build/home/.outerlayer/resume";
|
|
|
73
73
|
var META_FILE = "meta.json";
|
|
74
74
|
var SESSION_ID_VARIABLE = "OUTERLAYER_SESSION_ID";
|
|
75
75
|
var RESUME_SESSION_VARIABLE = "OUTERLAYER_RESUME_SESSION";
|
|
76
|
+
var CONTINUE_VARIABLE = "OUTERLAYER_CONTINUE";
|
|
76
77
|
var WORK_ITEM_ID = /^[A-Za-z0-9_-]{1,64}$/;
|
|
77
78
|
var SESSION_ID = /^[A-Za-z0-9-]{1,64}$/;
|
|
78
79
|
var REASON_TEXT = {
|
|
@@ -225,7 +226,7 @@ function packKeptSession(dir, meta, agents = defaultAgents(), job) {
|
|
|
225
226
|
return Readable.from(pack());
|
|
226
227
|
}
|
|
227
228
|
function resumeDecision(input, agents = defaultAgents()) {
|
|
228
|
-
if (input.queue !== "amend") return void 0;
|
|
229
|
+
if (input.queue !== "amend" && input.continueSession !== true) return void 0;
|
|
229
230
|
if (!input.builtin || jobAgent(input.job, agents)?.adapter.launch?.session === void 0) return { resumed: false, reason: "build_type_cannot_resume" };
|
|
230
231
|
if (input.kept === void 0) return { resumed: false, reason: "no_saved_session" };
|
|
231
232
|
return { resumed: true, fromSessionId: input.kept.sessionId, fromClaimId: input.kept.claimId };
|
|
@@ -233,7 +234,9 @@ function resumeDecision(input, agents = defaultAgents()) {
|
|
|
233
234
|
async function prepareResume(input, agents = defaultAgents()) {
|
|
234
235
|
const sessionId = (input.newSessionId ?? randomUUID)();
|
|
235
236
|
const fresh = (resume) => ({ sessionId, resume, env: { [SESSION_ID_VARIABLE]: sessionId } });
|
|
236
|
-
if (input.queue !== "amend") return fresh(void 0);
|
|
237
|
+
if (input.queue !== "amend" && input.continueSession !== true) return fresh(void 0);
|
|
238
|
+
const build = input.queue !== "amend";
|
|
239
|
+
const what = build ? "build" : "agent job";
|
|
237
240
|
const dir = keptSessionDir(input.configPath, input.organizationId, input.workItemId);
|
|
238
241
|
let kept = readKeptSession(dir, agents, input.job);
|
|
239
242
|
if (kept !== void 0 && input.requireScrubNote === true && kept.meta.scrubbed !== true) {
|
|
@@ -241,20 +244,20 @@ async function prepareResume(input, agents = defaultAgents()) {
|
|
|
241
244
|
input.log("the saved session was kept before the runner scrubbed sessions, so it is removed");
|
|
242
245
|
kept = void 0;
|
|
243
246
|
}
|
|
244
|
-
const decision = resumeDecision({ queue: input.queue, builtin: input.builtin, kept: kept?.meta, job: input.job }, agents);
|
|
247
|
+
const decision = resumeDecision({ queue: input.queue, continueSession: input.continueSession, builtin: input.builtin, kept: kept?.meta, job: input.job }, agents);
|
|
245
248
|
if (!decision.resumed) {
|
|
246
|
-
input.log(
|
|
249
|
+
input.log(`${what} starts fresh because ${REASON_TEXT[decision.reason]}`);
|
|
247
250
|
return fresh(decision);
|
|
248
251
|
}
|
|
249
252
|
const meta = kept.meta;
|
|
250
253
|
try {
|
|
251
254
|
await input.restore({ dir, meta });
|
|
252
255
|
} catch (err) {
|
|
253
|
-
input.log(
|
|
256
|
+
input.log(`${what} starts fresh because ${REASON_TEXT.session_not_loaded}: ${describeCallFailure(err)}`);
|
|
254
257
|
return fresh({ resumed: false, reason: "session_not_loaded" });
|
|
255
258
|
}
|
|
256
|
-
input.log(
|
|
257
|
-
return { sessionId, resume: decision, env: { [SESSION_ID_VARIABLE]: sessionId, [RESUME_SESSION_VARIABLE]: `${RESUME_DIR}/${sessionFilesOf(meta.sessionId, agents, input.job).entries[0]}
|
|
259
|
+
input.log(`${what} continues session ${meta.sessionId.slice(0, 8)} of claim ${shortClaim(meta.claimId)}`);
|
|
260
|
+
return { sessionId, resume: decision, env: { [SESSION_ID_VARIABLE]: sessionId, [RESUME_SESSION_VARIABLE]: `${RESUME_DIR}/${sessionFilesOf(meta.sessionId, agents, input.job).entries[0]}`, ...build ? { [CONTINUE_VARIABLE]: "1" } : {} } };
|
|
258
261
|
}
|
|
259
262
|
var COPY_OUT_SCRIPT = 'cd "$1" 2>/dev/null && [ -f "$2" ] || exit 3; shift; for entry in "$@"; do if [ -e "$entry" ]; then set -- "$@" "$entry"; fi; shift; done; exec tar -cf - "$@"';
|
|
260
263
|
var SESSION_COPY_MS = 15 * 6e4;
|
|
@@ -2460,6 +2463,15 @@ async function prepareBranch(opts) {
|
|
|
2460
2463
|
startCommit: await mustGit(git2, workdir, `reading the commit of ${defaultBranch}`, ["rev-parse", `origin/${defaultBranch}`])
|
|
2461
2464
|
};
|
|
2462
2465
|
}
|
|
2466
|
+
async function prepareDefaultBranch(opts) {
|
|
2467
|
+
const { workdir } = opts;
|
|
2468
|
+
const git2 = opts.git ?? localGit;
|
|
2469
|
+
const defaultBranch = await remoteDefaultBranch(git2, workdir);
|
|
2470
|
+
await fetchBranch(git2, workdir, defaultBranch);
|
|
2471
|
+
await mustGit(git2, workdir, `checking out ${defaultBranch}`, ["checkout", "--quiet", "-B", defaultBranch, `origin/${defaultBranch}`]);
|
|
2472
|
+
const head = await mustGit(git2, workdir, "reading the checked-out commit", ["rev-parse", "HEAD"]);
|
|
2473
|
+
return { branch: defaultBranch, head, startCommit: head };
|
|
2474
|
+
}
|
|
2463
2475
|
async function keepUnpushedCommits(git2, workdir, branch) {
|
|
2464
2476
|
const local = await git2(workdir, ["rev-parse", "--quiet", "--verify", `refs/heads/${branch}^{commit}`]);
|
|
2465
2477
|
if (local.status !== 0) return void 0;
|
|
@@ -2928,21 +2940,18 @@ async function checkOut(input, entry, restored, fromItemDisk) {
|
|
|
2928
2940
|
}
|
|
2929
2941
|
}
|
|
2930
2942
|
try {
|
|
2931
|
-
const
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
return { status: ran.status, stdout: ran.stdout.trim(), stderr: ran.stderr.trim() };
|
|
2937
|
-
}
|
|
2938
|
-
});
|
|
2943
|
+
const git2 = async (cwd, args) => {
|
|
2944
|
+
const ran = await exec(["git", ...args], cwd, { quiet: true });
|
|
2945
|
+
return { status: ran.status, stdout: ran.stdout.trim(), stderr: ran.stderr.trim() };
|
|
2946
|
+
};
|
|
2947
|
+
const prepared = entry.branch === void 0 ? await prepareDefaultBranch({ workdir: path, git: git2 }) : await prepareBranch({ workdir: path, branch: entry.branch, git: git2 });
|
|
2939
2948
|
if (prepared.kept !== void 0) log.line(`${tag} ${entry.primary ? "" : `${entry.repository}: `}${keptCommitsLine(prepared.branch, prepared.kept)}`);
|
|
2940
2949
|
log.line(`${tag} ${entry.primary ? "" : `${entry.repository} `}on ${prepared.branch} at ${prepared.head.slice(0, 8)}`);
|
|
2941
2950
|
return { ok: true, head: prepared.head, startCommit: prepared.startCommit };
|
|
2942
2951
|
} catch (err) {
|
|
2943
2952
|
if (err instanceof BranchPrepareError) {
|
|
2944
2953
|
const reason = entry.primary ? err.message : `${entry.repository}: ${err.message}`;
|
|
2945
|
-
return failed(restored ? `the ${what} checkout of ${entry.repository} could not be switched to ${entry.branch}: ${err.message}` : reason);
|
|
2954
|
+
return failed(restored ? `the ${what} checkout of ${entry.repository} could not be switched to ${entry.branch ?? "its default branch"}: ${err.message}` : reason);
|
|
2946
2955
|
}
|
|
2947
2956
|
throw err;
|
|
2948
2957
|
}
|
|
@@ -4425,7 +4434,7 @@ async function provisionSandboxOnce(input, itemDiskFailed) {
|
|
|
4425
4434
|
environment.credentials = tokens.used();
|
|
4426
4435
|
let services;
|
|
4427
4436
|
try {
|
|
4428
|
-
const gitRemote = gitRemoteFor(runtime, { repositories, tokens, buildDir: buildDir2, log: (line2) => log.line(`${tag} ${line2}`), ...input.queue
|
|
4437
|
+
const gitRemote = gitRemoteFor(runtime, { repositories, tokens, buildDir: buildDir2, log: (line2) => log.line(`${tag} ${line2}`), ...readOnlyOption(input.queue) });
|
|
4429
4438
|
services = await startServicesFor(runtime, config, buildDir2, jobDir, itemKey, true, gitRemote, "stream", input.leaseExpiryMs === void 0 ? void 0 : leaseFor(runtime, buildId, input.leaseExpiryMs), void 0, (line2) => log.line(`${tag} ${line2}`));
|
|
4430
4439
|
runtime.tunnels.set(buildId, services);
|
|
4431
4440
|
} catch (err) {
|
|
@@ -4603,6 +4612,33 @@ async function provisionSandboxOnce(input, itemDiskFailed) {
|
|
|
4603
4612
|
function asContainerJob(job) {
|
|
4604
4613
|
return { ...job, container: job.sandbox.container };
|
|
4605
4614
|
}
|
|
4615
|
+
async function leaveRelay(runtime, buildId) {
|
|
4616
|
+
runtime.leases.get(buildId)?.stop();
|
|
4617
|
+
const relay = runtime.relays.get(buildId);
|
|
4618
|
+
if (relay !== void 0) {
|
|
4619
|
+
runtime.relays.delete(buildId);
|
|
4620
|
+
await relay.close();
|
|
4621
|
+
}
|
|
4622
|
+
}
|
|
4623
|
+
async function rejoinOf(runtime, own) {
|
|
4624
|
+
const services = runtime.tunnels.get(own.container.buildId);
|
|
4625
|
+
const joinSecret = runtime.sandbox.joinSecrets.get(own.container.buildId);
|
|
4626
|
+
if (services?.streams === void 0 || joinSecret === void 0) throw new Error("the runner no longer holds the build's tunnel and join secret, so it cannot join the build's relay again");
|
|
4627
|
+
const sandbox = await sandboxOfBuild(runtime, own);
|
|
4628
|
+
if (sandbox === void 0) throw new SandboxGoneError(own.sandboxId);
|
|
4629
|
+
return { sandbox, sandboxed: runtimeInSandbox(runtime, sandbox), streams: services.streams, joinSecret };
|
|
4630
|
+
}
|
|
4631
|
+
async function startSandboxContainerAgain(runtime, own, rejoin, jobDir, log) {
|
|
4632
|
+
const state = own.container;
|
|
4633
|
+
const { sandbox, sandboxed } = rejoin;
|
|
4634
|
+
const started = await sandboxed.host.start(state.container);
|
|
4635
|
+
if (started.status !== 0) throw new Error(`the build's container could not be started again (exit ${started.status})`);
|
|
4636
|
+
if (!await waitForRelay(sandboxed, state.container)) throw new Error("the relay in the build's container did not start again");
|
|
4637
|
+
joinRelay(runtime, sandbox, { buildId: state.buildId, container: state.container }, rejoin.streams, rejoin.joinSecret, log);
|
|
4638
|
+
const delivered = await deliverJobFiles(sandboxed, state, ["gh", "git-hooks", "context"], secretsOf(runtime, jobDir));
|
|
4639
|
+
if (!delivered.ok) throw new Error(delivered.reason);
|
|
4640
|
+
state.stopped = false;
|
|
4641
|
+
}
|
|
4606
4642
|
function sandboxJudgeEnvironment(input) {
|
|
4607
4643
|
const own = input.job.sandbox;
|
|
4608
4644
|
const state = own.container;
|
|
@@ -4610,27 +4646,14 @@ function sandboxJudgeEnvironment(input) {
|
|
|
4610
4646
|
return {
|
|
4611
4647
|
stop: async () => {
|
|
4612
4648
|
const { runtime } = input;
|
|
4613
|
-
const
|
|
4614
|
-
const
|
|
4615
|
-
|
|
4616
|
-
const sandbox = await sandboxOfBuild(runtime, own);
|
|
4617
|
-
if (sandbox === void 0) throw new SandboxGoneError(own.sandboxId);
|
|
4618
|
-
const sandboxed = runtimeInSandbox(runtime, sandbox);
|
|
4619
|
-
runtime.leases.get(state.buildId)?.stop();
|
|
4620
|
-
const relay = runtime.relays.get(state.buildId);
|
|
4621
|
-
if (relay !== void 0) {
|
|
4622
|
-
runtime.relays.delete(state.buildId);
|
|
4623
|
-
await relay.close();
|
|
4624
|
-
}
|
|
4649
|
+
const rejoin = await rejoinOf(runtime, own);
|
|
4650
|
+
const { sandbox, sandboxed } = rejoin;
|
|
4651
|
+
await leaveRelay(runtime, state.buildId);
|
|
4625
4652
|
const removed = await client(runtime).command(sandbox, removeBuildContainersLine(state.container));
|
|
4626
4653
|
if (removed.exitCode !== 0) throw new Error(`the containers the build started could not be removed (exit ${removed.exitCode ?? "none"})`);
|
|
4627
4654
|
await sandboxed.host.stop(state.container);
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
if (!await waitForRelay(sandboxed, state.container)) throw new Error("the relay in the build's container did not start again");
|
|
4631
|
-
joinRelay(runtime, sandbox, { buildId: state.buildId, container: state.container }, services.streams, joinSecret, input.log);
|
|
4632
|
-
const delivered = await deliverJobFiles(sandboxed, state, ["gh", "git-hooks", "context"], secretsOf(runtime, input.jobDir));
|
|
4633
|
-
if (!delivered.ok) throw new Error(delivered.reason);
|
|
4655
|
+
state.stopped = true;
|
|
4656
|
+
await startSandboxContainerAgain(runtime, own, rejoin, input.jobDir, input.log);
|
|
4634
4657
|
},
|
|
4635
4658
|
hashProgram: async () => (await inner()).hashProgram(),
|
|
4636
4659
|
prepare: async (files, tree) => (await inner()).prepare(files, tree),
|
|
@@ -4706,17 +4729,79 @@ async function endSandboxCommand(runtime, state, jobDir, warn) {
|
|
|
4706
4729
|
appendCommandLog(jobDir, probe.bytes);
|
|
4707
4730
|
if (probe.bytes.length === 0 || offset + probe.bytes.length >= probe.size) break;
|
|
4708
4731
|
}
|
|
4732
|
+
await leaveRelay(runtime, state.buildId);
|
|
4709
4733
|
await sandboxed.host.stop(state.container.container);
|
|
4734
|
+
state.container.stopped = true;
|
|
4710
4735
|
} catch (err) {
|
|
4711
4736
|
warn(`ending the build's command in its sandbox failed: ${describeCallFailure(err)} \xB7 continuing`);
|
|
4712
4737
|
}
|
|
4713
4738
|
}
|
|
4739
|
+
var SESSION_BYTES_LIMIT = 67108864;
|
|
4740
|
+
var SESSION_MOVE_MS = 9e5;
|
|
4741
|
+
var BASE64_OUTPUT_SCRIPT = 'f="$(mktemp)" || exit 70; "$@" > "$f"; code=$?; base64 "$f" | tr -d "\\n"; rm -f "$f"; exit "$code"';
|
|
4742
|
+
async function bytesOf(source, limit) {
|
|
4743
|
+
if (typeof source === "string" || Buffer.isBuffer(source)) return Buffer.from(source);
|
|
4744
|
+
const parts = [];
|
|
4745
|
+
let size = 0;
|
|
4746
|
+
for await (const part of source) {
|
|
4747
|
+
const bytes = Buffer.from(part);
|
|
4748
|
+
size += bytes.length;
|
|
4749
|
+
if (size > limit) throw new Error(`the session holds more than ${limit} bytes`);
|
|
4750
|
+
parts.push(bytes);
|
|
4751
|
+
}
|
|
4752
|
+
return Buffer.concat(parts);
|
|
4753
|
+
}
|
|
4754
|
+
function sessionGuestOfSandbox(runtime, own) {
|
|
4755
|
+
const state = own.container;
|
|
4756
|
+
const exec = (argv) => ({ container: state.container, user: state.agentUser ?? ADDED_USER, env: NO_ENV, argv });
|
|
4757
|
+
const host = async () => (await inSandbox(runtime, own)).host;
|
|
4758
|
+
return {
|
|
4759
|
+
run: async (argv) => (await host()).exec(exec(argv)),
|
|
4760
|
+
stream: async (argv, io) => {
|
|
4761
|
+
if (io.signal?.aborted === true) throw new Error("the copy was stopped before it started");
|
|
4762
|
+
const result = io.stdin === void 0 ? await (await host()).exec(exec(["/bin/sh", "-c", BASE64_OUTPUT_SCRIPT, "sh", ...argv]), { timeoutMs: SESSION_MOVE_MS }) : await (await host()).exec({ ...exec(argv), stdin: await bytesOf(io.stdin, SESSION_BYTES_LIMIT) }, { timeoutMs: SESSION_MOVE_MS });
|
|
4763
|
+
if (io.stdin === void 0 && result.stdout !== "") io.onStdout?.(Buffer.from(result.stdout, "base64"));
|
|
4764
|
+
if (result.stderr !== "") io.onStderr?.(Buffer.from(result.stderr));
|
|
4765
|
+
return { status: result.status };
|
|
4766
|
+
}
|
|
4767
|
+
};
|
|
4768
|
+
}
|
|
4769
|
+
async function restoreSessionIntoSandbox(runtime, own, keptDir, meta, job) {
|
|
4770
|
+
const restored = await restoreSession({ guest: sessionGuestOfSandbox(runtime, own), tar: packKeptSession(keptDir, meta, runtime.agents, job) });
|
|
4771
|
+
if (!restored.ok) throw new Error(restored.reason);
|
|
4772
|
+
}
|
|
4773
|
+
async function ensureSandboxContainerRunning(runtime, own) {
|
|
4774
|
+
try {
|
|
4775
|
+
const sandboxed = await inSandbox(runtime, own);
|
|
4776
|
+
if (own.container.stopped !== true) return void 0;
|
|
4777
|
+
const started = await sandboxed.host.start(own.container.container);
|
|
4778
|
+
return started.status === 0 ? void 0 : `the build's container could not be started again (exit ${started.status})`;
|
|
4779
|
+
} catch (err) {
|
|
4780
|
+
return describeCallFailure(err);
|
|
4781
|
+
}
|
|
4782
|
+
}
|
|
4783
|
+
var HOOK_ERRORS_IN_CONTAINER = "/build/home/.outerlayer/spool/hook-errors.log";
|
|
4784
|
+
async function copySandboxHookErrors(runtime, state, jobDir) {
|
|
4785
|
+
try {
|
|
4786
|
+
if (state.container.stopped === true) return;
|
|
4787
|
+
const sandboxed = await inSandbox(runtime, state);
|
|
4788
|
+
const log = await sandboxed.host.exec({
|
|
4789
|
+
container: state.container.container,
|
|
4790
|
+
user: state.container.agentUser ?? ADDED_USER,
|
|
4791
|
+
env: NO_ENV,
|
|
4792
|
+
argv: ["tail", "-c", String(SANDBOX_PROBE_BYTES), HOOK_ERRORS_IN_CONTAINER]
|
|
4793
|
+
});
|
|
4794
|
+
if (log.status === 0 && log.stdout !== "") writeFileSync(join(jobDir, "hook-errors.log"), log.stdout);
|
|
4795
|
+
} catch {
|
|
4796
|
+
}
|
|
4797
|
+
}
|
|
4714
4798
|
async function runCliInSandbox(input, argv, logName) {
|
|
4715
4799
|
const { job } = input;
|
|
4716
4800
|
const own = job.sandbox;
|
|
4717
4801
|
try {
|
|
4718
4802
|
const sandboxed = await inSandbox(input.runtime, own);
|
|
4719
4803
|
const state = own.container;
|
|
4804
|
+
if (state.stopped === true) await startSandboxContainerAgain(input.runtime, own, await rejoinOf(input.runtime, own), input.jobDir, input.log);
|
|
4720
4805
|
const env = buildEnvironment({
|
|
4721
4806
|
config: claimCalls(input.config, job),
|
|
4722
4807
|
item: job.item,
|
|
@@ -5534,7 +5619,7 @@ async function provisionMicroVmOnce(input, allowRestore, itemDiskFailed) {
|
|
|
5534
5619
|
makeBuildsDirPrivate(buildDir2);
|
|
5535
5620
|
let services;
|
|
5536
5621
|
try {
|
|
5537
|
-
const gitRemote = gitRemoteFor(runtime, { repositories, tokens, buildDir: buildDir2, organizationId: input.organizationId, log: (line2) => log.line(`${tag} ${line2}`), ...input.queue
|
|
5622
|
+
const gitRemote = gitRemoteFor(runtime, { repositories, tokens, buildDir: buildDir2, organizationId: input.organizationId, log: (line2) => log.line(`${tag} ${line2}`), ...readOnlyOption(input.queue) });
|
|
5538
5623
|
services = await startServicesFor(runtime, config, buildDir2, jobDir, itemKey, true, gitRemote, "socket", void 0, void 0, (line2) => log.line(`${tag} ${line2}`));
|
|
5539
5624
|
runtime.tunnels.set(buildId, services);
|
|
5540
5625
|
} catch (err) {
|
|
@@ -7907,6 +7992,7 @@ async function keepSandboxDisk2(input) {
|
|
|
7907
7992
|
// src/runner/workspace/finish.ts
|
|
7908
7993
|
function noDiskReason(job, config) {
|
|
7909
7994
|
if (job.workItemId === void 0) return "the job names no work item";
|
|
7995
|
+
if (job.queue === "revise") return "a revision reads each repository at its default branch and leaves nothing to continue";
|
|
7910
7996
|
if (job.reason === "disk_limit_exceeded" || job.reason === "disk_check_failed") return "the build passed its disk limit, so a rerun would start from a full disk";
|
|
7911
7997
|
if (config.managed === true && (job.managedVariables?.length ?? 0) > 0) return "the build held a factory build variable, and the runner cannot remove a value that a command stored in an encoded form";
|
|
7912
7998
|
return void 0;
|
|
@@ -8002,12 +8088,17 @@ async function guestOf(job, runtime) {
|
|
|
8002
8088
|
const why = await ensureContainerRunning(runtime, job.container);
|
|
8003
8089
|
return why === void 0 ? { guest: sessionGuestOfContainer(runtime, job.container) } : { reason: why };
|
|
8004
8090
|
}
|
|
8005
|
-
|
|
8091
|
+
if (job.sandbox !== void 0) {
|
|
8092
|
+
const why = await ensureSandboxContainerRunning(runtime, job.sandbox);
|
|
8093
|
+
return why === void 0 ? { guest: sessionGuestOfSandbox(runtime, job.sandbox) } : { reason: why };
|
|
8094
|
+
}
|
|
8095
|
+
return { reason: "the build is not a container, microVM or sandbox build" };
|
|
8006
8096
|
}
|
|
8007
8097
|
async function keepEndedSession(input) {
|
|
8008
8098
|
const { job, log, tag } = input;
|
|
8009
8099
|
if (job.sessionId === void 0 || job.workItemId === void 0 || job.sessionKept === true) return false;
|
|
8010
|
-
if (job.
|
|
8100
|
+
if (job.queue === "revise") return false;
|
|
8101
|
+
if (job.microvm === void 0 && job.container === void 0 && job.sandbox === void 0) return false;
|
|
8011
8102
|
if (jobAgent(job, input.runtime.agents)?.adapter.launch?.session === void 0) return false;
|
|
8012
8103
|
const found = await guestOf(job, input.runtime);
|
|
8013
8104
|
if ("reason" in found) {
|
|
@@ -8067,11 +8158,12 @@ function readJudgeReply(run, minutes, agents = defaultAgents()) {
|
|
|
8067
8158
|
const said2 = firstLine5(run.stderr);
|
|
8068
8159
|
return { kind: "none", reason: `the judge exited ${run.status} and printed no result${said2 === "" ? "" : `: ${said2}`}` };
|
|
8069
8160
|
}
|
|
8070
|
-
|
|
8161
|
+
const usage = output.usage === void 0 ? {} : { usage: output.usage };
|
|
8162
|
+
if (output.kind === "turn-limit") return { kind: "none", reason: `the judge reached the turn limit of ${JUDGE_MAX_TURNS} turns before it gave a result`, ...usage };
|
|
8071
8163
|
const lines = output.text.split(/\r\n|\r|\n/).map((line2) => line2.trim()).filter((line2) => line2 !== "");
|
|
8072
8164
|
const verdict = RESULT_LINE.exec(lines.at(-1) ?? "")?.[1]?.toLowerCase();
|
|
8073
|
-
if (verdict === void 0) return { kind: "none", reason: "the judge gave no `result:` line" };
|
|
8074
|
-
return { kind: "answered", verdict, unmet: new Set(lines.flatMap((line2) => UNMET_LINE.exec(line2)?.[1] ?? [])) };
|
|
8165
|
+
if (verdict === void 0) return { kind: "none", reason: "the judge gave no `result:` line", ...usage };
|
|
8166
|
+
return { kind: "answered", verdict, unmet: new Set(lines.flatMap((line2) => UNMET_LINE.exec(line2)?.[1] ?? [])), ...usage };
|
|
8075
8167
|
}
|
|
8076
8168
|
|
|
8077
8169
|
// src/runner/judge-report.ts
|
|
@@ -8209,6 +8301,19 @@ function previousText(items) {
|
|
|
8209
8301
|
return `${JSON.stringify({ commit: open[0].commit ?? null, defects }, null, 2)}
|
|
8210
8302
|
`;
|
|
8211
8303
|
}
|
|
8304
|
+
function storedProblemsText(problems) {
|
|
8305
|
+
const defects = problems.filter((problem) => problem.status === "open" || problem.status === "with_agent");
|
|
8306
|
+
const dismissed = problems.filter((problem) => problem.status === "not_a_problem");
|
|
8307
|
+
if (defects.length === 0 && dismissed.length === 0) return void 0;
|
|
8308
|
+
const place = (problem) => ({ path: problem.path, ...problem.line === null ? {} : { line: problem.line } });
|
|
8309
|
+
const body = {
|
|
8310
|
+
commit: defects[0]?.commit ?? null,
|
|
8311
|
+
defects: defects.map((problem) => ({ id: problem.id, ...problem.reason === "" ? {} : { reason: problem.reason }, refs: problem.path === "" ? [] : [place(problem)] })),
|
|
8312
|
+
dismissed: dismissed.map((problem) => ({ id: problem.id, ...problem.title === "" ? {} : { title: problem.title }, ...place(problem), reason: problem.dismissalReason }))
|
|
8313
|
+
};
|
|
8314
|
+
return `${JSON.stringify(body, null, 2)}
|
|
8315
|
+
`;
|
|
8316
|
+
}
|
|
8212
8317
|
function mergeAnswers(answers) {
|
|
8213
8318
|
const items = [];
|
|
8214
8319
|
const earlier = /* @__PURE__ */ new Set();
|
|
@@ -8223,22 +8328,32 @@ function mergeAnswers(answers) {
|
|
|
8223
8328
|
}
|
|
8224
8329
|
const lists = answers.flatMap((answer) => answer.reviewed === void 0 ? [] : [answer.reviewed]);
|
|
8225
8330
|
const reviewed = lists.length === 0 ? void 0 : [...new Set(lists.flat())];
|
|
8331
|
+
const verdicts = /* @__PURE__ */ new Map();
|
|
8332
|
+
for (const answer of answers) {
|
|
8333
|
+
for (const { id, verdict } of answer.previous ?? []) if (verdicts.get(id) !== "open") verdicts.set(id, verdict);
|
|
8334
|
+
}
|
|
8335
|
+
const previous = answers.some((answer) => answer.previous !== void 0) ? [...verdicts].map(([id, verdict]) => ({ id, verdict })) : void 0;
|
|
8226
8336
|
const failed = answers.some((answer) => answer.result === "fail") || items.some((entry) => entry.result === "fail");
|
|
8227
8337
|
const said2 = answers.filter((answer) => answer.result !== void 0);
|
|
8228
8338
|
const result = failed ? "fail" : said2.length > 0 && said2.every((answer) => answer.result === "pass") ? "pass" : void 0;
|
|
8229
|
-
return { ...result === void 0 ? {} : { result }, items, ...reviewed === void 0 ? {} : { reviewed } };
|
|
8339
|
+
return { ...result === void 0 ? {} : { result }, items, ...reviewed === void 0 ? {} : { reviewed }, ...previous === void 0 ? {} : { previous } };
|
|
8230
8340
|
}
|
|
8231
|
-
function
|
|
8341
|
+
function unreviewedFiles(changed, reviewed) {
|
|
8232
8342
|
if (reviewed === void 0) return void 0;
|
|
8233
|
-
const read = new Set(reviewed.map((path) => path.replace(/^\/+/, "").replace(/^outerlayer\/judge\/tree\//, "")));
|
|
8343
|
+
const read = [...new Set(reviewed.map((path) => path.replace(/^\/+/, "").replace(/^outerlayer\/judge\/tree\//, "")))];
|
|
8234
8344
|
const counted = changed.filter((file) => !file.generated && file.path !== "?");
|
|
8235
|
-
const
|
|
8236
|
-
|
|
8345
|
+
const seen = new Set(read);
|
|
8346
|
+
return { read, missed: counted.filter((file) => !seen.has(file.path)).map((file) => file.path), counted: counted.length };
|
|
8347
|
+
}
|
|
8348
|
+
function unreviewedItem(changed, reviewed, commit) {
|
|
8349
|
+
const files = unreviewedFiles(changed, reviewed);
|
|
8350
|
+
if (files === void 0 || files.missed.length === 0) return void 0;
|
|
8351
|
+
const { missed } = files;
|
|
8237
8352
|
const room = CHECK_ITEM_REASON_MAX_LENGTH - 40;
|
|
8238
|
-
let reason = `${missed.length} of ${counted
|
|
8353
|
+
let reason = `${missed.length} of ${files.counted} changed files were not reviewed: `;
|
|
8239
8354
|
let listed = 0;
|
|
8240
|
-
for (const
|
|
8241
|
-
const next = `${listed === 0 ? "" : ", "}${
|
|
8355
|
+
for (const path of missed) {
|
|
8356
|
+
const next = `${listed === 0 ? "" : ", "}${path}`;
|
|
8242
8357
|
if (reason.length + next.length > room) break;
|
|
8243
8358
|
reason += next;
|
|
8244
8359
|
listed += 1;
|
|
@@ -8247,6 +8362,55 @@ function unreviewedItem(changed, reviewed, commit) {
|
|
|
8247
8362
|
return { id: UNREVIEWED_FILES_ITEM_ID, result: "skipped", commit, reason: `${reason}.` };
|
|
8248
8363
|
}
|
|
8249
8364
|
|
|
8365
|
+
// src/runner/code-review-problems.ts
|
|
8366
|
+
var EXCERPT_CONTEXT_LINES = 5;
|
|
8367
|
+
var EXCERPT_LINE_MAX = 300;
|
|
8368
|
+
var PROBLEMS_MAX = CODE_REVIEW_PROBLEMS_MAX;
|
|
8369
|
+
var FILES_MAX = 2e3;
|
|
8370
|
+
var TITLE_MAX = 300;
|
|
8371
|
+
function problemExcerpt(text2, line2) {
|
|
8372
|
+
if (text2 === void 0 || line2 === void 0 || !Number.isInteger(line2) || line2 < 1) return null;
|
|
8373
|
+
const lines = text2.replace(/\u0000/g, "").split(/\r\n|\r|\n/);
|
|
8374
|
+
if (lines.at(-1) === "") lines.pop();
|
|
8375
|
+
if (line2 > lines.length) return null;
|
|
8376
|
+
const startLine = Math.max(1, line2 - EXCERPT_CONTEXT_LINES);
|
|
8377
|
+
const endLine = Math.min(lines.length, line2 + EXCERPT_CONTEXT_LINES);
|
|
8378
|
+
const kept = lines.slice(startLine - 1, endLine).map((raw) => raw.length > EXCERPT_LINE_MAX ? `${raw.slice(0, EXCERPT_LINE_MAX - 1)}\u2026` : raw);
|
|
8379
|
+
return { startLine, text: kept.join("\n") };
|
|
8380
|
+
}
|
|
8381
|
+
function titleOf(title, fallback) {
|
|
8382
|
+
const line2 = (title ?? "").replace(/\s+/g, " ").trim();
|
|
8383
|
+
return (line2 === "" ? fallback : line2).slice(0, TITLE_MAX);
|
|
8384
|
+
}
|
|
8385
|
+
function reviewRecord(input) {
|
|
8386
|
+
const entries = wholeEntries(input.merged);
|
|
8387
|
+
const problems = [];
|
|
8388
|
+
for (const [index, item] of input.items.entries()) {
|
|
8389
|
+
const entry = entries[index];
|
|
8390
|
+
if (entry === void 0 || item.result !== "fail") continue;
|
|
8391
|
+
if (problems.length >= PROBLEMS_MAX) break;
|
|
8392
|
+
const place = item.refs?.[0];
|
|
8393
|
+
problems.push({
|
|
8394
|
+
id: item.id,
|
|
8395
|
+
kind: problemKind(entry.kind),
|
|
8396
|
+
title: titleOf(entry.title, item.id),
|
|
8397
|
+
reason: item.reason ?? "",
|
|
8398
|
+
path: place?.path ?? "",
|
|
8399
|
+
line: place?.line ?? null,
|
|
8400
|
+
inDiff: place?.inDiff === true,
|
|
8401
|
+
excerpt: place === void 0 ? null : input.excerptOf(place.path, place.line),
|
|
8402
|
+
reviewer: entry.reviewer ?? ""
|
|
8403
|
+
});
|
|
8404
|
+
}
|
|
8405
|
+
const files = unreviewedFiles(input.changed, input.merged.reviewed);
|
|
8406
|
+
return {
|
|
8407
|
+
reviewers: input.runs.map((run) => ({ name: run.name, turns: run.turns ?? null, seconds: Math.round(run.seconds * 10) / 10, costUsd: run.costUsd ?? null, answered: run.answered })),
|
|
8408
|
+
files: { read: (files?.read ?? []).slice(0, FILES_MAX), notRead: (files?.missed ?? []).slice(0, FILES_MAX) },
|
|
8409
|
+
problems,
|
|
8410
|
+
verdicts: (input.merged.previous ?? []).slice(0, CODE_REVIEW_PROBLEMS_MAX)
|
|
8411
|
+
};
|
|
8412
|
+
}
|
|
8413
|
+
|
|
8250
8414
|
// src/runner/code-review-report.ts
|
|
8251
8415
|
var REPORT_RETRY_WINDOW_MS = 2e4;
|
|
8252
8416
|
var MAX_REASON_LENGTH = 2e3;
|
|
@@ -8268,6 +8432,40 @@ async function reportCodeReview(config, job, report, deps) {
|
|
|
8268
8432
|
deps.log.line(`${tag} the code review's report was not sent: ${describeCallFailure(err)}`);
|
|
8269
8433
|
}
|
|
8270
8434
|
}
|
|
8435
|
+
var STATUSES = ["open", "with_agent", "fixed", "not_a_problem"];
|
|
8436
|
+
function readStoredProblems(data) {
|
|
8437
|
+
const list = Object(data).problems;
|
|
8438
|
+
if (!Array.isArray(list)) return [];
|
|
8439
|
+
return list.flatMap((entry) => {
|
|
8440
|
+
const row = Object(entry);
|
|
8441
|
+
if (typeof row.id !== "string" || typeof row.status !== "string" || !STATUSES.includes(row.status)) return [];
|
|
8442
|
+
return [
|
|
8443
|
+
{
|
|
8444
|
+
id: row.id,
|
|
8445
|
+
status: row.status,
|
|
8446
|
+
title: typeof row.title === "string" ? row.title : "",
|
|
8447
|
+
reason: typeof row.reason === "string" ? row.reason : "",
|
|
8448
|
+
path: typeof row.path === "string" ? row.path : "",
|
|
8449
|
+
line: typeof row.line === "number" && Number.isInteger(row.line) ? row.line : null,
|
|
8450
|
+
commit: typeof row.commit === "string" ? row.commit : "",
|
|
8451
|
+
dismissalReason: typeof row.dismissalReason === "string" ? row.dismissalReason : null
|
|
8452
|
+
}
|
|
8453
|
+
];
|
|
8454
|
+
});
|
|
8455
|
+
}
|
|
8456
|
+
async function readCodeReviewProblems(config, job, deps) {
|
|
8457
|
+
const tag = itemTag(job);
|
|
8458
|
+
try {
|
|
8459
|
+
const calls = claimCalls(config, job);
|
|
8460
|
+
const item = claimItem(config, job);
|
|
8461
|
+
const signer = await signerFor(calls.configPath);
|
|
8462
|
+
const page = await getJson(calls.url, `/v1/work-items/${item}/claim/code-review/problems`, calls.apiKey, calls.appId, deps.fetchImpl, signer);
|
|
8463
|
+
return readStoredProblems(page.data);
|
|
8464
|
+
} catch (err) {
|
|
8465
|
+
deps.log.line(`${tag} the stored problems of the code review could not be read: ${describeCallFailure(err)}`);
|
|
8466
|
+
return void 0;
|
|
8467
|
+
}
|
|
8468
|
+
}
|
|
8271
8469
|
|
|
8272
8470
|
// src/runner/judge.ts
|
|
8273
8471
|
var LIMIT_KEY_TAIL = " (runner.checks.timeLimitMinutes)";
|
|
@@ -8593,11 +8791,14 @@ async function runJudge(input) {
|
|
|
8593
8791
|
{ brief: withAnswerProtocol(territoryBrief(brief, territory), "none", { reviewed: true, answer }), credential, effort: CODE_REVIEW_EFFORT, answer },
|
|
8594
8792
|
runtime.agents
|
|
8595
8793
|
);
|
|
8794
|
+
const began = now().getTime();
|
|
8795
|
+
const clock = { seconds: void 0 };
|
|
8596
8796
|
const settled = environment.run(command, { logPath: join(jobDir, index === 0 ? "judge.log" : `judge-${territory.name}.log`) }).then(
|
|
8597
8797
|
(result) => result,
|
|
8598
8798
|
(err) => err instanceof Error ? err : new Error(String(err))
|
|
8599
8799
|
);
|
|
8600
|
-
|
|
8800
|
+
void settled.then(() => clock.seconds = (now().getTime() - began) / 1e3);
|
|
8801
|
+
return { territory, answerName, settled, clock, began, outcome: void 0 };
|
|
8601
8802
|
});
|
|
8602
8803
|
for (const run of started) void run.settled.then((outcome) => run.outcome = outcome);
|
|
8603
8804
|
const timer = timeoutAfter(limitMinutes * 6e4, deps.sleep);
|
|
@@ -8626,7 +8827,7 @@ async function runJudge(input) {
|
|
|
8626
8827
|
const outcome = run.outcome;
|
|
8627
8828
|
if (outcome instanceof Error) log.error(`${tag} the ${run.territory.name} review could not be run: ${describeCallFailure(outcome)}`);
|
|
8628
8829
|
const ran = outcome === void 0 ? { kind: "timeout" } : outcome instanceof Error ? { kind: "exited", status: 1, stdout: "", stderr: outcome.message } : { kind: "exited", status: outcome.status, stdout: outcome.stdout, stderr: outcome.stderr };
|
|
8629
|
-
return { territory: run.territory, reply: readJudgeReply(ran, minutes, runtime.agents), answer: answers[index] };
|
|
8830
|
+
return { territory: run.territory, reply: readJudgeReply(ran, minutes, runtime.agents), answer: answers[index], seconds: run.clock.seconds ?? (now().getTime() - run.began) / 1e3 };
|
|
8630
8831
|
})
|
|
8631
8832
|
};
|
|
8632
8833
|
};
|
|
@@ -8647,7 +8848,8 @@ async function runJudge(input) {
|
|
|
8647
8848
|
const issue = issueText(workItem, criteriaOf(workItem));
|
|
8648
8849
|
if (issue !== void 0) files["issue.md"] = issue;
|
|
8649
8850
|
try {
|
|
8650
|
-
const
|
|
8851
|
+
const stored = await readCodeReviewProblems(config, job, deps);
|
|
8852
|
+
const earlier = stored !== void 0 && stored.length > 0 ? storedProblemsText(stored) : previousText(await earlierReview(itemCalls(config, job), workItem, deps.fetchImpl));
|
|
8651
8853
|
if (earlier !== void 0) files["previous.json"] = earlier;
|
|
8652
8854
|
} catch (err) {
|
|
8653
8855
|
log.line(`${tag} the item's earlier code review could not be read, so the review runs without it: ${describeCallFailure(err)}`);
|
|
@@ -8657,11 +8859,12 @@ async function runJudge(input) {
|
|
|
8657
8859
|
const reviewed = await reviewSideBySide(files, runs);
|
|
8658
8860
|
if (!reviewed.ok) return await fail(check, reviewed.reason);
|
|
8659
8861
|
const answers = [];
|
|
8862
|
+
const byReviewer = (name, from) => ({ ...from, items: from.items.map((entry) => ({ ...entry, reviewer: name })) });
|
|
8660
8863
|
for (const { territory, reply, answer } of reviewed.runs) {
|
|
8661
8864
|
if (answer?.ok === true && reply.kind === "none") {
|
|
8662
|
-
answers.push({ items: answer.answer.items, ...answer.answer.reviewed === void 0 ? {} : { reviewed: answer.answer.reviewed } });
|
|
8865
|
+
answers.push(byReviewer(territory.name, { items: answer.answer.items, ...answer.answer.reviewed === void 0 ? {} : { reviewed: answer.answer.reviewed } }));
|
|
8663
8866
|
log.line(`${tag} the ${territory.name} review stopped before it ended, so only what it found is kept: ${reply.reason}`);
|
|
8664
|
-
} else if (answer?.ok === true) answers.push(answer.answer);
|
|
8867
|
+
} else if (answer?.ok === true) answers.push(byReviewer(territory.name, answer.answer));
|
|
8665
8868
|
else log.line(`${tag} the ${territory.name} review gave no answer: ${answer?.ok === false ? answer.reason : reply.kind === "none" ? reply.reason : "it wrote no answer file"}`);
|
|
8666
8869
|
}
|
|
8667
8870
|
const first = reviewed.runs[0];
|
|
@@ -8669,7 +8872,21 @@ async function runJudge(input) {
|
|
|
8669
8872
|
const merged = mergeAnswers(answers);
|
|
8670
8873
|
const items2 = wholeItems({ answer: merged, commit: head, treeRoot: JUDGE_TREE, place, ownTree, patch: diff, clean: cleanReason });
|
|
8671
8874
|
const unreviewed = unreviewedItem(changed, merged.reviewed, head);
|
|
8672
|
-
|
|
8875
|
+
const review = reviewRecord({
|
|
8876
|
+
merged,
|
|
8877
|
+
items: items2,
|
|
8878
|
+
changed,
|
|
8879
|
+
runs: reviewed.runs.map((run) => ({
|
|
8880
|
+
name: run.territory.name,
|
|
8881
|
+
...run.reply.usage?.turns === void 0 ? {} : { turns: run.reply.usage.turns },
|
|
8882
|
+
seconds: run.reply.usage?.durationMs === void 0 ? run.seconds : run.reply.usage.durationMs / 1e3,
|
|
8883
|
+
...run.reply.usage?.costUsd === void 0 ? {} : { costUsd: run.reply.usage.costUsd },
|
|
8884
|
+
// A reviewer that stopped early or wrote no answer proves nothing about a problem that it did not report.
|
|
8885
|
+
answered: run.answer?.ok === true && run.reply.kind === "answered"
|
|
8886
|
+
})),
|
|
8887
|
+
excerptOf: (path, line2) => problemExcerpt(treeFileText(branchDir, path), line2)
|
|
8888
|
+
});
|
|
8889
|
+
return await finishWhole(check, { reply: first.reply, answer: { ok: true, answer: merged }, items: unreviewed === void 0 ? items2 : [...items2, unreviewed], report: void 0, head, branch, review });
|
|
8673
8890
|
}
|
|
8674
8891
|
if (criteria === void 0) {
|
|
8675
8892
|
let ran;
|
|
@@ -8740,7 +8957,7 @@ async function runJudge(input) {
|
|
|
8740
8957
|
await record(check.name, result, reason, { keyTail: at.limitKey === true ? LIMIT_KEY_TAIL : "", link, items: sendable(items) });
|
|
8741
8958
|
}
|
|
8742
8959
|
async function finishWhole(check, at) {
|
|
8743
|
-
const where = { head: at.head, branch: at.branch };
|
|
8960
|
+
const where = { head: at.head, branch: at.branch, review: at.review };
|
|
8744
8961
|
if (at.answer?.ok === true) {
|
|
8745
8962
|
const answered = at.items ?? [];
|
|
8746
8963
|
const failing = itemsSentence(answered, { one: "check item", many: "check items" });
|
|
@@ -8771,7 +8988,7 @@ async function runJudge(input) {
|
|
|
8771
8988
|
await reportReview(check, { result: "failed", reason: "review_not_run", runnerReason: oneLineReason(cleanReason(at.reason ?? "")) ?? "the judge did not run" });
|
|
8772
8989
|
} else {
|
|
8773
8990
|
const failing = named.filter((item) => item.result === "fail").length;
|
|
8774
|
-
await reportReview(check, { result: "reviewed", reason: "reviewed", commit: at.head, problems: at.result === "fail" ? Math.max(failing, 1) : failing });
|
|
8991
|
+
await reportReview(check, { result: "reviewed", reason: "reviewed", commit: at.head, problems: at.result === "fail" ? Math.max(failing, 1) : failing, ...at.review === void 0 ? {} : { review: at.review } });
|
|
8775
8992
|
}
|
|
8776
8993
|
}
|
|
8777
8994
|
function sendable(items) {
|
|
@@ -9385,6 +9602,7 @@ async function finishJob(job, jobDirPath, outcome, config, deps, ending) {
|
|
|
9385
9602
|
const logPath = join(jobDirPath, "command.log");
|
|
9386
9603
|
const tag = `${itemTag(job)}`;
|
|
9387
9604
|
const isRun = job.queue === "run";
|
|
9605
|
+
const noJudgement = isRun || job.queue === "revise";
|
|
9388
9606
|
deps.attemptLogs?.open(job.item, jobDirPath, itemScope(job));
|
|
9389
9607
|
const valuesNotHeld = (job.managedVariables?.length ?? 0) > 0 && managedBuildSettingsFor(jobDirPath) === void 0;
|
|
9390
9608
|
await stopSender({ job, jobDir: jobDirPath, deps: { spawnFn, runtime: deps.container, log } });
|
|
@@ -9423,7 +9641,7 @@ async function finishJob(job, jobDirPath, outcome, config, deps, ending) {
|
|
|
9423
9641
|
if (job.pid !== void 0 && isGroupAlive(job.pid)) {
|
|
9424
9642
|
await stopProcessGroup(job.pid);
|
|
9425
9643
|
}
|
|
9426
|
-
const sessionRuntime = (build ?? vmBuild)?.runtime;
|
|
9644
|
+
const sessionRuntime = (build ?? vmBuild ?? sandboxBuild)?.runtime;
|
|
9427
9645
|
if (sessionRuntime !== void 0) {
|
|
9428
9646
|
if (!valuesNotHeld) {
|
|
9429
9647
|
if (await keepEndedSession({ job, jobDirPath, runtime: sessionRuntime, configPath: config.configPath, log, tag, now, scrub: keptSessionScrub(config, job, jobDirPath) })) writeJobFile(jobFilePath, job);
|
|
@@ -9515,7 +9733,7 @@ async function finishJob(job, jobDirPath, outcome, config, deps, ending) {
|
|
|
9515
9733
|
log.error(`${tag} removing an earlier attempt's check environment failed: ${describeCallFailure(err)} \xB7 continuing`);
|
|
9516
9734
|
}
|
|
9517
9735
|
}
|
|
9518
|
-
if (outcome === "ok" && !
|
|
9736
|
+
if (outcome === "ok" && !noJudgement && !job.cleanupRan && job.proofsRan !== true && !valuesNotHeld && job.workdir !== void 0 && job.itemKey !== void 0 && await declaresRecordedProof(itemCalls(config, job), job.item, deps.fetchImpl)) {
|
|
9519
9737
|
setStage(job, jobDirPath, "proofs");
|
|
9520
9738
|
job.proofsRan = true;
|
|
9521
9739
|
writeJobFile(jobFilePath, job);
|
|
@@ -9536,11 +9754,11 @@ async function finishJob(job, jobDirPath, outcome, config, deps, ending) {
|
|
|
9536
9754
|
log.error(`${tag} the host's proof recording stopped: ${describeCallFailure(err)} \xB7 continuing`);
|
|
9537
9755
|
}
|
|
9538
9756
|
}
|
|
9539
|
-
if (valuesNotHeld && outcome === "ok" && !
|
|
9757
|
+
if (valuesNotHeld && outcome === "ok" && !noJudgement && !job.cleanupRan) {
|
|
9540
9758
|
log.error(`${tag} the host's judge and checks skipped: ${VALUES_NOT_HELD}`);
|
|
9541
9759
|
await reportCodeReview(config, job, { result: "skipped", reason: "variables_lost" }, { fetchImpl: deps.fetchImpl, log, now: deps.now, sleep: deps.sleep });
|
|
9542
9760
|
}
|
|
9543
|
-
if (outcome === "ok" && !
|
|
9761
|
+
if (outcome === "ok" && !noJudgement && !job.cleanupRan && job.judgeRan !== true && !valuesNotHeld) {
|
|
9544
9762
|
setStage(job, jobDirPath, "judge");
|
|
9545
9763
|
job.judgeRan = true;
|
|
9546
9764
|
writeJobFile(jobFilePath, job);
|
|
@@ -9555,7 +9773,7 @@ async function finishJob(job, jobDirPath, outcome, config, deps, ending) {
|
|
|
9555
9773
|
log.error(`${tag} the host's judge stopped: ${describeCallFailure(err)} \xB7 continuing`);
|
|
9556
9774
|
}
|
|
9557
9775
|
}
|
|
9558
|
-
if (outcome === "ok" && !
|
|
9776
|
+
if (outcome === "ok" && !noJudgement && !job.cleanupRan && job.checksRan !== true && !valuesNotHeld) {
|
|
9559
9777
|
setStage(job, jobDirPath, "checks");
|
|
9560
9778
|
job.checksRan = true;
|
|
9561
9779
|
writeJobFile(jobFilePath, job);
|
|
@@ -9628,6 +9846,7 @@ async function finishJob(job, jobDirPath, outcome, config, deps, ending) {
|
|
|
9628
9846
|
tunnelRecord = sandboxBuild.runtime.tunnels.get(sandboxBuild.state.buildId)?.record();
|
|
9629
9847
|
try {
|
|
9630
9848
|
const sandboxRuntime = sandboxBuild.runtime;
|
|
9849
|
+
await copySandboxHookErrors(sandboxRuntime, sandboxBuild.state, jobDirPath);
|
|
9631
9850
|
const kept = await cleanupSandbox(
|
|
9632
9851
|
sandboxRuntime,
|
|
9633
9852
|
sandboxBuild.state,
|
|
@@ -9693,7 +9912,7 @@ async function finishJob(job, jobDirPath, outcome, config, deps, ending) {
|
|
|
9693
9912
|
writeJobFile(jobFilePath, job);
|
|
9694
9913
|
}
|
|
9695
9914
|
let verdictReason;
|
|
9696
|
-
if (outcome === "ok" && !
|
|
9915
|
+
if (outcome === "ok" && !noJudgement) {
|
|
9697
9916
|
const decision = await settleVerdict({
|
|
9698
9917
|
read: () => readItemEvaluation(itemCalls(config, job), job.item, deps.fetchImpl, job.claimId),
|
|
9699
9918
|
now,
|
|
@@ -10129,7 +10348,7 @@ var STAGING_GRACE_MS = 36e5;
|
|
|
10129
10348
|
var MAX_STATE_IDS = 1e3;
|
|
10130
10349
|
var keptAtOf = (entry) => Date.parse(entry.kept.record.keptAt);
|
|
10131
10350
|
var oldestFirst2 = (entries) => [...entries].sort((a, b) => keptAtOf(a) - keptAtOf(b));
|
|
10132
|
-
var
|
|
10351
|
+
var bytesOf2 = (entries) => entries.reduce((sum, entry) => sum + entry.kept.record.bytes, 0);
|
|
10133
10352
|
function allEntries(configPath) {
|
|
10134
10353
|
return storeScopes(configPath).flatMap((scope) => listItemDisks(configPath, scope).map((kept) => ({ scope, kept })));
|
|
10135
10354
|
}
|
|
@@ -10212,7 +10431,7 @@ async function removeItemDisks(input) {
|
|
|
10212
10431
|
for (const scope of new Set(entries.map((entry) => entry.scope))) {
|
|
10213
10432
|
if (scope === void 0) continue;
|
|
10214
10433
|
const mine = oldestFirst2(entries.filter((entry) => entry.scope === scope && !gone.has(entry)));
|
|
10215
|
-
let total2 =
|
|
10434
|
+
let total2 = bytesOf2(mine);
|
|
10216
10435
|
for (const entry of mine.slice(0, -1)) {
|
|
10217
10436
|
if (total2 <= limits2.orgMax) break;
|
|
10218
10437
|
const before = gone.size;
|
|
@@ -10220,7 +10439,7 @@ async function removeItemDisks(input) {
|
|
|
10220
10439
|
if (gone.size > before) total2 -= entry.kept.record.bytes;
|
|
10221
10440
|
}
|
|
10222
10441
|
}
|
|
10223
|
-
let total =
|
|
10442
|
+
let total = bytesOf2(entries.filter((entry) => !gone.has(entry)));
|
|
10224
10443
|
for (const entry of oldestFirst2(entries.filter((candidate) => !gone.has(candidate)))) {
|
|
10225
10444
|
if (total <= limits2.max) break;
|
|
10226
10445
|
const before = gone.size;
|
|
@@ -11701,16 +11920,19 @@ function createGitRemote(options) {
|
|
|
11701
11920
|
if (bodyPath !== void 0) rmSync(bodyPath, { force: true });
|
|
11702
11921
|
}
|
|
11703
11922
|
}
|
|
11923
|
+
const readOnly = options.readOnly === true || options.readOnly === "revise";
|
|
11924
|
+
const readOnlyActor = options.readOnly === "revise" ? "a spec revision" : "a check";
|
|
11704
11925
|
async function handle(req, res) {
|
|
11705
11926
|
const route = classifyRequest(req.method ?? "", req.url ?? "");
|
|
11706
11927
|
if (route === void 0) {
|
|
11707
11928
|
req.resume();
|
|
11708
11929
|
return plain2(res, 404, "not found\n");
|
|
11709
11930
|
}
|
|
11710
|
-
if (
|
|
11931
|
+
if (readOnly && (route.kind === "receive-pack" || route.kind === "info-refs" && route.service === "git-receive-pack")) {
|
|
11711
11932
|
log(`push refused: this remote is read-only`);
|
|
11712
11933
|
req.resume();
|
|
11713
|
-
return plain2(res, 403,
|
|
11934
|
+
return plain2(res, 403, `this remote is read-only: ${readOnlyActor} cannot push
|
|
11935
|
+
`);
|
|
11714
11936
|
}
|
|
11715
11937
|
const target2 = claimed.find((entry) => isOwnRepository(entry.repository, route.owner, route.name));
|
|
11716
11938
|
const pushing = route.kind === "receive-pack" || route.kind === "info-refs" && route.service === "git-receive-pack";
|
|
@@ -11727,7 +11949,8 @@ function createGitRemote(options) {
|
|
|
11727
11949
|
body = await readBody(req, maxLfsBodyBytes);
|
|
11728
11950
|
if (body === void 0) return plain2(res, 413, "the request is too large\n");
|
|
11729
11951
|
kind = isLfsUpload(body) ? "push" : "read";
|
|
11730
|
-
if (
|
|
11952
|
+
if (readOnly && kind === "push") return plain2(res, 403, `this remote is read-only: ${readOnlyActor} cannot upload
|
|
11953
|
+
`);
|
|
11731
11954
|
}
|
|
11732
11955
|
let authorization;
|
|
11733
11956
|
if (target2 !== void 0) {
|
|
@@ -11997,7 +12220,8 @@ function gitRemoteFor(runtime, input) {
|
|
|
11997
12220
|
return createGitRemote({
|
|
11998
12221
|
repositories: input.repositories.map((entry) => {
|
|
11999
12222
|
const [owner = "", name = ""] = entry.repository.split("/");
|
|
12000
|
-
|
|
12223
|
+
if (entry.branch === void 0 && input.readOnly === void 0) throw new Error(`the claim names no branch in ${entry.repository}, so its remote cannot accept a push`);
|
|
12224
|
+
return { repository: entry.repository, branch: entry.branch ?? "", mirrorDir: mirrorDir(runnerDirPath, owner, name) };
|
|
12001
12225
|
}),
|
|
12002
12226
|
tokens: input.tokens,
|
|
12003
12227
|
gitUrl: runtime.github.gitUrl,
|
|
@@ -12006,7 +12230,7 @@ function gitRemoteFor(runtime, input) {
|
|
|
12006
12230
|
input.tokens.reason = WORKFLOW_PERMISSION_REASON;
|
|
12007
12231
|
},
|
|
12008
12232
|
log: input.log,
|
|
12009
|
-
...input.readOnly ===
|
|
12233
|
+
...input.readOnly === void 0 ? {} : { readOnly: input.readOnly }
|
|
12010
12234
|
});
|
|
12011
12235
|
}
|
|
12012
12236
|
var NO_ENV2 = { literals: {}, passed: {} };
|
|
@@ -12294,7 +12518,7 @@ async function provisionContainerOnce(input, allowRestore, itemDiskFailed) {
|
|
|
12294
12518
|
environment.credentials = tokens.used();
|
|
12295
12519
|
let services;
|
|
12296
12520
|
try {
|
|
12297
|
-
const gitRemote = gitRemoteFor(runtime, { repositories, tokens, buildDir: buildDir2, log: (line2) => log.line(`${tag} ${line2}`), ...input.queue
|
|
12521
|
+
const gitRemote = gitRemoteFor(runtime, { repositories, tokens, buildDir: buildDir2, log: (line2) => log.line(`${tag} ${line2}`), ...readOnlyOption(input.queue) });
|
|
12298
12522
|
services = await startServicesFor(runtime, config, buildDir2, jobDir, itemKey, true, gitRemote, "stream", input.leaseExpiryMs === void 0 ? void 0 : leaseFor(runtime, buildId, input.leaseExpiryMs), void 0, (line2) => log.line(`${tag} ${line2}`));
|
|
12299
12523
|
runtime.tunnels.set(buildId, services);
|
|
12300
12524
|
} catch (err) {
|
|
@@ -12610,7 +12834,7 @@ async function ensureTunnel(runtime, state, jobDir, config, itemKey, branch, rep
|
|
|
12610
12834
|
}
|
|
12611
12835
|
const tokens = runtime.credentials.get(jobDir);
|
|
12612
12836
|
const served = repositoriesOf({ repositories, repository: state.repository, branch });
|
|
12613
|
-
const gitRemote = tokens === void 0 || served.length === 0 ? void 0 : gitRemoteFor(runtime, { repositories: served, tokens, buildDir: state.buildDir, ...readOnly ===
|
|
12837
|
+
const gitRemote = tokens === void 0 || served.length === 0 ? void 0 : gitRemoteFor(runtime, { repositories: served, tokens, buildDir: state.buildDir, ...readOnly === void 0 ? {} : { readOnly } });
|
|
12614
12838
|
const lease = transport === "exec" && leaseExpiryMs !== void 0 ? leaseFor(runtime, state.buildId, leaseExpiryMs) : void 0;
|
|
12615
12839
|
if (state.stopped === true) lease?.stop();
|
|
12616
12840
|
const services = await startServicesFor(runtime, config, state.buildDir, jobDir, itemKey, state.builtIns === true, gitRemote, transport === "exec" ? "stream" : "socket", lease);
|
|
@@ -12636,7 +12860,7 @@ async function runCliInContainer(input, argv, logName) {
|
|
|
12636
12860
|
const { runtime, job } = input;
|
|
12637
12861
|
const state = job.container;
|
|
12638
12862
|
try {
|
|
12639
|
-
await ensureTunnel(runtime, state, input.jobDir, configForJob(input.config, job), job.itemKey, job.branch, job.repositories, input.log, () => leaseExpiresAtMs(job), job.queue
|
|
12863
|
+
await ensureTunnel(runtime, state, input.jobDir, configForJob(input.config, job), job.itemKey, job.branch, job.repositories, input.log, () => leaseExpiresAtMs(job), readOnlyRemoteOf(job.queue));
|
|
12640
12864
|
if (state.stopped) {
|
|
12641
12865
|
const network = await ensureNetworkReady(runtime, state);
|
|
12642
12866
|
if (network !== void 0) return { ok: false, reason: network };
|
|
@@ -12730,7 +12954,7 @@ async function restoreSessionIntoContainer(runtime, state, keptDir, meta, job) {
|
|
|
12730
12954
|
const restored = await restoreSession({ guest: sessionGuestOfContainer(runtime, state), tar: packKeptSession(keptDir, meta, runtime.agents, job) });
|
|
12731
12955
|
if (!restored.ok) throw new Error(restored.reason);
|
|
12732
12956
|
}
|
|
12733
|
-
var
|
|
12957
|
+
var HOOK_ERRORS_IN_CONTAINER2 = "/build/home/.outerlayer/spool/hook-errors.log";
|
|
12734
12958
|
async function copyHookErrors2(runtime, state, jobDir) {
|
|
12735
12959
|
try {
|
|
12736
12960
|
if (state.stopped) {
|
|
@@ -12738,7 +12962,7 @@ async function copyHookErrors2(runtime, state, jobDir) {
|
|
|
12738
12962
|
const started = await runtime.host.start(state.container);
|
|
12739
12963
|
if (started.status !== 0) return;
|
|
12740
12964
|
}
|
|
12741
|
-
const log = await runtime.host.exec({ container: state.container, user: state.agentUser ?? ADDED_USER, env: NO_ENV2, argv: ["cat",
|
|
12965
|
+
const log = await runtime.host.exec({ container: state.container, user: state.agentUser ?? ADDED_USER, env: NO_ENV2, argv: ["cat", HOOK_ERRORS_IN_CONTAINER2] });
|
|
12742
12966
|
if (log.status === 0 && log.stdout !== "") writeFileSync(join(jobDir, "hook-errors.log"), log.stdout);
|
|
12743
12967
|
} catch {
|
|
12744
12968
|
}
|
|
@@ -12797,7 +13021,7 @@ function containerJudgeEnvironment(input) {
|
|
|
12797
13021
|
};
|
|
12798
13022
|
return {
|
|
12799
13023
|
stop: async () => {
|
|
12800
|
-
if (input.config !== void 0) await ensureTunnel(runtime, state, input.jobDir, configForJob(input.config, job), job.itemKey, job.branch, job.repositories, input.log, void 0, job.queue
|
|
13024
|
+
if (input.config !== void 0) await ensureTunnel(runtime, state, input.jobDir, configForJob(input.config, job), job.itemKey, job.branch, job.repositories, input.log, void 0, readOnlyRemoteOf(job.queue));
|
|
12801
13025
|
await stopContainer(runtime, state);
|
|
12802
13026
|
const network = await ensureNetworkReady(runtime, state);
|
|
12803
13027
|
if (network !== void 0) throw new Error(network);
|
|
@@ -13249,6 +13473,8 @@ async function runHostChecks(input) {
|
|
|
13249
13473
|
const unpushed = [];
|
|
13250
13474
|
let primaryHead;
|
|
13251
13475
|
for (const entry of claimed) {
|
|
13476
|
+
const branch = entry.branch;
|
|
13477
|
+
if (branch === void 0) continue;
|
|
13252
13478
|
let entryToken = readToken;
|
|
13253
13479
|
if (!entry.primary) {
|
|
13254
13480
|
try {
|
|
@@ -13257,17 +13483,17 @@ async function runHostChecks(input) {
|
|
|
13257
13483
|
return await failAll(`no read token for ${entry.repository}: ${describeCallFailure(err)}`);
|
|
13258
13484
|
}
|
|
13259
13485
|
}
|
|
13260
|
-
const read = await (deps.readBranch ?? readBranchHead)({ remote: remoteOf(entry.repository), dir: scratch, branch
|
|
13261
|
-
if (read.kind === "unreadable") return await failAll(`the branch ${
|
|
13486
|
+
const read = await (deps.readBranch ?? readBranchHead)({ remote: remoteOf(entry.repository), dir: scratch, branch, token: entryToken });
|
|
13487
|
+
if (read.kind === "unreadable") return await failAll(`the branch ${branch} could not be read${entry.primary ? "" : ` on ${entry.repository}`}: ${read.reason}`);
|
|
13262
13488
|
if (read.kind === "absent") {
|
|
13263
13489
|
unpushed.push(entry);
|
|
13264
13490
|
continue;
|
|
13265
13491
|
}
|
|
13266
|
-
pushed.set(entry.repository,
|
|
13492
|
+
pushed.set(entry.repository, branch);
|
|
13267
13493
|
if (entry.primary) primaryHead = read.sha;
|
|
13268
13494
|
}
|
|
13269
13495
|
if (pushed.size === 0) {
|
|
13270
|
-
return await failAll(`the build pushed no branch: ${unpushed.map((entry) => `${entry.branch} does not exist on ${entry.repository}`).join("; ")}`);
|
|
13496
|
+
return await failAll(`the build pushed no branch: ${unpushed.map((entry) => `${entry.branch ?? "its branch"} does not exist on ${entry.repository}`).join("; ")}`);
|
|
13271
13497
|
}
|
|
13272
13498
|
const repositoriesToCheckOut = claimed;
|
|
13273
13499
|
const limitMinutes = config.checks?.timeLimitMinutes ?? DEFAULT_CHECK_TIME_LIMIT_MINUTES;
|
|
@@ -13487,4 +13713,4 @@ async function runHostChecks(input) {
|
|
|
13487
13713
|
}
|
|
13488
13714
|
}
|
|
13489
13715
|
|
|
13490
|
-
export { ADOPTED_FETCH_RETRY_WINDOW_MS, ALREADY_RELEASED, AttemptLogBook, CRITERIA_CHECK, 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, SandboxGoneError, agentCredentialCheck, appendCommandLog, attemptNote, builtOf, checksIn, claimPermissionProblem, claimRun, commandItems, commandLogOffset, containerCommandExec, createContainerRuntime, createHousekeepingDocker, createLeaseChannel, currentSkillCommand, decideHostBuildSkill, deliverCommitHooks, deliverContainerHooks, deliverExecMaven, deliverJobFiles, deliverSandboxHooks, describeHookEnd, describeMachineDocker, detectMachine, ensureFirecrackerAndJailer, ensureNetworkReady, ensureTunnel, execArgv, execCommandLine, fetchManagedBuildSettings, fetchManagedClaudeKey, filesAreCopied, finishJob, foldSample, formerSkillProblem, formerSkillQueues, freeItemDisksUntil, gitRemoteFor, 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, judgeProbe, keepGhConfigCurrent, keptCommitsLine, keptSandboxIds, leaseExpiresAtMs, leaseTimeLeftMs, lifecycleFailureReason, lifecycleSteps, listAdoptableJobs, listItemDisks, listTrackedJobs, listUnreadableJobs, listenOnBroker, makeRecorder, managedBuildSettingsFor, measureDisk, microVmArchSupported, microVmAssetsPinned, microVmCommandLine, microVmOomKills, missingPermissionFix, missingPermissionOf, modellessProblem, modellessQueues, 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, recordsProofsOnly, recoverLostJobs, releaseLease, removeOldestUntil, renewLease, renewRun, resolveHostBuild, restartSender, restoreSessionIntoContainer, restoreSessionIntoMicroVm, retryFailedReleases, runCommand, runCommandOf, runHook, runHostChecks, runHousekeeping, runIsolation, runRunnerInit, runWithSpawn, sampleGuest, savedStatesDir, scrubReason, serveLease, setStage, setUpRunnerCgroup, shellQuote, startHostServices, startMicroVmCommand, startSandboxCommand, startSender, startServicesFor, stopOrphanedMicroVms, stoppedHelperReason, stripTerminalControls, supportsContainerBuilds, supportsMicroVmBuilds, sweepImageBuilders, sweepSandboxes, testProofIn, timeoutAfter, unfinishedJobs, usableCpus, vmAlive, withTunnelLog, workdirProblem, writeGuestGhConfig, writeRunnerInit };
|
|
13716
|
+
export { ADOPTED_FETCH_RETRY_WINDOW_MS, ALREADY_RELEASED, AttemptLogBook, CRITERIA_CHECK, 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, SandboxGoneError, agentCredentialCheck, appendCommandLog, attemptNote, builtOf, checksIn, claimPermissionProblem, claimRun, commandItems, commandLogOffset, containerCommandExec, createContainerRuntime, createHousekeepingDocker, createLeaseChannel, currentSkillCommand, decideHostBuildSkill, deliverCommitHooks, deliverContainerHooks, deliverExecMaven, deliverJobFiles, deliverSandboxHooks, describeHookEnd, describeMachineDocker, detectMachine, ensureFirecrackerAndJailer, ensureNetworkReady, ensureTunnel, execArgv, execCommandLine, fetchManagedBuildSettings, fetchManagedClaudeKey, filesAreCopied, finishJob, foldSample, formerSkillProblem, formerSkillQueues, freeItemDisksUntil, gitRemoteFor, 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, judgeProbe, keepGhConfigCurrent, keptCommitsLine, keptSandboxIds, leaseExpiresAtMs, leaseTimeLeftMs, lifecycleFailureReason, lifecycleSteps, listAdoptableJobs, listItemDisks, listTrackedJobs, listUnreadableJobs, listenOnBroker, makeRecorder, managedBuildSettingsFor, measureDisk, microVmArchSupported, microVmAssetsPinned, microVmCommandLine, microVmOomKills, missingPermissionFix, missingPermissionOf, modellessProblem, modellessQueues, 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, recordsProofsOnly, recoverLostJobs, releaseLease, removeOldestUntil, renewLease, renewRun, resolveHostBuild, restartSender, restoreSessionIntoContainer, restoreSessionIntoMicroVm, restoreSessionIntoSandbox, retryFailedReleases, runCommand, runCommandOf, runHook, runHostChecks, runHousekeeping, runIsolation, runRunnerInit, runWithSpawn, sampleGuest, savedStatesDir, scrubReason, serveLease, setStage, setUpRunnerCgroup, shellQuote, startHostServices, startMicroVmCommand, startSandboxCommand, startSender, startServicesFor, stopOrphanedMicroVms, stoppedHelperReason, stripTerminalControls, supportsContainerBuilds, supportsMicroVmBuilds, sweepImageBuilders, sweepSandboxes, testProofIn, timeoutAfter, unfinishedJobs, usableCpus, vmAlive, withTunnelLog, workdirProblem, writeGuestGhConfig, writeRunnerInit };
|