Repository navigation
Description
Problem or Motivation
Today the implement job can continue on a plan branch, and stage_ready can mark the same plan PR ready to wait for G1. The two paths can act on one head; #4078 reports a case on PR #4069. No job returns a ready bot PR that needs work to draft. A checkpoint commit on an open PR starts a CI run on an unchecked head. The approved pipeline split design (tracker #5482) fixes this with D3 (one Staged rule for each item) and D7 (the draft route).
Proposed Solution & Architectural Design
- Staged rule (D3): the effort pass picks one path for each item. The effort pass comes from the setting
roadmap.implement.effort.- When the item is in the implement effort pass, tests and implement continue on the plan branch, and watch never marks that plan PR ready.
- Otherwise, watch marks the plan PR ready, and delivery starts at Planned on a new branch with no PR.
due_jobsholds the rule.
- Draft route (D7): watch converts a ready bot PR to draft only on a deterministic verdict: a conflict, a failed required check,
plan/needs-fix, and after E4 a failedreview.verdict. Never a PR of a person. At most 3 draft cycles for each PR (watch.cycles). After that, the job writes a person cause after the fixable check. - Use the GraphQL
convertPullRequestToDraftandmarkPullRequestReadyForReview. During a GraphQL hold, retry at the next sweep and read with REST ETags. [skip ci]rule: a checkpoint or tests commit on a branch with an open PR holds[skip ci]in its message. The checked head holds no marker. Watch judges only checked heads.
Target Subsystem
Roadmap Service and roadmap jobs (src/devops_cli/roadmap/, the watch row).
Acceptance Criteria
- Test first:
due_jobsnever gives both a ready mark and an implement continue for one item head. The test fails on the base. - A test: a ready bot PR with a failed required check goes to draft; a PR of a person does not; the fourth cycle writes a person cause.
- A test: a checkpoint commit on an open PR holds
[skip ci], and watch gives no verdict for that head. - A test:
--dry-runsends 0 requests. -
docs/ROADMAP_WORKFLOW.mdstates the Staged rule and the draft route. - Live proof: after the merge and the release, watch runs as the App on the open
devops-cli-service[bot]plan and delivery PRs, and on those closed in the last 14 days. A comment on this issue gives the result lines, one path for each item, and 0 red CI runs on unchecked App heads.
Existing Tool Considered
The GitHub GraphQL convertPullRequestToDraft and markPullRequestReadyForReview and the [skip ci] marker cover the writes. The Prow Tide pattern gives one verdict with its reason. Build: 200,000 to 300,000 agent tokens and 0.5 to 1 day.
Related
Tracker #5482, Phase 3. Depends on #5024, #5020 and #5504. It replaces #4078 (closed). #5259 (stage plans items that implement never takes). #5520 uses the [skip ci] rule.
Source: #5482
Alternatives check of 2026-11-29: in-use.
The repository already uses this tool.
Tool: cli/cli (https://github.com/cli/cli), MIT, last activity 2026-11-27, maintained.
Reason: The searches found no tool for the staged or draft policy. cli/cli covers only the ready and draft state writes that the watch row needs, so the rule and the cycle cap stay in the roadmap code.
Covers:
- Marks a draft pull request ready for review
- Converts a pull request to draft with --undo
- Sends the writes as GraphQL mutations
Lacks:
- No one-path rule for each item head
- No draft cycle cap and person stop
- No skip ci marker on checkpoint commits
Proposed design
Problem statement
Build the Staged rule and the draft route. Do not go live until the plan review step runs. The implement job and watch can act on one plan head: implement continues while watch marks the same pull request ready. No job moves a ready bot pull request that needs work back to draft, and a checkpoint commit starts CI on an unchecked head. This change gives one Staged rule to due_jobs, adds the draft route to watch, and puts [skip ci] on checkpoint commits.
Acceptance criteria
Requirement: One staged path for each item head
due_jobs SHALL give an item head either the implement step or the ready step, and never both, using the implement judge's selection and its effort pass.
Scenario: Item that the implement judge takes
- WHEN The implement judge takes the item in its effort pass and the plan pull request has passing checks.
- THEN
due_jobsreturns the implement step and no ready step for that head, and the test fails on the base.
Requirement: Ready step for an item that the implement judge leaves
due_jobs SHALL give the ready step, and no implement step, to an item that the implement judge leaves and whose plan pull request is a draft with passing checks.
Scenario: Item that the implement judge leaves
- WHEN The implement judge leaves the item, its plan pull request is a draft, and the checks pass.
- THEN
due_jobsreturns the ready step and no implement step for that head.
Requirement: A failed required check drafts a bot pull request
watch MUST convert a ready bot pull request to draft when a required check fails.
Scenario: Failed required check
- WHEN
watchreads a ready bot pull request whose required check failed. - THEN
watchsendsconvertPullRequestToDraftonce and records one draft cycle for the pull request.
Requirement: A pull request of a person stays ready
watch MUST NOT convert a pull request of a person to draft.
Scenario: Pull request of a person
- WHEN
watchreads a ready pull request of a person whose required check failed. - THEN
watchsends no draft request and records no draft cycle.
Requirement: A conflict or the fix-plan label drafts a bot pull request
watch MUST convert a ready bot pull request to draft when it has a merge conflict or the label verdict/fix-plan.
Scenario: Merge conflict
- WHEN
watchreads a ready bot pull request with a merge conflict. - THEN
watchsendsconvertPullRequestToDraftonce and records one draft cycle.
Requirement: The draft cycle cap
watch MUST send no draft request after watch.cycles cycles for one pull request and MUST write a stop whose failure class has the action person.
Scenario: Fourth cycle
- WHEN The record holds
watch.cyclesat 3 for the pull request and a required check fails again. - THEN
watchsends no draft request and writes the stop record with the class actionperson.
Requirement: A dry run sends no request
watch MUST send no request when --dry-run is set.
Scenario: Dry run on a bot pull request
- WHEN
watchruns with--dry-runon a bot pull request that a failed check would draft. - THEN The client records 0 requests and the result line names the planned draft action.
Requirement: The skip marker on a checkpoint commit
The implement job MUST put [skip ci] in the message of each checkpoint and tests commit that it pushes to a branch with an open pull request.
Scenario: Checkpoint push
- WHEN The implement job pushes a checkpoint commit to a branch that has an open pull request.
- THEN The message of the pushed commit holds
[skip ci], and the checked commit holds no marker.
Requirement: Watch judges only a checked head
watch MUST give no verdict and no draft request for a head whose tip commit holds [skip ci].
Scenario: Unchecked head
- WHEN
watchreads a pull request whose head tip commit holds[skip ci]. - THEN
watchwrites no verdict, no draft request and no ready request for that head.
Requirement: The GraphQL path skips a recorded ready mark
_find_plan_item MUST skip a plan pull request that the record stage.ready names.
Scenario: Recorded ready mark
- WHEN The record holds
stage.readyfor the plan pull request and watch reads the plan item through GraphQL. - THEN
watchsends no ready request for that pull request, as the REST collector_collect_rest_candidatesalready does.
Requirement: The ready route acts only on a draft
watch MUST send markPullRequestReadyForReview only for a pull request that is a draft and that draft_readiness answers ready for.
Scenario: Plan pull request that is already ready
- WHEN
watchreads a ready bot plan pull request whose checks pass. - THEN
watchsends no ready request for that head.
Requirement: A hold retries at the next sweep
watch MUST return the try-again result when a ready or draft write fails and MUST make no other write for that pull request in the round.
Scenario: GraphQL hold
- WHEN A ready or draft write returns an error that a retry can clear.
- THEN
watchexits 75, and the next round reads the pull request again with a REST ETag.
Requirement: The setting defaults
The settings MUST hold watch.cycles with the default 3 and roadmap.implement.effort with the default empty list.
Scenario: Defaults of the two keys
- WHEN The settings tests load the defaults of the two keys.
- THEN The loaded values are 3 and the empty list.
Requirement: The workflow document states the two rules
docs/ROADMAP_WORKFLOW.md MUST state the Staged rule and the draft route, and tests/invariants/test_roadmap_workflow_doc.py MUST check the two sections.
Scenario: Document invariant
- WHEN
uv run pytest tests/invariants/test_roadmap_workflow_doc.pyruns. - THEN The test passes.
Requirement: Pending a person after the merge
After the merge and the release, watch MUST run as the App on the open bot plan and delivery pull requests and on those closed in the last 14 days, and a person MUST comment the result lines on the issue.
Scenario: Live App proof
- WHEN The release is out and watch has run as the App on the open bot plan and delivery pull requests and on those closed in the last 14 days.
- THEN The comment gives one path for each item and shows 0 red CI runs on unchecked App heads.
Existing Tool Considered
cli/cli (https://github.com/cli/cli), verdict in-use from the alternatives check of 2026-11-23 in the issue body. The check found no open tool for the staged or draft policy, and the repository already uses this client for the ready and draft state writes. The proposal uses cli/cli for those writes and builds the policy parts in due_jobs and watch; the check gives what the tool covers and lacks. Build cost: 200,000 to 300,000 agent tokens and 0.5 to 1 day.
Key questions
- Which label marks a plan pull request that needs a fix?:
verdict/fix-plan. [sources: docs/ROADMAP_WORKFLOW.md] - Where does the Staged rule live, and which judge supplies the effort pass?:
due_jobsinsrc/devops_cli/roadmap/watch_row.pyholds the rule. It uses the implement judge's selection, including its effort pass fromroadmap.implement.effort, so an item that the judge leaves gets the ready step even when its Effort label is in the pass. The callersrc/devops_cli/roadmap/fix_checks_row.pykeeps its call. (best practice) [sources: src/devops_cli/roadmap/watch_row.py, src/devops_cli/roadmap/fix_checks_row.py, src/devops_cli/config/settings.py]- Chosen: The rule in
due_jobs. The watch lane computes its steps there, andfix_checks_rowcalls it. - Rejected: The rule in the implement selection. The implement selection runs after the watch step, so it cannot stop the ready mark that the same head gets.
- Rejected: The rule in
stage_ready. The stage row does not read the implement step of the item.
- Chosen: The rule in
- How does watch tell a bot pull request from a pull request of a person?: Watch compares the author login of the pull request with the login of the App. Only a pull request of that login takes the draft route. (best practice) [sources: docs/adr/0015-roadmap-jobs-act-as-a-github-app-on-the-personal-account.md, src/devops_cli/roadmap/watch_row.py]
- Chosen: The App login. The App authors each branch and pull request that the Service stages, and a person keeps a different login.
- Rejected: A label on the pull request. A label copies a fact that the author holds, and a person can remove it.
- Rejected: The branch name prefix. A person can push to a branch with the same prefix.
- Which verdicts send a bot pull request to draft in this change?: A merge conflict, a failed required check, and the label
verdict/fix-plan. Thereview.verdictverdict starts after E4 and is no part of this change. (best practice) [sources: docs/adr/0004-ci-is-the-authoritative-gate.md, docs/adr/0005-review-findings-come-from-tools-not-models.md, docs/ROADMAP_WORKFLOW.md]- Chosen: The three deterministic verdicts now. Each one is a fact that watch reads, and the round is idempotent.
- Rejected: The
review.verdictverdict now. E4 records that verdict, and the issue body starts it after E4. - Rejected: A model call on the pull request. A model verdict is a sample, and ADR 0005 keeps findings with tools and checked facts.
- Where does watch keep the count of draft cycles for each pull request?: The job record key
watch.cyclesholds the count for each pull request number. The settingwatch.cyclesgives the cap, and its default is 3. (best practice) [sources: docs/ROADMAP_WORKFLOW.md, docs/adr/0016-labels-hold-the-roadmap-items-fields.md, CONTEXT.md]- Chosen: The job record key
watch.cycles. The record holds the facts behind the labels, and each round reads it before it acts. - Rejected: A label on the pull request. It adds a label family, and a person can remove the label.
- Rejected: The due mark in Valkey. A due mark is never the only copy of a decision.
- Chosen: The job record key
- How does the
[skip ci]rule keep watch from judging an unchecked head?: The implement job puts[skip ci]in the message of each checkpoint and tests commit that it pushes to a branch with an open pull request. Watch reads the tip commit message and gives no verdict for a head that holds the marker. (best practice) [sources: CONTEXT.md, docs/ROADMAP_WORKFLOW.md, docs/adr/0004-ci-is-the-authoritative-gate.md]- Chosen: The marker on checkpoint commits. GitHub starts no workflow run for that head, so an unchecked head costs no CI run.
- Rejected: Cancel the run after the push. The run still starts, and a cancelled run reports a check status.
- Rejected: Draft the pull request at each checkpoint. It spends a draft cycle on work that needs no verdict.
- What does watch write when the draft cap is spent?: It writes a stop whose failure class has the action
person, in the stop record of the item. The item is Blocked until a person commentsimplement: retry. (best practice) [sources: CONTEXT.md, docs/ROADMAP_WORKFLOW.md]- Chosen: The stop record with a person class. The Service clears only a class whose action a retry can fix, so a person cause stays.
- Rejected: A comment alone. A comment changes no state, and the next sweep repeats the write.
- Rejected: A new label. It adds a label family for a state that the stop record already holds.
- Which call moves a pull request between ready and draft, and what does a hold do?: The row uses the GitHub CLI
gh pr readyand its undo form. These calls invoke the GraphQL mutationsmarkPullRequestReadyForReviewandconvertPullRequestToDraft. A hold returns the try-again result, and the next sweep reads the pull request again with a REST ETag. (best practice) [sources: src/devops_cli/roadmap/watch_row.py, CONTEXT.md]- Chosen: The GitHub CLI
gh pr readyand its undo form. The alternatives check records this client as in-use and says its errors let a retry inspect the hold. - Rejected: Direct GraphQL calls. The project already uses the CLI for the same state writes, so direct calls build what the tool covers.
- Rejected: A branch rename. It changes the branch and no pull request state.
- Chosen: The GitHub CLI
- Which commands prove the change offline?:
uv run pytest tests/roadmap/test_roadmap_run_job_rows.py tests/roadmap/stage/test_roadmap_stage_ready.pycovers the rows that calldue_jobsandstage_ready. The new tests oftests/roadmap/test_roadmap_watch_row.pycover the draft route, anduv run pytest tests/invariants/test_roadmap_workflow_doc.pycovers the document. [sources: tests/roadmap/test_roadmap_run_job_rows.py, tests/roadmap/stage/test_roadmap_stage_ready.py, tests/roadmap/test_roadmap_watch_row.py, tests/invariants/test_roadmap_workflow_doc.py]
Fit
Fits in one pull request.
Suspected block
The plan review step must run before the Staged rule goes live; devops roadmap eval grades showed 0 attempts in the last 7 days.
Activity
dan-petty commentedon Nov 13, 2026
Both address the problem of two paths acting on one plan PR head, but the candidate adds the draft route and the Staged rule as a system design while #4078 only stops implement from taking an unmerged stage plan PR.dan-petty commentedon Nov 16, 2026
Two facts about the READY route of the watch row, found in the build of #5027 (PR #6009):
due_stepsgivesreadyto each green bot pull request, a draft or not, and_apply_due_steps(src/devops_cli/roadmap/watch_row.py) callsmark_readyfor a plan pull request with no check of the draft flag or ofstage.ready. The GraphQL path finds the plan item bystage.pronly. So a green plan pull request that is ready already gets one REST read and onegh pr readyon each tick until it merges.implement.jobalone. The record keeps the name of an ended Job, so each delivery pull request was skipped, and the delivery READY route (an unconditionalmark_ready) never ran. feat(roadmap): The watch row starts fix-checks Jobs #6009 reads the live unit withjob_holds, and narrows the delivery READY route: the row runs the ready path of the stepfix-checks(draft_readiness, the mode) only on a draft that a fix Job repaired, once for each head. Every other delivery draft stays with its implement Job.The draft route of this item can take point 1: route
readyonly for a draft.dan-petty commentedon Nov 17, 2026
A live case of the D3 problem, from #6123 (fix in #6132):
stage.prand asimplement.pr: the implement job continued on the plan branch.stage.pronly (_find_plan_item,src/devops_cli/roadmap/watch_row.py), and does not skip a pull request whosestage.readyis recorded. The REST path does skip it (_collect_rest_candidates).gh pr ready 6041at 2026-11-17 04:04:10Z (Tempo tracef37612b9ebaa9e8f2439e686a6e9bc69), and again at 04:48:56Z (trace7c2ac6260fb20c6232818b974773ab9d) after an agent set the pull request back to draft at 04:44:25Z.#6132 makes
mark_readyaskdraft_readiness, so an incomplete delivery stays a draft. Two parts stay for this item: a complete delivery on the plan branch that a person sets back to draft is marked ready again by the GraphQL path, and the row still judges one pull request as the plan of the item.devops-cli-service commentedon Nov 17, 2026
Alternatives check: in-use
Reason: The searches found no open tool or library that implements the Staged rule or the draft route; only the write half is already covered, by the GitHub ready/draft transitions (
markPullRequestReadyForReview/convertPullRequestToDraft, which the GitHub CLI invokes asgh pr readyand its undo form, and which the watch row already runs). The deterministic verdict, the draft-cycle cap, the[skip ci]judgment, thedue_jobsrule and the zero-request dry run stay project code, and the Prow Tide pattern the issue cites only gates merges, so it does not cover this need either.The repository already uses this tool.
Tool: cli/cli (https://github.com/cli/cli)
Covers:
markPullRequestReadyForReview/convertPullRequestToDraftcalls).gh pr ready).Lacks:
due_jobs: one path per item fromroadmap.implement.effort, with no ready mark when implement continues on the plan branch.plan/needs-fix, failedreview.verdictafter E4) and the refusal to act on a pull request of a person.watch.cycles) and the person cause written after it.[skip ci]checkpoint rule and judging only checked heads.--dry-runwith 0 requests, the docs update and the live App proof.Tools considered:
Searches run:
Sources:
Checked on 2026-11-17. A person decides what this means for the item. The check changes no label and closes no issue.
devops-cli-service commentedon Nov 18, 2026
Refine cannot set this item to Ready at fd00bf1 while the items below stay open. The next refine round looks at the item again when they close, or when a person replies in a comment or edits the body.
dan-petty commentedon Nov 26, 2026
Evidence for the Staged rule (D3): the two rows acted on one green plan draft within one second.
Timeline of #4745 and its plan pull request #7255 on 2026-11-25 (GitHub timeline events):
owner/serviceon feat(docs): build the docs site theme from the design tokens #4745 and created the runner Job.stage_ready) marked docs(spec): plan #4745 Map the docs site theme to the design tokens #7255 ready for review.ci_infrastop, set the item Blocked, then cleared the stop with continuation 1 of 4.The same order of events is on #4439 (2026-11-24T01:55Z, plan #6946), #4562 (03:07Z, #6955) and #4649 (14:30Z, #6995): 4 Jobs in 2 days. Each row reads the item, sees a green draft with no Job, and acts.
_recorded_pullofstage_ready.pyleaves an item that holds a Job, and_pull_reasonofimplement.pyleaves an item whose plan is ready, but each check reads state that the other row writes in the same second. A second read narrows the window and does not close it.Two points for the design of this item:
roadmap.implement.effortand the implement judge still leaves the item (a stop, an open dependency, an item that refine did not approve, a claim), the watch row would not mark the draft ready and no Job would start. The rule must be the answer of the one judge that the implement row uses, with its effort pass, which is whatdue_jobs(feat(roadmap): one due_jobs function names the due jobs of an item #5504) is for.devops roadmap eval grades), so such a plan gets no review before the build. The review step for plans must run before this rule goes live.I built no partial rule: this item needs #5504 first, and a second fix on the two reads would only narrow the window.
devops-cli-service commentedon Nov 27, 2026
Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.