Skip to content

fix(roadmap): Name the failed refine form check to the model #6327

Closed

Description

@dan-petty

Problem

In the 6 hours to 2026-11-18 20:30 UTC, refine graded 37 of 52 runs as a success (71%, below the 80% target). 15 runs failed with class none. Three items reached failed after 3 tries each: #6106, #6090 and #6043 (#5954 did the same earlier on 0.176.1).

The record of each item holds only this:

refine.failed_check: acceptance_criteria
refine.failure: The reply of the model failed the form check.
  • The record does not say which criterion or which part (name, requirement, scenario, when, then) was empty, or whether the list was empty. A person cannot see what to fix.
  • The next round does not give the failure to the model. _judge_findings in src/devops_cli/roadmap/refine/refine.py gives only the findings of a review that refused the proposal. So each try sends the same request and fails the same way, and the item stops at failed.
  • The job result has class=none, so the grade shows no cause.
  • CONST_ROADMAP_REFINE_FAILURE_MAX_CHARS and CONST_ROADMAP_REFINE_JUDGE_FINDINGS_MAX_CHARS cut the failure and the findings that the next round reads. The owner rule of 2026-11-17 forbids hard character caps that drop failure reasons of earlier tries.

Expected behavior

  • A form-check failure names each failed check and the criterion and part that failed, in the record and in the job result log line.
  • The next round gives the model the full failure of the earlier try, as it does for review findings, with no character cap.
  • A form-check failure has a failure class that is not none.
  • A test shows a reply with an empty then in one criterion: the record names that criterion and part, and the next request holds that text.

Related

Alternatives check of 2026-11-18: in-use.
The repository already uses this tool.
Tool: pydantic/pydantic-ai (https://github.com/pydantic/pydantic-ai), MIT, last activity 2026-11-18, maintained.
Reason: Searches found no tool for the refine form check itself; pydantic-ai validates structured output, names the failing field, and re-prompts the model with the error text, so it covers the naming and the feedback-to-the-next-round parts, but the record, failure class and log line stay project code.

Covers:

  • Validation errors name the failing field path and reason
  • Output validators raise ModelRetry to send the error to the next model round
  • Typed output models require each criterion part to be present

Lacks:

  • No failure class for the job result, so class stays none
  • Writes nothing to the item record or the job result log line
  • No acceptance-criteria schema naming name/requirement/scenario/when/then

Proposed design

Problem statement

A form-check failure records only the check name and a generic message. The record, the job result and the next round lose the criterion and the part. The model retries the same request and the item stops at failed. The change names the failed criterion and part, keeps the whole failure for the next round, and gives the failure its own class.

Acceptance criteria

Requirement: Form-check failure detail

A form-check failure SHALL name each failed check and, for each failed acceptance criterion, the index of the criterion and the part that failed.

Scenario: Empty then in the first criterion

  • WHEN A test runs the form check on a proposal whose first acceptance criterion has an empty then.
  • THEN The failure text names acceptance_criteria[0].then.

Requirement: Failure record detail

The job record MUST hold the detail of each failed form check in refine.failed_check and refine.failure.

Scenario: Apply writes a form-check failure

  • WHEN A test applies a refined item with a form-check JobFailure.
  • THEN The record's refine.failure holds acceptance_criteria[0].then.

Requirement: Job result log detail

The job result log line SHALL hold the text of the form-check failure and a class that is not none.

Scenario: Log line of a form-check failure

  • WHEN A test calls log_job_result for a refine round with a form-check JobFailure.
  • THEN The JSON line holds class form_check and a reason with acceptance_criteria[0].then.

Requirement: Form-check failure class

A form-check failure MUST record a failure class that is not none.

Scenario: Class of a form-check failure

  • WHEN A test applies a refined item with a form-check JobFailure.
  • THEN The record's refine.failure_class is form_check.

Requirement: Next-round failure feedback

The next refine request SHALL carry the whole text of the earlier form-check failure, with no character cap.

Scenario: Long failure text

  • WHEN A test calls _judge_findings with a job record whose form-check error is longer than 2000 characters.
  • THEN The findings that the next request carries hold the whole error text.

Requirement: No failure character caps

The refine code MUST NOT cut failure text or review findings with a fixed character cap.

Scenario: No cap reference remains

  • WHEN A test searches src/devops_cli/roadmap/refine/refine.py and src/devops_cli/config/constants.py.
  • THEN It finds no CONST_ROADMAP_REFINE_FAILURE_MAX_CHARS or CONST_ROADMAP_REFINE_JUDGE_FINDINGS_MAX_CHARS.

Existing Tool Considered

pydantic/pydantic-ai (https://github.com/pydantic/pydantic-ai), MIT, last activity 2026-11-18, maintained; verdict in-use (alternatives check in the issue body). The repository already uses the tool. The proposal uses its ValidationError field path and its ModelRetry text for a rejected structured reply. The refine round writes that text to the record, the failure class and the job result line in project code, and carries the whole text to the next request. The check in the issue body lists what the tool covers and lacks.

Key questions

  • Which mechanism names the criterion and the part that a form check failed?: Use the ValidationError location from pydantic-ai for a schema rejection, and the project form_checks detail for an empty field that the schema allows. Both produce a path such as acceptance_criteria[0].then. (best practice) [sources: src/devops_cli/roadmap/refine/refine.py]
    • Chosen: pydantic-ai ValidationError and project form check. The repository already uses pydantic-ai. It names the field path, and the project form check covers an empty field.
    • Rejected: Custom string scan of the proposal. It repeats the schema and misses nested fields.
    • Rejected: A second JSON Schema validator. It adds a schema that the model does not read and gives no field path to the next round.
  • How does the next round receive the earlier form-check failure?: Extend _judge_findings to add the JobFailure.error text to the findings. Remove the two character caps so the text stays whole. (best practice) [sources: src/devops_cli/roadmap/refine/refine.py:2870, src/devops_cli/config/constants.py:3440, src/devops_cli/config/constants.py:3444]
    • Chosen: Extend _judge_findings. This function already builds the findings that the next request carries, so one path feeds the model.
    • Rejected: A new request key. It changes the prompt and the schema for one string.
    • Rejected: A comment on the item. The record is the source, and a comment adds noise and waits on a read.
  • Which failure class does a form-check failure record?: Add FailureClass.FORM_CHECK with value form_check and use it for a JobFailure whose checks are form checks. The job result class is then not none. (best practice) [sources: src/devops_cli/roadmap/failure.py, src/devops_cli/roadmap/refine/refine.py]
    • Chosen: Add FailureClass.FORM_CHECK. The class names the cause and the job result shows it.
    • Rejected: Use FailureClass.NONE. The issue shows that none hides the cause.
    • Rejected: Reuse an existing model class. A form check is no model or network failure, so an existing class names the wrong cause.
  • What happens to CONST_ROADMAP_REFINE_FAILURE_MAX_CHARS and CONST_ROADMAP_REFINE_JUDGE_FINDINGS_MAX_CHARS?: Remove both constants and their cuts. The owner rule of 2026-11-17 prohibits hard character caps that drop failure reasons of earlier tries. (best practice) [sources: src/devops_cli/config/constants.py:3440, src/devops_cli/config/constants.py:3444]
    • Chosen: Remove both caps. The owner rule prohibits a cap that drops a failure reason, and the next round needs the whole text.
    • Rejected: Raise the caps. A larger cap still drops a long failure and still breaks the owner rule.
    • Rejected: Cap only the log line. The log line is the evidence that a person reads, so a cap hides the same detail.
  • Where does the job result log line get the failure text?: The refine round passes JobFailure.error and FailureClass.FORM_CHECK to log_job_result. The line holds both. (best practice) [sources: src/devops_cli/roadmap/job_result.py, src/devops_cli/roadmap/refine/refine.py]
    • Chosen: Pass the failure to log_job_result. The job result line is the one place that the grade reads, and it already writes the class.
    • Rejected: Write the detail in a comment. The grade reads the job result line, not the comments.
    • Rejected: Log the detail with logger. The grade does not read the application log.
  • Which test proves that an empty then reaches the record and the next request?: A unit test in tests/roadmap/refine/test_roadmap_refine_job_failure.py builds a proposal with an empty then in the first criterion. It asserts the record text names acceptance_criteria[0].then and the next request holds that text. [sources: tests/roadmap/refine/test_roadmap_refine_job_failure.py, src/devops_cli/roadmap/refine/refine.py]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/bug
    source/agent
    scope/roadmap
    status/new
    value/medium
    on Nov 18, 2026
  2. dan-petty commented on Nov 18, 2026

    @dan-petty
    OwnerAuthor
  3. added
    effort/medium
    priority/p1-high
    on Nov 18, 2026
  4. devops-cli-service commented on Nov 18, 2026

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.

    Searches (10)

    Tools considered:

    Searches run:

    • LLM structured output validation error details retry library, results: 5
    • pydantic-ai output validator ModelRetry feed validation error back to model, results: 5
    • jsonschema validation error field path message library python, results: 5
    • pydantic-ai output validators retries ModelRetry documentation, results: 5
    • pydantic-ai github, results: 5
    • pydantic ValidationError loc field path message, results: 5
    • instructor python library validation retry LLM, results: 5
    • "pydantic-ai" retry validation error, results: 5
    • pydantic-ai validation error retry agent, results: 5
    • ai.pydantic.dev output validators ModelRetry, results: 5

    Sources:

  5. added
    status/ready
    and removed
    status/new
    on Nov 18, 2026
  6. devops-cli-service commented on Nov 18, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at f771237 (see proposed design in issue body).

  7. added
    owner/service
    and removed
    owner/service
    on Nov 19, 2026
  8. 26 remaining items

  9. dan-petty commented on Nov 20, 2026

    @dan-petty
    OwnerAuthor

    A deviation from the refined design waits for the owner. The refined requirement "Form-check failure class" says that the record's refine.failure_class is form_check. Pull request #6507 writes the class form_check on the result line only, and not in the job record.

    The reason: the record already holds refine.failed_class, the class of a failed model call, and retry_after reads it to set the wait of the next round. A form check there would set a wait that no model call caused, and a second key refine.failure_class would hold two classes of one round under two near-equal names. The grade reads the class from the result line, and the record keeps the failed parts in refine.failed_check and refine.failure.

    To accept: no action. To refuse: name the record key that must hold the class, and the pull request gets a follow-up.

  10. removed
    status/in-review
    on Nov 20, 2026
  11. devops-cli-service commented on Nov 20, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-20 17:44 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p1-highscope/roadmapsource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions