agentxchain 2.155.32 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentxchain",
3
- "version": "2.155.32",
3
+ "version": "2.155.33",
4
4
  "description": "CLI for AgentXchain — governed multi-agent software delivery",
5
5
  "type": "module",
6
6
  "bin": {
@@ -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 };