@nathapp/nax 0.67.16 → 0.67.17

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/nax.js +40 -16
  2. package/package.json +1 -1
package/dist/nax.js CHANGED
@@ -53205,14 +53205,7 @@ async function runRectification(ctx, state, phaseCosts, phaseOutputs) {
53205
53205
  storyId: ctx.storyId
53206
53206
  });
53207
53207
  }
53208
- const exhaustedReasons = new Set([
53209
- "max-attempts-total",
53210
- "max-attempts-per-strategy",
53211
- "bail-when",
53212
- "no-strategy",
53213
- "agent-gave-up"
53214
- ]);
53215
- if (exhaustedReasons.has(cycleResult.exitReason) && cycleResult.finalFindings.length > 0) {
53208
+ if (EXHAUSTED_EXIT_REASONS.has(cycleResult.exitReason) && cycleResult.finalFindings.length > 0) {
53216
53209
  return { rectificationExhausted: true, unfixedFindings: cycleResult.finalFindings };
53217
53210
  }
53218
53211
  return {};
@@ -53260,6 +53253,7 @@ class ExecutionPlan {
53260
53253
  }
53261
53254
  const rectResult = await runRectification(this.ctx, this.state, phaseCosts, phaseOutputs);
53262
53255
  if (this.state.rectification && !rectResult.rectificationExhausted) {
53256
+ let resumeRectifyUsed = false;
53263
53257
  for (const phase of collectOrderedPhases(this.state)) {
53264
53258
  const name = phase.slot.op.name;
53265
53259
  if (name in phaseOutputs && phasePassed(name, phaseOutputs[name], this.ctx.storyId)) {
@@ -53276,10 +53270,27 @@ class ExecutionPlan {
53276
53270
  throw error48;
53277
53271
  }
53278
53272
  if (!phasePassed(name, phaseOutputs[name], this.ctx.storyId)) {
53273
+ if (!resumeRectifyUsed) {
53274
+ resumeRectifyUsed = true;
53275
+ logger?.info("story-orchestrator", "Phase failed in post-rectification resume \u2014 invoking second rectification pass", { storyId: this.ctx.storyId, phase: name, source: "post-rectification-resume" });
53276
+ const secondRect = await runRectification(this.ctx, this.state, phaseCosts, phaseOutputs);
53277
+ if (secondRect.rectificationExhausted) {
53278
+ logger?.warn("story-orchestrator", "Second rectification pass exhausted \u2014 terminal failure", {
53279
+ storyId: this.ctx.storyId,
53280
+ phase: name,
53281
+ source: "post-rectification-resume"
53282
+ });
53283
+ break;
53284
+ }
53285
+ if (phasePassed(name, phaseOutputs[name], this.ctx.storyId)) {
53286
+ continue;
53287
+ }
53288
+ }
53279
53289
  logger?.warn("story-orchestrator", "Terminal phase failure (post-rectification resume \u2014 bypasses rectification)", {
53280
53290
  storyId: this.ctx.storyId,
53281
53291
  phase: name,
53282
- source: "post-rectification-resume"
53292
+ source: "post-rectification-resume",
53293
+ secondRectifyUsed: resumeRectifyUsed
53283
53294
  });
53284
53295
  break;
53285
53296
  }
@@ -53384,7 +53395,7 @@ class StoryOrchestratorBuilder {
53384
53395
  return new ExecutionPlan(ctx, { ...this.state }, opts.isThreeSession ?? false);
53385
53396
  }
53386
53397
  }
53387
- var _storyOrchestratorDeps, TDD_OP_NAMES, STRICT_VERDICT_PHASE_NAMES, CANONICAL_ORDER, PHASE_KIND_TO_STATE_KEY, STRATEGY_TO_REVALIDATION_PHASES;
53398
+ var _storyOrchestratorDeps, EXHAUSTED_EXIT_REASONS, TDD_OP_NAMES, STRICT_VERDICT_PHASE_NAMES, CANONICAL_ORDER, PHASE_KIND_TO_STATE_KEY, STRATEGY_TO_REVALIDATION_PHASES;
53388
53399
  var init_story_orchestrator = __esm(() => {
53389
53400
  init_errors();
53390
53401
  init_findings();
@@ -53400,6 +53411,13 @@ var init_story_orchestrator = __esm(() => {
53400
53411
  prepareSemanticReviewInput,
53401
53412
  prepareAdversarialReviewInput
53402
53413
  };
53414
+ EXHAUSTED_EXIT_REASONS = new Set([
53415
+ "max-attempts-total",
53416
+ "max-attempts-per-strategy",
53417
+ "bail-when",
53418
+ "no-strategy",
53419
+ "agent-gave-up"
53420
+ ]);
53403
53421
  TDD_OP_NAMES = new Set(["test-writer", "implementer", "verifier"]);
53404
53422
  STRICT_VERDICT_PHASE_NAMES = new Set([
53405
53423
  fullSuiteGateOp.name,
@@ -53948,7 +53966,7 @@ function extractPauseReason(phaseOutputs) {
53948
53966
  }
53949
53967
  return;
53950
53968
  }
53951
- function deriveTddFailureCategory(phaseOutputs) {
53969
+ function deriveTddFailureCategory(phaseOutputs, unfixedFindings) {
53952
53970
  const testWriterOutput = phaseOutputs[testWriterOp.name];
53953
53971
  if (testWriterOutput?.success === false) {
53954
53972
  return "session-failure";
@@ -53965,6 +53983,12 @@ function deriveTddFailureCategory(phaseOutputs) {
53965
53983
  return "tests-failing";
53966
53984
  }
53967
53985
  const verifierPassed = verifierOutput?.success === true;
53986
+ if (!verifierPassed && unfixedFindings && unfixedFindings.length > 0) {
53987
+ const rectOutput = phaseOutputs.rectification;
53988
+ if (rectOutput?.exitReason && EXHAUSTED_EXIT_REASONS.has(rectOutput.exitReason) && unfixedFindings.some((f) => f.source === "test-runner")) {
53989
+ return "full-suite-gate-exhausted";
53990
+ }
53991
+ }
53968
53992
  if (!verifierPassed) {
53969
53993
  const gateOutput = phaseOutputs[fullSuiteGateOp.name];
53970
53994
  if (gateOutput && (gateOutput.success === false || gateOutput.passed === false)) {
@@ -53997,7 +54021,6 @@ async function applyPostRunInspection(ctx, planResult, opts) {
53997
54021
  ...capturedTokenUsage ? { tokenUsage: capturedTokenUsage } : {}
53998
54022
  };
53999
54023
  ctx.agentResult = agentResult;
54000
- ctx.agentSwapCount = 0;
54001
54024
  const fullSuiteGateOutput = planResult.phaseOutputs[fullSuiteGateOp.name];
54002
54025
  if (fullSuiteGateOutput?.passed) {
54003
54026
  ctx.fullSuiteGatePassed = true;
@@ -54068,7 +54091,7 @@ async function applyPostRunInspection(ctx, planResult, opts) {
54068
54091
  }
54069
54092
  }
54070
54093
  const pauseReason = extractPauseReason(planResult.phaseOutputs);
54071
- const failureCategory = isTdd && !planResult.success ? deriveTddFailureCategory(planResult.phaseOutputs) : undefined;
54094
+ const failureCategory = isTdd && !planResult.success ? deriveTddFailureCategory(planResult.phaseOutputs, planResult.unfixedFindings) : undefined;
54072
54095
  if (isTdd && !planResult.success && !failureCategory) {
54073
54096
  const phaseSignals = {};
54074
54097
  for (const [name, output] of Object.entries(planResult.phaseOutputs)) {
@@ -54287,6 +54310,7 @@ var init_post_run = __esm(() => {
54287
54310
  init_scratch_writer();
54288
54311
  init_rollback();
54289
54312
  init_git();
54313
+ init_story_orchestrator();
54290
54314
  _postRunDeps = {
54291
54315
  detectMergeConflict,
54292
54316
  checkMergeConflict,
@@ -57809,7 +57833,7 @@ var package_default;
57809
57833
  var init_package = __esm(() => {
57810
57834
  package_default = {
57811
57835
  name: "@nathapp/nax",
57812
- version: "0.67.16",
57836
+ version: "0.67.17",
57813
57837
  description: "AI Coding Agent Orchestrator \u2014 loops until done",
57814
57838
  type: "module",
57815
57839
  bin: {
@@ -57904,8 +57928,8 @@ var init_version = __esm(() => {
57904
57928
  NAX_VERSION = package_default.version;
57905
57929
  NAX_COMMIT = (() => {
57906
57930
  try {
57907
- if (/^[0-9a-f]{6,10}$/.test("215c9e93"))
57908
- return "215c9e93";
57931
+ if (/^[0-9a-f]{6,10}$/.test("74621ad5"))
57932
+ return "74621ad5";
57909
57933
  } catch {}
57910
57934
  try {
57911
57935
  const result = Bun.spawnSync(["git", "rev-parse", "--short", "HEAD"], {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nathapp/nax",
3
- "version": "0.67.16",
3
+ "version": "0.67.17",
4
4
  "description": "AI Coding Agent Orchestrator — loops until done",
5
5
  "type": "module",
6
6
  "bin": {