Skip to content

refactor(roadmap): judge plan verify commands with the shared command gate #5204

Not planned

Description

@dan-petty

Problem or Motivation

Plan verify commands have their own program lists and rules in four places:

  • read_verification (implement_shell_policy.py:485-516);
  • the stage form gate (stage_form.py:65-89);
  • the plan reader (plan_read.py:355-379);
  • plan amendment (implement_amend.py:170-209).

The amendment refuses a ! git grep negative search that the stage gate accepts (implement_amend.py:181 against stage_form.py:65-68). The program list is a constant, and the configured lists of the command gate (#5201) do not drive it.

Proposed Solution & Architectural Design

Add the argv profile implement_verify to command_gate/profiles.py.

  • Its parse tier is shlex plus the rules of read_verification, as they are today: NUL, 2,000 characters, and the negative-search grammar.
  • Its list tier uses the same merged lists and argument models as implement_shell. It has no Jev tier.
  • stage_form, plan_read, plan_rewrite and implement_amend call judge(..., profile=implement_verify).
  • The convention rules stay where they are: the uv run devops form, the manifest form and NOT_IN_RUNNER.
  • Amendment accepts the negative search, as the stage gate does.

This item edits profiles.py and the plan modules only. It does not touch gate.py, which the Jev item of tracker #5199 changes.

Files: src/devops_cli/roadmap/command_gate/profiles.py, src/devops_cli/roadmap/implement/implement_shell_policy.py, src/devops_cli/roadmap/implement/implement_amend.py, src/devops_cli/roadmap/stage/stage_form.py, src/devops_cli/roadmap/plan_read.py, src/devops_cli/roadmap/plan_rewrite.py, tests/roadmap/command_gate/plan_verify_cases.json, tests/roadmap/command_gate/test_roadmap_command_gate_verify.py, tests/roadmap/implement/test_roadmap_implement_amend.py.

Target Subsystem

SDLC, Git & PR Governance (src/devops_cli/roadmap/, the plan and stage gates).

Existing Tool Considered

The shared command gate of #5201. This item moves code and builds no new part. Cost: about 0.4M tokens and half a day.

Acceptance Criteria

  1. tests/roadmap/command_gate/test_roadmap_command_gate_verify.py: ! git grep -n -e foo -- src gives run in profile implement_verify; git grep -O x gives refuse with the rule of read_verification.
  2. tests/roadmap/implement/test_roadmap_implement_amend.py: an amendment to a negative-search verify command is accepted.
  3. Real plan pull requests: tests/roadmap/command_gate/plan_verify_cases.json holds every verify command from tasks.md of the 9 open Service plan pull requests and of the merged Service plan pull requests since 2026-11-01 (author app/devops-cli-service, 203 pull requests in total). The test asserts that the shared gate gives the same verdict as read_verification at origin/main for each of them. The pull request lists each difference with its reason.
  4. uv run devops ci test tests/roadmap/command_gate tests/roadmap/stage tests/roadmap/implement passes.

Dependencies

Related

Source: #5199

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

Proposed design

Problem statement

Plan verify commands are judged by four separate call sites. They disagree on negative searches: the stage form accepts a ! git grep command, but the amendment refuses it. The program list is a constant, so the configured lists of the shared command gate #5201 do not drive the plan gates. This change adds the implement_verify profile and makes the four plan call sites use it. The convention rules stay in their current modules.

Acceptance criteria

Requirement: Verify profile accepts a negative search

The implement_verify profile SHALL accept a negative-search verify command that matches the read_verification grammar.

Scenario: Negative search runs

  • WHEN A test in tests/roadmap/command_gate/test_roadmap_command_gate_verify.py calls judge with profile implement_verify and the command ! git grep -n -e foo -- src.
  • THEN The judge returns run.

Requirement: Verify profile refuses a bad git command

The implement_verify profile SHALL refuse a git command that read_verification refuses.

Scenario: Refused git command

  • WHEN A test calls judge with profile implement_verify and the command git grep -O x.
  • THEN The judge returns refuse with the read_verification reason that git runs only as the negative search.

Requirement: Verify profile refuses a NUL word

The implement_verify profile SHALL refuse a verify command whose word holds a NUL byte, as read_verification does.

Scenario: Refused NUL word

  • WHEN A test calls judge with profile implement_verify and a command whose word holds a NUL byte.
  • THEN The judge returns refuse with the read_verification byte rule.

Requirement: Verify profile refuses an over-long command

The implement_verify profile SHALL refuse a verify command longer than 2,000 characters, as read_verification does.

Scenario: Refused long command

  • WHEN A test calls judge with profile implement_verify and a command whose words hold more than 2,000 characters in all.
  • THEN The judge returns refuse with the read_verification long-command rule.

Requirement: Verify profile reuses the shell lists

The implement_verify profile SHALL use the same merged lists and argument models as implement_shell.

Scenario: Same list tier

  • WHEN A test compares the list tier of implement_verify with the list tier of implement_shell.
  • THEN The lists and argument models are equal, and implement_verify has no Jev tier.

Requirement: Four plan call sites use the shared profile

The stage form, plan reader, plan rewrite and amendment SHALL judge verify commands with judge(..., profile=implement_verify).

Scenario: Each caller uses the profile

  • WHEN A test patches judge in stage_form, plan_read, plan_rewrite and implement_amend and sends a verify command to each.
  • THEN Each call records the implement_verify profile.

Requirement: Amendment accepts a negative search

The amendment SHALL accept a negative-search verify command that the stage form accepts.

Scenario: Amend to a negative search

  • WHEN A test in tests/roadmap/implement/test_roadmap_implement_amend.py amends a verify command to ! git grep -n -e foo -- src and adds a task whose verify is the same command.
  • THEN Both amendments are applied, not refused.

Requirement: NOT_IN_RUNNER still refuses

The stage content check SHALL still refuse a verify command that names a program of NOT_IN_RUNNER when Feasibility names no capability for it.

Scenario: Program not in runner

  • WHEN A test in tests/roadmap/stage/test_roadmap_stage_content.py sends a plan whose group verify is helm template k8s/devops and whose Feasibility names no capability.
  • THEN The stage content check returns a problem that names helm as a program that the runner cannot run.

Requirement: Stage form keeps the project form

The stage form SHALL keep the uv run devops form rule in the caller.

Scenario: Project form still refused

  • WHEN A test in tests/roadmap/stage/test_roadmap_stage_verify.py sends grep foo src/ as a group verify command.
  • THEN The stage form returns a problem that names the uv run devops form.

Requirement: Manifest form keeps its rule

The stage form SHALL keep the manifest verify form uv run devops ci test <path> in the caller.

Scenario: Manifest form still refused

  • WHEN A test in tests/roadmap/stage/test_roadmap_stage_manifest.py sends a manifest group whose verify is uv run devops ci test tests/other.py, a path outside the group.
  • THEN The stage form returns a problem that names the manifest verify form.

Requirement: Focused suites pass

The change SHALL pass the roadmap command gate, stage and implement test suites.

Scenario: Run the focused suites

  • WHEN The command uv run devops ci test tests/roadmap/command_gate tests/roadmap/stage tests/roadmap/implement runs.
  • THEN The command exits 0.

Existing Tool Considered

The alternatives check of 2026-11-22 records not-applicable for this refactor and names no tool; see the alternatives block in the issue body for the result. No external open tool is named for this internal refactor. The change reuses the shared command gate of #5201 and writes no new parser or list. Cost: about 0.4M tokens to build, about 30k tokens a month to keep and fix, and half a day of elapsed time.

Key questions

  • Which parse tier does the implement_verify profile use?: It uses shlex plus the read_verification rules: no NUL byte, at most 2,000 characters in all, and the negative-search grammar. It adds no parser. (best practice) [sources: src/devops_cli/roadmap/stage/stage_form.py:65]
    • Chosen: Reuse shlex and the read_verification rules. The rules already exist in read_verification, and one rule then decides the step and the plan gates.
    • Rejected: Add bashlex. The project already uses shlex, and bashlex gives no program list, argument model or negative-search grammar.
    • Rejected: Write a new parser. It duplicates the rules and can drift from the step.
    • Rejected: Use the implement_shell parse tier. The shell tier lacks the NUL, 2,000-character and negative-search rules.
  • Which list tier does implement_verify use?: It uses the same merged lists and argument models as implement_shell, so the configured lists of feat(roadmap): check shell commands with a parser and configured lists #5201 drive the plan gates. It has no Jev tier. (best practice) [sources: src/devops_cli/roadmap/implement/implement_amend.py]
    • Chosen: Reuse the implement_shell lists. The configured lists of feat(roadmap): check shell commands with a parser and configured lists #5201 then drive the plan gates, and one list decides the shell and the verify command.
    • Rejected: Keep the local program constant. The constant is the cause of the split behavior.
    • Rejected: Add a Jev tier. A plan verify command needs no Jev judgment.
  • Which plan modules call judge(..., profile=implement_verify)?: The stage form, plan reader, plan rewrite and amendment call it. (best practice) [sources: src/devops_cli/roadmap/stage/stage_form.py, src/devops_cli/roadmap/plan_read.py, src/devops_cli/roadmap/plan_rewrite.py, src/devops_cli/roadmap/implement/implement_amend.py]
    • Chosen: All four plan modules. The issue names four separate implementations, and one rule must decide every plan verify command.
    • Rejected: Only the stage form and amendment. The plan reader and rewrite keep their own rules.
    • Rejected: Only the amendment. The other three gates still disagree.
  • Does the amendment accept a negative-search verify command?: Yes. The amendment uses the shared profile in _judge_command and _judge_task, so it accepts the command that the stage form accepts. (best practice) [sources: src/devops_cli/roadmap/implement/implement_amend.py:170, src/devops_cli/roadmap/stage/stage_form.py:65]
    • Chosen: Accept through the shared gate. The stage form already accepts the command, and the two gates must agree.
    • Rejected: Keep the amendment refusal. It keeps the known difference between Gate E and Gate G.
  • Do the convention rules move into the implement_verify profile?: No. The uv run devops form and the manifest form stay in stage_form.py. The NOT_IN_RUNNER rule stays in the stage content check. (best practice) [sources: src/devops_cli/roadmap/stage/stage_form.py, src/devops_cli/roadmap/stage/stage_change.py]
    • Chosen: Keep them in the stage form and the stage content check. The form rules depend on the plan context, and the NOT_IN_RUNNER rule needs the Feasibility text.
    • Rejected: Move them into the profile. The profile would need plan context and would duplicate the stage form and the content check.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#6521, #5201

Activity

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

    @dan-petty
    OwnerAuthor
  4. added
    priority/p2-medium
    on Nov 12, 2026
  5. devops-cli-service commented on Nov 16, 2026

    @devops-cli-service
    Contributor

    Alternatives check: not-applicable

    Class: refactor. The check makes no search and no model call for an item of this class.

    Tool: none found

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

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

    @devops-cli-service
    Contributor

    Refine cannot set this item to Ready at 8ccd95a 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.

  7. dan-petty commented on Nov 20, 2026

    @dan-petty
    OwnerAuthor

    Frozen on 2026-11-20. The stage, implement and fix-checks jobs grade under 60%, so the owner rule asks for a re-architecture before more fixes inside the current design (tracker #6519). This item is incremental work on those jobs, so its Dependencies section now names #6521 first. Stage and implement leave this item while #6521 is open. When the experiments of #6519 decide, a person closes #6521 (this item can then continue) or closes this item as not planned.

  8. devops-cli-service commented on Nov 21, 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.

  9. dan-petty commented on Nov 30, 2026

    @dan-petty
    OwnerAuthor

    Triage under #6519 (owner instruction of 2026-11-30), before the hold #6521 closes. This item adds or extends a gate, refusal, screen, cap, limit, retry, result line, shell allowlist, tool catalog or plan-shape rule of the stage, implement or fix-checks job. #6519 found that 263 of about 900 issues in four weeks added such rules and none replaced the engine. Stage now runs on stock Coder (grade 60 on 30 graded attempts), where the agent reads the repository, runs the checks in its loop and has a real shell; implement follows (#6527). The code paths that this item names have also moved. If the failure class still shows in graded attempts, file a new item from that evidence. Closed as not planned; a person may reopen it.

  10. removed
    status/new
    on Nov 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/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