@kody-ade/kody-engine 0.4.33 → 0.4.34

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 (2) hide show
  1. package/dist/bin/kody.js +39 -2
  2. package/package.json +1 -1
package/dist/bin/kody.js CHANGED
@@ -3,7 +3,7 @@
3
3
  // package.json
4
4
  var package_default = {
5
5
  name: "@kody-ade/kody-engine",
6
- version: "0.4.33",
6
+ version: "0.4.34",
7
7
  description: "kody \u2014 autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative executable profiles.",
8
8
  license: "MIT",
9
9
  type: "module",
@@ -8514,6 +8514,7 @@ function tryPostPr6(prNumber, body, cwd) {
8514
8514
  import { spawn as spawn2 } from "child_process";
8515
8515
  var TAIL_CHARS = 4e3;
8516
8516
  var COMMAND_TIMEOUT_MS = 10 * 60 * 1e3;
8517
+ var DEFAULT_TEST_RETRIES = 2;
8517
8518
  function runCommand(command, cwd) {
8518
8519
  return new Promise((resolve4) => {
8519
8520
  const start = Date.now();
@@ -8567,6 +8568,28 @@ async function verifyAll(config, cwd) {
8567
8568
  }
8568
8569
  return { ok: failed.length === 0, failed, details };
8569
8570
  }
8571
+ async function applyTestRetries(initial, testCommand, cwd, runner, testRetries = DEFAULT_TEST_RETRIES) {
8572
+ if (initial.ok) return { ...initial, recovered: [] };
8573
+ const recovered = [];
8574
+ const details = { ...initial.details };
8575
+ let failed = [...initial.failed];
8576
+ if (failed.includes("test") && testCommand && testRetries > 0) {
8577
+ for (let attempt = 1; attempt <= testRetries; attempt++) {
8578
+ const retry = await runner(testCommand, cwd);
8579
+ details[`test (retry ${attempt})`] = retry;
8580
+ if (retry.exitCode === 0) {
8581
+ failed = failed.filter((f) => f !== "test");
8582
+ recovered.push("test");
8583
+ break;
8584
+ }
8585
+ }
8586
+ }
8587
+ return { ok: failed.length === 0, failed, details, recovered };
8588
+ }
8589
+ async function verifyAllWithRetry(config, cwd, opts) {
8590
+ const initial = await verifyAll(config, cwd);
8591
+ return applyTestRetries(initial, config.quality.testUnit, cwd, runCommand, opts?.testRetries);
8592
+ }
8570
8593
  var ANSI_RE = /\x1B\[[0-?]*[ -/]*[@-~]/g;
8571
8594
  function stripAnsi(s) {
8572
8595
  return s.replace(ANSI_RE, "");
@@ -8579,6 +8602,13 @@ function summarizeFailure(result) {
8579
8602
  lines.push(`
8580
8603
  --- ${name} (exit ${d.exitCode}, ${(d.durationMs / 1e3).toFixed(1)}s) ---`);
8581
8604
  lines.push(stripAnsi(d.tail));
8605
+ for (let attempt = 1; ; attempt++) {
8606
+ const retry = result.details[`${name} (retry ${attempt})`];
8607
+ if (!retry) break;
8608
+ lines.push(`
8609
+ --- ${name} (retry ${attempt}: exit ${retry.exitCode}, ${(retry.durationMs / 1e3).toFixed(1)}s) ---`);
8610
+ lines.push(stripAnsi(retry.tail));
8611
+ }
8582
8612
  }
8583
8613
  return lines.join("\n");
8584
8614
  }
@@ -8586,9 +8616,16 @@ function summarizeFailure(result) {
8586
8616
  // src/scripts/verify.ts
8587
8617
  var verify = async (ctx) => {
8588
8618
  try {
8589
- const result = await verifyAll(ctx.config, ctx.cwd);
8619
+ const result = await verifyAllWithRetry(ctx.config, ctx.cwd);
8590
8620
  ctx.data.verifyOk = result.ok;
8591
8621
  ctx.data.verifyReason = result.ok ? "" : summarizeFailure(result);
8622
+ ctx.data.verifyRecovered = result.recovered ?? [];
8623
+ if (result.recovered && result.recovered.length > 0) {
8624
+ process.stderr.write(
8625
+ `[kody verify] caught flake on: ${result.recovered.join(", ")} (passed on retry)
8626
+ `
8627
+ );
8628
+ }
8592
8629
  } catch (err) {
8593
8630
  ctx.data.verifyOk = false;
8594
8631
  ctx.data.verifyReason = `verify crashed: ${err instanceof Error ? err.message : String(err)}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.33",
3
+ "version": "0.4.34",
4
4
  "description": "kody — autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative executable profiles.",
5
5
  "license": "MIT",
6
6
  "type": "module",