Skip to content

feat(roadmap): the draft route and one Staged rule for watch #5505

Open

Description

@dan-petty

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_jobs holds 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 failed review.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 convertPullRequestToDraft and markPullRequestReadyForReview. 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_jobs never 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-run sends 0 requests.
  • docs/ROADMAP_WORKFLOW.md states 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_jobs returns 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_jobs returns 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 watch reads a ready bot pull request whose required check failed.
  • THEN watch sends convertPullRequestToDraft once 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 watch reads a ready pull request of a person whose required check failed.
  • THEN watch sends 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 watch reads a ready bot pull request with a merge conflict.
  • THEN watch sends convertPullRequestToDraft once 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.cycles at 3 for the pull request and a required check fails again.
  • THEN watch sends no draft request and writes the stop record with the class action person.

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 watch runs with --dry-run on 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 watch reads a pull request whose head tip commit holds [skip ci].
  • THEN watch writes 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.ready for the plan pull request and watch reads the plan item through GraphQL.
  • THEN watch sends no ready request for that pull request, as the REST collector _collect_rest_candidates already 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 watch reads a ready bot plan pull request whose checks pass.
  • THEN watch sends 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 watch exits 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.py runs.
  • 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_jobs in src/devops_cli/roadmap/watch_row.py holds the rule. It uses the implement judge's selection, including its effort pass from roadmap.implement.effort, so an item that the judge leaves gets the ready step even when its Effort label is in the pass. The caller src/devops_cli/roadmap/fix_checks_row.py keeps 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, and fix_checks_row calls 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.
  • 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. The review.verdict verdict 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.verdict verdict 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.cycles holds the count for each pull request number. The setting watch.cycles gives 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.
  • 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 comments implement: 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 ready and its undo form. These calls invoke the GraphQL mutations markPullRequestReadyForReview and convertPullRequestToDraft. 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 ready and 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.
  • Which commands prove the change offline?: uv run pytest tests/roadmap/test_roadmap_run_job_rows.py tests/roadmap/stage/test_roadmap_stage_ready.py covers the rows that call due_jobs and stage_ready. The new tests of tests/roadmap/test_roadmap_watch_row.py cover the draft route, and uv run pytest tests/invariants/test_roadmap_workflow_doc.py covers 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.

Dependencies

#5024, #5020, #5504

Activity

  1. added
    source/agent
    on Nov 13, 2026
  2. added
    type/feature
    scope/roadmap
    status/new
    value/high
    effort/high
    on Nov 13, 2026
  3. dan-petty commented on Nov 13, 2026

    @dan-petty
    OwnerAuthor
  4. added
    priority/p2-medium
    on Nov 13, 2026
  5. dan-petty commented on Nov 16, 2026

    @dan-petty
    OwnerAuthor

    Two facts about the READY route of the watch row, found in the build of #5027 (PR #6009):

    1. due_steps gives ready to each green bot pull request, a draft or not, and _apply_due_steps (src/devops_cli/roadmap/watch_row.py) calls mark_ready for a plan pull request with no check of the draft flag or of stage.ready. The GraphQL path finds the plan item by stage.pr only. So a green plan pull request that is ready already gets one REST read and one gh pr ready on each tick until it merges.
    2. Fixed in feat(roadmap): The watch row starts fix-checks Jobs #6009: the row read a live unit from implement.job alone. The record keeps the name of an ended Job, so each delivery pull request was skipped, and the delivery READY route (an unconditional mark_ready) never ran. feat(roadmap): The watch row starts fix-checks Jobs #6009 reads the live unit with job_holds, and narrows the delivery READY route: the row runs the ready path of the step fix-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 ready only for a draft.

  6. dan-petty commented on Nov 17, 2026

    @dan-petty
    OwnerAuthor

    A live case of the D3 problem, from #6123 (fix in #6132):

    • The record of feat(roadmap): onboard checks and starts the rag ingestion #3771 holds 6041 as stage.pr and as implement.pr: the implement job continued on the plan branch.
    • The GraphQL path of the watch row finds the plan item through stage.pr only (_find_plan_item, src/devops_cli/roadmap/watch_row.py), and does not skip a pull request whose stage.ready is recorded. The REST path does skip it (_collect_rest_candidates).
    • So the watch lane ran gh pr ready 6041 at 2026-11-17 04:04:10Z (Tempo trace f37612b9ebaa9e8f2439e686a6e9bc69), and again at 04:48:56Z (trace 7c2ac6260fb20c6232818b974773ab9d) after an agent set the pull request back to draft at 04:44:25Z.

    #6132 makes mark_ready ask draft_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.

  7. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    Contributor

    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 as gh pr ready and its undo form, and which the watch row already runs). The deterministic verdict, the draft-cycle cap, the [skip ci] judgment, the due_jobs rule 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)

    • License: MIT
    • Last activity: 2026-11-17
    • Maintained: yes

    Covers:

    • Performs the two pull-request state writes the issue needs: mark a pull request ready for review, and convert a pull request back to draft (the markPullRequestReadyForReview / convertPullRequestToDraft calls).
    • Is the client the watch row already uses for those calls (gh pr ready).

    Lacks:

    • The Staged rule in due_jobs: one path per item from roadmap.implement.effort, with no ready mark when implement continues on the plan branch.
    • The deterministic draft verdict (conflict, failed required check, plan/needs-fix, failed review.verdict after E4) and the refusal to act on a pull request of a person.
    • The cap of 3 draft cycles per pull request (watch.cycles) and the person cause written after it.
    • The [skip ci] checkpoint rule and judging only checked heads.
    • --dry-run with 0 requests, the docs update and the live App proof.

    Tools considered:

    Searches run:

    • GitHub Action convert pull request to draft when required check fails, results: 5
    • Prow Tide merge automation one verdict reason GitHub bot, results: 5
    • open source bot mark pull request ready for review and draft on failed checks, results: 5
    • kubernetes-sigs/prow Tide component, results: 5
    • kodiak github bot auto merge, results: 5
    • kubernetes test-infra prow tide github pull request merge automation, results: 5
    • cli cli manual gh pr ready, results: 5
    • gh pr ready --undo convert pull request to draft manual, results: 5

    Sources:

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

  8. devops-cli-service commented on Nov 18, 2026

    @devops-cli-service
    Contributor

    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.

  9. dan-petty commented on Nov 26, 2026

    @dan-petty
    OwnerAuthor

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

    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_pull of stage_ready.py leaves an item that holds a Job, and _pull_reason of implement.py leaves 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:

    1. A rule that reads only the effort label can leave a draft with no owner. When the effort is in roadmap.implement.effort and 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 what due_jobs (feat(roadmap): one due_jobs function names the due jobs of an item #5504) is for.
    2. With the live setting, low and medium effort items then never get a ready plan pull request. The review step made 0 attempts in the last 7 days (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.

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

    @devops-cli-service
    Contributor

    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.

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/highpriority/p2-mediumscope/roadmapsource/agentstatus/newtype/featurevalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions