Skip to content

fix(roadmap): stage allows task groups that edit openspec change folders #3285

Closed

Description

@dan-petty

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 subsequent implementation steps executed by devops roadmap implement.
The implementation steps modify source code under src/, test suites under tests/, and documentation under docs/.
Implementation steps must never create or edit OpenSpec change proposal documents in openspec/changes/ because the change proposal is already written before implementation starts.

In PR #3225 (issue #3060), the stage model generated a redundant task group titled Write the change documents, listing paths under a hallucinated directory openspec/changes/3060-model-tier-ladder/.
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.
Because the group listed the paths in creates, the path validator in src/devops_cli/roadmap/stage_paths.py allowed nonexistent paths under openspec/changes/.

Proposed Solution & Architectural Design

  1. Add a validator to StageGroup in src/devops_cli/roadmap/stage_change.py that rejects any group whose changes or creates contains paths starting with openspec/changes/.
  2. Add a path check in src/devops_cli/roadmap/stage_paths.py that refuses creates entries under openspec/changes/.
  3. Update src/devops_cli/ai/tasks/roadmap_stage_change.md to instruct the stage planner that an implementation group must never change or create files under openspec/changes/.
  4. Add a unit test in tests/roadmap/test_stage_change.py confirming that StageGroup rejects paths under openspec/changes/.

Target Subsystem

src/devops_cli/roadmap/stage_change.py, src/devops_cli/roadmap/stage_paths.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 change folder tasks without adding external dependencies. Cost to build: about 5,000 tokens and 30 minutes.

Proposed design

Problem statement

The stage planner can write a task group that changes or creates files under openspec/changes/. The current StageGroup and check_proposal checks accept those paths. The fix rejects such groups, adds the rule to the prompt, and covers it with tests.

Acceptance criteria

Requirement: Stage group refuses change-folder paths

A StageGroup SHALL reject a path in changes or creates that is openspec/changes or starts with openspec/changes/.

Scenario: Change path in a task group

  • WHEN a StageGroup sets changes to openspec/changes/3060-model-tier-ladder/proposal.md
  • THEN validation fails and the error names that path

Requirement: Stage group allows change-folder reads

A StageGroup SHALL allow a path under openspec/changes/ in reads.

Scenario: Read a change document

  • WHEN a StageGroup sets reads to openspec/changes/3060-model-tier-ladder/proposal.md and changes src/devops_cli/roadmap/stage_change.py
  • THEN validation succeeds

Requirement: Proposal check reports a change-folder path

check_proposal SHALL return a problem for a group that changes or creates openspec/changes or a path under openspec/changes/.

Scenario: Recorded plan edits a change file

  • WHEN check_proposal runs on a group built without validation that creates openspec/changes/3060-model-tier-ladder/proposal.md
  • THEN the problems name the group and the path

Requirement: Stage prompt forbids change-folder edits

The roadmap stage prompt SHALL tell the planner that an implementation group must not change or create a path under openspec/changes/.

Scenario: Prompt states the rule

  • WHEN the prompt file is read
  • THEN it contains a sentence that names openspec/changes/ and forbids the change or creation

Requirement: Roadmap stage tests cover the rule

The roadmap stage tests SHALL cover the rejection in StageGroup and in check_proposal.

Scenario: Roadmap stage tests run

  • WHEN the roadmap stage tests run
  • THEN they pass and include a case for openspec/changes/3060-model-tier-ladder/proposal.md

Existing Tool Considered

No alternatives check has run. The existing validation layer, _repository_path and the StageGroup model validators in src/devops_cli/roadmap/stage_change.py, covers the need. No external library applies. Cost to build, keep and fix: about 5,000 tokens and 30 minutes.

Key questions

  • Which functions check a stage plan today?: StageGroup model validators check the reply, and check_proposal calls path_problems and form_problems. [sources: src/devops_cli/roadmap/stage_change.py, src/devops_cli/roadmap/stage_paths.py, src/devops_cli/roadmap/stage_eval_gates.py]
  • Where should the stage job refuse a task group that changes or creates a path under openspec/changes/?: Refuse it in both the StageGroup model validator and path_problems; check_proposal calls path_problems. (best practice) [sources: src/devops_cli/roadmap/stage_change.py, src/devops_cli/roadmap/stage_paths.py, src/devops_cli/roadmap/stage_eval_gates.py]
    • Rejected: StageGroup validator only. A recorded plan can build a group with model_construct and skip the schema.
    • Rejected: path_problems only. The model gets no correction before the job checks the plan.
    • Chosen: Both checks. The validator corrects the reply early, and the path gate also judges recorded plans.
  • Which path fields should the rule refuse?: Refuse changes and creates; allow reads, task text and verify unless another check refuses the path. (best practice) [sources: src/devops_cli/roadmap/stage_change.py, src/devops_cli/roadmap/stage_paths.py]
    • Rejected: All path fields. A task text or a command can name a change document to read, and the check cannot tell a read from a write.
    • Rejected: creates only. A group can change an existing change file and create no path.
    • Chosen: changes and creates. These fields declare the files that the implementation step writes.
  • How should the rule treat the openspec/changes folder itself?: Refuse openspec/changes and every path under openspec/changes/. (best practice) [sources: src/devops_cli/roadmap/stage_change.py]
    • Rejected: Prefix only. A group could change the folder itself and avoid the prefix check.
    • Chosen: Exact folder and prefix. The constant _CHANGES_DIRECTORY names the folder, and a write to it is a change-folder write.
  • Where should the tests for the rule live?: Add StageGroup cases to tests/roadmap/test_roadmap_stage_form.py, path cases to tests/roadmap/test_roadmap_stage_paths.py, and the prompt case to tests/roadmap/test_roadmap_stage_prompt_rules.py. (best practice) [sources: tests/roadmap/test_roadmap_stage_form.py, tests/roadmap/test_roadmap_stage_paths.py, tests/roadmap/test_roadmap_stage_prompt_rules.py]
    • Rejected: New tests/roadmap/test_stage_change.py. The repository already groups StageGroup and path cases in the existing stage test modules.
    • Chosen: Existing stage test modules. They hold the nearest cases and run in the same suite.
  • How should the prompt state the rule?: Add one bullet under the path rules that says an implementation group must not change or create a path under openspec/changes/. (best practice) [sources: src/devops_cli/ai/tasks/roadmap_stage_change.md]
    • Chosen: Add a separate path-rule bullet. The model reads the path rules as a list, and a separate bullet is easy to test.
    • Rejected: Add the sentence to the changes key description. The model can miss a rule inside a key description.
    • Rejected: Add the sentence to the feasibility rule. The rule is not about feasibility.
  • What message should the validator and the path check give?: Add one message key stage_bad_change_path that names the path and says a task group must not change or create a path under openspec/changes/. (best practice) [sources: src/devops_cli/roadmap/stage_change.py, src/devops_cli/roadmap/stage_paths.py]
    • Rejected: Reuse stage_bad_path. That message says the path is not a repository path, which is false.
    • Chosen: Add stage_bad_change_path. The message states the real rule and names the path.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/bug
    scope/roadmap
    status/new
    value/medium
    effort/low
    on Nov 2, 2026
  2. dan-petty commented on Nov 2, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/bug. The fix prefix of the title gives the type.
    • Scope: scope/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P2-Medium. A real plan (PR #3225) produced an invalid group, but the defect is contained to one generated plan and does not break builds.
    • Value: Medium. Prevents a class of invalid stage plans that would mislead the implement step, but affects only plans touching openspec/changes paths.
    • Effort: Low. The body estimates about 5,000 tokens and 30 minutes for a prefix check, a model-prompt line, and one unit test.
    • Related: fix(roadmap): the stage job refuses a plan that names a path that does not exist #3010, which asks for a different change. Both add path validation in stage_change.py for task groups, but 3010 rejects nonexistent paths while the candidate rejects a specific forbidden prefix (openspec/changes/).
  3. added
    priority/p2-medium
    on Nov 2, 2026
  4. added
    status/ready
    and removed
    status/new
    on Nov 3, 2026
  5. devops-cli-service commented on Nov 3, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 2eede7c (see proposed design in issue body).

  6. devops-cli-service commented on Nov 3, 2026

    @devops-cli-service
    Contributor

    Staged: branch fix/3285-stage-allows-task-groups-that-edit, draft pull request #3311. 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:

    1. Refuse a change-folder path in a task group: 23208 tokens
    2. Report a change-folder path in the path check: 20094 tokens
    3. State the path rule in the stage prompt: 20288 tokens

    The plan run made 3 model request(s), and used 227992 input tokens and 15231 output tokens. The model made no tool call.

    A model review of the plan found these points. They stop no draft, and a person judges them:

    • other at group 1: The new validator refuses changes and creates paths under openspec/changes/. The existing REPORT fixture uses such paths and feeds passing tests. The group does not update the fixture, so its own verify command fails. Evidence: ""changes": ["openspec/changes/2162-x/mutation-report.md"],"
    • other at group 1 and group 2: Both groups need the new message text in the roadmap texts that MESSAGES serves. No group lists that file in changes. The step cannot edit an unlisted file, so the message key stays undefined. Evidence: "Add the message text to the roadmap texts that MESSAGES serves"
  7. added 2 commits that reference this issue on Nov 3, 2026
  8. added
    status/planned
    and removed
    status/ready
    on Nov 3, 2026
  9. added
    status/in-progress
    status/in-review
    and removed
    status/planned
    status/in-progress
    on Nov 4, 2026
  10. removed
    status/in-review
    on Nov 4, 2026
  11. devops-cli-service commented on Nov 4, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-04 04:25 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/lowpriority/p2-mediumscope/roadmapsource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions