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
1 change: 1 addition & 0 deletions docs/ROADMAP_WORKFLOW.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ These are all the keys of the job record, by the job that writes them:
| Implement | `implement.result` | How the run of the Job ended: `ready`, `stopped`, `yielded` or `returned`. The Job writes it as the last mark of its end and clears it in its first record write. The Service clears it when it records a new Job. A Job with `ready`, `yielded` or `returned` caused no stop, so the Service sets no stop for the Status that it left. A Job with no result, such as a killed pod, gets its class from its log |
| Implement | `implement.checked_sha`, `implement.published_sha` | The head that passed the scoped checks, and the head that the job pushed. A Job that starts at the same head skips that phase, so a Job that was killed does not repeat it. The job writes each one when its phase passes, and clears both at ready and at a return to New |
| Implement | `implement.job`, `implement.job_state`, `implement.job_digest` | The runner Job that the Service made, its state after a round reported it, and the digest of the runner image that the Job ran |
| Implement | `implement.needs_fix` | The draft pull request that the Service logged as left out for the label `plan/needs-fix`. A round that judges the Item and does not leave it out for the label clears it, so a new label is logged again |
| Implement | `implement.continuations` | The count of the Jobs that the Service made to continue a run that ended with no result. It holds a count and no other data, and it stays after a clear |
| Implement | `implement.digest_clears`, `implement.digest_clear_commented_at` | The clears of a stop by a new runner image (the class, the digest and the time of each), which stay after a clear, and the time of the last comment of such a clear |

Expand Down
2 changes: 1 addition & 1 deletion docs/roadmap/implement.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ The effort of an item picks its pass: the job runs one pass for each value of th

The job leaves out a Planned item whose title has no Conventional Commit type, or whose title summary has more than 60 characters. It judges the title before it reads the plan or makes a model request. `devops roadmap retitle` shortens such a title.

The job also leaves out an item whose plan fails the stage gates, or whose plan the reader cannot read. The job checks a Staged item on its branch, and a Planned item on the default branch. The job names the first problem in the report and in `devops roadmap explain`. No runner Job starts for such an item. A run lists the files of the default branch and reads its base specs one time. The job gives them to the check of every item. The check lists the branch of each Staged item for that item.
The job also leaves out an item whose plan fails the stage gates, or whose plan the reader cannot read. The job checks a Staged item on its branch, and a Planned item on the default branch. The job names the first problem in the report and in `devops roadmap explain`. No runner Job starts for such an item. The job also leaves out a Staged item while its draft holds the label `plan/needs-fix`, which the review of the stage job sets on a plan with an open finding. The reason names the label and the pull request. The Service logs such an item once for each draft and records the draft in `implement.needs_fix`. When the label is gone, the job takes the item again. A run lists the files of the default branch and reads its base specs one time. The job gives them to the check of every item. The check lists the branch of each Staged item for that item.

- A **Staged** item has its staged branch and draft on `origin`.
- A **Planned** item has its change folder on the default branch and no branch. The job makes the branch `<type>/<issue>-<slug>` there, with the slug of the folder. It opens the draft when the branch first holds a commit.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
schema: spec-driven
created: 2026-11-11
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Design

## Decisions

- The judge reads the label from the `PullStatus` that `_pull_reason` reads already. The check needs no new request, and it applies to the plan of the Service and to the plan of the runner Job (`--item`), because both call `plan_implement`.
- The check uses the constant `PLAN_NEEDS_FIX_LABEL` of `stage_verify.py`, the one that the stage job applies and the row `stage_ready` reads. The messages take the label as a value, so the code holds no second copy of the label text.
- The judge keeps the items that it leaves out for the label, and `ImplementPlan.needs_fix` returns them. The judge stays free of writes, because the module plans only.
- The row `implement` logs an item once for each draft. It records the draft in `implement.needs_fix`, as the row `stage_ready` records `stage.needs_fix` when it tells about the label once. A round clears the mark only for an item that its plan judged: with the limit 1 of the Service, the walk stops after the first item that it takes, and an item that it did not judge keeps its mark, so a later round does not log it again.
- When the label is gone, the item is free again at once: the judge reads the label in each round, and the mark gates only the log line.

## Rejected alternatives

- Leave out every unmerged plan, as #4078 and #4041 propose. That changes the Staged route of the job, which takes a plan on its staged branch by design. This change keeps that route and reads only the label that the review sets already.
- Read the check runs of the plan, as #3976 proposes. A plan with an open finding can pass every check, so the check runs do not show the finding.
- Comment on the issue when the job leaves the item out. The stage comment already lists the open findings, and the row `stage_ready` comments on the draft. A third comment adds noise for a person, so the Service logs the skip once and the plan report and `devops roadmap explain` give the reason.
- Log the skip in each round. The row runs every seven minutes, so a held item would add a log line in each round.
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Proposal

## Why

The implement job takes a Staged item while the draft pull request of its plan holds the label `plan/needs-fix`. The stage job sets the label when the model review of the plan finds an open finding (`_label_needs_fix` in `src/devops_cli/roadmap/stage/stage.py`, constant `PLAN_NEEDS_FIX_LABEL` in `src/devops_cli/roadmap/stage/stage_verify.py`). The row `stage_ready` keeps such a draft a draft, but `_Judge._pull_reason` in `src/devops_cli/roadmap/implement/implement.py` accepts every open draft. On 2026-11-10 the Service started a runner Job for #3443 6 minutes after its plan #4352 got the label, and for #3451 7 minutes after its plan #4353 got the label. Both Jobs stopped on `limit_reached`, and each spent its step budget on a plan that the review refused (#4477).

## What Changes

- `_Judge._pull_reason` leaves out an open draft that holds `PLAN_NEEDS_FIX_LABEL`, with a reason that names the label and the pull request. The judge reads the labels from the `PullStatus` that it reads already, so the change adds no request. The judge keeps such items, and `ImplementPlan.needs_fix` returns them.
- The row `implement` of the Service logs each such item once for each draft. The round records the draft in the new mark `implement.needs_fix`, and returns only the items that it did not record yet. A round that judges the item and does not leave it out for the label clears the mark, so a new label is logged again.
- When the label is gone, the judge takes the item again, because it reads the label in each round.
- `docs/roadmap/implement.md` and the record table of `docs/ROADMAP_WORKFLOW.md` name the reason and the mark.
- The change fits one pull request.

## Capabilities

### New Capabilities

None.

### Modified Capabilities

- `roadmap-implement-job`: The job leaves out a Staged item whose draft holds the label `plan/needs-fix`

## Impact

- Code: `src/devops_cli/roadmap/implement/implement.py`, `src/devops_cli/roadmap/implement/implement_submit.py`, `src/devops_cli/roadmap/run.py`, `src/devops_cli/roadmap/stores/store.py`, `src/devops_cli/lang/en/messages.py`
- Documents: `docs/roadmap/implement.md`, `docs/ROADMAP_WORKFLOW.md`
- Tests: `tests/roadmap/implement/test_roadmap_implement_selection.py`, `tests/roadmap/implement/test_roadmap_implement_submit.py`, `tests/support/roadmap_implement.py`
- Settings: none. The live ConfigMap needs no change.

## Feasibility

- `devops gh api repos/dan-petty/devops-cli/issues/4352/events` showed the label `plan/needs-fix` set by the App at 2026-11-10T10:51:32Z and removed by a person at 13:47:05Z. The same read of #4353 showed 11:40:27Z and 14:16:43Z.
- `kubectl -n devops get jobs` showed `devops-cli-runner-20261110-105724-b626` (args `roadmap implement --item 3443 --confirm`, start 10:57:29Z) and `devops-cli-runner-20261110-114742-c187` (args `--item 3451`, start 11:47:47Z). `kubectl -n devops logs` of both showed `Failure class limit_reached. Action left: raise_limit.` and `stopped 1`.
- `grep -rn "needs-fix\|NEEDS_FIX" src/devops_cli/roadmap/implement/` found nothing. `_label_needs_fix` in `stage.py` sets the label, and `_settle` in `stage_ready.py` reads it from `PullStatus.labels`.
- `_Judge._pull_reason` in `implement.py` reads `PullStatus` with `client.get_pull_status` and checks only `is_open_draft`. `PullStatus.labels` in `src/devops_cli/github/client.py` holds the label names.
- `run_implement_round` in `implement_submit.py` calls `plan_implement` for the Service, and the runner Job calls it with `--item`, so one check in the judge covers both.
- First check: `uv run devops ci test tests/roadmap/implement/test_roadmap_implement_selection.py tests/roadmap/implement/test_roadmap_implement_submit.py`.
- Second check: `uv run devops openspec check`.

## Existing Tool Considered

The change uses the label that the stage review sets already, the `PullStatus` that the judge reads already, and the record marks of the store. `stage_ready.py` uses the same pattern for `stage.needs_fix`: it tells about the label once and records the draft. No open tool decides which roadmap item a job takes. Written cost: about 30k tokens to build, keep and fix, and 1.5 hours of elapsed time.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## ADDED Requirements

### Requirement: The job leaves out a Staged item whose draft holds the label plan/needs-fix
The implement selection SHALL leave out a Staged item while its open draft pull request holds the label `plan/needs-fix`, with a reason that names the label and the pull request. The row `implement` of the Service SHALL log such an item once for each draft and record the draft in `implement.needs_fix`. The selection SHALL take the item again when the label is gone, and a round that judges the item and does not leave it out for the label SHALL clear the mark.

#### Scenario: The draft holds the label
- **WHEN** the open draft of a Staged item holds the label `plan/needs-fix`
- **THEN** `plan_implement` returns no target for the item, and its reason names the label and the pull request

#### Scenario: The Service logs the item once
- **WHEN** two rounds of the row `implement` judge the item while its draft holds the label
- **THEN** no round creates a Job, the log holds one line for the item, and `implement.needs_fix` holds the number of the draft

#### Scenario: The label is gone
- **WHEN** a round judges the item after the label was removed from its draft
- **THEN** the round creates the Job of the item and clears `implement.needs_fix`

#### Scenario: The label comes back
- **WHEN** the label comes back on the draft after a round judged the item without it
- **THEN** the next round logs the item again and creates no Job
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Tasks

## 1. Leave out a Staged item whose draft holds the label plan/needs-fix

Reads: `src/devops_cli/roadmap/implement/implement.py`, `src/devops_cli/roadmap/implement/implement_submit.py`, `src/devops_cli/roadmap/run.py`, `src/devops_cli/roadmap/stores/store.py`, `src/devops_cli/roadmap/stage/stage_verify.py`, `src/devops_cli/roadmap/stage/stage_ready.py`, `src/devops_cli/github/client.py`, `src/devops_cli/lang/en/messages.py`, `tests/support/roadmap_implement.py`, `tests/roadmap/implement/test_roadmap_implement_selection.py`, `tests/roadmap/implement/test_roadmap_implement_submit.py`, `tests/roadmap/implement/test_roadmap_implement_record_readers.py`. Changes: `src/devops_cli/roadmap/implement/implement.py`, `src/devops_cli/roadmap/implement/implement_submit.py`, `src/devops_cli/roadmap/run.py`, `src/devops_cli/roadmap/stores/store.py`, `src/devops_cli/lang/en/messages.py`, `tests/support/roadmap_implement.py`, `tests/roadmap/implement/test_roadmap_implement_selection.py`, `tests/roadmap/implement/test_roadmap_implement_submit.py`, `tests/roadmap/implement/test_roadmap_implement_record_readers.py`.

- [x] 1.1 Add to `tests/roadmap/implement/test_roadmap_implement_selection.py` a test that a Staged item whose open draft holds `plan/needs-fix` gets no target and a reason that names the label and the pull request. Add to `tests/roadmap/implement/test_roadmap_implement_submit.py` a test that two rounds create no Job, log the item once and record `implement.needs_fix`, a test that a round after the label is gone creates the Job and clears the mark, and a test that a label that comes back is logged again. Add `implement.needs_fix` to the table of `tests/roadmap/implement/test_roadmap_implement_record_readers.py`
- Verification: `uv run devops ci test tests/roadmap/implement/test_roadmap_implement_selection.py tests/roadmap/implement/test_roadmap_implement_submit.py tests/roadmap/implement/test_roadmap_implement_record_readers.py` fails on the base
- [x] 1.2 Leave out an open draft with `PLAN_NEEDS_FIX_LABEL` in `_Judge._pull_reason`, keep the item in `ImplementPlan.needs_fix`, add `ImplementRecordKey.NEEDS_FIX`, record and clear the mark in `run_implement_round`, and log each new item in the row `implement` of `run.py`
- Verification: `uv run devops ci test tests/roadmap/implement/test_roadmap_implement_selection.py tests/roadmap/implement/test_roadmap_implement_submit.py tests/roadmap/implement/test_roadmap_implement_record_readers.py` passes

## 2. Name the reason and the mark in the documents

Reads: `docs/roadmap/implement.md`, `docs/ROADMAP_WORKFLOW.md`. Changes: `docs/roadmap/implement.md`, `docs/ROADMAP_WORKFLOW.md`.

- [x] 2.1 Add the label to the reasons that the implement job leaves an item out in `docs/roadmap/implement.md`, and add `implement.needs_fix` to the record table of `docs/ROADMAP_WORKFLOW.md`
- Verification: `uv run devops ci docs` passes

## Workflow follow-up

- Pending a person: review the diff in tuicr (tuicr -r <base>..HEAD).
19 changes: 19 additions & 0 deletions openspec/specs/roadmap-implement-job/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -1853,3 +1853,22 @@ The record `implement.spend` SHALL hold, for each step that got the one extensio
#### Scenario: No extension
- **WHEN** no step of the run got an extension
- **THEN** the comment of the item lists no budget extension

### Requirement: The job leaves out a Staged item whose draft holds the label plan/needs-fix
The implement selection SHALL leave out a Staged item while its open draft pull request holds the label `plan/needs-fix`, with a reason that names the label and the pull request. The row `implement` of the Service SHALL log such an item once for each draft and record the draft in `implement.needs_fix`. The selection SHALL take the item again when the label is gone, and a round that judges the item and does not leave it out for the label SHALL clear the mark.

#### Scenario: The draft holds the label
- **WHEN** the open draft of a Staged item holds the label `plan/needs-fix`
- **THEN** `plan_implement` returns no target for the item, and its reason names the label and the pull request

#### Scenario: The Service logs the item once
- **WHEN** two rounds of the row `implement` judge the item while its draft holds the label
- **THEN** no round creates a Job, the log holds one line for the item, and `implement.needs_fix` holds the number of the draft

#### Scenario: The label is gone
- **WHEN** a round judges the item after the label was removed from its draft
- **THEN** the round creates the Job of the item and clears `implement.needs_fix`

#### Scenario: The label comes back
- **WHEN** the label comes back on the draft after a round judged the item without it
- **THEN** the next round logs the item again and creates no Job
8 changes: 8 additions & 0 deletions src/devops_cli/lang/en/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -3030,6 +3030,10 @@ class RoadmapMessages:
implement_left_no_branch: str = "Its staged branch `{branch}` is not on origin."
implement_left_foreign: str = "Its branch has a commit by {author}, not by {bot}."
implement_left_pull: str = "Its pull request #{pull} is not an open draft."
implement_left_needs_fix: str = (
"Its pull request #{pull} holds the label `{label}`: the review of its plan found an open "
"finding. The job takes the item again when the label is gone."
)
implement_left_plan: str = "Its plan fails the stage check: {problem}"
implement_left_plan_git: str = "Its plan cannot be read from git: {reason}"
implement_job_title: str = "# Implement plan for {repo}"
Expand Down Expand Up @@ -3097,6 +3101,10 @@ class RoadmapMessages:
implement_job_applied: str = "Took {ready} item(s) to a ready pull request, stopped {stopped}."
implement_job_yielded: str = "Left {yielded} item(s) to the owner that claimed them."
implement_round_left: str = "Left #{number}: an agent or a person claimed it since the plan."
implement_round_needs_fix: str = (
"Left #{number}: its pull request #{pull} holds the label `{label}`. The row takes the item "
"again when the label is gone."
)
implement_round_effort: str = "The round selected an item in effort pass {effort}."
implement_round_fallback: str = "The round uses the fallback pass."
implement_boundary_group: str = "the start of group {group}"
Expand Down
Loading