@outerlayer/cli 0.40.0-next.20261117022943 → 0.40.0-next.20261117034333
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-setup-UU3NQZ3A.js +41 -0
- package/dist/{agent-subcommand-JGANAEB4.js → agent-subcommand-MW4TF4SG.js} +4 -4
- package/dist/{artifact-link-cmd-K6VFGMIO.js → artifact-link-cmd-XUHNVFVU.js} +2 -2
- package/dist/{bridge-YHCQBKZC.js → bridge-WEK2IMAD.js} +7 -7
- package/dist/{build-SSIBPHPA.js → build-LJSUCORB.js} +13 -13
- package/dist/{build-disk-KI2JOKAK.js → build-disk-S2XHWSDH.js} +11 -11
- package/dist/build-info.json +1 -1
- package/dist/{builder-I562HT2D.js → builder-TCRJKB2W.js} +10 -10
- package/dist/caller-VJBDXZXG.js +23 -0
- package/dist/{check-YDBHBTOS.js → check-Z6GAY2C4.js} +58 -61
- package/dist/{chunk-SBSH253O.js → chunk-2QFZBWBP.js} +1 -1
- package/dist/{chunk-UMFSHU72.js → chunk-33DTLCL6.js} +2 -2
- package/dist/{chunk-6RJBLCPV.js → chunk-33RKRHJG.js} +1 -1
- package/dist/{chunk-YI2HDVUL.js → chunk-3ETI7MKK.js} +4 -4
- package/dist/{chunk-PEN7Y4PB.js → chunk-3PXV4I75.js} +3 -3
- package/dist/{chunk-UXAB2OEM.js → chunk-4FTRLX6A.js} +5 -5
- package/dist/{chunk-CEHT2FCU.js → chunk-5EWESACE.js} +2 -2
- package/dist/{chunk-XAOZFBXK.js → chunk-5O7P6VXS.js} +1 -1
- package/dist/{chunk-DHB3M244.js → chunk-6GJMRVMX.js} +1 -1
- package/dist/{chunk-QI6YUQWR.js → chunk-6NODVJGM.js} +3 -3
- package/dist/{chunk-VJCILU3C.js → chunk-6QXGAGQY.js} +1 -1
- package/dist/{chunk-MCJRTOAL.js → chunk-6ZBUQIJA.js} +1 -1
- package/dist/{chunk-NB2BDENG.js → chunk-7PIUTUXI.js} +3 -3
- package/dist/{chunk-OF6XMZHO.js → chunk-7QIQ7QR3.js} +1 -1
- package/dist/{chunk-J4F4V3G2.js → chunk-ABXHYH2Y.js} +6 -6
- package/dist/{chunk-G3HBBHIK.js → chunk-ABY722KN.js} +1 -1
- package/dist/{chunk-JSN2DMPB.js → chunk-AGKUDDIN.js} +1 -1
- package/dist/{chunk-UELSHBQH.js → chunk-AH2BO6Q6.js} +6 -6
- package/dist/{chunk-6DO34552.js → chunk-BEK2BZAI.js} +6 -6
- package/dist/{chunk-3WMULGB4.js → chunk-BZFRU6M7.js} +8 -8
- package/dist/{chunk-MCUI6RHU.js → chunk-CH3PO7UY.js} +10 -2
- package/dist/{chunk-PC2FA62W.js → chunk-CNMC4OXO.js} +7 -7
- package/dist/{chunk-AL6CJD2X.js → chunk-CW6H5JXV.js} +8 -8
- package/dist/{chunk-C6EPHJIV.js → chunk-D2QNQOFX.js} +1 -1
- package/dist/{chunk-3YMOSZRN.js → chunk-D3CALDGC.js} +1 -1
- package/dist/{chunk-HQPB4ZMS.js → chunk-EBWA6KIE.js} +1 -1
- package/dist/{chunk-DQV2XTBD.js → chunk-EU6JHHES.js} +368 -245
- package/dist/{chunk-D5JM2VPO.js → chunk-F4PRZBBJ.js} +2 -2
- package/dist/{chunk-CFIYOLCT.js → chunk-F6J3ACXH.js} +6 -6
- package/dist/{chunk-DV44KCM6.js → chunk-FG2E3HES.js} +1 -1
- package/dist/{chunk-XDWJOYC4.js → chunk-FLHDVJAV.js} +5 -5
- package/dist/{chunk-P2I6YVJV.js → chunk-GBLNHZ3E.js} +4 -4
- package/dist/{chunk-QVTGSGQ5.js → chunk-GQI5N56J.js} +2 -2
- package/dist/{chunk-JE23PLDE.js → chunk-H2THCHUP.js} +1 -1
- package/dist/{chunk-732WJDYG.js → chunk-H4JQKCVP.js} +9 -9
- package/dist/{chunk-UNGZ25QF.js → chunk-H6L6SWMN.js} +2 -2
- package/dist/{chunk-TWUEZPWP.js → chunk-HI6R4XYD.js} +2 -2
- package/dist/{chunk-6P23FS2Z.js → chunk-HSGZ4JEV.js} +1 -1
- package/dist/{chunk-UAOLY4EP.js → chunk-I7ZQKMKG.js} +1 -1
- package/dist/{chunk-JBGASRRE.js → chunk-IQYAPM4S.js} +7 -7
- package/dist/{chunk-ONDONSBT.js → chunk-K6THWLSJ.js} +1 -1
- package/dist/{chunk-DMWGWD26.js → chunk-KCLFDN26.js} +3 -3
- package/dist/{chunk-OY4EJVUH.js → chunk-KDVQGQXM.js} +1 -1
- package/dist/{chunk-IEDCYMPH.js → chunk-LYHR47YE.js} +2 -2
- package/dist/{chunk-MJGBRYDH.js → chunk-MBOQJTOS.js} +11 -6
- package/dist/{chunk-TL5HRSMD.js → chunk-MEZVLRJK.js} +19 -77
- package/dist/{chunk-DSUD4K5N.js → chunk-MG2Y5XYV.js} +267 -211
- package/dist/{chunk-DG7525WL.js → chunk-NWWED36F.js} +1 -1
- package/dist/{chunk-DUQIP32K.js → chunk-P7OXJ3ZD.js} +5 -5
- package/dist/{chunk-XLU5ZOTK.js → chunk-PB4QDL6Q.js} +4 -4
- package/dist/{chunk-YUR7GV5L.js → chunk-PHC24VUU.js} +5 -5
- package/dist/{chunk-YSHMGQRD.js → chunk-PZZS6DHY.js} +8 -8
- package/dist/{chunk-PWHKJ24U.js → chunk-QJI56HI2.js} +7 -7
- package/dist/{chunk-7H5JQFWQ.js → chunk-RUSF2YGL.js} +6 -6
- package/dist/{chunk-CWJ26A6W.js → chunk-S4CX66JO.js} +1 -1
- package/dist/{chunk-H7EBNQGW.js → chunk-SK4BESZM.js} +1 -1
- package/dist/{chunk-NE5PE3Q7.js → chunk-TTBG7YZW.js} +7 -7
- package/dist/{chunk-FKC5D6CA.js → chunk-TZNIDZGI.js} +1 -1
- package/dist/{chunk-Q6MCI3BQ.js → chunk-UAZBE4O3.js} +10 -10
- package/dist/{chunk-DLYCHCKQ.js → chunk-UE42G3QY.js} +1 -1
- package/dist/{chunk-GOJ2SPKB.js → chunk-UFGV3JZ5.js} +1 -1
- package/dist/{chunk-2EJED3QQ.js → chunk-UN7RXMOB.js} +4 -4
- package/dist/{chunk-BBJC4R6E.js → chunk-UUVURKWB.js} +4 -4
- package/dist/{chunk-UQWBHNTZ.js → chunk-V6UDJVVD.js} +3 -3
- package/dist/{chunk-SCI6U7CV.js → chunk-V77IQKWK.js} +19 -19
- package/dist/{chunk-BCBZHDMW.js → chunk-VG6FUXGK.js} +1 -1
- package/dist/{chunk-BB73O6OW.js → chunk-WEPLWKV6.js} +3 -3
- package/dist/{chunk-6367NG5G.js → chunk-WZ6K327V.js} +7 -7
- package/dist/{chunk-IOUBTUS2.js → chunk-X6BGCNE3.js} +8 -8
- package/dist/{chunk-RO5YUUN2.js → chunk-XT6LWXJ2.js} +1 -1
- package/dist/{chunk-4FUTEM37.js → chunk-YICV7DAE.js} +3 -3
- package/dist/{chunk-45JV3EMA.js → chunk-ZASDJ7F5.js} +6 -8
- package/dist/{chunk-YNNTU5IZ.js → chunk-ZIN6G7DS.js} +1 -1
- package/dist/{chunk-O2324X34.js → chunk-ZQTMWBLA.js} +1 -1
- package/dist/{chunk-77JLN6GC.js → chunk-ZYIVNB6B.js} +7 -8
- package/dist/{claude-launcher-TWKHBR6F.js → claude-launcher-HWC5S5HD.js} +7 -7
- package/dist/{cli-SSHQSIPV.js → cli-TWF7CU3E.js} +168 -168
- package/dist/{command-W6BEIPAJ.js → command-KGYVPB7B.js} +52 -52
- package/dist/{config-HYSU7MD3.js → config-J4VSNOH4.js} +12 -12
- package/dist/{connect-cmd-O4ATJTQV.js → connect-cmd-LPC6J27D.js} +13 -13
- package/dist/{container-start-4KRTW3QU.js → container-start-O6BAIQGT.js} +49 -49
- package/dist/{context-cleanup-SK445SLA.js → context-cleanup-VWJSWUJB.js} +4 -4
- package/dist/{context-show-cmd-D3GXL65K.js → context-show-cmd-B427F3M4.js} +14 -14
- package/dist/{control-plane-launch-KVROM6BY.js → control-plane-launch-WV253P7I.js} +14 -14
- package/dist/{demo-record-cmd-UMHWHDZ4.js → demo-record-cmd-YRND2HVT.js} +8 -8
- package/dist/{demo-voice-cmd-GBI52Y73.js → demo-voice-cmd-TUIXJ7CY.js} +20 -20
- package/dist/{dist-775TDFCK.js → dist-UV2JOW3N.js} +2 -2
- package/dist/{docker-B76MDGCW.js → docker-6NO5B657.js} +10 -10
- package/dist/{doctor-QV3BJKRZ.js → doctor-V3Z5CR5Q.js} +60 -65
- package/dist/{emit-artifact-cmd-X4AKVBS2.js → emit-artifact-cmd-MWDEBRB2.js} +19 -19
- package/dist/{emit-cmd-A6ZGOPLZ.js → emit-cmd-2ADJWBJP.js} +7 -7
- package/dist/{emit-criteria-cmd-UKZBMIK6.js → emit-criteria-cmd-35O7KR37.js} +16 -16
- package/dist/{emit-demo-cmd-QC56Y6P2.js → emit-demo-cmd-HJCW3JEA.js} +20 -20
- package/dist/{emit-finding-cmd-DL2Y7BEV.js → emit-finding-cmd-Q4SN3OA7.js} +16 -16
- package/dist/{emit-result-cmd-VPWAJBN6.js → emit-result-cmd-7VEMDT2P.js} +18 -18
- package/dist/{emit-step-cmd-REP4IS3F.js → emit-step-cmd-DYQM5OQA.js} +16 -16
- package/dist/{exec-client-KBOKVUU5.js → exec-client-6WGSNY56.js} +8 -8
- package/dist/{chunk-6TF4QU7M.js → find-unit-6BX4K4WV.js} +19 -2
- package/dist/{findings-cmd-BXAXOQB6.js → findings-cmd-WHQBJZNA.js} +16 -16
- package/dist/{fleet-readiness-EDJDDAEB.js → fleet-readiness-A67D5OP4.js} +14 -14
- package/dist/{governing-source-AG7KDIIG.js → governing-source-C4BMFNFZ.js} +21 -21
- package/dist/{guest-init-DUOJUQFY.js → guest-init-ZWEJGXQS.js} +9 -9
- package/dist/{hook-fast-ZVZWP7OQ.js → hook-fast-SZ5L3ZJK.js} +1 -1
- package/dist/{hook-install-VF3X2ZXN.js → hook-install-63GJ3OUI.js} +4 -4
- package/dist/host-checks-SYD7WFUN.js +82 -0
- package/dist/host-key-AYXCAME4.js +18 -0
- package/dist/{image-tag-BTK5342G.js → image-tag-6HQDPX45.js} +8 -8
- package/dist/index.js +4 -4
- package/dist/{init-OZ4JNNOI.js → init-KOG5S5KX.js} +47 -47
- package/dist/init-ULMPF7MK.js +82 -0
- package/dist/{init-agent-GNX5OIZX.js → init-agent-XIDQULDZ.js} +47 -47
- package/dist/init-cmd-P7FYHTLS.js +53 -0
- package/dist/{init-update-ZJSTM46T.js → init-update-7SBDG65Z.js} +24 -24
- package/dist/install-cmd-TWYZTNRV.js +26 -0
- package/dist/launch-agent-5MCXT6QN.js +26 -0
- package/dist/{layout-BG6MFUS3.js → layout-2MIQCJ3U.js} +4 -4
- package/dist/{login-browser-OA4R4PEQ.js → login-browser-ZYWUIEOQ.js} +2 -2
- package/dist/{logs-L5GX5BWF.js → logs-SP6RPVCP.js} +7 -7
- package/dist/loop-OU2U7SUJ.js +92 -0
- package/dist/machine-NE34TJIO.js +82 -0
- package/dist/{machine-skills-B7KO47CH.js → machine-skills-UYWZXOZI.js} +4 -4
- package/dist/{mcp-install-cmd-JXD6Q7NN.js → mcp-install-cmd-U2SEWH66.js} +4 -4
- package/dist/{mcp-serve-cmd-3B3KWYHN.js → mcp-serve-cmd-VAQL3CJB.js} +9 -9
- package/dist/{paths-26SZBIOA.js → paths-G7LFPGQQ.js} +7 -7
- package/dist/pending-OEAYMKZO.js +18 -0
- package/dist/{pidfile-22HCQHLJ.js → pidfile-FIVR2HKB.js} +8 -8
- package/dist/{record-HFUJLNOV.js → record-K3I7V46A.js} +8 -8
- package/dist/{relay-V5GHEWT3.js → relay-AQBBQJ5I.js} +5 -5
- package/dist/{relay-protocol-2S2EAHYH.js → relay-protocol-XZ7WESQL.js} +5 -5
- package/dist/{run-cmd-G4LA2YZR.js → run-cmd-BRUSQKEA.js} +16 -16
- package/dist/{runner-agents-CLDURIBZ.js → runner-agents-KF6EECFW.js} +4 -4
- package/dist/runner-env-XAO7EBCK.js +24 -0
- package/dist/{runner-identity-V4IUTSCJ.js → runner-identity-JM3ZQ2PJ.js} +10 -10
- package/dist/{runner-key-FQDBMYII.js → runner-key-P6FUFO6Y.js} +47 -47
- package/dist/{session-sender-AAQXJLNE.js → session-sender-N3U3ZTL3.js} +19 -19
- package/dist/{setup-cmd-4CKPSEJD.js → setup-cmd-F7Y4SFTK.js} +14 -14
- package/dist/{setup-wiring-INA66DBJ.js → setup-wiring-LU6AY2QA.js} +54 -54
- package/dist/{spec-cmd-V2FPAZJ7.js → spec-cmd-ZNXNMAYA.js} +17 -17
- package/dist/{starter-pack-WOD4WMUX.js → starter-pack-NEQLRMTX.js} +5 -5
- package/dist/state-VXN7EX2K.js +18 -0
- package/dist/{status-MC2SJQ57.js → status-N326EK5I.js} +47 -47
- package/dist/{sync-cmd-2TLRGEXR.js → sync-cmd-KG7YQGM6.js} +18 -18
- package/dist/update-steps-YQQXESUZ.js +83 -0
- package/dist/{watch-GQAIYCFW.js → watch-3VJ363V2.js} +18 -18
- package/dist/{work-claim-cmd-SI3UTDLB.js → work-claim-cmd-MXWB5NG6.js} +23 -23
- package/dist/{work-cmd-LA5ZBMBQ.js → work-cmd-X55AAJG2.js} +16 -16
- package/dist/{work-comment-cmd-NP6USSKX.js → work-comment-cmd-7AL5KEVJ.js} +18 -18
- package/dist/{work-demo-cmd-KZDTXCYM.js → work-demo-cmd-6UFGGEMI.js} +16 -16
- package/dist/{work-logs-cmd-3BX5MK2E.js → work-logs-cmd-DCAV3J7A.js} +16 -16
- package/dist/{work-mock-cmd-IT3IKALB.js → work-mock-cmd-O7KFTS65.js} +16 -16
- package/dist/{work-needs-attention-cmd-BDIFC7I4.js → work-needs-attention-cmd-OD5PTHLX.js} +16 -16
- package/dist/{work-no-change-cmd-A65QOBQ2.js → work-no-change-cmd-ABYXIOZT.js} +16 -16
- package/dist/{work-open-pr-cmd-CGSCDYHI.js → work-open-pr-cmd-WRFHZXVM.js} +17 -17
- package/dist/{work-pr-cmd-DZKJLYLF.js → work-pr-cmd-VEH4HP7P.js} +16 -16
- package/dist/{work-proofs-cmd-OJXWHUMP.js → work-proofs-cmd-TKA3J2II.js} +18 -18
- package/dist/{work-proofs-record-J6WOOW3R.js → work-proofs-record-WTBSJLET.js} +24 -24
- package/dist/{work-stop-cmd-RJESQDZN.js → work-stop-cmd-WF7R6ILK.js} +16 -16
- package/package.json +1 -1
- package/skill-pack/maintained/outerlayer-review/SKILL.md +5 -2
- package/skill-pack/maintained/outerlayer-review/references/consolidation.md +80 -0
- package/dist/agent-setup-5UMGRTAY.js +0 -41
- package/dist/caller-VTVQPOGC.js +0 -23
- package/dist/find-unit-5PUEPP5J.js +0 -24
- package/dist/host-checks-AS2C5HR2.js +0 -82
- package/dist/host-key-MNYYPKBU.js +0 -18
- package/dist/init-H2GOMKCC.js +0 -82
- package/dist/init-cmd-CM7UKGRG.js +0 -53
- package/dist/install-cmd-U4PP4YQE.js +0 -26
- package/dist/launch-agent-BIAPDAVB.js +0 -26
- package/dist/loop-3F3PNYOH.js +0 -92
- package/dist/machine-CCB2PQIM.js +0 -82
- package/dist/pending-Y62PXWTU.js +0 -18
- package/dist/runner-env-RQ3SKLKL.js +0 -24
- package/dist/state-PSFO26DS.js +0 -18
- package/dist/update-steps-JZE3OGKB.js +0 -83
|
@@ -1,73 +1,52 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { readHousekeepingRecord, writeHousekeepingRecord } from './chunk-
|
|
3
|
+
import { readHousekeepingRecord, writeHousekeepingRecord } from './chunk-TZNIDZGI.js';
|
|
4
4
|
import { fetchVersionMeta, npmVersion, npmSupportsProvenance, fetchTarballDigest, fetchProvenance, installVersion, auditSignatures } from './chunk-E7R2GIAW.js';
|
|
5
|
-
import { reportFailedStart, fitImageBuildMemory } from './chunk-
|
|
6
|
-
import { renderUpdateSteps } from './chunk-
|
|
5
|
+
import { reportFailedStart, fitImageBuildMemory } from './chunk-QJI56HI2.js';
|
|
6
|
+
import { renderUpdateSteps } from './chunk-7PIUTUXI.js';
|
|
7
7
|
import { decideInstalledSwitch } from './chunk-TXKHD4Q6.js';
|
|
8
|
-
import { writeFleetState } from './chunk-
|
|
9
|
-
import { writePendingUpdate } from './chunk-
|
|
10
|
-
import { fleetConfigProblem, realBlockedProbes,
|
|
11
|
-
import { writeMarker, readMarker, currentVersion, removeMarker, isInLayout, startedThroughCurrent, entryIn, versionDir, switchCurrent, cleanVersions, stagingDir } from './chunk-
|
|
12
|
-
import { leaseTimeLeftMs, createContainerRuntime, heldSandboxClaimsOf, unfinishedJobs, withTunnelLog, itemTag, releaseLease, runDecision, claimRun, LEASE_SECONDS, isUnfinished, prepareResume, restoreSessionIntoMicroVm, restoreSessionIntoContainer, restoreSessionIntoSandbox, restoreWork, keptSessionDir, workRestoredEnv, sessionGuestOfMicroVm, sessionGuestOfContainer, sessionGuestOfSandbox, recordsProofsOnly, itemScope, attemptNote, fetchManagedClaudeKey, holdManagedClaudeKey, fetchManagedBuildSettings, holdManagedBuildSettings, setStage, jobEnv, runHook, describeHookEnd, needsBuildSkill, provisionContainer, leaseExpiresAtMs, withJobTimeLimit, deliverContainerHooks, provisionSandbox, deliverSandboxHooks, provisionMicroVm, deliverCommitHooks, provisionEnvironment, readProvisionOut, resolveHostBuild, workdirProblem, listenOnBroker, hostEnvironment, deliverExecMaven, runWithSpawn, hostCommandEnvironment, lifecycleSteps, execArgv, lifecycleFailureReason, decideHostBuildSkill, prepareBranch, keptCommitsLine, currentSkillCommand, formerSkillProblem, commandLogOffset, startSandboxCommand, MICROVM_COMMAND_DIR, startMicroVmCommand, microVmCommandLine, runCommand, containerCommandExec, execCommandLine, startSender, startHostServices, finishJob, sampleGuest, foldSample, isSandboxTracked, isContainerTracked, isMicroVmTracked, probeSandboxCommand, probeMicroVmCommand, probeCommand, appendCommandLog, judgeProbe, SandboxGoneError, SandboxContainerStoppedError, EXIT_CODE_FILE, isTracked, isGroupAlive, outcomeFromExitCode, isIsolatedJob, jobTimeLimitMinutes, isTimedOut, readCpuUsec, isIdle, HELPER_ENV, setUpRunnerCgroup, stopOrphanedMicroVms, sweepImageBuilders, listUnreadableJobs, listAdoptableJobs, retryFailedReleases, recoverLostJobs, GUEST_USAGE_INTERVAL_MS, vmAlive, filesAreCopied, inSandbox, listItemDisks,
|
|
13
|
-
import { RUNNER_PROTOCOL } from './chunk-
|
|
14
|
-
import { criteriaOf, loadCitationFinder, wholeItems, itemsSentence, oneLineReason, wholeEntries,
|
|
15
|
-
import {
|
|
16
|
-
import { RepoFilter } from './chunk-732WJDYG.js';
|
|
8
|
+
import { writeFleetState } from './chunk-VG6FUXGK.js';
|
|
9
|
+
import { writePendingUpdate } from './chunk-5O7P6VXS.js';
|
|
10
|
+
import { fleetConfigProblem, realBlockedProbes, checkBlockedWithSlots, askFleetMachine } from './chunk-MEZVLRJK.js';
|
|
11
|
+
import { writeMarker, readMarker, currentVersion, removeMarker, isInLayout, startedThroughCurrent, entryIn, versionDir, switchCurrent, cleanVersions, stagingDir } from './chunk-I7ZQKMKG.js';
|
|
12
|
+
import { leaseTimeLeftMs, createContainerRuntime, heldSandboxClaimsOf, unfinishedJobs, withTunnelLog, itemTag, releaseLease, runDecision, claimRun, LEASE_SECONDS, isUnfinished, prepareResume, restoreSessionIntoMicroVm, restoreSessionIntoContainer, restoreSessionIntoSandbox, restoreWork, keptSessionDir, workRestoredEnv, sessionGuestOfMicroVm, sessionGuestOfContainer, sessionGuestOfSandbox, recordsProofsOnly, itemScope, attemptNote, fetchManagedClaudeKey, holdManagedClaudeKey, fetchManagedBuildSettings, holdManagedBuildSettings, setStage, jobEnv, runHook, describeHookEnd, needsBuildSkill, provisionContainer, leaseExpiresAtMs, withJobTimeLimit, deliverContainerHooks, provisionSandbox, deliverSandboxHooks, provisionMicroVm, deliverCommitHooks, provisionEnvironment, readProvisionOut, resolveHostBuild, workdirProblem, listenOnBroker, hostEnvironment, deliverExecMaven, runWithSpawn, hostCommandEnvironment, lifecycleSteps, execArgv, lifecycleFailureReason, decideHostBuildSkill, prepareBranch, keptCommitsLine, currentSkillCommand, formerSkillProblem, commandLogOffset, startSandboxCommand, MICROVM_COMMAND_DIR, startMicroVmCommand, microVmCommandLine, runCommand, containerCommandExec, execCommandLine, startSender, startHostServices, finishJob, sampleGuest, foldSample, isSandboxTracked, isContainerTracked, isMicroVmTracked, probeSandboxCommand, probeMicroVmCommand, probeCommand, appendCommandLog, judgeProbe, SandboxGoneError, SandboxContainerStoppedError, EXIT_CODE_FILE, isTracked, isGroupAlive, outcomeFromExitCode, isIsolatedJob, jobTimeLimitMinutes, isTimedOut, readCpuUsec, isIdle, HELPER_ENV, setUpRunnerCgroup, stopOrphanedMicroVms, sweepImageBuilders, listUnreadableJobs, listAdoptableJobs, retryFailedReleases, recoverLostJobs, GUEST_USAGE_INTERVAL_MS, vmAlive, filesAreCopied, inSandbox, listItemDisks, hookLimitsFor, runCommandOf, AttemptLogBook, environmentFor, builtOf, judgeCredential, readWorkItem, makeRecorder, microVmOomKills, needsRenew, renewRun, renewLease, RENEW_INTERVAL_SECONDS, stoppedHelperReason, measureDisk, listTrackedJobs, sweepSandboxes, keptSandboxIds, parseCpuList, ensureTunnel, keepGhConfigCurrent, restartSender, rejoinSandboxBuild, createHousekeepingDocker, housekeepingDockerIfReachable, runHousekeeping, shellQuote, jobRecordsClaim, freeItemDisksUntil, savedStatesDir, readRecords, holdsHostDisk, removeOldestUntil, treeFileText, timeoutAfter, scrubReason, ensureNetworkReady, ADOPTED_FETCH_RETRY_WINDOW_MS, managedBuildSettingsFor, gitRemoteFor, startServicesFor, installTrust, createLeaseChannel, serveLease, writeGuestGhConfig, deliverJobFiles, inTeardown } from './chunk-MG2Y5XYV.js';
|
|
13
|
+
import { RUNNER_PROTOCOL } from './chunk-EBWA6KIE.js';
|
|
14
|
+
import { criteriaOf, diffLines, loadCitationFinder, wholeItems, itemsSentence, oneLineReason, parseJudgeAnswer, wholeEntries, treePath, lineInDiff } from './chunk-MBOQJTOS.js';
|
|
15
|
+
import { RepoFilter } from './chunk-H4JQKCVP.js';
|
|
17
16
|
import { JOB_STATE_FORMAT, readsJobState, jobStateFormatOf } from './chunk-B4XB5QFD.js';
|
|
18
|
-
import { imageTag, writeUpdateStatus, pullInstruction, tagToPull } from './chunk-
|
|
17
|
+
import { imageTag, writeUpdateStatus, pullInstruction, tagToPull } from './chunk-UE42G3QY.js';
|
|
19
18
|
import { isVersion, compareVersions, satisfiesRange } from './chunk-TQMI335S.js';
|
|
20
|
-
import { claimCalls, claimItem, spoolHomeFor, leftByRunnerKey, runnerCalls, itemCalls, configForJob } from './chunk-
|
|
21
|
-
import { fetchCommit, readBranchHead, diffBetween } from './chunk-
|
|
22
|
-
import { claimPidFile, releasePidFile, writePidFile, readPidFile } from './chunk-
|
|
19
|
+
import { claimCalls, claimItem, spoolHomeFor, leftByRunnerKey, runnerCalls, itemCalls, configForJob } from './chunk-HI6R4XYD.js';
|
|
20
|
+
import { fetchCommit, readBranchHead, diffBetween } from './chunk-WZ6K327V.js';
|
|
21
|
+
import { claimPidFile, releasePidFile, writePidFile, readPidFile } from './chunk-6QXGAGQY.js';
|
|
23
22
|
import { startTimeOf, isSameProcess } from './chunk-JBJTC3UU.js';
|
|
24
|
-
import { describeCallFailure, retrySend, shortClaim, relativeToRunner, formatDuration, resolveGoverningSource, BuildTokens, classifyRefusal, refusalCode, createRunnerLog, formatClock } from './chunk-
|
|
25
|
-
import { WorkCommandError, isSignatureRefusal, getJson, postJson, getBytes } from './chunk-
|
|
26
|
-
import { keyRunnerFactory, readsOnly, isBuiltinSandbox, isBuiltinContainer, isBuiltinVm, loadRunnerConfig, checkHooks, builtinKind, keepsHostBuilder, runnerDeliversComments, DEFAULT_CHECK_TIME_LIMIT_MINUTES, readOnlyRemoteOf, DEFAULT_SAVED_STATE_MAX_BYTES, DEFAULT_UPDATE_MAX_WAIT_HOURS, readOnlyOption } from './chunk-
|
|
27
|
-
import {
|
|
28
|
-
import { writeJobFile, ensureRunnerIdentity, identityDockerFor, readJobFile, JUDGE_TREE, exceedsDisk, runnerLabelValue, builderName, ensureFailureCount, builderSpec, ensureBuilder, spawnRun,
|
|
29
|
-
import { loadHostKey, ensureHostKey, signerFor } from './chunk-
|
|
30
|
-
import { jobsDir, RUNNER_DIR_MODE, runnerDir, RUNNER_FILE_MODE, buildDir, attemptStamp, jobDir, pidFilePath, storeScopes
|
|
31
|
-
import { parseClaimIdentity, parseBranchlessRepositories, parseClaimedRepositories, parseUnreachable, repositoriesOf, primaryOf, JOB_MOUNT, WORK_DIR } from './chunk-
|
|
32
|
-
import { jobCredentialProblem, COMMAND_LOST_REASON, takeAgentCredentials, heldAgentCredential, CONTAINER_STOPPED_REASON, currentAgentCredential, fdName } from './chunk-
|
|
33
|
-
import { cleanAttachmentName } from './chunk-
|
|
34
|
-
import { jobAgent, jobCommandEnv, runnerAgents, judgeAgent } from './chunk-
|
|
35
|
-
import { defaultAgents, resolvePackRoot } from './chunk-
|
|
23
|
+
import { describeCallFailure, retrySend, shortClaim, relativeToRunner, formatDuration, resolveGoverningSource, BuildTokens, classifyRefusal, refusalCode, createRunnerLog, formatClock } from './chunk-CW6H5JXV.js';
|
|
24
|
+
import { WorkCommandError, isSignatureRefusal, getJson, postJson, getBytes } from './chunk-X6BGCNE3.js';
|
|
25
|
+
import { keyRunnerFactory, readsOnly, isBuiltinSandbox, isBuiltinContainer, isBuiltinVm, loadRunnerConfig, checkHooks, builtinKind, keepsHostBuilder, runnerDeliversComments, DEFAULT_CHECK_TIME_LIMIT_MINUTES, readOnlyRemoteOf, DEFAULT_SAVED_STATE_MAX_BYTES, DEFAULT_UPDATE_MAX_WAIT_HOURS, readOnlyOption } from './chunk-ZASDJ7F5.js';
|
|
26
|
+
import { formatBytes, freeBytes } from './chunk-33DTLCL6.js';
|
|
27
|
+
import { writeJobFile, ensureRunnerIdentity, identityDockerFor, readJobFile, JUDGE_TREE, exceedsDisk, runnerLabelValue, builderName, ensureFailureCount, builderSpec, ensureBuilder, spawnRun, JUDGE_DIR, judgeCommand, JUDGE_MAX_TURNS } from './chunk-PZZS6DHY.js';
|
|
28
|
+
import { loadHostKey, ensureHostKey, signerFor } from './chunk-6ZBUQIJA.js';
|
|
29
|
+
import { jobsDir, RUNNER_DIR_MODE, runnerDir, RUNNER_FILE_MODE, buildDir, attemptStamp, jobDir, pidFilePath, storeScopes } from './chunk-H2THCHUP.js';
|
|
30
|
+
import { parseClaimIdentity, parseBranchlessRepositories, parseClaimedRepositories, parseUnreachable, repositoriesOf, primaryOf, JOB_MOUNT, WORK_DIR } from './chunk-ZYIVNB6B.js';
|
|
31
|
+
import { jobCredentialProblem, COMMAND_LOST_REASON, takeAgentCredentials, heldAgentCredential, CONTAINER_STOPPED_REASON, currentAgentCredential, fdName } from './chunk-GQI5N56J.js';
|
|
32
|
+
import { cleanAttachmentName } from './chunk-6NODVJGM.js';
|
|
33
|
+
import { jobAgent, jobCommandEnv, runnerAgents, judgeAgent } from './chunk-7QIQ7QR3.js';
|
|
34
|
+
import { defaultAgents, resolvePackRoot } from './chunk-5EWESACE.js';
|
|
36
35
|
import { resolveVersion } from './chunk-RA3O54FC.js';
|
|
37
|
-
import { CheckItemsSchema, CODE_REVIEW_NAME, CHECK_ITEM_HREF_MAX_LENGTH, CHECK_ITEM_REASON_MAX_LENGTH, UNREVIEWED_FILES_ITEM_ID, problemKind, CODE_REVIEW_PROBLEMS_MAX, REVIEWED_COMMIT_ITEM_ID } from './chunk-
|
|
38
|
-
import { mkdirSync, existsSync, writeFileSync, chmodSync, renameSync, statSync, readdirSync, rmSync, readFileSync, lstatSync, closeSync } from 'fs';
|
|
39
|
-
import { join, dirname } from 'path';
|
|
36
|
+
import { CheckItemsSchema, CODE_REVIEW_NAME, CHECK_ITEM_HREF_MAX_LENGTH, CHECK_ITEM_REASON_MAX_LENGTH, UNREVIEWED_FILES_ITEM_ID, problemKind, CODE_REVIEW_PROBLEMS_MAX, REVIEWED_COMMIT_ITEM_ID, PROBLEM_KINDS, problemSeverity } from './chunk-CH3PO7UY.js';
|
|
40
37
|
import { randomBytes, createHash } from 'crypto';
|
|
38
|
+
import { mkdirSync, existsSync, writeFileSync, chmodSync, renameSync, statSync, readdirSync, rmSync, readFileSync, lstatSync, closeSync } from 'fs';
|
|
41
39
|
import { totalmem, userInfo, constants } from 'os';
|
|
40
|
+
import { join, dirname } from 'path';
|
|
42
41
|
|
|
43
42
|
createRequire(import.meta.url);
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
|
|
44
|
+
// src/runner/fleet/report.ts
|
|
46
45
|
var BUILD_SIZES = {
|
|
47
46
|
small: { memoryGiB: 16, vcpus: 4, diskGB: 20 },
|
|
48
47
|
large: { memoryGiB: 32, vcpus: 8, diskGB: 30 }
|
|
49
48
|
};
|
|
50
|
-
var UNLIMITED_DISK_GB = 1e9;
|
|
51
49
|
var NONE = { memoryGiB: 0, vcpus: 0, diskGB: 0 };
|
|
52
|
-
function fleetRoom(facts, jobs, held, draining) {
|
|
53
|
-
if (draining || held) return { total: { ...NONE }, free: { ...NONE } };
|
|
54
|
-
const availableBytes = facts.sliceBytes ?? Math.max(0, facts.totalMemoryBytes - RUNNER_RESERVE_BYTES);
|
|
55
|
-
const total = {
|
|
56
|
-
memoryGiB: Math.floor(availableBytes / GIB),
|
|
57
|
-
vcpus: facts.cpus,
|
|
58
|
-
diskGB: facts.freeDiskBytes === void 0 ? UNLIMITED_DISK_GB : Math.floor((facts.freeDiskBytes + facts.heldDiskBytes) / GB)
|
|
59
|
-
};
|
|
60
|
-
const sizes = jobs.map((job) => BUILD_SIZES[job.size ?? "large"]);
|
|
61
|
-
const sum = (key) => sizes.reduce((all, size) => all + size[key], 0);
|
|
62
|
-
return {
|
|
63
|
-
total,
|
|
64
|
-
free: {
|
|
65
|
-
memoryGiB: Math.max(0, total.memoryGiB - sum("memoryGiB")),
|
|
66
|
-
vcpus: Math.max(0, total.vcpus - sum("vcpus")),
|
|
67
|
-
diskGB: Math.max(0, total.diskGB - sum("diskGB"))
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
50
|
function sandboxFleetRoom(concurrency, jobs, held, draining) {
|
|
72
51
|
if (draining || held) return { total: { ...NONE }, free: { ...NONE } };
|
|
73
52
|
const large = BUILD_SIZES.large;
|
|
@@ -80,29 +59,6 @@ function sandboxFleetRoom(concurrency, jobs, held, draining) {
|
|
|
80
59
|
free: { memoryGiB: total.memoryGiB - sum("memoryGiB"), vcpus: total.vcpus - sum("vcpus"), diskGB: total.diskGB - sum("diskGB") }
|
|
81
60
|
};
|
|
82
61
|
}
|
|
83
|
-
var MAX_IMAGES = 500;
|
|
84
|
-
function names(path) {
|
|
85
|
-
try {
|
|
86
|
-
return readdirSync(path);
|
|
87
|
-
} catch {
|
|
88
|
-
return [];
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
function heldImages(configPath) {
|
|
92
|
-
const held = /* @__PURE__ */ new Set();
|
|
93
|
-
for (const scope of storeScopes(configPath)) {
|
|
94
|
-
if (scope === void 0) continue;
|
|
95
|
-
const root = imagesDir(configPath, scope);
|
|
96
|
-
for (const owner of names(root)) {
|
|
97
|
-
if (owner.startsWith("_")) continue;
|
|
98
|
-
for (const name of names(join(root, owner))) {
|
|
99
|
-
const hasRecord = names(join(root, owner, name)).some((entry) => existsSync(join(root, owner, name, entry, "image.json")));
|
|
100
|
-
if (hasRecord) held.add(`${scope}/${owner}/${name}`.toLowerCase());
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
return [...held].sort().slice(0, MAX_IMAGES);
|
|
105
|
-
}
|
|
106
62
|
var MAX_DISKS = 500;
|
|
107
63
|
var WORK_ITEM_UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
108
64
|
function heldItemDisks(configPath) {
|
|
@@ -141,13 +97,9 @@ function record(ports, memory) {
|
|
|
141
97
|
}
|
|
142
98
|
}
|
|
143
99
|
function roomOf(ports, held) {
|
|
144
|
-
|
|
145
|
-
if (isBuiltinSandbox(config.hooks.provision)) return sandboxFleetRoom(config.concurrency, ports.jobs(), held, ports.draining());
|
|
146
|
-
return fleetRoom(ports.facts(), ports.jobs(), held, ports.draining());
|
|
147
|
-
}
|
|
148
|
-
function imagesOf(ports) {
|
|
149
|
-
return isBuiltinSandbox(ports.config().hooks.provision) ? [] : ports.images();
|
|
100
|
+
return sandboxFleetRoom(ports.config().concurrency, ports.jobs(), held, ports.draining());
|
|
150
101
|
}
|
|
102
|
+
var NO_IMAGES = [];
|
|
151
103
|
async function checkFleet(ports, memory) {
|
|
152
104
|
const config = ports.config();
|
|
153
105
|
const at = ports.now().toISOString();
|
|
@@ -266,7 +218,7 @@ async function runFleetTick(ports, memory) {
|
|
|
266
218
|
if (!await checkFleet(ports, memory)) return;
|
|
267
219
|
const held = await ports.held();
|
|
268
220
|
memory.held = held;
|
|
269
|
-
const images =
|
|
221
|
+
const images = [...NO_IMAGES];
|
|
270
222
|
const disks = ports.disks();
|
|
271
223
|
for (let called = 0; called < MAX_CLAIMS_PER_POLL; called++) {
|
|
272
224
|
const room = roomOf(ports, held);
|
|
@@ -307,7 +259,7 @@ async function runFleetKeepalive(ports, memory, minGapMs) {
|
|
|
307
259
|
if (memory.lastAnsweredMs !== void 0 && ports.now().getTime() - memory.lastAnsweredMs < minGapMs) return;
|
|
308
260
|
if (memory.keyDoubted || fleetConfigProblem(ports.config()) !== void 0) return;
|
|
309
261
|
const room = roomOf(ports, memory.held);
|
|
310
|
-
const answer = await callFleetRoute(ports, memory, { total: room.total, free: NO_ROOM },
|
|
262
|
+
const answer = await callFleetRoute(ports, memory, { total: room.total, free: NO_ROOM }, [...NO_IMAGES], ports.disks());
|
|
311
263
|
if (answer === void 0) return;
|
|
312
264
|
memory.last = {
|
|
313
265
|
calledAt: ports.now().toISOString(),
|
|
@@ -441,11 +393,11 @@ function commentsOf(data) {
|
|
|
441
393
|
for (const entry of raw) {
|
|
442
394
|
const comment = entry;
|
|
443
395
|
if (comment === null || typeof comment !== "object") continue;
|
|
444
|
-
const { claimId, workItemId, commentId, thread, authorName, text, summary, at } = comment;
|
|
396
|
+
const { claimId, workItemId, commentId, thread, authorName, text: text2, summary, at } = comment;
|
|
445
397
|
if (typeof claimId !== "string" || typeof workItemId !== "string" || typeof commentId !== "string" || commentId === "") continue;
|
|
446
|
-
if (typeof thread !== "string" || typeof authorName !== "string" || typeof
|
|
398
|
+
if (typeof thread !== "string" || typeof authorName !== "string" || typeof text2 !== "string" || typeof at !== "string") continue;
|
|
447
399
|
const attachments = attachmentsOf(comment.attachments);
|
|
448
|
-
comments.push({ claimId, workItemId, commentId, thread, authorName, text, summary: typeof summary === "string" ? summary : null, at, ...attachments.length === 0 ? {} : { attachments } });
|
|
400
|
+
comments.push({ claimId, workItemId, commentId, thread, authorName, text: text2, summary: typeof summary === "string" ? summary : null, at, ...attachments.length === 0 ? {} : { attachments } });
|
|
449
401
|
}
|
|
450
402
|
return comments;
|
|
451
403
|
}
|
|
@@ -712,8 +664,8 @@ function readLastUpdate(configPath) {
|
|
|
712
664
|
return void 0;
|
|
713
665
|
}
|
|
714
666
|
}
|
|
715
|
-
function isoTime(
|
|
716
|
-
const ms = Date.parse(
|
|
667
|
+
function isoTime(text2) {
|
|
668
|
+
const ms = Date.parse(text2);
|
|
717
669
|
if (!Number.isFinite(ms)) return void 0;
|
|
718
670
|
const iso = new Date(ms).toISOString();
|
|
719
671
|
return /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(iso) ? iso : void 0;
|
|
@@ -1284,8 +1236,8 @@ async function judgeMicroVmAdoption(input) {
|
|
|
1284
1236
|
return probe.unreachable === true ? "unasked" : "unservable";
|
|
1285
1237
|
}
|
|
1286
1238
|
const inherited = runtime.vm.fdStore.inherited();
|
|
1287
|
-
const
|
|
1288
|
-
return
|
|
1239
|
+
const names = state.fdStore ?? [];
|
|
1240
|
+
return names.length > 0 && names.every((name) => inherited.has(name)) ? "adopt" : "unservable";
|
|
1289
1241
|
}
|
|
1290
1242
|
|
|
1291
1243
|
// src/runner/revise-job.ts
|
|
@@ -1324,8 +1276,8 @@ var SMALL_CHANGE_LINES = 40;
|
|
|
1324
1276
|
var LARGE_CHANGE_LINES = 800;
|
|
1325
1277
|
var GENERATED = /(^|\/)(openapi\.ya?ml|gateway-types\.ts|yarn\.lock|package-lock\.json|pnpm-lock\.yaml)$|\.golden$|\.snap$|(^|\/)generated\/|(^|\/)db-types\//;
|
|
1326
1278
|
var FLOOR = /\.sql$|(^|\/)migrations\/|auth|secret|permission|webhook|token|(^|\/)rls/i;
|
|
1327
|
-
function markdownSection(
|
|
1328
|
-
const lines =
|
|
1279
|
+
function markdownSection(text2, heading) {
|
|
1280
|
+
const lines = text2.split("\n");
|
|
1329
1281
|
const start2 = lines.findIndex((line) => line.trim() === `## ${heading}`);
|
|
1330
1282
|
if (start2 === -1) return void 0;
|
|
1331
1283
|
const end = lines.findIndex((line, index) => index > start2 && line.startsWith("## "));
|
|
@@ -1336,15 +1288,15 @@ function splitDiff(patch) {
|
|
|
1336
1288
|
const parts = [];
|
|
1337
1289
|
const starts = [...patch.matchAll(/^diff --git /gm)].map((match) => match.index);
|
|
1338
1290
|
for (const [index, start2] of starts.entries()) {
|
|
1339
|
-
const
|
|
1340
|
-
const path = /^diff --git a\/\S+ b\/(\S+)/.exec(
|
|
1291
|
+
const text2 = patch.slice(start2, starts[index + 1] ?? patch.length);
|
|
1292
|
+
const path = /^diff --git a\/\S+ b\/(\S+)/.exec(text2)?.[1] ?? "?";
|
|
1341
1293
|
let added = 0;
|
|
1342
1294
|
let removed = 0;
|
|
1343
|
-
for (const line of
|
|
1295
|
+
for (const line of text2.split("\n")) {
|
|
1344
1296
|
if (line.startsWith("+") && !line.startsWith("+++")) added += 1;
|
|
1345
1297
|
else if (line.startsWith("-") && !line.startsWith("---")) removed += 1;
|
|
1346
1298
|
}
|
|
1347
|
-
parts.push({ path, text, added, removed });
|
|
1299
|
+
parts.push({ path, text: text2, added, removed });
|
|
1348
1300
|
}
|
|
1349
1301
|
return parts;
|
|
1350
1302
|
}
|
|
@@ -1368,14 +1320,14 @@ function territories(changed, briefs) {
|
|
|
1368
1320
|
const generalist = { name: "generalist", text: "Review the full change with no restriction, and favor the seams no other reviewer names as its own." };
|
|
1369
1321
|
const full = lines > LARGE_CHANGE_LINES || changed.some((file) => FLOOR.test(file.path));
|
|
1370
1322
|
if (!full && lines < SMALL_CHANGE_LINES) return [generalist];
|
|
1371
|
-
const
|
|
1323
|
+
const names = [
|
|
1372
1324
|
["contracts", "Contracts reviewer"],
|
|
1373
1325
|
["test-strength", "Test-strength reviewer"]
|
|
1374
1326
|
];
|
|
1375
|
-
if (full)
|
|
1376
|
-
const focused =
|
|
1377
|
-
const
|
|
1378
|
-
return
|
|
1327
|
+
if (full) names.push(["security", "Security reviewer"], ["failure-path", "Failure-path reviewer"]);
|
|
1328
|
+
const focused = names.flatMap(([name, heading]) => {
|
|
1329
|
+
const text2 = briefs === void 0 ? void 0 : markdownSection(briefs, heading);
|
|
1330
|
+
return text2 === void 0 ? [] : [{ name, text: text2 }];
|
|
1379
1331
|
});
|
|
1380
1332
|
return [generalist, ...focused];
|
|
1381
1333
|
}
|
|
@@ -1412,15 +1364,24 @@ function storedProblemsText(problems) {
|
|
|
1412
1364
|
}
|
|
1413
1365
|
function mergeAnswers(answers) {
|
|
1414
1366
|
const items = [];
|
|
1415
|
-
const earlier = /* @__PURE__ */ new
|
|
1367
|
+
const earlier = /* @__PURE__ */ new Map();
|
|
1416
1368
|
const keyOf = (entry) => {
|
|
1417
1369
|
const place = entry.refs?.[0];
|
|
1418
1370
|
return [entry.id, entry.result, place?.path ?? ""].join("\0");
|
|
1419
1371
|
};
|
|
1420
1372
|
for (const answer of answers) {
|
|
1421
|
-
const
|
|
1422
|
-
for (const entry of
|
|
1423
|
-
|
|
1373
|
+
const own = [];
|
|
1374
|
+
for (const entry of answer.items) {
|
|
1375
|
+
const held = earlier.get(keyOf(entry));
|
|
1376
|
+
if (held === void 0) {
|
|
1377
|
+
const kept = { ...entry, ...entry.reviewer === void 0 ? {} : { foundBy: [entry.reviewer] } };
|
|
1378
|
+
own.push([keyOf(entry), kept]);
|
|
1379
|
+
items.push(kept);
|
|
1380
|
+
continue;
|
|
1381
|
+
}
|
|
1382
|
+
if (entry.reviewer !== void 0 && !(held.foundBy ?? []).includes(entry.reviewer)) held.foundBy = [...held.foundBy ?? [], entry.reviewer];
|
|
1383
|
+
}
|
|
1384
|
+
for (const [key, entry] of own) if (!earlier.has(key)) earlier.set(key, entry);
|
|
1424
1385
|
}
|
|
1425
1386
|
const lists = answers.flatMap((answer) => answer.reviewed === void 0 ? [] : [answer.reviewed]);
|
|
1426
1387
|
const reviewed = lists.length === 0 ? void 0 : [...new Set(lists.flat())];
|
|
@@ -1438,7 +1399,7 @@ function mergeAnswers(answers) {
|
|
|
1438
1399
|
const result = failed2 ? "fail" : said.length > 0 && said.every((answer) => answer.result === "pass") ? "pass" : void 0;
|
|
1439
1400
|
return { ...result === void 0 ? {} : { result }, items, ...reviewed === void 0 ? {} : { reviewed }, ...previous === void 0 ? {} : { previous } };
|
|
1440
1401
|
}
|
|
1441
|
-
function
|
|
1402
|
+
function carriedProblems(merged, stored) {
|
|
1442
1403
|
const verdicts = new Map((merged.previous ?? []).map((entry) => [entry.id, entry]));
|
|
1443
1404
|
const kept = [];
|
|
1444
1405
|
const decided = /* @__PURE__ */ new Set();
|
|
@@ -1454,10 +1415,20 @@ function carryProblems(merged, stored) {
|
|
|
1454
1415
|
kind: problem.kind,
|
|
1455
1416
|
...problem.title === "" ? {} : { title: problem.title },
|
|
1456
1417
|
...problem.reason === "" ? {} : { reason: problem.reason },
|
|
1457
|
-
...problem.path === "" ? {} : { refs: [{ path: problem.path, ...line === void 0 ? {} : { line } }] }
|
|
1418
|
+
...problem.path === "" ? {} : { refs: [{ path: problem.path, ...line === void 0 ? {} : { line } }] },
|
|
1419
|
+
...problem.severity === null ? {} : { severity: problem.severity }
|
|
1458
1420
|
});
|
|
1459
1421
|
}
|
|
1460
|
-
return {
|
|
1422
|
+
return { kept, fresh: merged.items.filter((entry) => !decided.has(entry.id)) };
|
|
1423
|
+
}
|
|
1424
|
+
function dropNonProblems(answer, known) {
|
|
1425
|
+
const dropped = [];
|
|
1426
|
+
const items = answer.items.filter((entry) => {
|
|
1427
|
+
const why = (entry.refs ?? []).length === 0 ? "no place" : (entry.reason ?? "").trim() === "" ? "no reason" : entry.refs.some((ref) => known(ref.path)) ? void 0 : "unknown file";
|
|
1428
|
+
if (why !== void 0) dropped.push({ id: entry.id, why });
|
|
1429
|
+
return why === void 0;
|
|
1430
|
+
});
|
|
1431
|
+
return { answer: { ...answer, items }, dropped };
|
|
1461
1432
|
}
|
|
1462
1433
|
function unreviewedFiles(changed, reviewed) {
|
|
1463
1434
|
if (reviewed === void 0) return void 0;
|
|
@@ -1483,18 +1454,172 @@ function unreviewedItem(changed, reviewed, commit) {
|
|
|
1483
1454
|
return { id: UNREVIEWED_FILES_ITEM_ID, result: "skipped", commit, reason: `${reason}.` };
|
|
1484
1455
|
}
|
|
1485
1456
|
|
|
1457
|
+
// src/runner/code-review-consolidate.ts
|
|
1458
|
+
var CONSOLIDATION_INPUT = "problems.json";
|
|
1459
|
+
var CONSOLIDATION_ANSWER = "items-consolidator.json";
|
|
1460
|
+
var CONSOLIDATOR = "consolidator";
|
|
1461
|
+
var DROP_REASONS = ["duplicate", "out-of-scope", "not-shown", "wrong"];
|
|
1462
|
+
function shouldConsolidate(reviewers, fresh) {
|
|
1463
|
+
if (fresh === 0) return false;
|
|
1464
|
+
return reviewers > 1 || fresh > 1;
|
|
1465
|
+
}
|
|
1466
|
+
var keyAt = (index) => `p${index + 1}`;
|
|
1467
|
+
var finders = (entry) => entry.foundBy ?? (entry.reviewer === void 0 ? [] : [entry.reviewer]);
|
|
1468
|
+
function consolidationInput(fresh, reviewers) {
|
|
1469
|
+
const problems = fresh.map((entry, index) => ({
|
|
1470
|
+
key: keyAt(index),
|
|
1471
|
+
reviewers: finders(entry),
|
|
1472
|
+
id: entry.id,
|
|
1473
|
+
kind: entry.kind ?? "bug",
|
|
1474
|
+
...entry.title === void 0 ? {} : { title: entry.title },
|
|
1475
|
+
...entry.reason === void 0 ? {} : { reason: entry.reason },
|
|
1476
|
+
refs: entry.refs ?? []
|
|
1477
|
+
}));
|
|
1478
|
+
return `${JSON.stringify({ reviewers, problems }, null, 2)}
|
|
1479
|
+
`;
|
|
1480
|
+
}
|
|
1481
|
+
var RULES = ["What the review covers", "What is a problem", "What is never a problem", "Repository text"];
|
|
1482
|
+
function consolidationBrief(consolidation, brief) {
|
|
1483
|
+
const rules = RULES.flatMap((heading) => {
|
|
1484
|
+
const body = markdownSection(brief, heading);
|
|
1485
|
+
return body === void 0 ? [] : [`## ${heading}
|
|
1486
|
+
|
|
1487
|
+
${body}`];
|
|
1488
|
+
});
|
|
1489
|
+
return [consolidation.trimEnd(), ...rules.length === 0 ? [] : ["# The rules of the review", ...rules]].join("\n\n");
|
|
1490
|
+
}
|
|
1491
|
+
function consolidationProtocol(instructions, answer) {
|
|
1492
|
+
return `${instructions.trimEnd()}
|
|
1493
|
+
|
|
1494
|
+
## How to answer
|
|
1495
|
+
|
|
1496
|
+
This section comes from the factory host and overrides any other answer format above. \`${JUDGE_DIR}/${CONSOLIDATION_INPUT}\` lists the new problems, each under a \`key\`. \`${JUDGE_DIR}/files.md\` lists the changed files, the \`diff-<n>.patch\` files hold the change and \`${JUDGE_TREE}/\` the files of the commit under review.
|
|
1497
|
+
|
|
1498
|
+
Write your answer as JSON to \`${answer}\`: \`{"problems":[{"from":["<key>"],"id":"<a short name>","kind":"bug"|"security"|"data"|"test"|"docs"|"comment","severity":"blocking"|"advisory","title":"<a short name>","reason":"<one to three sentences>","trigger":"<the input or state that triggers it>","result":"<the wrong result>","changed":{"path":"<changed file>","line":<the changed line that adds or causes it>},"refs":[{"path":"<path relative to ${JUDGE_TREE}/>","line":<the line in the commit>}]}],"dropped":[{"key":"<key>","why":"duplicate"|"out-of-scope"|"not-shown"|"wrong","of":"<key it repeats, for a duplicate>","reason":"<one sentence>"}]}\`. \`from\` lists every key the kept problem joins. Give each key once: in the \`from\` of one kept problem, or in \`dropped\`. Never keep a problem that no key names. The host drops a kept problem with no \`trigger\`, \`result\` or \`changed\` line of the change.
|
|
1499
|
+
`;
|
|
1500
|
+
}
|
|
1501
|
+
function knownPlaces(raw, known) {
|
|
1502
|
+
if (!Array.isArray(raw)) return [];
|
|
1503
|
+
return raw.flatMap((entry) => {
|
|
1504
|
+
const { path, line } = typeof entry === "object" && entry !== null ? entry : {};
|
|
1505
|
+
if (typeof path !== "string" || path === "" || path.length > 1024 || !known(path)) return [];
|
|
1506
|
+
return [{ path, ...typeof line === "number" && Number.isInteger(line) && line > 0 ? { line } : {} }];
|
|
1507
|
+
});
|
|
1508
|
+
}
|
|
1509
|
+
var text = (raw, max) => typeof raw === "string" && raw.trim() !== "" && raw.length <= max ? raw : void 0;
|
|
1510
|
+
function severityOf(kind, lowered) {
|
|
1511
|
+
if (kind === "test" || kind === "docs" || kind === "comment") return "advisory";
|
|
1512
|
+
if (kind === "security" || kind === "data") return "blocking";
|
|
1513
|
+
return lowered === "advisory" ? "advisory" : "blocking";
|
|
1514
|
+
}
|
|
1515
|
+
function shown(said, inChange) {
|
|
1516
|
+
const changed = Object(said.changed);
|
|
1517
|
+
const placed = typeof changed.path === "string" && typeof changed.line === "number" && Number.isInteger(changed.line) && changed.line > 0 && inChange(changed.path, changed.line);
|
|
1518
|
+
return placed && text(said.trigger, 2e3) !== void 0 && text(said.result, 2e3) !== void 0;
|
|
1519
|
+
}
|
|
1520
|
+
var UNSHOWN_REASON = "The consolidator kept it without naming the trigger, the wrong result and a changed line.";
|
|
1521
|
+
function readConsolidation(raw, fresh, known, inChange) {
|
|
1522
|
+
if (raw === void 0 || raw.trim() === "") return { ok: false, reason: "the consolidator wrote no answer file" };
|
|
1523
|
+
let parsed;
|
|
1524
|
+
try {
|
|
1525
|
+
parsed = JSON.parse(raw);
|
|
1526
|
+
} catch {
|
|
1527
|
+
return { ok: false, reason: "the consolidator's answer is not JSON" };
|
|
1528
|
+
}
|
|
1529
|
+
const answer = Object(parsed);
|
|
1530
|
+
if (!Array.isArray(answer.problems)) return { ok: false, reason: "the consolidator's answer lists no problems" };
|
|
1531
|
+
const sources = new Map(fresh.map((entry, index) => [keyAt(index), entry]));
|
|
1532
|
+
const used = /* @__PURE__ */ new Set();
|
|
1533
|
+
const notes = [];
|
|
1534
|
+
const kept = [];
|
|
1535
|
+
const dropped = [];
|
|
1536
|
+
const droppedKeys = /* @__PURE__ */ new Set();
|
|
1537
|
+
for (const [index, item] of answer.problems.entries()) {
|
|
1538
|
+
const said = Object(item);
|
|
1539
|
+
const keys = (Array.isArray(said.from) ? said.from : []).filter((key) => typeof key === "string" && sources.has(key) && !used.has(key));
|
|
1540
|
+
if (keys.length === 0) {
|
|
1541
|
+
notes.push(`problem ${index + 1} of the answer names no reported problem, so it is ignored`);
|
|
1542
|
+
continue;
|
|
1543
|
+
}
|
|
1544
|
+
for (const key of keys) used.add(key);
|
|
1545
|
+
if (!shown(said, inChange)) {
|
|
1546
|
+
for (const key of keys) {
|
|
1547
|
+
droppedKeys.add(key);
|
|
1548
|
+
dropped.push({ key, id: sources.get(key).id, reviewers: finders(sources.get(key)), why: "not-shown", reason: UNSHOWN_REASON });
|
|
1549
|
+
}
|
|
1550
|
+
continue;
|
|
1551
|
+
}
|
|
1552
|
+
const first = sources.get(keys[0]);
|
|
1553
|
+
const refs = knownPlaces(said.refs, known);
|
|
1554
|
+
const kind = PROBLEM_KINDS.includes(said.kind) ? said.kind : first.kind ?? "bug";
|
|
1555
|
+
const title = text(said.title, 300) ?? first.title;
|
|
1556
|
+
const reason = text(said.reason, 4e3) ?? first.reason;
|
|
1557
|
+
kept.push({
|
|
1558
|
+
keys,
|
|
1559
|
+
entry: {
|
|
1560
|
+
id: text(said.id, 200) ?? first.id,
|
|
1561
|
+
result: "fail",
|
|
1562
|
+
kind,
|
|
1563
|
+
...title === void 0 ? {} : { title },
|
|
1564
|
+
...reason === void 0 ? {} : { reason },
|
|
1565
|
+
refs: refs.length > 0 ? refs : first.refs ?? [],
|
|
1566
|
+
severity: severityOf(kind, problemSeverity(said.severity)),
|
|
1567
|
+
...first.reviewer === void 0 ? {} : { reviewer: first.reviewer }
|
|
1568
|
+
}
|
|
1569
|
+
});
|
|
1570
|
+
}
|
|
1571
|
+
const keptKey = (key) => kept.find((problem) => problem.keys.includes(key));
|
|
1572
|
+
const drops = Array.isArray(answer.dropped) ? answer.dropped : [];
|
|
1573
|
+
const ordered = [...drops.filter((drop) => Object(drop).why !== "duplicate"), ...drops.filter((drop) => Object(drop).why === "duplicate")];
|
|
1574
|
+
for (const drop of ordered) {
|
|
1575
|
+
const said = Object(drop);
|
|
1576
|
+
const key = said.key;
|
|
1577
|
+
if (typeof key !== "string" || !sources.has(key) || used.has(key)) continue;
|
|
1578
|
+
if (!DROP_REASONS.includes(said.why)) {
|
|
1579
|
+
notes.push(`the drop of ${key} gives no known reason, so ${key} is kept`);
|
|
1580
|
+
continue;
|
|
1581
|
+
}
|
|
1582
|
+
const why = said.why;
|
|
1583
|
+
const of = typeof said.of === "string" ? said.of : void 0;
|
|
1584
|
+
if (why === "duplicate") {
|
|
1585
|
+
const target = of === void 0 ? void 0 : keptKey(of);
|
|
1586
|
+
if (target === void 0 && (of === void 0 || !droppedKeys.has(of))) {
|
|
1587
|
+
notes.push(`${key} is called a duplicate of ${of ?? "nothing"}, which is no kept or dropped problem, so ${key} is kept`);
|
|
1588
|
+
continue;
|
|
1589
|
+
}
|
|
1590
|
+
if (target !== void 0) target.keys.push(key);
|
|
1591
|
+
}
|
|
1592
|
+
used.add(key);
|
|
1593
|
+
droppedKeys.add(key);
|
|
1594
|
+
const source = sources.get(key);
|
|
1595
|
+
const reason = text(said.reason, 1e3);
|
|
1596
|
+
dropped.push({ key, id: source.id, reviewers: finders(source), why, ...of === void 0 ? {} : { of }, ...reason === void 0 ? {} : { reason } });
|
|
1597
|
+
}
|
|
1598
|
+
const items = kept.map(({ entry, keys }) => {
|
|
1599
|
+
const reviewers = [...new Set(keys.flatMap((key) => finders(sources.get(key))))];
|
|
1600
|
+
return reviewers.length === 0 ? entry : { ...entry, foundBy: reviewers };
|
|
1601
|
+
});
|
|
1602
|
+
for (const [key, entry] of sources) {
|
|
1603
|
+
if (used.has(key)) continue;
|
|
1604
|
+
notes.push(`the answer neither keeps nor drops ${key} (${entry.id}), so it is kept as reported`);
|
|
1605
|
+
items.push({ ...entry, severity: severityOf(entry.kind) });
|
|
1606
|
+
}
|
|
1607
|
+
return { ok: true, items, dropped, notes };
|
|
1608
|
+
}
|
|
1609
|
+
|
|
1486
1610
|
// src/runner/code-review-problems.ts
|
|
1487
1611
|
var EXCERPT_CONTEXT_LINES = 5;
|
|
1488
1612
|
var EXCERPT_LINE_MAX = 300;
|
|
1489
1613
|
var PROBLEMS_MAX = CODE_REVIEW_PROBLEMS_MAX;
|
|
1490
1614
|
var FILES_MAX = 2e3;
|
|
1491
1615
|
var TITLE_MAX = 300;
|
|
1492
|
-
|
|
1493
|
-
|
|
1616
|
+
var CONSOLIDATION_REASON_MAX = 200;
|
|
1617
|
+
function storable(text2) {
|
|
1618
|
+
return text2.replace(/\u0000/g, "").replace(/\p{Cs}/gu, "");
|
|
1494
1619
|
}
|
|
1495
|
-
function problemExcerpt(
|
|
1496
|
-
if (
|
|
1497
|
-
const lines = storable(
|
|
1620
|
+
function problemExcerpt(text2, line) {
|
|
1621
|
+
if (text2 === void 0 || line === void 0 || !Number.isInteger(line) || line < 1) return null;
|
|
1622
|
+
const lines = storable(text2).split(/\r\n|\r|\n/);
|
|
1498
1623
|
if (lines.at(-1) === "") lines.pop();
|
|
1499
1624
|
if (line > lines.length) return null;
|
|
1500
1625
|
const startLine = Math.max(1, line - EXCERPT_CONTEXT_LINES);
|
|
@@ -1517,13 +1642,14 @@ function reviewRecord(input) {
|
|
|
1517
1642
|
problems.push({
|
|
1518
1643
|
id: item.id,
|
|
1519
1644
|
kind: problemKind(entry.kind),
|
|
1520
|
-
title: titleOf(entry.title, item.id, input.clean ?? ((
|
|
1645
|
+
title: titleOf(entry.title, item.id, input.clean ?? ((text2) => text2)),
|
|
1521
1646
|
reason: item.reason ?? "",
|
|
1522
1647
|
path: place?.path ?? "",
|
|
1523
1648
|
line: place?.line ?? null,
|
|
1524
1649
|
inDiff: place?.inDiff === true,
|
|
1525
1650
|
excerpt: place === void 0 ? null : input.excerptOf(place.path, place.line),
|
|
1526
|
-
reviewer: entry.reviewer ?? ""
|
|
1651
|
+
reviewer: entry.reviewer ?? "",
|
|
1652
|
+
severity: entry.severity ?? null
|
|
1527
1653
|
});
|
|
1528
1654
|
}
|
|
1529
1655
|
const files = unreviewedFiles(input.changed, input.merged.reviewed);
|
|
@@ -1574,7 +1700,8 @@ function readStoredProblems(data) {
|
|
|
1574
1700
|
path: typeof row.path === "string" ? row.path : "",
|
|
1575
1701
|
line: typeof row.line === "number" && Number.isInteger(row.line) ? row.line : null,
|
|
1576
1702
|
commit: typeof row.commit === "string" ? row.commit : "",
|
|
1577
|
-
dismissalReason: typeof row.dismissalReason === "string" ? row.dismissalReason : null
|
|
1703
|
+
dismissalReason: typeof row.dismissalReason === "string" ? row.dismissalReason : null,
|
|
1704
|
+
severity: problemSeverity(row.severity) ?? null
|
|
1578
1705
|
}
|
|
1579
1706
|
];
|
|
1580
1707
|
});
|
|
@@ -1597,9 +1724,9 @@ async function readCodeReviewProblems(config, job, deps) {
|
|
|
1597
1724
|
var REVIEW_SKILL = "outerlayer-review";
|
|
1598
1725
|
var REVIEW_EFFORT = "high";
|
|
1599
1726
|
var MAX_DIFF_BYTES = 4 * 1024 * 1024;
|
|
1600
|
-
function withoutFrontMatter(
|
|
1601
|
-
const match = /^---\r?\n[\s\S]*?\r?\n---\r?\n/.exec(
|
|
1602
|
-
return match === null ?
|
|
1727
|
+
function withoutFrontMatter(text2) {
|
|
1728
|
+
const match = /^---\r?\n[\s\S]*?\r?\n---\r?\n/.exec(text2);
|
|
1729
|
+
return match === null ? text2 : text2.slice(match[0].length).trimStart();
|
|
1603
1730
|
}
|
|
1604
1731
|
function readReviewInstructions(root = resolvePackRoot()) {
|
|
1605
1732
|
const dir = join(root, "maintained", REVIEW_SKILL);
|
|
@@ -1609,14 +1736,17 @@ function readReviewInstructions(root = resolvePackRoot()) {
|
|
|
1609
1736
|
} catch {
|
|
1610
1737
|
return void 0;
|
|
1611
1738
|
}
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1739
|
+
const reference = (name) => {
|
|
1740
|
+
try {
|
|
1741
|
+
return readFileSync(join(dir, "references", name), "utf8");
|
|
1742
|
+
} catch {
|
|
1743
|
+
return void 0;
|
|
1744
|
+
}
|
|
1745
|
+
};
|
|
1746
|
+
const briefs = reference("territories.md");
|
|
1747
|
+
const consolidation = reference("consolidation.md");
|
|
1748
|
+
const sha256 = createHash("sha256").update(skill).update("\0").update(briefs ?? "").update("\0").update(consolidation ?? "").digest("hex");
|
|
1749
|
+
return { brief: withoutFrontMatter(skill), territories: briefs, consolidation, sha256 };
|
|
1620
1750
|
}
|
|
1621
1751
|
function reviewIsolation(config) {
|
|
1622
1752
|
const kind = builtinKind(config.hooks.provision);
|
|
@@ -1638,11 +1768,11 @@ This section comes from the factory host and overrides any other answer format a
|
|
|
1638
1768
|
Write your answer as JSON to \`${answer}\`: \`{"reviewed":["<changed file path>"],"previous":[{"id":"<id in previous.json>","verdict":"fixed"|"open","line":<its line in the commit, when open>}],"problems":[{"id":"<a short name>","kind":"bug"|"security"|"data"|"test"|"docs"|"comment","title":"<a short name>","reason":"<one to three sentences>","refs":[{"path":"<path relative to ${JUDGE_TREE}/>","line":<the line in the commit>}]}]}\`. Each problem is unique by its id in the answer, and names in \`refs\` the file and line it is about. \`reviewed\` lists each changed file you read in full, by its path in the repository. \`previous\` gives a verdict on each defect in \`previous.json\`, when the file exists. Never list a defect of \`previous.json\` in \`problems\`: the host keeps each one that is still open. \`kind\` is what the problem is about, and \`bug\` when none fits. A reason quotes the decisive line or names what is missing. An answer with no problems lists none.
|
|
1639
1769
|
`;
|
|
1640
1770
|
}
|
|
1641
|
-
function parseReviewAnswer(
|
|
1642
|
-
if (
|
|
1771
|
+
function parseReviewAnswer(text2) {
|
|
1772
|
+
if (text2 === void 0 || text2.trim() === "") return void 0;
|
|
1643
1773
|
let raw;
|
|
1644
1774
|
try {
|
|
1645
|
-
raw = JSON.parse(
|
|
1775
|
+
raw = JSON.parse(text2);
|
|
1646
1776
|
} catch {
|
|
1647
1777
|
return { ok: false, reason: "the reviewer's answer is not JSON" };
|
|
1648
1778
|
}
|
|
@@ -1668,7 +1798,7 @@ async function runReviewJob(input) {
|
|
|
1668
1798
|
const { runtime, log } = deps;
|
|
1669
1799
|
const tag = itemTag(job);
|
|
1670
1800
|
const scratch = join(jobDir2, "review-scratch");
|
|
1671
|
-
const cleanReason = (
|
|
1801
|
+
const cleanReason = (text2) => scrubReason(text2, config, void 0, jobDir2, CHECK_ITEM_REASON_MAX_LENGTH) ?? "";
|
|
1672
1802
|
const notRun = async (reason) => {
|
|
1673
1803
|
if (input.ending()) return { kind: "ended" };
|
|
1674
1804
|
const said = oneLineReason(cleanReason(reason)) ?? "the code review did not run";
|
|
@@ -1732,34 +1862,59 @@ async function runReviewJob(input) {
|
|
|
1732
1862
|
log.line(`${tag} code review of ${head.slice(0, 8)}: ${changed.length} changed ${changed.length === 1 ? "file" : "files"}, reviewers ${runs.map((run) => run.name).join(", ")}`);
|
|
1733
1863
|
const limitMinutes = config.checks?.timeLimitMinutes ?? DEFAULT_CHECK_TIME_LIMIT_MINUTES;
|
|
1734
1864
|
const minutes = `${limitMinutes} ${limitMinutes === 1 ? "minute" : "minutes"}`;
|
|
1735
|
-
const
|
|
1865
|
+
const reviewerRuns = runs.map((territory, index) => {
|
|
1866
|
+
const answerName = index === 0 ? "items.json" : `items-${territory.name}.json`;
|
|
1867
|
+
return { territory, answerName, logName: index === 0 ? "review.log" : `review-${territory.name}.log`, prompt: reviewAnswerProtocol(territoryBrief(instructions.brief, territory), `${JUDGE_DIR}/${answerName}`) };
|
|
1868
|
+
});
|
|
1869
|
+
const reviewed = await reviewSideBySide({ environment, files, tree: treeDir, runs: reviewerRuns, credential, limitMinutes, minutes, jobDir: jobDir2, deps, tag });
|
|
1736
1870
|
if (!reviewed.ok) return await notRun(reviewed.reason);
|
|
1737
1871
|
if (input.ending()) return { kind: "ended" };
|
|
1872
|
+
let ownTree = false;
|
|
1873
|
+
try {
|
|
1874
|
+
lstatSync(join(treeDir, "tree"));
|
|
1875
|
+
ownTree = true;
|
|
1876
|
+
} catch {
|
|
1877
|
+
}
|
|
1878
|
+
const changedPaths = new Set(changed.map((file) => file.path));
|
|
1879
|
+
const known = (raw) => {
|
|
1880
|
+
const written = treePath(raw, JUDGE_TREE);
|
|
1881
|
+
if (written === void 0) return false;
|
|
1882
|
+
const path = written.startsWith("tree/") && !ownTree ? written.slice("tree/".length) : written;
|
|
1883
|
+
return path !== "" && (changedPaths.has(path) || treeFileText(treeDir, path) !== void 0);
|
|
1884
|
+
};
|
|
1885
|
+
const shownLines = diffLines(diff);
|
|
1886
|
+
const inChange = (raw, line) => {
|
|
1887
|
+
const written = treePath(raw, JUDGE_TREE);
|
|
1888
|
+
const path = written !== void 0 && written.startsWith("tree/") && !ownTree ? written.slice("tree/".length) : written;
|
|
1889
|
+
if (path === void 0 || !changedPaths.has(path)) return false;
|
|
1890
|
+
return shownLines.has(path) ? lineInDiff(shownLines, path, line) : true;
|
|
1891
|
+
};
|
|
1738
1892
|
const answers = [];
|
|
1739
|
-
for (const { territory, end, answer } of reviewed.runs) {
|
|
1893
|
+
for (const { territory, end, answer } of reviewed.runs.map((run) => ({ ...run, answer: parseReviewAnswer(run.text) }))) {
|
|
1740
1894
|
if (answer?.ok === true) {
|
|
1741
|
-
|
|
1895
|
+
const guarded = dropNonProblems(answer.answer, known);
|
|
1896
|
+
for (const { id, why } of guarded.dropped) log.line(`${tag} the ${territory.name} review's entry ${JSON.stringify(id)} is no problem (${why}), so it is left out`);
|
|
1897
|
+
answers.push({ ...guarded.answer, items: guarded.answer.items.map((entry) => ({ ...entry, reviewer: territory.name })) });
|
|
1742
1898
|
if (!end.finished) log.line(`${tag} the ${territory.name} review stopped before it ended, so only what it found is kept: ${end.reason}`);
|
|
1743
1899
|
} else log.line(`${tag} the ${territory.name} review gave no answer: ${answer?.ok === false ? answer.reason : end.finished ? "it wrote no answer file" : end.reason}`);
|
|
1744
1900
|
}
|
|
1745
1901
|
if (answers.length === 0) {
|
|
1746
1902
|
const first = reviewed.runs[0];
|
|
1747
|
-
|
|
1903
|
+
const answer = parseReviewAnswer(first.text);
|
|
1904
|
+
return await notRun(answer?.ok === false ? answer.reason : first.end.finished ? "the review wrote no answer file" : first.end.reason);
|
|
1748
1905
|
}
|
|
1749
|
-
const
|
|
1906
|
+
const joined = mergeAnswers(answers);
|
|
1907
|
+
const { kept, fresh } = carriedProblems(joined, stored ?? []);
|
|
1908
|
+
const consolidated = await consolidate({ fresh, reviewers: answers.length, names: runs.map((run) => run.name) });
|
|
1909
|
+
if (input.ending()) return { kind: "ended" };
|
|
1910
|
+
const merged = { ...joined, items: [...kept, ...consolidated.items] };
|
|
1750
1911
|
const finder = await loadCitationFinder();
|
|
1751
|
-
let ownTree = false;
|
|
1752
|
-
try {
|
|
1753
|
-
lstatSync(join(treeDir, "tree"));
|
|
1754
|
-
ownTree = true;
|
|
1755
|
-
} catch {
|
|
1756
|
-
}
|
|
1757
1912
|
const place = (path, line) => {
|
|
1758
1913
|
if (treeFileText(treeDir, path) === void 0) return {};
|
|
1759
1914
|
const href = finder.testHref(repository, head, path, line ?? 1);
|
|
1760
1915
|
return href !== null && href.length <= CHECK_ITEM_HREF_MAX_LENGTH && /^https:\/\/\S+$/.test(href) ? { href } : {};
|
|
1761
1916
|
};
|
|
1762
|
-
const items = wholeItems({ answer: merged, commit: head, treeRoot: JUDGE_TREE, place, ownTree, patch: diff, clean: cleanReason });
|
|
1917
|
+
const items = wholeItems({ answer: merged, commit: head, treeRoot: JUDGE_TREE, place, ownTree, patch: diff, clean: cleanReason, reviewers: answers.length });
|
|
1763
1918
|
const unreviewed = unreviewedItem(changed, merged.reviewed, head);
|
|
1764
1919
|
const record2 = {
|
|
1765
1920
|
...reviewRecord({
|
|
@@ -1772,12 +1927,13 @@ async function runReviewJob(input) {
|
|
|
1772
1927
|
seconds: run.end.usage?.durationMs === void 0 ? run.seconds : run.end.usage.durationMs / 1e3,
|
|
1773
1928
|
...run.end.usage?.costUsd === void 0 ? {} : { costUsd: run.end.usage.costUsd },
|
|
1774
1929
|
// A reviewer that stopped early or wrote no answer proves nothing about a problem that it did not report.
|
|
1775
|
-
answered: run.
|
|
1930
|
+
answered: parseReviewAnswer(run.text)?.ok === true && run.end.finished
|
|
1776
1931
|
})),
|
|
1777
1932
|
excerptOf: (path, line) => problemExcerpt(treeFileText(treeDir, path), line),
|
|
1778
1933
|
clean: cleanReason
|
|
1779
1934
|
}),
|
|
1780
|
-
instructions: { cliVersion: deps.cliVersion, sha256: instructions.sha256 }
|
|
1935
|
+
instructions: { cliVersion: deps.cliVersion, sha256: instructions.sha256 },
|
|
1936
|
+
consolidation: consolidated.record
|
|
1781
1937
|
};
|
|
1782
1938
|
if (input.ending()) return { kind: "ended" };
|
|
1783
1939
|
const listed = unreviewed === void 0 ? items : [...items, unreviewed];
|
|
@@ -1791,6 +1947,44 @@ async function runReviewJob(input) {
|
|
|
1791
1947
|
await reportCodeReview(config, job, { result: "reviewed", reason: "reviewed", commit: head, problems, review: record2 }, deps);
|
|
1792
1948
|
log.line(`${tag} code review done: ${problems} ${problems === 1 ? "problem" : "problems"}`);
|
|
1793
1949
|
return { kind: "reviewed", problems };
|
|
1950
|
+
async function consolidate(input2) {
|
|
1951
|
+
const unchanged = (result2, reason) => {
|
|
1952
|
+
log.line(`${tag} the problems were not consolidated: ${reason}`);
|
|
1953
|
+
const items2 = input2.fresh.map((entry) => ({ ...entry, severity: severityOf(entry.kind) }));
|
|
1954
|
+
return { items: items2, record: { result: result2, reason: oneLineReason(cleanReason(reason))?.slice(0, CONSOLIDATION_REASON_MAX) ?? result2 } };
|
|
1955
|
+
};
|
|
1956
|
+
if (!shouldConsolidate(input2.reviewers, input2.fresh.length)) return unchanged("skipped", input2.fresh.length === 0 ? "no reviewer reported a new problem" : "one reviewer reported one problem");
|
|
1957
|
+
if (instructions.consolidation === void 0) return unchanged("skipped", `this CLI's ${REVIEW_SKILL} skill holds no consolidation instructions`);
|
|
1958
|
+
try {
|
|
1959
|
+
return await runPass(instructions.consolidation);
|
|
1960
|
+
} catch (err) {
|
|
1961
|
+
return unchanged("failed", `the consolidator could not be run: ${describeCallFailure(err)}`);
|
|
1962
|
+
}
|
|
1963
|
+
async function runPass(text2) {
|
|
1964
|
+
const answer = `${JUDGE_DIR}/${CONSOLIDATION_ANSWER}`;
|
|
1965
|
+
const run = await reviewSideBySide({
|
|
1966
|
+
environment,
|
|
1967
|
+
files: { ...files, [CONSOLIDATION_INPUT]: consolidationInput(input2.fresh, input2.names) },
|
|
1968
|
+
tree: treeDir,
|
|
1969
|
+
runs: [{ territory: { name: CONSOLIDATOR, text: "" }, answerName: CONSOLIDATION_ANSWER, logName: `review-${CONSOLIDATOR}.log`, prompt: consolidationProtocol(consolidationBrief(text2, instructions.brief), answer) }],
|
|
1970
|
+
credential,
|
|
1971
|
+
limitMinutes,
|
|
1972
|
+
minutes,
|
|
1973
|
+
jobDir: jobDir2,
|
|
1974
|
+
deps,
|
|
1975
|
+
tag
|
|
1976
|
+
});
|
|
1977
|
+
if (!run.ok) return unchanged("failed", run.reason);
|
|
1978
|
+
const { end, text: written } = run.runs[0];
|
|
1979
|
+
if (!end.finished) return unchanged("failed", end.reason);
|
|
1980
|
+
const read = readConsolidation(written, input2.fresh, known, inChange);
|
|
1981
|
+
if (!read.ok) return unchanged("failed", read.reason);
|
|
1982
|
+
for (const note of read.notes) log.line(`${tag} consolidation: ${note}`);
|
|
1983
|
+
for (const drop of read.dropped) log.line(`${tag} consolidation dropped ${JSON.stringify(drop.id)} (${drop.reviewers.join(", ") || "no reviewer"}): ${drop.why}${drop.of === void 0 ? "" : ` of ${drop.of}`}${drop.reason === void 0 ? "" : `: ${oneLineReason(cleanReason(drop.reason)) ?? ""}`}`);
|
|
1984
|
+
log.line(`${tag} consolidation kept ${read.items.length} of ${input2.fresh.length} new ${input2.fresh.length === 1 ? "problem" : "problems"}`);
|
|
1985
|
+
return { items: read.items, record: { result: "consolidated" } };
|
|
1986
|
+
}
|
|
1987
|
+
}
|
|
1794
1988
|
}
|
|
1795
1989
|
}
|
|
1796
1990
|
function withCommit(items, commit, result) {
|
|
@@ -1804,13 +1998,12 @@ async function reviewSideBySide(input) {
|
|
|
1804
1998
|
} catch (err) {
|
|
1805
1999
|
return { ok: false, reason: `the review could not be prepared: ${describeCallFailure(err)}` };
|
|
1806
2000
|
}
|
|
1807
|
-
const started = input.runs.map((territory,
|
|
1808
|
-
const answerName = index === 0 ? "items.json" : `items-${territory.name}.json`;
|
|
2001
|
+
const started = input.runs.map(({ territory, prompt, answerName, logName }) => {
|
|
1809
2002
|
const answer = `${JUDGE_DIR}/${answerName}`;
|
|
1810
|
-
const command = judgeCommand({ brief:
|
|
2003
|
+
const command = judgeCommand({ brief: prompt, credential: input.credential, effort: REVIEW_EFFORT, answer }, deps.runtime.agents);
|
|
1811
2004
|
const began = now().getTime();
|
|
1812
2005
|
const run = { territory, answerName, began, seconds: void 0, outcome: void 0 };
|
|
1813
|
-
const settled = environment.run(command, { logPath: join(input.jobDir,
|
|
2006
|
+
const settled = environment.run(command, { logPath: join(input.jobDir, logName) }).then(
|
|
1814
2007
|
(result) => result,
|
|
1815
2008
|
(err) => err instanceof Error ? err : new Error(String(err))
|
|
1816
2009
|
);
|
|
@@ -1830,7 +2023,7 @@ async function reviewSideBySide(input) {
|
|
|
1830
2023
|
const answers = await Promise.all(
|
|
1831
2024
|
started.map(async ({ run }) => {
|
|
1832
2025
|
try {
|
|
1833
|
-
return
|
|
2026
|
+
return await environment.readItems(run.answerName);
|
|
1834
2027
|
} catch (err) {
|
|
1835
2028
|
deps.log.error(`${tag} the ${run.territory.name} review's answer could not be read: ${describeCallFailure(err)}`);
|
|
1836
2029
|
return void 0;
|
|
@@ -1847,7 +2040,7 @@ async function reviewSideBySide(input) {
|
|
|
1847
2040
|
const outcome = run.outcome;
|
|
1848
2041
|
if (outcome instanceof Error) deps.log.error(`${tag} the ${run.territory.name} review could not be run: ${describeCallFailure(outcome)}`);
|
|
1849
2042
|
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 };
|
|
1850
|
-
return { territory: run.territory, end: readReviewerEnd(ran, input.minutes, deps.runtime.agents),
|
|
2043
|
+
return { territory: run.territory, end: readReviewerEnd(ran, input.minutes, deps.runtime.agents), text: answers[index], seconds: run.seconds ?? (now().getTime() - run.began) / 1e3 };
|
|
1851
2044
|
})
|
|
1852
2045
|
};
|
|
1853
2046
|
}
|
|
@@ -1915,7 +2108,7 @@ function startWaiting(ports) {
|
|
|
1915
2108
|
return { stop: () => controller.abort() };
|
|
1916
2109
|
}
|
|
1917
2110
|
function linuxSignalName(number) {
|
|
1918
|
-
const
|
|
2111
|
+
const names = {
|
|
1919
2112
|
1: "SIGHUP",
|
|
1920
2113
|
2: "SIGINT",
|
|
1921
2114
|
3: "SIGQUIT",
|
|
@@ -1948,7 +2141,7 @@ function linuxSignalName(number) {
|
|
|
1948
2141
|
30: "SIGPWR",
|
|
1949
2142
|
31: "SIGSYS"
|
|
1950
2143
|
};
|
|
1951
|
-
return
|
|
2144
|
+
return names[number];
|
|
1952
2145
|
}
|
|
1953
2146
|
function hostSignalName(number) {
|
|
1954
2147
|
return Object.entries(constants.signals).find(([, value]) => value === number)?.[0];
|
|
@@ -2186,12 +2379,12 @@ async function sendTickHeartbeat(state, workRequest, wake2 = false) {
|
|
|
2186
2379
|
workRequest: next,
|
|
2187
2380
|
lastUpdate: readLastUpdate(state.config.configPath),
|
|
2188
2381
|
lowDisk: state.lowDisk,
|
|
2189
|
-
blocked: state.blocked
|
|
2382
|
+
blocked: state.blocked,
|
|
2190
2383
|
state: hostState({
|
|
2191
2384
|
draining: state.draining === true,
|
|
2192
2385
|
restarting: state.restarting === true,
|
|
2193
2386
|
holdingForUpdate: state.holdingForUpdate === true,
|
|
2194
|
-
blocked:
|
|
2387
|
+
blocked: state.blocked !== void 0,
|
|
2195
2388
|
lowDisk: state.lowDisk !== void 0
|
|
2196
2389
|
}),
|
|
2197
2390
|
// Left out unless a draining runner has builds to wait on, so the gateway stores null.
|
|
@@ -2453,50 +2646,11 @@ function holdAfterProvisionRetry(state) {
|
|
|
2453
2646
|
logOf(state).line("taking work again: the wait after a provision failure that can clear by itself is over");
|
|
2454
2647
|
return false;
|
|
2455
2648
|
}
|
|
2456
|
-
function holdWithoutRoomForLarge(state) {
|
|
2457
|
-
if (state.config.managed !== true) return false;
|
|
2458
|
-
if (isBuiltinSandbox(state.config.hooks.provision)) return false;
|
|
2459
|
-
const probes = {
|
|
2460
|
-
...realBlockedProbes(),
|
|
2461
|
-
...state.deps.container?.hostEnv === void 0 ? {} : { env: state.deps.container.hostEnv },
|
|
2462
|
-
...state.deps.blocked
|
|
2463
|
-
};
|
|
2464
|
-
let runningMemoryBytes = 0;
|
|
2465
|
-
let runningDiskBytes = 0;
|
|
2466
|
-
let heldDiskBytes = 0;
|
|
2467
|
-
for (const active of state.jobs.values()) {
|
|
2468
|
-
const microvm = active.job?.microvm;
|
|
2469
|
-
runningMemoryBytes += microvm?.limits?.memoryBytes ?? largeBuildMemoryBytes();
|
|
2470
|
-
runningDiskBytes += microvm?.limits?.diskBytes ?? LARGE_BUILD_DISK_BYTES;
|
|
2471
|
-
if (microvm?.buildDisk !== void 0) heldDiskBytes += (state.deps.allocatedBytes ?? allocatedBytes)(microvm.buildDisk);
|
|
2472
|
-
}
|
|
2473
|
-
const room = checkManagedRoom({
|
|
2474
|
-
runningMemoryBytes,
|
|
2475
|
-
totalMemoryBytes: probes.totalMemoryBytes(),
|
|
2476
|
-
sliceBytes: sliceMemoryOf(probes.env),
|
|
2477
|
-
freeDiskBytes: (state.deps.freeBytes ?? freeBytes)(runnerDir(state.config.configPath)),
|
|
2478
|
-
heldDiskBytes,
|
|
2479
|
-
runningDiskBytes
|
|
2480
|
-
});
|
|
2481
|
-
const log = logOf(state);
|
|
2482
|
-
if (!room.fits) {
|
|
2483
|
-
if (state.noRoom !== room.resource) log.line(`holding off new work: ${room.reason} \xB7 claiming again once a build ends`);
|
|
2484
|
-
state.noRoom = room.resource;
|
|
2485
|
-
state.noRoomEmpty = state.jobs.size === 0 ? { reason: `no room for one Large build: ${room.reason}` } : void 0;
|
|
2486
|
-
return true;
|
|
2487
|
-
}
|
|
2488
|
-
state.noRoomEmpty = void 0;
|
|
2489
|
-
if (state.noRoom !== void 0) {
|
|
2490
|
-
state.noRoom = void 0;
|
|
2491
|
-
log.line("a Large build fits again \xB7 taking work");
|
|
2492
|
-
}
|
|
2493
|
-
return false;
|
|
2494
|
-
}
|
|
2495
2649
|
async function housekeepingDockerOf(state) {
|
|
2496
2650
|
const injected = state.deps.housekeeping ?? {};
|
|
2497
|
-
const
|
|
2651
|
+
const names = { run: injected.run, runnerId: runnerLabelValue(state.config.configPath), builder: builderName(state.config.configPath) };
|
|
2498
2652
|
const hostBuilder = keepsHostBuilder(state.config, state.deps.blocked?.builderDiskPinned);
|
|
2499
|
-
return injected.docker ?? (hostBuilder ? createHousekeepingDocker(
|
|
2653
|
+
return injected.docker ?? (hostBuilder ? createHousekeepingDocker(names) : await housekeepingDockerIfReachable(names));
|
|
2500
2654
|
}
|
|
2501
2655
|
async function freeDiskFromItemDisks(state, readFree) {
|
|
2502
2656
|
const minimum = state.config.housekeeping?.minFreeDisk ?? 0;
|
|
@@ -2521,15 +2675,15 @@ async function freeDiskFromItemDisks(state, readFree) {
|
|
|
2521
2675
|
}
|
|
2522
2676
|
async function freeDiskFromSavedStates(state, root, readFree) {
|
|
2523
2677
|
const dir = savedStatesDir(root);
|
|
2524
|
-
const records = readRecords(dir).filter((record2) => record2.complete);
|
|
2678
|
+
const records = readRecords(dir).filter((record2) => record2.complete && holdsHostDisk(record2));
|
|
2525
2679
|
if (records.length === 0) return readFree();
|
|
2526
2680
|
const log = logOf(state);
|
|
2527
2681
|
const minimum = state.config.housekeeping?.minFreeDisk ?? 0;
|
|
2528
2682
|
try {
|
|
2529
2683
|
state.deps.housekeeping ??= {};
|
|
2530
|
-
const
|
|
2684
|
+
const names = { run: state.deps.housekeeping.run, runnerId: runnerLabelValue(state.config.configPath), builder: builderName(state.config.configPath) };
|
|
2531
2685
|
const hostBuilder = keepsHostBuilder(state.config, state.deps.blocked?.builderDiskPinned);
|
|
2532
|
-
const docker = state.deps.housekeeping.docker ?? (hostBuilder ? createHousekeepingDocker(
|
|
2686
|
+
const docker = state.deps.housekeeping.docker ?? (hostBuilder ? createHousekeepingDocker(names) : await housekeepingDockerIfReachable(names));
|
|
2533
2687
|
await removeOldestUntil({
|
|
2534
2688
|
records,
|
|
2535
2689
|
deps: {
|
|
@@ -2548,11 +2702,11 @@ async function freeDiskFromSavedStates(state, root, readFree) {
|
|
|
2548
2702
|
return readFree();
|
|
2549
2703
|
}
|
|
2550
2704
|
function recordPendingUpdate(state, record2) {
|
|
2551
|
-
const
|
|
2552
|
-
if (state.updateRecord ===
|
|
2705
|
+
const text2 = record2 === void 0 ? "none" : JSON.stringify(record2);
|
|
2706
|
+
if (state.updateRecord === text2) return;
|
|
2553
2707
|
try {
|
|
2554
2708
|
writePendingUpdate(runnerDir(state.config.configPath), record2);
|
|
2555
|
-
state.updateRecord =
|
|
2709
|
+
state.updateRecord = text2;
|
|
2556
2710
|
reportRepeating(state, "the update-pending.json record", void 0);
|
|
2557
2711
|
} catch (err) {
|
|
2558
2712
|
const code = err.code;
|
|
@@ -2857,8 +3011,7 @@ async function fleetHeld(state) {
|
|
|
2857
3011
|
state.holdingForUpdate = true;
|
|
2858
3012
|
return true;
|
|
2859
3013
|
}
|
|
2860
|
-
|
|
2861
|
-
if (holdWhenBlocked(state, jailer)) return true;
|
|
3014
|
+
if (holdWhenBlocked(state)) return true;
|
|
2862
3015
|
if (await holdOffForDisk(state)) return true;
|
|
2863
3016
|
return holdAfterProvisionRetry(state);
|
|
2864
3017
|
}
|
|
@@ -2866,26 +3019,6 @@ var CLAIM_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i
|
|
|
2866
3019
|
function fleetClaimIds(ids) {
|
|
2867
3020
|
return ids.filter((id) => CLAIM_ID.test(id));
|
|
2868
3021
|
}
|
|
2869
|
-
function fleetFactsOf(state) {
|
|
2870
|
-
const probes = {
|
|
2871
|
-
...realBlockedProbes(),
|
|
2872
|
-
...state.deps.container?.hostEnv === void 0 ? {} : { env: state.deps.container.hostEnv },
|
|
2873
|
-
...state.deps.blocked
|
|
2874
|
-
};
|
|
2875
|
-
let heldDiskBytes = 0;
|
|
2876
|
-
for (const active of state.jobs.values()) {
|
|
2877
|
-
const buildDisk = active.job?.microvm?.buildDisk;
|
|
2878
|
-
if (buildDisk !== void 0) heldDiskBytes += (state.deps.allocatedBytes ?? allocatedBytes)(buildDisk);
|
|
2879
|
-
}
|
|
2880
|
-
const sliceBytes = sliceMemoryOf(probes.env);
|
|
2881
|
-
return {
|
|
2882
|
-
totalMemoryBytes: probes.totalMemoryBytes(),
|
|
2883
|
-
...sliceBytes === void 0 ? {} : { sliceBytes },
|
|
2884
|
-
cpus: (state.deps.fleet?.cpus ?? (() => usableCpus().length))(),
|
|
2885
|
-
freeDiskBytes: (state.deps.freeBytes ?? freeBytes)(runnerDir(state.config.configPath)),
|
|
2886
|
-
heldDiskBytes
|
|
2887
|
-
};
|
|
2888
|
-
}
|
|
2889
3022
|
function fleetPortsOf(state) {
|
|
2890
3023
|
return {
|
|
2891
3024
|
config: () => state.config,
|
|
@@ -2898,8 +3031,6 @@ function fleetPortsOf(state) {
|
|
|
2898
3031
|
draining: () => state.draining === true,
|
|
2899
3032
|
jobs: () => [...state.jobs.values()].map((active) => active.job.size === void 0 ? {} : { size: active.job.size }),
|
|
2900
3033
|
claims: () => fleetClaimIds([...state.jobs.values()].map((active) => active.job.claimId)),
|
|
2901
|
-
facts: () => fleetFactsOf(state),
|
|
2902
|
-
images: () => heldImages(state.config.configPath),
|
|
2903
3034
|
disks: () => heldItemDisks(state.config.configPath),
|
|
2904
3035
|
applyStops: (stops) => applyStops(state, stops),
|
|
2905
3036
|
considerVersion: (named) => considerNamedVersion(state, named),
|
|
@@ -2953,16 +3084,11 @@ function imageBuilderState(state) {
|
|
|
2953
3084
|
if (result === void 0) return "unknown";
|
|
2954
3085
|
return result.ok ? "usable" : { problem: result.problem };
|
|
2955
3086
|
}
|
|
2956
|
-
|
|
2957
|
-
const probe = await runtimeOf(state).vm.helper.probe();
|
|
2958
|
-
return probe.ok ? "usable" : { problem: probe.detail };
|
|
2959
|
-
}
|
|
2960
|
-
function holdWhenBlocked(state, jailer) {
|
|
3087
|
+
function holdWhenBlocked(state) {
|
|
2961
3088
|
const probes = {
|
|
2962
3089
|
...realBlockedProbes(),
|
|
2963
3090
|
...state.deps.container?.hostEnv === void 0 ? {} : { env: state.deps.container.hostEnv },
|
|
2964
3091
|
...state.deps.blocked?.imageBuilder === void 0 ? { imageBuilder: imageBuilderState(state) } : {},
|
|
2965
|
-
...jailer === void 0 ? {} : { jailer },
|
|
2966
3092
|
inImage: state.deps.image !== void 0,
|
|
2967
3093
|
...state.deps.blocked
|
|
2968
3094
|
};
|
|
@@ -3045,9 +3171,9 @@ async function housekeepingPass(state) {
|
|
|
3045
3171
|
try {
|
|
3046
3172
|
state.deps.housekeeping ??= {};
|
|
3047
3173
|
const hostBuilder = keepsHostBuilder(state.config, state.deps.blocked?.builderDiskPinned);
|
|
3048
|
-
const
|
|
3174
|
+
const names = { run: state.deps.housekeeping.run, runnerId: runnerLabelValue(state.config.configPath), builder: builderName(state.config.configPath) };
|
|
3049
3175
|
const own = isBuiltinSandbox(state.config.hooks.provision);
|
|
3050
|
-
const docker = own ? void 0 : state.deps.housekeeping.docker ?? (hostBuilder ? createHousekeepingDocker(
|
|
3176
|
+
const docker = own ? void 0 : state.deps.housekeeping.docker ?? (hostBuilder ? createHousekeepingDocker(names) : await housekeepingDockerIfReachable(names));
|
|
3051
3177
|
if (hostBuilder && docker !== void 0) state.deps.housekeeping.docker ??= docker;
|
|
3052
3178
|
const result = await runHousekeeping({
|
|
3053
3179
|
configPath: state.config.configPath,
|
|
@@ -3086,10 +3212,8 @@ async function runTick(state) {
|
|
|
3086
3212
|
state.holdingForUpdate = true;
|
|
3087
3213
|
return;
|
|
3088
3214
|
}
|
|
3089
|
-
|
|
3090
|
-
if (holdWhenBlocked(state, jailer)) return;
|
|
3215
|
+
if (holdWhenBlocked(state)) return;
|
|
3091
3216
|
if (await holdOffForDisk(state)) return;
|
|
3092
|
-
if (holdWithoutRoomForLarge(state)) return;
|
|
3093
3217
|
if (holdAfterSandboxRefusal(state)) return;
|
|
3094
3218
|
if (holdAfterProvisionRetry(state)) return;
|
|
3095
3219
|
const log = logOf(state);
|
|
@@ -3131,7 +3255,6 @@ async function runTick(state) {
|
|
|
3131
3255
|
filtered++;
|
|
3132
3256
|
continue;
|
|
3133
3257
|
}
|
|
3134
|
-
if (holdWithoutRoomForLarge(state)) return;
|
|
3135
3258
|
if (holdAfterSandboxRefusal(state)) return;
|
|
3136
3259
|
if (holdAfterProvisionRetry(state)) return;
|
|
3137
3260
|
const attempt = await tryClaimAndStart(state, item, queue);
|
|
@@ -3238,7 +3361,7 @@ var CLAIM_REFUSAL_CODES = new Set(
|
|
|
3238
3361
|
"pull_request_from_fork pull_request_on_default_branch pull_request_ambiguous pull_request_repository_not_connected repository_not_reachable branch_claimed_elsewhere".split(" ")
|
|
3239
3362
|
);
|
|
3240
3363
|
async function tryClaimAndStart(state, item, queue) {
|
|
3241
|
-
const { postJson: postJson2 } = await import('./work-cmd-
|
|
3364
|
+
const { postJson: postJson2 } = await import('./work-cmd-X55AAJG2.js');
|
|
3242
3365
|
const log = logOf(state);
|
|
3243
3366
|
const hostKey = await loadHostKey(state.config.configPath);
|
|
3244
3367
|
const claim = await retrySend(
|
|
@@ -3453,7 +3576,7 @@ async function prepareSession(state, active, item, queue, tag) {
|
|
|
3453
3576
|
continueSession: job.continueSession === true,
|
|
3454
3577
|
builtin,
|
|
3455
3578
|
job,
|
|
3456
|
-
requireScrubNote: state.config.
|
|
3579
|
+
requireScrubNote: state.config.fleet === true,
|
|
3457
3580
|
restore: async ({ dir, meta }) => {
|
|
3458
3581
|
if (job.microvm !== void 0) await restoreSessionIntoMicroVm(runtimeOf(state), job.microvm, dir, meta, job);
|
|
3459
3582
|
else if (job.container !== void 0) await restoreSessionIntoContainer(runtimeOf(state), job.container, dir, meta, job);
|
|
@@ -3557,13 +3680,13 @@ async function startJob(state, item, queue, claimId, itemKey, branch, identity,
|
|
|
3557
3680
|
return;
|
|
3558
3681
|
}
|
|
3559
3682
|
if (active.ending) return;
|
|
3560
|
-
const credentialProblem = state.config.
|
|
3683
|
+
const credentialProblem = state.config.fleet === true ? void 0 : jobCredentialProblem(jobAgent(active.job, state.deps.agents), process.env, state.deps.agents);
|
|
3561
3684
|
if (credentialProblem !== void 0) {
|
|
3562
3685
|
log.error(`${tag} ${credentialProblem} \xB7 ending job as failed`);
|
|
3563
3686
|
await endJob(state, active, "failed", { stage: "provision", reason: credentialProblem });
|
|
3564
3687
|
return;
|
|
3565
3688
|
}
|
|
3566
|
-
if (state.config.
|
|
3689
|
+
if (state.config.fleet === true) {
|
|
3567
3690
|
const fetched = await fetchManagedClaudeKey(claimCalls(state.config, active.job), claimItem(state.config, active.job), { fetchImpl: state.deps.fetchImpl, now: state.deps.now, sleep: state.deps.sleep });
|
|
3568
3691
|
if (active.ending) return;
|
|
3569
3692
|
if (!fetched.ok) {
|
|
@@ -4554,7 +4677,7 @@ async function adoptTrackedBuilds(state, jobsDirPath) {
|
|
|
4554
4677
|
async function holdManagedAgain(state, dirPath, job, tag) {
|
|
4555
4678
|
const config = state.config;
|
|
4556
4679
|
const log = logOf(state);
|
|
4557
|
-
if (config.
|
|
4680
|
+
if (config.fleet !== true) return void 0;
|
|
4558
4681
|
const fetched = await fetchManagedClaudeKey(claimCalls(config, job), claimItem(config, job), {
|
|
4559
4682
|
fetchImpl: state.deps.fetchImpl,
|
|
4560
4683
|
now: state.deps.now,
|
|
@@ -4869,7 +4992,7 @@ async function startRunner(configPath, deps, startup) {
|
|
|
4869
4992
|
check: update.check ? () => update.check(configPath) : async () => {
|
|
4870
4993
|
const held = runnerAgents(deps.agents).flatMap((agent) => heldAgentCredential(agent.descriptor.id) ?? []);
|
|
4871
4994
|
const env = { ...process.env, ...Object.fromEntries(held.map((credential) => [credential.variable, credential.value])) };
|
|
4872
|
-
return (await import('./check-
|
|
4995
|
+
return (await import('./check-Z6GAY2C4.js')).runRunnerCheck(configPath, { fetchImpl: deps.fetchImpl, env });
|
|
4873
4996
|
},
|
|
4874
4997
|
now: () => (deps.now ?? (() => /* @__PURE__ */ new Date()))().getTime(),
|
|
4875
4998
|
log
|