Skip to content

fix(roadmap): a refused repair revision goes back to the planner once #4348

Closed

Description

@dan-petty

Problem

A repair round of the stage job gets no return when the checks refuse its revision. _repaired in src/devops_cli/roadmap/stage/stage.py raises _stage_error at the first refused revision, while _gated returns a refused first reply to the model once with the problem. After the model review found defects, the planner runs again with the findings; that run costs 33 to 49 tool calls and 6 to 10 minutes, and one gate problem in its reply (a form fault that the model fixes at once when told) throws all of it away.

Evidence: a live run of devops roadmap stage --plan --item 3387 on 2026-11-10 with deepseek-v4.1-flash-1017. The plan run, the gate return and the review (63 calls) all passed. The repair run (22 requests, 33 tool calls, 348 seconds) gave a revision that the check refused: "Scenario 'The plan is on the default branch and the branch is gone' names stage.pr with no behavior test". The item failed after 21 minutes. The run before the change of #4346 did stage the same item in 62 minutes, with a repair that passed the check.

Expected

  • A refused revision of a repair round goes back to the planner once with the problem, as a refused first reply does. The return needs few calls (a gate return took 0 to 4 calls in the same runs).

Acceptance criteria

  • A test of _repaired shows that a revision with a gate problem goes back once, and that a second refusal stops the item. It fails today.
  • devops roadmap eval stage --replay keeps its result (81 of 317 defects caught, 0 missed, 5 of 5 good plans accepted).

Existing tool considered

None: it is control flow of the job. Cost: about 20,000 tokens to build, 2,000 to keep, 1.5 hours.

Proposed design

Problem statement

In a repair round of the stage job, _repaired in src/devops_cli/roadmap/stage/stage.py raises _stage_error at the first revision that the checks refuse. _gated returns a refused first reply to the planner once with the problem. A repair run costs 33 to 49 tool calls and 6 to 10 minutes. One form fault in its revision, which the model fixes at once when told, throws all of that work away. The item then fails.

Acceptance criteria

Requirement: A refused revision returns once

The planner SHALL send a revision of a repair round that the checks refuse back to the model once, with the problem and the refused revision, as _gated does for a refused first reply.

Scenario: First revision refused, second revision passes

  • WHEN the checks refuse the first revision of a repair round and accept the second revision
  • THEN _repaired asks the model a second time with previous set to the refused revision and problem set to the gate problem, and it returns the accepted change

Requirement: A second refusal stops the item

The planner SHALL stop the item with RoadmapStageError when the checks refuse the returned revision of a repair round.

Scenario: Both revisions refused

  • WHEN the checks refuse the first revision and the second revision of a repair round
  • THEN _repaired raises RoadmapStageError that names the problem of the second refusal, and it makes no third model call

Requirement: The return is bounded

The planner SHALL make at most one return for each repair round, and a revision that the checks accept SHALL cause no extra model call.

Scenario: Accepted revision makes no return

  • WHEN the checks accept the first revision of a repair round
  • THEN _repaired makes exactly one model call

Requirement: The replay result stays

The replay of the stage evaluation SHALL keep its result after the change.

Scenario: Replay keeps its result

  • WHEN devops roadmap eval stage --replay runs offline
  • THEN it reports 81 of 317 defects caught, 0 missed and 5 of 5 good plans accepted

Existing Tool Considered

None: the change is control flow of the stage job, and no library covers it. Cost: about 20,000 tokens to build, 2,000 to keep and fix, and about 1.5 hours. The change reuses the return logic that _gated already has.

Key questions

  • Does a gate return of a repair round need its own return limit?: No. One return for each repair round matches the return of _gated, which uses one return, and the issue asks for one. The number of repair rounds stays CONST_ROADMAP_STAGE_VERIFY_REPAIR_ROUNDS. (best practice) [sources: src/devops_cli/roadmap/stage/stage.py, CONTEXT.md]
    • Chosen: One return for each repair round. It matches _gated and the Expected section of the issue, and it bounds the extra cost to a few calls.
    • Rejected: Several returns for each repair round. It adds cost and delay, and the issue does not ask for it.
    • Rejected: No return, as today. It throws away 33 to 49 tool calls for one form fault.
  • How should the code share the return logic between _gated and _repaired?: Extract a helper that asks the planner, settles the reply, and sends one return with previous and problem when the checks refuse it. _repaired and the return step of _gated call it. Keep the refused-reply log, the file of refused replies and the degenerate-reply stop in the _gated path, so its behavior does not change. (best practice) [sources: src/devops_cli/roadmap/stage/stage.py]
    • Chosen: Shared helper. It keeps one rule for the return and avoids copied code.
    • Rejected: Copy the return code into _repaired. It duplicates the logic and the two paths can then differ.
  • Does the change alter the result of the replay of the stage evaluation?: No. The replay reads recorded replies and the change only adds a return after a refused repair revision. A test checks the numbers 81 of 317 defects caught, 0 missed and 5 of 5 good plans accepted. [sources: src/devops_cli/roadmap/stage/stage_eval_run.py, src/devops_cli/roadmap/stage/stage.py]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

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

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/bug. The fix prefix of the title gives the type.
    • Scope: scope/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P2-Medium. A single gate refusal discards 21 minutes of work, but the item still completes its run; it is a correctness bug, not a blocker.
    • Value: Medium. It prevents a full item failure from a form fault the model can fix in 0 to 4 calls, saving 6 to 10 minutes per affected run.
    • Effort: Low. It mirrors the existing _gated return path in the same file; the body estimates 1.5 hours.
    • Related: fix(roadmap): keep a refused revision of the review repair #4312, which asks for a different change. Both target a refused revision in _repaired, but #4312 asks to persist it to a file while the candidate asks to return it to the planner for one retry.
  3. added
    priority/p2-medium
    on Nov 10, 2026
  4. added
    status/ready
    and removed
    status/new
    on Nov 10, 2026
  5. devops-cli-service commented on Nov 10, 2026

    @devops-cli-service
    Contributor

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

  6. added
    owner/agent
    status/in-review
    and removed
    status/ready
    on Nov 10, 2026
  7. removed
    status/in-review
    owner/agent
    on Nov 10, 2026
  8. devops-cli-service commented on Nov 10, 2026

    @devops-cli-service
    Contributor
  9. devops-cli-service commented on Nov 10, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-10 13:56 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/lowpriority/p2-mediumscope/roadmapsource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions