Skip to content

refactor(roadmap): the stage agent is stock Coder #6705

Closed
1 of 3 issues completed
Closed

Description

@dan-petty

Problem

The stage agent is a custom engine: its own tools and toolbox (stage_tools.py, stage_toolbox.py), gate returns, a gate extension and a schema retry. The owner decided that stage runs on stock Coder with upstream RequireVerification (#6528 comment 7053539044).

Change

  • The stage agent is stock Coder with LocalWorkspace and RequireVerification with the checks devops openspec check, openspec validate and devops roadmap plan-recheck --source . --branch HEAD. The checks cover the Markdown plan files (exempt_paths=()).
  • The agent has a real shell. The agent phase holds no GitHub credential.
  • The proposal comes from the change folder that the agent wrote. The agent writes the PR body candidate in the same run.
  • A run that ends unverified records plan_defect, and publish stops the item on that value.
  • Delete the custom tools, the toolbox, the gate returns, the gate extension and the schema retry.
  • devops roadmap stage takes --phase prepare|agent|publish|all and --work, and all stays the default, so the CronJob does not change until feat(roadmap): add the three-container runner Job, policy and log reads #3700.

Acceptance criteria

  • A test of the stage agent finds Coder with the stock capabilities, RequireVerification with the three checks, and no custom tool.
  • The custom engine code and its tests are gone.

Related

Source

Source: #6528

Alternatives check of 2026-11-22: not-applicable.
Class: refactor, no search.
Tool: none found.

Proposed design

Problem statement

The stage planner is a custom engine. It has its own tools, toolbox, gate returns, gate extension and schema retry. It duplicates the coding-agent capability of the pydantic-ai harness. The change replaces it with the stock Coder agent, LocalWorkspace and RequireVerification, and it deletes the custom engine.

Acceptance criteria

Requirement: Stock Coder stage agent

The stage agent MUST use the stock Coder capability with LocalWorkspace and MUST add no custom tool.

Scenario: Stage agent capability list

  • WHEN A test builds the stage agent with a checkout and a stub model.
  • THEN The capabilities of the agent hold Coder and LocalWorkspace, and no capability comes from the removed stage toolbox.

Requirement: Verification of the plan files

The stage agent MUST use RequireVerification with the checks devops openspec check, openspec validate and devops roadmap plan-recheck --source . --branch HEAD, and MUST exempt no path.

Scenario: Verification check list

  • WHEN A test builds the stage agent.
  • THEN The RequireVerification capability holds these three checks in this order, and its exempt_paths is empty.

Requirement: Unverified run records plan_defect

A stage agent run that ends without a passing verification MUST record the failure class plan_defect on the item.

Scenario: Agent run that fails verification

  • WHEN A test runs the agent phase with a stub Coder that ends unverified.
  • THEN The job record of the item holds plan_defect.

Requirement: Publish stops on plan_defect

The publish phase MUST stop the item when the job record holds plan_defect.

Scenario: Publish after an unverified run

  • WHEN A test runs devops roadmap stage --phase publish on an item whose record holds plan_defect.
  • THEN The command exits 1 and pushes no branch.

Requirement: Proposal from the written change folder

The stage job MUST read the proposal from the change folder that the agent wrote and MUST take the pull request body from the candidate of the same run.

Scenario: Plan written by the agent

  • WHEN A test runs the agent phase on a stub checkout that writes openspec/changes/6705-stage-agent/proposal.md and a body candidate.
  • THEN The publish phase reads the proposal of that folder and the pull request body from the candidate of the run.

Requirement: Custom engine removed

The change MUST delete the custom stage tools, toolbox, gate returns, gate extension and schema retry.

Scenario: Removed modules and settings

  • WHEN A test imports the stage package and loads the settings.
  • THEN devops_cli.roadmap.stage.stage_tools and devops_cli.roadmap.stage.stage_toolbox do not import, and roadmap.stage holds no gate_returns, gate_return_extensions or verify_repair_rounds key.

Requirement: Default phase stays all

devops roadmap stage MUST keep all as its default phase, so CronJob roadmap-stage runs the whole stage with no change until #3700.

Scenario: Stage command with no phase

  • WHEN A test calls devops roadmap stage --job-item 6705 --confirm with no --phase and a stub for each phase.
  • THEN The command runs prepare, then agent, then publish.

Requirement: No GitHub credential in the agent phase

The agent phase MUST run with no GitHub credential.

Scenario: Agent phase environment

  • WHEN A test builds the agent phase with a job environment that holds GITHUB_TOKEN.
  • THEN The environment of the agent phase holds no GITHUB_TOKEN and no GH_TOKEN value.

Existing Tool Considered

The pydantic-ai harness covers the need. Its Coder, LocalWorkspace and RequireVerification capabilities replace the custom stage engine, and src/devops_cli/roadmap/implement/implement_step.py already uses Coder and LocalWorkspace. The alternatives check of 2026-11-22 in the issue body records not-applicable for this refactor and names no tool, so it names no cover and no lack. The harness holds no project check: the change gives RequireVerification the three commands, and it keeps no custom tool.

Key questions

  • Which tool supplies the stage agent and its verification?: The pydantic-ai harness supplies Coder with LocalWorkspace, and RequireVerification supplies the checks. The implement step already uses Coder and LocalWorkspace, so the stage agent uses the same code path. (best practice) [sources: src/devops_cli/roadmap/implement/implement_step.py, src/devops_cli/ai/knowledge_base/devops_cli/libraries/pydantic_ai_harness.md:35, docs/ROADMAP_WORKFLOW.md:453]
    • Chosen: Stock Coder from the pydantic-ai harness. The owner decided it, and the implement step already uses it.
    • Rejected: Keep the custom stage engine. It duplicates the harness and adds tools, gate returns and a schema retry to keep.
    • Rejected: Write a new stage engine. It repeats the cost that this refactor removes.
  • Which commands does RequireVerification run, and which paths does it exempt?: The body gives the three checks from the owner decision in refactor(roadmap): run stage on Coder in the runner image #6528: devops openspec check, openspec validate and devops roadmap plan-recheck --source . --branch HEAD. exempt_paths=() covers the Markdown plan files. The image holds the pinned OpenSpec and a Node runtime, so openspec validate runs in the job. (best practice) [sources: docs/CLUSTER.md:52, docs/ROADMAP_WORKFLOW.md:453]
    • Chosen: Three checks with exempt_paths=(). The checks cover the Markdown plan files, so a plan defect fails the run.
    • Rejected: One combined check. It hides which check failed, so the agent repairs less.
    • Rejected: Exempt the change folder. The plan files escape the checks, so an unverified plan can pass.
  • How does the job record an unverified run, and what stops the item?: The job records the class plan_defect on the item. The publish phase stops the item on that value, with exit 1. The stage row waits an hour for a plan_defect item and counts the run toward roadmap.stage.plan_defect_limit. [sources: src/devops_cli/config/settings.py:1391, src/devops_cli/roadmap/stage/stage_job.py, docs/CLUSTER.md:100, CONTEXT.md]
  • Which code holds the custom engine that the change deletes?: The issue names stage_tools.py and stage_toolbox.py. The gate returns, the gate extension and the schema retry live in the stage job. The settings roadmap.stage.gate_returns, gate_return_extensions, verify_repair_rounds and verify_repair_rounds_ceiling go with them, and so does the seed file src/devops_cli/roadmap/stage/stage_finding_classes.json. [sources: src/devops_cli/roadmap/stage/stage_job.py, src/devops_cli/roadmap/stage/stage.py, src/devops_cli/config/settings.py:1391, docs/CLUSTER.md:52, docs/ENV_VARS.md:276]
  • Does the agent phase get a GitHub credential?: No. The agent phase holds no GitHub credential. The prepare phase reads the item and the publish phase pushes with the Service token. The prompt gives the agent the issue text that prepare read. (best practice) [sources: docs/CLUSTER.md:52, docs/ROADMAP_WORKFLOW.md:453]
    • Chosen: No credential in the agent phase. The agent runs no GitHub request, so no token sits in a shell that the agent controls.
    • Rejected: A read-only token. It adds a credential to a shell that the agent controls.
    • Rejected: The Service token. It gives the agent write access that the stage job does not need.
  • Which item delivers the phase split, and does it come before this one?: The split item for the phases comes first. It delivers --phase prepare|agent|publish|all and --work. The body gives no number, so refine must add that number to dependencies. This issue keeps all as the default phase, so CronJob roadmap-stage does not change until feat(roadmap): add the three-container runner Job, policy and log reads #3700. [sources: docs/CLUSTER.md:52, docs/CLUSTER.md:100]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Sub-issues

Sub-issues

1 of 3 Issues completed
Loading 3 sub-issues

Activity

  1. added
    type/refactor
    source/agent
    scope/roadmap
    status/new
    value/medium
    effort/medium
    on Nov 21, 2026
  2. dan-petty commented on Nov 21, 2026

    @dan-petty
    OwnerAuthor
  3. added
    priority/p2-medium
    owner/agent
    on Nov 21, 2026
  4. added
    status/ready
    and removed
    status/new
    on Nov 22, 2026
  5. devops-cli-service commented on Nov 22, 2026

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See the section Proposed design of the body.

  6. 19 remaining items

  7. added
    status/in-review
    and removed
    status/in-progress
    on Nov 23, 2026
  8. removed
    status/in-review
    owner/agent
    on Nov 23, 2026
  9. devops-cli-service commented on Nov 23, 2026

    @devops-cli-service
    Contributor
  10. devops-cli-service commented on Nov 23, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-23 17:12 UTC

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/mediumpriority/p2-mediumscope/roadmapsource/agenttype/refactorvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions