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
10 changes: 5 additions & 5 deletions docs/roadmap/inbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ The lines come in this order of classes:
2. Ready implementation pull requests of the jobs (G2), class `implement`.
3. The open release pull request (G3), class `release`.
4. Items in `status/blocked`, with their cause, class `blocked`.
5. New items that wait on a person in refine, one line for each, class `refine`. The line comes from the job record: the last refine round left a question for a person, or the stage job returned the item twice on the same body. A reply shows in the list until the next refine round. `devops roadmap explain <number>` gives the cause.
6. New items with a split that no person has applied, one line for each, class `split`. Refine proposed the split under Fit in its section of the body.
7. New items whose refine round put a covering tool to a person, one line for each, class `alternatives`. The line names the tool.
8. New items whose refine job failed as often as the limit allows, one line for each, class `failed`. The line names the failed checks, the count of tries and the last error, and asks no question. An item that refine will try again has no line. A body edit makes refine try again.
5. New items that are not trackers and wait on a person in refine, one line for each, class `refine`. The line comes from the job record: the last refine round left a question for a person, or the stage job returned the item twice on the same body. A reply shows in the list until the next refine round. `devops roadmap explain <number>` gives the cause.
6. New items that are not trackers and hold a split that no person has applied, one line for each, class `split`. Refine proposed the split under Fit in its section of the body.
7. New items that are not trackers and whose refine round put a covering tool to a person, one line for each, class `alternatives`. The line names the tool.
8. New items that are not trackers and whose refine job failed as often as the limit allows, one line for each, class `failed`. The line names the failed checks, the count of tries and the last error, and asks no question. An item that refine will try again has no line. A body edit makes refine try again.
9. Ready items whose stage job failed, one line for each, class `stage_retry`. The line names the failure class of the last plan or write, such as `provider` or `limit_reached`. The stage job holds the item for the wait of that class and takes it again when the wait ends, so the line asks nothing of a person. `devops roadmap explain <number>` names the wait. An item in `status/new` keeps the class of its last failure with no line, because the stage job does not take a New item. A staged item clears the class.
10. Drafts of jobs, class `draft`. A draft of a job is listed when a check of its head commit failed in its latest run, or when it is older than `roadmap.inbox.draft_days`. An older run that a newer run of the same check replaced does not count. A newer draft with no failed check is not listed. A pull request that a runner Job holds is not listed either.
11. Claims with no activity for 7 days, class `claim`.
12. Workflow labels of the package and labels of `.github/labels.yml` that the repository lacks or holds with another color or description, class `labels`.
13. The state of the Planned queue, when the count of Planned items is at `roadmap.stage.planned_limit`, class `queue`. The stage job then plans only items with the priority `P0-Critical` or `P1-High`, and a refine round still takes New items. The line has no number and no age.

A second list holds open owner questions (class `owner`). Each line lists the item number, age, question, and the clear command `gh issue comment <number> --body "<answer>"`. It also holds the other open pull requests of people and agents, class `person`. It marks the drafts.
A second list holds open owner questions on items that are not trackers (class `owner`). Each line lists the item number, age, question, and the clear command `gh issue comment <number> --body "<answer>"`. It also holds the other open pull requests of people and agents, class `person`. It marks the drafts.

## The counts as telemetry

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
schema: spec-driven
created: 2026-11-25
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Design

## Decisions
1. Filter `item.is_tracker` in `src/devops_cli/roadmap/inbox.py` across `refine_wait_on_person`, `_split_lines`, `_alternatives_lines`, `_failed_lines`, and `_owner_lines`. Because `_refine_lines` delegates to `refine_wait_on_person` and `inbox_gauges` counts lines returned by `read_inbox`, filtering at those five functions removes tracker waits from both human output and `devops_cli_roadmap_inbox_items`.
2. Gate refine and owner-question checks inside `has_person_cause` (`src/devops_cli/roadmap/phase.py`) on `not item.is_tracker`, leaving execution-phase stop keys (`ImplementRecordKey.STOPPED`, `StageRecordKey.NEEDS_SPLIT`, `StageRecordKey.NEEDS_FIX`, `verdict/fix-plan`) intact.
3. Reuse the `Item.is_tracker` property instead of duplicating `sub_issues > 0 or CONST_ROADMAP_EPIC_LABEL in labels`.

## Rejected alternatives
- Scrubbing stale refine keys off GitHub tracker bodies during refine: refine already skips trackers early, so an inbox-side filter stops stale tracker records immediately without extra GitHub writes.
- Checking `CONST_ROADMAP_EPIC_LABEL` or `sub_issues` inline at each call site: duplicates `Item.is_tracker`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Proposal

## Why
Issue `#6446`: `devops roadmap inbox` and `has_person_cause` report refine waits (`refine`, `split`, `alternatives`, `failed`) and open owner questions for tracker items (`type/epic` or `sub_issues > 0`). Refine already skips trackers, so stale refine or owner keys on a tracker stay in the inbox as permanent waits and inflate `devops_cli_roadmap_inbox_items`.

## What Changes
- Exclude `item.is_tracker` items in `refine_wait_on_person`, `_split_lines`, `_alternatives_lines`, `_failed_lines`, and `_owner_lines` in `src/devops_cli/roadmap/inbox.py`.
- Ignore refine and owner-question record keys in `has_person_cause` (`src/devops_cli/roadmap/phase.py`) when `item.is_tracker` is true.
- Update `docs/roadmap/inbox.md` to document tracker exclusion for refine waits and owner questions.
- Add tests in `tests/roadmap/test_roadmap_inbox.py`, `tests/roadmap/test_roadmap_inbox_gauges.py`, and `tests/roadmap/test_roadmap_phase.py`.

## Capabilities

### New Capabilities
- `roadmap-inbox`: exclude tracker items from `refine`, `split`, `alternatives`, `failed`, and `owner` lines and counts.
- `roadmap-phases`: ignore refine and owner-question causes in `has_person_cause` for tracker items.

## Impact
- `src/devops_cli/roadmap/inbox.py`
- `src/devops_cli/roadmap/phase.py`
- `docs/roadmap/inbox.md`
- `tests/roadmap/test_roadmap_inbox.py`
- `tests/roadmap/test_roadmap_inbox_gauges.py`
- `tests/roadmap/test_roadmap_phase.py`
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## ADDED Requirements

### Requirement: Trackers excluded from refine inbox lines and person causes
The inbox command SHALL exclude tracker items (`Item.is_tracker` is true) from `refine`, `split`, `alternatives`, `failed`, and `owner` lines and from `devops_cli_roadmap_inbox_items` counts for those kinds.

#### Scenario: Epic tracker with refine wait record produces no refine line or gauge count
- **WHEN** an open New item carries label `type/epic` and job record key `refine.next_step` equal to `person` or `refine.returned_body_hash` equal to `refine.body_hash`
- **THEN** `read_inbox` and `refine_wait_on_person` produce no `refine` line for it and the `refine` gauge value excludes it

#### Scenario: Sub-issue tracker with split, alternatives, failed, or owner record produces no inbox line
- **WHEN** an open item has `sub_issues > 0` or label `type/epic` and holds `refine.next_step=split`, `refine.alternatives_asked`, `refine.next_step=failed`, or an unanswered `owner_question.hash`
- **THEN** `read_inbox` produces no `split`, `alternatives`, `failed`, or `owner` line for that item

#### Scenario: Non-tracker item keeps refine, split, alternatives, failed, and owner lines
- **WHEN** an open item is not a tracker and holds one of those wait keys
- **THEN** `read_inbox` lists the matching line and counts it in `devops_cli_roadmap_inbox_items`
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## ADDED Requirements

### Requirement: Tracker items ignore refine and owner person causes
`has_person_cause` SHALL return false for refine wait keys and open owner questions when `Item.is_tracker` is true.

#### Scenario: Tracker with refine or owner wait keys has no person cause
- **WHEN** a tracker item (`type/epic` or `sub_issues > 0`) holds `refine.next_step` in `("person", "split", "failed")`, matching `refine.returned_body_hash`, `refine.alternatives_asked`, `refine.blocked_by`, or unanswered `owner_question.hash`
- **THEN** `has_person_cause(item)` returns false

#### Scenario: Non-tracker item preserves person cause detection
- **WHEN** a non-tracker item holds the same refine or owner wait keys
- **THEN** `has_person_cause(item)` returns true
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Tasks

## 1. Tests (RED)
- [x] Add tests in `tests/roadmap/test_roadmap_inbox.py` verifying tracker items (`type/epic` and `sub_issues > 0`) produce no `refine`, `split`, `alternatives`, `failed`, or `owner` lines while non-trackers do.
- [x] Add test in `tests/roadmap/test_roadmap_inbox_gauges.py` verifying trackers with refine waits do not increment `devops_cli_roadmap_inbox_items`.
- [x] Add tests in `tests/roadmap/test_roadmap_phase.py` verifying `has_person_cause` returns `False` for refine/owner keys on trackers and `True` on non-trackers.

## 2. Implementation (GREEN)
- [x] Update `refine_wait_on_person`, `_split_lines`, `_alternatives_lines`, `_failed_lines`, and `_owner_lines` in `src/devops_cli/roadmap/inbox.py` to skip `item.is_tracker`.
- [x] Update `has_person_cause` in `src/devops_cli/roadmap/phase.py` to ignore refine and owner-question keys when `item.is_tracker` is true.
- [x] Update `docs/roadmap/inbox.md` to state that trackers are excluded from refine waits and owner questions.

## 3. Verification
- [x] Run pytest on `test_roadmap_inbox.py`, `test_roadmap_inbox_gauges.py`, and `test_roadmap_phase.py`.
- [x] Run `devops ci fail-to-pass --base origin/main`, `devops openspec check`, `ruff`, `mypy`, and static CI gates.
15 changes: 15 additions & 0 deletions openspec/specs/roadmap-inbox/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,3 +238,18 @@ The line of a stopped item whose record holds no `implement.failure` SHALL name
#### Scenario: A repository that holds one stopped item
- **WHEN** The inbox reads a repository whose one open Item holds `status/blocked`, a Priority, and a job record with `implement.stopped`, `implement.failure` and `implement.left_action`, and a second repository whose one open Item holds `status/blocked` and a Priority and no stop.
- **THEN** The paths of the requests that each run sends are the same, and no request reads one issue.

### Requirement: Trackers excluded from refine inbox lines and person causes
The inbox command SHALL exclude tracker items (`Item.is_tracker` is true) from `refine`, `split`, `alternatives`, `failed`, and `owner` lines and from `devops_cli_roadmap_inbox_items` counts for those kinds.

#### Scenario: Epic tracker with refine wait record produces no refine line or gauge count
- **WHEN** an open New item carries label `type/epic` and job record key `refine.next_step` equal to `person` or `refine.returned_body_hash` equal to `refine.body_hash`
- **THEN** `read_inbox` and `refine_wait_on_person` produce no `refine` line for it and the `refine` gauge value excludes it

#### Scenario: Sub-issue tracker with split, alternatives, failed, or owner record produces no inbox line
- **WHEN** an open item has `sub_issues > 0` or label `type/epic` and holds `refine.next_step=split`, `refine.alternatives_asked`, `refine.next_step=failed`, or an unanswered `owner_question.hash`
- **THEN** `read_inbox` produces no `split`, `alternatives`, `failed`, or `owner` line for that item

#### Scenario: Non-tracker item keeps refine, split, alternatives, failed, and owner lines
- **WHEN** an open item is not a tracker and holds one of those wait keys
- **THEN** `read_inbox` lists the matching line and counts it in `devops_cli_roadmap_inbox_items`
11 changes: 11 additions & 0 deletions openspec/specs/roadmap-phases/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,14 @@ The agent phase SHALL write each patch with `git diff --binary --full-index --no
#### Scenario: A patch up to a commit
- **WHEN** the patch ends at a commit and the checkout holds a later file
- **THEN** the patch holds no later file

### Requirement: Tracker items ignore refine and owner person causes
`has_person_cause` SHALL return false for refine wait keys and open owner questions when `Item.is_tracker` is true.

#### Scenario: Tracker with refine or owner wait keys has no person cause
- **WHEN** a tracker item (`type/epic` or `sub_issues > 0`) holds `refine.next_step` in `("person", "split", "failed")`, matching `refine.returned_body_hash`, `refine.alternatives_asked`, `refine.blocked_by`, or unanswered `owner_question.hash`
- **THEN** `has_person_cause(item)` returns false

#### Scenario: Non-tracker item preserves person cause detection
- **WHEN** a non-tracker item holds the same refine or owner wait keys
- **THEN** `has_person_cause(item)` returns true
47 changes: 29 additions & 18 deletions src/devops_cli/roadmap/inbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,11 @@ def _blocked_lines(items: Iterable[Item], repo: str, now: datetime) -> list[Inbo


def refine_wait_on_person(item: Item) -> InboxKind | None:
"""`InboxKind.REFINE` when the job record of the open New item `item` says that refine waits
on a person, else None: the last round left a question or a suspected block for a person, or
the stage job returned the item twice on the same body (#3483). The record is the whole
read, so a reply since the round shows only after the next round."""
if item.state is not GitHubState.OPEN or item.status != CONST_ROADMAP_STATUS_NEW:
"""`InboxKind.REFINE` when the job record of the open New non-tracker `item` says that refine
waits on a person, else None: the last round left a question or a suspected block for a person,
or the stage job returned the item twice on the same body (#3483, #6446). The record is the
whole read, so a reply since the round shows only after the next round."""
if not _open_new_refine_item(item):
return None
record = item.job_record
if record.get(RefineRecordKey.NEXT_STEP) == NextStep.PERSON.value:
Expand Down Expand Up @@ -291,13 +291,18 @@ def _refine_lines(items: Iterable[Item], repo: str, now: datetime) -> list[Inbox
return lines


def _open_new(item: Item) -> bool:
return item.state is GitHubState.OPEN and item.status == CONST_ROADMAP_STATUS_NEW
def _open_new_refine_item(item: Item) -> bool:
"""Whether `item` is an open New non-tracker item handled by refine (#6446)."""
return (
item.state is GitHubState.OPEN
and item.status == CONST_ROADMAP_STATUS_NEW
and not item.is_tracker
)


def _split_lines(items: Iterable[Item], now: datetime) -> list[InboxLine]:
"""One line for each open New item whose refine next step is a split, which no person has
applied yet (#3494)."""
"""One line for each open New non-tracker item whose refine next step is a split, which no
person has applied yet (#3494, #6446)."""
texts = MESSAGES.roadmap
return [
InboxLine(
Expand All @@ -309,19 +314,19 @@ def _split_lines(items: Iterable[Item], now: datetime) -> list[InboxLine]:
item=item.number,
)
for item in items
if _open_new(item)
if _open_new_refine_item(item)
and item.job_record.get(RefineRecordKey.NEXT_STEP) == NextStep.SPLIT.value
]


def _alternatives_lines(items: Iterable[Item], now: datetime) -> list[InboxLine]:
"""One line for each open New item whose refine round put a covering tool to a person
(#3494). The line names the tool that the round recorded."""
"""One line for each open New non-tracker item whose refine round put a covering tool to a
person (#3494, #6446). The line names the tool that the round recorded."""
texts = MESSAGES.roadmap
lines: list[InboxLine] = []
for item in items:
tool = item.job_record.get(RefineRecordKey.ALTERNATIVES_ASKED)
if not _open_new(item) or not tool:
if not _open_new_refine_item(item) or not tool:
continue
subject = texts.inbox_subjects["alternatives"].format(title=item.title, tool=tool)
clear = texts.inbox_clears["alternatives"].format(number=item.number)
Expand All @@ -345,7 +350,9 @@ def _failed_lines(items: Iterable[Item], repo: str, now: datetime) -> list[Inbox
lines: list[InboxLine] = []
for item in items:
record = item.job_record
if not _open_new(item) or record.get(RefineRecordKey.NEXT_STEP) != NextStep.FAILED.value:
if not _open_new_refine_item(item) or (
record.get(RefineRecordKey.NEXT_STEP) != NextStep.FAILED.value
):
continue
subject = texts.inbox_subjects["failed"].format(
title=item.title,
Expand Down Expand Up @@ -391,14 +398,18 @@ def _stage_retry_lines(items: Iterable[Item], repo: str, now: datetime) -> list[


def _owner_lines(items: Iterable[Item], now: datetime) -> list[InboxLine]:
"""One line for each open item whose job record holds an owner question that no trusted
reply answered (#3077). The open frame is the marker of the wait, so no status label is
added, and the comment that answers it clears the line."""
"""One line for each open non-tracker item whose job record holds an owner question that no
trusted reply answered (#3077, #6446). The open frame is the marker of the wait, so no status
label is added, and the comment that answers it clears the line."""
texts = MESSAGES.roadmap
lines: list[InboxLine] = []
for item in items:
record = item.job_record
if not record.get(OwnerQuestionRecordKey.HASH) or record.get(OwnerQuestionRecordKey.ANSWER):
if (
item.is_tracker
or not record.get(OwnerQuestionRecordKey.HASH)
or record.get(OwnerQuestionRecordKey.ANSWER)
):
continue
subject = texts.inbox_subjects["owner"].format(
title=item.title, question=record.get(OwnerQuestionRecordKey.TEXT) or ""
Expand Down
Loading