Skip to content

feat(roadmap): devops roadmap stage writes the change of a Ready item in context-sized task groups and opens its draft pull request #2654

Description

@dan-petty

Problem or Motivation

Parent: #2653. No command makes a Ready item Staged. An agent does each step by hand, and nothing sizes the task groups of a change to a context budget.

Proposed Solution & Architectural Design

devops roadmap stage [--repo] [--item N] [--filter family=value]... [--limit N] [--step-tokens N] [--dry-run | --plan | --confirm].

Selection:

  • --filter is repeatable, family=value over the label families status, priority, type, value and effort. Values of one family are OR, and families are AND. The default is status=ready priority=p0-critical priority=p1-high type=bug.
  • Left out: an item with needs-split, a Blocked or started item, an item whose author is not trusted (CONST_ROADMAP_TRUSTED_AUTHORS, because the model reads the body), an item whose "Dependencies" names an open issue, and a held item: a pushed branch of the form <type>/<issue>-<slug> exists, a worktree of the clone holds one, or an open pull request names the issue (the rule of worktree_add.py).
  • --limit (default 3) caps a run. --item stages the one item it names when it is open and Ready.

Per item, in the job's clone (the model lane's model-clone), on a worktree of that clone so that its HEAD stays on the default branch:

  1. Fetch, and make the branch <type>/<issue>-<slug> at origin/<default>: type from the Conventional Commit type of the title, slug from the title (branch_form.py).
  2. One chat_structured call with ai.for_task("analysis") and the prompt roadmap_stage_change.md. Inputs: the title, the refined body (problem statement, acceptance criteria, key questions, and the alternatives block when present), the output of openspec list --specs, the repository map and the files the body cites, within the task's context window. Reply: the proposal (Why, What Changes, Feasibility, Existing Tool Considered, with skip_specs when the change is not observable), the spec deltas (reuse a capability, a Purpose on a new one), the design (decisions and rejected alternatives), and tasks.md as groups. A group holds its failing test, its implementation, its documentation regeneration and one verification command, and names the files it reads and changes. The reply also gives a pull request title whose summary is at most 60 characters.
  3. The job measures each group with tiktoken: the group's named files, packed with ai/context_packer.py, plus the change folder and the item. A group over --step-tokens (default roadmap.stage.step_tokens, 40000) goes back to the model once with the measure and the ask to split it. A group still over budget stops the item: a comment names the group and its measure, the record keeps stage.needs_split, and a person decides. The budget is the inputs of one implementation step. The rest of the 128k window is for tool output and the model's turns.
  4. openspec validate <change> --strict when the openspec binary is on PATH. A failed validation goes back to the model once, and a second failure stops the item. Without the binary the job says so in the pull request comment, and the OpenSpec gate of CI judges it.
  5. Commit as the App, push with -u origin, and open the draft with devops pr create --title <title> --body <body>. The body is the permanent what and why of the proposal, and it starts with Plans #<issue>. It holds no closing keyword: whoever lands the code rewrites it to Closes #<issue>.
  6. One comment on the issue with the marker devops roadmap stage: the branch, the pull request, the groups with their measures, and the budget. The job record keeps stage.branch, stage.pr, stage.sha and stage.groups. The Status label is unchanged.

Reconcile, each run: a staged branch whose item is closed, and whose commits past origin/<default> are all the App's, loses its draft pull request and its branch, so no remote branch stays without an open pull request (docs/ROUTINE_TASKS.md).

Errors: a model call that fails skips its item, and the run fails after the others, naming each. Rejected credentials stop the run. A push that GitHub refuses stops the item with the reason. --dry-run makes no request. A text that looks like a secret in a body is refused, as intake does.

Target Subsystem

src/devops_cli/roadmap/ (new stage.py), src/devops_cli/commands/roadmap.py, src/devops_cli/ai/tasks/roadmap_stage_change.md, src/devops_cli/git/, CONTEXT.md (the terms "Staged" and "Step"), README.

Existing Tool Considered

OpenSpec for the change and its validation, worktree_add.py and branch_form.py for the branch, devops pr create for the draft, tiktoken for the measure, and ai/context_packer.py for the packing. The job builds the selection, one structured call, the measure loop and the writes, in refine's shape. Estimated cost: about 1,400 lines of code and tests, around 400k tokens of agent work and two days of elapsed time, plus upkeep when OpenSpec's schema changes.

Key questions

  • Why a draft pull request for a plan with no code? Every remote branch needs an open pull request (docs/ROUTINE_TASKS.md), and a plan-only draft with Plans #N and no closing keyword is the agreed form. devops pr check-readiness blocks it until the archive is added, and the job never marks it ready.
  • Why does Status stay Ready? Started means in progress, in review or done. A staged item has no code yet. The draft pull request is the visible link.
  • What is the budget measured against? The inputs of one implementation step: the step's instructions, the item, the change folder and the group's packed files. 40000 tokens leaves most of a 128k window for tool output and turns. The setting is tunable.

Acceptance criteria

  • With GitHub, git and the model faked at their edges, a run on a Ready P1 bug makes the branch, writes a valid change with groups under budget, pushes one commit by the App, opens a draft whose body starts with Plans #N, comments once and records the keys.
  • An item that is held, Blocked, started, needs-split, untrusted, or with an open dependency is left out, and the plan says why.
  • A group over budget after one split stops the item with a comment and stage.needs_split.
  • The staged branch and draft of a closed item are removed when every commit past the default branch is the App's, and kept when any other commit exists.
  • --dry-run makes no request and lists the requests a run makes.
  • uv run devops ci passes, and devops docs generate --sync-readme is run.

Source: #2653

Activity

  1. added
    source/agent
    type/feature
    status/new
    value/high
    effort/high
    on Oct 29, 2026
  2. dan-petty commented on Oct 29, 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/feature. The title uses the 'feat' prefix and the body defines a new command with selection, AI calls, validation, and PR creation.
    • Priority: P2-Medium. It automates a manual multi-step process but does not block a release or fix a defect.
    • Value: High. It replaces a hand-run agent sequence with one command that sizes work to a context budget and opens a draft PR.
    • Effort: High. It spans branch creation, structured AI calls, tiktoken measurement, openspec validation, PR creation, and reconciliation logic.
    • Related: feat(ai): item refinement to ready with proposed decisions (devops roadmap refine) #744, which asks for a different change. Both are roadmap pipeline steps; #744 produces Ready items via 'refine', while this candidate consumes Ready items via 'stage'.
  3. added
    priority/p2-medium
    on Oct 29, 2026
  4. added a commit that references this issue on Oct 29, 2026
  5. removed
    status/new
    on Oct 30, 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/highpriority/p2-mediumsource/agenttype/featurevalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions