Skip to content
3 changes: 2 additions & 1 deletion docs/ROADMAP_WORKFLOW.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ Each clear by digest adds an entry (the class, the new digest and the time) to `

## The failure classes

A stop has a class (`roadmap/failure.py`, #3065). A stop site that knows its cause passes the class itself (#3476): the classes `no_change_in_fix`, `tests_lost`, `head_moved`, `output_cap` and `limit_reached` come from the step, and no rule makes them. For any other stop, the classifier is a pure function of the error text, the exit status, the refusal of a tool, the name of the check and the log of the check. It never reads the last message of the agent, which is a claim that no check verified. A failure that no rule matches is `ci_infra`. The stop comment starts with the failed check and the end of its log, then names the class, the action taken and the action left. It shows the last message of the agent as a claim that no check verified. The Job log holds one line with the class and the action left. The Service adds 1 to `devops_cli_service_implement_failures_total` with the labels `class` and `repo` when a round reports the Job. A Job that left the Item with no result gets the class of the tail of its log.
A stop has a class (`roadmap/failure.py`, #3065). A stop site that knows its cause passes the class itself (#3476): the classes `no_change_in_fix`, `tests_lost`, `head_moved`, `output_cap`, `limit_reached` and `outside_plan` come from the step, and no rule makes them. For any other stop, the classifier is a pure function of the error text, the exit status, the refusal of a tool, the name of the check and the log of the check. It never reads the last message of the agent, which is a claim that no check verified. A failure that no rule matches is `ci_infra`. The stop comment starts with the failed check and the end of its log, then names the class, the action taken and the action left. It shows the last message of the agent as a claim that no check verified. The Job log holds one line with the class and the action left. The Service adds 1 to `devops_cli_service_implement_failures_total` with the labels `class` and `repo` when a round reports the Job. A Job that left the Item with no result gets the class of the tail of its log.

| Class | Default action | Meaning |
| :--- | :--- | :--- |
Expand All @@ -181,6 +181,7 @@ A stop has a class (`roadmap/failure.py`, #3065). A stop site that knows its cau
| `output_cap` | `raise_limit` | A model reply reached the output cap of the step |
| `limit_reached` | `raise_limit` | A step spent a token budget or a time limit of `roadmap.implement`. The reason names the setting and its value. See [the budgets](#checks-of-the-implement-job) |
| `read_only_path` | `wait` | A command wrote to a path that the Job mounts read-only. A new attempt or a new runner image writes to the same path, so a person fixes the cause |
| `outside_plan` | `wait` | A fix step changed, added or deleted a path that the plan does not name (a path in a code span of any group, or a file of the change folder). The stop names the paths and holds the discarded diff. A person decides whether the plan changes |

The Job runs these actions by itself:
- the fix rounds of `roadmap.implement.repair_rounds` for a failed check,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
schema: spec-driven
created: 2026-11-07
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Design

## Decisions

- **The check runs in `_exit_failure`, after the stage and before the test and static checks.**: A fix step that edited another path has failed, whatever the later checks say. An early stop spends no command run on work that is discarded.
- **The plan names a path in a code span of any group.**: `stray_files` uses the same rule. It holds the `Reads:` line and the `Changes:` line that the issue names, and also a plan that the stage job wrote with no such line. A rule on `Changes:` alone would stop every fix step of a plan with no such line.
- **The change folder is always allowed.**: A fix step runs after the archive, so the folder of the change is in `openspec/changes/archive/`. A repair of a check on the change files stays inside the plan.
- **The new class `outside_plan` has the action `wait`.**: The cause is a decision of a person: change the plan, or accept the edit. `retry` or `repair` would run the same fix again. `plan_defect` has the action `amend`, which edits a group of the plan, and that is not the remedy for a check whose cause lies in code that the plan did not list.
- **The failure has no repair paths.**: An extra turn would give the model one more try at the same edit.
- **A deleted or renamed path counts.**: `git diff --name-only --no-renames` lists the old path of a rename and the deleted path, so a fix step cannot remove a file outside the plan.
- **A group step is not checked.**: The plan names the files of a group, and #3092 keeps the stray rule for them. The issue is about the fix step.

## Rejected alternatives

- **Return the item to `New` on a stop.**: `devops roadmap return` drops the pull request and the work. The existing stop keeps the branch, comments the evidence and leaves the item Blocked with the action `wait`. A person can then decide with the work in view.
- **Check only the `changes` paths.**: The title of the issue says "the paths that the plan names", and the proposed solution lists `changes` and `reads`. The code spans of the text hold both.
- **Check the paths in the prompt only.**: A prompt is a request, and the model said it was done after changing nothing (#2116). The step must judge the exit, not the model.
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Proposal

## Why

A fix step of the Service edited paths that the plan does not name (#3824). On #3808, the fix for #3536, the step "Make check Plan Check pass" changed `src/devops_cli/roadmap/plan_check.py`, `docs/roadmap/plan-check.md` and `openspec/specs/roadmap-plan-check/spec.md`, and the next step added a test for those lines. The plan named two paths. The edit made a check pass by narrowing it, and the pull request body did not say so. One failed check led to two more edits outside the plan. The owner rule is to write no compensating code and to leave such an item for a person (AGENTS.md rule 2).

## What Changes

- After a fix step, the exit checks compare every path that the step changed, added or deleted with the paths that the plan names. A step that touched another path stops with the new class `outside_plan` and the action `wait`.
- The plan names a path in a code span of the text of any group of `tasks.md`. This holds the `Reads:` line, the `Changes:` line and the tasks. A file under the change folder of the item is always allowed.
- The stop is a normal stop of the job. Its comment holds the failed check, the end of its log, the reason with each path, and the discarded diff. The step resets the checkout. No repair round runs, for the failure has no repair paths.
- A group step is not checked. Its group names its files, and the stray rule of #3092 already covers it.
- This replaces the rule of #3488 that a fix step keeps a new file under `src/`, `tests/`, `docs/` or `openspec/`. A fix step keeps a new file only when the plan names it.
- A consumer observes the stop, the class and the comment, so the change carries spec deltas.
- The change fits one pull request.

## Capabilities

### New Capabilities

None.

### Modified Capabilities

- `roadmap-implement-step`: A fix step changes only the paths that the plan names.
- `roadmap-failure-taxonomy`: The new class `outside_plan` waits for a person.

## Impact

- Code: `src/devops_cli/roadmap/implement/implement_step.py`, `src/devops_cli/roadmap/implement/implement_strays.py`, `src/devops_cli/roadmap/failure.py`, `src/devops_cli/lang/en/messages.py`
- Documents: `docs/ROADMAP_WORKFLOW.md`

## Feasibility

Checked against `origin/main` at `b6af763b`.

- `_exit_failure` in `implement_step.py` already stages the checkout and runs the exit checks in order. A check after the stage sees every path of the step, deletions included, with `git diff --cached --name-only --no-renames -z <base>`. For a fix step `keeper.base` is the commit at the start of the step, because a fix step ticks no task and makes no `wip:` commit.
- `implement_strays.py` already reads the paths that a group names as the code spans of its text. The new check reuses that rule for all groups, so a plan with no `Reads:` line is read the same way.
- `_extra_ask` gives an extra turn only to a failure with `repair_paths`. A `_Failure` without them stops the step at once, which is what the issue asks.
- `implement_run._stopped_by` already carries the class, the check, its log and the discarded diff into the stop comment, and `stop()` sets the item to Blocked. The issue asks to set the item back to `New` with return-style evidence. This change keeps the existing stop, which holds the same evidence, and leaves the item with a person under the action `wait`, as for `no_change_in_fix` and `tests_lost`. A return to `New` would drop the branch and the draft that the stop keeps.
- The history of #2116 shows "The agent changed no file" at the fix stage four times. #3476 covers that case with the class `no_change_in_fix`, so it needs no change here. #3645 changes `implement_run.py` for the scoped checks and does not touch `_exit_failure`. The open branch of #2804 changes `implement_step.py` in another function. Neither overlaps.

## Existing Tool Considered

No open tool judges the paths of an agent edit against a plan of this repository. The change reuses `stray_files`, `parse_task_groups` and `git diff`. It adds no dependency. To build it costs about 40k tokens to write, about 3k tokens a month to keep, and about 2 hours of elapsed time. The change deletes no internal code.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## MODIFIED Requirements

### Requirement: The failure classes
The failure taxonomy SHALL have these 19 classes: `provider`, `parser`, `test`, `lint`, `types`, `plan_defect`, `premise_false`, `oom`, `timeout`, `refused_tool`, `conflict`, `ci_infra`, `no_change_in_fix`, `tests_lost`, `head_moved`, `output_cap`, `read_only_path`, `limit_reached` and `outside_plan`.

#### Scenario: The class list
- **WHEN** a test reads the classes of the taxonomy
- **THEN** it finds these 19 and no other

### Requirement: One default action for each class
`ACTION_BY_CLASS` SHALL give each class exactly one default action: `provider`, `timeout`, `ci_infra` and `head_moved` `retry`; `parser` `change_tier`; `test`, `lint` and `types` `repair`; `plan_defect` `amend`; `premise_false` `return`; `oom`, `output_cap` and `limit_reached` `raise_limit`; `refused_tool`, `conflict`, `no_change_in_fix`, `read_only_path`, `tests_lost` and `outside_plan` `wait`.

#### Scenario: The table
- **WHEN** a test reads the table
- **THEN** its keys are the 19 classes and each value is the action above

#### Scenario: A new runner image and a lost test
- **WHEN** an item stopped with the class `tests_lost`, and the digest in the template differs from the digest of its Job
- **THEN** the rule `digest` does not clear the stop
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
## MODIFIED Requirements

### Requirement: A step removes the stray files of the agent
Before the exit checks stage the checkout, and again after the extra turn, the step SHALL unstage and delete each stray file and SHALL give it to no tool. A stray file is an untracked or added file that git does not ignore, a nested git repository, or a file that the group does not allow.

#### Scenario: A scratch file in the root
- **WHEN** the model writes `tmp_test_x.py` with an unused import in the checkout root, writes the files of the group, ticks the tasks, and ends its run
- **THEN** the step reports done, the file is not in the tree or in the commit, no tool got its name, and `removed` lists `tmp_test_x.py`

#### Scenario: A new test file in the directory of the group
- **WHEN** the model writes `tests/test_sample_more.py` next to the named `tests/test_sample.py`
- **THEN** the step keeps the file, and the commit holds it

#### Scenario: A file of the project directories that the plan does not list
- **WHEN** the model writes `tests/data.json`, `tests/conftest.py` and `src/helper.py`, which the group does not name
- **THEN** the step keeps the files, ends done, and the commit holds them

#### Scenario: A nested git repository
- **WHEN** the model runs `git init sub` and writes `sub/a.txt`
- **THEN** the step removes `sub/` with its files, lists `sub/` in `removed`, and ends done

#### Scenario: A fix step
- **WHEN** a fix step runs and the model writes a new file outside `src/`, `tests/`, `docs/` and `openspec/`
- **THEN** the step deletes the file

#### Scenario: A fix step with a new test file
- **WHEN** a fix step runs and the model writes a new file under `tests/` that the plan names
- **THEN** the step keeps the file and stages it

#### Scenario: A staged stray file
- **WHEN** the agent stages a new file outside `src/`, `tests/`, `docs/` and `openspec/` with `git add`
- **THEN** the step unstages the file and deletes it, in a group step and in a fix step

#### Scenario: A staged rename into a stray name
- **WHEN** the agent renames `src/other.py` to `tmp_test_x.py` with `git mv`
- **THEN** the step unstages and deletes `tmp_test_x.py`, and puts back `src/other.py`, so that the commit and the work in progress keep the file

#### Scenario: A file in a directory that the group does not name
- **WHEN** the model writes `scripts/probe.py`, which the group does not name
- **THEN** the step deletes the file

#### Scenario: The agent is told
- **WHEN** a scratch file was removed and `ruff check` fails on a file of the group
- **THEN** the message of the extra turn names the removed file and says that the group does not name it

#### Scenario: A stray file in the extra turn
- **WHEN** the model writes a scratch file in the extra turn
- **THEN** the step deletes it, and does not stop for a file that it had not changed

#### Scenario: An ignored file
- **WHEN** the model writes a file under `.data/agent/scratch/`
- **THEN** the step does not list it, deletes nothing, and the commit holds no such file

#### Scenario: The paths that a group allows
- **WHEN** the group names a path in a code span, and the model writes files under its change folder, under `src/`, `tests/`, `docs/` or `openspec/`, and at the named path
- **THEN** the step keeps those files, and it names each removed file in the Job log, in `StepOutcome.removed` and in the extra turn

## ADDED Requirements

### Requirement: A fix step changes only the paths that the plan names
A fix step SHALL stop with the class `outside_plan` when it changed, added or deleted a path that the plan does not name. The plan names a path in a code span of the text of any group of its `tasks.md`, which includes the `Reads:` line, the `Changes:` line and the tasks. A file under the change folder of the item is always allowed. The stop SHALL reset the checkout, SHALL name each path in its reason, and SHALL run no repair round. A group step SHALL NOT be subject to this rule.

#### Scenario: A fix step edits a path that the plan does not name
- **WHEN** a fix step writes `src/sample.py`, which the plan names, and `src/other.py`, which it does not
- **THEN** the step reports stopped with the class `outside_plan`, the reason names `src/other.py` and not `src/sample.py`, the diff holds the edit of `src/other.py`, no repair round ran, and the checkout is at its start commit

#### Scenario: A fix step adds an unnamed file
- **WHEN** a fix step writes a new file `tests/test_sample_fix.py` that the plan does not name
- **THEN** the step reports stopped with the class `outside_plan`

#### Scenario: A fix step deletes an unnamed file
- **WHEN** a fix step deletes `src/other.py`, which the plan does not name
- **THEN** the step reports stopped with the class `outside_plan`, and the file is back in the checkout

#### Scenario: A fix step edits only named paths and the change folder
- **WHEN** a fix step edits `src/sample.py`, which the plan names, and `design.md` of the change folder
- **THEN** the step ends done
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Tasks

## 1. Stop a fix step that changes an unnamed path

Kind: behavior. Reads: `src/devops_cli/roadmap/implement/implement_step.py`, `src/devops_cli/roadmap/implement/implement_strays.py`, `src/devops_cli/roadmap/failure.py`, `src/devops_cli/lang/en/messages.py`. Changes: `src/devops_cli/roadmap/implement/implement_step.py`, `src/devops_cli/roadmap/implement/implement_strays.py`, `src/devops_cli/roadmap/failure.py`, `src/devops_cli/lang/en/messages.py`, `tests/roadmap/implement/test_roadmap_implement_step_fix_paths.py` (new), `tests/roadmap/test_roadmap_failure.py`, `tests/roadmap/implement/test_roadmap_implement_strays.py`.

- [x] 1.1 Write tests: a fix step that edits, adds or deletes an unnamed path stops with the class `outside_plan` and resets the checkout, and one that edits a named path or a file of the change folder ends done
- Verification: `uv run devops ci test tests/roadmap/implement/test_roadmap_implement_step_fix_paths.py` fails on the base
- [x] 1.2 Add `unplanned_paths`, the check in `_exit_failure`, the class `outside_plan` with the action `wait`, and the reason of the stop
- Verification: `uv run devops ci test tests/roadmap/implement/test_roadmap_implement_step_fix_paths.py tests/roadmap/test_roadmap_failure.py tests/roadmap/implement/test_roadmap_implement_strays.py` passes

## 2. Document the class

Kind: docs. Reads: `docs/ROADMAP_WORKFLOW.md`. Changes: `docs/ROADMAP_WORKFLOW.md`.

- [x] 2.1 Add the class `outside_plan` to the list and the table of failure classes
- Verification: `git grep -n outside_plan docs/ROADMAP_WORKFLOW.md`

## Criteria

- Group 1: ### Requirement: A fix step changes only the paths that the plan names A fix step SHALL stop with the class outside_plan when it changed, added or deleted a path that the plan does not name.
- Group 1: ### Requirement: The failure classes The failure taxonomy SHALL have these 19 classes.

## Workflow follow-up

- Pending a person: review the diff in tuicr (tuicr -r <base>..HEAD).
Loading
Loading