@kitman-sh/cli 0.13.17 → 0.13.18

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 (27) hide show
  1. package/dist/{chunk-pbmadbfm.js → chunk-03hvwd6m.js} +14 -8
  2. package/dist/{chunk-ahvpwkyk.js → chunk-1cbnvby8.js} +2 -2
  3. package/dist/{chunk-4yca7e7x.js → chunk-39m1xtbk.js} +239 -100
  4. package/dist/{chunk-b5edh1jq.js → chunk-7m71m106.js} +32 -32
  5. package/dist/{chunk-8nzsyz74.js → chunk-827sgh31.js} +1 -1
  6. package/dist/{chunk-cbf0q15q.js → chunk-84xks8tn.js} +60 -14
  7. package/dist/{chunk-1cr225aq.js → chunk-940cc29s.js} +5 -5
  8. package/dist/{chunk-67xn3yer.js → chunk-a7ds2jqf.js} +10 -10
  9. package/dist/{chunk-80f0p6s7.js → chunk-bc8ytp0y.js} +308 -284
  10. package/dist/{chunk-syhs23yk.js → chunk-be2jf9m3.js} +10 -10
  11. package/dist/{chunk-efyrm6bv.js → chunk-dc0pcs3z.js} +1 -1
  12. package/dist/{chunk-643pxp2k.js → chunk-frjsv0ng.js} +4 -4
  13. package/dist/{chunk-g7ysb6ca.js → chunk-fv2v1sdc.js} +18 -18
  14. package/dist/{chunk-24h0y27w.js → chunk-gq7y5v3e.js} +1 -1
  15. package/dist/{chunk-0vv8cbye.js → chunk-gqy5shhk.js} +21 -21
  16. package/dist/{chunk-mmd7mjv0.js → chunk-gy9rf14f.js} +3 -3
  17. package/dist/{chunk-x20t7xy8.js → chunk-hakqpy8z.js} +26 -17
  18. package/dist/{chunk-pxvd8w2v.js → chunk-q5w3v4k1.js} +1 -1
  19. package/dist/{chunk-q4ra17vf.js → chunk-r1s1dcy0.js} +3 -3
  20. package/dist/{chunk-zcpnmgwb.js → chunk-rp4tn60z.js} +7 -7
  21. package/dist/{chunk-pvsg1ppc.js → chunk-vxc2cg5f.js} +9 -9
  22. package/dist/{chunk-ggmwpwhf.js → chunk-y1krmnbv.js} +2 -2
  23. package/dist/{chunk-pjq9bf3w.js → chunk-ynvzbgms.js} +4 -4
  24. package/dist/{chunk-gasqek3p.js → chunk-z1rve2hk.js} +6 -6
  25. package/dist/{chunk-zgraq2y3.js → chunk-zw3gf6r5.js} +28 -70
  26. package/dist/index.js +4 -4
  27. package/package.json +1 -1
@@ -75,10 +75,14 @@ import {
75
75
  toEquivalence,
76
76
  toCodecJson,
77
77
  Json
78
- } from "./chunk-zgraq2y3.js";
78
+ } from "./chunk-zw3gf6r5.js";
79
+ import {
80
+ runForEach,
81
+ FileSystem
82
+ } from "./chunk-hakqpy8z.js";
79
83
  import {
80
84
  guard
81
- } from "./chunk-pxvd8w2v.js";
85
+ } from "./chunk-q5w3v4k1.js";
82
86
  import {
83
87
  currentTimeMillis,
84
88
  WebCrypto,
@@ -105,11 +109,7 @@ import {
105
109
  KitDigest,
106
110
  KitSetup,
107
111
  RunnerRpcError
108
- } from "./chunk-80f0p6s7.js";
109
- import {
110
- runForEach,
111
- FileSystem
112
- } from "./chunk-x20t7xy8.js";
112
+ } from "./chunk-bc8ytp0y.js";
113
113
 
114
114
  // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/crypto/internal/webCrypto.js
115
115
  var subtleUnavailable = () => new Error("crypto.subtle is unavailable; browsers expose it only in secure contexts");
@@ -500,7 +500,13 @@ var EvidenceCheck = Struct({
500
500
  failedTests: optionalKey(ArraySchema(String4)),
501
501
  suggested: optionalKey(Boolean2),
502
502
  skippedSinceBaseline: optionalKey(ArraySchema(String4)),
503
- newNotRun: optionalKey(ArraySchema(String4))
503
+ newNotRun: optionalKey(ArraySchema(String4)),
504
+ environmentFailure: optionalKey(Struct({
505
+ failedTests: optionalKey(ArraySchema(String4)),
506
+ exitCode: optionalKey(Int),
507
+ outputTail: optionalKey(String4),
508
+ retryFailedTests: optionalKey(ArraySchema(String4))
509
+ }))
504
510
  });
505
511
  var VerifyResult = Struct({
506
512
  revision: String4,
@@ -14,8 +14,8 @@ import {
14
14
  writeSrtSettings2,
15
15
  srtStepArgv2,
16
16
  srtArgv2
17
- } from "./chunk-x20t7xy8.js";
18
- import"./chunk-zgraq2y3.js";
17
+ } from "./chunk-hakqpy8z.js";
18
+ import"./chunk-zw3gf6r5.js";
19
19
  export {
20
20
  compiled2 as compiled,
21
21
  harnessesUnsupportedInSrt2 as harnessesUnsupportedInSrt,
@@ -41,7 +41,7 @@ import {
41
41
  isFailure2,
42
42
  hasInterrupts,
43
43
  makeUnsafe5,
44
- make15,
44
+ make16,
45
45
  _await,
46
46
  fail5,
47
47
  isDoneUnsafe,
@@ -168,12 +168,55 @@ import {
168
168
  decodeJsonStringSync,
169
169
  encodeUnknownJsonStringSync,
170
170
  storable
171
- } from "./chunk-zgraq2y3.js";
171
+ } from "./chunk-zw3gf6r5.js";
172
+ import {
173
+ join,
174
+ interrupt,
175
+ unbounded,
176
+ publishUnsafe,
177
+ unbounded2,
178
+ offer,
179
+ makeUnsafe3,
180
+ make11,
181
+ fromQueue,
182
+ fromPubSub,
183
+ map2,
184
+ filter,
185
+ take2,
186
+ decodeText,
187
+ encodeText,
188
+ splitLines,
189
+ run,
190
+ runCollect,
191
+ runHead,
192
+ runForEach,
193
+ FileSystem,
194
+ Path,
195
+ embeddedFile,
196
+ extractEmbeddedFile,
197
+ optionalEnv,
198
+ operatorConfigHome,
199
+ tempDirectoryScoped,
200
+ harnessesUnsupportedInSrt2,
201
+ compiled2,
202
+ pinnedSrtCommand2,
203
+ pinnedSrtStepCommand2,
204
+ runSrtCli2,
205
+ kitmanCacheDirectory2,
206
+ srtSettings2,
207
+ srtCacheEnvironment2,
208
+ srtInheritedEnv2,
209
+ inheritedEnvironment2,
210
+ withOnlyEnvironment2,
211
+ writeSrtSettings2,
212
+ srtStepArgv2,
213
+ srtArgv2
214
+ } from "./chunk-hakqpy8z.js";
172
215
  import {
173
216
  Id,
174
217
  secretReference,
175
218
  secretPlaceholder
176
- } from "./chunk-pxvd8w2v.js";
219
+ } from "./chunk-q5w3v4k1.js";
177
220
  import {
178
221
  currentTimeMillis,
179
222
  SecureRandom,
@@ -196,10 +239,14 @@ import {
196
239
  programNetworkHosts,
197
240
  canonicalSha256,
198
241
  tokensSpent,
199
- reportedModelName,
200
242
  isTestReportName,
243
+ testDigest,
201
244
  failedTestOfLine,
245
+ printedNotReported,
246
+ failedTestsOf,
247
+ testOutcomes,
202
248
  checkTests,
249
+ reportedModelName,
203
250
  MeasureSample,
204
251
  catchUpPathLimit,
205
252
  createId,
@@ -248,51 +295,9 @@ import {
248
295
  assertHerdrRunnerCapability2,
249
296
  installCommand,
250
297
  checkServicesFile,
251
- checkServices
252
- } from "./chunk-80f0p6s7.js";
253
- import {
254
- join,
255
- interrupt,
256
- unbounded,
257
- publishUnsafe,
258
- unbounded2,
259
- offer,
260
- makeUnsafe3,
261
- make10,
262
- fromQueue,
263
- fromPubSub,
264
- map2,
265
- filter,
266
- take2,
267
- decodeText,
268
- encodeText,
269
- splitLines,
270
- run,
271
- runCollect,
272
- runHead,
273
- runForEach,
274
- FileSystem,
275
- Path,
276
- embeddedFile,
277
- extractEmbeddedFile,
278
- optionalEnv,
279
- operatorConfigHome,
280
- tempDirectoryScoped,
281
- harnessesUnsupportedInSrt2,
282
- compiled2,
283
- pinnedSrtCommand2,
284
- pinnedSrtStepCommand2,
285
- runSrtCli2,
286
- kitmanCacheDirectory2,
287
- srtSettings2,
288
- srtCacheEnvironment2,
289
- srtInheritedEnv2,
290
- inheritedEnvironment2,
291
- withOnlyEnvironment2,
292
- writeSrtSettings2,
293
- srtStepArgv2,
294
- srtArgv2
295
- } from "./chunk-x20t7xy8.js";
298
+ checkServices,
299
+ serviceChecks
300
+ } from "./chunk-bc8ytp0y.js";
296
301
  import {
297
302
  writeAgentEnvironmentConfigFile2,
298
303
  readManifestSkillPaths2,
@@ -308,8 +313,8 @@ import {
308
313
  applyAgentEnvironmentMaterialization2,
309
314
  isPathWithin2,
310
315
  skillIdentity2
311
- } from "./chunk-pvsg1ppc.js";
312
- import"./chunk-q4ra17vf.js";
316
+ } from "./chunk-vxc2cg5f.js";
317
+ import"./chunk-r1s1dcy0.js";
313
318
  import {
314
319
  egressAllowed,
315
320
  writeSecretRegistry,
@@ -319,7 +324,7 @@ import {
319
324
  secretFilter2,
320
325
  opaqueTunnelRefusal2,
321
326
  isOpaqueConnectReason2
322
- } from "./chunk-ggmwpwhf.js";
327
+ } from "./chunk-y1krmnbv.js";
323
328
  import {
324
329
  sliceBytes2,
325
330
  maxLineBytes2,
@@ -327,23 +332,23 @@ import {
327
332
  decodedOption2,
328
333
  decoded2,
329
334
  readOpencode2
330
- } from "./chunk-67xn3yer.js";
335
+ } from "./chunk-a7ds2jqf.js";
331
336
  import {
332
337
  uploadRunFile,
333
338
  programLease,
334
339
  rpcRunFiles,
335
340
  programHostsEnv,
336
341
  undeclaredHostsEnv
337
- } from "./chunk-pbmadbfm.js";
338
- import"./chunk-zcpnmgwb.js";
342
+ } from "./chunk-03hvwd6m.js";
343
+ import"./chunk-rp4tn60z.js";
339
344
  import {
340
345
  nextInt
341
- } from "./chunk-24h0y27w.js";
346
+ } from "./chunk-gq7y5v3e.js";
342
347
  import {
343
348
  ChildProcessSpawner,
344
- make2
345
- } from "./chunk-cbf0q15q.js";
346
- import"./chunk-1cr225aq.js";
349
+ make3
350
+ } from "./chunk-84xks8tn.js";
351
+ import"./chunk-940cc29s.js";
347
352
 
348
353
  // packages/core/src/sync-kit.ts
349
354
  import { createHash } from "crypto";
@@ -7085,7 +7090,7 @@ var codexAppServer = (binary = "codex") => (env) => gen(function* () {
7085
7090
  const input = yield* unbounded2();
7086
7091
  const pending = new Map;
7087
7092
  let lastId = 0;
7088
- const handle = yield* spawner.spawn(make2(binary, ["app-server"], {
7093
+ const handle = yield* spawner.spawn(make3(binary, ["app-server"], {
7089
7094
  cwd: env.home,
7090
7095
  extendEnv: true,
7091
7096
  env: { HOME: env.home, CODEX_HOME: env.codexHome },
@@ -7108,7 +7113,7 @@ var codexAppServer = (binary = "codex") => (env) => gen(function* () {
7108
7113
  return {
7109
7114
  request: (method, params) => gen(function* () {
7110
7115
  const id = ++lastId;
7111
- const deferred = yield* make15();
7116
+ const deferred = yield* make16();
7112
7117
  pending.set(id, deferred);
7113
7118
  yield* send({ id, method, params });
7114
7119
  return yield* _await(deferred).pipe(mapError2((error) => new CodexAppServerFailed({ reason: `${method}: ${error.message}` })));
@@ -7248,10 +7253,10 @@ var handshake = [
7248
7253
  `).join("");
7249
7254
  var kitmanMcpPreflight = (mcp) => gen(function* () {
7250
7255
  const spawner = yield* ChildProcessSpawner;
7251
- const server = yield* spawner.spawn(make2(mcp.command, [...mcp.args], {
7256
+ const server = yield* spawner.spawn(make3(mcp.command, [...mcp.args], {
7252
7257
  extendEnv: true,
7253
7258
  env: mcp.env,
7254
- stdin: { stream: make10(new TextEncoder().encode(handshake)), endOnDone: false },
7259
+ stdin: { stream: make11(new TextEncoder().encode(handshake)), endOnDone: false },
7255
7260
  stderr: "ignore"
7256
7261
  }));
7257
7262
  const reply = yield* server.stdout.pipe(decodeText, splitLines, map2((line) => getOrUndefined(decodeJsonStringOption(line))), filter((message) => isJsonObject(message) && message.id === 2), runHead);
@@ -7324,8 +7329,8 @@ var programProcessExecutor = (input) => (work) => gen(function* () {
7324
7329
  };
7325
7330
  const exitCode = sandbox === undefined ? yield* gen(function* () {
7326
7331
  const spawner = yield* ChildProcessSpawner;
7327
- const handle = yield* spawner.spawn(make2(input.bun ?? process.execPath, [file], {
7328
- stdin: make10(new TextEncoder().encode(stdin)),
7332
+ const handle = yield* spawner.spawn(make3(input.bun ?? process.execPath, [file], {
7333
+ stdin: make11(new TextEncoder().encode(stdin)),
7329
7334
  stdout: "inherit",
7330
7335
  stderr: "inherit",
7331
7336
  extendEnv: false,
@@ -7693,8 +7698,8 @@ var checkedTests = (filesDir, printed) => gen(function* () {
7693
7698
  const path = yield* Path;
7694
7699
  const names = (yield* regularFiles(filesDir)).filter(isTestReportName);
7695
7700
  const reports = yield* forEach(names, (name) => fs.readFileString(path.join(filesDir, name)).pipe(map8((text) => [text]), orElseSucceed(() => [])));
7696
- return checkTests(reports.flat(), printed);
7697
- }).pipe(orElseSucceed(() => checkTests([], printed)));
7701
+ return { tests: checkTests(reports.flat(), printed), statuses: testOutcomes(reports.flat()) };
7702
+ }).pipe(orElseSucceed(() => ({ tests: checkTests([], printed), statuses: testOutcomes([]) })));
7698
7703
 
7699
7704
  class ServicesUnavailable extends TaggedError("ServicesUnavailable") {
7700
7705
  get message() {
@@ -7890,34 +7895,39 @@ var printedFailures = (output) => gen(function* () {
7890
7895
  const fs = yield* FileSystem;
7891
7896
  return yield* fs.stream(output).pipe(decodeText, splitLines, map2(failedTestOfLine), filter((name) => name !== undefined), take2(failingLinesRead), runCollect);
7892
7897
  }).pipe(orElseSucceed(() => []));
7893
- var runChecks = (worktree, checks, tree, known, run, keeper, services) => gen(function* () {
7894
- const path = yield* Path;
7895
- const due = checks.filter((check) => !known.some((entry) => entry.tree === tree && entry.name === check.name && entry.command === check.command));
7896
- if (due.length === 0)
7897
- return [];
7898
- yield* installIn(worktree, run);
7898
+ var startedCheckPostgres = (worktree, services, run) => gen(function* () {
7899
7899
  const started = yield* checkoutPostgres(worktree, services);
7900
- const postgres = started === undefined ? undefined : yield* reachCheckPostgres(started, services, worktree, run);
7901
- return yield* forEach(due, (check) => gen(function* () {
7902
- const fs = yield* FileSystem;
7903
- const startedAt = yield* currentTimeMillis;
7904
- const filesDir = yield* tempDirectoryScoped(fs, { prefix: "kitman-check-files-" });
7905
- const output = path.join(yield* tempDirectoryScoped(fs, { prefix: "kitman-check-output-" }), "output");
7906
- const sink = yield* fs.open(output, { flag: "w" });
7907
- const docker = check.pipeline === true ? yield* pipelineDaemon(services, check.name) : undefined;
7908
- const ran = yield* run({
7909
- command: check.command,
7910
- cwd: path.join(worktree, check.workingDirectory ?? "."),
7911
- filesDir,
7912
- ...postgres === undefined ? undefined : { postgres },
7913
- ...docker === undefined ? undefined : { docker },
7914
- onOutput: (chunk) => sink.writeAll(chunk)
7915
- });
7916
- const durationMs = (yield* currentTimeMillis) - startedAt;
7917
- const printed = ran.exitCode === 0 ? [] : yield* printedFailures(output);
7918
- const { failedTests, ...tests } = yield* checkedTests(filesDir, printed);
7919
- const fileIds = keeper === undefined ? undefined : yield* keeper.keep({ check: check.name, prefix: keeper.prefix, output, filesDir });
7920
- return {
7900
+ return started === undefined ? undefined : yield* reachCheckPostgres(started, services, worktree, run);
7901
+ });
7902
+ var checksOnServices = (worktree) => gen(function* () {
7903
+ const fs = yield* FileSystem;
7904
+ const path = yield* Path;
7905
+ const file = path.join(worktree, checkServicesFile);
7906
+ return serviceChecks((yield* fs.exists(file)) ? yield* fs.readFileString(file) : undefined);
7907
+ }).pipe(orElseSucceed(() => []));
7908
+ var runCheck = (worktree, check, run, keeper, services, postgres) => gen(function* () {
7909
+ const fs = yield* FileSystem;
7910
+ const path = yield* Path;
7911
+ const startedAt = yield* currentTimeMillis;
7912
+ const filesDir = yield* tempDirectoryScoped(fs, { prefix: "kitman-check-files-" });
7913
+ const output = path.join(yield* tempDirectoryScoped(fs, { prefix: "kitman-check-output-" }), "output");
7914
+ const sink = yield* fs.open(output, { flag: "w" });
7915
+ const docker = check.pipeline === true ? yield* pipelineDaemon(services, check.name) : undefined;
7916
+ const ran = yield* run({
7917
+ command: check.command,
7918
+ cwd: path.join(worktree, check.workingDirectory ?? "."),
7919
+ filesDir,
7920
+ ...postgres === undefined ? undefined : { postgres },
7921
+ ...docker === undefined ? undefined : { docker },
7922
+ onOutput: (chunk) => sink.writeAll(chunk)
7923
+ });
7924
+ const durationMs = (yield* currentTimeMillis) - startedAt;
7925
+ const printed = ran.exitCode === 0 ? [] : yield* printedFailures(output);
7926
+ const { tests: checked, statuses } = yield* checkedTests(filesDir, printed);
7927
+ const { failedTests, ...tests } = checked;
7928
+ const fileIds = keeper === undefined ? undefined : yield* keeper.keep({ check: check.name, prefix: keeper.prefix, output, filesDir });
7929
+ return {
7930
+ evidence: {
7921
7931
  name: check.name,
7922
7932
  command: check.command,
7923
7933
  status: ran.exitCode === 0 ? "passed" : "failed",
@@ -7926,9 +7936,109 @@ var runChecks = (worktree, checks, tree, known, run, keeper, services) => gen(fu
7926
7936
  outputTail: redactedOutputTail(ran.output),
7927
7937
  ...fileIds === undefined ? undefined : { fileIds },
7928
7938
  tests: { ...tests, ...ran.exitCode === 0 || failedTests === undefined ? undefined : { failedTests } }
7929
- };
7930
- }).pipe(scoped));
7931
- });
7939
+ },
7940
+ statuses,
7941
+ printed,
7942
+ onPostgres: postgres !== undefined
7943
+ };
7944
+ }).pipe(scoped);
7945
+ var runChecks = (worktree, checks, tree, known, run, keeper, services) => gen(function* () {
7946
+ const due = checks.filter((check) => !known.some((entry) => entry.tree === tree && entry.name === check.name && entry.command === check.command));
7947
+ if (due.length === 0)
7948
+ return [];
7949
+ yield* installIn(worktree, run);
7950
+ const postgres = yield* startedCheckPostgres(worktree, services, run);
7951
+ return yield* forEach(due, (check) => runCheck(worktree, check, run, keeper, services, postgres));
7952
+ });
7953
+ var maxCheckFileIds = 51;
7954
+ var maxRanDigests = 1e5;
7955
+ var withStatus = (statuses, status) => [...statuses].flatMap(([id, is]) => is === status ? [id] : []);
7956
+ var failuresOf = (ran) => {
7957
+ const reported = withStatus(ran.statuses, "failed");
7958
+ return { reported, printed: printedNotReported(reported, ran.printed) };
7959
+ };
7960
+ var hasNone = (failures) => failures.reported.length === 0 && failures.printed.length === 0;
7961
+ var without = (failures, taken) => {
7962
+ const reported = new Set(taken.reported);
7963
+ const printed = new Set(taken.printed);
7964
+ return {
7965
+ reported: failures.reported.filter((id) => !reported.has(id)),
7966
+ printed: failures.printed.filter((name) => !printed.has(name))
7967
+ };
7968
+ };
7969
+ var passedIn = (ran, failures) => {
7970
+ const passed = withStatus(ran.statuses, "passed");
7971
+ const unmatched = new Set(printedNotReported(passed, failures.printed));
7972
+ const passedUnreported = ran.statuses.size === 0 && ran.evidence.status === "passed";
7973
+ return {
7974
+ reported: failures.reported.filter((id) => ran.statuses.get(id) === "passed"),
7975
+ printed: failures.printed.filter((name) => passedUnreported || !unmatched.has(name))
7976
+ };
7977
+ };
7978
+ var passedAtBaseline = (head, baseline) => {
7979
+ const failures = failuresOf(head);
7980
+ return hasNone(failures) ? baseline.evidence.status === "passed" : hasNone(without(failures, passedIn(baseline, failures)));
7981
+ };
7982
+ var failedOnlyIn = (again, first) => {
7983
+ const failed = failuresOf(again);
7984
+ const printedFirst = (id) => printedNotReported([id], first.printed).length < first.printed.length;
7985
+ return without({
7986
+ reported: failed.reported.filter((id) => !printedFirst(id)),
7987
+ printed: printedNotReported(first.reported, failed.printed)
7988
+ }, first);
7989
+ };
7990
+ var named = (failures) => failedTestsOf(failures.reported, failures.printed);
7991
+ var bothFileIds = (shown, other) => {
7992
+ const fileIds = [...shown.fileIds ?? [], ...other.fileIds ?? []].slice(0, maxCheckFileIds);
7993
+ return fileIds.length === 0 ? undefined : { fileIds };
7994
+ };
7995
+ var judged = (evidence) => ({
7996
+ ...evidence,
7997
+ tests: { ...evidence.tests, environmentJudged: true }
7998
+ });
7999
+ var afterFreshService = (first, again) => {
8000
+ const failures = failuresOf(first);
8001
+ const cleared = passedIn(again, failures);
8002
+ const remaining = without(failures, cleared);
8003
+ const newlyFailed = failedOnlyIn(again, failures);
8004
+ const passedBefore = passedIn(first, newlyFailed);
8005
+ const charged = without(newlyFailed, passedBefore);
8006
+ const againPassed = again.evidence.status === "passed";
8007
+ const recovered = hasNone(remaining) && hasNone(charged) && (againPassed || !hasNone(failures) && !hasNone(newlyFailed));
8008
+ if (!recovered && hasNone(cleared))
8009
+ return { ...judged(first.evidence), ...bothFileIds(first.evidence, again.evidence) };
8010
+ const ranFirst = new Set(first.evidence.tests.ranDigests);
8011
+ const skippedTests = again.evidence.tests.skippedTests.filter((id) => !ranFirst.has(testDigest(id)));
8012
+ const { failedTests: _failedAgain, ...againTests } = again.evidence.tests;
8013
+ const failedTests = recovered ? [] : named({
8014
+ reported: [...remaining.reported, ...charged.reported],
8015
+ printed: [...remaining.printed, ...charged.printed]
8016
+ });
8017
+ const clearedNames = named(cleared);
8018
+ const retryFailedTests = named(passedBefore);
8019
+ const { exitCode: _exitCode, ...againEvidence } = again.evidence;
8020
+ return {
8021
+ ...againEvidence,
8022
+ status: recovered ? "passed" : "failed",
8023
+ ...again.evidence.exitCode === undefined || recovered && !againPassed ? undefined : { exitCode: again.evidence.exitCode },
8024
+ durationMs: first.evidence.durationMs + again.evidence.durationMs,
8025
+ ...bothFileIds(again.evidence, first.evidence),
8026
+ tests: {
8027
+ ...againTests,
8028
+ skipped: againTests.skipped - (againTests.skippedTests.length - skippedTests.length),
8029
+ skippedTests,
8030
+ ranDigests: [...new Set([...againTests.ranDigests, ...first.evidence.tests.ranDigests])].sort().slice(0, maxRanDigests),
8031
+ ...failedTests.length === 0 ? undefined : { failedTests },
8032
+ environmentFailure: {
8033
+ ...clearedNames.length === 0 ? undefined : { failedTests: clearedNames },
8034
+ ...first.evidence.exitCode === undefined ? undefined : { exitCode: first.evidence.exitCode },
8035
+ outputTail: first.evidence.outputTail,
8036
+ ...retryFailedTests.length === 0 ? undefined : { retryFailedTests }
8037
+ },
8038
+ environmentJudged: true
8039
+ }
8040
+ };
8041
+ };
7932
8042
  var timesMarker = "__kitman_times__";
7933
8043
  var rssMarker = "__kitman_peak_rss_kb__";
7934
8044
  var quoted = (text) => `'${text.replaceAll("'", `'\\''`)}'`;
@@ -8121,12 +8231,40 @@ var verificationExecutor = (input) => (work) => gen(function* () {
8121
8231
  docker: input.docker,
8122
8232
  network: daemonNetwork
8123
8233
  });
8124
- const headChecks = yield* runChecks(head, work.checks, headTree, known, runIn(head), keeper(""), services(work.id)).pipe(scoped);
8234
+ const onServices = yield* checksOnServices(head);
8235
+ const usesServices = (check) => work.checks.some((entry) => entry.name === check.name && entry.command === check.command && entry.pipeline !== true && onServices.includes(entry.name));
8236
+ const comparable = headTree !== baselineTree;
8237
+ const headKnown = known.filter((entry) => !(comparable && entry.tree === headTree && entry.unjudgedFailure === true && usesServices(entry)));
8238
+ const firstHead = yield* runChecks(head, work.checks, headTree, headKnown, runIn(head), keeper(""), services(work.id)).pipe(scoped);
8239
+ const failedOnPostgres = firstHead.filter((ran) => ran.evidence.status === "failed" && ran.onPostgres && usesServices(ran.evidence));
8240
+ const sameCheck = (a) => (b) => a.name === b.name && a.command === b.command;
8241
+ const rejudged = (entry) => entry.tree === baselineTree && failedOnPostgres.some((ran) => sameCheck(ran.evidence)(entry));
8242
+ const baselineRan = comparable ? yield* runChecks(baseline, work.checks.filter((check) => check.pipeline !== true), baselineTree, known.filter((entry) => !rejudged(entry)), runIn(baseline), keeper("baseline-"), services(`${work.id}-baseline`)).pipe(scoped) : [];
8243
+ const headRevision = (yield* runCommand2("git", ["-C", head, "rev-parse", "HEAD"])).trim();
8244
+ const onFreshService = (check, attempt) => gen(function* () {
8245
+ const worktree = yield* checkouts.checkout({ runId: work.runId, id: `${work.id}-rerun`, baseRevision: headRevision }, work.repoBinding);
8246
+ const run = runIn(worktree);
8247
+ const fresh = services(`${work.id}-rerun-${attempt}`);
8248
+ yield* installIn(worktree, run);
8249
+ const postgres = yield* startedCheckPostgres(worktree, fresh, run);
8250
+ return postgres === undefined ? undefined : yield* runCheck(worktree, check, run, keeper("rerun-"), fresh, postgres);
8251
+ }).pipe(scoped);
8252
+ const headChecks = yield* forEach(firstHead, (ran, index) => gen(function* () {
8253
+ const check = work.checks.find(sameCheck(ran.evidence));
8254
+ const atBaseline = baselineRan.find((other) => sameCheck(other.evidence)(ran.evidence));
8255
+ if (check === undefined || atBaseline === undefined || !failedOnPostgres.includes(ran))
8256
+ return ran.evidence;
8257
+ if (!passedAtBaseline(ran, atBaseline))
8258
+ return ran.evidence;
8259
+ const again = yield* onFreshService(check, index + 1);
8260
+ return again === undefined ? ran.evidence : afterFreshService(ran, again);
8261
+ }));
8262
+ const baselineChecks = baselineRan.filter((ran) => !known.some((entry) => entry.tree === baselineTree && sameCheck(ran.evidence)(entry))).map((ran) => ran.evidence);
8125
8263
  return {
8126
8264
  status: "completed",
8127
8265
  evidence: {
8128
8266
  head: {
8129
- revision: (yield* runCommand2("git", ["-C", head, "rev-parse", "HEAD"])).trim(),
8267
+ revision: headRevision,
8130
8268
  tree: headTree,
8131
8269
  checks: headChecks
8132
8270
  },
@@ -8134,7 +8272,7 @@ var verificationExecutor = (input) => (work) => gen(function* () {
8134
8272
  baseline: {
8135
8273
  revision: (yield* runCommand2("git", ["-C", baseline, "rev-parse", "HEAD"])).trim(),
8136
8274
  tree: baselineTree,
8137
- checks: yield* runChecks(baseline, work.checks.filter((check) => check.pipeline !== true), baselineTree, known, runIn(baseline), keeper("baseline-"), services(`${work.id}-baseline`)).pipe(scoped)
8275
+ checks: baselineChecks
8138
8276
  }
8139
8277
  }
8140
8278
  }
@@ -8183,6 +8321,7 @@ export {
8183
8321
  SkillMaterializationRefused2 as SkillMaterializationRefused,
8184
8322
  StepAttemptLabel,
8185
8323
  StepProcesses,
8324
+ afterFreshService,
8186
8325
  agentStepExecutionLimit,
8187
8326
  agentStepExecutor,
8188
8327
  agentStepSandboxPolicy,