Repository navigation
Description
Problem Description
When a pull request CI check fails after an implement run pushes commits, ImplementRun._repair_after_push invokes run_fix_step.
run_fix_step passes the full CI check failure log to the model without restricting which files the model may edit.
If a repository workflow check or meta-check fails (such as Plan Check or Docs Site Build), the model attempts to fix files outside the OpenSpec change tasks.
In pull request #3961, when Plan Check failed, the repair step edited src/devops_cli/roadmap/plan_check.py instead of files within the change plan.
This behavior spent 217 model requests and 14.4 million tokens on out-of-scope code modifications, duplicated work on main, and caused merge conflicts.
Reproduction Steps
- Start an implement run on a staged roadmap item.
- Complete task groups and push commits to the pull request branch.
- If an external CI check (such as
Plan Check) fails, observeImplementRun._repair_after_pushlaunchingrun_fix_step. - Inspect the files changed by the model in the repair turn: the model edits arbitrary repository source files outside the planned change files.
Expected vs Actual Behavior
Expected: A repair turn must restrict model edits to the files declared in the change plan and fail or report an error if an out-of-scope workflow check fails.
Actual: run_fix_step permits the model to modify any file in the repository, resulting in large token spend and out-of-scope code changes.
Environment Diagnostics
- DevOps CLI Version: 0.83.0
- Python Version: 3.14.10
- Execution Environment: Kubernetes runner pod
regression of #3824
Proposed design
Problem statement
A repair turn after a push can edit any file in the repository. In pull request #3961 a failed Plan Check made the repair turn edit src/devops_cli/roadmap/plan_check.py. The turn spent 217 model requests and 14.4 million tokens. It duplicated work on main and caused merge conflicts. The change confines a repair turn to the files of the change plan. It stops the item on a check that the plan cannot fix.
Acceptance criteria
Requirement: Repair turn file scope
A repair turn SHALL permit an edit only to a path that the change plan declares.
Scenario: Edit outside the plan
- WHEN A repair turn edits
src/devops_cli/roadmap/plan_check.pyand no task group declares that path - THEN The step reports a stray file and the turn commits no change to that path.
Requirement: Out-of-scope check spends no model request
The run SHALL stop the item as Blocked with no model request when a failed check names no path of the repair scope.
Scenario: A workflow check outside the plan fails after the push
- WHEN The check
Deploy Previewfails and its annotations and its log name no path of the repair scope - THEN
_repair_after_pushcalls norun_fix_stepand the stop reason namesDeploy Preview.
Requirement: Repair scope holds every plan path
The repair scope SHALL hold each changes and creates path of every task group and each file of the change folder.
Scenario: Two groups declare a path each
- WHEN A change has two task groups and they declare
a.pyandb.py - THEN The repair scope holds
a.py,b.pyand each file of the change folder.
Requirement: In-scope check gets a repair turn
The run SHALL give an in-scope failed check at most repair_rounds repair turns.
Scenario: Static Analysis fails on a plan path
- WHEN The check
Static Analysisfails and its log namessrc/app.py, which the plan declares - THEN The run calls
run_fix_stepwithsrc/app.pyin its scope, no more thanrepair_roundstimes.
Requirement: Stop reason names the check and the scope
The stop reason of an out-of-scope check SHALL name the failed check and each path of the repair scope.
Scenario: A person reads the stop comment
- WHEN The run stops on the check
Deploy Preview - THEN The stop reason names
Deploy Previewand each path of the repair scope.
Existing Tool Considered
No alternatives check has run. No open, maintained tool or library covers the need: the change uses the file confinement and the stray-file check that run_fix_step already holds. The written cost of the own code is about 120 lines, in a scope builder src/devops_cli/roadmap/implement/implement_fix_scope.py, a path argument of run_fix_step in implement_step.py and the call in _repair_after_push in implement_run.py, with four tests. The estimate is 60000 tokens to build it, 10000 tokens each month to keep and fix it, and one day of elapsed time.
Key questions
- How does the repair turn restrict the files that the model may edit?: Pass the paths of the change plan as the files of the fix group. The step already confines a fix turn to the files of its group and reports a stray file, so
_repair_after_pushneeds no second guard. (best practice) [sources: src/devops_cli/roadmap/implement/implement_run.py, src/devops_cli/roadmap/implement/implement_step.py, tests/roadmap/implement/test_roadmap_implement_step_fix_paths.py, tests/roadmap/implement/test_roadmap_implement_strays.py]- Chosen: Pass the plan paths as the files of the fix group. The step confines a group to its
changesandcreatespaths and reports a stray file, and the teststest_roadmap_implement_step_fix_paths.pyandtest_roadmap_implement_strays.pyhold that behavior. - Rejected: Add a separate allowlist argument to
run_fix_step. It adds a second path mechanism beside the group files, and the step then enforces two scopes. - Rejected: Ask the model in the prompt to edit only plan files. A prompt is no guard. In pull request fix(roadmap): Detect obsolete spec requirements on command rename #3961 the model edited an out-of-scope file with the full log in the prompt.
- Chosen: Pass the plan paths as the files of the fix group. The step confines a group to its
- How does the run tell a check that the plan can fix from one that it cannot?: Compare the failed check with the repair scope. A check is in scope when its annotations or its log name a path of the repair scope. A check with no such path is out of scope. (best practice) [sources: src/devops_cli/roadmap/implement/implement_run.py, src/devops_cli/github/check_verdict.py, docs/adr/0004-ci-is-the-authoritative-gate.md]
- Chosen: Match the annotations or the log of the check against the repair scope. It uses the evidence of the failing check itself and needs no list of check names.
read_check_runsalready reads the check runs and their annotations. - Rejected: Match the log text only. A log may hold no path, and an annotation names the file and the line.
- Rejected: Hard-code the names of the workflow checks. The required check names are pinned by ADR 0004, but a repair turn cannot fix the title check, and a new check makes the list stale.
- Chosen: Match the annotations or the log of the check against the repair scope. It uses the evidence of the failing check itself and needs no list of check names.
- What does the run do when a failed check is out of scope?: Stop the item as Blocked with a reason that names the check and the repair scope. Push the ticks that passed, and make no model request. (best practice) [sources: CONTEXT.md, src/devops_cli/roadmap/implement/implement_run.py]
- Chosen: Stop the item as Blocked and report the check. Blocked is the status for a wait outside the roadmap, and a person reads the reason and comments
implement: retry(CONTEXT.md). - Rejected: End the run with an error. An error loses the ticks that passed and the record of the failed check.
- Rejected: Run the repair turn with no editable file. The model then answers with no edit, and the run spends a model request for nothing.
- Chosen: Stop the item as Blocked and report the check. Blocked is the status for a wait outside the roadmap, and a person reads the reason and comments
- Does the repair scope include the change folder?: Yes. The scope holds each
changesandcreatespath of every task group and each file of the change folder, so a repair turn can tick a task. (best practice) [sources: CONTEXT.md, openspec/changes/archive/2026-11-01-3043-runner-hooks-and-scoped-ci/design.md]- Chosen: Include the change folder. The job ticks each task of a group whose exit checks pass, and a repair turn may tick a task (CONTEXT.md).
- Rejected: Hold only the source paths of the groups. A repair turn that cannot write
tasks.mdcannot record a tick, and the job then repeats the work.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Alternatives check of 2026-11-10: none.
Tool: none found.
Activity
dan-petty commentedon Nov 7, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
fixprefix of the title gives the type.(roadmap)scope of the title gives the scope.The defect wastes 14.4 million tokens per occurrence and causes merge conflicts on main.Prevents large token spend and out-of-scope code changes that break the build.Requires modifying run_fix_step to enforce a file allowlist and report out-of-scope check failures.devops-cli-service commentedon Nov 7, 2026
Status set to Ready at b659660 (see proposed design in issue body).
devops-cli-service commentedon Nov 10, 2026
Alternatives check: none
Reason: One search found only generic filesystem MCP servers that limit paths, such as the Filesystem reference server. The issue needs more than that. A repair turn must be confined to the paths a change plan declares, and a failed CI check that names none of those paths must stop the item as Blocked. The need is internal to this project's
run_fix_stepand_repair_after_push, which already hold the group-file confinement and the stray-file check. No open tool covers it.Tool: none found
Covers:
Lacks:
Searches run:
Sources:
Checked on 2026-11-10. A person decides what this means for the item. The check changes no label and closes no issue.
devops-cli-service commentedon Nov 11, 2026
Released in v0.112.3: https://github.com/dan-petty/devops-cli/releases/tag/v0.112.3
devops-cli-service commentedon Nov 11, 2026
Live since 2026-11-11 19:36 UTC