Skip to content

fix(roadmap): stage allows task groups that edit living specs #3295

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 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

  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/specs/.
  2. 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/specs/.
  3. Add a unit test in tests/roadmap/test_stage_change.py confirming that StageGroup rejects paths starting with openspec/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 StageGroup lists openspec/specs/config-commands/spec.md in changes and creates.
  • THEN Validation fails, and the error names that path and says that only openspec archive writes 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 StageGroup lists openspec/changes/3295-example/tasks.md in changes and openspec/specs/config-commands/spec.md in reads.
  • 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 that openspec archive writes 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.py and tests/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 StageGroup model validator in src/devops_cli/roadmap/stage_change.py. It catches both the proposal reply and the split reply before check_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?: changes and creates only. 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 folder openspec/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.
  • Which test module should hold the new tests?: Extend tests/roadmap/test_roadmap_stage_paths.py for the validator and tests/roadmap/test_roadmap_stage_prompt_rules.py for 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 ValueError from the model validator. The message SHALL name the path and say that only openspec archive writes 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.
  • Does the current code have a rule for living-spec paths?: No. StageGroup checks path form and creates membership. check_proposal checks form and paths. Neither checks the openspec/specs/ prefix. [sources: src/devops_cli/roadmap/stage_change.py, src/devops_cli/roadmap/stage_eval_gates.py]
  • Does StageGroup require every path in creates to be in changes?: Yes. The _creates_are_changes model validator raises when a creates path is absent from changes. [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 name openspec/specs/. [sources: src/devops_cli/ai/tasks/roadmap_stage_change.md]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/bug
    priority/p2-medium
    source/agent
    scope/roadmap
    status/new
    value/medium
    effort/low
    on Nov 2, 2026
  2. added
    status/ready
    and removed
    status/new
    on Nov 3, 2026
  3. devops-cli-service commented on Nov 3, 2026

    @devops-cli-service
    Contributor

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

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

    @devops-cli-service
    Contributor

    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:

    1. Refuse a living-spec path in a task group: 38688 tokens
    2. State the living-spec rule in the stage prompt: 19824 tokens

    The plan run made 2 model request(s), and used 147379 input tokens and 8040 output tokens. The model made no tool call.

  5. added 2 commits that reference this issue on Nov 3, 2026
  6. added
    status/planned
    and removed
    status/ready
    on Nov 3, 2026
  7. added
    status/in-progress
    status/in-review
    and removed
    status/planned
    status/in-progress
    on Nov 3, 2026
  8. removed
    status/in-review
    on Nov 3, 2026
  9. devops-cli-service commented on Nov 3, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-03 21:44 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