Description
In ModelFacade.generate() (and agenerate()), curr_num_correction_steps is incremented before the parser runs, then checked with <= max_correction_steps after a ParserException. The variable name suggests "number of correction steps taken" but it's incremented before any correction has happened.
With max_correction_steps=1, the parser gets 2 attempts (initial + 1 correction), which is likely correct behavior — but the code reads as if it might be an off-by-one.
Suggestion
Either:
- Rename to
parse_attempts to match the actual semantics (incremented per attempt, not per correction)
- Move the increment into the
except block so it truly counts corrections taken
Location
packages/data-designer-engine/src/data_designer/engine/models/facade.py — lines ~279 (sync generate) and ~377 (async agenerate)