Skip to content

refactor(roadmap): delete the old stage engine after the split #6846

Open

Description

@dan-petty

Problem

#6705 adds the stock Coder agent for the separate phases of stage. Until #6814 is live, CronJob roadmap-stage runs --phase all in one container that holds the App key, so production keeps the old stage engine. After that, the old engine has no use in a stage Job, but other code still uses it:

  • the custom tools, the toolbox, the gate returns, the gate extension and the schema retry (stage_tools.py, stage_toolbox.py);
  • the fix-plan row (run.py) and devops roadmap step fix-plan;
  • the golden-set evals (stage_eval_run.py);
  • the round mode of stage, and --phase all with --job-item.

Change

  • Delete the old stage engine and its tests.
  • Move fix-plan and the golden-set evals to the Coder agent of refactor(roadmap): the stage agent is stock Coder #6705, or delete them where the new design makes them unnecessary.
  • Refuse --phase all with --job-item, so that a stage Job always runs the separate phases.

Acceptance criteria

  • A test of the stage agent finds Coder with the stock capabilities, RequireVerification and no custom tool. This is the second criterion of refactor(roadmap): the stage agent is stock Coder #6705.
  • The custom engine code and its tests are gone.
  • One live stage Job, one fix-plan run and one eval run pass after the deletion.

Dependencies

Source

Source: #6705

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

Proposed design

Problem statement

The stage Job still runs the old stage engine until #6814 splits it. After the split, the old engine has no use in a stage Job. But fix-plan, the golden-set evals and the round mode still call it. This change deletes the old engine and moves the stage golden set to the stock Coder agent. It deletes fix-plan and the verify golden set. It refuses the modes that would run the old planner.

Acceptance criteria

Requirement: stage-agent-runs-stock-coder

The stage agent SHALL run on the stock Coder agent with RequireVerification and SHALL offer no custom stage tool.

Scenario: Stage agent toolset

  • WHEN the test tests/roadmap/stage/test_roadmap_stage_agent.py builds the agent of a stage run
  • THEN the test finds Coder with the stock capabilities and RequireVerification. The tools offered are exactly the stock tools, with no delegate_task and no custom stage tool.

Requirement: custom-stage-engine-removed

The stage package MUST hold no stage_tools.py, stage_toolbox.py, stage_eval_compare.py, StageTools, ToolboxClient or gate_extension, and no tracked file SHALL import one of them.

Scenario: Ban on the old engine modules

  • WHEN the ban check that tests/invariants/test_source_tree.py runs walks the tracked files under src/ and tests/, apart from the helper that holds the ban
  • THEN the ban finds none of these six names: stage_tools.py, stage_toolbox.py, stage_eval_compare.py, StageTools, ToolboxClient and gate_extension. It also finds no file that imports one of them.

Requirement: phase-all-refused-with-job-item

The stage command MUST refuse the resolved phase all together with --job-item, including when --phase is omitted and defaults to all.

Scenario: Refused flag pair

  • WHEN a test runs devops roadmap stage --phase all --job-item 6846 --confirm and the same command with --phase omitted
  • THEN both commands exit non-zero and each message names the phase all, --job-item and the separate phases prepare, agent and publish.

Requirement: stage-round-mode-removed

The stage command MUST refuse a model run (--plan or --confirm) that names no --job-item, so that the old round planner is unreachable.

Scenario: Refused round mode

  • WHEN a test runs devops roadmap stage --confirm with no --job-item
  • THEN the command exits non-zero and its message names --job-item and the phases prepare, agent and publish.

Requirement: fix-plan-removed

The repository MUST hold no fix_plan row, no devops roadmap step fix-plan command and no steps/fix_plan.py.

Scenario: Fix-plan command gone

  • WHEN a test runs devops roadmap step fix-plan --item 6846
  • THEN the command exits non-zero as an unknown command. The ban in tests/invariants/test_source_tree.py finds no FixPlanRecordKey, no src/devops_cli/roadmap/steps/fix_plan.py and no fix_plan row in src/devops_cli/roadmap/run.py.

Requirement: verify-golden-set-removed

The repository MUST hold no devops roadmap eval verify command and no stage_verify_eval.py.

Scenario: Verify eval gone

  • WHEN a test runs devops roadmap eval verify
  • THEN the command exits non-zero as an unknown command, and the ban in tests/invariants/test_source_tree.py finds no src/devops_cli/roadmap/stage/stage_verify_eval.py.

Requirement: stage-golden-set-runs-on-coder

devops roadmap eval stage MUST run each case on the Coder agent with RequireVerification and MUST score the resulting plan with the existing plan-check gates.

Scenario: Stage golden-set agent

  • WHEN a test builds the golden-set run of devops roadmap eval stage
  • THEN the run builds Coder with RequireVerification, offers only the stock tools, and scores the plan with the existing stage-eval gates.

Requirement: Pending a person after the merge

A person MUST run the live stage Job of each phase and one devops roadmap eval stage run after the merge, and both MUST pass.

Scenario: Live proof after the merge

  • WHEN a person runs the live stage Job of prepare, agent and publish, and runs devops roadmap eval stage
  • THEN each phase of the Job passes and the eval command exits 0.

Existing Tool Considered

The alternatives check in the issue body records not-applicable for a refactor with no search and names no tool. The change keeps the Coder agent of pydantic-ai-harness that #6705 added. Coder lacks a custom stage tool and a model review pass. RequireVerification runs the three checks, and publish reruns them. The plan builds no replacement engine, so the cost to build, keep and fix one is zero tokens and zero elapsed time.

Key questions

  • Does the fix-plan row and devops roadmap step fix-plan move to the Coder agent, or are they deleted?: Delete them. The new stage agent and publish run no model review pass. A staged plan never gets verdict/fix-plan. The step calls the old planner's revise_plan and review. This item deletes that planner and review. (best practice) [sources: src/devops_cli/roadmap/steps/fix_plan.py, src/devops_cli/roadmap/run.py, src/devops_cli/roadmap/stage/stage_job_phases.py, tests/roadmap/stage/test_roadmap_stage_agent.py, tests/commands/test_roadmap_step_fix_plan.py]
    • Chosen: Delete fix-plan. The new design sets no verdict/fix-plan. The step calls the planner and review that this item deletes.
    • Rejected: Move fix-plan to the Coder agent. The new stage agent has no model review pass. The label that selects the step never appears. A moved step needs a new producer, which is outside this item.
    • Rejected: Keep fix-plan on the old engine. The engine it calls goes. The step would keep the code that this item removes.
  • Do the golden-set evals move to the Coder agent, or are they deleted?: Move the stage golden set to Coder and delete the verify golden set. The stage set measures the stage prompt and checks. The new agent has a new prompt and three checks. The verify set scores a review pass that the new design does not run. Delete stage_eval_compare.py with the toolbox. (best practice) [sources: src/devops_cli/roadmap/stage/stage_eval_run.py, src/devops_cli/roadmap/stage/stage_verify_eval.py, src/devops_cli/roadmap/stage/stage_eval_compare.py, tests/roadmap/stage/test_roadmap_stage_agent.py]
    • Chosen: Move the stage set to Coder and delete the verify set. The stage set measures the stage prompt and checks, which this change keeps. The verify set scores a review pass that no longer exists.
    • Rejected: Move both golden sets to Coder. The verify set measures the old review pass. It has nothing to score.
    • Rejected: Delete both golden sets. The stage set is the measure of a stage prompt or check change. The project keeps that measure.
    • Rejected: Keep both on the old engine. The old engine goes. The modules would keep the code that this item removes.
  • How does the code prove that the old stage engine is gone?: Add a ban check that tests/invariants/test_source_tree.py runs, with its helper in tests/gate/tree_checks/source_tree.py. The ban walks the tracked files under src/ and tests/, apart from the helper. It fails on six names: stage_tools.py, stage_toolbox.py, stage_eval_compare.py, StageTools, ToolboxClient and gate_extension. It also fails on an import of one of them. (best practice) [sources: tests/invariants/test_source_tree.py, tests/gate/tree_checks/source_tree.py, docs/TESTING.md]
    • Chosen: Ban in tests/invariants/test_source_tree.py. It holds each retired rule as a ban and the path rules over src/ and tests/.
    • Rejected: Ban in tests/invariants/test_architectural_invariants.py. Its subject is suppression ceilings and workflow permissions, not the source-tree layout.
    • Rejected: No test; the deletion shows in the diff. A later change can bring a module back with no failure.
    • Rejected: A grep in CI. The project runs its invariants as tests. A separate grep is a second gate.
  • How does the stage command refuse the modes that would still run the old planner?: Refuse them in _refuse_phase_options at the start of stage_cmd, before the store opens or a job item is read. Refuse the resolved phase all with --job-item, including the default phase. Refuse a --plan or --confirm run with no --job-item. The message names both flags and the phases prepare, agent and publish. refactor(k8s): run the stage Job as three containers #6814 must add --phase to the Job args that stage_submit.py builds. (best practice) [sources: src/devops_cli/commands/roadmap_jobs.py:534, src/devops_cli/commands/roadmap.py, src/devops_cli/roadmap/stage/stage_submit.py]
    • Chosen: Refuse in _refuse_phase_options before any work. The pair is refused before the store opens or a job item is read, so no work is lost. The same check covers the default phase and the round mode.
    • Rejected: Refuse inside the phase runner. The Job would start and hold the App key before the refusal.
    • Rejected: Keep the round mode and run the phases in one process. It rebuilds the kept-plan cache and the single-process flow that refactor(k8s): run the stage Job as three containers #6814 splits.
    • Rejected: Keep the round mode on a plain client with no toolbox. It keeps the gate returns, the gate extension and the schema retry. The old engine would stay.
  • Which items must be delivered before this one?: Only refactor(k8s): run the stage Job as three containers #6814. refactor(roadmap): the stage agent is stock Coder #6705 is delivered. stage_agent.py builds Coder with RequireVerification, and tests/roadmap/stage/test_roadmap_stage_agent.py checks it. refactor(k8s): run the stage Job as three containers #6814 is not live: CronJob roadmap-stage still runs --phase all in one container that holds the App key. The Service passes no --phase. [sources: src/devops_cli/roadmap/stage/stage_agent.py, tests/roadmap/stage/test_roadmap_stage_agent.py, k8s/devops/cronjob-stage.yaml, src/devops_cli/roadmap/stage/stage_submit.py]
  • Where does the live verification of the deletion go?: Keep it as the acceptance criterion Pending a person after the merge. After the merge and the deployment of refactor(k8s): run the stage Job as three containers #6814, a person runs the live stage Job of each phase. The person also runs one devops roadmap eval stage run. Both pass. No fix-plan run remains, because the step is deleted. No offline test shows the live Job. The deletion merges with its offline tests. (best practice) [sources: src/devops_cli/roadmap/stage/stage_submit.py, tests/roadmap/stage/test_roadmap_stage_agent.py]
    • Chosen: Post-merge live criterion. The live check needs the deployed split of refactor(k8s): run the stage Job as three containers #6814. The deletion can merge with offline tests.
    • Rejected: New deferred issue. The live check is a post-merge proof of this item, not a separate part of the code.
    • Rejected: Offline test. No offline test shows a live stage Job and the deployed split.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#6814

Watched files

A commit on the default branch that changes one of these files starts the next refine round.

  • k8s/devops/cronjob-stage.yaml
  • src/devops_cli/roadmap/stage/stage_submit.py

Activity

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

    @dan-petty
    OwnerAuthor
  3. added
    priority/p2-medium
    on Nov 23, 2026
  4. added a commit that references this issue on Nov 23, 2026
  5. devops-cli-service commented on Nov 23, 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.

  6. devops-cli-service commented on Nov 28, 2026

    @devops-cli-service
    Contributor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies and Watched files in the section Proposed design of the body.

  7. dan-petty commented on Nov 28, 2026

    @dan-petty
    OwnerAuthor

    Audit evidence: custom code against open tools, 2026-11-28, devops-cli at d0bc3dffa. The audit ranks this replacement first of 27. Its verdict is "replace, as decided" (ADR 0036, #6705).

    The custom engine

    • src/devops_cli/roadmap/stage/stage_tools.py (511 lines), with StageTools at :121.
    • stage_toolbox.py (358 lines), with ToolboxClient at :104 and the schema-violation retry at :320.
    • The gate_extension returns at stage.py:1576 and :2037-2049.
    • stage/ has 24,189 lines. tests/roadmap/stage has 2,018 tests.

    Breakage (bugs created after 2026-10-28)

    165 roadmap bugs name stage or plan. About 30 of them hit the engine mechanics:

    The other ~135 are plan-form rules. The publish checks keep them, as ADR 0036 decides.

    Tool facts (read 2026-11-28)

    • pydantic-ai-harness 0.75.0 (MIT) is pinned at pyproject.toml:41.
    • The repository pydantic/pydantic-ai-harness is archived. The package names github.com/pydantic/pydantic-ai as its source (MIT, v2.77.0, 2026-11-27), so the source is maintained.

    Risk: fix-plan and the golden-set runs still call the old engine (the "Bad" list of ADR 0036). #6814 must land first.

    Recommendation of the audit: add no feature to the old engine before this deletion. The owner direction of 2026-11-27 (close comment of #7489) rejects more custom code where an open tool solves the problem.

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

    @devops-cli-service
    Contributor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies and Watched files 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/mediumpriority/p2-mediumscope/roadmapsource/agentstatus/newtype/refactorvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions