Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
schema: spec-driven
created: 2026-11-14
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Design

## Context

`_extra_turn` returns `_Failure(foreign)` when `_foreign_change` names a path. `_failure_of` then classifies an untyped stop from the text and the check name.

## Goals

- One class for one cause.
- The wait action, because a retry gives the same stop.

## Decisions

- **Pass the class at the stop site.** The cause is a path outside the plan, which is what `outside_plan` names.
- **Keep the text.** The comment keeps the paths for a person.

## Risks

- A foreign path that another class describes better takes `outside_plan`. The stop is about a change outside the plan, which is the cause.

## Tests

- The repair-turn test asserts `FailureClass.OUTSIDE_PLAN`, also when the path holds a classifier word.
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Proposal

## Why

A repair turn of the implement step can change a file that the step did not change. `_extra_turn` builds `_Failure(foreign)` with no class, so the classifier reads the path text and the check name. The same cause becomes `lint` in one repository and `ci_infra` in another, and a retry repeats the stop (#4390).

## What Changes

- The foreign-change stop carries `FailureClass.OUTSIDE_PLAN`.
- The class no longer depends on the path text or the check name.
- The repair-turn test asserts the class.
- The change fits one pull request.

## Capabilities

### New Capabilities

None.

### Modified Capabilities

- `roadmap-failure-taxonomy`: The foreign-change stop carries `outside_plan`.

## Impact

- Code: `src/devops_cli/roadmap/implement/implement_step.py`
- Tests: `tests/roadmap/implement/test_roadmap_implement_step_repair.py`

## Feasibility

- `_Failure` already holds a `klass`.
- `FailureClass.OUTSIDE_PLAN` maps to `FailureAction.WAIT`, which is the right action.
- Verification commands: `uv run devops ci test tests/roadmap/implement/test_roadmap_implement_step_repair.py` and `uv run devops ci --check --only lint,format,typecheck`.

## Existing Tool Considered

The classifier already exists and reads an untyped stop. The change types the stop, so no model call and no new tool.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## ADDED Requirements

### Requirement: The foreign-change stop carries outside_plan
The stop of an extra repair turn whose turn changed a path outside the allowed set SHALL carry `FailureClass.OUTSIDE_PLAN`, and its class SHALL NOT depend on the path text or the failed check name.

#### Scenario: A foreign path after an extra turn
- **WHEN** an extra repair turn changes a path outside `ask.may_change` and outside the change `tasks.md`
- **THEN** `_extra_turn` returns `_Failure` with `klass` set to `FailureClass.OUTSIDE_PLAN`

#### Scenario: The path text holds classifier words
- **WHEN** the foreign path list holds a word such as `pre-commit` or `ci`
- **THEN** the stop class remains `FailureClass.OUTSIDE_PLAN` and the action is `wait`
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Tasks

## 1. Type the foreign-change stop

Reads: `src/devops_cli/roadmap/implement/implement_step.py`. Changes: the same file and `tests/roadmap/implement/test_roadmap_implement_step_repair.py`.

- [x] 1.1 Pass `FailureClass.OUTSIDE_PLAN` at the `_Failure(foreign)` site.
- [x] 1.2 Assert the class in the repair-turn test.
- Verification: `$ uv run devops ci test tests/roadmap/implement/test_roadmap_implement_step_repair.py` passes
11 changes: 11 additions & 0 deletions openspec/specs/roadmap-failure-taxonomy/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,14 @@ When git refuses to start a rebase of the implement job, as in a checkout that h
#### Scenario: A checkout that holds a changed file at the start
- **WHEN** a tracked file of the checkout is changed when the job rebases at the start of the run
- **THEN** the item stops at the rebase with the class `ci_infra`, the comment says that the rebase did not start and names no abort, `implement.conflict` holds no file, and the job runs no `git rebase --abort`

### Requirement: The foreign-change stop carries outside_plan
The stop of an extra repair turn whose turn changed a path outside the allowed set SHALL carry `FailureClass.OUTSIDE_PLAN`, and its class SHALL NOT depend on the path text or the failed check name.

#### Scenario: A foreign path after an extra turn
- **WHEN** an extra repair turn changes a path outside `ask.may_change` and outside the change `tasks.md`
- **THEN** `_extra_turn` returns `_Failure` with `klass` set to `FailureClass.OUTSIDE_PLAN`

#### Scenario: The path text holds classifier words
- **WHEN** the foreign path list holds a word such as `pre-commit` or `ci`
- **THEN** the stop class remains `FailureClass.OUTSIDE_PLAN` and the action is `wait`
2 changes: 1 addition & 1 deletion src/devops_cli/roadmap/implement/implement_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -1844,7 +1844,7 @@ def _extra_turn(
_remove_strays(source, inputs, log)
foreign = _foreign_change(source, inputs, tree, ask)
if foreign:
return run, _Failure(foreign)
return run, _Failure(foreign, klass=FailureClass.OUTSIDE_PLAN)
return run, _exit_failure(source, inputs, keeper, log)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from pydantic_ai.usage import UsageLimits

from devops_cli.config.constants import CONST_ROADMAP_IMPLEMENT_REASON_CHARS
from devops_cli.roadmap.failure import FailureClass
from devops_cli.roadmap.implement.implement_step import (
FixRequest,
StepOutcome,
Expand Down Expand Up @@ -182,11 +183,18 @@ def test_an_extra_turn_that_changes_a_file_the_step_did_not_change_stops_the_ste

outcome = _step(store, checkout, script)

assert (outcome.status, outcome.reason, outcome.commit, is_clean_at_wip(checkout, head)) == (
assert (
outcome.status,
outcome.reason,
outcome.commit,
outcome.failure_class,
is_clean_at_wip(checkout, head),
) == (
StepStatus.STOPPED,
"The extra turn for the static check changed files that the step had not changed: "
"src/other.py.",
"",
FailureClass.OUTSIDE_PLAN,
True,
)

Expand Down