Skip to content

feat(roadmap): each repair round changes the strategy of a step #3569

Closed

Description

@dan-petty

Problem or Motivation

A repair round of an implement step sends the same inputs again with the text of the failure. A second failure of the same kind repeats the same strategy. A stop with action change_tier on a ladder with one tier (roadmap.implement.ladder) names no setting, so a person cannot see what to change. Split from #3053.

Proposed Solution & Architectural Design

  • Attempt 1 runs the step as planned.
  • Attempt 2 adds context from the repo map, and asks for a smaller group when the failure names a group or the inputs exceed the step budget.
  • Attempt 3 changes the model tier when roadmap.implement.ladder holds more than one tier. When it holds one tier, the stop comment names roadmap.implement.ladder and its value.
  • The attempt event of the trace records the strategy of each round.
  • Acceptance: a replay where the first attempt fails with class test shows more repo-map context in the second attempt; a ladder of one tier names the setting in the stop; a stub model test checks each round.

Target Subsystem

The implement step, src/devops_cli/roadmap/implement_step.py.

Existing Tool Considered

pydantic-ai covers retries and message history. It has no strategy change between rounds. The project builds the ladder: about 70000 tokens to build, 3000 each quarter to keep, 10000 to fix one miss, about 4 hours.

Source: #3053

Proposed design

Problem statement

A repair round of an implement step sends the same inputs again with the text of the failure. A second failure of the same kind repeats the same strategy. A stop with action change_tier on a ladder of one tier names no setting, so a person cannot see what to change.

Acceptance criteria

Requirement: Strategy of each attempt

The step SHALL record the strategy of each attempt in the attempt event of its trace.

Scenario: A failed test on the first attempt

  • WHEN a stub model fails the first attempt with class test and roadmap.implement.repair_rounds is 1
  • THEN the trace holds an attempt event for attempt 1 with strategy planned and one for attempt 2 with strategy repo_map

Requirement: Repository-map context of the second attempt

The second attempt SHALL add the repository-map entries of the files that the failure names to its message.

Scenario: A failed test names a path

  • WHEN the reason of the first attempt names src/devops_cli/roadmap/failure.py
  • THEN the message of the second attempt holds a section named # Repository map with the entry of that file

Requirement: Tier move of the third attempt

The third attempt MUST run on the next healthy tier when roadmap.implement.ladder holds more than one tier.

Scenario: A ladder of two tiers

  • WHEN the ladder names two tiers and the first two attempts fail with a repairable class
  • THEN the third attempt calls the model of the second tier, and its attempt event names that tier and the strategy tier

Requirement: One-tier ladder names its setting

A stop with action change_tier on a ladder of one tier MUST name roadmap.implement.ladder and its value in its reason.

Scenario: A parser failure on a ladder of one tier

  • WHEN roadmap.implement.ladder names one tier and a failure selects change_tier
  • THEN the reason of the stopped step holds roadmap.implement.ladder and the name of that tier

Requirement: Document of the implement step

docs/roadmap/implement.md MUST state the strategy of each attempt and the tier move of the third attempt.

Scenario: The document states the new rule

  • WHEN a reader opens docs/roadmap/implement.md
  • THEN the file names the repository-map context of the second attempt and the tier move of the third attempt, and no longer states that every repair round stays on its tier

Existing Tool Considered

No alternatives check has run. pydantic-ai covers retries and message history, but it changes no strategy between rounds. The step builds its own round strategy and ladder: about 70000 tokens to build, 3000 each quarter to keep, 10000 to fix one miss, and about 4 hours.

Key questions

  • Which strategy does each attempt use, and how does the step select it?: The attempt number selects the strategy: attempt 1 runs the step as planned, attempt 2 adds the repository-map context, and attempt 3 moves to the next tier. A later attempt keeps the strategy of the third attempt. (best practice) [sources: src/devops_cli/roadmap/implement_step.py, src/devops_cli/roadmap/failure.py]
    • Chosen: The attempt number selects the strategy. Each attempt tries something new, so a second failure of the same class does not repeat the strategy.
    • Rejected: The failure class selects the strategy. A second failure of the same class repeats the same strategy, which is the defect.
    • Rejected: A setting names the strategy of each round. It adds a setting to keep, and it does not stop a repeated strategy by itself.
  • Which repository-map context does the second attempt add, and how is it bounded?: Attempt 2 adds the repository-map entry of each file that the failure reason names, and of each file of the group. The step counts the section with the message against the window of the step. (best practice) [sources: CONTEXT.md, src/devops_cli/roadmap/implement_step.py]
    • Chosen: The map entries of the files that the failure names and of the group. It reuses the repository map of the planner, and it names the code that the failure touches.
    • Rejected: The whole repository map. It can exceed the window of the step and the budget of the item.
    • Rejected: The packed text of the files that the failure names. The inputs already pack the files of the group, and the full text costs more tokens than the map.
  • How does the third attempt change the tier, and does it spend a repair round?: Attempt 3 moves to the next healthy tier, discards the checkout back to the last wip: commit, and runs the message with the failure text. The move spends no repair round, as the ladder move does today. (best practice) [sources: docs/ENV_VARS.md, docs/roadmap/implement.md, src/devops_cli/roadmap/implement_step.py]
    • Chosen: Move to the next healthy tier and spend no repair round. It reuses the tier health check and the keeper, and a new model starts from a known state.
    • Rejected: Continue the conversation of the earlier attempts on the new tier. A conversation of one model is not the input of another, and the tree keeps the work of a failed attempt.
    • Rejected: Restart at the weakest tier. It repeats a tier that already failed.
  • What does the stop reason say when the ladder holds one tier?: The reason holds the setting name roadmap.implement.ladder and the value of the ladder of the step class, so a person can see the one tier that the failure cannot move past. (best practice) [sources: src/devops_cli/lang/en/messages.py, src/devops_cli/roadmap/implement_step.py]
    • Chosen: Name the setting and its value. A person sees the setting to change, and the value that stops the move.
    • Rejected: Name the setting only. A person cannot tell the ladder that the step read.
    • Rejected: Add a repair round instead. Another round on the same tier repeats the strategy that failed.
  • How does the trace record the strategy of an attempt?: The attempt event gets a strategy field with one fixed name: planned, repo_map or tier. It sits next to the number, the tier, the class and the evidence. (best practice) [sources: src/devops_cli/roadmap/implement_trace.py, tests/roadmap/test_roadmap_implement_step_attempts.py]
    • Chosen: A strategy field with a fixed name. A test reads the strategy without the text of the evidence, and a reader compares two rounds.
    • Rejected: The evidence text of the failure. It holds the reason of the failure, not the strategy of the round.
    • Rejected: The tier only. Two rounds on one tier look the same, though their strategies differ.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Alternatives check of 2026-11-07: partly.
Tool: pydantic-ai (https://pypi.org/project/pydantic-ai), MIT, last activity 2026-11-04, maintained.

Activity

  1. added
    source/agent
    on Nov 5, 2026
  2. added
    type/feature
    scope/roadmap
    status/new
    value/medium
    effort/medium
    on Nov 5, 2026
  3. dan-petty commented on Nov 5, 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/feature. The feat prefix of the title gives the type.
    • Scope: scope/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P2-Medium. Improves repair efficiency but does not block a release or fix a critical failure.
    • Value: Medium. Reduces repeated identical failures and gives a person a clear stop message when the ladder has one tier.
    • Effort: Medium. Requires changes to attempt logic, context injection, group-size rules, and stop-comment text in implement_step.py.
    • Related: feat(roadmap): a model ladder for retries, with the tier chosen per attempt #3060, which asks for a different change. Both change per-attempt behaviour in the implement step; #3060 delivers the model ladder, the candidate adds repo-map context and group-size reduction as strategy changes that use the ladder.
  4. added
    priority/p2-medium
    on Nov 5, 2026
  5. added
    status/ready
    and removed
    status/new
    on Nov 6, 2026
  6. devops-cli-service commented on Nov 6, 2026

    @devops-cli-service
    Contributor

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

    Moved to new items: #3724.

  7. devops-cli-service commented on Nov 7, 2026

    @devops-cli-service
    Contributor

    Alternatives check: partly

    Reason: The web searches timed out, so the only facts available are the package facts I read and the issue text: pydantic-ai is an actively maintained agent library that covers the retry loop and message history of an attempt, but it changes no strategy between rounds. It therefore covers only the part of the need that re-runs an attempt with the failure text, not the per-attempt strategy, repo-map context, tier ladder or stop-message setting name the issue asks for.

    Tool: pydantic-ai (https://pypi.org/project/pydantic-ai)

    • License: MIT
    • Last activity: 2026-11-04
    • Maintained: yes

    Covers:

    • retries of a failed agent run
    • message history of the earlier attempts, so the failure text can be sent again

    Lacks:

    • no strategy change between repair rounds; a repeated failure class repeats the same inputs
    • no repository-map context added on the second attempt
    • no tier ladder move on the third attempt, and no stop reason that names roadmap.implement.ladder and its value
    • no attempt trace event recording the strategy of each round

    Tools considered:

    Searches run:

    • pydantic-ai retries fallback model tier escalation per attempt, results: 0
    • LLM agent framework escalating repair strategy per retry attempt, results: 0
    • LLM agent retry strategy escalation library, results: 0
    • pydantic-ai retries, results: 0
    • langgraph retry policy, results: 0
    • agent repair retry strategies, results: 0
    • pydantic-ai retry attempt history, results: 0
    • tenacity retry, results: 0
    • python library escalate model tier on repeated agent failure, results: 0
    • aider openhands repair retry strategy, results: 0

    Sources:

    Checked on 2026-11-07. A person decides what this means for the item. The check changes no label and closes no issue.

  8. 35 remaining items

  9. devops-cli-service commented on Nov 15, 2026

    @devops-cli-service
    Contributor

    Stopped at scoped checks.

    Failure class: ci_infra.
    Action taken: none.
    Action left: retry: run the item again.

    Step Status Attempts Tokens in/out Last failing command
    group 1 done 1 2106789/10284 pytest on base: tests/roadmap/implement/test_roadmap_implement_step_attempts.py
    group 2 done 1 11045621/46781 pytest on base: tests/roadmap/implement/test_roadmap_implement_step_repair.py
    group 3 done 1 7012128/45410 pytest on base: tests/roadmap/implement/test_roadmap_implement_tier_move.py
    group 4 done 1 7221983/20115 pytest on base: tests/roadmap/implement/test_roadmap_implement_one_tier.py, tests/roadmap/implement/test_roadmap_implement_step.py
    group 5 done 1 1433166/8155 -
    scoped checks stopped 1 0/0 -

    Reason:

    SecurityError: Prohibited dangerous environment variable override: 'PYTEST_ADDOPTS'
    

    Last message of the agent (a claim that no check verified): none.

    The item is Blocked, and the job will not run it. Fix the cause. Then comment implement: retry. The Service clears the stop on its own when a new runner image rolls out, but only if a retry can fix the class of the stop and the limits of roadmap.implement.digest_clears_per_class and roadmap.implement.digest_clears_per_item allow it.

    The job kept the commits that passed on the branch feat/3569-each-repair-round-changes-the-strategy on origin. The last is 4584b4cd78b77eda723f712a06c7af16c8cf8973. The pull request stays a draft. The next run continues from it, runs no group that is ticked, and runs the scoped checks again.

  10. added
    status/blocked
    and removed
    status/in-progress
    on Nov 15, 2026
  11. devops-cli-service commented on Nov 15, 2026

    @devops-cli-service
    Contributor

    The runner Job devops-cli-implement-devops-cli-3569-4abbd6 ended: succeeded.
    Image digest: sha256:98de20a7edd09701e7b226a1931ada4763199253d241daf1151b0fe6b79f2dc5

    The last lines of its log:

    Tool call: run_command, started: grep -n md\\|markdown\\|vale .pre-commit-config.yaml | head ...
    Tool call: run_command, program grep, ok.
    Tool call: run_command, started: grep -rn CONST_ROADMAP docs | head ...
    Tool call: run_command, program grep, ok.
    Tool call: run_command, started: grep -rn implement\\.md src tests openspec ...
    Tool call: run_command, program grep, ok.
    Tool call: edit_file, ok.
    Tool call: edit_file, ok.
    Tool call: read_file, ok.
    Tool call: run_command, started: git grep -n <masked> -- docs
    Tool call: run_command, started: git grep -n <masked> -- docs/roadmap/implement.md
    Tool call: run_command, program git, ok.
    Tool call: run_command, program git, ok.
    Tool call: run_command, started: uv run devops ci docs
    Tool call: run_command, program uv, ok.
    Tool call: run_command, started: git diff --check
    Tool call: run_command, started: git diff --stat
    Tool call: run_command, program git, ok.
    Tool call: run_command, program git, ok.
    Tool call: read_file, ok.
    Tool call: edit_file, ok.
    Tool call: edit_file, ok.
    Tool call: run_command, started: uv run devops ci docs
    Tool call: run_command, program uv, ok.
    Tool call: run_command, started: git diff --stat
    Tool call: run_command, started: git diff -- openspec/changes/3569-each-repair-round-changes-the-strategy/tasks.md
    Tool call: run_command, program git, ok.
    Tool call: run_command, program git, ok.
    Tool call: run_command, started: git status --short
    Tool call: run_command, started: git log --oneline -3
    Tool call: run_command, program git, ok.
    Tool call: run_command, program git, ok.
    Tool call: run_command, started: git show --stat HEAD
    Tool call: run_command, started: git show HEAD~1 -- docs/roadmap/implement.md | ...
    Tool call: run_command, program git, ok.
    Tool call: run_command, program git, ok.
    Tool call: run_command, started: git grep -n 5\\.[12] -- openspec/changes/3569-each-repair-round-changes-the-strategy/tasks.md
    Tool call: run_command, program git, ok.
    Failure class ci_infra. Action left: retry.
    ✓ Took 0 item(s) to a ready pull request, stopped 1.
    
  12. added
    status/planned
    and removed
    owner/service
    status/blocked
    on Nov 15, 2026
  13. devops-cli-service commented on Nov 15, 2026

    @devops-cli-service
    Contributor

    Cleared the stop at scoped checks by the rule digest: the runner image changed since the stop, from sha256:98de20a7edd09701e7b226a1931ada4763199253d241daf1151b0fe6b79f2dc5 to sha256:014636e1131ac1400a333cf938c841f3ffff1b3a7deb8b63b92cb8920cd31745, and the class ci_infra of the stop is one that a new attempt can fix. The item is Planned again, and the Service takes it in the next round. The Service clears at most 1 for each class and 3 for each item by digest. A stop of another class, a new stop on this image, and a stop over a limit wait for a comment implement: retry.

  14. added
    status/in-review
    and removed
    status/planned
    on Nov 16, 2026
  15. removed
    status/in-review
    on Nov 16, 2026
  16. devops-cli-service commented on Nov 16, 2026

    @devops-cli-service
    Contributor
  17. devops-cli-service commented on Nov 16, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-16 03:02 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/p2-mediumscope/roadmapsource/agenttype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions