Skip to content

fix(roadmap): preserve stage plan kind when PR numbers collide #4045

Closed

Description

@dan-petty

Problem Description

In src/devops_cli/roadmap/implement/implement_pull.py, kind_of(item, pull) determines whether a pull request is evaluated as DraftKind.PERSON, DraftKind.AGENT, DraftKind.IMPLEMENT, or DraftKind.STAGE_PLAN:

    pull_str = str(pull) if pull is not None else None
    if pull_str and item.job_record.get(ImplementRecordKey.PR) == pull_str:
        return DraftKind.IMPLEMENT
    if pull_str and item.job_record.get(StageRecordKey.PR) == pull_str:
        return DraftKind.STAGE_PLAN

When a runner Job records implement.pr equal to stage.pr (e.g. from an erroneous or failed implementation attempt on a staged branch), kind_of() returns DraftKind.IMPLEMENT.

Consequently:

  1. _judge_completeness() treats the pull request as an implementation draft and refuses readiness if any task group is unticked or if the change is not archived.
  2. devops pr check-readiness fails with errors for all unticked task groups.
  3. stage_ready and devops pr ready cannot mark the stage plan pull request ready.

kind_of() should verify whether the pull request is actually a stage plan pull request (e.g., matching the title prefix docs(openspec): plan or checking that the pull request diff only contains unarchived files under openspec/changes/<change>/), so a collision does not permanently block the stage plan pull request.

Reproduction Steps

  1. An item has stage.pr set to a plan pull request.
  2. A runner job sets implement.pr to the same number and stops.
  3. Run devops pr check-readiness <pr>.
  4. Observe that kind_of() classifies the plan pull request as implement, causing readiness checks to fail on unticked task groups.

Expected vs Actual Behavior

Expected: A pull request that plans an item (docs(openspec): plan #...) is classified as DraftKind.STAGE_PLAN and evaluated without requiring implementation tasks to be ticked.
Actual: The pull request is classified as DraftKind.IMPLEMENT and permanently fails readiness.

Environment Diagnostics

  • DevOps CLI Version: 0.83.2
  • Python Version: 3.14.10
  • OS & Architecture: Linux x86_64
  • Execution Environment: CLI / CI

Logs, Traces, or Terminal Output

PR #4022 is not ready: Task group 1, Refuse a security trigger without a security section, has a task that is not ticked.
Task group 2, Render the security section in the design file, has a task that is not ticked.
Task group 3, State the security rule in the stage prompt, has a task that is not ticked.
Task group 4, Measure the stage job with the new rule, has a task that is not ticked.

Pre-Submission Checklist

  • I have verified that no sensitive credentials, private keys, or internal tokens are contained in this issue report.
  • I have checked existing issues and pull requests to ensure this is not a duplicate.

Proposed design

Problem statement

A runner Job can record the stage plan pull request number as implement.pr. Then kind_of returns DraftKind.IMPLEMENT. Readiness checks then demand ticked tasks and the stage plan pull request cannot become ready. The fix uses the pull request title to break the tie.

Acceptance criteria

Requirement: Stage plan title wins a collision

When implement.pr and stage.pr hold the same pull request number, kind_of SHALL return DraftKind.STAGE_PLAN if the pull request title starts with docs(openspec): plan.

Scenario: Colliding plan title

  • WHEN kind_of receives an item whose implement.pr and stage.pr equal the pull request and a title that starts with docs(openspec): plan
  • THEN it returns DraftKind.STAGE_PLAN.

Requirement: Implement title keeps a collision as implement

When implement.pr and stage.pr hold the same pull request number, kind_of SHALL return DraftKind.IMPLEMENT if the title does not start with docs(openspec): plan.

Scenario: Colliding implement title

  • WHEN kind_of receives an item whose implement.pr and stage.pr equal the pull request and a title that starts with fix(roadmap):
  • THEN it returns DraftKind.IMPLEMENT.

Requirement: Read draft passes the pull request title

read_draft SHALL pass the pull request title to kind_of for classification.

Scenario: Read a colliding plan pull request

  • WHEN read_draft reads a pull request whose title starts with docs(openspec): plan and whose number both records hold
  • THEN the returned Draft.kind is DraftKind.STAGE_PLAN.

Requirement: Stage plan readiness ignores unticked tasks

draft_readiness SHALL NOT refuse a DraftKind.STAGE_PLAN draft because a task group is unticked.

Scenario: Stage plan with unticked tasks

  • WHEN draft_readiness receives a stage plan draft with unticked task groups and passing checks
  • THEN it returns Readiness(Answer.READY).

Requirement: Implement readiness keeps task checks

draft_readiness SHALL refuse an implement draft when a task group is unticked.

Scenario: Implement draft with unticked tasks

  • WHEN draft_readiness receives an implement draft with an unticked task group
  • THEN it returns Readiness(Answer.REFUSE) with the unticked group in the reason.

Requirement: Check readiness accepts a colliding stage plan

devops pr check-readiness SHALL classify a colliding stage plan pull request as a stage plan and SHALL NOT report unticked task groups.

Scenario: Check readiness on a colliding plan

  • WHEN the command runs on a pull request whose title starts with docs(openspec): plan and whose number both records hold
  • THEN the output contains no unticked task group error.

Existing Tool Considered

No alternatives check has run. No open, maintained tool or library covers this need. GitHub CLI supplies pull request data, but it does not classify draft readiness. The change corrects existing code. The estimated cost is about 1,500 output tokens and 20 minutes of elapsed work.

Key questions

  • How does kind_of resolve a pull request number that both implement.pr and stage.pr hold?: Use the pull request title. Return DraftKind.STAGE_PLAN when the title starts with docs(openspec): plan. Otherwise return DraftKind.IMPLEMENT. (best practice) [sources: src/devops_cli/roadmap/implement/implement_pull.py, CONTEXT.md, docs/ROADMAP_WORKFLOW.md]
    • Chosen: Check the stage plan title prefix. The title type is the recorded marker of a plan pull request, and the check needs no diff fetch.
    • Rejected: Prefer stage.pr when both fields match. This can misclassify a real implement pull request when stage.pr is stale.
    • Rejected: Inspect changed files for only unarchived openspec/changes files. An early implement pull request can also change only the change folder, and the check needs an extra API call.
  • Where does the fix apply?: Fix kind_of and give it the title from read_draft. Keep _judge_completeness unchanged. (best practice) [sources: src/devops_cli/roadmap/implement/implement_pull.py]
    • Chosen: Fix kind_of and pass the title from read_draft. One classification point serves pr check-readiness, stage_ready and devops pr ready.
    • Rejected: Add a second check in _judge_completeness. It hides the wrong kind and leaves other callers with the wrong result.
  • What marks a stage plan pull request?: The stage plan pull request has the type docs(openspec) and its summary starts with plan. [sources: CONTEXT.md, docs/ROADMAP_WORKFLOW.md]
  • Does the fix need a new external library?: No. The fix uses the GitHub client data in read_draft. It adds no dependency. [sources: src/devops_cli/roadmap/implement/implement_pull.py]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Alternatives check of 2026-11-10: none.
Tool: none found.

Activity

  1. added
    source/agent
    type/bug
    scope/roadmap
    status/new
    value/medium
    effort/medium
    on Nov 7, 2026
  2. dan-petty commented on Nov 7, 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 stage plan PR is permanently blocked from readiness, but only in a specific PR-number collision scenario.
    • Value: Medium. Unblocks a workflow that is otherwise stuck with no recovery path for the affected item.
    • Effort: Medium. Requires adding a verification check (title prefix or diff inspection) to one function in one file.
    • Related: fix(roadmap): leave out items with unmerged stage plan PRs #4041, which asks for a different change. Both address the implement.pr equals stage.pr collision; 4041 prevents the implement job from taking the item, while the candidate fixes kind_of() to classify the PR correctly.
  3. added
    priority/p2-medium
    on Nov 7, 2026
  4. added
    status/ready
    and removed
    status/new
    on Nov 8, 2026
  5. devops-cli-service commented on Nov 8, 2026

    @devops-cli-service
    Contributor

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

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

    @devops-cli-service
    Contributor

    Alternatives check: none

    Reason: One search found no tool for this need. The issue is a bug in project-specific logic: kind_of() must tell a roadmap stage plan PR from an implement PR when implement.pr and stage.pr hold the same number. The planned fix is a title-prefix check on the project's own code, so no external library applies.

    Tool: none found

    Lacks:

    • Classification of the project's own DraftKind values (stage plan vs implement) when the two record fields collide
    • Readiness rules tied to the roadmap's job records

    Searches run:

    • classify pull request type by title prefix conventional commits library, results: 5

    Checked on 2026-11-10. A person decides what this means for the item. The check changes no label and closes no issue.

  7. added
    owner/service
    and removed
    owner/service
    on Nov 18, 2026
  8. added
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 18, 2026
  9. removed
    status/in-review
    owner/agent
    on Nov 18, 2026
  10. devops-cli-service commented on Nov 18, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-18 13: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/mediumpriority/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