Skip to content

fix(roadmap): leave out items with unmerged stage plan PRs #4041

Closed as not planned

Description

@dan-petty

Problem Description

The implement job takes an item when recorded_branch(item) returns a branch on origin and the pull request is an open draft. In src/devops_cli/roadmap/implement/implement.py, recorded_branch() reads StageRecordKey.BRANCH and StageRecordKey.PR when implement.* keys are absent. Because a plan staged by the stage job is pushed to origin with an open draft pull request, the implement job immediately takes the item before Gate G1 review and before stage_ready marks the plan pull request ready.

When the runner Job starts, it records implement.pr with the stage plan pull request number. If the runner Job stops or fails, the item remains blocked with implement.pr equal to stage.pr. Then devops pr check-readiness classifies the plan pull request as an implementation pull request and refuses it because task groups are not ticked and the change is not archived. Additionally, stage_ready ignores the pull request because implement.job is set.

Reproduction Steps

  1. A roadmap item reaches status/ready.
  2. The stage job stages the item and opens a draft plan pull request (for example PR docs(openspec): plan #3247 Require a security section for sensitive plans #4022 for item feat(roadmap): Require a security section for sensitive plans #3247).
  3. The implement job runs while the plan pull request is still open.
  4. Inspect the item: the implement job takes the item, sets implement.pr to the plan pull request number, and starts an implementation Job.
  5. If the Job stops, inspect devops pr check-readiness <pr>: it fails with unticked task group errors.

Expected vs Actual Behavior

Expected: The implement job leaves out an item whose stage plan pull request has not been reviewed and merged into the default branch (Gate G1).
Actual: The implement job takes the stage plan pull request immediately, overwrites implement.pr, and locks the plan pull request in an unready state.

Environment Diagnostics

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

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

The implement job takes an item as soon as the stage job pushes its draft plan pull request. It then writes the plan pull request number as implement.pr and starts an implementation Job before Gate G1. A Job that stops leaves the item blocked, and devops pr check-readiness then refuses the plan pull request. The change makes the job take an item only after a person merges the plan into the default branch.

Acceptance criteria

Requirement: Recorded branch is the implement pair

recorded_branch SHALL return the branch and pull request that the implement job wrote, and SHALL return None when the record holds only the stage pair.

Scenario: Stage record only

  • WHEN An item's job record holds stage.branch and stage.pr, and no implement.branch or implement.pr.
  • THEN recorded_branch(item) returns None.

Requirement: Staged item is left out

The implement job SHALL leave out an item whose change folder is not active on the default branch.

Scenario: Open plan pull request

  • WHEN An item holds status/ready, a stage.branch on origin and an open draft stage.pr, and the default branch holds no change folder for it.
  • THEN plan_implement selects no item and reports the item left out with the unmerged-plan reason.

Requirement: Unmerged-plan reason names the plan pull request

The left-out reason of an item whose plan pull request is not merged SHALL name the stage pull request number.

Scenario: Report line

  • WHEN render_implement_plan renders a plan that holds the left-out item.
  • THEN The line of the item holds its number, its title and the stage pull request number.

Requirement: Stale implement pair is left out

The job SHALL leave out an item whose implement.* pair names the stage plan pull request and whose change folder is not on the default branch.

Scenario: Runner stopped before its own draft

  • WHEN The record holds implement.branch equal to stage.branch and implement.pr equal to stage.pr, and the default branch holds no change folder for the item.
  • THEN plan_implement selects no item and reports the item left out with the unmerged-plan reason.

Requirement: Planned item is taken

The job SHALL take an item whose change folder is active on the default branch, also when its record still holds the stage pair.

Scenario: Merged plan with the stage branch on origin

  • WHEN The record holds a stage.* pair whose branch is on origin, and the change folder is active on the default branch.
  • THEN plan_implement selects the item as a Planned target with pull None and the branch <type>/<issue>-<slug>.

Requirement: Retry keeps the implementation draft

The job SHALL take an item whose implement.* branch is on origin, whose implement.* pull request is an open draft, and whose change folder is active on the default branch.

Scenario: Retry after a stop

  • WHEN The record holds an implement.* pair and a stop, a trusted person commented implement: retry after the last job comment, and the plan on the branch passes the stage gates.
  • THEN plan_implement selects the item with that branch and pull request, and the target has retry true.

Requirement: Stale implement pair is cleared

The Service SHALL clear every implement.* key of an item when its recorded implement pull request is the stage plan pull request and the default branch holds no change folder for it.

Scenario: Repair of a stopped item

  • WHEN A status round reads an item whose record holds implement.pr equal to stage.pr and an implement.job, and the default branch holds no change folder for it.
  • THEN The record holds no implement.* key, and stage_ready marks the plan pull request ready when its checks pass.

Existing Tool Considered

No check has run. No open, maintained tool or library covers this need, because the rule reads this project's own job record and its own plan layout. The project builds it: about 15,000 tokens to write the selection change, the message and the tests, and about 30 minutes of one implement run. The rule adds no dependency, so the keep and fix cost is the cost of the existing implement tests.

Key questions

  • Which condition makes an item takeable by the implement job?: The change folder must be active on the default branch. The job reads tasks.md from that branch, so an item without the folder cannot run. A recorded branch alone never makes an item takeable. (best practice) [sources: CONTEXT.md, src/devops_cli/roadmap/implement/implement.py]
    • Chosen: Require the active change folder on the default branch. The job reads tasks.md and the base specs from that branch. CONTEXT.md makes a person's merge of the plan the step that makes an item Planned.
    • Rejected: Compare implement.pr with stage.pr. This catches the stale record only. A fresh Staged item holds the stage pair alone.
    • Rejected: Keep the stage pair as a takeable record. This is the defect. It starts an implementation Job before Gate G1.
  • Which record pair does recorded_branch read?: Only implement.branch and implement.pr. A second helper reads the stage.* pair to give the left-out reason. (best practice) [sources: src/devops_cli/roadmap/implement/implement.py]
    • Chosen: Implement pair only, with a stage helper for the reason. The stage pair is the plan record. It must not select the item.
    • Rejected: Both pairs, in order. The fallback to the stage pair is the defect.
  • How does the project clear an implement pair that names the stage plan pull request?: The Service clears every implement.* key when the pair names the stage plan pull request and the default branch holds no change folder. The record then reads as Staged, and stage_ready marks the plan pull request ready. (best practice) [sources: CONTEXT.md, src/devops_cli/roadmap/implement/implement.py]
    • Chosen: Clear the record in the Service. The Service writes the job record and already clears a stop. One repair restores every reader.
    • Rejected: Make stage_ready ignore implement.job. This hides a bad record from one reader. devops pr check-readiness stays wrong.
    • Rejected: Leave the repair to a person. The item stays blocked, and no command clears the pair.
  • Which message does the job give for an item whose plan pull request is not merged?: A new key implement_left_plan_unmerged in src/devops_cli/lang/en/messages.py. It names the item and the stage pull request number. (best practice) [sources: src/devops_cli/lang/en/messages.py, src/devops_cli/roadmap/implement/implement.py]
    • Chosen: New key implement_left_plan_unmerged. Every left-out reason is a key of MESSAGES.roadmap, and the existing implement_left_pull says the pull request is not an open draft.
    • Rejected: Reuse implement_left_pull. The plan pull request is an open draft, so the text is wrong.
    • Rejected: Reuse implement_left_not_staged. The item is staged, so the text is wrong.

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. The bug locks items in a broken state and blocks the pipeline, but it is a specific edge case, not a data-loss or security defect.
    • Value: Medium. It prevents the implement job from corrupting item state and blocking plan PRs, keeping the roadmap pipeline usable.
    • Effort: Medium. The change is local to the selection logic in implement.py but needs a merge-state check and tests.
    • Related: fix(roadmap): implement refuses items with failing plan checks #3976, which asks for a different change. Both change the implement job selection rule for items with a plan PR, but #3976 checks for failing CI checks while the candidate checks for the PR being unmerged.
  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 447f024 (see proposed design in issue body).

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

    @devops-cli-service
    Contributor

    Alternatives check: none

    Reason: The search found no open, maintained tool that covers this need. The fix changes how this project's implement job picks items. It reads the project's own job record (stage.* and implement.* keys) and its OpenSpec change-folder layout on the default branch. The only results were unrelated GitHub Actions and container images. The issue's design already says no tool covers it.

    Tool: none found

    Lacks:

    • Reads the project's job record keys (stage.* / implement.*)
    • Checks for an active OpenSpec change folder on the default branch
    • Reports the unmerged-plan reason with the stage PR number
    • Clears a stale implement.* pair in the Service

    Searches run:

    • workflow automation skip item until plan pull request merged gate before implementation job, 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/agent
    on Nov 18, 2026
  8. dan-petty commented on Nov 18, 2026

    @dan-petty
    OwnerAuthor

    Close this issue as not planned per AGENTS.md Rule 2.

    Evidence

    Newer changes on main replaced this issue and resolved the related concerns:

    1. Plan merge wait handled in selection:
      PR fix(roadmap): name the plan merge wait in explain #5632 (commit cdef5c22, closing fix(roadmap): clarify review wait message for ready plan PRs in explain #3971) updated _pull_reason in src/devops_cli/roadmap/implement/implement.py to identify when a plan pull request is ready for review and awaiting merge:
      Its plan pull request #{pull} is ready for review and awaiting merge.

    2. CI gate checks for plan pull requests:
      PR fix(roadmap): leave out an item whose plan checks did not pass #5650 (commit c8b98323, closing fix(roadmap): implement refuses items with failing plan checks #3976) updated _pull_reason to evaluate the CI checks of the plan pull request (Plan Check), leaving out items whose plan checks have not completed or passed.

    3. Staged branch rebase before implementation:
      PR feat(roadmap): rebase staged branch onto main before implement #5921 (commit 42fbc79e, closing feat(roadmap): rebase staged branch onto main before implement #4076) added --rebase to rebase the staged branch onto main before implement.

    The premise of requiring the change folder on the default branch contradicts the existing roadmap architecture, which explicitly supports taking Staged items to ready pull requests (CONTEXT.md). Over 1,100 existing tests rely on the Staged implementation workflow.

  9. removed
    status/ready
    owner/agent
    on Nov 18, 2026
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