fix(workflows): reject bool max_iterations in engine re-eval guard
Summary
The while / do-while step validators already reject max_iterations: true as a type error — bool is a subclass of int, so a boolean passes a bare isinstance(..., int) check, and since True - 1 == 0 it would silently cap the loop at a single iteration (0 re-iterations).
The engine's re-evaluation guard in WorkflowEngine, however, still used the older shape:
if not isinstance(max_iters, int) or max_iters < 1:
max_iters = 10
On an unvalidated run (executing a definition without first calling the validators), a boolean max_iterations slipped through this guard and ran the loop body just once instead of falling back to the safe default of 10.
Fix
Add the explicit isinstance(max_iters, bool) rejection so the engine guard matches WhileStep.validate() / DoWhileStep.validate(). An unvalidated run now degrades to the default of 10 rather than silently under-running the loop.
Testing
- Added
test_while_loop_bool_max_iterations_falls_back_to_default, which runs awhilestep withmax_iterations: truethrough the engine and asserts the body executes 10 times (not 1). - Verified the test fails without the engine change and passes with it (test-the-test via
git stash). - Full while/do-while/loop suite: 16 passed.
🤖 Generated with Claude Code