Files
crewAI/lib
Devin AI c074b05002 fix: enforce guardrail re-validation on retry and reject negative max_retries
Fixes #5979 — guardrails are now enforced as hard constraints.

Two bugs fixed:

1. Multiple guardrails skipped re-validation of earlier guardrails after retry.
   When guardrail N failed and the agent retried, the new output was only
   checked against guardrail N onward. Earlier guardrails (0..N-1) were not
   re-evaluated, allowing retry outputs to silently violate them.

   Fix: refactored _invoke_guardrail_function into _run_guardrails which
   runs ALL guardrails from the beginning on each retry attempt.

2. Negative guardrail_max_retries bypassed guardrails entirely.
   Setting guardrail_max_retries to a negative value made the guardrail
   loop execute zero iterations, letting output pass without validation.

   Fix: added ge=0 constraint to the guardrail_max_retries field.

Co-Authored-By: João <joao@crewai.com>
2026-05-30 08:33:26 +00:00
..
2026-05-28 09:47:19 -07:00
2026-05-28 09:47:19 -07:00
2026-05-28 09:47:19 -07:00