@outerlayer/cli 0.38.0-next.20261111182110 → 0.38.0-next.20261111220050

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/dist/agent-setup-P77VERNT.js +40 -0
  2. package/dist/{agent-subcommand-NZFPV3MV.js → agent-subcommand-MLVQVTVU.js} +5 -5
  3. package/dist/{artifact-link-cmd-L4BXSQQP.js → artifact-link-cmd-A7SROEQS.js} +2 -2
  4. package/dist/{bridge-OBIGQXDH.js → bridge-CVHBKOFU.js} +8 -8
  5. package/dist/{build-4IYEB6OE.js → build-KVJM6PMC.js} +14 -14
  6. package/dist/{build-disk-2MOEPIZF.js → build-disk-H6ZN32KR.js} +12 -12
  7. package/dist/build-info.json +1 -1
  8. package/dist/{builder-SVI2D35R.js → builder-3LUEEVSN.js} +11 -11
  9. package/dist/caller-IMM277FA.js +23 -0
  10. package/dist/{check-XIJ2MOWV.js → check-V2TITR5P.js} +58 -58
  11. package/dist/{chunk-QHYCF36K.js → chunk-26BFN6DH.js} +1 -1
  12. package/dist/{chunk-36XB56GG.js → chunk-33HBGNKZ.js} +5 -5
  13. package/dist/{chunk-LVNMKOWI.js → chunk-34VR5LPD.js} +2 -2
  14. package/dist/{chunk-RHPEAVKR.js → chunk-3FN6JADD.js} +1 -1
  15. package/dist/{chunk-CT4PKI24.js → chunk-3LOW5W6T.js} +274 -99
  16. package/dist/{chunk-QENFVQ7O.js → chunk-3RAAAAPL.js} +7 -7
  17. package/dist/{chunk-KA4BMGBR.js → chunk-3V5B7M5Q.js} +2 -2
  18. package/dist/{chunk-XAVR7JHO.js → chunk-3XZ66FRV.js} +10 -10
  19. package/dist/{chunk-R3S2A7YF.js → chunk-544OP3E4.js} +90 -45
  20. package/dist/{chunk-J345NEVJ.js → chunk-5FTUUXBK.js} +5 -5
  21. package/dist/{chunk-NEXKR5RR.js → chunk-5NVF5TAL.js} +6 -1
  22. package/dist/{chunk-NFPJ2XC2.js → chunk-6AORV65Z.js} +3 -3
  23. package/dist/{chunk-DE3NQAR7.js → chunk-6LYKHTC2.js} +3 -3
  24. package/dist/{chunk-WV4T6ZOQ.js → chunk-6VHBQBHL.js} +2 -2
  25. package/dist/{chunk-6XORUAR7.js → chunk-7GJEQXOH.js} +1 -1
  26. package/dist/{chunk-I45HTSSA.js → chunk-A3NJSQPK.js} +1 -1
  27. package/dist/{chunk-PBHAM73F.js → chunk-AR3SCE7R.js} +3 -3
  28. package/dist/{chunk-6YOXYZC2.js → chunk-AS3DUHKZ.js} +7 -7
  29. package/dist/{chunk-FQPGZOH3.js → chunk-AUBLZPCA.js} +1 -1
  30. package/dist/{chunk-ATEMEVFF.js → chunk-AW3N24L5.js} +1 -1
  31. package/dist/{chunk-ZC2BXXKB.js → chunk-B4HUGT3L.js} +16 -16
  32. package/dist/{chunk-CZDYUKA6.js → chunk-BKAUXDXK.js} +7 -7
  33. package/dist/{chunk-UPUHL3KC.js → chunk-BU4O4T7X.js} +7 -7
  34. package/dist/{chunk-N3KGXHV4.js → chunk-BUT777XB.js} +1 -1
  35. package/dist/{chunk-6XMC6R4W.js → chunk-C6OQ45AS.js} +1 -1
  36. package/dist/{chunk-DKRZZBKI.js → chunk-CAL6L5DK.js} +3 -3
  37. package/dist/{chunk-6BXJESQF.js → chunk-CJEWYQ46.js} +9 -9
  38. package/dist/{chunk-3Z5KBFBB.js → chunk-COTJ2FIL.js} +2 -2
  39. package/dist/{chunk-ZQII2ZRP.js → chunk-CPXQLO4X.js} +1 -1
  40. package/dist/{chunk-6GZL5RIV.js → chunk-CT7X6XGR.js} +14 -11
  41. package/dist/{chunk-JDOEEKPN.js → chunk-DPMUZ2QT.js} +25 -9
  42. package/dist/{chunk-MOA4PGYL.js → chunk-DULA3AYN.js} +1 -1
  43. package/dist/{chunk-3YJJ2JDV.js → chunk-E532PUGI.js} +1 -1
  44. package/dist/{chunk-BIMHESZG.js → chunk-EVME7MT6.js} +1 -1
  45. package/dist/{chunk-OPCFOIZJ.js → chunk-EWKNMUPI.js} +1 -1
  46. package/dist/{chunk-MOFT7QCR.js → chunk-F4Q4Y7ZE.js} +5 -5
  47. package/dist/{chunk-LW5RIKAV.js → chunk-FBLO2U6D.js} +1 -1
  48. package/dist/{chunk-4AEOP5PD.js → chunk-FM4OXL5V.js} +6 -6
  49. package/dist/{chunk-D5GR3U2O.js → chunk-FYIISGXR.js} +10 -10
  50. package/dist/{chunk-IHM7K6RS.js → chunk-GRNA7FHI.js} +4 -4
  51. package/dist/{chunk-BATSP67Z.js → chunk-GXYVZZO7.js} +6 -6
  52. package/dist/{chunk-IN7QCBO5.js → chunk-KGDFBO3G.js} +6 -6
  53. package/dist/{chunk-4G5SYPK2.js → chunk-KUM6RRPC.js} +1 -1
  54. package/dist/{chunk-6FQSV7ZK.js → chunk-KUNRGSPX.js} +3 -3
  55. package/dist/{chunk-LKLP5YMH.js → chunk-LEIO5LD3.js} +7 -7
  56. package/dist/{chunk-KR34GXEH.js → chunk-LF4BHMEG.js} +1 -1
  57. package/dist/{chunk-CAQSGGPJ.js → chunk-LOXR7Q77.js} +6 -6
  58. package/dist/{chunk-ORLJK7UT.js → chunk-MOBYKKTR.js} +7 -7
  59. package/dist/{chunk-NJ6IJFKR.js → chunk-MRZMJPYA.js} +1 -1
  60. package/dist/{chunk-OKAAVLLW.js → chunk-MXEZN6SV.js} +4 -4
  61. package/dist/{chunk-7GUD2FIF.js → chunk-N63KZWYP.js} +1 -1
  62. package/dist/{chunk-UKEJBA5Y.js → chunk-NHYV24WJ.js} +4 -4
  63. package/dist/{chunk-SASWFX22.js → chunk-NTPBHL6U.js} +1 -1
  64. package/dist/{chunk-QMCWSBQO.js → chunk-O4BVDRKJ.js} +2 -2
  65. package/dist/{chunk-QH5NV7EQ.js → chunk-PFSUX4MQ.js} +7 -7
  66. package/dist/{chunk-SIGBRVEF.js → chunk-Q3QA4DTV.js} +18 -5
  67. package/dist/{chunk-DKTXQ7XQ.js → chunk-QPSLXP6A.js} +2 -2
  68. package/dist/{chunk-F3RBGMHL.js → chunk-QR6XP6BJ.js} +1 -1
  69. package/dist/{chunk-USINHGZI.js → chunk-RIYSVN6V.js} +3 -3
  70. package/dist/{chunk-36M66QKN.js → chunk-SBZX6XP6.js} +2 -1
  71. package/dist/{chunk-VQ6ZKSNL.js → chunk-T34WBDIO.js} +1 -1
  72. package/dist/{chunk-ABRGN5OA.js → chunk-TFAAVSYJ.js} +4 -4
  73. package/dist/{chunk-UWLCJZ45.js → chunk-TNUJXYK6.js} +1 -1
  74. package/dist/{chunk-VNHCN75M.js → chunk-TYXZTMZK.js} +1 -1
  75. package/dist/{chunk-3BEMKOFH.js → chunk-U5NUHRGX.js} +1 -1
  76. package/dist/{chunk-AJ3YUM23.js → chunk-UIS6E64L.js} +1 -1
  77. package/dist/{chunk-33XLQIV4.js → chunk-UOCYI5SA.js} +3 -3
  78. package/dist/{chunk-AMFCM4H7.js → chunk-UPIXYW7Y.js} +3 -3
  79. package/dist/{chunk-QBJ7MMOT.js → chunk-V6FY4BRV.js} +16 -5
  80. package/dist/{chunk-3SHX2D37.js → chunk-VZ3T5MPT.js} +5 -5
  81. package/dist/{chunk-TH3K67SR.js → chunk-WJMA4BRG.js} +9 -9
  82. package/dist/{chunk-BECC4325.js → chunk-WR53L7RZ.js} +8 -8
  83. package/dist/{chunk-DULO2L5B.js → chunk-WVTBZX4K.js} +1 -1
  84. package/dist/{chunk-TMROYEP4.js → chunk-YRJI2ZKT.js} +4 -4
  85. package/dist/{chunk-PDPBWX67.js → chunk-ZN4444RL.js} +17 -6
  86. package/dist/{claude-launcher-GIT7VNYK.js → claude-launcher-XHIHOO4U.js} +8 -8
  87. package/dist/{cli-Y5CRBNQQ.js → cli-VZUDY3VM.js} +168 -159
  88. package/dist/{cli-update-notice-OC4SOSZE.js → cli-update-notice-PCJN5ZKP.js} +2 -2
  89. package/dist/{command-2RX7FULE.js → command-TWK2QQ5J.js} +53 -53
  90. package/dist/config-JMTO5H4U.js +22 -0
  91. package/dist/{connect-cmd-DSP6HJRP.js → connect-cmd-JPHOQZBW.js} +15 -15
  92. package/dist/{container-start-DFFZVSGX.js → container-start-IWW2OVWT.js} +51 -51
  93. package/dist/{context-cleanup-FIQMPC6F.js → context-cleanup-CTKOHNCW.js} +5 -5
  94. package/dist/{context-show-cmd-BPZX3OUE.js → context-show-cmd-WO6B7UUZ.js} +16 -16
  95. package/dist/{control-plane-launch-IIHRG233.js → control-plane-launch-OZLAMALE.js} +16 -16
  96. package/dist/{demo-record-cmd-PI7QDFRP.js → demo-record-cmd-47RXW75H.js} +9 -9
  97. package/dist/{demo-voice-cmd-CMCPERTJ.js → demo-voice-cmd-ENFCUFP6.js} +22 -22
  98. package/dist/{dist-JSSJSW2B.js → dist-7JDEWP5U.js} +2 -2
  99. package/dist/docker-KC5ZFIK5.js +20 -0
  100. package/dist/{doctor-ZVHGEA3C.js → doctor-3XXCQPUZ.js} +53 -53
  101. package/dist/emit-artifact-cmd-5YXDBVXP.js +44 -0
  102. package/dist/{emit-cmd-QGVMVSLS.js → emit-cmd-VETPASRD.js} +8 -8
  103. package/dist/emit-criteria-cmd-5GBTQL3J.js +35 -0
  104. package/dist/{emit-demo-cmd-KLYEKCB3.js → emit-demo-cmd-2YTSDKEN.js} +22 -22
  105. package/dist/{emit-finding-cmd-FZWK3Y4Q.js → emit-finding-cmd-RXR5O2RB.js} +18 -18
  106. package/dist/{emit-result-cmd-TODAXDFJ.js → emit-result-cmd-ND72YSHC.js} +20 -20
  107. package/dist/{emit-step-cmd-QI52ZB57.js → emit-step-cmd-NXRZAW3R.js} +18 -18
  108. package/dist/{exec-client-YQCKCZGW.js → exec-client-RQ2WBQYI.js} +9 -9
  109. package/dist/find-unit-6YALHLSE.js +24 -0
  110. package/dist/{findings-cmd-O7I2GKRO.js → findings-cmd-OHZRCVPV.js} +18 -18
  111. package/dist/{fleet-readiness-BY7PY5FF.js → fleet-readiness-QTBZ322P.js} +16 -16
  112. package/dist/governing-source-LOIIVNWG.js +41 -0
  113. package/dist/guest-init-R3Z35NG7.js +20 -0
  114. package/dist/{hook-fast-3BGU6BF2.js → hook-fast-BEFGAPAW.js} +3 -3
  115. package/dist/{hook-install-6H6W4UM2.js → hook-install-Y6ZL3OT2.js} +5 -5
  116. package/dist/host-checks-3OKNIXBF.js +80 -0
  117. package/dist/host-key-JDLHIUNO.js +18 -0
  118. package/dist/{image-tag-IJKYPT6D.js → image-tag-BAA6APVR.js} +9 -9
  119. package/dist/index.js +4 -4
  120. package/dist/{init-65RN5X55.js → init-IE5IGNVE.js} +49 -49
  121. package/dist/init-LGMYM54E.js +80 -0
  122. package/dist/{init-agent-R4ZOEFI3.js → init-agent-YBLFXWPL.js} +49 -49
  123. package/dist/{init-cmd-L4EFMAQ4.js → init-cmd-VKCXBALQ.js} +29 -29
  124. package/dist/{init-update-ACLVXFS7.js → init-update-EJS5G2XZ.js} +26 -26
  125. package/dist/install-cmd-7LUZQZMJ.js +21 -0
  126. package/dist/{layout-MBCG2IHB.js → layout-IZ6XCHGG.js} +5 -5
  127. package/dist/{login-browser-COSWHZEC.js → login-browser-LSZKECIB.js} +2 -2
  128. package/dist/{logs-VX2SXLJH.js → logs-WVO5SCTN.js} +8 -8
  129. package/dist/loop-ZMIBNWIP.js +90 -0
  130. package/dist/machine-WILRS4XJ.js +80 -0
  131. package/dist/{machine-skills-RPKQK52T.js → machine-skills-SDIQFRIX.js} +5 -5
  132. package/dist/{mcp-install-cmd-GN2K2JM3.js → mcp-install-cmd-GF2QAYQE.js} +5 -5
  133. package/dist/{mcp-serve-cmd-P34CQIBX.js → mcp-serve-cmd-RB3NBRP7.js} +11 -11
  134. package/dist/{paths-HV3G2EHE.js → paths-W2U4BYFR.js} +8 -8
  135. package/dist/pending-ZYVVCMCB.js +18 -0
  136. package/dist/{pidfile-4ZG5I7ZR.js → pidfile-ZIDS3G5J.js} +9 -9
  137. package/dist/{record-3XWPD2UP.js → record-I6XI5YWE.js} +9 -9
  138. package/dist/{relay-ZOWT4YLQ.js → relay-MUBJFLEI.js} +6 -6
  139. package/dist/{relay-protocol-FDFEVLQT.js → relay-protocol-UK2KZKGH.js} +6 -6
  140. package/dist/{run-cmd-ZVNOKJB3.js → run-cmd-KPAN5DTB.js} +18 -18
  141. package/dist/{runner-agents-3NUGNJD6.js → runner-agents-3ZKMPZ2D.js} +5 -5
  142. package/dist/runner-env-IKUFXCUV.js +24 -0
  143. package/dist/{runner-identity-F2Z3TXJ7.js → runner-identity-UMODOKXV.js} +11 -11
  144. package/dist/{runner-key-AOK7W733.js → runner-key-4VZCSL73.js} +49 -49
  145. package/dist/{session-sender-V3INPB34.js → session-sender-CCXS5LKC.js} +21 -21
  146. package/dist/{spec-cmd-LYGXRFVY.js → spec-cmd-UX6VYKE6.js} +109 -22
  147. package/dist/{starter-pack-7QA7J5FT.js → starter-pack-EQL24NLF.js} +6 -6
  148. package/dist/state-MD27KY5N.js +18 -0
  149. package/dist/{status-SPPT7WU5.js → status-IRQ5N2CN.js} +49 -49
  150. package/dist/{sync-cmd-EDSOKOXS.js → sync-cmd-OCHEVJDU.js} +20 -20
  151. package/dist/update-steps-PCZORLEO.js +81 -0
  152. package/dist/{watch-GBDNXFAK.js → watch-DDSNYG5M.js} +20 -20
  153. package/dist/{work-claim-cmd-SHKDYS7J.js → work-claim-cmd-2YYRYOPS.js} +27 -27
  154. package/dist/work-cmd-PRMB5ETL.js +33 -0
  155. package/dist/work-comment-cmd-7SOO2JXW.js +39 -0
  156. package/dist/{work-demo-cmd-YJ654BQP.js → work-demo-cmd-P7AXOVMK.js} +18 -18
  157. package/dist/{work-logs-cmd-RUNYYALP.js → work-logs-cmd-PUE23KB5.js} +18 -18
  158. package/dist/{work-needs-attention-cmd-NRDFGJPP.js → work-needs-attention-cmd-SJ6P2V3S.js} +18 -18
  159. package/dist/{work-no-change-cmd-FDA7PYB7.js → work-no-change-cmd-6FLPOK7M.js} +18 -18
  160. package/dist/{work-open-pr-cmd-LEWPNTW5.js → work-open-pr-cmd-FTZSIWOM.js} +19 -19
  161. package/dist/work-pr-cmd-ZOCB54YC.js +34 -0
  162. package/dist/{work-proofs-cmd-QKIEJJRF.js → work-proofs-cmd-7HOVHHCL.js} +20 -20
  163. package/dist/{work-proofs-record-2M4A5OIF.js → work-proofs-record-YWUBA3IS.js} +26 -26
  164. package/dist/{work-stop-cmd-HH2SSJIO.js → work-stop-cmd-LKDWZL24.js} +18 -18
  165. package/package.json +3 -3
  166. package/skill-pack/maintained/outerlayer-amend/references/threads.md +10 -4
  167. package/skill-pack/maintained/outerlayer-build/references/agent-briefs.md +1 -1
  168. package/skill-pack/maintained/outerlayer-build/references/code-review-judge.md +15 -5
  169. package/skill-pack/maintained/outerlayer-revise/SKILL.md +68 -0
  170. package/dist/agent-setup-U4XTZO56.js +0 -40
  171. package/dist/caller-PW7R46M7.js +0 -23
  172. package/dist/config-AOOR5BPQ.js +0 -22
  173. package/dist/docker-6MPPSTR4.js +0 -20
  174. package/dist/emit-artifact-cmd-VJ3C36RU.js +0 -44
  175. package/dist/emit-criteria-cmd-UOHOOSVV.js +0 -35
  176. package/dist/find-unit-YT25OH3F.js +0 -24
  177. package/dist/governing-source-XRLJFSPE.js +0 -41
  178. package/dist/guest-init-X2HLNETS.js +0 -20
  179. package/dist/host-checks-U5JKQQMM.js +0 -80
  180. package/dist/host-key-KQ6JWRB4.js +0 -18
  181. package/dist/init-CYTHJSTQ.js +0 -80
  182. package/dist/install-cmd-DHIVJEBO.js +0 -21
  183. package/dist/loop-4ATDJGQV.js +0 -90
  184. package/dist/machine-UIA7MN3U.js +0 -80
  185. package/dist/pending-I2EJ7TMY.js +0 -18
  186. package/dist/runner-env-JS2WDB5L.js +0 -24
  187. package/dist/state-64OMLIN4.js +0 -18
  188. package/dist/update-steps-XPEATLFQ.js +0 -81
  189. package/dist/work-cmd-QR62TX6Q.js +0 -33
  190. package/dist/work-comment-cmd-DUDVMT6U.js +0 -39
  191. 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-JDOEEKPN.js';
4
- import { RUNNER_PROTOCOL } from './chunk-6XMC6R4W.js';
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-DPMUZ2QT.js';
4
+ import { RUNNER_PROTOCOL } from './chunk-C6OQ45AS.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-J345NEVJ.js';
8
- import { upgradedStarterText } from './chunk-MOFT7QCR.js';
9
- import { HELPER_PATH, HELPER_RECORD, DOCKERD_LOG } from './chunk-DKRZZBKI.js';
10
- import { writeDockerClientConfig } from './chunk-BIMHESZG.js';
11
- import { senderPidfile } from './chunk-TMROYEP4.js';
12
- import { installScrubContext } from './chunk-TH3K67SR.js';
7
+ import { hasStoredCredential, storedCredentialVariables, storeAgentCredential, isAgentName, credentialFromStdin } from './chunk-5FTUUXBK.js';
8
+ import { upgradedStarterText } from './chunk-F4Q4Y7ZE.js';
9
+ import { HELPER_PATH, HELPER_RECORD, DOCKERD_LOG } from './chunk-CAL6L5DK.js';
10
+ import { writeDockerClientConfig } from './chunk-EVME7MT6.js';
11
+ import { senderPidfile } from './chunk-YRJI2ZKT.js';
12
+ import { installScrubContext } from './chunk-WJMA4BRG.js';
13
13
  import { readsJobState, READ_JOB_STATE_FORMATS, jobStateFormatOf } from './chunk-ZVB57WI6.js';
14
- import { runnerImageVersion } from './chunk-4G5SYPK2.js';
15
- import { claimCalls, spoolHomeFor, itemCalls, claimItem, leftByRunnerKey, configForJob } from './chunk-3Z5KBFBB.js';
14
+ import { runnerImageVersion } from './chunk-KUM6RRPC.js';
15
+ import { claimCalls, spoolHomeFor, itemCalls, claimItem, leftByRunnerKey, configForJob } from './chunk-COTJ2FIL.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-LKLP5YMH.js';
18
- import { FETCHED_DIR, toolsDockerfile, FETCHED_FFMPEG, FETCHED_GH, FETCHED_TINI, FETCHED_HEADLESS_SHELL, FETCHED_PLAYWRIGHT_FFMPEG, FETCHED_VOICE_DIR } from './chunk-ABRGN5OA.js';
17
+ import { readDefaultBranchFiles, readDefaultBranchHead, buildRepositoryImage, fetchCommit, readBranchHead, diffBetween, prepareImageBuild, KEY_PREFIX, TAG_HOST, SHARED_OWNER, SHARED_NAME, universalBase, metadataFromLabels, writeRecord } from './chunk-LEIO5LD3.js';
18
+ import { FETCHED_DIR, toolsDockerfile, FETCHED_FFMPEG, FETCHED_GH, FETCHED_TINI, FETCHED_HEADLESS_SHELL, FETCHED_PLAYWRIGHT_FFMPEG, FETCHED_VOICE_DIR } from './chunk-TFAAVSYJ.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-UWLCJZ45.js';
22
- import { socketPathProblem, vsockLinks, linkVsockSockets, GUEST_CID, LEASE_LINK } from './chunk-33XLQIV4.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-CZDYUKA6.js';
24
- import { postJson, WorkCommandError, isSignatureRefusal, getJson } from './chunk-6GZL5RIV.js';
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-QBJ7MMOT.js';
26
- import { formatBytes, volumeBytes, allocatedBytes, DEFAULT_BUILD_DISK, DEFAULT_CACHE_DISK, freeBytes } from './chunk-KA4BMGBR.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-6BXJESQF.js';
28
- import { universalImagePending, RecipeError, writeSanitizedRecipe, classifyProperties, DOCKER_FEATURE } from './chunk-FQPGZOH3.js';
29
- import { sanitizeTerminal, planArtifactUpload } from './chunk-QHYCF36K.js';
30
- import { sharedSkillNames, skillConflictMessage } from './chunk-WV4T6ZOQ.js';
21
+ import { vmExecArgs, runExec, execCapture, waitForAgent } from './chunk-TNUJXYK6.js';
22
+ import { socketPathProblem, vsockLinks, linkVsockSockets, GUEST_CID, LEASE_LINK } from './chunk-UOCYI5SA.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-BKAUXDXK.js';
24
+ import { postJson, WorkCommandError, isSignatureRefusal, getJson } from './chunk-CT7X6XGR.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-V6FY4BRV.js';
26
+ import { formatBytes, volumeBytes, allocatedBytes, DEFAULT_BUILD_DISK, DEFAULT_CACHE_DISK, freeBytes } from './chunk-3V5B7M5Q.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-CJEWYQ46.js';
28
+ import { universalImagePending, RecipeError, writeSanitizedRecipe, classifyProperties, DOCKER_FEATURE } from './chunk-AUBLZPCA.js';
29
+ import { sanitizeTerminal, planArtifactUpload } from './chunk-26BFN6DH.js';
30
+ import { sharedSkillNames, skillConflictMessage } from './chunk-6VHBQBHL.js';
31
31
  import { readCloudConfig } from './chunk-HWVMRETT.js';
32
- import { signerFor } from './chunk-ZQII2ZRP.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-DULO2L5B.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-SIGBRVEF.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-NFPJ2XC2.js';
32
+ import { signerFor } from './chunk-CPXQLO4X.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-WVTBZX4K.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-Q3QA4DTV.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-6AORV65Z.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-36M66QKN.js';
38
- import { sessionFolderIn, legacyAgent, defaultAgents, parsePolicy, AGENTS_SKILLS_BASE, OUTERLAYER_SKILLS_BASE, orderSessions, extractFacts, sessionsToTimeline, resolvePackRoot } from './chunk-PDPBWX67.js';
39
- import { MAINTAINED_SKILLS } from './chunk-ATEMEVFF.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-SBZX6XP6.js';
38
+ import { sessionFolderIn, legacyAgent, defaultAgents, parsePolicy, AGENTS_SKILLS_BASE, OUTERLAYER_SKILLS_BASE, orderSessions, extractFacts, sessionsToTimeline, resolvePackRoot } from './chunk-ZN4444RL.js';
39
+ import { MAINTAINED_SKILLS } from './chunk-AW3N24L5.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-6XORUAR7.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, CHECK_ITEM_HREF_MAX_LENGTH, downconvertSession } from './chunk-NEXKR5RR.js';
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';
@@ -2460,6 +2460,15 @@ async function prepareBranch(opts) {
2460
2460
  startCommit: await mustGit(git2, workdir, `reading the commit of ${defaultBranch}`, ["rev-parse", `origin/${defaultBranch}`])
2461
2461
  };
2462
2462
  }
2463
+ async function prepareDefaultBranch(opts) {
2464
+ const { workdir } = opts;
2465
+ const git2 = opts.git ?? localGit;
2466
+ const defaultBranch = await remoteDefaultBranch(git2, workdir);
2467
+ await fetchBranch(git2, workdir, defaultBranch);
2468
+ await mustGit(git2, workdir, `checking out ${defaultBranch}`, ["checkout", "--quiet", "-B", defaultBranch, `origin/${defaultBranch}`]);
2469
+ const head = await mustGit(git2, workdir, "reading the checked-out commit", ["rev-parse", "HEAD"]);
2470
+ return { branch: defaultBranch, head, startCommit: head };
2471
+ }
2463
2472
  async function keepUnpushedCommits(git2, workdir, branch) {
2464
2473
  const local = await git2(workdir, ["rev-parse", "--quiet", "--verify", `refs/heads/${branch}^{commit}`]);
2465
2474
  if (local.status !== 0) return void 0;
@@ -2928,21 +2937,18 @@ async function checkOut(input, entry, restored, fromItemDisk) {
2928
2937
  }
2929
2938
  }
2930
2939
  try {
2931
- const prepared = await prepareBranch({
2932
- workdir: path,
2933
- branch: entry.branch,
2934
- git: async (cwd, args) => {
2935
- const ran = await exec(["git", ...args], cwd, { quiet: true });
2936
- return { status: ran.status, stdout: ran.stdout.trim(), stderr: ran.stderr.trim() };
2937
- }
2938
- });
2940
+ const git2 = async (cwd, args) => {
2941
+ const ran = await exec(["git", ...args], cwd, { quiet: true });
2942
+ return { status: ran.status, stdout: ran.stdout.trim(), stderr: ran.stderr.trim() };
2943
+ };
2944
+ const prepared = entry.branch === void 0 ? await prepareDefaultBranch({ workdir: path, git: git2 }) : await prepareBranch({ workdir: path, branch: entry.branch, git: git2 });
2939
2945
  if (prepared.kept !== void 0) log.line(`${tag} ${entry.primary ? "" : `${entry.repository}: `}${keptCommitsLine(prepared.branch, prepared.kept)}`);
2940
2946
  log.line(`${tag} ${entry.primary ? "" : `${entry.repository} `}on ${prepared.branch} at ${prepared.head.slice(0, 8)}`);
2941
2947
  return { ok: true, head: prepared.head, startCommit: prepared.startCommit };
2942
2948
  } catch (err) {
2943
2949
  if (err instanceof BranchPrepareError) {
2944
2950
  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);
2951
+ return failed(restored ? `the ${what} checkout of ${entry.repository} could not be switched to ${entry.branch ?? "its default branch"}: ${err.message}` : reason);
2946
2952
  }
2947
2953
  throw err;
2948
2954
  }
@@ -4425,7 +4431,7 @@ async function provisionSandboxOnce(input, itemDiskFailed) {
4425
4431
  environment.credentials = tokens.used();
4426
4432
  let services;
4427
4433
  try {
4428
- const gitRemote = gitRemoteFor(runtime, { repositories, tokens, buildDir: buildDir2, log: (line2) => log.line(`${tag} ${line2}`), ...input.queue === "run" ? { readOnly: true } : {} });
4434
+ const gitRemote = gitRemoteFor(runtime, { repositories, tokens, buildDir: buildDir2, log: (line2) => log.line(`${tag} ${line2}`), ...readOnlyOption(input.queue) });
4429
4435
  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
4436
  runtime.tunnels.set(buildId, services);
4431
4437
  } catch (err) {
@@ -4603,6 +4609,33 @@ async function provisionSandboxOnce(input, itemDiskFailed) {
4603
4609
  function asContainerJob(job) {
4604
4610
  return { ...job, container: job.sandbox.container };
4605
4611
  }
4612
+ async function leaveRelay(runtime, buildId) {
4613
+ runtime.leases.get(buildId)?.stop();
4614
+ const relay = runtime.relays.get(buildId);
4615
+ if (relay !== void 0) {
4616
+ runtime.relays.delete(buildId);
4617
+ await relay.close();
4618
+ }
4619
+ }
4620
+ async function rejoinOf(runtime, own) {
4621
+ const services = runtime.tunnels.get(own.container.buildId);
4622
+ const joinSecret = runtime.sandbox.joinSecrets.get(own.container.buildId);
4623
+ 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");
4624
+ const sandbox = await sandboxOfBuild(runtime, own);
4625
+ if (sandbox === void 0) throw new SandboxGoneError(own.sandboxId);
4626
+ return { sandbox, sandboxed: runtimeInSandbox(runtime, sandbox), streams: services.streams, joinSecret };
4627
+ }
4628
+ async function startSandboxContainerAgain(runtime, own, rejoin, jobDir, log) {
4629
+ const state = own.container;
4630
+ const { sandbox, sandboxed } = rejoin;
4631
+ const started = await sandboxed.host.start(state.container);
4632
+ if (started.status !== 0) throw new Error(`the build's container could not be started again (exit ${started.status})`);
4633
+ if (!await waitForRelay(sandboxed, state.container)) throw new Error("the relay in the build's container did not start again");
4634
+ joinRelay(runtime, sandbox, { buildId: state.buildId, container: state.container }, rejoin.streams, rejoin.joinSecret, log);
4635
+ const delivered = await deliverJobFiles(sandboxed, state, ["gh", "git-hooks", "context"], secretsOf(runtime, jobDir));
4636
+ if (!delivered.ok) throw new Error(delivered.reason);
4637
+ state.stopped = false;
4638
+ }
4606
4639
  function sandboxJudgeEnvironment(input) {
4607
4640
  const own = input.job.sandbox;
4608
4641
  const state = own.container;
@@ -4610,27 +4643,14 @@ function sandboxJudgeEnvironment(input) {
4610
4643
  return {
4611
4644
  stop: async () => {
4612
4645
  const { runtime } = input;
4613
- const services = runtime.tunnels.get(state.buildId);
4614
- const joinSecret = runtime.sandbox.joinSecrets.get(state.buildId);
4615
- 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");
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
- }
4646
+ const rejoin = await rejoinOf(runtime, own);
4647
+ const { sandbox, sandboxed } = rejoin;
4648
+ await leaveRelay(runtime, state.buildId);
4625
4649
  const removed = await client(runtime).command(sandbox, removeBuildContainersLine(state.container));
4626
4650
  if (removed.exitCode !== 0) throw new Error(`the containers the build started could not be removed (exit ${removed.exitCode ?? "none"})`);
4627
4651
  await sandboxed.host.stop(state.container);
4628
- const started = await sandboxed.host.start(state.container);
4629
- if (started.status !== 0) throw new Error(`the build's container could not be started again (exit ${started.status})`);
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);
4652
+ state.stopped = true;
4653
+ await startSandboxContainerAgain(runtime, own, rejoin, input.jobDir, input.log);
4634
4654
  },
4635
4655
  hashProgram: async () => (await inner()).hashProgram(),
4636
4656
  prepare: async (files, tree) => (await inner()).prepare(files, tree),
@@ -4706,17 +4726,35 @@ async function endSandboxCommand(runtime, state, jobDir, warn) {
4706
4726
  appendCommandLog(jobDir, probe.bytes);
4707
4727
  if (probe.bytes.length === 0 || offset + probe.bytes.length >= probe.size) break;
4708
4728
  }
4729
+ await leaveRelay(runtime, state.buildId);
4709
4730
  await sandboxed.host.stop(state.container.container);
4731
+ state.container.stopped = true;
4710
4732
  } catch (err) {
4711
4733
  warn(`ending the build's command in its sandbox failed: ${describeCallFailure(err)} \xB7 continuing`);
4712
4734
  }
4713
4735
  }
4736
+ var HOOK_ERRORS_IN_CONTAINER = "/build/home/.outerlayer/spool/hook-errors.log";
4737
+ async function copySandboxHookErrors(runtime, state, jobDir) {
4738
+ try {
4739
+ if (state.container.stopped === true) return;
4740
+ const sandboxed = await inSandbox(runtime, state);
4741
+ const log = await sandboxed.host.exec({
4742
+ container: state.container.container,
4743
+ user: state.container.agentUser ?? ADDED_USER,
4744
+ env: NO_ENV,
4745
+ argv: ["tail", "-c", String(SANDBOX_PROBE_BYTES), HOOK_ERRORS_IN_CONTAINER]
4746
+ });
4747
+ if (log.status === 0 && log.stdout !== "") writeFileSync(join(jobDir, "hook-errors.log"), log.stdout);
4748
+ } catch {
4749
+ }
4750
+ }
4714
4751
  async function runCliInSandbox(input, argv, logName) {
4715
4752
  const { job } = input;
4716
4753
  const own = job.sandbox;
4717
4754
  try {
4718
4755
  const sandboxed = await inSandbox(input.runtime, own);
4719
4756
  const state = own.container;
4757
+ if (state.stopped === true) await startSandboxContainerAgain(input.runtime, own, await rejoinOf(input.runtime, own), input.jobDir, input.log);
4720
4758
  const env = buildEnvironment({
4721
4759
  config: claimCalls(input.config, job),
4722
4760
  item: job.item,
@@ -5534,7 +5572,7 @@ async function provisionMicroVmOnce(input, allowRestore, itemDiskFailed) {
5534
5572
  makeBuildsDirPrivate(buildDir2);
5535
5573
  let services;
5536
5574
  try {
5537
- const gitRemote = gitRemoteFor(runtime, { repositories, tokens, buildDir: buildDir2, organizationId: input.organizationId, log: (line2) => log.line(`${tag} ${line2}`), ...input.queue === "run" ? { readOnly: true } : {} });
5575
+ const gitRemote = gitRemoteFor(runtime, { repositories, tokens, buildDir: buildDir2, organizationId: input.organizationId, log: (line2) => log.line(`${tag} ${line2}`), ...readOnlyOption(input.queue) });
5538
5576
  services = await startServicesFor(runtime, config, buildDir2, jobDir, itemKey, true, gitRemote, "socket", void 0, void 0, (line2) => log.line(`${tag} ${line2}`));
5539
5577
  runtime.tunnels.set(buildId, services);
5540
5578
  } catch (err) {
@@ -7907,6 +7945,7 @@ async function keepSandboxDisk2(input) {
7907
7945
  // src/runner/workspace/finish.ts
7908
7946
  function noDiskReason(job, config) {
7909
7947
  if (job.workItemId === void 0) return "the job names no work item";
7948
+ if (job.queue === "revise") return "a revision reads each repository at its default branch and leaves nothing to continue";
7910
7949
  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
7950
  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
7951
  return void 0;
@@ -8007,6 +8046,7 @@ async function guestOf(job, runtime) {
8007
8046
  async function keepEndedSession(input) {
8008
8047
  const { job, log, tag } = input;
8009
8048
  if (job.sessionId === void 0 || job.workItemId === void 0 || job.sessionKept === true) return false;
8049
+ if (job.queue === "revise") return false;
8010
8050
  if (job.microvm === void 0 && job.container === void 0) return false;
8011
8051
  if (jobAgent(job, input.runtime.agents)?.adapter.launch?.session === void 0) return false;
8012
8052
  const found = await guestOf(job, input.runtime);
@@ -8067,11 +8107,12 @@ function readJudgeReply(run, minutes, agents = defaultAgents()) {
8067
8107
  const said2 = firstLine5(run.stderr);
8068
8108
  return { kind: "none", reason: `the judge exited ${run.status} and printed no result${said2 === "" ? "" : `: ${said2}`}` };
8069
8109
  }
8070
- 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` };
8110
+ const usage = output.usage === void 0 ? {} : { usage: output.usage };
8111
+ 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
8112
  const lines = output.text.split(/\r\n|\r|\n/).map((line2) => line2.trim()).filter((line2) => line2 !== "");
8072
8113
  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] ?? [])) };
8114
+ if (verdict === void 0) return { kind: "none", reason: "the judge gave no `result:` line", ...usage };
8115
+ return { kind: "answered", verdict, unmet: new Set(lines.flatMap((line2) => UNMET_LINE.exec(line2)?.[1] ?? [])), ...usage };
8075
8116
  }
8076
8117
 
8077
8118
  // src/runner/judge-report.ts
@@ -8209,6 +8250,19 @@ function previousText(items) {
8209
8250
  return `${JSON.stringify({ commit: open[0].commit ?? null, defects }, null, 2)}
8210
8251
  `;
8211
8252
  }
8253
+ function storedProblemsText(problems) {
8254
+ const defects = problems.filter((problem) => problem.status === "open" || problem.status === "with_agent");
8255
+ const dismissed = problems.filter((problem) => problem.status === "not_a_problem");
8256
+ if (defects.length === 0 && dismissed.length === 0) return void 0;
8257
+ const place = (problem) => ({ path: problem.path, ...problem.line === null ? {} : { line: problem.line } });
8258
+ const body = {
8259
+ commit: defects[0]?.commit ?? null,
8260
+ defects: defects.map((problem) => ({ id: problem.id, ...problem.reason === "" ? {} : { reason: problem.reason }, refs: problem.path === "" ? [] : [place(problem)] })),
8261
+ dismissed: dismissed.map((problem) => ({ id: problem.id, ...problem.title === "" ? {} : { title: problem.title }, ...place(problem), reason: problem.dismissalReason }))
8262
+ };
8263
+ return `${JSON.stringify(body, null, 2)}
8264
+ `;
8265
+ }
8212
8266
  function mergeAnswers(answers) {
8213
8267
  const items = [];
8214
8268
  const earlier = /* @__PURE__ */ new Set();
@@ -8223,22 +8277,32 @@ function mergeAnswers(answers) {
8223
8277
  }
8224
8278
  const lists = answers.flatMap((answer) => answer.reviewed === void 0 ? [] : [answer.reviewed]);
8225
8279
  const reviewed = lists.length === 0 ? void 0 : [...new Set(lists.flat())];
8280
+ const verdicts = /* @__PURE__ */ new Map();
8281
+ for (const answer of answers) {
8282
+ for (const { id, verdict } of answer.previous ?? []) if (verdicts.get(id) !== "open") verdicts.set(id, verdict);
8283
+ }
8284
+ const previous = answers.some((answer) => answer.previous !== void 0) ? [...verdicts].map(([id, verdict]) => ({ id, verdict })) : void 0;
8226
8285
  const failed = answers.some((answer) => answer.result === "fail") || items.some((entry) => entry.result === "fail");
8227
8286
  const said2 = answers.filter((answer) => answer.result !== void 0);
8228
8287
  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 } };
8288
+ return { ...result === void 0 ? {} : { result }, items, ...reviewed === void 0 ? {} : { reviewed }, ...previous === void 0 ? {} : { previous } };
8230
8289
  }
8231
- function unreviewedItem(changed, reviewed, commit) {
8290
+ function unreviewedFiles(changed, reviewed) {
8232
8291
  if (reviewed === void 0) return void 0;
8233
- const read = new Set(reviewed.map((path) => path.replace(/^\/+/, "").replace(/^outerlayer\/judge\/tree\//, "")));
8292
+ const read = [...new Set(reviewed.map((path) => path.replace(/^\/+/, "").replace(/^outerlayer\/judge\/tree\//, "")))];
8234
8293
  const counted = changed.filter((file) => !file.generated && file.path !== "?");
8235
- const missed = counted.filter((file) => !read.has(file.path));
8236
- if (missed.length === 0) return void 0;
8294
+ const seen = new Set(read);
8295
+ return { read, missed: counted.filter((file) => !seen.has(file.path)).map((file) => file.path), counted: counted.length };
8296
+ }
8297
+ function unreviewedItem(changed, reviewed, commit) {
8298
+ const files = unreviewedFiles(changed, reviewed);
8299
+ if (files === void 0 || files.missed.length === 0) return void 0;
8300
+ const { missed } = files;
8237
8301
  const room = CHECK_ITEM_REASON_MAX_LENGTH - 40;
8238
- let reason = `${missed.length} of ${counted.length} changed files were not reviewed: `;
8302
+ let reason = `${missed.length} of ${files.counted} changed files were not reviewed: `;
8239
8303
  let listed = 0;
8240
- for (const file of missed) {
8241
- const next = `${listed === 0 ? "" : ", "}${file.path}`;
8304
+ for (const path of missed) {
8305
+ const next = `${listed === 0 ? "" : ", "}${path}`;
8242
8306
  if (reason.length + next.length > room) break;
8243
8307
  reason += next;
8244
8308
  listed += 1;
@@ -8247,6 +8311,55 @@ function unreviewedItem(changed, reviewed, commit) {
8247
8311
  return { id: UNREVIEWED_FILES_ITEM_ID, result: "skipped", commit, reason: `${reason}.` };
8248
8312
  }
8249
8313
 
8314
+ // src/runner/code-review-problems.ts
8315
+ var EXCERPT_CONTEXT_LINES = 5;
8316
+ var EXCERPT_LINE_MAX = 300;
8317
+ var PROBLEMS_MAX = CODE_REVIEW_PROBLEMS_MAX;
8318
+ var FILES_MAX = 2e3;
8319
+ var TITLE_MAX = 300;
8320
+ function problemExcerpt(text2, line2) {
8321
+ if (text2 === void 0 || line2 === void 0 || !Number.isInteger(line2) || line2 < 1) return null;
8322
+ const lines = text2.replace(/\u0000/g, "").split(/\r\n|\r|\n/);
8323
+ if (lines.at(-1) === "") lines.pop();
8324
+ if (line2 > lines.length) return null;
8325
+ const startLine = Math.max(1, line2 - EXCERPT_CONTEXT_LINES);
8326
+ const endLine = Math.min(lines.length, line2 + EXCERPT_CONTEXT_LINES);
8327
+ const kept = lines.slice(startLine - 1, endLine).map((raw) => raw.length > EXCERPT_LINE_MAX ? `${raw.slice(0, EXCERPT_LINE_MAX - 1)}\u2026` : raw);
8328
+ return { startLine, text: kept.join("\n") };
8329
+ }
8330
+ function titleOf(title, fallback) {
8331
+ const line2 = (title ?? "").replace(/\s+/g, " ").trim();
8332
+ return (line2 === "" ? fallback : line2).slice(0, TITLE_MAX);
8333
+ }
8334
+ function reviewRecord(input) {
8335
+ const entries = wholeEntries(input.merged);
8336
+ const problems = [];
8337
+ for (const [index, item] of input.items.entries()) {
8338
+ const entry = entries[index];
8339
+ if (entry === void 0 || item.result !== "fail") continue;
8340
+ if (problems.length >= PROBLEMS_MAX) break;
8341
+ const place = item.refs?.[0];
8342
+ problems.push({
8343
+ id: item.id,
8344
+ kind: problemKind(entry.kind),
8345
+ title: titleOf(entry.title, item.id),
8346
+ reason: item.reason ?? "",
8347
+ path: place?.path ?? "",
8348
+ line: place?.line ?? null,
8349
+ inDiff: place?.inDiff === true,
8350
+ excerpt: place === void 0 ? null : input.excerptOf(place.path, place.line),
8351
+ reviewer: entry.reviewer ?? ""
8352
+ });
8353
+ }
8354
+ const files = unreviewedFiles(input.changed, input.merged.reviewed);
8355
+ return {
8356
+ 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 })),
8357
+ files: { read: (files?.read ?? []).slice(0, FILES_MAX), notRead: (files?.missed ?? []).slice(0, FILES_MAX) },
8358
+ problems,
8359
+ verdicts: (input.merged.previous ?? []).slice(0, CODE_REVIEW_PROBLEMS_MAX)
8360
+ };
8361
+ }
8362
+
8250
8363
  // src/runner/code-review-report.ts
8251
8364
  var REPORT_RETRY_WINDOW_MS = 2e4;
8252
8365
  var MAX_REASON_LENGTH = 2e3;
@@ -8268,6 +8381,40 @@ async function reportCodeReview(config, job, report, deps) {
8268
8381
  deps.log.line(`${tag} the code review's report was not sent: ${describeCallFailure(err)}`);
8269
8382
  }
8270
8383
  }
8384
+ var STATUSES = ["open", "with_agent", "fixed", "not_a_problem"];
8385
+ function readStoredProblems(data) {
8386
+ const list = Object(data).problems;
8387
+ if (!Array.isArray(list)) return [];
8388
+ return list.flatMap((entry) => {
8389
+ const row = Object(entry);
8390
+ if (typeof row.id !== "string" || typeof row.status !== "string" || !STATUSES.includes(row.status)) return [];
8391
+ return [
8392
+ {
8393
+ id: row.id,
8394
+ status: row.status,
8395
+ title: typeof row.title === "string" ? row.title : "",
8396
+ reason: typeof row.reason === "string" ? row.reason : "",
8397
+ path: typeof row.path === "string" ? row.path : "",
8398
+ line: typeof row.line === "number" && Number.isInteger(row.line) ? row.line : null,
8399
+ commit: typeof row.commit === "string" ? row.commit : "",
8400
+ dismissalReason: typeof row.dismissalReason === "string" ? row.dismissalReason : null
8401
+ }
8402
+ ];
8403
+ });
8404
+ }
8405
+ async function readCodeReviewProblems(config, job, deps) {
8406
+ const tag = itemTag(job);
8407
+ try {
8408
+ const calls = claimCalls(config, job);
8409
+ const item = claimItem(config, job);
8410
+ const signer = await signerFor(calls.configPath);
8411
+ const page = await getJson(calls.url, `/v1/work-items/${item}/claim/code-review/problems`, calls.apiKey, calls.appId, deps.fetchImpl, signer);
8412
+ return readStoredProblems(page.data);
8413
+ } catch (err) {
8414
+ deps.log.line(`${tag} the stored problems of the code review could not be read: ${describeCallFailure(err)}`);
8415
+ return void 0;
8416
+ }
8417
+ }
8271
8418
 
8272
8419
  // src/runner/judge.ts
8273
8420
  var LIMIT_KEY_TAIL = " (runner.checks.timeLimitMinutes)";
@@ -8593,11 +8740,14 @@ async function runJudge(input) {
8593
8740
  { brief: withAnswerProtocol(territoryBrief(brief, territory), "none", { reviewed: true, answer }), credential, effort: CODE_REVIEW_EFFORT, answer },
8594
8741
  runtime.agents
8595
8742
  );
8743
+ const began = now().getTime();
8744
+ const clock = { seconds: void 0 };
8596
8745
  const settled = environment.run(command, { logPath: join(jobDir, index === 0 ? "judge.log" : `judge-${territory.name}.log`) }).then(
8597
8746
  (result) => result,
8598
8747
  (err) => err instanceof Error ? err : new Error(String(err))
8599
8748
  );
8600
- return { territory, answerName, settled, outcome: void 0 };
8749
+ void settled.then(() => clock.seconds = (now().getTime() - began) / 1e3);
8750
+ return { territory, answerName, settled, clock, began, outcome: void 0 };
8601
8751
  });
8602
8752
  for (const run of started) void run.settled.then((outcome) => run.outcome = outcome);
8603
8753
  const timer = timeoutAfter(limitMinutes * 6e4, deps.sleep);
@@ -8626,7 +8776,7 @@ async function runJudge(input) {
8626
8776
  const outcome = run.outcome;
8627
8777
  if (outcome instanceof Error) log.error(`${tag} the ${run.territory.name} review could not be run: ${describeCallFailure(outcome)}`);
8628
8778
  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] };
8779
+ return { territory: run.territory, reply: readJudgeReply(ran, minutes, runtime.agents), answer: answers[index], seconds: run.clock.seconds ?? (now().getTime() - run.began) / 1e3 };
8630
8780
  })
8631
8781
  };
8632
8782
  };
@@ -8647,7 +8797,8 @@ async function runJudge(input) {
8647
8797
  const issue = issueText(workItem, criteriaOf(workItem));
8648
8798
  if (issue !== void 0) files["issue.md"] = issue;
8649
8799
  try {
8650
- const earlier = previousText(await earlierReview(itemCalls(config, job), workItem, deps.fetchImpl));
8800
+ const stored = await readCodeReviewProblems(config, job, deps);
8801
+ const earlier = stored !== void 0 && stored.length > 0 ? storedProblemsText(stored) : previousText(await earlierReview(itemCalls(config, job), workItem, deps.fetchImpl));
8651
8802
  if (earlier !== void 0) files["previous.json"] = earlier;
8652
8803
  } catch (err) {
8653
8804
  log.line(`${tag} the item's earlier code review could not be read, so the review runs without it: ${describeCallFailure(err)}`);
@@ -8657,11 +8808,12 @@ async function runJudge(input) {
8657
8808
  const reviewed = await reviewSideBySide(files, runs);
8658
8809
  if (!reviewed.ok) return await fail(check, reviewed.reason);
8659
8810
  const answers = [];
8811
+ const byReviewer = (name, from) => ({ ...from, items: from.items.map((entry) => ({ ...entry, reviewer: name })) });
8660
8812
  for (const { territory, reply, answer } of reviewed.runs) {
8661
8813
  if (answer?.ok === true && reply.kind === "none") {
8662
- answers.push({ items: answer.answer.items, ...answer.answer.reviewed === void 0 ? {} : { reviewed: answer.answer.reviewed } });
8814
+ answers.push(byReviewer(territory.name, { items: answer.answer.items, ...answer.answer.reviewed === void 0 ? {} : { reviewed: answer.answer.reviewed } }));
8663
8815
  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);
8816
+ } else if (answer?.ok === true) answers.push(byReviewer(territory.name, answer.answer));
8665
8817
  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
8818
  }
8667
8819
  const first = reviewed.runs[0];
@@ -8669,7 +8821,21 @@ async function runJudge(input) {
8669
8821
  const merged = mergeAnswers(answers);
8670
8822
  const items2 = wholeItems({ answer: merged, commit: head, treeRoot: JUDGE_TREE, place, ownTree, patch: diff, clean: cleanReason });
8671
8823
  const unreviewed = unreviewedItem(changed, merged.reviewed, head);
8672
- return await finishWhole(check, { reply: first.reply, answer: { ok: true, answer: merged }, items: unreviewed === void 0 ? items2 : [...items2, unreviewed], report: void 0, head, branch });
8824
+ const review = reviewRecord({
8825
+ merged,
8826
+ items: items2,
8827
+ changed,
8828
+ runs: reviewed.runs.map((run) => ({
8829
+ name: run.territory.name,
8830
+ ...run.reply.usage?.turns === void 0 ? {} : { turns: run.reply.usage.turns },
8831
+ seconds: run.reply.usage?.durationMs === void 0 ? run.seconds : run.reply.usage.durationMs / 1e3,
8832
+ ...run.reply.usage?.costUsd === void 0 ? {} : { costUsd: run.reply.usage.costUsd },
8833
+ // A reviewer that stopped early or wrote no answer proves nothing about a problem that it did not report.
8834
+ answered: run.answer?.ok === true && run.reply.kind === "answered"
8835
+ })),
8836
+ excerptOf: (path, line2) => problemExcerpt(treeFileText(branchDir, path), line2)
8837
+ });
8838
+ 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
8839
  }
8674
8840
  if (criteria === void 0) {
8675
8841
  let ran;
@@ -8740,7 +8906,7 @@ async function runJudge(input) {
8740
8906
  await record(check.name, result, reason, { keyTail: at.limitKey === true ? LIMIT_KEY_TAIL : "", link, items: sendable(items) });
8741
8907
  }
8742
8908
  async function finishWhole(check, at) {
8743
- const where = { head: at.head, branch: at.branch };
8909
+ const where = { head: at.head, branch: at.branch, review: at.review };
8744
8910
  if (at.answer?.ok === true) {
8745
8911
  const answered = at.items ?? [];
8746
8912
  const failing = itemsSentence(answered, { one: "check item", many: "check items" });
@@ -8771,7 +8937,7 @@ async function runJudge(input) {
8771
8937
  await reportReview(check, { result: "failed", reason: "review_not_run", runnerReason: oneLineReason(cleanReason(at.reason ?? "")) ?? "the judge did not run" });
8772
8938
  } else {
8773
8939
  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 });
8940
+ 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
8941
  }
8776
8942
  }
8777
8943
  function sendable(items) {
@@ -9385,6 +9551,7 @@ async function finishJob(job, jobDirPath, outcome, config, deps, ending) {
9385
9551
  const logPath = join(jobDirPath, "command.log");
9386
9552
  const tag = `${itemTag(job)}`;
9387
9553
  const isRun = job.queue === "run";
9554
+ const noJudgement = isRun || job.queue === "revise";
9388
9555
  deps.attemptLogs?.open(job.item, jobDirPath, itemScope(job));
9389
9556
  const valuesNotHeld = (job.managedVariables?.length ?? 0) > 0 && managedBuildSettingsFor(jobDirPath) === void 0;
9390
9557
  await stopSender({ job, jobDir: jobDirPath, deps: { spawnFn, runtime: deps.container, log } });
@@ -9515,7 +9682,7 @@ async function finishJob(job, jobDirPath, outcome, config, deps, ending) {
9515
9682
  log.error(`${tag} removing an earlier attempt's check environment failed: ${describeCallFailure(err)} \xB7 continuing`);
9516
9683
  }
9517
9684
  }
9518
- if (outcome === "ok" && !isRun && !job.cleanupRan && job.proofsRan !== true && !valuesNotHeld && job.workdir !== void 0 && job.itemKey !== void 0 && await declaresRecordedProof(itemCalls(config, job), job.item, deps.fetchImpl)) {
9685
+ 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
9686
  setStage(job, jobDirPath, "proofs");
9520
9687
  job.proofsRan = true;
9521
9688
  writeJobFile(jobFilePath, job);
@@ -9536,11 +9703,11 @@ async function finishJob(job, jobDirPath, outcome, config, deps, ending) {
9536
9703
  log.error(`${tag} the host's proof recording stopped: ${describeCallFailure(err)} \xB7 continuing`);
9537
9704
  }
9538
9705
  }
9539
- if (valuesNotHeld && outcome === "ok" && !isRun && !job.cleanupRan) {
9706
+ if (valuesNotHeld && outcome === "ok" && !noJudgement && !job.cleanupRan) {
9540
9707
  log.error(`${tag} the host's judge and checks skipped: ${VALUES_NOT_HELD}`);
9541
9708
  await reportCodeReview(config, job, { result: "skipped", reason: "variables_lost" }, { fetchImpl: deps.fetchImpl, log, now: deps.now, sleep: deps.sleep });
9542
9709
  }
9543
- if (outcome === "ok" && !isRun && !job.cleanupRan && job.judgeRan !== true && !valuesNotHeld) {
9710
+ if (outcome === "ok" && !noJudgement && !job.cleanupRan && job.judgeRan !== true && !valuesNotHeld) {
9544
9711
  setStage(job, jobDirPath, "judge");
9545
9712
  job.judgeRan = true;
9546
9713
  writeJobFile(jobFilePath, job);
@@ -9555,7 +9722,7 @@ async function finishJob(job, jobDirPath, outcome, config, deps, ending) {
9555
9722
  log.error(`${tag} the host's judge stopped: ${describeCallFailure(err)} \xB7 continuing`);
9556
9723
  }
9557
9724
  }
9558
- if (outcome === "ok" && !isRun && !job.cleanupRan && job.checksRan !== true && !valuesNotHeld) {
9725
+ if (outcome === "ok" && !noJudgement && !job.cleanupRan && job.checksRan !== true && !valuesNotHeld) {
9559
9726
  setStage(job, jobDirPath, "checks");
9560
9727
  job.checksRan = true;
9561
9728
  writeJobFile(jobFilePath, job);
@@ -9628,6 +9795,7 @@ async function finishJob(job, jobDirPath, outcome, config, deps, ending) {
9628
9795
  tunnelRecord = sandboxBuild.runtime.tunnels.get(sandboxBuild.state.buildId)?.record();
9629
9796
  try {
9630
9797
  const sandboxRuntime = sandboxBuild.runtime;
9798
+ await copySandboxHookErrors(sandboxRuntime, sandboxBuild.state, jobDirPath);
9631
9799
  const kept = await cleanupSandbox(
9632
9800
  sandboxRuntime,
9633
9801
  sandboxBuild.state,
@@ -9693,7 +9861,7 @@ async function finishJob(job, jobDirPath, outcome, config, deps, ending) {
9693
9861
  writeJobFile(jobFilePath, job);
9694
9862
  }
9695
9863
  let verdictReason;
9696
- if (outcome === "ok" && !isRun) {
9864
+ if (outcome === "ok" && !noJudgement) {
9697
9865
  const decision = await settleVerdict({
9698
9866
  read: () => readItemEvaluation(itemCalls(config, job), job.item, deps.fetchImpl, job.claimId),
9699
9867
  now,
@@ -11701,16 +11869,19 @@ function createGitRemote(options) {
11701
11869
  if (bodyPath !== void 0) rmSync(bodyPath, { force: true });
11702
11870
  }
11703
11871
  }
11872
+ const readOnly = options.readOnly === true || options.readOnly === "revise";
11873
+ const readOnlyActor = options.readOnly === "revise" ? "a spec revision" : "a check";
11704
11874
  async function handle(req, res) {
11705
11875
  const route = classifyRequest(req.method ?? "", req.url ?? "");
11706
11876
  if (route === void 0) {
11707
11877
  req.resume();
11708
11878
  return plain2(res, 404, "not found\n");
11709
11879
  }
11710
- if (options.readOnly === true && (route.kind === "receive-pack" || route.kind === "info-refs" && route.service === "git-receive-pack")) {
11880
+ if (readOnly && (route.kind === "receive-pack" || route.kind === "info-refs" && route.service === "git-receive-pack")) {
11711
11881
  log(`push refused: this remote is read-only`);
11712
11882
  req.resume();
11713
- return plain2(res, 403, "this remote is read-only: a check cannot push\n");
11883
+ return plain2(res, 403, `this remote is read-only: ${readOnlyActor} cannot push
11884
+ `);
11714
11885
  }
11715
11886
  const target2 = claimed.find((entry) => isOwnRepository(entry.repository, route.owner, route.name));
11716
11887
  const pushing = route.kind === "receive-pack" || route.kind === "info-refs" && route.service === "git-receive-pack";
@@ -11727,7 +11898,8 @@ function createGitRemote(options) {
11727
11898
  body = await readBody(req, maxLfsBodyBytes);
11728
11899
  if (body === void 0) return plain2(res, 413, "the request is too large\n");
11729
11900
  kind = isLfsUpload(body) ? "push" : "read";
11730
- if (options.readOnly === true && kind === "push") return plain2(res, 403, "this remote is read-only: a check cannot upload\n");
11901
+ if (readOnly && kind === "push") return plain2(res, 403, `this remote is read-only: ${readOnlyActor} cannot upload
11902
+ `);
11731
11903
  }
11732
11904
  let authorization;
11733
11905
  if (target2 !== void 0) {
@@ -11997,7 +12169,8 @@ function gitRemoteFor(runtime, input) {
11997
12169
  return createGitRemote({
11998
12170
  repositories: input.repositories.map((entry) => {
11999
12171
  const [owner = "", name = ""] = entry.repository.split("/");
12000
- return { repository: entry.repository, branch: entry.branch, mirrorDir: mirrorDir(runnerDirPath, owner, name) };
12172
+ 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`);
12173
+ return { repository: entry.repository, branch: entry.branch ?? "", mirrorDir: mirrorDir(runnerDirPath, owner, name) };
12001
12174
  }),
12002
12175
  tokens: input.tokens,
12003
12176
  gitUrl: runtime.github.gitUrl,
@@ -12006,7 +12179,7 @@ function gitRemoteFor(runtime, input) {
12006
12179
  input.tokens.reason = WORKFLOW_PERMISSION_REASON;
12007
12180
  },
12008
12181
  log: input.log,
12009
- ...input.readOnly === true ? { readOnly: true } : {}
12182
+ ...input.readOnly === void 0 ? {} : { readOnly: input.readOnly }
12010
12183
  });
12011
12184
  }
12012
12185
  var NO_ENV2 = { literals: {}, passed: {} };
@@ -12294,7 +12467,7 @@ async function provisionContainerOnce(input, allowRestore, itemDiskFailed) {
12294
12467
  environment.credentials = tokens.used();
12295
12468
  let services;
12296
12469
  try {
12297
- const gitRemote = gitRemoteFor(runtime, { repositories, tokens, buildDir: buildDir2, log: (line2) => log.line(`${tag} ${line2}`), ...input.queue === "run" ? { readOnly: true } : {} });
12470
+ const gitRemote = gitRemoteFor(runtime, { repositories, tokens, buildDir: buildDir2, log: (line2) => log.line(`${tag} ${line2}`), ...readOnlyOption(input.queue) });
12298
12471
  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
12472
  runtime.tunnels.set(buildId, services);
12300
12473
  } catch (err) {
@@ -12610,7 +12783,7 @@ async function ensureTunnel(runtime, state, jobDir, config, itemKey, branch, rep
12610
12783
  }
12611
12784
  const tokens = runtime.credentials.get(jobDir);
12612
12785
  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 === true ? { readOnly: true } : {} });
12786
+ const gitRemote = tokens === void 0 || served.length === 0 ? void 0 : gitRemoteFor(runtime, { repositories: served, tokens, buildDir: state.buildDir, ...readOnly === void 0 ? {} : { readOnly } });
12614
12787
  const lease = transport === "exec" && leaseExpiryMs !== void 0 ? leaseFor(runtime, state.buildId, leaseExpiryMs) : void 0;
12615
12788
  if (state.stopped === true) lease?.stop();
12616
12789
  const services = await startServicesFor(runtime, config, state.buildDir, jobDir, itemKey, state.builtIns === true, gitRemote, transport === "exec" ? "stream" : "socket", lease);
@@ -12636,7 +12809,7 @@ async function runCliInContainer(input, argv, logName) {
12636
12809
  const { runtime, job } = input;
12637
12810
  const state = job.container;
12638
12811
  try {
12639
- await ensureTunnel(runtime, state, input.jobDir, configForJob(input.config, job), job.itemKey, job.branch, job.repositories, input.log, () => leaseExpiresAtMs(job), job.queue === "run");
12812
+ await ensureTunnel(runtime, state, input.jobDir, configForJob(input.config, job), job.itemKey, job.branch, job.repositories, input.log, () => leaseExpiresAtMs(job), readOnlyRemoteOf(job.queue));
12640
12813
  if (state.stopped) {
12641
12814
  const network = await ensureNetworkReady(runtime, state);
12642
12815
  if (network !== void 0) return { ok: false, reason: network };
@@ -12730,7 +12903,7 @@ async function restoreSessionIntoContainer(runtime, state, keptDir, meta, job) {
12730
12903
  const restored = await restoreSession({ guest: sessionGuestOfContainer(runtime, state), tar: packKeptSession(keptDir, meta, runtime.agents, job) });
12731
12904
  if (!restored.ok) throw new Error(restored.reason);
12732
12905
  }
12733
- var HOOK_ERRORS_IN_CONTAINER = "/build/home/.outerlayer/spool/hook-errors.log";
12906
+ var HOOK_ERRORS_IN_CONTAINER2 = "/build/home/.outerlayer/spool/hook-errors.log";
12734
12907
  async function copyHookErrors2(runtime, state, jobDir) {
12735
12908
  try {
12736
12909
  if (state.stopped) {
@@ -12738,7 +12911,7 @@ async function copyHookErrors2(runtime, state, jobDir) {
12738
12911
  const started = await runtime.host.start(state.container);
12739
12912
  if (started.status !== 0) return;
12740
12913
  }
12741
- const log = await runtime.host.exec({ container: state.container, user: state.agentUser ?? ADDED_USER, env: NO_ENV2, argv: ["cat", HOOK_ERRORS_IN_CONTAINER] });
12914
+ const log = await runtime.host.exec({ container: state.container, user: state.agentUser ?? ADDED_USER, env: NO_ENV2, argv: ["cat", HOOK_ERRORS_IN_CONTAINER2] });
12742
12915
  if (log.status === 0 && log.stdout !== "") writeFileSync(join(jobDir, "hook-errors.log"), log.stdout);
12743
12916
  } catch {
12744
12917
  }
@@ -12797,7 +12970,7 @@ function containerJudgeEnvironment(input) {
12797
12970
  };
12798
12971
  return {
12799
12972
  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 === "run");
12973
+ 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
12974
  await stopContainer(runtime, state);
12802
12975
  const network = await ensureNetworkReady(runtime, state);
12803
12976
  if (network !== void 0) throw new Error(network);
@@ -13249,6 +13422,8 @@ async function runHostChecks(input) {
13249
13422
  const unpushed = [];
13250
13423
  let primaryHead;
13251
13424
  for (const entry of claimed) {
13425
+ const branch = entry.branch;
13426
+ if (branch === void 0) continue;
13252
13427
  let entryToken = readToken;
13253
13428
  if (!entry.primary) {
13254
13429
  try {
@@ -13257,17 +13432,17 @@ async function runHostChecks(input) {
13257
13432
  return await failAll(`no read token for ${entry.repository}: ${describeCallFailure(err)}`);
13258
13433
  }
13259
13434
  }
13260
- const read = await (deps.readBranch ?? readBranchHead)({ remote: remoteOf(entry.repository), dir: scratch, branch: entry.branch, token: entryToken });
13261
- if (read.kind === "unreadable") return await failAll(`the branch ${entry.branch} could not be read${entry.primary ? "" : ` on ${entry.repository}`}: ${read.reason}`);
13435
+ const read = await (deps.readBranch ?? readBranchHead)({ remote: remoteOf(entry.repository), dir: scratch, branch, token: entryToken });
13436
+ if (read.kind === "unreadable") return await failAll(`the branch ${branch} could not be read${entry.primary ? "" : ` on ${entry.repository}`}: ${read.reason}`);
13262
13437
  if (read.kind === "absent") {
13263
13438
  unpushed.push(entry);
13264
13439
  continue;
13265
13440
  }
13266
- pushed.set(entry.repository, entry.branch);
13441
+ pushed.set(entry.repository, branch);
13267
13442
  if (entry.primary) primaryHead = read.sha;
13268
13443
  }
13269
13444
  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("; ")}`);
13445
+ return await failAll(`the build pushed no branch: ${unpushed.map((entry) => `${entry.branch ?? "its branch"} does not exist on ${entry.repository}`).join("; ")}`);
13271
13446
  }
13272
13447
  const repositoriesToCheckOut = claimed;
13273
13448
  const limitMinutes = config.checks?.timeLimitMinutes ?? DEFAULT_CHECK_TIME_LIMIT_MINUTES;