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
3 changes: 2 additions & 1 deletion docs/ROADMAP_WORKFLOW.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ These are all the keys of the job record, by the job that writes them:
| Refine | `refine.deferred` | The numbers of the issues that refine filed for the deferred parts of the Item |
| Refine | `refine.judge` | The verdict of the review of a Ready proposal for an Item that a bot opened, `approved` or `refused`. The stage, implement and alternatives jobs take such an Item only when it is `approved` and its body hashes as `refine.body_hash` and `refine.section_hash` record |
| Refine | `refine.returned_body_hash` | The body hash of a round that looked again at an Item after the stage job returned it; a second return on that body waits on a person |
| Refine | `refine.tries`, `refine.failed_check`, `refine.failure` | The count of rounds whose job failed on the same body, the names of the failed checks, and the last error. `refine.next_step` is then `retry`, and `failed` at 3 tries (`CONST_ROADMAP_REFINE_MAX_TRIES`). Only a decision marked `(a person decides)` makes refine wait on a person |
| Refine | `refine.tries`, `refine.failed_check`, `refine.failure` | The count of rounds whose job failed on the same body, the names of the failed checks, and the last error. `refine.next_step` is then `retry`, and `failed` at 3 tries (`CONST_ROADMAP_REFINE_MAX_TRIES`). A refusal of the review of a bot Item is the check `judge_refused`. Only a decision marked `(a person decides)` makes refine wait on a person |
| Refine | `refine.judge_findings` | The open findings of the last refusal of the review, one on each line. The next round gives them to the model, and a round that does not fail clears them |
| Refine | `refine.failed_at`, `refine.failed_step`, `refine.failed_class` | When the last model call of the Item failed, the step (`investigate`) and the failure class (a value of the taxonomy, such as `provider` or `parser`). The class comes from the type of the error. Refine leaves the Item out for the wait of its class (1 hour for `provider`, `plan_defect` and `ci_infra`, 6 hours for `parser`, none for `head_moved`), shows the step `retry`, and a round whose model call worked clears all three. A failure that the text caused ends its wait with a body edit. Intake keeps the failure of a candidate in its record file (`IntakeRecord.failed`), not in a job record |
| Refine | `refine.comments_seen`, `refine.commented_at`, `refine.wait_refs` | What the last read of the comments of a waiting item gave: the count of comments of the issue listing, the time of refine's last comment, and the issues and paths that the wait text names. A round reads the comments again only when the count moves |
| Alternatives | `alternatives.checked_at`, `alternatives.body_hash`, `alternatives.verdict`, `alternatives.tool`, `alternatives.failed_at`, `alternatives.failed_error` | When the check ran, the text it read, its verdict and the tool it found; when the last check failed and the class of its error, until a check is written |
Expand Down
12 changes: 9 additions & 3 deletions docs/roadmap/refine.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ The Service App and the workflows of the repository open items. Examples are the

Nobody wrote the text of a bot item, so a Ready proposal for it goes through a review first. The review is the verification pass of the stage job, with the model of the task slot `ai.tasks.verification`. It reads the issue and the proposal. With no open finding, refine sets the item Ready and records `refine.judge` `approved`.

With an open finding, the item stays New and waits for a body edit. One comment lists each finding with its evidence. The approval covers the body that the review read, and the hashes in the job record show it. A body edit ends the approval, and the next round reviews the item again. The stage job, the implement job and the alternatives job take a bot item only with an approval that holds.
With an open finding, the item stays New and refine records `refine.judge` `refused`. A refusal is a job failure with the check `judge_refused` (see below), so no person edits the body. The job record keeps each open finding with its evidence in `refine.judge_findings`. The next round refines the item again, and its request gives the findings to the model as `judge_findings`. The model fixes each finding or takes out the claim. At the third try on the same body, the step is `failed` and the inbox lists the item. Refine writes no comment for a refusal. An item of a person gets no review, so a refusal never stops it.

The approval covers the body that the review read, and the hashes in the job record show it. A body edit ends the approval, and the next round reviews the item again. A Ready bot item that the review refuses after a body edit goes back to New with the step `retry`. The stage job, the implement job and the alternatives job take a bot item only with an approval that holds.

A refusal from before this rule left its item with the step `edit` and a comment that asks a person for a body edit. Such an item keeps that wait. `devops roadmap refine --item <number>` refines it on the new route.

The review is a model, so text in the item can mislead it. The control is the login of the author. The models of refine and of the alternatives job read only the replies of two kinds of author. These are a person with write access and the App's bot. A person still merges each pull request. A comment of a bot starts no `implement: retry`.

Expand Down Expand Up @@ -88,15 +92,17 @@ A person has nothing to do for a failed job. These cases are job failures, not p
- A quoted title in the Dependencies section names no item, or two items (`dependencies`). The error names the title and asks for the issue as `#<number>`.
- A question has no verified source after the investigation (`missing_source`), or a question of the body has no answer (`unanswered_question`).
- The investigation ended with no proposal while such a question is open (`investigation_stopped`).
- The review of a Ready proposal for an item that a bot opened refused it (`judge_refused`).

A job failure writes no body and no comment. The job record shows it:
A job failure writes no body and no comment. A refusal of the review is the one exception: it writes the body with the section of the refused proposal, and a Ready item goes back to New. The job record shows it:

| Key | Value |
| :--- | :--- |
| `refine.next_step` | `retry` below the limit of tries, then `failed` |
| `refine.tries` | The count of rounds that failed on this body. A body edit starts it at 1 again |
| `refine.failed_check` | The names of the failed checks, comma separated |
| `refine.failure` | The last error, with the calls of the read tools when they found no source |
| `refine.failure` | The last error, with the calls of the read tools when they found no source. For `judge_refused`, the first open finding |
| `refine.judge_findings` | Each open finding of the last refusal of the review, one on each line, at most 2,000 characters (`CONST_ROADMAP_REFINE_JUDGE_FINDINGS_MAX_CHARS`). A round that does not fail clears it |

With the step `retry`, the next round refines the item again. At 3 tries (`CONST_ROADMAP_REFINE_MAX_TRIES`) the step is `failed`: refine sends no model request for the item until a person edits its body, and [the inbox](inbox.md) lists it in the class `failed` with the checks, the count and the last error. A proposal that passes clears the keys. A job failure comes before a question for a person: a proposal that is not valid asks nobody.

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

- **A refusal is a job failure.** The check is `judge_refused`. It shares `refine.tries` and the limit of 3 tries on the same body with the other job failures (#3632). A form check failure and a refusal on the same body both count, because each one is a round that did not give a Ready proposal.
- **The refusal still writes the body and the Status.** The requirement "A round reviews a Ready item of a bot again when its approval ends" sets a refused Ready item back to New. The section of the refused proposal stays in the body, so the next request shows the model the proposal that the findings name.
- **The findings have their own key.** `refine.failure` holds at most 300 characters and the inbox prints it on one line. One finding with its quote is often longer. `refine.judge_findings` keeps each finding on its line, at most 2,000 characters, and `refine.failure` keeps the first finding for the inbox and `devops roadmap explain`.
- **The findings stay until a round does not fail.** A form check failure after a refusal keeps them, so the next request still has them. A body edit starts the count of tries again but keeps the findings, because they can still apply to the new body.
- **No comment.** A job failure writes no comment. The inbox lists the item at the limit, with the check, the count and the first finding.

## Rejected alternatives

- **A comment for each refusal, with no request to a person.** Three refusals give three comments. The cap of 2 refine comments in 24 hours (`CONST_ROADMAP_REFINE_MAX_COMMENTS_PER_ITEM`) would hold the third try for a day. The job record and the inbox give the same facts.
- **Read the findings from the last comment of refine.** The comment is text for a person, and a parse of it breaks when the text changes. The job record is structured.
- **Read an old record with the step `edit` and `refine.judge` `refused` as `retry`.** That is a shim for old data, and AGENTS.md forbids a shim. One `devops roadmap refine --item <number> --confirm` round for each of the 28 items puts it on the new route.
- **Write only the record, as the other job failures do.** A refused Ready item would then stay Ready with no approval that holds, and the requirement says that it goes back to New.
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Proposal

## Why

The review of refine (#3502) refuses a Ready proposal for an item that a bot opened, and the item then waits for a person to edit the body (#4798). The census of 2026-11-11 found 36 bot items with a verdict of the review: 8 approved and 28 refused. All 28 refused items were New with the step `edit`. Their median time in the Status was 6.0 days, and 25 of them had no free comment. The owner rule of 2026-11-05 says that bot-filed work goes on with an agentic judge and no person, and the owner accepted the agent round on 2026-11-11 (#4780). A refusal is a defect of the proposal, which the next proposal can fix. This change routes a refusal to a job failure of refine, so that the next round refines the item again with the findings.

## What Changes

- A refusal of the review is a job failure with the new check `judge_refused` (`JobCheck.JUDGE_REFUSED`). It counts in `refine.tries` on the same body, as the other job failures do. The step is `retry` below 3 tries (`CONST_ROADMAP_REFINE_MAX_TRIES`) and `failed` at the limit. `devops roadmap inbox` lists a `failed` item in its class `failed`.
- The job record keeps each open finding with its evidence in the new key `refine.judge_findings`, at most `CONST_ROADMAP_REFINE_JUDGE_FINDINGS_MAX_CHARS` (2,000) characters. `refine.failure` holds the first finding. A round that does not fail clears the key.
- The request of the proposal step and of the investigation has the new key `judge_findings`. The prompt `roadmap_refine_proposal.md` tells the model to fix each finding or take out the claim.
- A refusal writes the body with the section of the refused proposal and sets a Ready item back to New, as before. It writes no comment. The text of the comment that asked a person for a body edit (`refine_step_comments["edit"]`) is deleted.
- An item of a person gets no review, so its behavior does not change.
- The change carries a spec delta: the job record, the next step and the comment are observable.
- The change fits one pull request.

## Capabilities

### New Capabilities

None.

### Modified Capabilities

- `roadmap-refine`: A refusal of the review is a job failure that a later round fixes, The review keeps the approval of an unchanged body, A round reviews a Ready item of a bot again when its approval ends, A passing proposal clears the job failure. Two requirements go: A refusal keeps the item New and lists each finding, The review looks again only after the body changes.

## Impact

- Code: `src/devops_cli/roadmap/refine/refine.py`, `src/devops_cli/roadmap/refine/refine_judge.py`, `src/devops_cli/roadmap/stores/store.py`, `src/devops_cli/config/constants.py`, `src/devops_cli/lang/en/messages.py`, `src/devops_cli/ai/tasks/roadmap_refine_proposal.md`, `src/devops_cli/ai/tasks/roadmap_refine_investigation.md`
- Documents: `docs/roadmap/refine.md`, `docs/ROADMAP_WORKFLOW.md`
- Tests: `tests/roadmap/refine/test_roadmap_refine_trust.py`, `tests/roadmap/test_roadmap_limit_classes.py`
- The items that a refusal left with the step `edit` before this change keep that wait. One `devops roadmap refine --item <number> --confirm` round for each item puts it on the new route.

## Feasibility

- `src/devops_cli/roadmap/refine/refine.py` at `origin/main` (bbb952ed, 2026-11-11) confirms the cause. In `refine_one_item`, a refusal sets `NextStep.EDIT` with the findings as the details of the comment. `_still_waiting` treats `EDIT` as a wait that only a body edit ends, so the next round makes no model call.
- The same file holds the job failure of #3632: `_failed_round` counts `refine.tries` on the body, `RETRY` is no wait, and `FAILED` at 3 tries waits on a body edit. `inbox.py` lists `FAILED` in the class `failed`. So the route exists, and the refusal only needs to join it.
- The census of 2026-11-11T17:30Z (the job records of 437 open issues) gives the counts in Why: `refine.judge` is `refused` on 28 records (20 of the Service App, 8 of `github-actions[bot]`) and `approved` on 8. Each refused record holds `refine.next_step` `edit`.
- The question resolver of #4780 is not built: no module of `src/` names it. Its answers become an input of refine in a later item of #4780, which adds them to the check for an unchanged item. This change does not add that input.

## Existing Tool Considered

The refine agent, the verification pass of the stage job (#3502) and the job failure of refine (#3632) cover each part. No outside tool routes a refusal of a review in a roadmap job. The change joins these parts. Cost to build: about 80,000 tokens and 2 hours, as the issue states. Code that the change deletes: the `edit` text of `refine_step_comments` and the branch of `refine_one_item` that gave a refusal the step `edit`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
## ADDED Requirements

### Requirement: A refusal of the review is a job failure that a later round fixes
A finding of the type `missing_path`, `false_premise`, `ignores_existing_code` or `spec_delta_wrong`, or a placeholder, with a quote that the input holds, SHALL be an open finding. With an open finding, refine SHALL keep the item New, record `refine.judge` `refused`, the failed check `judge_refused` and the open findings in `refine.judge_findings`, and write no comment. The next request SHALL give them as `judge_findings`. Another finding SHALL be advice.

#### Scenario: The review refuses
- **WHEN** the review finds a `false_premise` that quotes the problem statement, and a `contrived_test` with no quote
- **THEN** the item stays New, its job record holds `refine.judge` `refused`, `refine.next_step` `retry`, `refine.tries` `1`, `refine.failed_check` `judge_refused` and only the `false_premise` with its evidence in `refine.judge_findings`, and refine writes no comment

#### Scenario: The next round fixes the findings
- **WHEN** a round follows the refusal, and its review finds no open defect
- **THEN** its request holds the `false_premise` in `judge_findings`, the item is Ready with `refine.judge` `approved`, and the job record holds no `refine.tries` and no `refine.judge_findings`

#### Scenario: The third refusal
- **WHEN** the review refuses the same body of a bot item in three rounds
- **THEN** `refine.next_step` is `failed`, the next round makes no proposal call and no review call, and the inbox lists the item in the class `failed`

#### Scenario: A body edit after the third refusal
- **WHEN** a person edits the body after the third refusal
- **THEN** the next round makes one review call, and `refine.tries` starts at `1`

#### Scenario: A quote that the input does not hold
- **WHEN** the review finds a `false_premise` whose quote is in no text of the input
- **THEN** the item is Ready and its job record holds `refine.judge` `approved`

#### Scenario: A finding about tasks
- **WHEN** the review finds a `task_order` or a `verify_form` finding that quotes the input
- **THEN** the finding is advice, because a proposal holds no task group, and the item is Ready with `refine.judge` `approved`

### Requirement: The review keeps the approval of an unchanged body
Refine SHALL make no review call for an item that holds `refine.judge` `approved` with an unchanged body. A body edit SHALL end the approval, and the next round SHALL review the new proposal.

#### Scenario: An approved item that a round looks at again
- **WHEN** a round looks again at an item that holds `refine.judge` `approved`, and its body is unchanged
- **THEN** refine keeps the approval and makes no review call

#### Scenario: A body edit after a refusal
- **WHEN** a person edits the body after a refusal, and the review finds no open defect
- **THEN** the next round makes one review call and sets the item Ready

## MODIFIED Requirements

### Requirement: A round reviews a Ready item of a bot again when its approval ends
A round SHALL take a Ready item of a trusted bot when its approval does not hold. The approval does not hold when `refine.judge` is not `approved`, or when the body hashes differently from `refine.body_hash` and `refine.section_hash`. The round SHALL review the new proposal. With no open finding, the item SHALL stay Ready with a new approval. With an open finding, the item SHALL go back to New.

#### Scenario: A person edits the body of an approved item
- **WHEN** refine approved a Ready item of the Service App, and a person adds a line to the body outside the section of refine
- **THEN** the item has no approval that holds, the next round makes one proposal call and one review call, and the item stays Ready with a new approval

#### Scenario: The review refuses the edited body
- **WHEN** the review finds an open defect in the proposal for the edited body
- **THEN** the item goes back to New, its job record holds `refine.judge` `refused` and `refine.next_step` `retry`, and no job takes it

#### Scenario: An approval that holds
- **WHEN** a Ready item of the Service App holds `refine.judge` `approved` and its body is unchanged
- **THEN** a round does not take the item for this reason

### Requirement: A passing proposal clears the job failure
A proposal that passes the form checks with no job failure SHALL clear `refine.tries`, `refine.failed_check`, `refine.failure` and `refine.judge_findings` from the job record.

#### Scenario: A later proposal passes
- **WHEN** the model returns a whole proposal after a failed try
- **THEN** the item is refined as before, and its record holds no `refine.tries`, `refine.failed_check`, `refine.failure` or `refine.judge_findings`

## REMOVED Requirements

### Requirement: A refusal keeps the item New and lists each finding
**Reason**: A refusal no longer waits on a person. It is a job failure, and the next round refines the item again with the findings (#4798).
**Migration**: Read "A refusal of the review is a job failure that a later round fixes".

### Requirement: The review looks again only after the body changes
**Reason**: After a refusal, the next round reviews a new proposal on the same body. Only an approval of an unchanged body holds with no review call.
**Migration**: Read "The review keeps the approval of an unchanged body" and "A refusal of the review is a job failure that a later round fixes".
Loading