Skip to content

feat(roadmap): an implement job delivers each staged low-effort P0 and P1 bug one task group at a time and marks its pull request ready when the checks pass #2661

Closed
3 of 3 issues completed

Description

@dan-petty

Problem or Motivation

A Staged item still waits for an agent session to write its code. A session loads the whole repository into its context and works until it is done, so a local model's window overflows, and the result depends on the agent's habits. The owner asked on 2026-10-29 that the Service implement issues and stage pull requests from a label filter, by default the low-effort Ready P0 and P1 bugs, in discrete steps that each work in a 128k context window.

Proposed Solution & Architectural Design

A new roadmap job, implement, takes each Staged item that the filter names and runs the groups of its tasks.md in order. Each group is one step: one fresh agent run whose inputs fit the step budget, built on the Coder capability of pydantic-ai-harness over the devops-coder route, which serves qwen3-coder on a 128000-token tier. The step ends when the group's verification command passes and its tasks are ticked, and the job commits. After the last group the job regenerates the documentation, archives the change, pushes, rewrites the pull request body to close the issue, watches the checks, fixes a failed check at most once, and marks the pull request ready when the checks pass. A person merges, as always. A step that fails stops the item with a comment, and a person decides.

The work is three items, each one pull request:

  • The step: devops roadmap implement --item N --group n runs one group on a checkout, with the engine, the task model and the budget.
  • The job: devops roadmap implement over the filter, the group loop, the archive, the pull request writes, the one check fix and the records.
  • The runner: a runner image with uv, the dev dependencies and the pinned tools, a cluster Job template, the Service's submission of one Job at a time, and the RBAC and network policy it needs.

This issue is delivered by its sub-issues.

Target Subsystem

SDLC, Git & PR Governance; AI & Agentic Review Pipeline.

Existing Tool Considered

  • pydantic-ai-harness (MIT, by the pydantic-ai maintainers; 0.63.0 released on 2026-10-28; Python 3.11 or later): the Coder capability gives the file, grep and shell tools, the context controls ClearToolResults and ToolOutputLimits, and a delegate_task sub-run, on a LocalWorkspace. pydantic-ai is the one agent runtime (refactor(ai): Replace PydanticAgent with pydantic-ai Agent #2489). The project builds no agent loop.
  • Claude Agent SDK and claude -p are rejected. It is a second agent runtime, it needs Node and an Anthropic key, and it cannot run the gateway's local models with native tools.
  • GitHub Copilot coding agent is rejected. chore(github): Turn off AI Scan for pull requests to save allowance #1496 keeps the Copilot allowance, it runs no OpenSpec step and no local model.
  • OpenHands, SWE-agent and Aider are rejected. Each is its own runtime with its own container needs, outside pydantic-ai.
  • GitHub Actions on GitHub-hosted runners as the execution environment is rejected. The gateway is reachable from outside only through the Cloudflare tunnel, which cuts a call at 125 s and needs an Access service token that only a person can make.

Related

Depends on: #2653.

Proposed design

Problem statement

A Staged item needs its code written. A full agent session loads the whole repository into context and overflows a local model's window. The implement job runs each task group as a discrete step that fits a 128k budget. After the last group, the job archives the change, pushes, rewrites the pull request body, watches the checks, fixes one failure, and marks the pull request ready. A person merges.

Acceptance criteria

Requirement: Step runs one group in bounded context

The step command SHALL run exactly one task group of a staged change in a bounded context window and commit the result.

Scenario: step runs a group on a clean checkout

  • WHEN devops roadmap implement --item N --group n is invoked on a clean checkout and the inputs fit the task's token window
  • THEN the agent runs, the group's verification command passes, all tasks in the group are ticked, and the checkout is committed with the group title and item number

Requirement: Job filters Staged items

The implement job SHALL process only Staged items that match the label filter for low-effort Ready P0 and P1 bugs.

Scenario: filter excludes a non-matching item

  • WHEN the implement job runs and a Staged item carries a P2 priority label
  • THEN the job skips that item and runs no group of it

Requirement: Job runs groups in order

The implement job SHALL run the task groups of a staged change in their listed order, one step at a time, committing after each group.

Scenario: three groups run sequentially

  • WHEN a staged change has three task groups and the job starts
  • THEN the job runs group 1, commits, runs group 2, commits, runs group 3, and commits

Requirement: Job completes the pull request lifecycle

After the last group, the job SHALL regenerate documentation, archive the change, push, rewrite the pull request body to close the issue, and mark the pull request ready when all required checks pass.

Scenario: pull request marked ready after checks pass

  • WHEN all required checks on the pull request report a passing status after the push
  • THEN the job marks the pull request as ready for review

Requirement: Failed step stops the item

When a step fails and the one retry also fails, the job SHALL stop the item and write a comment on the issue describing the failure.

Scenario: step failure stops the item

  • WHEN a step's verification command fails and the single retry also fails
  • THEN the job writes a comment on the issue with the failure reason and does not proceed to the next group

Requirement: One check fix attempt

The job SHALL attempt to fix a failed required check at most once before stopping the item.

Scenario: one fix attempt then stop

  • WHEN a required check fails after the push and the single fix step does not resolve it
  • THEN the job stops the item with a comment and does not attempt a second fix

Existing Tool Considered

pydantic-ai-harness (MIT, 0.63.0, Python 3.11+) provides the Coder capability with file, grep, and shell tools, the context controls ClearToolResults and ToolOutputLimits, and a delegate_task sub-run on a LocalWorkspace. It lacks the step-level orchestration: the group loop, the verification-and-commit cycle, the pull request lifecycle (archive, push, body rewrite, check watch, one fix, mark ready), and the runner image with RBAC and network policy. The project builds that orchestration on top of the harness.

Key questions

  • Which agent runtime does the step use?: pydantic-ai with the Coder capability of pydantic-ai-harness. The project builds no agent loop of its own. (best practice) [sources: docs/adr/0005-review-findings-come-from-tools-not-models.md, src/devops_cli/ai/knowledge_base/devops_cli/libraries/pydantic_ai_harness.md, openspec/changes/archive/2026-10-29-2664-roadmap-implement-step/proposal.md]
    • Chosen: pydantic-ai-harness Coder. The project's one agent runtime. Provides file, grep, and shell tools, context controls, and a LocalWorkspace. The step tunes Coder with an allowlist shell and a real context window.
    • Rejected: Claude Agent SDK. A second agent runtime. Needs Node and an Anthropic key. Cannot run the gateway's local models with native tools.
    • Rejected: GitHub Copilot coding agent. Runs no OpenSpec step and no local model. The Copilot allowance is kept for review only.
    • Rejected: OpenHands, SWE-agent, or Aider. Each is its own runtime with its own container needs, outside pydantic-ai.
  • What is the execution environment for the implement job?: A cluster Job template that exists today. The Service submits one Job at a time. The job moves to Argo Workflows when the go is recorded on feat(k8s): the argo workflows controller runs in its own namespace under argo cd and deploy-stack, and a --version workflow measures start-up and api-server load for the go/no-go on moving the roadmap jobs onto it #1535. (proposed)
    • Chosen: Cluster Job template. The existing executor for sandboxed work. The Service already submits Jobs. The gateway is reachable from inside the cluster without the Cloudflare tunnel cut.
    • Rejected: GitHub Actions on hosted runners. The gateway is reachable from outside only through the Cloudflare tunnel, which cuts a call at 125 s and needs an Access service token that only a person can make.
  • What is the step's token budget?: 128000 tokens, the tier of qwen3-coder served on the devops-coder route. [sources: README.md]
  • Does the step command already exist in the codebase?: Yes. The step is implemented at src/devops_cli/roadmap/implement_step.py and documented in README.md. The change is archived as 2026-10-29-2664-roadmap-implement-step. [sources: src/devops_cli/roadmap/implement_step.py, README.md, openspec/changes/archive/2026-10-29-2664-roadmap-implement-step/proposal.md]
  • How does the job process multiple Staged items?: One Job at a time, sequentially. The Service submits one cluster Job per item and waits for it to finish before submitting the next. (best practice) [sources: CONTEXT.md]
    • Chosen: Sequential, one Job at a time. The Service's lane runs one round at a time. Sequential processing avoids concurrent writes to the same repository and keeps the model lane's budget predictable.
    • Rejected: Parallel Jobs. Concurrent writes to the same repository risk conflicts. The model lane is designed for one round at a time.
  • Who merges the pull request?: A person merges, as always. The job marks the pull request ready but does not merge it. [sources: docs/adr/0004-ci-is-the-authoritative-gate.md]

Open questions

  • What issue must be delivered before this one? (missing verified source)

Fit

Needs splitting into 3 items:

  1. The step: devops roadmap implement --item N --group n runs one group on a checkout, with the engine, the task model and the budget.
  2. The job: devops roadmap implement over the filter, the group loop, the archive, the pull request writes, the one check fix and the records.
  3. The runner: a runner image with uv, the dev dependencies and the pinned tools, a cluster Job template, the Service's submission of one Job at a time, and the RBAC and network policy it needs.

Suspected block

None.

Dependencies

#2653

Sub-issues

Sub-issues

3 of 3 Issues completed
Loading 3 sub-issues

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. A new implement command and job that did not exist before.
    • Priority: P1-High. The owner asked for this on 2026-10-29 and it is the delivery step for staged P0 and P1 bugs.
    • Value: High. Without this job, staged items remain undelivered and no code reaches a pull request.
    • Effort: High. Three sub-issues cover the step command, the job loop, and the runner image with RBAC and network policy.
    • Related: feat(roadmap): devops roadmap stage writes the change of a Ready item in context-sized task groups and opens its draft pull request #2654, which asks for a different change. Both are siblings under parent #2653. #2654 writes task groups and opens a draft pull request. The candidate runs those groups to deliver code and mark the pull request ready.
  3. added
    priority/p1-high
    on Oct 29, 2026
  4. devops-cli-service commented on Oct 29, 2026

    @devops-cli-service
    Contributor

    Refine cannot set this item to Ready at 19a2e08 until a person answers the questions below. Reply in a comment or edit the body, and the next refine round looks at the item again.

    • What issue must be delivered before this one? (missing verified source)
  5. dan-petty commented on Oct 29, 2026

    @dan-petty
    OwnerAuthor

    Done. All three sub-issues are merged: #2664 (the one-group step engine, PR 2684), #2665 (the job loop, PR 2692) and #2667 (the runner image, the cluster Job and the Service submission, PR 2698).

    Two limits stay open as their own items: the real sandbox for the agent shell (#2695) and the admission policy for the Jobs of the Service (#2696).

  6. 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/p1-highsource/agenttype/featurevalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions