Repository navigation
Description
Problem
The Service opens a draft pull request for each staged roadmap item. The stage_ready row marks the pull request ready when all CI checks pass.
When subsequent changes merge into the default branch, the open plan pull request can become invalid. For example, moving modules to subpackages or adding verification command syntax requirements invalidates older plans. GitHub does not re-run CI checks automatically without new pushes. The Service does not detect this drift against the default branch. The pull request stays open until an engineer discovers the failure during review or implementation.
Proposed change
Add automated plan drift detection for open plan pull requests to the Service.
The Service evaluates open plan pull requests against the current default branch:
- Identify open plan pull requests whose target branch is the default branch.
- Run
plan-checkagainst the head commit of the default branch. - If
plan-checkreports problems, add the labelplan/needs-fixto the pull request. - Post a comment on the pull request that lists each detected problem.
Acceptance criteria
- A function evaluates whether open plan pull requests satisfy
plan-checkagainst the default branch. - When an open plan pull request fails the check, the pull request receives the label
plan/needs-fix. - A comment is posted to the pull request that details each reported problem.
- When a previously failing plan pull request is updated and passes, remove the
plan/needs-fixlabel. - Unit tests cover drift detection, labeling, and comment generation.
Target Subsystem
SDLC, Git & PR Governance
Existing Tool Considered
No open tool validates OpenSpec proposals against custom repository stage gates. Building this feature requires approximately 25,000 tokens to implement and 5,000 tokens annually to maintain. Elapsed time is approximately 3 hours.
Proposed design
Problem statement
Open plan pull requests can become invalid when the default branch changes. The Service does not detect this drift, so a stale plan stays open until an engineer finds the failure. This change makes the Service check open plan pull requests against the default branch, label failures plan/needs-fix, and comment each problem.
Acceptance criteria
Requirement: Detect drift on open plan pull requests
The Service SHALL evaluate each open plan pull request against the head commit of the default branch.
Scenario: A stale plan cites a moved path
- WHEN An open plan pull request cites a path that the default branch head does not hold.
- THEN The drift check reports a problem for that path.
Requirement: Recognize a plan pull request
The Service SHALL treat an open pull request whose base is the default branch and whose title or body has the plan form as a plan pull request.
Scenario: A delivery is not a plan
- WHEN An open pull request into the default branch holds the title and body of a delivery.
- THEN The drift check reports no problem for it.
Requirement: Run the drift row in the status lane
The status lane SHALL run a plan_drift row before the stage_ready row on each round.
Scenario: A status-lane round starts
- WHEN A status-lane round starts for a repository.
- THEN The round runs
plan_driftbeforestage_ready.
Requirement: Keep the drift check model-free
The plan_drift row MUST run without a model call.
Scenario: The drift row runs
- WHEN The
plan_driftrow runs on a status-lane round. - THEN The row makes no model call.
Requirement: Label a failing plan pull request
The Service SHALL add the label plan/needs-fix to a plan pull request when the drift check reports at least one problem.
Scenario: The drift check reports a problem
- WHEN The drift check returns one or more problems for an open plan pull request.
- THEN The pull request has the label
plan/needs-fix.
Requirement: Comment each detected problem
The Service SHALL post a comment on a failing plan pull request that lists each problem the drift check reports.
Scenario: The drift check reports two problems
- WHEN The drift check returns two problems for an open plan pull request.
- THEN The comment contains the message of each problem.
Requirement: Keep one drift comment
The Service SHALL keep one drift comment per pull request and update it when the problem list changes.
Scenario: The problem list changes
- WHEN A plan pull request already has a drift comment and a later drift check reports a different problem list.
- THEN The Service updates the existing drift comment and creates no second drift comment.
Requirement: Remove the label after a passing check
The Service SHALL remove the label plan/needs-fix from a plan pull request when a later drift check reports no problem.
Scenario: A previously failing plan passes
- WHEN A plan pull request has the label
plan/needs-fixand a later drift check reports no problem. - THEN The pull request does not have the label
plan/needs-fix.
Requirement: Block readiness for a failing plan
The stage_ready row MUST NOT mark a plan pull request ready while it has the label plan/needs-fix.
Scenario: Green checks with the needs-fix label
- WHEN A draft plan pull request has passing checks and the label
plan/needs-fix. - THEN The
stage_readyrow leaves the pull request as a draft.
Requirement: Cover drift behavior with unit tests
The change MUST add unit tests for drift detection, label changes and comment generation.
Scenario: The drift unit tests run
- WHEN The unit test suite runs the roadmap stage tests.
- THEN The suite passes with tests for a detected problem, a label addition, a label removal and a comment body.
Existing Tool Considered
No alternatives check has run. The OpenSpec CLI (@fission-ai/openspec, pinned 1.14.3, ADR 0010) validates a change folder with openspec validate --strict, and the project's own plan_check already runs the stage gates with no model, but neither covers the need: OpenSpec knows no pull request, label or comment, and plan_check judges the pull request head tree, where a path that moved on the default branch still exists. No open, maintained tool detects, labels and comments plan drift on open pull requests. The change reuses both and builds only the row: about 25,000 tokens to implement, 5,000 tokens each year to maintain, and about 3 hours of elapsed time.
Key questions
- Which Service row runs the drift check?: Add a
plan_driftrow to the status lane, beforestage_ready, so a draft that this round finds drifted holds the label before readiness is decided. Do not extendstage_ready: it reads only the staged items whose record holdsstage.prand nostage.ready, so it stops reading a plan pull request once it marks it ready. (best practice) [sources: CONTEXT.md:150, src/devops_cli/roadmap/stage/stage_ready.py:84, docs/roadmap/stage.md:91, src/devops_cli/roadmap/run.py:750]- Chosen: Add
plan_driftto the status lane beforestage_ready. It covers every open plan pull request, including a ready one, it calls no model, and it runs before readiness is decided. - Rejected: Extend
stage_ready.stage_readyreads only a staged item until it marks the draft ready, so it misses a plan pull request that is already ready. - Rejected: Run it in the stage job. The stage job is in the model lane and spends model tokens.
- Chosen: Add
- How does the Service identify an open plan pull request?: List the open pull requests with
store.open_pulls(), keep those whose title starts withdocs(openspec): plan #, read each withget_pull, and keep those whose base ref is the default branch.plan_check.is_planthen excludes a pull request that the implement job has taken over as a delivery. (best practice) [sources: src/devops_cli/roadmap/plan_check.py:173, src/devops_cli/roadmap/stores/store.py:484, docs/roadmap/plan-check.md:56, docs/roadmap/stage.md:12]- Chosen: Plan title plus the default branch base. The stage job gives every plan pull request the title
docs(openspec): plan #<issue> <summary>, andis_planexcludes a delivery. - Rejected: Label
status/ready. The status label is on the issue, not on the pull request. - Rejected: Branch prefix. The branch keeps the type of the issue, so it is not a stable plan marker.
- Chosen: Plan title plus the default branch base. The stage job gives every plan pull request the title
- What plan check does the
plan_driftrow run?: Read the plan from the pull request head withread_change, then run the deterministic gatescheck_proposalandvalidate_changeagainst a detached checkout of the default branch head, with the pull-form rules ofplan_check; do not run the model verification pass. This reuses the core ofplan_check, which judges the pull request head tree, where a path that moved on the default branch still exists. (best practice) [sources: src/devops_cli/roadmap/plan_check.py:368, src/devops_cli/roadmap/stage/stage_change.py:1203, src/devops_cli/roadmap/stage/stage_validate.py:77, docs/roadmap/plan-check.md:26, docs/roadmap/stage.md:69]- Chosen: Reuse the plan-check gates against the default branch tree. It catches a moved path and a changed base spec without model tokens, and it keeps one rule set.
- Rejected: Call
plan_checkas it stands. It reads the gates on the pull request head tree, so a path moved on the default branch is still present and the drift is missed. - Rejected: Full stage job with the model review. The model review adds cost and latency to a periodic check.
- Rejected: New
plan-checkprogram. It duplicates the stage validation that the repository already keeps.
- When does the
plan_driftrow run?: Run it on its own interval on the status lane, every 37 minutes, the interval of the stage row, and on a first run. The poll is the source of truth; the Service takes no push webhook event, so a new default commit is found by the next round. (best practice) [sources: docs/adr/0003-polling-is-how-the-roadmap-sees-changes.md:7, docs/adr/0009-one-webhook-router-delivers-each-event-to-the-consumers-subscribed-to-it.md:8, src/devops_cli/config/constants.py:3451, src/devops_cli/config/defaults.py:898, docs/roadmap/stage.md:29]- Chosen: Every 37 minutes on the status lane. It matches the stage interval, and the check is heavier than the other status rows because it fetches a commit and runs
openspec validatefor each plan. - Rejected: On every status round, every 3 minutes. A plan check per open plan every 3 minutes is a fetch and an
openspec validaterun, for a change that only a merge or a push causes. - Rejected: On a push webhook. The Service takes the
issuesevent only, so apushdelivery getsno_subscriber, and a new subscription is a person's change to the repository hook.
- Chosen: Every 37 minutes on the status lane. It matches the stage interval, and the check is heavier than the other status rows because it fetches a commit and runs
- How does the Service prevent repeated drift comments?: Add the marker
<!-- devops roadmap plan drift -->as a new constant insrc/devops_cli/config/constants.pyand add it toCONST_ROADMAP_JOB_COMMENT_MARKERS. Read the pull request comments withlist_issue_comments, post withcreate_issue_commentwhen no comment holds the marker, and replace the marked comment withupdate_issue_commentwhen its body differs from the rendered one. (best practice) [sources: src/devops_cli/config/constants.py:3520, src/devops_cli/config/constants.py:3532, src/devops_cli/github/client.py:605, src/devops_cli/github/client.py:610, docs/roadmap/stage.md:86, k8s/README.md:673]- Chosen: One marked comment, updated in place. It follows the marker convention of every roadmap job's comment, and the client already lists and updates issue comments.
- Rejected: New comment each run. A periodic row would add a comment on every round.
- Rejected: No update. The comment would show problems that are already fixed.
- Does
stage_readyalready refuse a plan pull request withplan/needs-fix?: Yes. Thestage_readyrow refuses a green draft that holdsplan/needs-fix, comments once that the label is the reason, and recordsstage.needs_fix. [sources: src/devops_cli/roadmap/stage/stage_ready.py:103, docs/roadmap/stage.md:69] - Where does the drift code and its row registration live?: Add the row to
STATUS_LANE_ROWSinsrc/devops_cli/roadmap/run.pyand its interval tosrc/devops_cli/config/defaults.py. Put the check insrc/devops_cli/roadmap/stage/plan_drift.py, besidestage_ready.py, and its tests intests/roadmap/stage/test_roadmap_stage_drift.py. (best practice) [sources: src/devops_cli/roadmap/run.py:735, src/devops_cli/config/defaults.py:901, docs/roadmap/package-layout.md:11, src/devops_cli/roadmap/stage/stage_ready.py:1]- Chosen: New module under
src/devops_cli/roadmap/stage/. The stage package holds the plan validation andstage_ready, the other status-lane row of the stage job. - Rejected: New top-level
src/devops_cli/roadmap/plan_drift.py. The plan validation it calls lives in the stage package, andplan_check.pyis the command module, not a Service row. - Rejected: Add the logic to
src/devops_cli/roadmap/run.py.run.pyregisters rows and should stay a thin dispatcher.
- Chosen: New module under
- Which tests cover the affected row?: The status round tests are
tests/roadmap/test_roadmap_status_round.py, the due table tests aretests/roadmap/test_roadmap_run_due_table.py, and the readiness test istests/roadmap/stage/test_roadmap_stage_ready.py. The new drift tests go intests/roadmap/stage/test_roadmap_stage_drift.py. [sources: tests/roadmap/test_roadmap_status_round.py, tests/roadmap/test_roadmap_run_due_table.py, tests/roadmap/stage/test_roadmap_stage_ready.py, tests/roadmap/test_roadmap_plan_check.py]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Alternatives check of 2026-11-09: partly.
Tool: danger/danger-js (https://github.com/danger/danger-js), MIT, last activity 2026-10-26, maintained.
Activity
dan-petty commentedon Nov 7, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
featprefix of the title gives the type.(roadmap)scope of the title gives the scope.Prevents stale plan PRs from sitting open, but does not block delivery or expose a security risk.Saves engineer time by surfacing drift early, but the project functions without it.The body estimates approximately 3 hours and 25,000 tokens of work.Both use the plan-check command on plan pull requests, but #3201 delivers the command itself while the candidate adds an ongoing drift-detection loop that re-runs it, labels, and comments.devops-cli-service commentedon Nov 8, 2026
Status set to Ready at 1f03ee3 (see proposed design in issue body).
devops-cli-service commentedon Nov 9, 2026
Alternatives check: partly
Reason: Searches for tooling that re-validates open pull requests against the default branch found no dedicated drift detector; the closest fit is Danger JS, a pull-request rule engine that can run a check, add and remove labels, and keep one comment updated in place. It covers the labeling, label-removal and single-comment half of the acceptance criteria, but it runs on pull-request events, so it does not itself notice a new default-branch commit, and it carries no plan/OpenSpec gates.
Tool: danger/danger-js (https://github.com/danger/danger-js)
Covers:
Lacks:
Tools considered:
Searches run:
Sources:
Checked on 2026-11-09. A person decides what this means for the item. The check changes no label and closes no issue.
fix(roadmap): import change_root from plan_read and count the drift r…
test(roadmap): cover the plan drift row and its adapter (#3968)
test(roadmap): keep the drift protocol out of the pragma budget (#3968)
devops-cli-service commentedon Nov 14, 2026
Released in v0.144.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.144.0
devops-cli-service commentedon Nov 14, 2026
Live since 2026-11-14 22:29 UTC