Skip to content

feat(roadmap): list moved plan paths in the stage comment #3309

Closed

Description

@dan-petty

Problem or Motivation

The plan in PR #3261 (for #3201) was staged on a base that main has since passed. Two of its facts were stale when I reviewed it:

  • It builds the title rule on staging_title. fix(roadmap): staging_title cuts the plan title with ... and title_problems refuses it #3249 changed staging_title so that it raises RoadmapStageError for a summary that does not fit, instead of cutting it.
  • It plans validate_change and StagedTree for a command that reads the pull request through the GitHub client. Both need a checkout (validate_change takes source, the checkout with the base specs; StagedTree takes the tracked files of a checkout). The Feasibility quotes the two signatures and does not draw this conclusion.

The first is a stale fact. The second is a precondition of a callee that the plan did not carry into its design. Both reached a reviewer, who had to find them.

Proposed Solution & Architectural Design

  1. When a plan PR is still a draft and main has changed a file that the plan names under Reads or Changes, the stage job (or a devops roadmap plan-check run, feat(roadmap): add a plan-check command for a plan pull request #3201) lists those files and the commits that touched them, so the reviewer sees what moved.
  2. In the stage prompt, ask for the preconditions of each function that the plan calls (the arguments that need a checkout, a client or a network), one line each in feasibility.
  3. Test with a plan that names stage_change.py after a commit changed it: the list names the file and the commit.

Target Subsystem

src/devops_cli/roadmap/stage.py, src/devops_cli/ai/tasks/roadmap_stage_change.md.

Source: #3261

Proposed design

Problem statement

A staged plan can rest on a base that main has moved past. The reviewer then reads stale facts about the files that the plan names. The stage job must list the named files that main changed after the base and the commits that touched them. The stage prompt must also ask for the preconditions of each function that the plan calls.

Acceptance criteria

Requirement: Named paths that moved

The stage job SHALL list each path that the plan names under Reads or Changes and that a commit on the default branch changed after the plan's base.

Scenario: A named plan path changes on main

  • WHEN The plan names src/devops_cli/roadmap/stage_change.py under Reads and a later commit on the default branch changes that file.
  • THEN The comment of the staged item names src/devops_cli/roadmap/stage_change.py and the commit that changed it.

Requirement: Unnamed paths stay out

The stage job MUST NOT list a path that the plan does not name under Reads or Changes.

Scenario: An unnamed path changes on main

  • WHEN A commit after the base changes a file that no group of the plan names under Reads or Changes.
  • THEN The comment of the staged item does not name that file.

Requirement: Commit order and detail

The stage job SHALL give the short hash and the subject of each commit that changed a listed path, in log order.

Scenario: Two commits change one named path

  • WHEN Two commits after the base change a path that the plan names under Changes.
  • THEN The comment lists the two short hashes and subjects under that path in log order.

Requirement: No moved paths

The stage job MUST add no moved-file section when no commit after the base changes a path that the plan names.

Scenario: The default branch has not moved a named path

  • WHEN No commit after the base changes a path that the plan names under Reads or Changes.
  • THEN The comment of the staged item has no moved-file section.

Requirement: Latest default branch

The stage job MUST fetch the default branch before it compares the plan's base with the default branch.

Scenario: The remote default branch advances

  • WHEN A remote commit changes a named path after the stage job fetched the base.
  • THEN The comment of the staged item lists that path and commit.

Requirement: Prompt asks for preconditions

The stage prompt SHALL ask for one feasibility line for each called function whose arguments need a checkout, a client or a network.

Scenario: The stage prompt loads

  • WHEN The stage job loads src/devops_cli/ai/tasks/roadmap_stage_change.md.
  • THEN The prompt text names a checkout, a client and a network as preconditions to state in feasibility.

Existing Tool Considered

No alternatives check has run. Git covers the need: git log --format=%h%x00%s --name-only .. -- lists the commits and files. Git lacks the parsing of the plan's Reads and Changes lists, so the stage job must collect those paths and render the section.

Key questions

  • Which command lists the files that main changed after the plan's base?: The stage job lists them in the staged item's comment. The plan-check command is a separate item (feat(roadmap): add a plan-check command for a plan pull request #3201) and is not a dependency. (best practice) [sources: src/devops_cli/roadmap/stage.py, openspec/changes/3201-add-a-plan-check-command-for/design.md]
  • Which commit is the base of the comparison?: The commit that the stage job fetched at the start of the run (StagePlan.sha). The job compares it with the latest default branch before it writes the comment. (best practice) [sources: src/devops_cli/roadmap/stage.py]
    • Chosen: Fetched base SHA. It is the commit that the plan read and the branch starts from.
    • Rejected: The pull request merge base. The stage job holds the fetched base SHA before it opens the pull request.
    • Rejected: The current default branch only. It gives no files and no commits.
  • How does the job find the files and commits?: It runs git log --format=%h%x00%s --name-only .. -- and keeps the entries for the plan's paths. (best practice) [sources: src/devops_cli/roadmap/clone_git.py, src/devops_cli/roadmap/stage.py]
    • Chosen: One git log over the paths. It gives the commits and their files in one local command.
    • Rejected: git diff --name-only then one git log for each file. It makes more calls and repeats the path filter.
    • Rejected: GitHub API. It adds a network call and a rate limit for data that the clone holds.
  • Which paths does the job compare?: It compares the union of reads and changes of every group in the final plan. It does not compare creates separately because changes holds each created path. (best practice) [sources: src/devops_cli/roadmap/stage.py, src/devops_cli/roadmap/stage_paths.py]
    • Chosen: reads and changes. The issue names these two lists, and they hold the files that the plan depends on and writes.
    • Rejected: reads only. It misses a changed path that the plan writes.
    • Rejected: reads, changes and creates. creates is a subset of changes, so it adds no path.
  • Where does the reviewer see the list?: In the comment of the staged item, under a moved-file heading. The draft pull request body stays the same. (best practice) [sources: src/devops_cli/roadmap/stage.py]
    • Chosen: Staged item comment. The stage job writes one comment that holds the plan record.
    • Rejected: Pull request body. The body is the squash message and has an 800-character limit.
    • Rejected: Stage plan report only. The reviewer reads the pull request, not the command output.
  • How does the stage prompt ask for preconditions?: It adds one rule to feasibility: give one line for each called function whose arguments need a checkout, a client or a network. (best practice) [sources: src/devops_cli/ai/tasks/roadmap_stage_change.md, src/devops_cli/roadmap/stage.py]
    • Chosen: Prompt rule. feasibility is a list of strings, and the model writes it from the prompt.
    • Rejected: Structured field for preconditions. It changes the reply schema and the validator for one prompt rule.
    • Rejected: Validator check on quoted signatures. The model can state a precondition without a signature, so the check would miss the need.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/feature
    scope/roadmap
    status/new
    value/medium
    effort/medium
    on Nov 3, 2026
  2. dan-petty commented on Nov 3, 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 feat prefix of the title gives the type.
    • Scope: scope/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P2-Medium. It reduces reviewer burden on stale plans but does not block a release or fix a breakage.
    • Value: Medium. Reviewers see which files moved and avoid approving a plan built on a stale base.
    • Effort: Medium. It needs a git diff between the base and main for named files, a commit list, and integration into the stage job or plan-check run.
    • Related: feat(roadmap): add a plan-check command for a plan pull request #3201, which asks for a different change. Both work on the plan-check system; #3201 is the umbrella command, the candidate adds a specific stale-file check to it.
  3. added
    priority/p2-medium
    on Nov 3, 2026
  4. added
    status/ready
    and removed
    status/new
    on Nov 3, 2026
  5. devops-cli-service commented on Nov 3, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 8e0a486 (see proposed design in issue body).

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

    @devops-cli-service
    Contributor

    Staged: branch feat/3309-a-staged-plan-lists-the-files, draft pull request #3330. The pull request plans the item and closes no issue.

    The task groups, with the tokens of the inputs of each step, for a budget of 40000 tokens:

    1. Find the commits that changed a named path after the base: 17362 tokens
    2. Write the moved paths in the comment of a staged item: 32514 tokens
    3. Ask the stage prompt for the preconditions of a callee: 6837 tokens
    4. Check the prompt rule and the changed code together: 19918 tokens

    The plan run made 1 model request(s), and used 72776 input tokens and 3703 output tokens. The model made no tool call.

    A model review of the plan found these points. They stop no draft, and a person judges them:

    • verify_form at group 3: The verify command uv run devops openspec check does not run the prompt edit of this group. It passes whatever the prompt text says. Evidence: ""verify": "uv run devops openspec check""
    • task_order at group 4: The test of the new prompt rule comes in group 4, after group 3 writes the rule. New behavior needs the test first. Evidence: "Add a test to tests/roadmap/test_roadmap_stage_prompt_rules.py that loads src/devops_cli/ai/tasks/roadmap_stage_change.md and asserts that its text names a checkout, a client and a network as preconditions of feasibility"
  7. added 2 commits that reference this issue on Nov 3, 2026
  8. removed
    status/ready
    on Nov 3, 2026
  9. 7 remaining items

  10. added
    status/in-review
    and removed
    status/in-progress
    on Nov 6, 2026
  11. devops-cli-service commented on Nov 6, 2026

    @devops-cli-service
    Contributor

    Pull request #3805 is ready for review. The checks passed.

    Spend: 214 model requests, 16191288 input tokens, 62074 output tokens.

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

    @devops-cli-service
    Contributor

    The runner Job devops-cli-runner-20261106-160604-988c ended: succeeded.
    Image digest: sha256:dd3a72d4b948128440e588e182561df145a3f88b28a28ab87ac91515910a3fc2

    The last lines of its log:

    Tool call: shell, started: uv run python -c __import__("pathlib").Path(".data/agent/scratch").mkdir(parents=<masked>
    Tool call: shell, program uv, ok.
    Tool call: write_file, ok.
    Tool call: shell, started: uv run python .data/agent/scratch/run_in_runner.py tests/roadmap/test_roadmap_implement_records.py
    Tool call: shell, program uv, ok.
    Tool call: grep, ok.
    Tool call: grep, ok.
    Tool call: edit_file, ok.
    Tool call: shell, started: uv run python .data/agent/scratch/run_in_runner.py tests/roadmap/test_roadmap_implement_records.py
    Tool call: shell, program uv, ok.
    Tool call: shell, started: uv run devops ci test tests/roadmap/test_roadmap_implement_records.py
    Tool call: shell, program uv, ok.
    Tool call: shell, started: uv run devops ci test tests/roadmap/test_roadmap_stage_moved.py ...
    Tool call: shell, started: uv run ruff check tests/roadmap/test_roadmap_implement_records.py
    Tool call: shell, program uv, ok.
    Tool call: shell, program uv, ok.
    Tool call: shell, started: git diff
    Tool call: shell, started: git status --short
    Tool call: shell, program git, ok.
    Tool call: shell, program git, ok.
    Tool call: shell, started: git clean -n -X .data/agent/scratch
    Tool call: shell, program git, ok.
    Tool call: shell, started: uv run python -c __import__("pathlib").Path(".data/agent/scratch/run_in_runner.py").unlink(missing_ok=<masked>
    Tool call: shell, program uv, ok.
    Tool call: edit_file, ok.
    Tool call: write_file, ok.
    Tool call: shell, started: uv run python .data/agent/scratch/run_in_runner.py tests/roadmap/test_roadmap_implement_records.py
    Tool call: shell, started: uv run ruff check tests/roadmap/test_roadmap_implement_records.py
    Tool call: shell, program uv, ok.
    Tool call: shell, program uv, ok.
    Tool call: shell, started: uv run python -c __import__("pathlib").Path(".data/agent/scratch/run_in_runner.py").unlink(missing_ok=<masked>
    Tool call: shell, started: uv run devops ci test tests/roadmap/test_roadmap_implement_records.py
    Tool call: shell, program uv, ok.
    Tool call: shell, program uv, ok.
    Tool call: shell, started: git status --short
    Tool call: shell, started: git diff --stat
    Tool call: shell, program git, ok.
    Tool call: shell, program git, ok.
    ✓ Took 1 item(s) to a ready pull request, stopped 0.
    Elapsed: 52m 26s
    
  13. removed
    owner/service
    on Nov 6, 2026
  14. removed
    status/in-review
    on Nov 6, 2026
  15. devops-cli-service commented on Nov 6, 2026

    @devops-cli-service
    Contributor
  16. devops-cli-service commented on Nov 6, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-06 19:47 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/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions