Repository navigation
Description
Problem or Motivation
The roadmap stage job creates the OpenSpec change proposal folder under openspec/changes/<issue>-<slug>/.
The task groups of the plan describe implementation steps for devops roadmap implement.
OpenSpec manages living specifications under openspec/specs/.
When an implementation branch merges, devops openspec archive automatically applies spec deltas from the change folder's specs/ directory to openspec/specs/.
An implementation step must never edit living specification files under openspec/specs/ directly.
In PR #3234 (issue #3218), the stage model generated task group 2 titled State the dry-run diff and the redaction in the config-commands spec.
That group listed openspec/specs/config-commands/spec.md in changes and instructed hand editing of the living spec file.
Neither StageGroup in src/devops_cli/roadmap/stage_change.py nor check_proposal in src/devops_cli/roadmap/stage_eval_gates.py caught this defect.
Listing living specs in task groups creates contradictory manual edits and conflicts with openspec archive.
Proposed Solution & Architectural Design
- Add a validator to
StageGroupinsrc/devops_cli/roadmap/stage_change.pythat rejects any group whosechangesorcreatescontains paths starting withopenspec/specs/. - Update
src/devops_cli/ai/tasks/roadmap_stage_change.mdto instruct the stage planner that an implementation group must never change or create files underopenspec/specs/. - Add a unit test in
tests/roadmap/test_stage_change.pyconfirming thatStageGrouprejects paths starting withopenspec/specs/.
Target Subsystem
src/devops_cli/roadmap/stage_change.py, src/devops_cli/ai/tasks/roadmap_stage_change.md
Existing Tool Considered
_repository_path and StageGroup model validators are the existing validation layer in stage_change.py. Adding the path prefix check prevents invalid spec editing tasks without adding external dependencies. Cost to build: about 5,000 tokens and 30 minutes.
Proposed design
Problem statement
The stage planner can produce task groups that edit living specs under openspec/specs/. These edits conflict with openspec archive, which is the only writer of living specs. The change rejects such groups in StageGroup, updates the stage prompt, and adds a test.
Acceptance criteria
Requirement: Reject living specs in task groups
A StageGroup SHALL reject any path under openspec/specs/ in changes or creates with a validation error that names the path.
Scenario: A group lists a living spec
- WHEN A valid
StageGrouplistsopenspec/specs/config-commands/spec.mdinchangesandcreates. - THEN Validation fails, and the error names that path and says that only
openspec archivewrites living specs.
Requirement: Keep change folders and reads valid
A StageGroup SHALL accept a path under openspec/changes/ in changes and a path under openspec/specs/ in reads.
Scenario: A group writes its change folder and reads a living spec
- WHEN A valid
StageGrouplistsopenspec/changes/3295-example/tasks.mdinchangesandopenspec/specs/config-commands/spec.mdinreads. - THEN Validation succeeds.
Requirement: Tell the stage planner the living-spec rule
The stage prompt src/devops_cli/ai/tasks/roadmap_stage_change.md SHALL tell the planner never to put an openspec/specs/ path in changes or creates, and that openspec archive writes living specs.
Scenario: The prompt holds the living-spec rule
- WHEN A test reads
src/devops_cli/ai/tasks/roadmap_stage_change.md. - THEN The text states that a task group must not change or create files under
openspec/specs/and thatopenspec archivewrites living specs.
Requirement: Cover the living-spec rule with tests
The test suite SHALL cover the rejection in changes, the acceptance in reads, and the prompt rule.
Scenario: The new tests run
- WHEN The test suite runs
tests/roadmap/test_roadmap_stage_paths.pyandtests/roadmap/test_roadmap_stage_prompt_rules.py. - THEN The new tests pass.
Existing Tool Considered
No alternatives check has run. Pydantic provides the model-validator mechanism, but it lacks the repository-specific rule that rejects openspec/specs/ paths. The change extends the existing StageGroup validator in src/devops_cli/roadmap/stage_change.py. Written cost to build, keep and fix the validator, prompt change and test: about 5,000 tokens and 30 minutes. The change deletes no internal code.
Key questions
- Where should the rule that rejects living-spec edits live?: In a
StageGroupmodel validator insrc/devops_cli/roadmap/stage_change.py. It catches both the proposal reply and the split reply beforecheck_proposal. (best practice) [sources: src/devops_cli/roadmap/stage_change.py, src/devops_cli/roadmap/stage_eval_gates.py]- Chosen: StageGroup model validator. StageGroup is the schema of every task group, and the proposal and split replies both use it.
- Rejected: check_proposal only. It runs after schema validation and does not cover the split reply or a direct StageGroup validation.
- Rejected: Both StageGroup and check_proposal. The second check is redundant, and the schema already sends the violation back to the model.
- Which StageGroup fields must reject an
openspec/specs/path?:changesandcreatesonly. A step may read a living spec, because reading is not editing. (best practice) [sources: src/devops_cli/roadmap/stage_change.py, src/devops_cli/ai/tasks/roadmap_stage_change.md]- Chosen: Reject in changes and creates. The issue names these fields, and they list the files that the step writes.
- Rejected: Reject in reads too. A step may read a living spec, and the issue does not ask to stop reads.
- Rejected: Reject in all path fields. It would refuse valid read-only context.
- Which path prefix must the validator reject?: A path that starts with
openspec/specs/. The change folderopenspec/changes/must stay writable. (best practice) [sources: CONTEXT.md, src/devops_cli/roadmap/stage_change.py]- Chosen: Reject the
openspec/specs/prefix. It names living specs and no change folder. - Rejected: Reject every
openspec/path. It would refuse the change folder that the stage job writes. - Rejected: Reject only
openspec/specs//spec.md. It is narrower than the issue and misses other files under a living spec directory.
- Chosen: Reject the
- Which test module should hold the new tests?: Extend
tests/roadmap/test_roadmap_stage_paths.pyfor the validator andtests/roadmap/test_roadmap_stage_prompt_rules.pyfor the prompt. (best practice) [sources: tests/roadmap/test_roadmap_stage_paths.py, tests/roadmap/test_roadmap_stage_prompt_rules.py, tests/support/roadmap_stage.py]- Chosen: Extend the existing path and prompt modules. The existing modules already test StageGroup path rules and prompt rules.
- Rejected: Create
tests/roadmap/test_stage_change.py. It adds a second module for the same path rule, and the existing path module already covers StageGroup. - Rejected: Add only to the path module. It leaves the prompt rule without a test.
- How should the validator report a rejected path?: Raise
ValueErrorfrom the model validator. The message SHALL name the path and say that onlyopenspec archivewrites living specs. (best practice) [sources: src/devops_cli/roadmap/stage_change.py]- Chosen: Raise ValueError with a message that names the path. It matches
_creates_are_changes, and Pydantic sends the message back to the model. - Rejected: Return a problem from check_proposal only. The schema validator would accept the group, and the split reply would not be checked.
- Rejected: Raise ValueError without the path. The model and the test need the offending path to correct the reply.
- Chosen: Raise ValueError with a message that names the path. It matches
- Does the current code have a rule for living-spec paths?: No.
StageGroupchecks path form andcreatesmembership.check_proposalchecks form and paths. Neither checks theopenspec/specs/prefix. [sources: src/devops_cli/roadmap/stage_change.py, src/devops_cli/roadmap/stage_eval_gates.py] - Does
StageGrouprequire every path increatesto be inchanges?: Yes. The_creates_are_changesmodel validator raises when acreatespath is absent fromchanges. [sources: src/devops_cli/roadmap/stage_change.py] - Does the stage prompt currently tell the planner not to edit
openspec/specs/?: No. The prompt says a path must be a file of the commit or a created path. It does not nameopenspec/specs/. [sources: src/devops_cli/ai/tasks/roadmap_stage_change.md]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
devops-cli-service commentedon Nov 3, 2026
Status set to Ready at fc16309 (see proposed design in issue body).
devops-cli-service commentedon Nov 3, 2026
Staged: branch
fix/3295-stage-allows-task-groups-that-edit, draft pull request #3316. The pull request plans the item and closes no issue.The task groups, with the tokens of the inputs of each step, for a budget of 40000 tokens:
The plan run made 2 model request(s), and used 147379 input tokens and 8040 output tokens. The model made no tool call.
docs(openspec): plan #3295 reject living-spec paths in stage task groups
docs(openspec): plan #3295 reject living-spec paths in stage task gro…
devops-cli-service commentedon Nov 3, 2026
Released in v0.53.2: https://github.com/dan-petty/devops-cli/releases/tag/v0.53.2
devops-cli-service commentedon Nov 3, 2026
Live since 2026-11-03 21:44 UTC