Skip to content

Confusing correction step counter increment in ModelFacade.generate #371

@nabinchha

Description

@nabinchha

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions