diff --git a/openspec/changes/archive/2026-11-14-4618-degenerate-reply/.openspec.yaml b/openspec/changes/archive/2026-11-14-4618-degenerate-reply/.openspec.yaml new file mode 100644 index 0000000000..5acb9430d0 --- /dev/null +++ b/openspec/changes/archive/2026-11-14-4618-degenerate-reply/.openspec.yaml @@ -0,0 +1,3 @@ +schema: spec-driven +created: 2026-11-14 +skip_specs: true diff --git a/openspec/changes/archive/2026-11-14-4618-degenerate-reply/design.md b/openspec/changes/archive/2026-11-14-4618-degenerate-reply/design.md new file mode 100644 index 0000000000..e22a32bdcc --- /dev/null +++ b/openspec/changes/archive/2026-11-14-4618-degenerate-reply/design.md @@ -0,0 +1,23 @@ +# Design + +## Context + +`_return_plan_defects` builds the comment from the refused problems and the failure reason. It adds the reason only when `failure.stopped_by_checks` is false. + +## Goals + +- One bullet for the degenerate reply. +- Keep the reason path for a stop that the checks did not refuse. + +## Decisions + +- **The flag on the stop.** The degenerate reply is a refused reply, and its problem is the reason. +- **No spec delta.** The existing requirement already states this case. + +## Risks + +- None beyond the flag. + +## Tests + +- A round with a degenerate reply at the limit returns the item to New with one bullet. diff --git a/openspec/changes/archive/2026-11-14-4618-degenerate-reply/proposal.md b/openspec/changes/archive/2026-11-14-4618-degenerate-reply/proposal.md new file mode 100644 index 0000000000..443378d7a0 --- /dev/null +++ b/openspec/changes/archive/2026-11-14-4618-degenerate-reply/proposal.md @@ -0,0 +1,37 @@ +# Proposal + +## Why + +At the plan-defect limit, `_Planner._stop_degenerate` adds the degenerate reply to `self._refused` but does not set `self._stopped_by_checks`. `_return_plan_defects` then adds `failure.reason`, which is the same `stage_degenerate` text, so the return comment shows the same bullet twice (#4618). + +## What Changes + +- `_stop_degenerate` sets `self._stopped_by_checks = True`, because the job refused and kept the reply. +- A round test holds one bullet for the degenerate reply. +- The spec text needs no change: it already says the comment gives the reason unless the checks refused the last reply. +- The change fits one pull request. + +## Capabilities + +### New Capabilities + +None. + +### Modified Capabilities + +None. + +## Impact + +- Code: `src/devops_cli/roadmap/stage/stage.py` +- Tests: `tests/roadmap/stage/test_roadmap_stage_plan_defect_limit.py` + +## Feasibility + +- The stop already appends the problem to `self._refused`. +- The return comment already reads `stopped_by_checks`. +- Verification commands: `uv run devops ci test tests/roadmap/stage/test_roadmap_stage_plan_defect_limit.py` and `uv run devops ci --check --only lint,format,typecheck`. + +## Existing Tool Considered + +The change sets one flag. No tool and no model call. diff --git a/openspec/changes/archive/2026-11-14-4618-degenerate-reply/tasks.md b/openspec/changes/archive/2026-11-14-4618-degenerate-reply/tasks.md new file mode 100644 index 0000000000..cc5af28696 --- /dev/null +++ b/openspec/changes/archive/2026-11-14-4618-degenerate-reply/tasks.md @@ -0,0 +1,9 @@ +# Tasks + +## 1. One bullet for the degenerate reply + +Reads: `src/devops_cli/roadmap/stage/stage.py`. Changes: the same file and `tests/roadmap/stage/test_roadmap_stage_plan_defect_limit.py`. + +- [x] 1.1 Set `_stopped_by_checks` in `_stop_degenerate`. +- [x] 1.2 Add the round test. + - Verification: `$ uv run devops ci test tests/roadmap/stage/test_roadmap_stage_plan_defect_limit.py` passes diff --git a/src/devops_cli/roadmap/stage/stage.py b/src/devops_cli/roadmap/stage/stage.py index adf4f37f2a..b6f6fe2551 100644 --- a/src/devops_cli/roadmap/stage/stage.py +++ b/src/devops_cli/roadmap/stage/stage.py @@ -1799,7 +1799,10 @@ def _stop_degenerate( proposal: StageProposal, floor: int, ) -> NoReturn: - """End the item for a reply that is a placeholder in every text, with no second request.""" + """End the item for a reply that is a placeholder in every text, with no second request. + The reply is one that the job refused and kept, so its problem is the failure reason, and + the return comment must not repeat it (#4618).""" + self._stopped_by_checks = True self._note_refused(target, floor, "degenerate") refused.append((proposal, MESSAGES.roadmap.stage_degenerate)) self._keep_refused(target, key, refused) diff --git a/tests/roadmap/stage/test_roadmap_stage_plan_defect_limit.py b/tests/roadmap/stage/test_roadmap_stage_plan_defect_limit.py index 22c3599ad7..c7518afcc1 100644 --- a/tests/roadmap/stage/test_roadmap_stage_plan_defect_limit.py +++ b/tests/roadmap/stage/test_roadmap_stage_plan_defect_limit.py @@ -375,3 +375,51 @@ def test_a_staged_item_clears_its_count( assert StageRecordKey.BRANCH.value in record assert StageRecordKey.PLAN_DEFECTS.value not in record assert StageRecordKey.PLAN_DEFECTS_BODY.value not in record + + +def _placeholders() -> Any: + """A reply with `x` or `placeholder` in every text of the plan.""" + group = ( + make_stage_proposal() + .groups[0] + .model_copy( + update={ + "test": "x", + "implementation": "placeholder", + "documentation": None, + "verify": "x", + } + ) + ) + return make_stage_proposal( + why="x", existing_tool="placeholder", feasibility=["x"], groups=[group] + ) + + +def test_a_degenerate_reply_at_the_limit_gives_one_bullet( + stage_repo: StageRepo, + model_fake: ModelFake, + github_api: GitHubApiFake, + openspec_fake: OpenSpecFake, +) -> None: + """The degenerate reply is a refused reply, so its problem is the reason and appears once + (#4618).""" + store = _two_items(InMemoryRoadmapStore(repo=STAGE_REPO), openspec_fake, github_api) + _fail_to_the_limit(store, 1, less=1) + + def plan(prompt: str) -> Any: + request = json.loads(prompt) + if "plan" not in request and request["number"] == 1: + return _placeholders() + return make_stage_proposal() + + no_findings(model_fake) + model_fake.answer(plan) + + stage_round(store, stage_repo) + + assert _status(store, 1) == "New" + [comment] = _stage_comments(store, 1) + bullets = _bullets(comment) + assert bullets + assert len(bullets) == len(set(bullets))