agentxchain 2.155.31 → 2.155.33
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/package.json
CHANGED
|
@@ -4701,29 +4701,51 @@ function _acceptGovernedTurnLocked(root, config, opts) {
|
|
|
4701
4701
|
|
|
4702
4702
|
const gateSemanticMode = config.gate_semantic_coverage_mode || 'strict';
|
|
4703
4703
|
if (uncoveredFiles.length > 0 && gateSemanticMode === 'strict') {
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4704
|
+
// BUG-81: In planning phase only, auto-strip the phase transition request
|
|
4705
|
+
// instead of permanently blocking. PM's partial planning work is preserved;
|
|
4706
|
+
// the phase stays in "planning" and the continuous loop re-dispatches PM to
|
|
4707
|
+
// complete gate artifacts. In implementation+ phases, gate failures still
|
|
4708
|
+
// reject — dev/qa claiming readiness without updating gate files is a real error.
|
|
4709
|
+
if (turnResult.phase_transition_request && state.phase === 'planning') {
|
|
4710
|
+
emitRunEvent(root, 'gate_transition_request_auto_stripped', {
|
|
4711
|
+
run_id: state.run_id,
|
|
4712
|
+
phase: state.phase,
|
|
4713
|
+
status: state.status,
|
|
4714
|
+
turn: { turn_id: currentTurn.turn_id, role_id: currentTurn.assigned_role },
|
|
4715
|
+
payload: {
|
|
4716
|
+
gate_id: exitGateId,
|
|
4717
|
+
uncovered_files: uncoveredFiles,
|
|
4718
|
+
declared_files: [...declaredFiles],
|
|
4719
|
+
rationale: 'Turn did not modify gate-required files; phase transition stripped to preserve partial planning work',
|
|
4720
|
+
},
|
|
4721
|
+
});
|
|
4722
|
+
delete turnResult.phase_transition_request;
|
|
4723
|
+
// Fall through — continue with acceptance without the phase transition
|
|
4724
|
+
} else {
|
|
4725
|
+
const coverageError = `Gate "${exitGateId}" is failing on ${uncoveredFiles.join(', ')}. Your turn did not modify ${uncoveredFiles.length === 1 ? 'that file' : 'those files'}. Either edit the file(s) to satisfy the gate, or remove the phase transition request.`;
|
|
4726
|
+
transitionToFailedAcceptance(root, state, currentTurn, coverageError, {
|
|
4727
|
+
error_code: 'gate_semantic_coverage',
|
|
4721
4728
|
stage: 'gate_semantic_coverage',
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4729
|
+
extra: {
|
|
4730
|
+
gate_id: exitGateId,
|
|
4731
|
+
uncovered_files: uncoveredFiles,
|
|
4732
|
+
declared_files: [...declaredFiles],
|
|
4733
|
+
gate_reasons: preGateResult.reasons,
|
|
4734
|
+
},
|
|
4735
|
+
});
|
|
4736
|
+
return {
|
|
4737
|
+
ok: false,
|
|
4738
|
+
error: coverageError,
|
|
4739
|
+
validation: {
|
|
4740
|
+
...validation,
|
|
4741
|
+
ok: false,
|
|
4742
|
+
stage: 'gate_semantic_coverage',
|
|
4743
|
+
error_class: 'gate_coverage_error',
|
|
4744
|
+
errors: uncoveredFiles.map(f => `Gate "${exitGateId}" is failing on "${f}". Your turn did not modify that file.`),
|
|
4745
|
+
warnings: [],
|
|
4746
|
+
},
|
|
4747
|
+
};
|
|
4748
|
+
}
|
|
4727
4749
|
}
|
|
4728
4750
|
}
|
|
4729
4751
|
}
|
|
@@ -1274,6 +1274,34 @@ export function normalizeTurnResult(tr, config, context = {}) {
|
|
|
1274
1274
|
);
|
|
1275
1275
|
normalized.proposed_next_role = fallback;
|
|
1276
1276
|
}
|
|
1277
|
+
} else if (
|
|
1278
|
+
// BUG-82: When BUG-81's gate auto-strip keeps the session in an earlier
|
|
1279
|
+
// phase (e.g. planning), authoritative roles dispatched in that phase may
|
|
1280
|
+
// propose a next role valid for the phase they *expected* (e.g. "qa" for
|
|
1281
|
+
// implementation) but illegal for the actual phase. Auto-normalize to a
|
|
1282
|
+
// routing-legal role instead of hard-erroring.
|
|
1283
|
+
isKnownPhase &&
|
|
1284
|
+
!isReviewOnly &&
|
|
1285
|
+
normalized.status === 'completed' &&
|
|
1286
|
+
typeof normalized.proposed_next_role === 'string' &&
|
|
1287
|
+
normalized.proposed_next_role !== 'human' &&
|
|
1288
|
+
!/^<[^>]+>$/.test(normalized.proposed_next_role) && // skip template placeholders — let schema validation catch them
|
|
1289
|
+
allowedNextRoles.length > 0 &&
|
|
1290
|
+
!allowedNextRoles.includes(normalized.proposed_next_role)
|
|
1291
|
+
) {
|
|
1292
|
+
const fallback = pickAllowedRoleFallback();
|
|
1293
|
+
if (fallback) {
|
|
1294
|
+
corrections.push(
|
|
1295
|
+
`proposed_next_role: corrected "${normalized.proposed_next_role}" to allowed role "${fallback}" (routing-illegal for phase "${currentPhase}")`
|
|
1296
|
+
);
|
|
1297
|
+
normalizationEvents.push({
|
|
1298
|
+
field: 'proposed_next_role',
|
|
1299
|
+
original_value: normalized.proposed_next_role,
|
|
1300
|
+
normalized_value: fallback,
|
|
1301
|
+
rationale: `routing_illegal_for_phase_${currentPhase}`,
|
|
1302
|
+
});
|
|
1303
|
+
normalized.proposed_next_role = fallback;
|
|
1304
|
+
}
|
|
1277
1305
|
}
|
|
1278
1306
|
|
|
1279
1307
|
return { normalized, corrections, normalizationEvents };
|