@kody-ade/kody-engine 0.4.136 → 0.4.138

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 +25 -5
  2. package/package.json +1 -1
package/dist/bin/kody.js CHANGED
@@ -880,7 +880,7 @@ var init_loadPriorArt = __esm({
880
880
  // package.json
881
881
  var package_default = {
882
882
  name: "@kody-ade/kody-engine",
883
- version: "0.4.136",
883
+ version: "0.4.138",
884
884
  description: "kody \u2014 autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative executable profiles.",
885
885
  license: "MIT",
886
886
  type: "module",
@@ -7879,7 +7879,7 @@ function getRecentFailedRunsForPr(prNumber, limit, cwd) {
7879
7879
  } catch {
7880
7880
  return [];
7881
7881
  }
7882
- if (!headBranch || !headSha) return [];
7882
+ if (!headBranch) return [];
7883
7883
  try {
7884
7884
  const out = gh3(
7885
7885
  [
@@ -7898,7 +7898,7 @@ function getRecentFailedRunsForPr(prNumber, limit, cwd) {
7898
7898
  );
7899
7899
  const parsed = JSON.parse(out);
7900
7900
  if (!Array.isArray(parsed)) return [];
7901
- return parsed.map((r) => ({
7901
+ const runs = parsed.map((r) => ({
7902
7902
  id: String(r.databaseId ?? ""),
7903
7903
  workflowName: r.workflowName ?? "",
7904
7904
  headBranch: r.headBranch ?? headBranch,
@@ -7906,7 +7906,8 @@ function getRecentFailedRunsForPr(prNumber, limit, cwd) {
7906
7906
  conclusion: r.conclusion ?? "failure",
7907
7907
  url: r.url ?? "",
7908
7908
  createdAt: r.createdAt ?? ""
7909
- })).filter((r) => r.headSha === headSha);
7909
+ }));
7910
+ return runs.sort((a, b) => (a.headSha === headSha ? 0 : 1) - (b.headSha === headSha ? 0 : 1));
7910
7911
  } catch {
7911
7912
  return [];
7912
7913
  }
@@ -7970,7 +7971,7 @@ var fixCiFlow = async (ctx) => {
7970
7971
  bail(
7971
7972
  ctx,
7972
7973
  prNumber,
7973
- `no actionable failed workflow run found for PR #${prNumber}'s current commit (scanned up to ${RUN_LOOKBACK} failed runs on the head SHA \u2014 none were actionable CI failures with fetchable logs; pass --run-id to target a specific run)`
7974
+ `no actionable failed workflow run found for PR #${prNumber} (scanned up to ${RUN_LOOKBACK} recent failed runs on the branch, head commit first \u2014 none were actionable CI failures with fetchable logs; pass --run-id to target a specific run)`
7974
7975
  );
7975
7976
  return;
7976
7977
  }
@@ -12326,6 +12327,25 @@ var writeJobStateFile = async (ctx, _profile, agentResult, args) => {
12326
12327
  `);
12327
12328
  if (ctx.output.exitCode === 0) ctx.output.exitCode = 1;
12328
12329
  if (!ctx.output.reason) ctx.output.reason = `next-state parse failed: ${parseError}`;
12330
+ const prior = ctx.data.jobState;
12331
+ if (prior) {
12332
+ const carried = {
12333
+ version: 1,
12334
+ rev: prior.state.rev + 1,
12335
+ cursor: prior.state.cursor,
12336
+ data: {
12337
+ ...prior.state.data,
12338
+ lastFiredAt: (/* @__PURE__ */ new Date()).toISOString(),
12339
+ lastOutcome: "failed",
12340
+ lastDurationMs: agentResult?.durationMs ?? null,
12341
+ lastError: parseError
12342
+ },
12343
+ done: prior.state.done
12344
+ };
12345
+ const jobsDir2 = String(args?.jobsDir ?? ".kody/duties");
12346
+ const backend2 = resolveBackend({ config: ctx.config, cwd: ctx.cwd, jobsDir: jobsDir2 });
12347
+ await backend2.save(prior, carried);
12348
+ }
12329
12349
  return;
12330
12350
  }
12331
12351
  const next = ctx.data.nextJobState;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.136",
3
+ "version": "0.4.138",
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",