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)
Description
In
ModelFacade.generate()(andagenerate()),curr_num_correction_stepsis incremented before the parser runs, then checked with<= max_correction_stepsafter aParserException. 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:
parse_attemptsto match the actual semantics (incremented per attempt, not per correction)exceptblock so it truly counts corrections takenLocation
packages/data-designer-engine/src/data_designer/engine/models/facade.py— lines ~279 (syncgenerate) and ~377 (asyncagenerate)