Repository navigation
Description
Problem Description
The implement repair turn aborts when an agent restores or reverts a source file.
During an implement repair turn for fail-to-pass checks, _fail_to_pass_failure restricts repair_paths to the test files. At the start of the repair turn, tree = _tree(source) records the git tree of the checkout.
If the model agent runs git commands or restores a non-test file to match the base commit (keeper.base), _foreign_change compares the checkout to tree. Because the restored file differs from tree, _foreign_change detects a change in an unallowed file.
The step then aborts with:
The extra turn for the static check changed files that the step had not changed: <paths>.
This stops the job even when the agent only cleaned up uncommitted edits.
Reproduction Steps
- In an implementation step with a
fail-to-passtest failure, enter a repair round. - The repair round permits edits only to test files.
- In the repair round, touch or revert an edit in a non-test file (such as running
git stashorgit checkout -- <file>). - Complete the repair turn.
- Observe that
_foreign_changeaborts the step withimplement_stop_repair_turn_changed.
Expected vs Actual Behavior
Expected: _foreign_change allows working files whose contents match keeper.base. Reverting a file back to its base state does not abort the repair turn.
Actual: _foreign_change compares only against tree from the start of the turn. Reverting a modified file back to base is treated as an unauthorized modification.
Environment Diagnostics
- DevOps CLI Version: 0.82.0
- Python Version: 3.14.10
- OS & Architecture: Linux x86_64
- Execution Environment: DevContainer
Alternatives check of 2026-11-10: covers.
Tool: git/git (https://github.com/git/git), NOASSERTION, last activity 2026-11-09, maintained.
Proposed design
Problem statement
The extra repair turn of an implement step stops with implement_stop_repair_turn_changed when the agent restores a file to its content at keeper.base. _foreign_change compares the checkout only with tree, the tree taken at the start of the turn. A restoration then looks like an edit of a file outside repair_paths. The step must accept a file whose content equals keeper.base. It must still stop on a real foreign change.
Acceptance criteria
Requirement: Restored file passes
The extra turn SHALL accept a file outside repair_paths whose content equals its content at keeper.base.
Scenario: Revert a modified source file to base
- WHEN The step modified a source file before the extra turn, and the agent reverts that file to its content at
keeper.base. - THEN
_foreign_changereturns None, and the step continues with the exit checks.
Requirement: Foreign edit stops the turn
The extra turn MUST stop when a file outside repair_paths holds content that differs from tree and from keeper.base.
Scenario: Write new content into a source file
- WHEN The agent writes new content into a source file outside
repair_paths, and that content differs fromtreeand fromkeeper.base. - THEN
_foreign_changereturns the reasonimplement_stop_repair_turn_changedand names that file.
Requirement: Deleted base file stops the turn
The extra turn MUST stop when the agent deletes a file outside repair_paths that exists at keeper.base.
Scenario: Delete a source file
- WHEN The agent deletes a source file outside
repair_pathsthat exists intreeand atkeeper.base. - THEN
_foreign_changereturns the reasonimplement_stop_repair_turn_changedand names the deleted file.
Requirement: New file stops the turn
The extra turn MUST stop when the agent adds a file outside repair_paths that exists in neither tree nor keeper.base.
Scenario: Add a source file
- WHEN The agent adds a file outside
repair_pathsthat exists in neithertreenorkeeper.base. - THEN
_foreign_changereturns the reasonimplement_stop_repair_turn_changedand names the new file.
Requirement: Repair paths pass
The extra turn SHALL accept any change to a path in repair_paths and any change to the tasks.md of the change.
Scenario: Edit a test file
- WHEN The agent changes a test file that
_fail_to_pass_failureput inrepair_paths. - THEN
_foreign_changereturns None, and the step continues with the exit checks.
Requirement: Hook turn uses the same rule
The extra turn for a failed hook SHALL use the same rule for a restoration to keeper.base as the repair turn for a failed static check.
Scenario: Restore a source file in the hook turn
- WHEN The agent restores a source file outside
repair_pathsto its content atkeeper.baseduring the turn for a failed hook. - THEN
_foreign_changereturns None, and a source file with new content still gives the stop reason.
Existing Tool Considered
Git (https://github.com/git/git, maintained) covers the need, and the step already calls it. git diff --cached --name-only -z <commit> lists the paths that differ from a commit. The change runs it once more, against keeper.base, and subtracts the result from the paths that differ from tree. Git lacks the project rule that decides which paths the turn may change. That rule stays in _foreign_change, and so do its unit tests. No new dependency, library or parsing code is needed. The cost of own code is one small function change and its unit tests.
Key questions
- How does
_foreign_changetell a restoration tokeeper.basefrom a foreign change?: Add abaseargument to_foreign_change(src/devops_cli/roadmap/implement/implement_step.py:1565)._extra_turnpasseskeeper.base, a commit id that the keeper sets in__post_init__(src/devops_cli/roadmap/implement/implement_wip.py:117). Aftergit add -A, rungit diff --cached --name-only --no-renames -z <base>as well as the diff againsttree. A path that differs fromtreebut not frombaseis a restoration and passes. Every other path outsiderepair_pathsand thetasks.mdstays foreign. A deleted or added file differs frombase, so it stays foreign. (best practice) [sources: src/devops_cli/roadmap/implement/implement_step.py:1565, src/devops_cli/roadmap/implement/implement_wip.py:117, openspec/changes/archive/2026-10-30-2795-static-failure-repair-turn/proposal.md:37]- Chosen: Subtract the base diff from the tree diff. It reuses the Git call that
_foreign_changealready makes. It needs one more Git call and one set operation. - Rejected: Compare the blob id of each changed path. It needs one
git rev-parse <base>:<path>call for each path and more parsing code. - Rejected: Add every file the step touched to
repair_paths. It permits a real edit of those files during the turn, so the check stops guarding them. - Rejected: Compare content hashes in Python. It reads every changed file into the process and copies a function that Git already provides.
- Chosen: Subtract the base diff from the tree diff. It reuses the Git call that
- Does the allowance change the other extra turn, which shares
_foreign_change?: Yes. The extra turn for a failed hook and the extra turn for a failed static check or fail-to-pass check call the same helper through_extra_turn. Both get the rule. No turn asks for a tick now, because the job ticks the group (fix(roadmap): the job owns the ticks and the strays of a step #3488), so the old tick turn rule no longer applies. (best practice) [sources: src/devops_cli/roadmap/implement/implement_step.py:1578, src/devops_cli/roadmap/implement/implement_step.py:1624]- Chosen: One shared rule in
_foreign_change. A restoration to base is no content change in any turn. One helper keeps one rule. - Rejected: A flag that allows restorations in the repair turn only. It adds a parameter and a branch for no gain, because the hook turn has the same case.
- Chosen: One shared rule in
- Where do the unit tests for the restoration case go?: Put them in the test module for
implement_step.pythat calls_foreign_change. No test calls_foreign_changenow, so the change adds the first unit tests for it. Use a temporary Git repository with a base commit. [sources: src/devops_cli/roadmap/implement/implement_step.py:1565] - The alternatives check says that Git covers the need (
https://github.com/git/git). Adopt it as it is, or keep the item with a reason?: Keep the item. The step already uses Git, and the change adds one Git call and one set operation. Git does not hold the project rule for the paths that a turn may change. My recommendation is to keep the item as proposed. (a person decides)
Open questions
- The alternatives check says that Git covers the need (
https://github.com/git/git). Adopt it as it is, or keep the item with a reason? (a person decides) - The alternatives check found that
https://github.com/git/gitcovers this item. Adopt the tool, or keep the item and give the reason. (a person decides)
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
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.A false positive that aborts a step, but the agent can avoid it by not restoring files.Prevents a legitimate cleanup action from stopping the job.The fix adds a keeper.base comparison to the existing _foreign_change check.Both concern the implement repair turn, but #3577 adds repair rounds while the candidate fixes a false positive in that turn's foreign-change check.devops-cli-service commentedon Nov 8, 2026
Status set to Ready at 2335754 (see proposed design in issue body).
devops-cli-service commentedon Nov 10, 2026
Alternatives check: covers
Reason: Git already covers the need.
git diff --cached --name-only -z <keeper.base>lists the paths that differ from the base commit, and the issue's design subtracts that set from the paths that differ fromtree. No new library is needed. No ADR indecisionsrejects Git for this.Tool: git/git (https://github.com/git/git)
Covers:
Lacks:
_foreign_changeand its unit tests still has to be written in the project's codeTools considered:
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 10, 2026
Status set back to New at e99dc01. Refine cannot set this item to Ready at e99dc01 until a person answers the questions below. Reply in a comment or edit the body, and the next refine round looks at the item again.
https://github.com/git/git). Adopt it as it is, or keep the item with a reason? (a person decides)https://github.com/git/gitcovers this item. Adopt the tool, or keep the item and give the reason. (a person decides)devops-cli-service commentedon Nov 14, 2026
Released in v0.138.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.138.0
devops-cli-service commentedon Nov 14, 2026
Live since 2026-11-14 15:02 UTC